00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00102 unset($MCONF);
00103 require ('conf.php');
00104 require ($BACK_PATH.'init.php');
00105 require ($BACK_PATH.'template.php');
00106 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
00107 require_once (PATH_t3lib.'class.t3lib_browsetree.php');
00108 require_once (PATH_t3lib.'class.t3lib_foldertree.php');
00109 require_once (PATH_t3lib.'class.t3lib_tstemplate.php');
00110 require_once (PATH_t3lib.'class.t3lib_loadmodules.php');
00111 require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');
00112 require_once (PATH_typo3.'class.alt_menu_functions.inc');
00113
00114 $BE_USER->modAccess($MCONF,1);
00115
00116
00117
00118
00119
00120
00128 class localPageTree extends t3lib_browseTree {
00129 var $expandFirst=0;
00130 var $expandAll=0;
00131
00139 function localPageTree($BE_USER,$WEBMOUNTS='') {
00140 $this->init();
00141
00142 $this->BE_USER = $BE_USER;
00143 $this->MOUNTS = $WEBMOUNTS;
00144 $this->clause = $this->ext_permsC();
00145 $this->orderByFields = 'sorting';
00146 }
00147
00153 function ext_permsC() {
00154 return '';
00155 }
00156
00164 function wrapTitle($str,$row) {
00165 return $str;
00166 }
00167
00176 function PM_ATagWrap($icon,$cmd,$bMark='') {
00177 return '';
00178 }
00179
00187 function wrapIcon($icon,$row) {
00188
00189 $title = '['.$row['uid'].'] '.t3lib_BEfunc::getRecordPath($row['uid'],'',15);
00190 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ? $this->titleAttrib.'="'.htmlspecialchars($title).'"' : '').' border="0"');
00191
00192 return $theIcon;
00193 }
00194
00200 function initializePositionSaving() {
00201 $this->stored=array();
00202 }
00203 }
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00221 class printAllPageTree extends localPageTree {
00222 var $expandFirst=1;
00223 var $expandAll=1;
00224
00230 function ext_permsC() {
00231 return ' AND '.$this->BE_USER->getPagePermsClause(1);
00232 }
00233
00242 function PM_ATagWrap($icon,$cmd,$bMark='') {
00243 return $icon;
00244 }
00245
00253 function wrapIcon($icon,$row) {
00254
00255 $title = '['.$row['uid'].']';
00256 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ? $this->titleAttrib.'="'.htmlspecialchars($title).'"' : '').' border="0"');
00257
00258 return $theIcon;
00259 }
00260 }
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00278 class printAllPageTree_perms extends printAllPageTree {
00279
00287 function printTree($treeArr='',$printPath=0) {
00288 $titleLen=intval($this->BE_USER->uc['titleLen']);
00289
00290 $be_user_Array = t3lib_BEfunc::getUserNames();
00291 $be_group_Array = t3lib_BEfunc::getGroupNames();
00292 $lines=array();
00293 $lines[]='<tr class="bgColor5">
00294 <td nowrap="nowrap"><strong>Page title:</strong></td>
00295 '.($printPath?'<td nowrap="nowrap"><strong>Path:</strong></td>':'').'
00296 <td nowrap="nowrap" colspan=2><strong>User:</strong></td>
00297 <td nowrap="nowrap" colspan=2><strong>Group: </strong></td>
00298 <td nowrap="nowrap"><strong>Everybody: </strong></td>
00299 <td nowrap="nowrap"><strong>This user: </strong></td>
00300 <td nowrap="nowrap"><strong>Main group:</strong></td>
00301 </tr>';
00302
00303 if (!is_array($treeArr)) $treeArr=$this->tree;
00304 reset($treeArr);
00305 while(list($k,$v)=each($treeArr)) {
00306 $col1 = ' bgcolor="'.t3lib_div::modifyHtmlColor($GLOBALS['SOBE']->doc->bgColor4,+10,+10,+10).'"';
00307 $row = $v['row'];
00308 $title = htmlspecialchars(t3lib_div::fixed_lgd_cs($row['title'],$this->BE_USER->uc['titleLen']));
00309 $lines[]='<tr class="bgColor4">
00310 <td nowrap="nowrap">'.$v['HTML'].$title.' </td>
00311 '.($printPath?'<td nowrap="nowrap">'.htmlspecialchars(t3lib_BEfunc::getRecordPath ($row['pid'],'',15)).' </td>':'').'
00312 <td nowrap="nowrap"'.$col1.'>'.$be_user_Array[$row['perms_userid']]['username'].' </td>
00313 <td nowrap="nowrap"'.$col1.'>'.$this->ext_printPerms($row['perms_user']).' </td>
00314 <td nowrap="nowrap">'.$be_group_Array[$row['perms_groupid']]['title'].' </td>
00315 <td nowrap="nowrap">'.$this->ext_printPerms($row['perms_group']).' </td>
00316 <td nowrap="nowrap" align="center" '.$col1.'>'.$this->ext_printPerms($row['perms_everybody']).' </td>
00317 <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>
00318 <td nowrap="nowrap" align="center">'.$this->ext_printPerms($this->ext_groupPerms($row,$be_group_Array[$this->BE_USER->firstMainGroup])).' </td>
00319 </tr>';
00320 }
00321 return '<table border="0" cellpadding="0" cellspacing="0">'.implode('',$lines).'</table>';
00322 }
00323
00330 function ext_printPerms($int) {
00331 $str='';
00332 $str.= (($int&1)?'*':'<font color="red">x</font>');
00333 $str.= (($int&16)?'*':'<font color="red">x</font>');
00334 $str.= (($int&2)?'*':'<font color="red">x</font>');
00335 $str.= (($int&4)?'*':'<font color="red">x</font>');
00336 $str.= (($int&8)?'*':'<font color="red">x</font>');
00337
00338 return '<b><font color="green">'.$str.'</font></b>';
00339 }
00340
00348 function ext_groupPerms($row,$firstGroup) {
00349 if (is_array($row)) {
00350 $out=intval($row['perms_everybody']);
00351 if ($row['perms_groupid'] && $firstGroup['uid']==$row['perms_groupid']) {
00352 $out|= intval($row['perms_group']);
00353 }
00354 return $out;
00355 }
00356 }
00357 }
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00376 class localFolderTree extends t3lib_folderTree {
00377 var $expandFirst=0;
00378 var $expandAll=0;
00379
00387 function localFolderTree($BE_USER,$FILEMOUNTS='') {
00388 $this->init();
00389
00390 $this->BE_USER = $BE_USER;
00391 $this->MOUNTS = $FILEMOUNTS;
00392 $this->clause = '';
00393 }
00394
00402 function wrapTitle($str,$row) {
00403 return $str;
00404 }
00405
00414 function PM_ATagWrap($icon,$cmd,$bMark='') {
00415 return '';
00416 }
00417
00425 function wrapIcon($icon,$row) {
00426
00427 $title = $GLOBALS['SOBE']->localPath($row['path']);
00428 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ? $this->titleAttrib.'="'.htmlspecialchars($title).'"' : ''));
00429
00430 return $theIcon;
00431 }
00432
00438 function initializePositionSaving() {
00439 $this->stored=array();
00440 }
00441 }
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00462 class printAllFolderTree extends localFolderTree {
00463 var $expandFirst=1;
00464 var $expandAll=1;
00465
00474 function PM_ATagWrap($icon,$cmd,$bMark='') {
00475 return $icon;
00476 }
00477 }
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00496 class local_beUserAuth extends t3lib_beUserAuth {
00497 var $ext_pageIdsFromMounts='';
00498 var $ext_non_readAccessPageArray=array();
00499
00508 function returnWebmounts($pClause='') {
00509
00510
00511 $webmounts = (string)($this->groupData['webmounts'])!='' ? explode(',',$this->groupData['webmounts']) : Array();
00512
00513
00514 $pClause=$pClause?$pClause:$this->getPagePermsClause(1);
00515
00516
00517 foreach($webmounts as $k => $id) {
00518 $rec=t3lib_BEfunc::getRecord('pages',$id,'*',' AND '.$pClause);
00519 if (!is_array($rec)) {
00520 $this->ext_non_readAccessPageArray[$id]=t3lib_BEfunc::getRecord('pages',$id);
00521 unset($webmounts[$k]);
00522 }
00523 }
00524 return $webmounts;
00525 }
00526
00532 function ext_non_readAccessPages() {
00533 $lines=array();
00534
00535 foreach($this->ext_non_readAccessPageArray as $pA) {
00536 if ($pA) $lines[]=t3lib_BEfunc::getRecordPath($pA['uid'],'',15);
00537 }
00538 if (count($lines)) {
00539 return '<table bgcolor="red" border="0" cellpadding="0" cellspacing="0">
00540 <tr>
00541 <td align="center"><font color="white"><strong>The user has no read access to these DB-mounts!</strong></font></td>
00542 </tr>
00543 <tr>
00544 <td>'.implode('</td></tr><tr><td>',$lines).'</td>
00545 </tr>
00546 </table>';
00547 }
00548 }
00549
00555 function user_where_clause() {
00556 return 'AND pid=0 ';
00557 }
00558
00567 function ext_printOverview($uInfo,$compareFlags,$printTrees=0) {
00568
00569 if ($printTrees) {
00570
00571 $className=t3lib_div::makeInstanceClassName(!$this->isAdmin() ? 'printAllPageTree_perms' : 'printAllPageTree');
00572 $pagetree = new $className($this,$this->returnWebmounts());
00573 $pagetree->addField('perms_user',1);
00574 $pagetree->addField('perms_group',1);
00575 $pagetree->addField('perms_everybody',1);
00576 $pagetree->addField('perms_userid',1);
00577 $pagetree->addField('perms_groupid',1);
00578 $pagetree->addField('editlock',1);
00579
00580
00581 $className=t3lib_div::makeInstanceClassName('printAllFolderTree');
00582 $foldertree = new $className($this,$this->returnFilemounts());
00583 } else {
00584
00585 $className=t3lib_div::makeInstanceClassName('localPageTree');
00586 $pagetree = new $className($this,$this->returnWebmounts('1=1'));
00587
00588
00589 $className=t3lib_div::makeInstanceClassName('localFolderTree');
00590 $foldertree = new $className($this,$this->returnFilemounts());
00591 }
00592
00593
00594 $modNames = array(
00595 'web' => 'Web',
00596 'web_layout' => 'Page',
00597 'web_modules' => 'Modules',
00598 'web_info' => 'Info',
00599 'web_perms' => 'Access',
00600 'web_func' => 'Func',
00601 'web_list' => 'List',
00602 'web_ts' => 'Template',
00603 'file' => 'File',
00604 'file_list' => 'List',
00605 'file_images' => 'Images',
00606 'doc' => 'Doc.',
00607 'help' => 'Help',
00608 'help_about' => 'About',
00609 'help_quick' => 'User manual',
00610 'help_welcome' => 'Welcome',
00611 'user' => 'User',
00612 'user_setup' => 'Setup',
00613 'user_task' => 'Task center'
00614 );
00615
00616
00617 $out=array();
00618 foreach($uInfo as $k => $v) {
00619 if ($compareFlags[$k]) {
00620 switch($k) {
00621 case 'filemounts':
00622 $out[$k] = $foldertree->getBrowsableTree();
00623 break;
00624 case 'webmounts':
00625
00626 $pagetree->addSelfId=1;
00627 $out[$k] = $this->ext_non_readAccessPages();
00628 $out[$k].= $pagetree->getBrowsableTree();
00629 $this->ext_pageIdsFromMounts=implode(',',array_unique($pagetree->ids));
00630 break;
00631 case 'tempPath':
00632 $out[$k] = $GLOBALS['SOBE']->localPath($v);
00633 break;
00634 case 'pagetypes_select':
00635 $pageTypes = explode(',',$v);
00636 reset($pageTypes);
00637 while(list($kk,$vv)=each($pageTypes)) {
00638 $pageTypes[$kk]=$GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('pages','doktype',$vv));
00639 }
00640 $out[$k] = implode('<br />',$pageTypes);
00641 break;
00642 case 'tables_select':
00643 case 'tables_modify':
00644 $tables = explode(',',$v);
00645 reset($tables);
00646 while(list($kk,$vv)=each($tables)) {
00647 if ($vv) {
00648 $tables[$kk]='<span class="nobr">'.t3lib_iconWorks::getIconImage($vv,array(),$GLOBALS['BACK_PATH'],'align="top"').$GLOBALS['LANG']->sL($GLOBALS['TCA'][$vv]['ctrl']['title']).'</span>';
00649 }
00650 }
00651 $out[$k] = implode('<br />',$tables);
00652 break;
00653 case 'non_exclude_fields':
00654 $nef = explode(',',$v);
00655 reset($nef);
00656 $table='';
00657 $pout=array();
00658 while(list($kk,$vv)=each($nef)) {
00659 if ($vv) {
00660 list($thisTable,$field) = explode(':',$vv);
00661 if ($thisTable!=$table) {
00662 $table=$thisTable;
00663 t3lib_div::loadTCA($table);
00664 $pout[]='<span class="nobr">'.t3lib_iconWorks::getIconImage($table,array(),$GLOBALS['BACK_PATH'],'align="top"').$GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title']).'</span>';
00665 }
00666 if ($GLOBALS['TCA'][$table]['columns'][$field]) {
00667 $pout[]='<span class="nobr"> - '.ereg_replace(':$','',$GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['columns'][$field]['label'])).'</span>';
00668 }
00669 }
00670 }
00671 $out[$k] = implode('<br />',$pout);
00672 break;
00673 case 'groupList':
00674 case 'firstMainGroup':
00675 $uGroups = explode(',',$v);
00676 reset($uGroups);
00677 $table='';
00678 $pout=array();
00679 while(list($kk,$vv)=each($uGroups)) {
00680 if ($vv) {
00681 $uGRow = t3lib_BEfunc::getRecord('be_groups',$vv);
00682 $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>';
00683 }
00684 }
00685 $out[$k] = '<table border="0" cellpadding="0" cellspacing="0" width="100%">'.implode('',$pout).'</table>';
00686 break;
00687 case 'modules':
00688 $mods = explode(',',$v);
00689 reset($mods);
00690 $mainMod='';
00691 $pout=array();
00692 while(list($kk,$vv)=each($mods)) {
00693 if ($vv) {
00694 list($thisMod,$subMod) = explode('_',$vv);
00695 if ($thisMod!=$mainMod) {
00696 $mainMod=$thisMod;
00697 $pout[]='<span class="nobr">'.($modNames[$mainMod]?$modNames[$mainMod]:$mainMod).'</span>';
00698 }
00699 if ($subMod) {
00700 $pout[]='<span class="nobr"> - '.($modNames[$mainMod.'_'.$subMod]?$modNames[$mainMod.'_'.$subMod]:$mainMod.'_'.$subMod).'</span>';
00701 }
00702 }
00703 }
00704 $out[$k] = implode('<br />',$pout);
00705 break;
00706 case 'userTS':
00707
00708 $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');
00709 $tmpl->tt_track = 0;
00710
00711 $tmpl->fixedLgd=0;
00712 $tmpl->linkObjects=0;
00713 $tmpl->bType='';
00714 $tmpl->ext_expandAllNotes=1;
00715 $tmpl->ext_noPMicons=1;
00716 $out[$k] = $tmpl->ext_getObjTree($v,'','');
00717 break;
00718 case 'userTS_hl':
00719 $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
00720 $tsparser->lineNumberOffset=0;
00721 $out[$k] = $tsparser->doSyntaxHighlight($v,0,1);
00722 break;
00723 case 'explicit_allowdeny':
00724
00725
00726 $nef = array_flip(explode(',',$v));
00727 $pout = array();
00728
00729 $theTypes = t3lib_BEfunc::getExplicitAuthFieldValues();
00730
00731
00732 $icons = array(
00733 'ALLOW' => '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/icon_ok2.gif','').' class="absmiddle" alt="" />',
00734 'DENY' => '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/icon_fatalerror.gif','').' class="absmiddle" alt="" />',
00735 );
00736
00737
00738 foreach($theTypes as $tableFieldKey => $theTypeArrays) {
00739 if (is_array($theTypeArrays['items'])) {
00740 $pout[] = '<b>'.$theTypeArrays['tableFieldLabel'].'</b>';
00741
00742 foreach($theTypeArrays['items'] as $itemValue => $itemContent) {
00743 $v = $tableFieldKey.':'.$itemValue.':'.$itemContent[0];
00744 if (isset($nef[$v])) {
00745 unset($nef[$v]);
00746 $pout[] = $icons[$itemContent[0]].'['.$itemContent[2].'] '.$itemContent[1];
00747 } else {
00748 $pout[] = '<em style="color: #666666;">'.$icons[($itemContent[0]=='ALLOW' ? 'DENY' : 'ALLOW')].'['.$itemContent[2].'] '.$itemContent[1].'</em>';
00749 }
00750 }
00751 $pout[] = '';
00752 }
00753 }
00754
00755
00756 if (count($nef)) {
00757 $pout = array_merge($pout, array_keys($nef));
00758 }
00759
00760
00761 $out[$k] = implode('<br />',$pout);
00762 break;
00763 case 'allowed_languages':
00764
00765
00766 $nef = array_flip(explode(',',$v));
00767 $pout = array();
00768
00769
00770 $items = t3lib_BEfunc::getSystemLanguages();
00771
00772
00773 foreach($items as $iCfg) {
00774 if (isset($nef[$iCfg[1]])) {
00775 unset($nef[$iCfg[1]]);
00776 $icon = '<img src="'.$GLOBALS['BACK_PATH'].$iCfg[2].'" class="absmiddle" style="margin-right: 5px;" alt="" />';
00777 $pout[] = $icon.$iCfg[0];
00778 }
00779 }
00780
00781
00782 if (count($nef)) {
00783 $pout = array_merge($pout, array_keys($nef));
00784 }
00785
00786
00787 $out[$k] = implode('<br />',$pout);
00788 break;
00789 case 'custom_options':
00790
00791
00792 $nef = array_flip(explode(',',$v));
00793 $pout = array();
00794
00795
00796 $customOptions = $GLOBALS['TYPO3_CONF_VARS']['BE']['customPermOptions'];
00797 if (is_array($customOptions)) {
00798 foreach($customOptions as $coKey => $coValue) {
00799 if (is_array($coValue['items'])) {
00800
00801 foreach($coValue['items'] as $itemKey => $itemCfg) {
00802 $v = $coKey.':'.$itemKey;
00803 if (isset($nef[$v])) {
00804 unset($nef[$v]);
00805 $pout[] = $GLOBALS['LANG']->sl($coValue['header']).' / '.$GLOBALS['LANG']->sl($itemCfg[0]);
00806 }
00807 }
00808 }
00809 }
00810 }
00811
00812
00813 if (count($nef)) {
00814 $pout = array_merge($pout, array_keys($nef));
00815 }
00816
00817
00818 $out[$k] = implode('<br />',$pout);
00819 break;
00820 }
00821 }
00822 }
00823 return $out;
00824 }
00825
00831 function ext_getReadableButNonmounted() {
00832
00833
00834 if (!$this->ext_pageIdsFromMounts) {
00835 $this->ext_pageIdsFromMounts=0;
00836 }
00837
00838
00839 $be_user_Array = t3lib_BEfunc::getUserNames();
00840 $be_group_Array = t3lib_BEfunc::getGroupNames();
00841
00842
00843 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00844 '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':''),
00845 'pages',
00846 'uid NOT IN ('.$this->ext_pageIdsFromMounts.') AND '.$this->getPagePermsClause(1).t3lib_BEfunc::deleteClause('pages')
00847 );
00848 $dat = array();
00849 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00850 $dat[] = array(
00851 'row'=>$row,
00852 'HTML'=>t3lib_iconWorks::getIconImage('pages',$row,$GLOBALS['BACK_PATH'],'align="top" title="['.$row['uid'].']"')
00853 );
00854 }
00855 $className=t3lib_div::makeInstanceClassName('printAllPageTree_perms');
00856 $pp = new $className($this);
00857 return $pp->printTree($dat,1);
00858 }
00859
00866 function ext_printPerms($int) {
00867 $str='';
00868 $str.= (($int&1)?'*':'<font color="red">x</font>');
00869 $str.= (($int&16)?'*':'<font color="red">x</font>');
00870 $str.= (($int&2)?'*':'<font color="red">x</font>');
00871 $str.= (($int&4)?'*':'<font color="red">x</font>');
00872 $str.= (($int&8)?'*':'<font color="red">x</font>');
00873
00874 return '<b><font color="green">'.$str.'</font></b>';
00875 }
00876
00884 function ext_groupPerms($row,$firstGroup) {
00885 if (is_array($row)) {
00886 $out=intval($row['perms_everybody']);
00887 if ($row['perms_groupid'] && $firstGroup['uid']==$row['perms_groupid']) {
00888 $out|= intval($row['perms_group']);
00889 }
00890 return $out;
00891 }
00892 }
00893
00899 function ext_compileUserInfoForHash() {
00900 $uInfo=array();
00901
00902
00903 $uInfo['filemounts']=$this->ext_uniqueAndSortList(implode(',',array_keys($this->groupData['filemounts'])));
00904
00905
00906 $uInfo['webmounts']=$this->ext_uniqueAndSortList($this->groupData['webmounts']);
00907
00908
00909 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00910 $fileProcessor->init($this->groupData['filemounts'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
00911 $uInfo['tempPath'] = $fileProcessor->findTempFolder();
00912
00913
00914 $uInfo['firstMainGroup']=$this->firstMainGroup;
00915
00916
00917
00918 $uInfo['groupList']=$this->groupList;
00919
00920
00921 $uInfo['pagetypes_select']=$this->ext_uniqueAndSortList($this->groupData['pagetypes_select']);
00922
00923
00924 $uInfo['tables_select']=$this->ext_uniqueAndSortList($this->groupData['tables_select'].','.$this->groupData['tables_modify']);
00925
00926
00927 $uInfo['tables_modify']=$this->ext_uniqueAndSortList($this->groupData['tables_modify']);
00928
00929
00930 $uInfo['non_exclude_fields']=$this->ext_uniqueAndSortList($this->groupData['non_exclude_fields']);
00931
00932
00933 $uInfo['explicit_allowdeny']=$this->ext_uniqueAndSortList($this->groupData['explicit_allowdeny']);
00934
00935
00936 $uInfo['allowed_languages']=$this->ext_uniqueAndSortList($this->groupData['allowed_languages']);
00937
00938
00939 $uInfo['custom_options']=$this->ext_uniqueAndSortList($this->groupData['custom_options']);
00940
00941
00942 $uInfo['modules']=$this->ext_uniqueAndSortList($this->groupData['modules']);
00943
00944
00945 $this->ext_ksortArrayRecursive($this->userTS);
00946 $uInfo['userTS'] = $this->userTS;
00947
00948 $uInfo['userTS_hl'] = $this->userTS_text;
00949
00950 return $uInfo;
00951 }
00952
00959 function ext_uniqueAndSortList($list) {
00960 $uList=t3lib_div::trimExplode(',',$list,1);
00961 sort($uList);
00962 $uList=array_unique($uList);
00963 $uList=implode(',',$uList);
00964 return $uList;
00965 }
00966
00973 function ext_ksortArrayRecursive(&$arr) {
00974 krsort($arr);
00975 reset($arr);
00976 while(list($k,$v)=each($arr)) {
00977 if (is_array($v)) $this->ext_ksortArrayRecursive($arr[$k]);
00978 }
00979 }
00980 }
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
01000 class SC_mod_tools_be_user_index {
01001 var $MCONF=array();
01002 var $MOD_MENU=array();
01003 var $MOD_SETTINGS=array();
01004 var $doc;
01005
01006 var $include_once=array();
01007 var $content;
01008
01012 function init() {
01013 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
01014 $this->MCONF = $GLOBALS['MCONF'];
01015
01016 $this->menuConfig();
01017 $this->switchUser(t3lib_div::_GP('SwitchUser'));
01018
01019
01020
01021
01022
01023 $this->doc = t3lib_div::makeInstance('noDoc');
01024 $this->doc->form='<form action="" method="POST">';
01025 $this->doc->backPath = $BACK_PATH;
01026
01027 $this->doc->JScode = $this->doc->wrapScriptTags('
01028 script_ended = 0;
01029 function jumpToUrl(URL) {
01030 document.location = URL;
01031 }
01032 ');
01033 }
01034
01040 function menuConfig() {
01041 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
01042
01043
01044
01045
01046
01047 $this->MOD_MENU = array(
01048 'function' => array(
01049 'compare' => 'Compare User Settings'
01050 )
01051 );
01052
01053 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name'], 'ses');
01054 }
01055
01061 function main() {
01062 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
01063
01064 $this->content='';
01065 $this->content.=$this->doc->startPage('Backend User Administration');
01066
01067 $menu=t3lib_BEfunc::getFuncMenu(0,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function']);
01068
01069 $this->content.=$this->doc->header('Backend User Administration');
01070 $this->content.=$this->doc->spacer(5);
01071 $this->content.=$this->doc->section('',$menu).$this->doc->divider(5);
01072
01073 switch($this->MOD_SETTINGS['function']) {
01074 case 'compare':
01075 if (t3lib_div::_GP('ads')) {
01076 $compareFlags = t3lib_div::_GP('compareFlags');
01077 $BE_USER->pushModuleData('tools_beuser/index.php/compare',$compareFlags);
01078 } else {
01079 $compareFlags = $BE_USER->getModuleData('tools_beuser/index.php/compare','ses');
01080 }
01081 $this->content.=$this->compareUsers($compareFlags);
01082 break;
01083 }
01084
01085
01086 if ($BE_USER->mayMakeShortcut()) {
01087 $this->content.=$this->doc->spacer(20).
01088 $this->doc->section('',$this->doc->makeShortcutIcon('be_user_uid,compareFlags','function',$this->MCONF['name']));
01089 }
01090 }
01091
01097 function printContent() {
01098
01099 $this->content.=$this->doc->endPage();
01100 echo $this->content;
01101 }
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01119 function compareUsers($compareFlags) {
01120 global $SOBE;
01121
01122 $options = array(
01123 'filemounts' => 'Filemounts',
01124 'webmounts' => 'Webmounts',
01125 'tempPath' => 'Default upload path',
01126 'firstMainGroup' => 'Main user group',
01127 'groupList' => 'Member of groups',
01128 'pagetypes_select' => 'Page types access',
01129 'tables_select' => 'Select tables',
01130 'tables_modify' => 'Modify tables',
01131 'non_exclude_fields' => 'Non-exclude fields',
01132 'explicit_allowdeny' => 'Explicit Allow/Deny',
01133 'allowed_languages' => 'Limit to languages',
01134 'custom_options' => 'Custom options',
01135 'modules' => 'Modules',
01136 'userTS' => 'TSconfig',
01137 'userTS_hl' => 'TSconfig HL',
01138 );
01139
01140 $be_user_uid = t3lib_div::_GP('be_user_uid');
01141 if ($be_user_uid) {
01142
01143 $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');
01144 $tempBE_USER->userTS_dontGetCached=1;
01145 $tempBE_USER->OS = TYPO3_OS;
01146 $tempBE_USER->setBeUserByUid($be_user_uid);
01147 $tempBE_USER->fetchGroupData();
01148
01149 $uInfo = $tempBE_USER->ext_compileUserInfoForHash();
01150 $uInfo_dat = $tempBE_USER->ext_printOverview($uInfo,$options,1);
01151
01152 $lines=array();
01153 reset($options);
01154 while(list($kk,$vv)=each($options)) {
01155 if ($kk=='modules') {
01156 $loadModules = t3lib_div::makeInstance('t3lib_loadModules');
01157 $loadModules->load($GLOBALS['TBE_MODULES'],$tempBE_USER);
01158 $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
01159 $uInfo_dat[$kk] = $alt_menuObj->topMenu($loadModules->modules,1,$GLOBALS['BACK_PATH']);
01160 }
01161 $lines[]='<tr class="bgColor4">
01162 <td nowrap="nowrap" valign="top">'.$vv.': </td>
01163 <td>'.$uInfo_dat[$kk].' </td>
01164 </tr>';
01165
01166 if ($kk=='webmounts' && !$tempBE_USER->isAdmin()) {
01167 $lines[]='<tr class="bgColor4">
01168 <td nowrap="nowrap" valign="top">Non-mounted readable pages: </td>
01169 <td>'.$tempBE_USER->ext_getReadableButNonmounted().' </td>
01170 </tr>';
01171 }
01172 }
01173
01174 $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>';
01175 $outTable.= '<td>'.$tempBE_USER->user['realName'].($tempBE_USER->user['email'] ? ', <a href="mailto:'.$tempBE_USER->user['email'].'">'.$tempBE_USER->user['email'].'</a>' : '').'</td>';
01176 $outTable.= '<td>'.$this->elementLinks('be_users',$tempBE_USER->user).'</td></tr></table>';
01177 $outTable.= '<strong><a href="index.php">< Back to overview</a></strong><br />';
01178
01179 $outTable.= '<br /><table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
01180 $content.= $this->doc->section('User info',$outTable,0,1);
01181 } else {
01182 reset($options);
01183 $menu=array();
01184 while(list($kk,$vv)=each($options)) {
01185 $menu[]='<input type="checkbox" value="1" name="compareFlags['.$kk.']"'.($compareFlags[$kk]?' checked="checked"':'').'>'.htmlspecialchars($vv);
01186 }
01187 $outCode = 'Group by:<br />'.implode('<br />',$menu);
01188 $outCode.='<br /><input type="submit" name="ads" value="Update">';
01189 $content = $this->doc->section('Group and Compare Users',$outCode,0,1);
01190
01191
01192
01193 $users = t3lib_BEfunc::getUserNames();
01194 $comparation=array();
01195
01196 reset($users);
01197 $counter=0;
01198
01199
01200 $offset=0;
01201 $numberAtTime=1000;
01202 $tooManyUsers='';
01203
01204 while(list(,$r)=each($users)) {
01205 if ($counter>=$offset) {
01206
01207 $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');
01208 $tempBE_USER->OS = TYPO3_OS;
01209 $tempBE_USER->setBeUserByUid($r['uid']);
01210 $tempBE_USER->fetchGroupData();
01211
01212
01213 $md5pre='';
01214 $menu=array();
01215 $uInfo = $tempBE_USER->ext_compileUserInfoForHash();
01216 reset($options);
01217 while(list($kk,$vv)=each($options)) {
01218 if ($compareFlags[$kk]) {
01219 $md5pre.=serialize($uInfo[$kk]).'|';
01220 }
01221 }
01222
01223 $md5=md5($md5pre);
01224 if (!isset($comparation[$md5])) {
01225 $comparation[$md5]=$tempBE_USER->ext_printOverview($uInfo,$compareFlags);
01226 $comparation[$md5]['users']=array();
01227 }
01228 $comparation[$md5]['users'][]=$tempBE_USER->user;
01229 unset($tempBE_USER);
01230 }
01231 $counter++;
01232 if ($counter>=($numberAtTime+$offset)) {
01233 $tooManyUsers='There were more than '.$numberAtTime.' users (total: '.count($users).') and this tool can display only '.$numberAtTime.' at a time!';
01234 break;
01235 }
01236 }
01237
01238
01239 $allGroups=array();
01240
01241 $allCells = array();
01242 reset($options);
01243 $allCells['USERS'] = '<b>Usernames:</b>';
01244 while(list($kk,$vv)=each($options)) {
01245 if ($compareFlags[$kk]) {
01246 $allCells[$kk] = '<b>'.$vv.':</b>';
01247 }
01248 }
01249 $allGroups[]=$allCells;
01250
01251 reset($comparation);
01252 while(list(,$dat)=each($comparation)) {
01253 $allCells = array();
01254
01255 $uListArr=array();
01256 reset($dat['users']);
01257 while(list(,$uDat)=each($dat['users'])) {
01258 $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).
01259 '<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>'.
01260 '</td></tr>';
01261 }
01262 $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.implode('',$uListArr).'</table>';
01263
01264 reset($options);
01265 while(list($kk,$vv)=each($options)) {
01266 if ($compareFlags[$kk]) {
01267 $allCells[$kk] = $dat[$kk];
01268 }
01269 }
01270 $allGroups[]=$allCells;
01271 }
01272
01273
01274 $outTable='';
01275 reset($allGroups);
01276 $TDparams=' nowrap="nowrap" class="bgColor5" valign="top"';
01277 while(list(,$allCells)=each($allGroups)) {
01278 $outTable.='<tr><td'.$TDparams.'>'.implode('</td><td'.$TDparams.'>',$allCells).'</td></tr>';
01279 $TDparams=' nowrap="nowrap" class="bgColor4" valign="top"';
01280 }
01281 $outTable='<table border="0" cellpadding="2" cellspacing="2">'.$outTable.'</table>';
01282 $outTable.=fw('<br /><br />(All cached group lists updated.)');
01283 $outTable.=$tooManyUsers?'<br /><br /><strong><span class="typo3-red">'.$tooManyUsers.'</span></strong>':'';
01284 $content.= $this->doc->spacer(10);
01285 $content.= $this->doc->section('Result',$outTable,0,1);
01286 }
01287 return $content;
01288 }
01289
01297 function linkUser($str,$rec) {
01298 return '<a href="index.php?be_user_uid='.$rec['uid'].'">'.$str.'</a>';
01299 }
01300
01308 function elementLinks($table,$row) {
01309 global $TCA;
01310
01311 $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>';
01312
01313
01314 $params='&edit['.$table.']['.$row['uid'].']=edit';
01315 $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>';
01316
01317
01318 $hiddenField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
01319 if ($row[$hiddenField]) {
01320 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0';
01321 $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>';
01322 } else {
01323 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1';
01324 $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>';
01325 }
01326
01327
01328 $params='&cmd['.$table.']['.$row['uid'].'][delete]=1';
01329 $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>';
01330
01331 return implode('',$cells);
01332 }
01333
01339 function initUsers() {
01340
01341 $users = t3lib_BEfunc::getUserNames();
01342
01343 reset($users);
01344 while(list(,$r)=each($users)) {
01345
01346 $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');
01347 $tempBE_USER->OS = TYPO3_OS;
01348 $tempBE_USER->setBeUserByUid($r['uid']);
01349 $tempBE_USER->fetchGroupData();
01350 }
01351 }
01352
01359 function localPath($str) {
01360 if (substr($str,0,strlen(PATH_site))==PATH_site) {
01361 return substr($str,strlen(PATH_site));
01362 } else return $str;
01363 }
01364
01371 function switchUser($switchUser) {
01372 $uRec=t3lib_BEfunc::getRecord('be_users',$switchUser);
01373 if (is_array($uRec) && $GLOBALS['BE_USER']->isAdmin()) {
01374 $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']), array('ses_userid' => $uRec['uid']));
01375
01376 header('Location: '.t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'].'index.php'.($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']?'':'?commandLI=1')));
01377 exit;
01378 }
01379 }
01380 }
01381
01382
01383 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/beuser/mod/index.php']) {
01384 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/beuser/mod/index.php']);
01385 }
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399 $SOBE = t3lib_div::makeInstance('SC_mod_tools_be_user_index');
01400 $SOBE->init();
01401 $SOBE->main();
01402 $SOBE->printContent();
01403 ?>