Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00103 unset($MCONF); 00104 require ('conf.php'); 00105 require ($BACK_PATH.'init.php'); 00106 require ($BACK_PATH.'template.php'); 00107 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php'); 00108 require_once (PATH_t3lib.'class.t3lib_browsetree.php'); 00109 require_once (PATH_t3lib.'class.t3lib_foldertree.php'); 00110 require_once (PATH_t3lib.'class.t3lib_tstemplate.php'); 00111 require_once (PATH_t3lib.'class.t3lib_loadmodules.php'); 00112 require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php'); 00113 require_once (PATH_typo3.'class.alt_menu_functions.inc'); 00114 00115 $BE_USER->modAccess($MCONF,1); 00116 00117 00118 00119 00120 00121 00129 class localPageTree extends t3lib_browseTree { 00130 var $expandFirst=0; 00131 var $expandAll=0; 00132 00140 function localPageTree($BE_USER,$WEBMOUNTS='') { 00141 $this->init(); 00142 00143 $this->BE_USER = $BE_USER; 00144 $this->MOUNTS = $WEBMOUNTS; 00145 $this->clause = $this->ext_permsC(); // Notice, this clause does NOT filter out un-readable pages. This is the POINT since this class is ONLY used for the main overview where ALL is shown! Otherwise "AND '.$this->BE_USER->getPagePermsClause(1).'" should be added. 00146 $this->orderByFields = 'sorting'; 00147 } 00148 00154 function ext_permsC() { 00155 return ''; 00156 } 00157 00165 function wrapTitle($str,$row) { 00166 return $str; 00167 } 00168 00177 function PM_ATagWrap($icon,$cmd,$bMark='') { 00178 return ''; 00179 } 00180 00188 function wrapIcon($icon,$row) { 00189 // Add title attribute to input icon tag 00190 $title = '['.$row['uid'].'] '.t3lib_BEfunc::getRecordPath($row['uid'],'',15); 00191 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ? $this->titleAttrib.'="'.htmlspecialchars($title).'"' : '').' border="0"'); 00192 00193 return $theIcon; 00194 } 00195 00201 function initializePositionSaving() { 00202 $this->stored=array(); 00203 } 00204 } 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00222 class printAllPageTree extends localPageTree { 00223 var $expandFirst=1; 00224 var $expandAll=1; 00225 00231 function ext_permsC() { 00232 return ' AND '.$this->BE_USER->getPagePermsClause(1); 00233 } 00234 00243 function PM_ATagWrap($icon,$cmd,$bMark='') { 00244 return $icon; 00245 } 00246 00254 function wrapIcon($icon,$row) { 00255 // Add title attribute to input icon tag 00256 $title = '['.$row['uid'].']'; 00257 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ? $this->titleAttrib.'="'.htmlspecialchars($title).'"' : '').' border="0"'); 00258 00259 return $theIcon; 00260 } 00261 } 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00279 class printAllPageTree_perms extends printAllPageTree { 00280 00288 function printTree($treeArr='',$printPath=0) { 00289 $titleLen=intval($this->BE_USER->uc['titleLen']); 00290 00291 $be_user_Array = t3lib_BEfunc::getUserNames(); 00292 $be_group_Array = t3lib_BEfunc::getGroupNames(); 00293 $lines=array(); 00294 $lines[]='<tr class="bgColor5"> 00295 <td nowrap="nowrap"><strong>Page title:</strong></td> 00296 '.($printPath?'<td nowrap="nowrap"><strong>Path:</strong></td>':'').' 00297 <td nowrap="nowrap" colspan=2><strong>User:</strong></td> 00298 <td nowrap="nowrap" colspan=2><strong>Group: </strong></td> 00299 <td nowrap="nowrap"><strong>Everybody: </strong></td> 00300 <td nowrap="nowrap"><strong>This user: </strong></td> 00301 <td nowrap="nowrap"><strong>Main group:</strong></td> 00302 </tr>'; 00303 00304 if (!is_array($treeArr)) $treeArr=$this->tree; 00305 reset($treeArr); 00306 while(list($k,$v)=each($treeArr)) { 00307 $col1 = ' bgcolor="'.t3lib_div::modifyHtmlColor($GLOBALS['SOBE']->doc->bgColor4,+10,+10,+10).'"'; 00308 $row = $v['row']; 00309 $title = htmlspecialchars(t3lib_div::fixed_lgd_cs($row['title'],$this->BE_USER->uc['titleLen'])); 00310 $lines[]='<tr class="bgColor4"> 00311 <td nowrap="nowrap">'.$v['HTML'].$title.' </td> 00312 '.($printPath?'<td nowrap="nowrap">'.htmlspecialchars(t3lib_BEfunc::getRecordPath ($row['pid'],'',15)).' </td>':'').' 00313 <td nowrap="nowrap"'.$col1.'>'.$be_user_Array[$row['perms_userid']]['username'].' </td> 00314 <td nowrap="nowrap"'.$col1.'>'.$this->ext_printPerms($row['perms_user']).' </td> 00315 <td nowrap="nowrap">'.$be_group_Array[$row['perms_groupid']]['title'].' </td> 00316 <td nowrap="nowrap">'.$this->ext_printPerms($row['perms_group']).' </td> 00317 <td nowrap="nowrap" align="center" '.$col1.'>'.$this->ext_printPerms($row['perms_everybody']).' </td> 00318 <td nowrap="nowrap" align="center">'.($row['editlock'] ? '<img src="'.$this->backPath.'gfx/recordlock_warning2.gif" width="22" height="16" title="Edit lock prevents all editing" alt="" />' : $this->ext_printPerms($this->BE_USER->calcPerms($row))).' </td> 00319 <td nowrap="nowrap" align="center">'.$this->ext_printPerms($this->ext_groupPerms($row,$be_group_Array[$this->BE_USER->firstMainGroup])).' </td> 00320 </tr>'; 00321 } 00322 return '<table border="0" cellpadding="0" cellspacing="0">'.implode('',$lines).'</table>'; 00323 } 00324 00331 function ext_printPerms($int) { 00332 $str=''; 00333 $str.= (($int&1)?'*':'<font color="red">x</font>'); 00334 $str.= (($int&16)?'*':'<font color="red">x</font>'); 00335 $str.= (($int&2)?'*':'<font color="red">x</font>'); 00336 $str.= (($int&4)?'*':'<font color="red">x</font>'); 00337 $str.= (($int&8)?'*':'<font color="red">x</font>'); 00338 00339 return '<b><font color="green">'.$str.'</font></b>'; 00340 } 00341 00349 function ext_groupPerms($row,$firstGroup) { 00350 if (is_array($row)) { 00351 $out=intval($row['perms_everybody']); 00352 if ($row['perms_groupid'] && $firstGroup['uid']==$row['perms_groupid']) { 00353 $out|= intval($row['perms_group']); 00354 } 00355 return $out; 00356 } 00357 } 00358 } 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00377 class localFolderTree extends t3lib_folderTree { 00378 var $expandFirst=0; 00379 var $expandAll=0; 00380 00388 function localFolderTree($BE_USER,$FILEMOUNTS='') { 00389 $this->init(); 00390 00391 $this->BE_USER = $BE_USER; 00392 $this->MOUNTS = $FILEMOUNTS; 00393 $this->clause = ''; // Notice, this clause does NOT filter out un-readable pages. This is the POINT since this class is ONLY used for the main overview where ALL is shown! Otherwise "AND '.$this->BE_USER->getPagePermsClause(1).'" should be added. 00394 } 00395 00403 function wrapTitle($str,$row) { 00404 return $str; 00405 } 00406 00415 function PM_ATagWrap($icon,$cmd,$bMark='') { 00416 return ''; 00417 } 00418 00426 function wrapIcon($icon,$row) { 00427 // Add title attribute to input icon tag 00428 $title = $GLOBALS['SOBE']->localPath($row['path']); 00429 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ? $this->titleAttrib.'="'.htmlspecialchars($title).'"' : '')); 00430 00431 return $theIcon; 00432 } 00433 00439 function initializePositionSaving() { 00440 $this->stored=array(); 00441 } 00442 } 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00463 class printAllFolderTree extends localFolderTree { 00464 var $expandFirst=1; 00465 var $expandAll=1; 00466 00475 function PM_ATagWrap($icon,$cmd,$bMark='') { 00476 return $icon; 00477 } 00478 } 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00497 class local_beUserAuth extends t3lib_beUserAuth { 00498 var $ext_pageIdsFromMounts=''; // List of mounted page ids (from browsetree class when selecting mountpoints) 00499 var $ext_non_readAccessPageArray=array(); // Storage for non-readable webmounts, see returnWebmounts() 00500 00509 function returnWebmounts($pClause='') { 00510 00511 // Get array of webmounts: 00512 $webmounts = (string)($this->groupData['webmounts'])!='' ? explode(',',$this->groupData['webmounts']) : Array(); 00513 00514 // Get select clause: 00515 $pClause=$pClause?$pClause:$this->getPagePermsClause(1); 00516 00517 // Traverse mounts, check if they are readable: 00518 foreach($webmounts as $k => $id) { 00519 $rec=t3lib_BEfunc::getRecord('pages',$id,'*',' AND '.$pClause); 00520 if (!is_array($rec)) { 00521 $this->ext_non_readAccessPageArray[$id]=t3lib_BEfunc::getRecord('pages',$id); 00522 unset($webmounts[$k]); 00523 } 00524 } 00525 return $webmounts; 00526 } 00527 00533 function ext_non_readAccessPages() { 00534 $lines=array(); 00535 00536 foreach($this->ext_non_readAccessPageArray as $pA) { 00537 if ($pA) $lines[]=t3lib_BEfunc::getRecordPath($pA['uid'],'',15); 00538 } 00539 if (count($lines)) { 00540 return '<table bgcolor="red" border="0" cellpadding="0" cellspacing="0"> 00541 <tr> 00542 <td align="center"><font color="white"><strong>The user has no read access to these DB-mounts!</strong></font></td> 00543 </tr> 00544 <tr> 00545 <td>'.implode('</td></tr><tr><td>',$lines).'</td> 00546 </tr> 00547 </table>'; 00548 } 00549 } 00550 00556 function user_where_clause() { 00557 return 'AND pid=0 '; 00558 } 00559 00568 function ext_printOverview($uInfo,$compareFlags,$printTrees=0) { 00569 // Prepare for filemount and db-mount 00570 if ($printTrees) { // ... this is if we see the detailed view for a user: 00571 // Page tree object: 00572 $className=t3lib_div::makeInstanceClassName(!$this->isAdmin() ? 'printAllPageTree_perms' : 'printAllPageTree'); 00573 $pagetree = new $className($this,$this->returnWebmounts()); // Here, only readable webmounts are returned (1=1) 00574 $pagetree->addField('perms_user',1); 00575 $pagetree->addField('perms_group',1); 00576 $pagetree->addField('perms_everybody',1); 00577 $pagetree->addField('perms_userid',1); 00578 $pagetree->addField('perms_groupid',1); 00579 $pagetree->addField('editlock',1); 00580 00581 // Folder tree object: 00582 $className=t3lib_div::makeInstanceClassName('printAllFolderTree'); 00583 $foldertree = new $className($this,$this->returnFilemounts()); 00584 } else { 00585 // Page tree object: 00586 $className=t3lib_div::makeInstanceClassName('localPageTree'); 00587 $pagetree = new $className($this,$this->returnWebmounts('1=1')); // Here, ALL webmounts are returned (1=1) 00588 00589 // Folder tree object: 00590 $className=t3lib_div::makeInstanceClassName('localFolderTree'); 00591 $foldertree = new $className($this,$this->returnFilemounts()); 00592 } 00593 00594 // Names for modules: 00595 $modNames = array( 00596 'web' => 'Web', 00597 'web_layout' => 'Page', 00598 'web_modules' => 'Modules', 00599 'web_info' => 'Info', 00600 'web_perms' => 'Access', 00601 'web_func' => 'Func', 00602 'web_list' => 'List', 00603 'web_ts' => 'Template', 00604 'file' => 'File', 00605 'file_list' => 'List', 00606 'file_images' => 'Images', 00607 'doc' => 'Doc.', 00608 'help' => 'Help', 00609 'help_about' => 'About', 00610 'help_quick' => 'User manual', 00611 'help_welcome' => 'Welcome', 00612 'user' => 'User', 00613 'user_setup' => 'Setup', 00614 'user_task' => 'Task center' 00615 ); 00616 00617 // Traverse the enabled analysis topics: 00618 $out=array(); 00619 foreach($uInfo as $k => $v) { 00620 if ($compareFlags[$k]) { 00621 switch($k) { 00622 case 'filemounts': 00623 $out[$k] = $foldertree->getBrowsableTree(); 00624 break; 00625 case 'webmounts': 00626 // Print webmounts: 00627 $pagetree->addSelfId=1; 00628 $out[$k] = $this->ext_non_readAccessPages(); // Add HTML for non-readable webmounts (only shown when viewing details of a user - in overview/comparison ALL mounts are shown) 00629 $out[$k].= $pagetree->getBrowsableTree(); // Add HTML for readable webmounts. 00630 $this->ext_pageIdsFromMounts=implode(',',array_unique($pagetree->ids)); // List of mounted page ids 00631 break; 00632 case 'tempPath': 00633 $out[$k] = $GLOBALS['SOBE']->localPath($v); 00634 break; 00635 case 'pagetypes_select': 00636 $pageTypes = explode(',',$v); 00637 reset($pageTypes); 00638 while(list($kk,$vv)=each($pageTypes)) { 00639 $pageTypes[$kk]=$GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('pages','doktype',$vv)); 00640 } 00641 $out[$k] = implode('<br />',$pageTypes); 00642 break; 00643 case 'tables_select': 00644 case 'tables_modify': 00645 $tables = explode(',',$v); 00646 reset($tables); 00647 while(list($kk,$vv)=each($tables)) { 00648 if ($vv) { 00649 $tables[$kk]='<span class="nobr">'.t3lib_iconWorks::getIconImage($vv,array(),$GLOBALS['BACK_PATH'],'align="top"').$GLOBALS['LANG']->sL($GLOBALS['TCA'][$vv]['ctrl']['title']).'</span>'; 00650 } 00651 } 00652 $out[$k] = implode('<br />',$tables); 00653 break; 00654 case 'non_exclude_fields': 00655 $nef = explode(',',$v); 00656 reset($nef); 00657 $table=''; 00658 $pout=array(); 00659 while(list($kk,$vv)=each($nef)) { 00660 if ($vv) { 00661 list($thisTable,$field) = explode(':',$vv); 00662 if ($thisTable!=$table) { 00663 $table=$thisTable; 00664 t3lib_div::loadTCA($table); 00665 $pout[]='<span class="nobr">'.t3lib_iconWorks::getIconImage($table,array(),$GLOBALS['BACK_PATH'],'align="top"').$GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title']).'</span>'; 00666 } 00667 if ($GLOBALS['TCA'][$table]['columns'][$field]) { 00668 $pout[]='<span class="nobr"> - '.ereg_replace(':$','',$GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['columns'][$field]['label'])).'</span>'; 00669 } 00670 } 00671 } 00672 $out[$k] = implode('<br />',$pout); 00673 break; 00674 case 'groupList': 00675 case 'firstMainGroup': 00676 $uGroups = explode(',',$v); 00677 reset($uGroups); 00678 $table=''; 00679 $pout=array(); 00680 while(list($kk,$vv)=each($uGroups)) { 00681 if ($vv) { 00682 $uGRow = t3lib_BEfunc::getRecord('be_groups',$vv); 00683 $pout[]='<tr><td nowrap="nowrap">'.t3lib_iconWorks::getIconImage('be_groups',$uGRow,$GLOBALS['BACK_PATH'],'align="top"').' '.htmlspecialchars($uGRow['title']).' </td><td width=1% nowrap="nowrap">'.$GLOBALS['SOBE']->elementLinks('be_groups',$uGRow).'</td></tr>'; 00684 } 00685 } 00686 $out[$k] = '<table border="0" cellpadding="0" cellspacing="0" width="100%">'.implode('',$pout).'</table>'; 00687 break; 00688 case 'modules': 00689 $mods = explode(',',$v); 00690 reset($mods); 00691 $mainMod=''; 00692 $pout=array(); 00693 while(list($kk,$vv)=each($mods)) { 00694 if ($vv) { 00695 list($thisMod,$subMod) = explode('_',$vv); 00696 if ($thisMod!=$mainMod) { 00697 $mainMod=$thisMod; 00698 $pout[]='<span class="nobr">'.($modNames[$mainMod]?$modNames[$mainMod]:$mainMod).'</span>'; 00699 } 00700 if ($subMod) { 00701 $pout[]='<span class="nobr"> - '.($modNames[$mainMod.'_'.$subMod]?$modNames[$mainMod.'_'.$subMod]:$mainMod.'_'.$subMod).'</span>'; 00702 } 00703 } 00704 } 00705 $out[$k] = implode('<br />',$pout); 00706 break; 00707 case 'userTS': 00708 00709 $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext'); // Defined global here! 00710 $tmpl->tt_track = 0; // Do not log time-performance information 00711 00712 $tmpl->fixedLgd=0; 00713 $tmpl->linkObjects=0; 00714 $tmpl->bType=''; 00715 $tmpl->ext_expandAllNotes=1; 00716 $tmpl->ext_noPMicons=1; 00717 $out[$k] = $tmpl->ext_getObjTree($v,'',''); 00718 break; 00719 case 'userTS_hl': 00720 $tsparser = t3lib_div::makeInstance('t3lib_TSparser'); 00721 $tsparser->lineNumberOffset=0; 00722 $out[$k] = $tsparser->doSyntaxHighlight($v,0,1); 00723 break; 00724 case 'explicit_allowdeny': 00725 00726 // Explode and flip values: 00727 $nef = array_flip(explode(',',$v)); 00728 $pout = array(); 00729 00730 $theTypes = t3lib_BEfunc::getExplicitAuthFieldValues(); 00731 00732 // Icons: 00733 $icons = array( 00734 'ALLOW' => '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/icon_ok2.gif','').' class="absmiddle" alt="" />', 00735 'DENY' => '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/icon_fatalerror.gif','').' class="absmiddle" alt="" />', 00736 ); 00737 00738 // Traverse types: 00739 foreach($theTypes as $tableFieldKey => $theTypeArrays) { 00740 if (is_array($theTypeArrays['items'])) { 00741 $pout[] = '<b>'.$theTypeArrays['tableFieldLabel'].'</b>'; 00742 // Traverse options for this field: 00743 foreach($theTypeArrays['items'] as $itemValue => $itemContent) { 00744 $v = $tableFieldKey.':'.$itemValue.':'.$itemContent[0]; 00745 if (isset($nef[$v])) { 00746 unset($nef[$v]); 00747 $pout[] = $icons[$itemContent[0]].'['.$itemContent[2].'] '.$itemContent[1]; 00748 } else { 00749 $pout[] = '<em style="color: #666666;">'.$icons[($itemContent[0]=='ALLOW' ? 'DENY' : 'ALLOW')].'['.$itemContent[2].'] '.$itemContent[1].'</em>'; 00750 } 00751 } 00752 $pout[] = ''; 00753 } 00754 } 00755 00756 // Add remaining: 00757 if (count($nef)) { 00758 $pout = array_merge($pout, array_keys($nef)); 00759 } 00760 00761 // Implode for display: 00762 $out[$k] = implode('<br />',$pout); 00763 break; 00764 case 'allowed_languages': 00765 00766 // Explode and flip values: 00767 $nef = array_flip(explode(',',$v)); 00768 $pout = array(); 00769 00770 // Get languages: 00771 $items = t3lib_BEfunc::getSystemLanguages(); 00772 00773 // Traverse values: 00774 foreach($items as $iCfg) { 00775 if (isset($nef[$iCfg[1]])) { 00776 unset($nef[$iCfg[1]]); 00777 if (strlen($iCfg[2])) { 00778 $icon = '<img src="'.$GLOBALS['BACK_PATH'].'gfx/'.$iCfg[2].'" class="absmiddle" style="margin-right: 5px;" alt="" />'; 00779 } else { 00780 $icon = ''; 00781 } 00782 $pout[] = $icon.$iCfg[0]; 00783 } 00784 } 00785 00786 // Add remaining: 00787 if (count($nef)) { 00788 $pout = array_merge($pout, array_keys($nef)); 00789 } 00790 00791 // Implode for display: 00792 $out[$k] = implode('<br />',$pout); 00793 break; 00794 case 'workspace_perms': 00795 $out[$k] = implode('<br/>',explode(', ',t3lib_BEfunc::getProcessedValue('be_users','workspace_perms',$v))); 00796 break; 00797 case 'workspace_membership': 00798 $out[$k] = implode('<br/>',$this->ext_workspaceMembership()); 00799 break; 00800 case 'custom_options': 00801 00802 // Explode and flip values: 00803 $nef = array_flip(explode(',',$v)); 00804 $pout = array(); 00805 00806 // Initialize: 00807 $customOptions = $GLOBALS['TYPO3_CONF_VARS']['BE']['customPermOptions']; 00808 if (is_array($customOptions)) { 00809 foreach($customOptions as $coKey => $coValue) { 00810 if (is_array($coValue['items'])) { 00811 // Traverse items: 00812 foreach($coValue['items'] as $itemKey => $itemCfg) { 00813 $v = $coKey.':'.$itemKey; 00814 if (isset($nef[$v])) { 00815 unset($nef[$v]); 00816 $pout[] = $GLOBALS['LANG']->sl($coValue['header']).' / '.$GLOBALS['LANG']->sl($itemCfg[0]); 00817 } 00818 } 00819 } 00820 } 00821 } 00822 00823 // Add remaining: 00824 if (count($nef)) { 00825 $pout = array_merge($pout, array_keys($nef)); 00826 } 00827 00828 // Implode for display: 00829 $out[$k] = implode('<br />',$pout); 00830 break; 00831 } 00832 } 00833 } 00834 return $out; 00835 } 00836 00842 function ext_getReadableButNonmounted() { 00843 00844 // List of page id mounts which ARE mounted (and should therefore not be selected) 00845 if (!$this->ext_pageIdsFromMounts) { 00846 $this->ext_pageIdsFromMounts=0; 00847 } 00848 00849 // User and group names: 00850 $be_user_Array = t3lib_BEfunc::getUserNames(); 00851 $be_group_Array = t3lib_BEfunc::getGroupNames(); 00852 00853 // Create query: 00854 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00855 'pid,uid,title,doktype,perms_user,perms_group,perms_everybody,perms_userid,perms_groupid'.(t3lib_extMgm::isLoaded('cms')?',media,layout,hidden,starttime,endtime,fe_group,extendToSubpages':''), 00856 'pages', 00857 'uid NOT IN ('.$this->ext_pageIdsFromMounts.') AND '.$this->getPagePermsClause(1).t3lib_BEfunc::deleteClause('pages') 00858 ); 00859 $dat = array(); 00860 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00861 $dat[] = array( 00862 'row'=>$row, 00863 'HTML'=>t3lib_iconWorks::getIconImage('pages',$row,$GLOBALS['BACK_PATH'],'align="top" title="['.$row['uid'].']"') // .htmlspecialchars($row['title']) 00864 ); 00865 } 00866 $className=t3lib_div::makeInstanceClassName('printAllPageTree_perms'); 00867 $pp = new $className($this); 00868 return $pp->printTree($dat,1); 00869 } 00870 00877 function ext_printPerms($int) { 00878 $str=''; 00879 $str.= (($int&1)?'*':'<font color="red">x</font>'); 00880 $str.= (($int&16)?'*':'<font color="red">x</font>'); 00881 $str.= (($int&2)?'*':'<font color="red">x</font>'); 00882 $str.= (($int&4)?'*':'<font color="red">x</font>'); 00883 $str.= (($int&8)?'*':'<font color="red">x</font>'); 00884 00885 return '<b><font color="green">'.$str.'</font></b>'; 00886 } 00887 00895 function ext_groupPerms($row,$firstGroup) { 00896 if (is_array($row)) { 00897 $out=intval($row['perms_everybody']); 00898 if ($row['perms_groupid'] && $firstGroup['uid']==$row['perms_groupid']) { 00899 $out|= intval($row['perms_group']); 00900 } 00901 return $out; 00902 } 00903 } 00904 00911 function ext_compileUserInfoForHash($filter=NULL) { 00912 $uInfo=array(); 00913 $renderAll = !is_array($filter); 00914 00915 // Filemounts: 00916 if ($renderAll || $filter['filemounts']) { 00917 $uInfo['filemounts'] = $this->ext_uniqueAndSortList(implode(',',array_keys($this->groupData['filemounts']))); 00918 } 00919 00920 // DBmounts: 00921 if ($renderAll || $filter['webmounts']) { 00922 $uInfo['webmounts'] = $this->ext_uniqueAndSortList($this->groupData['webmounts']); 00923 } 00924 00925 // Sharing Upload Folder 00926 if ($renderAll || $filter['tempPath']) { 00927 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions'); 00928 $fileProcessor->init($this->groupData['filemounts'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']); 00929 $uInfo['tempPath'] = $fileProcessor->findTempFolder(); // The closest TEMP-path is found 00930 } 00931 00932 // First Main Group: 00933 if ($renderAll || $filter['firstMainGroup']) { 00934 $uInfo['firstMainGroup'] = $this->firstMainGroup; 00935 } 00936 00937 // Group List: 00938 if ($renderAll || $filter['groupList']) { 00939 $uInfo['groupList'] = $this->groupList; // This gives a list that shows in which order the groups are processed. This may result in a list of groups which is similar to that of another user regarding which group but not the order of groups. For now, I believe it's most usefull to let separate orders of groups appear as different group settings for a user. 00940 } 00941 00942 // Page Types: 00943 if ($renderAll || $filter['pagetypes_select']) { 00944 $uInfo['pagetypes_select'] = $this->ext_uniqueAndSortList($this->groupData['pagetypes_select']); 00945 } 00946 00947 // Tables select: 00948 if ($renderAll || $filter['tables_select']) { 00949 $uInfo['tables_select'] = $this->ext_uniqueAndSortList($this->groupData['tables_select'].','.$this->groupData['tables_modify']); 00950 } 00951 00952 // Tables modify: 00953 if ($renderAll || $filter['tables_modify']) { 00954 $uInfo['tables_modify'] = $this->ext_uniqueAndSortList($this->groupData['tables_modify']); 00955 } 00956 00957 // Non-exclude fields: 00958 if ($renderAll || $filter['non_exclude_fields']) { 00959 $uInfo['non_exclude_fields'] = $this->ext_uniqueAndSortList($this->groupData['non_exclude_fields']); 00960 } 00961 00962 // Explicit Allow/Deny: 00963 if ($renderAll || $filter['explicit_allowdeny']) { 00964 $uInfo['explicit_allowdeny'] = $this->ext_uniqueAndSortList($this->groupData['explicit_allowdeny']); 00965 } 00966 00967 // Limit to languages: 00968 if ($renderAll || $filter['allowed_languages']) { 00969 $uInfo['allowed_languages'] = $this->ext_uniqueAndSortList($this->groupData['allowed_languages']); 00970 } 00971 00972 // Workspace permissions 00973 if ($renderAll || $filter['workspace_perms']) { 00974 $uInfo['workspace_perms'] = $this->ext_uniqueAndSortList($this->groupData['workspace_perms']); 00975 } 00976 00977 // Workspace membership 00978 if ($renderAll || $filter['workspace_membership']) { 00979 $uInfo['workspace_membership'] = $this->ext_workspaceMembership(); 00980 } 00981 00982 // Custom options: 00983 if ($renderAll || $filter['custom_options']) { 00984 $uInfo['custom_options'] = $this->ext_uniqueAndSortList($this->groupData['custom_options']); 00985 } 00986 00987 // Modules: 00988 if ($renderAll || $filter['modules']) { 00989 $uInfo['modules'] = $this->ext_uniqueAndSortList($this->groupData['modules']); 00990 } 00991 00992 // User TS: 00993 $this->ext_ksortArrayRecursive($this->userTS); 00994 if ($renderAll || $filter['userTS']) { 00995 $uInfo['userTS'] = $this->userTS; 00996 } 00997 00998 if ($renderAll || $filter['userTS_hl']) { 00999 $uInfo['userTS_hl'] = $this->userTS_text; 01000 } 01001 01002 return $uInfo; 01003 } 01004 01011 function ext_uniqueAndSortList($list) { 01012 $uList=t3lib_div::trimExplode(',',$list,1); 01013 sort($uList); 01014 $uList=array_unique($uList); 01015 $uList=implode(',',$uList); 01016 return $uList; 01017 } 01018 01025 function ext_ksortArrayRecursive(&$arr) { 01026 krsort($arr); 01027 reset($arr); 01028 while(list($k,$v)=each($arr)) { 01029 if (is_array($v)) $this->ext_ksortArrayRecursive($arr[$k]); 01030 } 01031 } 01032 01038 function ext_workspaceMembership() { 01039 global $TYPO3_DB; 01040 01041 // Create accessible workspace arrays: 01042 $options = array(); 01043 if ($this->checkWorkspace(array('uid' => 0))) { 01044 $options[0] = '0: [LIVE]'; 01045 } 01046 if ($this->checkWorkspace(array('uid' => -1))) { 01047 $options[-1] = '-1: [Default Draft]'; 01048 } 01049 01050 // Add custom workspaces (selecting all, filtering by BE_USER check): 01051 $workspaces = $TYPO3_DB->exec_SELECTgetRows('uid,title,adminusers,members,reviewers,db_mountpoints','sys_workspace','pid=0'.t3lib_BEfunc::deleteClause('sys_workspace'),'','title'); 01052 if (count($workspaces)) { 01053 foreach ($workspaces as $rec) { 01054 if ($this->checkWorkspace($rec)) { 01055 $options[$rec['uid']] = $rec['uid'].': '.$rec['title']; 01056 01057 // Check if all mount points are accessible, otherwise show error: 01058 if (trim($rec['db_mountpoints'])!=='') { 01059 $mountPoints = t3lib_div::intExplode(',',$this->workspaceRec['db_mountpoints'],1); 01060 foreach($mountPoints as $mpId) { 01061 if (!$this->isInWebMount($mpId,'1=1')) { 01062 $options[$rec['uid']].= '<br> \- WARNING: Workspace Webmount page id "'.$mpId.'" not accessible!'; 01063 } 01064 } 01065 } 01066 } 01067 } 01068 } 01069 01070 return $options; 01071 } 01072 } 01073 01074 01075 01076 01077 01078 01079 01080 01081 01082 01083 01084 01092 class SC_mod_tools_be_user_index { 01093 var $MCONF=array(); 01094 var $MOD_MENU=array(); 01095 var $MOD_SETTINGS=array(); 01096 var $doc; 01097 01098 var $include_once=array(); 01099 var $content; 01100 01104 function init() { 01105 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 01106 $this->MCONF = $GLOBALS['MCONF']; 01107 01108 $this->menuConfig(); 01109 $this->switchUser(t3lib_div::_GP('SwitchUser')); 01110 01111 01112 // ************************** 01113 // Initializing 01114 // ************************** 01115 $this->doc = t3lib_div::makeInstance('noDoc'); 01116 $this->doc->form='<form action="" method="POST">'; 01117 $this->doc->backPath = $BACK_PATH; 01118 // JavaScript 01119 $this->doc->JScode = $this->doc->wrapScriptTags(' 01120 script_ended = 0; 01121 function jumpToUrl(URL) { // 01122 window.location.href = URL; 01123 } 01124 ' . $this->doc->redirectUrls()); 01125 } 01126 01132 function menuConfig() { 01133 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 01134 01135 // MENU-ITEMS: 01136 // If array, then it's a selector box menu 01137 // If empty string it's just a variable, that'll be saved. 01138 // Values NOT in this array will not be saved in the settings-array for the module. 01139 $this->MOD_MENU = array( 01140 'function' => array( 01141 'compare' => 'Compare User Settings' 01142 ) 01143 ); 01144 // CLEANSE SETTINGS 01145 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name'], 'ses'); 01146 } 01147 01153 function main() { 01154 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 01155 01156 $this->content=''; 01157 $this->content.=$this->doc->startPage('Backend User Administration'); 01158 01159 $menu=t3lib_BEfunc::getFuncMenu(0,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function']); 01160 01161 $this->content.=$this->doc->header('Backend User Administration'); 01162 $this->content.=$this->doc->spacer(5); 01163 $this->content.=$this->doc->section('',$menu).$this->doc->divider(5); 01164 01165 switch($this->MOD_SETTINGS['function']) { 01166 case 'compare': 01167 if (t3lib_div::_GP('ads')) { 01168 $compareFlags = t3lib_div::_GP('compareFlags'); 01169 $BE_USER->pushModuleData('tools_beuser/index.php/compare',$compareFlags); 01170 } else { 01171 $compareFlags = $BE_USER->getModuleData('tools_beuser/index.php/compare','ses'); 01172 } 01173 $this->content.=$this->compareUsers($compareFlags); 01174 break; 01175 } 01176 01177 01178 if ($BE_USER->mayMakeShortcut()) { 01179 $this->content.=$this->doc->spacer(20). 01180 $this->doc->section('',$this->doc->makeShortcutIcon('be_user_uid,compareFlags','function',$this->MCONF['name'])); 01181 } 01182 } 01183 01189 function printContent() { 01190 01191 $this->content.=$this->doc->endPage(); 01192 echo $this->content; 01193 } 01194 01195 01196 01197 01198 01199 01200 01201 /*************************** 01202 * 01203 * OTHER FUNCTIONS: 01204 * 01205 ***************************/ 01206 01211 function compareUsers($compareFlags) { 01212 global $SOBE; 01213 // Menu: 01214 $options = array( 01215 'filemounts' => 'Filemounts', 01216 'webmounts' => 'Webmounts', 01217 'tempPath' => 'Default upload path', 01218 'firstMainGroup' => 'Main user group', 01219 'groupList' => 'Member of groups', 01220 'pagetypes_select' => 'Page types access', 01221 'tables_select' => 'Select tables', 01222 'tables_modify' => 'Modify tables', 01223 'non_exclude_fields' => 'Non-exclude fields', 01224 'explicit_allowdeny' => 'Explicit Allow/Deny', 01225 'allowed_languages' => 'Limit to languages', 01226 'workspace_perms' => 'Workspace permissions', 01227 'workspace_membership' => 'Workspace membership', 01228 'custom_options' => 'Custom options', 01229 'modules' => 'Modules', 01230 'userTS' => 'TSconfig', 01231 'userTS_hl' => 'TSconfig HL', 01232 ); 01233 01234 $be_user_uid = t3lib_div::_GP('be_user_uid'); 01235 if ($be_user_uid) { 01236 // This is used to test with other users. Development ONLY! 01237 $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth'); // New backend user object 01238 $tempBE_USER->userTS_dontGetCached=1; 01239 $tempBE_USER->OS = TYPO3_OS; 01240 $tempBE_USER->setBeUserByUid($be_user_uid); 01241 $tempBE_USER->fetchGroupData(); 01242 01243 $uInfo = $tempBE_USER->ext_compileUserInfoForHash(); 01244 $uInfo_dat = $tempBE_USER->ext_printOverview($uInfo,$options,1); 01245 01246 $lines=array(); 01247 reset($options); 01248 while(list($kk,$vv)=each($options)) { 01249 if ($kk=='modules') { 01250 $loadModules = t3lib_div::makeInstance('t3lib_loadModules'); 01251 $loadModules->load($GLOBALS['TBE_MODULES'],$tempBE_USER); 01252 $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions'); 01253 $uInfo_dat[$kk] = $alt_menuObj->topMenu($loadModules->modules,1,$GLOBALS['BACK_PATH']); 01254 } 01255 $lines[]='<tr class="bgColor4"> 01256 <td nowrap="nowrap" valign="top">'.$vv.': </td> 01257 <td>'.$uInfo_dat[$kk].' </td> 01258 </tr>'; 01259 01260 if ($kk=='webmounts' && !$tempBE_USER->isAdmin()) { 01261 $lines[]='<tr class="bgColor4"> 01262 <td nowrap="nowrap" valign="top">Non-mounted readable pages: </td> 01263 <td>'.$tempBE_USER->ext_getReadableButNonmounted().' </td> 01264 </tr>'; 01265 } 01266 } 01267 01268 $outTable = '<table border="0" cellpadding="1" cellspacing="1"><tr class="bgColor5"><td>'.t3lib_iconWorks::getIconImage('be_users',$tempBE_USER->user,$GLOBALS['BACK_PATH'],'class="absmiddle" title="'.$tempBE_USER->user['uid'].'"').$tempBE_USER->user['username'].'</td>'; 01269 $outTable.= '<td>'.$tempBE_USER->user['realName'].($tempBE_USER->user['email'] ? ', <a href="mailto:'.$tempBE_USER->user['email'].'">'.$tempBE_USER->user['email'].'</a>' : '').'</td>'; 01270 $outTable.= '<td>'.$this->elementLinks('be_users',$tempBE_USER->user).'</td></tr></table>'; 01271 $outTable.= '<strong><a href="index.php">< Back to overview</a></strong><br />'; 01272 01273 $outTable.= '<br /><table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>'; 01274 $content.= $this->doc->section('User info',$outTable,0,1); 01275 } else { 01276 reset($options); 01277 $menu=array(); 01278 while(list($kk,$vv)=each($options)) { 01279 $menu[]='<input type="checkbox" value="1" name="compareFlags['.$kk.']"'.($compareFlags[$kk]?' checked="checked"':'').'>'.htmlspecialchars($vv); 01280 } 01281 $outCode = 'Group by:<br />'.implode('<br />',$menu); 01282 $outCode.='<br /><input type="submit" name="ads" value="Update">'; 01283 $content = $this->doc->section('Group and Compare Users',$outCode,0,1); 01284 01285 01286 // Traverse all users 01287 $users = t3lib_BEfunc::getUserNames(); 01288 $comparation=array(); 01289 // debug($users); 01290 reset($users); 01291 $counter=0; 01292 01293 01294 $offset=0; 01295 $numberAtTime=1000; 01296 $tooManyUsers=''; 01297 01298 while(list(,$r)=each($users)) { 01299 if ($counter>=$offset) { 01300 // This is used to test with other users. Development ONLY! 01301 $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth'); // New backend user object 01302 $tempBE_USER->OS = TYPO3_OS; 01303 $tempBE_USER->setBeUserByUid($r['uid']); 01304 $tempBE_USER->fetchGroupData(); 01305 01306 // Making group data 01307 $md5pre=''; 01308 $menu=array(); 01309 $uInfo = $tempBE_USER->ext_compileUserInfoForHash((array)$compareFlags); 01310 reset($options); 01311 while(list($kk,$vv)=each($options)) { 01312 if ($compareFlags[$kk]) { 01313 $md5pre.=serialize($uInfo[$kk]).'|'; 01314 } 01315 } 01316 // setting md5: 01317 $md5=md5($md5pre); 01318 if (!isset($comparation[$md5])) { 01319 $comparation[$md5]=$tempBE_USER->ext_printOverview($uInfo,$compareFlags); 01320 $comparation[$md5]['users']=array(); 01321 } 01322 $comparation[$md5]['users'][]=$tempBE_USER->user; //array('uid'=>$r['uid'],'username'=>$r['username'],'realName'=>$tempBE_USER->user['realName'],'email'=>$tempBE_USER->user['email'],'admin'=>$tempBE_USER->user['admin']); 01323 unset($tempBE_USER); 01324 } 01325 $counter++; 01326 if ($counter>=($numberAtTime+$offset)) { 01327 $tooManyUsers='There were more than '.$numberAtTime.' users (total: '.count($users).') and this tool can display only '.$numberAtTime.' at a time!'; 01328 break; 01329 } 01330 } 01331 01332 // Print the groups: 01333 $allGroups=array(); 01334 // Header: 01335 $allCells = array(); 01336 reset($options); 01337 01338 $link_createNewUser='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[be_users][0]=new',$this->doc->backPath,-1)).'">'. 01339 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/new_el.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('new',1).'" alt="" />'. 01340 '</a>'; 01341 01342 $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%"><td><b>Usernames:</b></td><td width="12">'.$link_createNewUser.'</td></tr></table>'; 01343 01344 while(list($kk,$vv)=each($options)) { 01345 if ($compareFlags[$kk]) { 01346 $allCells[$kk] = '<b>'.$vv.':</b>'; 01347 } 01348 } 01349 $allGroups[]=$allCells; 01350 01351 reset($comparation); 01352 while(list(,$dat)=each($comparation)) { 01353 $allCells = array(); 01354 01355 $uListArr=array(); 01356 reset($dat['users']); 01357 while(list(,$uDat)=each($dat['users'])) { 01358 $uListArr[] = '<tr><td width="130">'.t3lib_iconWorks::getIconImage('be_users',$uDat,$GLOBALS['BACK_PATH'],'align="top" title="'.$uDat['uid'].'"').$this->linkuser($uDat['username'],$uDat).' </td><td nowrap="nowrap">'.$this->elementLinks('be_users',$uDat). 01359 '<a href="'.t3lib_div::linkThisScript(array('SwitchUser'=>$uDat['uid'])).'" target="_top"><img src="'.$GLOBALS['BACK_PATH'].'gfx/su.gif" width="18" height="11" border="0" align="top" title="'.htmlspecialchars('Switch User to: '.$uDat['username']).'" alt="" /></a>'. 01360 '<a href="'.t3lib_div::linkThisScript(array('SwitchUser'=>$uDat['uid'], 'switchBackUser' => 1)).'" target="_top"><img src="'.$GLOBALS['BACK_PATH'].'gfx/su.gif" width="18" height="11" border="0" align="top" title="'.htmlspecialchars('Switch User to: '.$uDat['username']).' [SU-mode]" alt="" style="background-color:red;" /></a>'. 01361 '</td></tr>'; 01362 } 01363 $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.implode('',$uListArr).'</table>'; 01364 01365 reset($options); 01366 while(list($kk,$vv)=each($options)) { 01367 if ($compareFlags[$kk]) { 01368 $allCells[$kk] = $dat[$kk]; 01369 } 01370 } 01371 $allGroups[]=$allCells; 01372 } 01373 01374 // Make table 01375 $outTable=''; 01376 reset($allGroups); 01377 $TDparams=' nowrap="nowrap" class="bgColor5" valign="top"'; 01378 while(list(,$allCells)=each($allGroups)) { 01379 $outTable.='<tr><td'.$TDparams.'>'.implode('</td><td'.$TDparams.'>',$allCells).'</td></tr>'; 01380 $TDparams=' nowrap="nowrap" class="bgColor4" valign="top"'; 01381 } 01382 $outTable='<table border="0" cellpadding="2" cellspacing="2">'.$outTable.'</table>'; 01383 $outTable.=fw('<br /><br />(All cached group lists updated.)'); 01384 $outTable.=$tooManyUsers?'<br /><br /><strong><span class="typo3-red">'.$tooManyUsers.'</span></strong>':''; 01385 $content.= $this->doc->spacer(10); 01386 $content.= $this->doc->section('Result',$outTable,0,1); 01387 } 01388 return $content; 01389 } 01390 01398 function linkUser($str,$rec) { 01399 return '<a href="index.php?be_user_uid='.$rec['uid'].'">'.$str.'</a>'; 01400 } 01401 01409 function elementLinks($table,$row) { 01410 global $TCA; 01411 // Info: 01412 $cells[]='<a href="#" onclick="top.launchView(\''.$table.'\', \''.$row['uid'].'\',\''.$GLOBALS['BACK_PATH'].'\'); return false;"><img src="'.$GLOBALS['BACK_PATH'].'gfx/zoom2.gif" width="12" height="12" border="0" align="top" title="Show information" alt="" /></a>'; 01413 01414 // Edit: 01415 $params='&edit['.$table.']['.$row['uid'].']=edit'; 01416 $cells[]='<a href="#" onclick="'.t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'').'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/edit2.gif" width="11" height="12" border="0" align="top" title="Edit" alt="" /></a>'; 01417 01418 // Hide: 01419 $hiddenField = $TCA[$table]['ctrl']['enablecolumns']['disabled']; 01420 if ($row[$hiddenField]) { 01421 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0'; 01422 $cells[]='<a href="'.$this->doc->issueCommand($params).'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/button_unhide.gif" width="11" height="10" border="0" title="Disable" align="top" alt="" /></a>'; 01423 } else { 01424 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1'; 01425 $cells[]='<a href="'.$this->doc->issueCommand($params).'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/button_hide.gif" width="11" height="10" border="0" title="Disable" align="top" alt="" /></a>'; 01426 } 01427 01428 // Delete 01429 $params='&cmd['.$table.']['.$row['uid'].'][delete]=1'; 01430 $cells[]='<a href="'.$this->doc->issueCommand($params).'" onclick="return confirm(unescape(\''.rawurlencode('Are you sure you want to delete this element?').'\'));"><img src="'.$GLOBALS['BACK_PATH'].'gfx/garbage.gif" width="11" height="12" border="0" align="top" title="Delete(!)" alt="" /></a>'; 01431 01432 return implode('',$cells); 01433 } 01434 01440 function initUsers() { 01441 // Initializing all users in order to generate the usergroup_cached_list 01442 $users = t3lib_BEfunc::getUserNames(); 01443 //debug($users); 01444 reset($users); 01445 while(list(,$r)=each($users)) { 01446 // This is used to test with other users. Development ONLY! 01447 $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth'); // New backend user object 01448 $tempBE_USER->OS = TYPO3_OS; 01449 $tempBE_USER->setBeUserByUid($r['uid']); 01450 $tempBE_USER->fetchGroupData(); 01451 } 01452 } 01453 01460 function localPath($str) { 01461 if (substr($str,0,strlen(PATH_site))==PATH_site) { 01462 return substr($str,strlen(PATH_site)); 01463 } else return $str; 01464 } 01465 01472 function switchUser($switchUser) { 01473 $uRec=t3lib_BEfunc::getRecord('be_users',$switchUser); 01474 if (is_array($uRec) && $GLOBALS['BE_USER']->isAdmin()) { 01475 $updateData['ses_userid'] = $uRec['uid']; 01476 // user switchback 01477 if (t3lib_div::_GP('switchBackUser')) { 01478 $updateData['ses_backuserid'] = intval($GLOBALS['BE_USER']->user['uid']); 01479 } 01480 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_sessions', 'ses_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->id, 'be_sessions').' AND ses_name=\'be_typo_user\' AND ses_userid='.intval($GLOBALS['BE_USER']->user['uid']),$updateData); 01481 01482 header('Location: '.t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'].'index.php'.($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']?'':'?commandLI=1'))); 01483 exit; 01484 } 01485 } 01486 } 01487 01488 // Include extension? 01489 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/beuser/mod/index.php']) { 01490 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/beuser/mod/index.php']); 01491 } 01492 01493 01494 01495 01496 01497 01498 01499 01500 01501 01502 01503 01504 // Make instance: 01505 $SOBE = t3lib_div::makeInstance('SC_mod_tools_be_user_index'); 01506 $SOBE->init(); 01507 $SOBE->main(); 01508 $SOBE->printContent(); 01509 ?>