1<?php 2/** 3 * ACL administration functions 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Andreas Gohr <andi@splitbrain.org> 7 * @author Anika Henke <anika@selfthinker.org> (concepts) 8 * @author Frank Schubert <frank@schokilade.de> (old version) 9 */ 10// must be run within Dokuwiki 11if(!defined('DOKU_INC')) die(); 12 13if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 14require_once(DOKU_PLUGIN.'admin.php'); 15 16/** 17 * All DokuWiki plugins to extend the admin function 18 * need to inherit from this class 19 */ 20class admin_plugin_acl extends DokuWiki_Admin_Plugin { 21 var $acl = null; 22 var $ns = null; 23 var $who = ''; 24 var $usersgroups = array(); 25 var $specials = array(); 26 27 /** 28 * return some info 29 */ 30 function getInfo(){ 31 return array( 32 'author' => 'Andreas Gohr', 33 'email' => 'andi@splitbrain.org', 34 'date' => '2009-08-07', 35 'name' => 'ACL Manager', 36 'desc' => 'Manage Page Access Control Lists', 37 'url' => 'http://dokuwiki.org/plugin:acl', 38 ); 39 } 40 41 /** 42 * return prompt for admin menu 43 */ 44 function getMenuText($language) { 45 return $this->getLang('admin_acl'); 46 } 47 48 /** 49 * return sort order for position in admin menu 50 */ 51 function getMenuSort() { 52 return 1; 53 } 54 55 /** 56 * handle user request 57 * 58 * Initializes internal vars and handles modifications 59 * 60 * @author Andreas Gohr <andi@splitbrain.org> 61 */ 62 function handle() { 63 global $AUTH_ACL; 64 global $ID; 65 66 // fresh 1:1 copy without replacements 67 $AUTH_ACL = file(DOKU_CONF.'acl.auth.php'); 68 69 // namespace given? 70 if($_REQUEST['ns'] == '*'){ 71 $this->ns = '*'; 72 }else{ 73 $this->ns = cleanID($_REQUEST['ns']); 74 } 75 76 // user or group choosen? 77 $who = trim($_REQUEST['acl_w']); 78 if($_REQUEST['acl_t'] == '__g__' && $who){ 79 $this->who = '@'.ltrim($who,'@'); 80 }elseif($_REQUEST['acl_t'] == '__u__' && $who){ 81 $this->who = ltrim($who,'@'); 82 }elseif($_REQUEST['acl_t'] && 83 $_REQUEST['acl_t'] != '__u__' && 84 $_REQUEST['acl_t'] != '__g__'){ 85 $this->who = $_REQUEST['acl_t']; 86 }elseif($who){ 87 $this->who = $who; 88 } 89 90 // handle modifications 91 if(isset($_REQUEST['cmd'])){ 92 // scope for modifications 93 if($this->ns){ 94 if($this->ns == '*'){ 95 $scope = '*'; 96 }else{ 97 $scope = $this->ns.':*'; 98 } 99 }else{ 100 $scope = $ID; 101 } 102 103 if(isset($_REQUEST['cmd']['save']) && $scope && $this->who && isset($_REQUEST['acl'])){ 104 // handle additions or single modifications 105 $this->_acl_del($scope, $this->who); 106 $this->_acl_add($scope, $this->who, (int) $_REQUEST['acl']); 107 }elseif(isset($_REQUEST['cmd']['del']) && $scope && $this->who){ 108 // handle single deletions 109 $this->_acl_del($scope, $this->who); 110 }elseif(isset($_REQUEST['cmd']['update'])){ 111 // handle update of the whole file 112 foreach((array) $_REQUEST['del'] as $where => $names){ 113 // remove all rules marked for deletion 114 foreach($names as $who) 115 unset($_REQUEST['acl'][$where][$who]); 116 } 117 // prepare lines 118 $lines = array(); 119 // keep header 120 foreach($AUTH_ACL as $line){ 121 if($line{0} == '#'){ 122 $lines[] = $line; 123 }else{ 124 break; 125 } 126 } 127 // re-add all rules 128 foreach((array) $_REQUEST['acl'] as $where => $opt){ 129 foreach($opt as $who => $perm){ 130 $who = auth_nameencode($who,true); 131 $lines[] = "$where\t$who\t$perm\n"; 132 } 133 } 134 // save it 135 io_saveFile(DOKU_CONF.'acl.auth.php', join('',$lines)); 136 } 137 138 // reload ACL config 139 $AUTH_ACL = file(DOKU_CONF.'acl.auth.php'); 140 } 141 142 // initialize ACL array 143 $this->_init_acl_config(); 144 } 145 146 /** 147 * ACL Output function 148 * 149 * print a table with all significant permissions for the 150 * current id 151 * 152 * @author Frank Schubert <frank@schokilade.de> 153 * @author Andreas Gohr <andi@splitbrain.org> 154 */ 155 function html() { 156 global $ID; 157 158 echo '<div id="acl_manager">'.NL; 159 echo '<h1>'.$this->getLang('admin_acl').'</h1>'.NL; 160 echo '<div class="level1">'.NL; 161 162 echo '<div id="acl__tree">'.NL; 163 $this->_html_explorer($_REQUEST['ns']); 164 echo '</div>'.NL; 165 166 echo '<div id="acl__detail">'.NL; 167 $this->_html_detail(); 168 echo '</div>'.NL; 169 echo '</div>'.NL; 170 171 echo '<div class="clearer"></div>'; 172 echo '<h2>'.$this->getLang('current').'</h2>'.NL; 173 echo '<div class="level2">'.NL; 174 $this->_html_table(); 175 echo '</div>'.NL; 176 177 echo '<div class="footnotes"><div class="fn">'.NL; 178 echo '<sup><a id="fn__1" class="fn_bot" name="fn__1" href="#fnt__1">1)</a></sup>'.NL; 179 echo $this->getLang('p_include'); 180 echo '</div></div>'; 181 182 echo '</div>'.NL; 183 } 184 185 /** 186 * returns array with set options for building links 187 * 188 * @author Andreas Gohr <andi@splitbrain.org> 189 */ 190 function _get_opts($addopts=null){ 191 global $ID; 192 $opts = array( 193 'do'=>'admin', 194 'page'=>'acl', 195 ); 196 if($this->ns) $opts['ns'] = $this->ns; 197 if($this->who) $opts['acl_w'] = $this->who; 198 199 if(is_null($addopts)) return $opts; 200 return array_merge($opts, $addopts); 201 } 202 203 /** 204 * Display a tree menu to select a page or namespace 205 * 206 * @author Andreas Gohr <andi@splitbrain.org> 207 */ 208 function _html_explorer(){ 209 require_once(DOKU_INC.'inc/search.php'); 210 global $conf; 211 global $ID; 212 global $lang; 213 214 $dir = $conf['datadir']; 215 $ns = $this->ns; 216 if(empty($ns)){ 217 $ns = dirname(str_replace(':','/',$ID)); 218 if($ns == '.') $ns =''; 219 }elseif($ns == '*'){ 220 $ns =''; 221 } 222 $ns = utf8_encodeFN(str_replace(':','/',$ns)); 223 224 $data = $this->_get_tree($ns); 225 226 // wrap a list with the root level around the other namespaces 227 $item = array( 'level' => 0, 'id' => '*', 'type' => 'd', 228 'open' =>'true', 'label' => '['.$lang['mediaroot'].']'); 229 230 echo '<ul class="acltree">'; 231 echo $this->_html_li_acl($item); 232 echo '<div class="li">'; 233 echo $this->_html_list_acl($item); 234 echo '</div>'; 235 echo html_buildlist($data,'acl', 236 array($this,'_html_list_acl'), 237 array($this,'_html_li_acl')); 238 echo '</li>'; 239 echo '</ul>'; 240 241 } 242 243 /** 244 * get a combined list of media and page files 245 * 246 * @param string $folder an already converted filesystem folder of the current namespace 247 * @param string $limit limit the search to this folder 248 */ 249 function _get_tree($folder,$limit=''){ 250 global $conf; 251 252 // read tree structure from pages and media 253 $data = array(); 254 search($data,$conf['datadir'],'search_index',array('ns' => $folder),$limit); 255 $media = array(); 256 search($media,$conf['mediadir'],'search_index',array('ns' => $folder, 'nofiles' => true),$limit); 257 $data = array_merge($data,$media); 258 unset($media); 259 260 // combine by sorting and removing duplicates 261 usort($data,array($this,'_tree_sort')); 262 $count = count($data); 263 if($count>0) for($i=1; $i<$count; $i++){ 264 if($data[$i]['type'] == 'f') break; // namespaces come first, we're done 265 if($data[$i-1]['id'] == $data[$i]['id']) unset($data[$i]); 266 } 267 return $data; 268 } 269 270 /** 271 * usort callback 272 * 273 * Sorts the combined trees of media and page files 274 */ 275 function _tree_sort($a,$b){ 276 if($a['type'] == 'd' && $b['type'] == 'f'){ 277 return -1; 278 }elseif($a['type'] == 'f' && $b['type'] == 'd'){ 279 return 1; 280 }else{ 281 return strcmp($a['id'],$b['id']); 282 } 283 } 284 285 /** 286 * Display the current ACL for selected where/who combination with 287 * selectors and modification form 288 * 289 * @author Andreas Gohr <andi@splitbrain.org> 290 */ 291 function _html_detail(){ 292 global $conf; 293 global $ID; 294 295 echo '<form action="'.wl().'" method="post" accept-charset="utf-8"><div class="no">'.NL; 296 297 echo '<div id="acl__user">'; 298 echo $this->getLang('acl_perms').' '; 299 $inl = $this->_html_select(); 300 echo '<input type="text" name="acl_w" class="edit" value="'.(($inl)?'':hsc(ltrim($this->who,'@'))).'" />'.NL; 301 echo '<input type="submit" value="'.$this->getLang('btn_select').'" class="button" />'.NL; 302 echo '</div>'.NL; 303 304 echo '<div id="acl__info">'; 305 $this->_html_info(); 306 echo '</div>'; 307 308 echo '<input type="hidden" name="ns" value="'.hsc($this->ns).'" />'.NL; 309 echo '<input type="hidden" name="id" value="'.hsc($ID).'" />'.NL; 310 echo '<input type="hidden" name="do" value="admin" />'.NL; 311 echo '<input type="hidden" name="page" value="acl" />'.NL; 312 echo '</div></form>'.NL; 313 } 314 315 /** 316 * Print infos and editor 317 */ 318 function _html_info(){ 319 global $ID; 320 321 if($this->who){ 322 $current = $this->_get_exact_perm(); 323 324 // explain current permissions 325 $this->_html_explain($current); 326 // load editor 327 $this->_html_acleditor($current); 328 }else{ 329 echo '<p>'; 330 if($this->ns){ 331 printf($this->getLang('p_choose_ns'),hsc($this->ns)); 332 }else{ 333 printf($this->getLang('p_choose_id'),hsc($ID)); 334 } 335 echo '</p>'; 336 337 echo $this->locale_xhtml('help'); 338 } 339 } 340 341 /** 342 * Display the ACL editor 343 * 344 * @author Andreas Gohr <andi@splitbrain.org> 345 */ 346 function _html_acleditor($current){ 347 global $lang; 348 349 echo '<fieldset>'; 350 if(is_null($current)){ 351 echo '<legend>'.$this->getLang('acl_new').'</legend>'; 352 }else{ 353 echo '<legend>'.$this->getLang('acl_mod').'</legend>'; 354 } 355 356 357 echo $this->_html_checkboxes($current,empty($this->ns),'acl'); 358 359 if(is_null($current)){ 360 echo '<input type="submit" name="cmd[save]" class="button" value="'.$lang['btn_save'].'" />'.NL; 361 }else{ 362 echo '<input type="submit" name="cmd[save]" class="button" value="'.$lang['btn_update'].'" />'.NL; 363 echo '<input type="submit" name="cmd[del]" class="button" value="'.$lang['btn_delete'].'" />'.NL; 364 } 365 366 echo '</fieldset>'; 367 } 368 369 /** 370 * Explain the currently set permissions in plain english/$lang 371 * 372 * @author Andreas Gohr <andi@splitbrain.org> 373 */ 374 function _html_explain($current){ 375 global $ID; 376 global $auth; 377 378 $who = $this->who; 379 $ns = $this->ns; 380 381 // prepare where to check 382 if($ns){ 383 if($ns == '*'){ 384 $check='*'; 385 }else{ 386 $check=$ns.':*'; 387 } 388 }else{ 389 $check = $ID; 390 } 391 392 // prepare who to check 393 if($who{0} == '@'){ 394 $user = ''; 395 $groups = array(ltrim($who,'@')); 396 }else{ 397 $user = auth_nameencode($who); 398 $info = $auth->getUserData($user); 399 if($info === false){ 400 $groups = array(); 401 }else{ 402 $groups = $info['grps']; 403 } 404 } 405 406 // check the permissions 407 $perm = auth_aclcheck($check,$user,$groups); 408 409 // build array of named permissions 410 $names = array(); 411 if($perm){ 412 if($ns){ 413 if($perm >= AUTH_DELETE) $names[] = $this->getLang('acl_perm16'); 414 if($perm >= AUTH_UPLOAD) $names[] = $this->getLang('acl_perm8'); 415 if($perm >= AUTH_CREATE) $names[] = $this->getLang('acl_perm4'); 416 } 417 if($perm >= AUTH_EDIT) $names[] = $this->getLang('acl_perm2'); 418 if($perm >= AUTH_READ) $names[] = $this->getLang('acl_perm1'); 419 $names = array_reverse($names); 420 }else{ 421 $names[] = $this->getLang('acl_perm0'); 422 } 423 424 // print permission explanation 425 echo '<p>'; 426 if($user){ 427 if($ns){ 428 printf($this->getLang('p_user_ns'),hsc($who),hsc($ns),join(', ',$names)); 429 }else{ 430 printf($this->getLang('p_user_id'),hsc($who),hsc($ID),join(', ',$names)); 431 } 432 }else{ 433 if($ns){ 434 printf($this->getLang('p_group_ns'),hsc(ltrim($who,'@')),hsc($ns),join(', ',$names)); 435 }else{ 436 printf($this->getLang('p_group_id'),hsc(ltrim($who,'@')),hsc($ID),join(', ',$names)); 437 } 438 } 439 echo '</p>'; 440 441 // add note if admin 442 if($perm == AUTH_ADMIN){ 443 echo '<p>'.$this->getLang('p_isadmin').'</p>'; 444 }elseif(is_null($current)){ 445 echo '<p>'.$this->getLang('p_inherited').'</p>'; 446 } 447 } 448 449 450 /** 451 * Item formatter for the tree view 452 * 453 * User function for html_buildlist() 454 * 455 * @author Andreas Gohr <andi@splitbrain.org> 456 */ 457 function _html_list_acl($item){ 458 global $ID; 459 $ret = ''; 460 // what to display 461 if($item['label']){ 462 $base = $item['label']; 463 }else{ 464 $base = ':'.$item['id']; 465 $base = substr($base,strrpos($base,':')+1); 466 } 467 468 // highlight? 469 if( ($item['type']=='d' && $item['id'] == $this->ns) || 470 ($item['type']!='d' && $item['id'] == $ID)) $cl = ' cur'; 471 472 // namespace or page? 473 if($item['type']=='d'){ 474 if($item['open']){ 475 $img = DOKU_BASE.'lib/images/minus.gif'; 476 $alt = '−'; 477 }else{ 478 $img = DOKU_BASE.'lib/images/plus.gif'; 479 $alt = '+'; 480 } 481 $ret .= '<img src="'.$img.'" alt="'.$alt.'" />'; 482 $ret .= '<a href="'.wl('',$this->_get_opts(array('ns'=>$item['id']))).'" class="idx_dir'.$cl.'">'; 483 $ret .= $base; 484 $ret .= '</a>'; 485 }else{ 486 $ret .= '<a href="'.wl('',$this->_get_opts(array('id'=>$item['id'],'ns'=>''))).'" class="wikilink1'.$cl.'">'; 487 $ret .= noNS($item['id']); 488 $ret .= '</a>'; 489 } 490 return $ret; 491 } 492 493 494 function _html_li_acl($item){ 495 return '<li class="level'.$item['level'].'">'; 496 } 497 498 499 /** 500 * Get current ACL settings as multidim array 501 * 502 * @author Andreas Gohr <andi@splitbrain.org> 503 */ 504 function _init_acl_config(){ 505 global $AUTH_ACL; 506 global $conf; 507 $acl_config=array(); 508 $usersgroups = array(); 509 510 // get special users and groups 511 $this->specials[] = '@ALL'; 512 $this->specials[] = '@'.$conf['defaultgroup']; 513 if($conf['manager'] != '!!not set!!'){ 514 $this->specials = array_merge($this->specials, 515 array_map('trim', 516 explode(',',$conf['manager']))); 517 } 518 $this->specials = array_filter($this->specials); 519 $this->specials = array_unique($this->specials); 520 sort($this->specials); 521 522 foreach($AUTH_ACL as $line){ 523 $line = trim(preg_replace('/#.*$/','',$line)); //ignore comments 524 if(!$line) continue; 525 526 $acl = preg_split('/\s+/',$line); 527 //0 is pagename, 1 is user, 2 is acl 528 529 $acl[1] = rawurldecode($acl[1]); 530 $acl_config[$acl[0]][$acl[1]] = $acl[2]; 531 532 // store non-special users and groups for later selection dialog 533 $ug = $acl[1]; 534 if(in_array($ug,$this->specials)) continue; 535 $usersgroups[] = $ug; 536 } 537 538 $usersgroups = array_unique($usersgroups); 539 sort($usersgroups); 540 ksort($acl_config); 541 542 $this->acl = $acl_config; 543 $this->usersgroups = $usersgroups; 544 } 545 546 /** 547 * Display all currently set permissions in a table 548 * 549 * @author Andreas Gohr <andi@splitbrain.org> 550 */ 551 function _html_table(){ 552 global $lang; 553 global $ID; 554 555 echo '<form action="'.wl().'" method="post" accept-charset="utf-8"><div class="no">'.NL; 556 if($this->ns){ 557 echo '<input type="hidden" name="ns" value="'.hsc($this->ns).'" />'.NL; 558 }else{ 559 echo '<input type="hidden" name="id" value="'.hsc($ID).'" />'.NL; 560 } 561 echo '<input type="hidden" name="acl_w" value="'.hsc($this->who).'" />'.NL; 562 echo '<input type="hidden" name="do" value="admin" />'.NL; 563 echo '<input type="hidden" name="page" value="acl" />'.NL; 564 echo '<table class="inline">'; 565 echo '<tr>'; 566 echo '<th>'.$this->getLang('where').'</th>'; 567 echo '<th>'.$this->getLang('who').'</th>'; 568 echo '<th>'.$this->getLang('perm').'<sup><a id="fnt__1" class="fn_top" name="fnt__1" href="#fn__1">1)</a></sup></th>'; 569 echo '<th>'.$lang['btn_delete'].'</th>'; 570 echo '</tr>'; 571 foreach($this->acl as $where => $set){ 572 foreach($set as $who => $perm){ 573 echo '<tr>'; 574 echo '<td>'; 575 if(substr($where,-1) == '*'){ 576 echo '<span class="aclns">'.hsc($where).'</span>'; 577 $ispage = false; 578 }else{ 579 echo '<span class="aclpage">'.hsc($where).'</span>'; 580 $ispage = true; 581 } 582 echo '</td>'; 583 584 echo '<td>'; 585 if($who{0} == '@'){ 586 echo '<span class="aclgroup">'.hsc($who).'</span>'; 587 }else{ 588 echo '<span class="acluser">'.hsc($who).'</span>'; 589 } 590 echo '</td>'; 591 592 echo '<td>'; 593 echo $this->_html_checkboxes($perm,$ispage,'acl['.$where.']['.$who.']'); 594 echo '</td>'; 595 596 echo '<td align="center">'; 597 echo '<input type="checkbox" name="del['.hsc($where).'][]" value="'.hsc($who).'" />'; 598 echo '</td>'; 599 echo '</tr>'; 600 } 601 } 602 603 echo '<tr>'; 604 echo '<th align="right" colspan="4">'; 605 echo '<input type="submit" value="'.$lang['btn_update'].'" name="cmd[update]" class="button" />'; 606 echo '</th>'; 607 echo '</tr>'; 608 echo '</table>'; 609 echo '</div></form>'.NL; 610 } 611 612 613 /** 614 * Returns the permission which were set for exactly the given user/group 615 * and page/namespace. Returns null if no exact match is available 616 * 617 * @author Andreas Gohr <andi@splitbrain.org> 618 */ 619 function _get_exact_perm(){ 620 global $ID; 621 if($this->ns){ 622 if($this->ns == '*'){ 623 $check = '*'; 624 }else{ 625 $check = $this->ns.':*'; 626 } 627 }else{ 628 $check = $ID; 629 } 630 631 if(isset($this->acl[$check][$this->who])){ 632 return $this->acl[$check][$this->who]; 633 }else{ 634 return null; 635 } 636 } 637 638 /** 639 * adds new acl-entry to conf/acl.auth.php 640 * 641 * @author Frank Schubert <frank@schokilade.de> 642 */ 643 function _acl_add($acl_scope, $acl_user, $acl_level){ 644 $acl_config = file_get_contents(DOKU_CONF.'acl.auth.php'); 645 $acl_user = auth_nameencode($acl_user,true); 646 647 // max level for pagenames is edit 648 if(strpos($acl_scope,'*') === false) { 649 if($acl_level > AUTH_EDIT) $acl_level = AUTH_EDIT; 650 } 651 652 653 $new_acl = "$acl_scope\t$acl_user\t$acl_level\n"; 654 655 $new_config = $acl_config.$new_acl; 656 657 return io_saveFile(DOKU_CONF.'acl.auth.php', $new_config); 658 } 659 660 /** 661 * remove acl-entry from conf/acl.auth.php 662 * 663 * @author Frank Schubert <frank@schokilade.de> 664 */ 665 function _acl_del($acl_scope, $acl_user){ 666 $acl_config = file(DOKU_CONF.'acl.auth.php'); 667 $acl_user = auth_nameencode($acl_user,true); 668 669 $acl_pattern = '^'.preg_quote($acl_scope,'/').'\s+'.$acl_user.'\s+[0-8].*$'; 670 671 // save all non!-matching 672 $new_config = preg_grep("/$acl_pattern/", $acl_config, PREG_GREP_INVERT); 673 674 return io_saveFile(DOKU_CONF.'acl.auth.php', join('',$new_config)); 675 } 676 677 /** 678 * print the permission radio boxes 679 * 680 * @author Frank Schubert <frank@schokilade.de> 681 * @author Andreas Gohr <andi@splitbrain.org> 682 */ 683 function _html_checkboxes($setperm,$ispage,$name){ 684 global $lang; 685 686 static $label = 0; //number labels 687 $ret = ''; 688 689 if($ispage && $setperm > AUTH_EDIT) $perm = AUTH_EDIT; 690 691 foreach(array(AUTH_NONE,AUTH_READ,AUTH_EDIT,AUTH_CREATE,AUTH_UPLOAD,AUTH_DELETE) as $perm){ 692 $label += 1; 693 694 //general checkbox attributes 695 $atts = array( 'type' => 'radio', 696 'id' => 'pbox'.$label, 697 'name' => $name, 698 'value' => $perm ); 699 //dynamic attributes 700 if(!is_null($setperm) && $setperm == $perm) $atts['checked'] = 'checked'; 701 if($ispage && $perm > AUTH_EDIT){ 702 $atts['disabled'] = 'disabled'; 703 $class = ' class="disabled"'; 704 }else{ 705 $class = ''; 706 } 707 708 //build code 709 $ret .= '<label for="pbox'.$label.'" title="'.$this->getLang('acl_perm'.$perm).'"'.$class.'>'; 710 $ret .= '<input '.html_attbuild($atts).' /> '; 711 $ret .= $this->getLang('acl_perm'.$perm); 712 $ret .= '</label>'.NL; 713 } 714 return $ret; 715 } 716 717 /** 718 * Print a user/group selector (reusing already used users and groups) 719 * 720 * @author Andreas Gohr <andi@splitbrain.org> 721 */ 722 function _html_select(){ 723 global $conf; 724 $inlist = false; 725 726 if($this->who && 727 !in_array($this->who,$this->usersgroups) && 728 !in_array($this->who,$this->specials)){ 729 730 if($this->who{0} == '@'){ 731 $gsel = ' selected="selected"'; 732 }else{ 733 $usel = ' selected="selected"'; 734 } 735 }else{ 736 $usel = ''; 737 $gsel = ''; 738 $inlist = true; 739 } 740 741 742 echo '<select name="acl_t" class="edit">'.NL; 743 echo ' <option value="__g__" class="aclgroup"'.$gsel.'>'.$this->getLang('acl_group').':</option>'.NL; 744 echo ' <option value="__u__" class="acluser"'.$usel.'>'.$this->getLang('acl_user').':</option>'.NL; 745 echo ' <optgroup label=" ">'.NL; 746 foreach($this->specials as $ug){ 747 if($ug == $this->who){ 748 $sel = ' selected="selected"'; 749 $inlist = true; 750 }else{ 751 $sel = ''; 752 } 753 754 if($ug{0} == '@'){ 755 echo ' <option value="'.hsc($ug).'" class="aclgroup"'.$sel.'>'.hsc($ug).'</option>'.NL; 756 }else{ 757 echo ' <option value="'.hsc($ug).'" class="acluser"'.$sel.'>'.hsc($ug).'</option>'.NL; 758 } 759 } 760 echo ' </optgroup>'.NL; 761 echo ' <optgroup label=" ">'.NL; 762 foreach($this->usersgroups as $ug){ 763 if($ug == $this->who){ 764 $sel = ' selected="selected"'; 765 $inlist = true; 766 }else{ 767 $sel = ''; 768 } 769 770 if($ug{0} == '@'){ 771 echo ' <option value="'.hsc($ug).'" class="aclgroup"'.$sel.'>'.hsc($ug).'</option>'.NL; 772 }else{ 773 echo ' <option value="'.hsc($ug).'" class="acluser"'.$sel.'>'.hsc($ug).'</option>'.NL; 774 } 775 } 776 echo ' </optgroup>'.NL; 777 echo '</select>'.NL; 778 return $inlist; 779 } 780} 781