channels.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. require_once(dirname(dirname(__FILE__))."/header.php");
  3. function channel_flag_name($flag){
  4. switch($flag){
  5. case 'v':$name=__('Voice');break;
  6. case 'V':$name=__('Automatic voice');break;
  7. case 'h':$name=__('Halfop');break;
  8. case 'H':$name=__('Automatic Halfop');break;
  9. case 'o':$name=__('Op');break;
  10. case 'O':$name=__('Automatic Op');break;
  11. case 'a':$name=__('Admin');break;
  12. case 'q':$name=__('Owner');break;
  13. case 's':$name=__('Set');break;
  14. case 'i':$name=__('Invite/Getkey');break;
  15. case 'r':$name=__('Kick/Ban');break;
  16. case 'R':$name=__('Recover/Clear');break;
  17. case 'f':$name=__('Modify access lists');break;
  18. case 't':$name=__('Topic');break;
  19. case 'A':$name=__('View access lists');break;
  20. case 'F':$name=__('Founder');break;
  21. case 'b':$name=__('Banned');break;
  22. default:$name=$flag;
  23. }
  24. return $name;
  25. }
  26. function channel_flag_obj($flag,$selected=false){
  27. $ret = array(
  28. 'value'=>$flag,
  29. 'label'=>channel_flag_name($flag)
  30. );
  31. if($selected){
  32. $ret['attributes'] = array(
  33. 'selected'=>'selected'
  34. );
  35. }
  36. return $ret;
  37. }
  38. function sanitize_channel_flags($flags){
  39. $possible_flags = array('v','V','h','H','o','O','a','q','s','i','r','R','f','t','A','F','b');
  40. foreach($possible_flags as $k => $flag){
  41. if(!isset($flags[$flag])){
  42. $flags[$flag] = false;
  43. }else{
  44. if($flags[$flag] == 'on'){
  45. $flags[$flag] = true;
  46. }else{
  47. $flags[$flag] = false;
  48. }
  49. }
  50. }
  51. return $flags;
  52. }
  53. ?>