2 /***************************************************************
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Backend User Administration Module
30 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
33 $GLOBALS['LANG']->includeLLFile('EXT:beuser/mod/locallang.xml');
35 $BE_USER->modAccess($MCONF,1);
43 * Base Extension class for printing a page tree (non-browsable though)
45 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
47 * @subpackage tx_beuser
49 class localPageTree
extends t3lib_browseTree
{
54 * Local backend user (not the GLOBALS[] backend user!!)
56 * @var t3lib_beUserAuth
61 * Constructor for the local page tree.
63 * @param object Local backend user (not the GLOBALS[] backend user!!)
64 * @param array Webmounts for the backend user.
67 function __construct($BE_USER,$WEBMOUNTS='') {
70 $this->BE_USER
= $BE_USER;
71 $this->MOUNTS
= $WEBMOUNTS;
72 $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.
73 $this->orderByFields
= 'sorting';
77 * Compatibility constructor.
79 * @param object Local backend user (not the GLOBALS[] backend user!!)
80 * @param array Webmounts for the backend user
81 * @deprecated since TYPO3 4.6 and will be removed in TYPO3 4.8. Use __construct() instead.
83 public function localPageTree($BE_USER, $WEBMOUNTS = '') {
84 t3lib_div
::logDeprecatedFunction();
85 // Note: we cannot call $this->__construct() here because it would call the derived class constructor and cause recursion
86 // This code uses official PHP behavior (http://www.php.net/manual/en/language.oop5.basic.php) when $this in the
87 // statically called non-static method inherits $this from the caller's scope.
88 localPageTree
::__construct($BE_USER, $WEBMOUNTS);
92 * Return select permissions.
94 * @return string WHERE query part.
96 function ext_permsC() {
103 * @param string [See parent]
104 * @param array [See parent]
107 function wrapTitle($str,$row) {
112 * Wraps the plus/minus icon - in this case we just return blank which means we STRIP AWAY the plus/minus icon!
114 * @param string [See parent]
115 * @param string [See parent]
116 * @param string [See parent]
119 function PM_ATagWrap($icon,$cmd,$bMark='') {
124 * Wrapping the icon of the element/page. Normally a click menu is wrapped around the icon, but in this case only a title parameter is set.
126 * @param string Icon image tag.
128 * @return string Icon with title attribute added.
130 function wrapIcon($icon,$row) {
131 // Add title attribute to input icon tag
132 $title = '['.$row['uid'].'] '.t3lib_BEfunc
::getRecordPath($row['uid'],'',15);
133 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ?
$this->titleAttrib
.'="'.htmlspecialchars($title).'"' : '').' border="0"');
139 * This will make sure that no position data is acquired from the BE_USER uc variable.
143 function initializePositionSaving() {
144 $this->stored
=array();
158 * Extension class for printing a page tree: All pages of a mount point.
160 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
162 * @subpackage tx_beuser
164 class printAllPageTree
extends localPageTree
{
169 * Return select permissions.
171 * @return string WHERE query part.
173 function ext_permsC() {
174 return ' AND '.$this->BE_USER
->getPagePermsClause(1);
178 * Returns the plus/minus icon.
180 * @param string [See parent]
181 * @param string [See parent]
182 * @param string [See parent]
185 function PM_ATagWrap($icon,$cmd,$bMark='') {
190 * Wrapping the icon of the element/page. Normally a click menu is wrapped around the icon, but in this case only a title parameter is set.
192 * @param string Icon image tag.
194 * @return string Icon with title attribute added.
196 function wrapIcon($icon,$row) {
197 // Add title attribute to input icon tag
198 $title = '['.$row['uid'].']';
199 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ?
$this->titleAttrib
.'="'.htmlspecialchars($title).'"' : '').' border="0"');
215 * Extension class for printing a page tree: Printing all pages, with permissions.
217 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
219 * @subpackage tx_beuser
221 class printAllPageTree_perms
extends printAllPageTree
{
224 * Print the tree of pages.
226 * @param array The tree items
227 * @param boolean If set, the path of the pages in the tree is printed (only done for pages outside of mounts).
228 * @return string HTML content.
230 function printTree($treeArr='',$printPath=0) {
231 $titleLen=intval($this->BE_USER
->uc
['titleLen']);
233 $be_user_Array = t3lib_BEfunc
::getUserNames();
234 $be_group_Array = t3lib_BEfunc
::getGroupNames();
236 $lines[]='<tr class="bgColor5">
237 <td nowrap="nowrap"><strong>' . $GLOBALS['LANG']->getLL('pageTitle', TRUE) . '</strong></td>
238 ' . ($printPath?
'<td nowrap="nowrap"><strong>' . $GLOBALS['LANG']->getLL('path', TRUE) . '</strong></td>':'') . '
239 <td nowrap="nowrap" colspan="2"><strong>' . $GLOBALS['LANG']->getLL('user', TRUE) . '</strong></td>
240 <td nowrap="nowrap" colspan="2"><strong>' . $GLOBALS['LANG']->getLL('group', TRUE) . ' </strong></td>
241 <td nowrap="nowrap"><strong>' . $GLOBALS['LANG']->getLL('everybody', TRUE) . ' </strong></td>
242 <td nowrap="nowrap"><strong>' . $GLOBALS['LANG']->getLL('thisUser', TRUE) . ' </strong></td>
243 <td nowrap="nowrap"><strong>' . $GLOBALS['LANG']->getLL('mainGroup', TRUE) . '</strong></td>
246 if (!is_array($treeArr)) {
247 $treeArr = $this->tree
;
249 foreach ($treeArr as $v) {
250 $col1 = ' bgcolor="'.t3lib_div
::modifyHtmlColor($GLOBALS['SOBE']->doc
->bgColor4
,+
10,+
10,+
10).'"';
252 $title = htmlspecialchars(t3lib_div
::fixed_lgd_cs($row['title'],$this->BE_USER
->uc
['titleLen']));
253 $lines[]='<tr class="bgColor4">
254 <td nowrap="nowrap">'.$v['HTML'].$title.' </td>
255 '.($printPath?
'<td nowrap="nowrap">'.htmlspecialchars(t3lib_BEfunc
::getRecordPath ($row['pid'],'',15)).' </td>':'').'
256 <td nowrap="nowrap"'.$col1.'>'.$be_user_Array[$row['perms_userid']]['username'].' </td>
257 <td nowrap="nowrap"'.$col1.'>'.$this->ext_printPerms($row['perms_user']).' </td>
258 <td nowrap="nowrap">'.$be_group_Array[$row['perms_groupid']]['title'].' </td>
259 <td nowrap="nowrap">'.$this->ext_printPerms($row['perms_group']).' </td>
260 <td nowrap="nowrap" align="center" '.$col1.'>'.$this->ext_printPerms($row['perms_everybody']).' </td>
261 <td nowrap="nowrap" align="center">' . ($row['editlock'] ? t3lib_iconWorks
::getSpriteIcon('status-warning-in-use', array('title' => $GLOBALS['LANG']->getLL('editLock', TRUE))) : $this->ext_printPerms($this->BE_USER
->calcPerms($row))) . ' </td>
262 <td nowrap="nowrap" align="center">'.$this->ext_printPerms($this->ext_groupPerms($row,$be_group_Array[$this->BE_USER
->firstMainGroup
])).' </td>
265 return '<table border="0" cellpadding="0" cellspacing="0">'.implode('',$lines).'</table>';
269 * Print a set of permissions
271 * @param integer The permissions integer.
272 * @return string HTML formatted.
274 function ext_printPerms($int) {
276 $str.= (($int&1)?
'*':'<font color="red">x</font>');
277 $str.= (($int&16)?
'*':'<font color="red">x</font>');
278 $str.= (($int&2)?
'*':'<font color="red">x</font>');
279 $str.= (($int&4)?
'*':'<font color="red">x</font>');
280 $str.= (($int&8)?
'*':'<font color="red">x</font>');
282 return '<strong style="color:green;">'.$str.'</strong>';
286 * returns the permissions for a group based of the perms_groupid of $row. If the $row[perms_groupid] equals the $firstGroup[uid] then the function returns perms_everybody OR'ed with perms_group, else just perms_everybody
288 * @param array Page record.
289 * @param array First-group record.
290 * @return integer Permissions.
292 function ext_groupPerms($row,$firstGroup) {
293 if (is_array($row)) {
294 $out=intval($row['perms_everybody']);
295 if ($row['perms_groupid'] && $firstGroup['uid']==$row['perms_groupid']) {
296 $out|
= intval($row['perms_group']);
314 * Base Extension class for printing a folder tree (non-browsable though)
316 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
318 * @subpackage tx_beuser
320 class localFolderTree
extends t3lib_folderTree
{
325 * Local backend user (not the GLOBALS[] backend user!!)
327 * @var t3lib_beUserAuth
332 * Constructor for the local folder tree.
334 * @param object Local backend user (not the GLOBALS[] backend user!!)
335 * @param array Filemounts for the backend user.
338 function __construct($BE_USER,$FILEMOUNTS='') {
341 $this->BE_USER
= $BE_USER;
342 $this->MOUNTS
= $FILEMOUNTS;
343 $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.
347 * Compatibility constructor.
349 * @param object Local backend user (not the GLOBALS[] backend user!!)
350 * @param array Filemounts for the backend user
351 * @deprecated since TYPO3 4.6 and will be removed in TYPO3 4.8. Use __construct() instead.
353 public function localFolderTree($BE_USER, $FILEMOUNTS = '') {
354 t3lib_div
::logDeprecatedFunction();
355 // Note: we cannot call $this->__construct() here because it would call the derived class constructor and cause recursion
356 // This code uses official PHP behavior (http://www.php.net/manual/en/language.oop5.basic.php) when $this in the
357 // statically called non-static method inherits $this from the caller's scope.
358 localFolderTree
::__construct($BE_USER, $FILEMOUNTS);
364 * @param string [See parent]
365 * @param array [See parent]
368 function wrapTitle($str,$row) {
373 * Wraps the plus/minus icon - in this case we just return blank which means we STRIP AWAY the plus/minus icon!
375 * @param string [See parent]
376 * @param string [See parent]
377 * @param string [See parent]
380 function PM_ATagWrap($icon,$cmd,$bMark='') {
385 * Wrapping the icon of the element/page. Normally a click menu is wrapped around the icon, but in this case only a title parameter is set.
387 * @param string Icon image tag.
389 * @return string Icon with title attribute added.
391 function wrapIcon($icon,$row) {
392 // Add title attribute to input icon tag
393 $title = $GLOBALS['SOBE']->localPath($row['path']);
394 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ?
$this->titleAttrib
.'="'.htmlspecialchars($title).'"' : ''));
400 * This will make sure that no position data is acquired from the BE_USER uc variable.
404 function initializePositionSaving() {
405 $this->stored
=array();
422 * Extension class for printing a folder tree: All folders
424 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
426 * @subpackage tx_beuser
428 class printAllFolderTree
extends localFolderTree
{
433 * Wraps the plus/minus icon - in this case we just return blank which means we STRIP AWAY the plus/minus icon!
435 * @param string [See parent]
436 * @param string [See parent]
437 * @param string [See parent]
440 function PM_ATagWrap($icon,$cmd,$bMark='') {
456 * Extension class of beuserauth class.
458 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
460 * @subpackage tx_beuser
462 class local_beUserAuth
extends t3lib_beUserAuth
{
463 var $ext_pageIdsFromMounts=''; // List of mounted page ids (from browsetree class when selecting mountpoints)
464 var $ext_non_readAccessPageArray=array(); // Storage for non-readable webmounts, see returnWebmounts()
467 * Returns an array of the webmounts for the user, with non-readable webmounts filtered out.
468 * If there are non-readable webmounts they are registered in $this->ext_non_readAccessPageArray
469 * (Extending function in parent class)
471 * @param string alternative select clause (default is getPagePermsClause(1)). For instance to make sure that ALL webmounts are selected regardless of whether the user has read access or not, you can set this to "1=1".
472 * @return array Webmounts id's
474 function returnWebmounts($pClause='') {
476 // Get array of webmounts:
477 $webmounts = (string)($this->groupData
['webmounts'])!='' ?
explode(',',$this->groupData
['webmounts']) : Array();
479 // Get select clause:
480 $pClause=$pClause?
$pClause:$this->getPagePermsClause(1);
482 // Traverse mounts, check if they are readable:
483 foreach ($webmounts as $k => $id) {
484 $rec=t3lib_BEfunc
::getRecord('pages',$id,'*',' AND '.$pClause);
485 if (!is_array($rec)) {
486 $this->ext_non_readAccessPageArray
[$id]=t3lib_BEfunc
::getRecord('pages',$id);
487 unset($webmounts[$k]);
494 * Based on the content of ->ext_non_readAccessPageArray (see returnWebmounts()) it generates visually formatted information about these non-readable mounts.
496 * @return string HTML content showing which DB-mounts were not accessible for the user
498 function ext_non_readAccessPages() {
501 foreach ($this->ext_non_readAccessPageArray
as $pA) {
503 $lines[] = t3lib_BEfunc
::getRecordPath($pA['uid'],'',15);
507 return '<table bgcolor="red" border="0" cellpadding="0" cellspacing="0">
509 <td align="center"><font color="white"><strong>' . $GLOBALS['LANG']->getLL('noReadAccess', TRUE) . '</strong></font></td>
512 <td>'.implode('</td></tr><tr><td>',$lines).'</td>
519 * This returns the where-clause needed to select the user with respect flags like deleted, hidden, starttime, endtime
523 function user_where_clause() {
528 * Creates the overview information based on which analysis topics were selected.
530 * @param array Array of analysis topics
531 * @param array Array of the selected analysis topics (from session variable somewhere)
532 * @param boolean If set, the full trees of pages/folders are printed.
533 * @return array Array with accumulated HTML content.
535 function ext_printOverview($uInfo,$compareFlags,$printTrees=0) {
536 // Prepare for filemount and db-mount
537 if ($printTrees) { // ... this is if we see the detailed view for a user:
539 $pagetree = t3lib_div
::makeInstance(!$this->isAdmin() ?
'printAllPageTree_perms' : 'printAllPageTree', $this, $this->returnWebmounts()); // Here, only readable webmounts are returned (1=1)
540 $pagetree->addField('perms_user',1);
541 $pagetree->addField('perms_group',1);
542 $pagetree->addField('perms_everybody',1);
543 $pagetree->addField('perms_userid',1);
544 $pagetree->addField('perms_groupid',1);
545 $pagetree->addField('editlock',1);
547 // Folder tree object:
548 $foldertree = t3lib_div
::makeInstance('printAllFolderTree', $this, $this->returnFilemounts());
551 $pagetree = t3lib_div
::makeInstance('localPageTree', $this, $this->returnWebmounts('1=1')); // Here, ALL webmounts are returned (1=1)
553 // Folder tree object:
554 $foldertree = t3lib_div
::makeInstance('localFolderTree', $this, $this->returnFilemounts());
557 // Names for modules:
560 'web_layout' => 'Page',
561 'web_modules' => 'Modules',
562 'web_info' => 'Info',
563 'web_perms' => 'Access',
564 'web_func' => 'Func',
565 'web_list' => 'List',
566 'web_ts' => 'Template',
568 'file_list' => 'List',
569 'file_images' => 'Images',
572 'help_about' => 'About',
573 'help_quick' => 'User manual',
574 'help_welcome' => 'Welcome',
576 'user_setup' => 'Setup',
577 'user_task' => 'Task center'
580 // Traverse the enabled analysis topics:
582 foreach ($uInfo as $k => $v) {
583 if ($compareFlags[$k]) {
586 $out[$k] = $foldertree->getBrowsableTree();
590 $pagetree->addSelfId
=1;
591 $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)
592 $out[$k].= $pagetree->getBrowsableTree(); // Add HTML for readable webmounts.
593 $this->ext_pageIdsFromMounts
=implode(',',array_unique($pagetree->ids
)); // List of mounted page ids
596 $out[$k] = $GLOBALS['SOBE']->localPath($v);
598 case 'pagetypes_select':
599 $pageTypes = explode(',',$v);
600 foreach ($pageTypes as &$vv) {
601 $vv = $GLOBALS['LANG']->sL(t3lib_BEfunc
::getLabelFromItemlist('pages','doktype',$vv));
604 $out[$k] = implode('<br />',$pageTypes);
606 case 'tables_select':
607 case 'tables_modify':
608 $tables = explode(',',$v);
609 foreach ($tables as &$vv) {
611 $vv = '<span class="nobr">'.t3lib_iconWorks
::getSpriteIconForRecord($vv,array()).$GLOBALS['LANG']->sL($GLOBALS['TCA'][$vv]['ctrl']['title']).'</span>';
615 $out[$k] = implode('<br />',$tables);
617 case 'non_exclude_fields':
618 $nef = explode(',',$v);
621 foreach ($nef as $vv) {
623 list($thisTable,$field) = explode(':',$vv);
624 if ($thisTable!=$table) {
626 t3lib_div
::loadTCA($table);
627 $pout[]='<span class="nobr">'.t3lib_iconWorks
::getSpriteIconForRecord($table,array()).$GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title']).'</span>';
629 if ($GLOBALS['TCA'][$table]['columns'][$field]) {
630 $pout[]='<span class="nobr"> - '.rtrim($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']), ':').'</span>';
634 $out[$k] = implode('<br />',$pout);
637 case 'firstMainGroup':
638 $uGroups = explode(',',$v);
641 foreach ($uGroups as $vv) {
643 $uGRow = t3lib_BEfunc
::getRecord('be_groups',$vv);
644 $title = t3lib_BEfunc
::getRecordTitle('be_groups', $uGRow);
645 $pout[] = '<tr><td nowrap="nowrap">' . t3lib_iconWorks
::getSpriteIconForRecord('be_groups', $uGRow) .
646 ' ' . htmlspecialchars($title) . ' </td><td width="1%" nowrap="nowrap">' .
647 $GLOBALS['SOBE']->elementLinks('be_groups', $uGRow) . '</td></tr>';
650 $out[$k] = '<table border="0" cellpadding="0" cellspacing="0" width="100%">'.implode('',$pout).'</table>';
653 $mods = explode(',',$v);
656 foreach ($mods as $vv) {
658 list($thisMod,$subMod) = explode('_',$vv);
659 if ($thisMod!=$mainMod) {
661 $pout[]='<span class="nobr">'.($modNames[$mainMod]?
$modNames[$mainMod]:$mainMod).'</span>';
664 $pout[]='<span class="nobr"> - '.($modNames[$mainMod.'_'.$subMod]?
$modNames[$mainMod.'_'.$subMod]:$mainMod.'_'.$subMod).'</span>';
668 $out[$k] = implode('<br />',$pout);
672 $tmpl = t3lib_div
::makeInstance('t3lib_tsparser_ext'); // Defined global here!
673 $tmpl->tt_track
= 0; // Do not log time-performance information
676 $tmpl->linkObjects
=0;
678 $tmpl->ext_expandAllNotes
=1;
679 $tmpl->ext_noPMicons
=1;
680 $out[$k] = $tmpl->ext_getObjTree($v,'','','','','1');
683 $tsparser = t3lib_div
::makeInstance('t3lib_TSparser');
684 $tsparser->lineNumberOffset
=0;
685 $out[$k] = $tsparser->doSyntaxHighlight($v,0,1);
687 case 'explicit_allowdeny':
689 // Explode and flip values:
690 $nef = array_flip(explode(',',$v));
693 $theTypes = t3lib_BEfunc
::getExplicitAuthFieldValues();
697 'ALLOW' => t3lib_iconWorks
::getSpriteIcon('status-dialog-ok'),
698 'DENY' => t3lib_iconWorks
::getSpriteIcon('status-dialog-error'),
702 foreach ($theTypes as $tableFieldKey => $theTypeArrays) {
703 if (is_array($theTypeArrays['items'])) {
704 $pout[] = '<strong>'.$theTypeArrays['tableFieldLabel'].'</strong>';
705 // Traverse options for this field:
706 foreach ($theTypeArrays['items'] as $itemValue => $itemContent) {
707 $v = $tableFieldKey.':'.$itemValue.':'.$itemContent[0];
708 if (isset($nef[$v])) {
710 $pout[] = $icons[$itemContent[0]].'['.$itemContent[2].'] '.$itemContent[1];
712 $pout[] = '<em style="color: #666666;">'.$icons[($itemContent[0]=='ALLOW' ?
'DENY' : 'ALLOW')].'['.$itemContent[2].'] '.$itemContent[1].'</em>';
721 $pout = array_merge($pout, array_keys($nef));
724 // Implode for display:
725 $out[$k] = implode('<br />',$pout);
727 case 'allowed_languages':
729 // Explode and flip values:
730 $nef = array_flip(explode(',',$v));
734 $items = t3lib_BEfunc
::getSystemLanguages();
737 foreach ($items as $iCfg) {
738 if (isset($nef[$iCfg[1]])) {
739 unset($nef[$iCfg[1]]);
740 if (strpos($iCfg[2], '.gif') === FALSE) {
741 $icon = t3lib_iconWorks
::getSpriteIcon($iCfg[2]) . ' ';
742 } elseif (strlen($iCfg[2])) {
743 $icon = '<img '.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/'.$iCfg[2]).' class="absmiddle" style="margin-right: 5px;" alt="" />';
747 $pout[] = $icon.$iCfg[0];
753 $pout = array_merge($pout, array_keys($nef));
756 // Implode for display:
757 $out[$k] = implode('<br />',$pout);
759 case 'workspace_perms':
760 $out[$k] = implode('<br/>',explode(', ',t3lib_BEfunc
::getProcessedValue('be_users','workspace_perms',$v)));
762 case 'workspace_membership':
763 $out[$k] = implode('<br/>',$this->ext_workspaceMembership());
765 case 'custom_options':
767 // Explode and flip values:
768 $nef = array_flip(explode(',',$v));
772 $customOptions = $GLOBALS['TYPO3_CONF_VARS']['BE']['customPermOptions'];
773 if (is_array($customOptions)) {
774 foreach ($customOptions as $coKey => $coValue) {
775 if (is_array($coValue['items'])) {
777 foreach ($coValue['items'] as $itemKey => $itemCfg) {
778 $v = $coKey.':'.$itemKey;
779 if (isset($nef[$v])) {
781 $pout[] = $GLOBALS['LANG']->sl($coValue['header']).' / '.$GLOBALS['LANG']->sl($itemCfg[0]);
790 $pout = array_merge($pout, array_keys($nef));
793 // Implode for display:
794 $out[$k] = implode('<br />',$pout);
803 * Get HTML code for the pages which were mounted, but NOT readable!
805 * @return string HTML code.
807 function ext_getReadableButNonmounted() {
809 // List of page id mounts which ARE mounted (and should therefore not be selected)
810 if (!$this->ext_pageIdsFromMounts
) {
811 $this->ext_pageIdsFromMounts
=0;
814 // User and group names:
815 $be_user_Array = t3lib_BEfunc
::getUserNames();
816 $be_group_Array = t3lib_BEfunc
::getGroupNames();
819 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
820 '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':''),
822 'uid NOT IN ('.$this->ext_pageIdsFromMounts
.') AND '.$this->getPagePermsClause(1).t3lib_BEfunc
::deleteClause('pages')
825 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
828 'HTML'=>t3lib_iconWorks
::getSpriteIconForRecord('pages',$row,array('title'=>'['.$row['uid'].']'))
831 $pp = t3lib_div
::makeInstance('printAllPageTree_perms', $this);
832 return $pp->printTree($dat,1);
836 * Print a set of permissions
838 * @param integer The permissions integer.
839 * @return string HTML formatted.
841 function ext_printPerms($int) {
843 $str.= (($int&1)?
'*':'<font color="red">x</font>');
844 $str.= (($int&16)?
'*':'<font color="red">x</font>');
845 $str.= (($int&2)?
'*':'<font color="red">x</font>');
846 $str.= (($int&4)?
'*':'<font color="red">x</font>');
847 $str.= (($int&8)?
'*':'<font color="red">x</font>');
849 return '<strong style="color:green;">'.$str.'</strong>';
853 * returns the permissions for a group based of the perms_groupid of $row. If the $row[perms_groupid] equals the $firstGroup[uid] then the function returns perms_everybody OR'ed with perms_group, else just perms_everybody
855 * @param array Page record.
856 * @param array First-group record.
857 * @return integer Permissions.
859 function ext_groupPerms($row,$firstGroup) {
860 if (is_array($row)) {
861 $out=intval($row['perms_everybody']);
862 if ($row['perms_groupid'] && $firstGroup['uid']==$row['perms_groupid']) {
863 $out|
= intval($row['perms_group']);
870 * Creates uInfo array for the user.
872 * @param array Might contain array where keys/values indicate whether to render a certain value
873 * @return array Array with the information of the user for each analysis topic.
875 function ext_compileUserInfoForHash($filter=NULL) {
877 $renderAll = !is_array($filter);
880 if ($renderAll ||
$filter['filemounts']) {
881 $uInfo['filemounts'] = $this->ext_uniqueAndSortList(implode(',',array_keys($this->groupData
['filemounts'])));
885 if ($renderAll ||
$filter['webmounts']) {
886 $uInfo['webmounts'] = $this->ext_uniqueAndSortList($this->groupData
['webmounts']);
889 // Sharing Upload Folder
890 if ($renderAll ||
$filter['tempPath']) {
891 $fileProcessor = t3lib_div
::makeInstance('t3lib_basicFileFunctions');
892 $fileProcessor->init($this->groupData
['filemounts'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
893 $uInfo['tempPath'] = $fileProcessor->findTempFolder(); // The closest TEMP-path is found
897 if ($renderAll ||
$filter['firstMainGroup']) {
898 $uInfo['firstMainGroup'] = $this->firstMainGroup
;
902 if ($renderAll ||
$filter['groupList']) {
903 $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.
907 if ($renderAll ||
$filter['pagetypes_select']) {
908 $uInfo['pagetypes_select'] = $this->ext_uniqueAndSortList($this->groupData
['pagetypes_select']);
912 if ($renderAll ||
$filter['tables_select']) {
913 $uInfo['tables_select'] = $this->ext_uniqueAndSortList($this->groupData
['tables_select'].','.$this->groupData
['tables_modify']);
917 if ($renderAll ||
$filter['tables_modify']) {
918 $uInfo['tables_modify'] = $this->ext_uniqueAndSortList($this->groupData
['tables_modify']);
921 // Non-exclude fields:
922 if ($renderAll ||
$filter['non_exclude_fields']) {
923 $uInfo['non_exclude_fields'] = $this->ext_uniqueAndSortList($this->groupData
['non_exclude_fields']);
926 // Explicit Allow/Deny:
927 if ($renderAll ||
$filter['explicit_allowdeny']) {
928 $uInfo['explicit_allowdeny'] = $this->ext_uniqueAndSortList($this->groupData
['explicit_allowdeny']);
931 // Limit to languages:
932 if ($renderAll ||
$filter['allowed_languages']) {
933 $uInfo['allowed_languages'] = $this->ext_uniqueAndSortList($this->groupData
['allowed_languages']);
936 // Workspace permissions
937 if ($renderAll ||
$filter['workspace_perms']) {
938 $uInfo['workspace_perms'] = $this->ext_uniqueAndSortList($this->groupData
['workspace_perms']);
941 // Workspace membership
942 if ($renderAll ||
$filter['workspace_membership']) {
943 $uInfo['workspace_membership'] = $this->ext_workspaceMembership();
947 if ($renderAll ||
$filter['custom_options']) {
948 $uInfo['custom_options'] = $this->ext_uniqueAndSortList($this->groupData
['custom_options']);
952 if ($renderAll ||
$filter['modules']) {
953 $uInfo['modules'] = $this->ext_uniqueAndSortList($this->groupData
['modules']);
957 $this->ext_ksortArrayRecursive($this->userTS
);
958 if ($renderAll ||
$filter['userTS']) {
959 $uInfo['userTS'] = $this->userTS
;
962 if ($renderAll ||
$filter['userTS_hl']) {
963 $uInfo['userTS_hl'] = $this->userTS_text
;
970 * Sorts a commalist of values and removes duplicates.
972 * @param string Commalist.
973 * @return string Sorted, unique commalist.
975 function ext_uniqueAndSortList($list) {
976 $uList=t3lib_div
::trimExplode(',',$list,1);
978 $uList=array_unique($uList);
979 $uList=implode(',',$uList);
984 * Key sort input array recursively.
986 * @param array Multidimensional array (value by reference!)
989 function ext_ksortArrayRecursive(&$arr) {
991 foreach ($arr as &$v) {
993 $this->ext_ksortArrayRecursive($v);
1000 * Returns all workspaces that are accessible for the BE_USER
1002 * @return array with key / value pairs of available workspaces (filtered by BE_USER check)
1004 function ext_workspaceMembership() {
1005 // Create accessible workspace arrays:
1007 if ($this->checkWorkspace(array('uid' => 0))) {
1008 $options[0] = '0: ' . $GLOBALS['LANG']->getLL('live', TRUE);
1011 // Add custom workspaces (selecting all, filtering by BE_USER check):
1012 if (t3lib_extMgm
::isLoaded('workspaces')) {
1013 $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title,adminusers,members,reviewers,db_mountpoints','sys_workspace','pid=0'.t3lib_BEfunc
::deleteClause('sys_workspace'),'','title');
1014 if (count($workspaces)) {
1015 foreach ($workspaces as $rec) {
1016 if ($this->checkWorkspace($rec)) {
1017 $options[$rec['uid']] = $rec['uid'].': '.htmlspecialchars($rec['title']);
1019 // Check if all mount points are accessible, otherwise show error:
1020 if (trim($rec['db_mountpoints'])!=='') {
1021 $mountPoints = t3lib_div
::intExplode(',',$this->workspaceRec
['db_mountpoints'],1);
1022 foreach ($mountPoints as $mpId) {
1023 if (!$this->isInWebMount($mpId,'1=1')) {
1024 $options[$rec['uid']].= '<br> \- ' . $GLOBALS['LANG']->getLL('notAccessible', TRUE) . ' ' . $mpId;
1051 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
1053 * @subpackage tx_beuser
1055 class SC_mod_tools_be_user_index
{
1057 var $MOD_MENU=array();
1058 var $MOD_SETTINGS=array();
1061 * document emplate object
1067 var $include_once=array();
1072 * Basic initialization of the class
1077 $this->MCONF
= $GLOBALS['MCONF'];
1079 $this->menuConfig();
1080 $this->switchUser(t3lib_div
::_GP('SwitchUser'));
1083 // **************************
1085 // **************************
1086 $this->doc
= t3lib_div
::makeInstance('template');
1087 $this->doc
->backPath
= $GLOBALS['BACK_PATH'];
1088 $this->doc
->setModuleTemplate('templates/beuser.html');
1089 $this->doc
->form
= '<form action="" method="post">';
1092 $this->doc
->JScode
= $this->doc
->wrapScriptTags('
1094 function jumpToUrl(URL) { //
1095 window.location.href = URL;
1097 ' . $this->doc
->redirectUrls());
1101 * Initialization of the module menu configuration
1105 function menuConfig() {
1107 // If array, then it's a selector box menu
1108 // If empty string it's just a variable, that'll be saved.
1109 // Values NOT in this array will not be saved in the settings-array for the module.
1110 $this->MOD_MENU
= array(
1111 'function' => array(
1112 'compare' => $GLOBALS['LANG']->getLL('compareUserSettings', TRUE),
1113 'whoisonline' => $GLOBALS['LANG']->getLL('listUsersOnline', TRUE)
1117 $this->MOD_SETTINGS
= t3lib_BEfunc
::getModuleData($this->MOD_MENU
, t3lib_div
::_GP('SET'), $this->MCONF
['name'], 'ses');
1121 * This functions builds the content of the page
1128 $this->content
.=$this->doc
->header($GLOBALS['LANG']->getLL('backendUserAdministration', TRUE));
1129 $this->content
.=$this->doc
->spacer(5);
1131 switch($this->MOD_SETTINGS
['function']) {
1133 if (t3lib_div
::_GP('ads')) {
1134 $compareFlags = t3lib_div
::_GP('compareFlags');
1135 $GLOBALS['BE_USER']->pushModuleData('tools_beuser/index.php/compare',$compareFlags);
1137 $compareFlags = $GLOBALS['BE_USER']->getModuleData('tools_beuser/index.php/compare','ses');
1139 $this->content
.=$this->compareUsers($compareFlags);
1142 $this->content
.=$this->whoIsOnline();
1145 // Setting up the buttons and markers for docheader
1146 $docHeaderButtons = $this->getButtons();
1147 //$markers['CSH'] = $docHeaderButtons['csh'];
1148 $markers['FUNC_MENU'] = t3lib_BEfunc
::getFuncMenu(0,'SET[function]',$this->MOD_SETTINGS
['function'],$this->MOD_MENU
['function']);
1149 $markers['CONTENT'] = $this->content
;
1151 // Build the <body> for the module
1152 $this->content
= $this->doc
->moduleBody($this->pageinfo
, $docHeaderButtons, $markers);
1153 // Renders the module page
1154 $this->content
= $this->doc
->render(
1155 'Backend User Administration',
1161 * Prints the content of the page
1165 function printContent() {
1166 echo $this->content
;
1170 * Create the panel of buttons for submitting the form or otherwise perform operations.
1172 * @return array all available buttons as an assoc. array
1174 protected function getButtons() {
1183 //$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
1186 if ($this->MOD_SETTINGS
['function'] === 'compare') {
1187 $buttons['add'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick('&edit[be_users][0]=new' , $this->doc
->backPath
, -1)) .
1188 '" title="' . $GLOBALS['LANG']->getLL('newUser', TRUE) . '">' . t3lib_iconWorks
::getSpriteIcon('actions-document-new') . '</a>';
1192 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
1193 $buttons['shortcut'] = $this->doc
->makeShortcutIcon('be_user_uid,compareFlags','function', $this->MCONF
['name']);
1203 /***************************
1207 ***************************/
1210 * Compares the users with the given flags
1212 * @param array options that should be taking into account to compare the users
1213 * @return string the content
1215 function compareUsers($compareFlags) {
1218 'filemounts' => $GLOBALS['LANG']->getLL('filemounts', TRUE),
1219 'webmounts' => $GLOBALS['LANG']->getLL('webmounts', TRUE),
1220 'tempPath' => $GLOBALS['LANG']->getLL('defaultUploadPath', TRUE),
1221 'firstMainGroup' => $GLOBALS['LANG']->getLL('mainUserGroup', TRUE),
1222 'groupList' => $GLOBALS['LANG']->getLL('memberOfGroups', TRUE),
1223 'pagetypes_select' => $GLOBALS['LANG']->getLL('pageTypesAccess', TRUE),
1224 'tables_select' => $GLOBALS['LANG']->getLL('selectTables', TRUE),
1225 'tables_modify' => $GLOBALS['LANG']->getLL('modifyTables', TRUE),
1226 'non_exclude_fields' => $GLOBALS['LANG']->getLL('nonExcludeFields', TRUE),
1227 'explicit_allowdeny' => $GLOBALS['LANG']->getLL('explicitAllowDeny', TRUE),
1228 'allowed_languages' => $GLOBALS['LANG']->getLL('limitToLanguages', TRUE),
1229 'workspace_perms' => $GLOBALS['LANG']->getLL('workspacePermissions', TRUE),
1230 'workspace_membership' => $GLOBALS['LANG']->getLL('workspaceMembership', TRUE),
1231 'custom_options' => $GLOBALS['LANG']->getLL('customOptions', TRUE),
1232 'modules' => $GLOBALS['LANG']->getLL('modules', TRUE),
1233 'userTS' => $GLOBALS['LANG']->getLL('tsconfig', TRUE),
1234 'userTS_hl' => $GLOBALS['LANG']->getLL('tsconfigHL', TRUE),
1237 $be_user_uid = t3lib_div
::_GP('be_user_uid');
1239 // This is used to test with other users. Development ONLY!
1240 $tempBE_USER = t3lib_div
::makeInstance('local_beUserAuth'); // New backend user object
1241 $tempBE_USER->userTS_dontGetCached
=1;
1242 $tempBE_USER->OS
= TYPO3_OS
;
1243 $tempBE_USER->setBeUserByUid($be_user_uid);
1244 $tempBE_USER->fetchGroupData();
1246 $uInfo = $tempBE_USER->ext_compileUserInfoForHash();
1247 $uInfo_dat = $tempBE_USER->ext_printOverview($uInfo,$options,1);
1250 foreach ($options as $kk => $vv) {
1251 $lines[]='<tr class="bgColor4">
1252 <td nowrap="nowrap" valign="top">'.$vv.': </td>
1253 <td>'.$uInfo_dat[$kk].' </td>
1256 if ($kk=='webmounts' && !$tempBE_USER->isAdmin()) {
1257 $lines[]='<tr class="bgColor4">
1258 <td nowrap="nowrap" valign="top">' . $GLOBALS['LANG']->getLL('nonMountedReadablePages', TRUE) . ' </td>
1259 <td>'.$tempBE_USER->ext_getReadableButNonmounted().' </td>
1264 $email = htmlspecialchars($tempBE_USER->user
['email']);
1265 $realname = htmlspecialchars($tempBE_USER->user
['realName']);
1266 $outTable = '<table border="0" cellpadding="1" cellspacing="1"><tr class="bgColor5"><td>'.t3lib_iconWorks
::getSpriteIconForRecord('be_users',$tempBE_USER->user
,array('title'=>$tempBE_USER->user
['uid'])).htmlspecialchars($tempBE_USER->user
['username']).'</td>';
1267 $outTable.= '<td>'.($realname?
$realname.', ':'').($email ?
'<a href="mailto:'.$email.'">'.$email.'</a>' : '').'</td>';
1268 $outTable.= '<td>'.$this->elementLinks('be_users',$tempBE_USER->user
).'</td></tr></table>';
1269 $outTable.= '<strong><a href="'.htmlspecialchars($this->MCONF
['_']).'">' . $GLOBALS['LANG']->getLL('backToOverview', TRUE) . '</a></strong><br />';
1271 $outTable.= '<br /><table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
1272 $content.= $this->doc
->section($GLOBALS['LANG']->getLL('userInfo', TRUE),$outTable,0,1);
1274 $menu = array(0 => array());
1277 $itemsPerColumn = ceil(count($options) / 3);
1278 foreach ($options as $kk => $vv) {
1279 if ($rowCounter == $itemsPerColumn) {
1282 $menu[$columnCounter] = array();
1285 $menu[$columnCounter][]='<input type="checkbox" class="checkbox" value="1" name="compareFlags['.$kk.']" id="checkCompare_'.$kk.'"'.($compareFlags[$kk]?
' checked="checked"':'').'> <label for="checkCompare_'.$kk.'">'.htmlspecialchars($vv).'</label>';
1287 $outCode = '<p>' . $GLOBALS['LANG']->getLL('groupBy', TRUE) . '</p>';
1288 $outCode .= '<table border="0" cellpadding="3" cellspacing="1" class="compare-checklist valign-top"><tr>';
1289 foreach ($menu as $column) {
1290 $outCode .= '<td>' . implode('<br />', $column) . '</td>';
1292 $outCode .= '</tr></table>';
1293 $outCode.='<br /><input type="submit" name="ads" value="' . $GLOBALS['LANG']->getLL('update', TRUE) . '">';
1294 $content = $this->doc
->section($GLOBALS['LANG']->getLL('groupAndCompareUsers', TRUE),$outCode,0,1);
1297 // Traverse all users
1298 $users = t3lib_BEfunc
::getUserNames();
1299 $comparation=array();
1307 foreach ($users as $r) {
1308 if ($counter>=$offset) {
1309 // This is used to test with other users. Development ONLY!
1310 $tempBE_USER = t3lib_div
::makeInstance('local_beUserAuth'); // New backend user object
1311 /* @var $tempBE_USER local_beUserAuth */
1312 $tempBE_USER->OS
= TYPO3_OS
;
1313 $tempBE_USER->setBeUserByUid($r['uid']);
1314 $tempBE_USER->fetchGroupData();
1316 // Making group data
1319 $uInfo = $tempBE_USER->ext_compileUserInfoForHash((array)$compareFlags);
1320 foreach ($options as $kk => $vv) {
1321 if ($compareFlags[$kk]) {
1322 $md5pre.=serialize($uInfo[$kk]).'|';
1327 if (!isset($comparation[$md5])) {
1328 $comparation[$md5]=$tempBE_USER->ext_printOverview($uInfo,$compareFlags);
1329 $comparation[$md5]['users']=array();
1331 $comparation[$md5]['users'][]=$tempBE_USER->user
;
1332 unset($tempBE_USER);
1335 if ($counter>=($numberAtTime+
$offset)) {
1336 $tooManyUsers=$GLOBALS['LANG']->getLL('tooManyUsers', TRUE) . ' ' . count($users) . '. ' . $GLOBALS['LANG']->getLL('canOnlyDisplay', TRUE) . ' ' . $numberAtTime . '.';
1341 // Print the groups:
1344 $allCells = array();
1346 $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td><strong>' . $GLOBALS['LANG']->getLL('usernames', TRUE) . '</strong></td></table>';
1348 foreach ($options as $kk => $vv) {
1349 if ($compareFlags[$kk]) {
1350 $allCells[$kk] = '<strong>'.$vv.':</strong>';
1353 $allGroups[]=$allCells;
1355 foreach ($comparation as $dat) {
1356 $allCells = array();
1358 $curUid = $GLOBALS['BE_USER']->user
['uid'];
1361 foreach ($dat['users'] as $uDat) {
1362 $uItem = '<tr><td width="130">' . t3lib_iconWorks
::getSpriteIconForRecord('be_users',$uDat,array('title'=> $uDat['uid'] )) . $this->linkUser($uDat['username'],$uDat) . ' </td><td nowrap="nowrap">' . $this->elementLinks('be_users',$uDat);
1363 if ($curUid != $uDat['uid'] && !$uDat['disable'] && ($uDat['starttime'] == 0 ||
1364 $uDat['starttime'] < $GLOBALS['EXEC_TIME']) && ($uDat['endtime'] == 0 ||
1365 $uDat['endtime'] > $GLOBALS['EXEC_TIME'])) {
1366 $uItem .= '<a href="' . t3lib_div
::linkThisScript(array('SwitchUser'=>$uDat['uid'])) . '" target="_top" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('switchUserTo', TRUE) . ' ' . $uDat['username']) . ' ' . $GLOBALS['LANG']->getLL('changeToMode', TRUE) . '">' .
1367 t3lib_iconWorks
::getSpriteIcon('actions-system-backend-user-switch') .
1369 '<a href="' . t3lib_div
::linkThisScript(array('SwitchUser'=>$uDat['uid'], 'switchBackUser' => 1)) . '" target="_top" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('switchUserTo', TRUE) . ' ' . $uDat['username']) . ' ' . $GLOBALS['LANG']->getLL('switchBackMode', TRUE) . '">' .
1370 t3lib_iconWorks
::getSpriteIcon('actions-system-backend-user-emulate') .
1373 $uItem .= '</td></tr>';
1374 $uListArr[] = $uItem;
1376 $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.implode('',$uListArr).'</table>';
1378 foreach ($options as $kk => $vv) {
1379 if ($compareFlags[$kk]) {
1380 $allCells[$kk] = $dat[$kk];
1383 $allGroups[]=$allCells;
1388 $TDparams=' nowrap="nowrap" class="bgColor5" valign="top"';
1390 foreach ($allGroups as $allCells) {
1391 $outTable.='<tr><td'.$TDparams.'>'.implode('</td><td'.$TDparams.'>',$allCells).'</td></tr>';
1392 $TDparams=' nowrap="nowrap" class="'.($i++ %
2 == 0 ?
'bgColor4' : 'bgColor6').'" valign="top"';
1394 $outTable='<table border="0" cellpadding="2" cellspacing="2">' . $outTable . '</table>';
1395 $flashMessageCachedGrouplistsUpdated = t3lib_div
::makeInstance(
1396 't3lib_FlashMessage',
1398 $GLOBALS['LANG']->getLL('cachedGrouplistsUpdated', TRUE),
1399 t3lib_FlashMessage
::INFO
1401 t3lib_FlashMessageQueue
::addMessage($flashMessageCachedGrouplistsUpdated);
1402 if ($tooManyUsers) {
1403 $flashMessageTooManyUsers = t3lib_div
::makeInstance(
1404 't3lib_FlashMessage',
1407 t3lib_FlashMessage
::ERROR
1409 t3lib_FlashMessageQueue
::addMessage($flashMessageTooManyUsers);
1411 $content.= $this->doc
->spacer(10);
1412 $content.= $this->doc
->section($GLOBALS['LANG']->getLL('result', TRUE),$outTable,0,1);
1419 * Creates a HTML anchor to the user record
1421 * @param string the string used to identify the user (inside the <a>...</a>)
1422 * @param array the BE user record to link
1423 * @return string the HTML anchor
1425 function linkUser($str,$rec) {
1426 return '<a href="'.htmlspecialchars($this->MCONF
['_']).'&be_user_uid='.$rec['uid'].'">' . htmlspecialchars($str) . '</a>';
1431 * Builds a list of all links for a specific element (here: BE user) and returns it for print.
1433 * @param string the db table that should be used
1434 * @param array the BE user record to use
1435 * @return string a HTML formatted list of the link
1437 function elementLinks($table,$row) {
1439 $cells[]='<a href="#" onclick="top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\',\'' . $GLOBALS['BACK_PATH'] . '\'); return false;" title="' . $GLOBALS['LANG']->getLL('showInformation', TRUE) . '">' .
1440 t3lib_iconWorks
::getSpriteIcon('actions-document-info') .
1444 $params='&edit[' . $table . '][' . $row['uid'] . ']=edit';
1445 $cells[]='<a href="#" onclick="' . t3lib_BEfunc
::editOnClick($params,$GLOBALS['BACK_PATH'],'') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:edit', TRUE) . '">' .
1446 t3lib_iconWorks
::getSpriteIcon('actions-document-open') .
1450 $hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
1451 if ($row[$hiddenField]) {
1452 $params='&data[' . $table . '][' . $row['uid'] . '][' . $hiddenField . ']=0';
1453 $cells[]='<a href="' . $this->doc
->issueCommand($params) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:enable', TRUE) . '">' .
1454 t3lib_iconWorks
::getSpriteIcon('actions-edit-unhide') .
1457 $params='&data[' . $table . '][' . $row['uid'] . '][' . $hiddenField . ']=1';
1458 $cells[]='<a href="' . $this->doc
->issueCommand($params) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:disable', TRUE) . '">' .
1459 t3lib_iconWorks
::getSpriteIcon('actions-edit-hide') .
1464 $params='&cmd[' . $table . '][' . $row['uid'] . '][delete]=1';
1465 $cells[]='<a href="' . $this->doc
->issueCommand($params) . '" onclick="return confirm(unescape(\'' . $GLOBALS['LANG']->getLL('sureToDelete', TRUE) . '\'));" title="' . $GLOBALS['LANG']->getLL('delete', TRUE) . '">' .
1466 t3lib_iconWorks
::getSpriteIcon('actions-edit-delete') .
1469 return implode('',$cells);
1474 * Inits all BE-users available, for development ONLY!
1478 function initUsers() {
1479 // Initializing all users in order to generate the usergroup_cached_list
1480 $users = t3lib_BEfunc
::getUserNames();
1482 // This is used to test with other users. Development ONLY!
1483 foreach ($users as $r) {
1484 $tempBE_USER = t3lib_div
::makeInstance('local_beUserAuth'); // New backend user object
1485 /* @var $tempBE_USER local_beUserAuth */
1486 $tempBE_USER->OS
= TYPO3_OS
;
1487 $tempBE_USER->setBeUserByUid($r['uid']);
1488 $tempBE_USER->fetchGroupData();
1493 * Returns the local path for this string (removes the PATH_site if it is included)
1495 * @param string the path that will be checked
1496 * @return string the local path
1498 function localPath($str) {
1499 if (substr($str,0,strlen(PATH_site
))==PATH_site
) {
1500 return substr($str,strlen(PATH_site
));
1507 * Switches to a given user (SU-mode) and then redirects to the start page of the backend to refresh the navigation etc.
1509 * @param array BE-user record that will be switched to
1512 function switchUser($switchUser) {
1513 $uRec=t3lib_BEfunc
::getRecord('be_users',$switchUser);
1514 if (is_array($uRec) && $GLOBALS['BE_USER']->isAdmin()) {
1515 $updateData['ses_userid'] = $uRec['uid'];
1517 if (t3lib_div
::_GP('switchBackUser')) {
1518 $updateData['ses_backuserid'] = intval($GLOBALS['BE_USER']->user
['uid']);
1520 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_sessions', 'ses_id=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->id
, 'be_sessions') . ' AND ses_name=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(t3lib_beUserAuth
::getCookieName(), 'be_sessions') . ' AND ses_userid=' . intval($GLOBALS['BE_USER']->user
['uid']), $updateData);
1522 $redirectUrl = $GLOBALS['BACK_PATH'] . 'index.php' . ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] ?
'' : '?commandLI=1');
1523 t3lib_utility_Http
::redirect($redirectUrl);
1527 /***************************
1529 * "WHO IS ONLINE" FUNCTIONS:
1531 ***************************/
1534 * @author Martin Kutschker
1536 function whoIsOnline() {
1537 $select_fields = 'ses_id, ses_tstamp, ses_iplock, u.uid,u.username, u.admin, u.realName, u.disable, u.starttime, u.endtime, u.deleted, bu.uid AS bu_uid,bu.username AS bu_username, bu.realName AS bu_realName';
1538 $from_table = 'be_sessions INNER JOIN be_users u ON ses_userid=u.uid LEFT OUTER JOIN be_users bu ON ses_backuserid=bu.uid';
1540 $orderBy = 'u.username';
1542 $timeout = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout']);
1544 $where_clause = 'ses_tstamp > ' . ($GLOBALS['EXEC_TIME'] - $timeout);
1547 // Fetch active sessions of other users from storage:
1548 $sessions = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($select_fields,$from_table,$where_clause,'',$orderBy);
1549 // Process and visualized each active session as a table row:
1550 if (is_array($sessions)) {
1551 foreach ($sessions as $session) {
1552 $ip = $session['ses_iplock'];
1554 if ($session['ses_iplock'] == '[DISABLED]' ||
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'] == 0) {
1556 } elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'] == 4) {
1557 $hostName = ' title="' . @gethostbyaddr
($session['ses_iplock']) . '"';
1559 $ip .= str_repeat('.*', 4-$GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP']);
1562 <tr class="bgColor4" height="17" valign="top">' .
1563 '<td nowrap="nowrap">' .
1564 date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $session['ses_tstamp']) .
1566 '<td nowrap="nowrap">' .
1567 '<span'.$hostName.'>'.$ip.'</span>' .
1569 '<td width="130">' .
1570 t3lib_iconWorks
::getSpriteIconForRecord('be_users',$session,array('title'=>$session['uid'])).htmlspecialchars($session['username']).' ' .
1572 '<td nowrap="nowrap">'.htmlspecialchars($session['realName']).' </td>' .
1573 '<td nowrap="nowrap">'.$this->elementLinks('be_users',$session).'</td>' .
1574 '<td nowrap="nowrap" valign="top">'.($session['bu_username'] ?
' SU from: ' : '').htmlspecialchars($session['bu_username']).' </td>' .
1575 '<td nowrap="nowrap" valign="top"> '.htmlspecialchars($session['bu_realName']).'</td>' .
1579 // Wrap <table> tag around the rows:
1581 <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist">
1582 <tr class="t3-row-header">
1583 <td>' . $GLOBALS['LANG']->getLL('timestamp', TRUE) . '</td>
1584 <td>' . $GLOBALS['LANG']->getLL('host', TRUE) . '</td>
1585 <td colspan="5">' . $GLOBALS['LANG']->getLL('username', TRUE) . '</td>
1586 </tr>' . $outTable . '
1589 $content.= $this->doc
->section($GLOBALS['LANG']->getLL('whoIsOnline', TRUE),$outTable,0,1);
1596 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE
]['XCLASS']['ext/beuser/mod/index.php'])) {
1597 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE
]['XCLASS']['ext/beuser/mod/index.php']);
1602 $SOBE = t3lib_div
::makeInstance('SC_mod_tools_be_user_index');
1605 $SOBE->printContent();