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