Project

General

Profile

Bug #16024 » 20080217_user_tools_cleanup.patch

Administrator Admin, 2008-02-18 00:32

View differences:

typo3/sysext/beuser/mod/index.php (working copy)
function ext_non_readAccessPages() {
$lines=array();
foreach($this->ext_non_readAccessPageArray as $pA) {
if ($pA) $lines[]=t3lib_BEfunc::getRecordPath($pA['uid'],'',15);
foreach ($this->ext_non_readAccessPageArray as $pA) {
if ($pA) {
$lines[] = t3lib_BEfunc::getRecordPath($pA['uid'],'',15);
}
}
if (count($lines)) {
if (count($lines)) {
return '<table bgcolor="red" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><font color="white"><strong>The user has no read access to these DB-mounts!</strong></font></td>
......
break;
case 'pagetypes_select':
$pageTypes = explode(',',$v);
reset($pageTypes);
while(list($kk,$vv)=each($pageTypes)) {
$pageTypes[$kk]=$GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('pages','doktype',$vv));
foreach ($pageTypes as &$vv) {
$vv = $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('pages','doktype',$vv));
}
$out[$k] = implode('<br />',$pageTypes);
break;
case 'tables_select':
case 'tables_modify':
$tables = explode(',',$v);
reset($tables);
while(list($kk,$vv)=each($tables)) {
if ($vv) {
$tables[$kk]='<span class="nobr">'.t3lib_iconWorks::getIconImage($vv,array(),$GLOBALS['BACK_PATH'],'align="top"').$GLOBALS['LANG']->sL($GLOBALS['TCA'][$vv]['ctrl']['title']).'</span>';
foreach ($tables as &$vv) {
if ($vv) {
$vv = '<span class="nobr">'.t3lib_iconWorks::getIconImage($vv,array(),$GLOBALS['BACK_PATH'],'align="top"').$GLOBALS['LANG']->sL($GLOBALS['TCA'][$vv]['ctrl']['title']).'</span>';
}
}
$out[$k] = implode('<br />',$tables);
break;
case 'non_exclude_fields':
$nef = explode(',',$v);
reset($nef);
$table='';
$pout=array();
while(list($kk,$vv)=each($nef)) {
if ($vv) {
foreach ($nef as $vv) {
if ($vv) {
list($thisTable,$field) = explode(':',$vv);
if ($thisTable!=$table) {
$table=$thisTable;
......
case 'groupList':
case 'firstMainGroup':
$uGroups = explode(',',$v);
reset($uGroups);
$table='';
$pout=array();
while(list($kk,$vv)=each($uGroups)) {
if ($vv) {
foreach ($uGroups as $vv) {
if ($vv) {
$uGRow = t3lib_BEfunc::getRecord('be_groups',$vv);
$pout[]='<tr><td nowrap="nowrap">'.t3lib_iconWorks::getIconImage('be_groups',$uGRow,$GLOBALS['BACK_PATH'],'align="top"').'&nbsp;'.htmlspecialchars($uGRow['title']).'&nbsp;&nbsp;</td><td width=1% nowrap="nowrap">'.$GLOBALS['SOBE']->elementLinks('be_groups',$uGRow).'</td></tr>';
}
......
break;
case 'modules':
$mods = explode(',',$v);
reset($mods);
$mainMod='';
$pout=array();
while(list($kk,$vv)=each($mods)) {
if ($vv) {
foreach ($mods as $vv) {
if ($vv) {
list($thisMod,$subMod) = explode('_',$vv);
if ($thisMod!=$mainMod) {
$mainMod=$thisMod;
......
*/
function ext_ksortArrayRecursive(&$arr) {
krsort($arr);
reset($arr);
while(list($k,$v)=each($arr)) {
if (is_array($v)) $this->ext_ksortArrayRecursive($arr[$k]);
foreach($arr as &$v) {
if (is_array($v)) {
$this->ext_ksortArrayRecursive($v);
}
}
}
/**
* [Describe function...]
* Returns all workspaces that are accessible for the BE_USER
*
* @return [type] ...
* @return array with key / value pairs of available workspaces (filtered by BE_USER check)
*/
function ext_workspaceMembership() {
// Create accessible workspace arrays:
......
var $include_once=array();
var $content;
/**
* @return [type] ...
* Basic initialization of the class
*
* @return void
*/
function init() {
$this->MCONF = $GLOBALS['MCONF'];
......
}
/**
* [Describe function...]
* Initialization of the module menu configuration
*
* @return [type] ...
* @return void
*/
function menuConfig() {
// MENU-ITEMS:
......
}
/**
* [Describe function...]
* This functions builds the content of the page
*
* @return [type] ...
* @return void
*/
function main() {
$this->content='';
......
}
/**
* [Describe function...]
* Prints the content of the page
*
* @return [type] ...
* @return void
*/
function printContent() {
......
***************************/
/**
* @param [type] $compareFlags: ...
* @return [type] ...
* Compares the users with the given flags
*
* @param array options that should be taking into account to compare the users
* @return string the content
*/
function compareUsers($compareFlags) {
// Menu:
......
$uInfo_dat = $tempBE_USER->ext_printOverview($uInfo,$options,1);
$lines=array();
reset($options);
while(list($kk,$vv)=each($options)) {
foreach ($options as $kk => $vv) {
if ($kk=='modules') {
$loadModules = t3lib_div::makeInstance('t3lib_loadModules');
$loadModules->load($GLOBALS['TBE_MODULES'],$tempBE_USER);
......
$outTable.= '<br /><table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
$content.= $this->doc->section('User info',$outTable,0,1);
} else {
reset($options);
$menu=array();
while(list($kk,$vv)=each($options)) {
foreach ($options as $kk => $vv) {
$menu[]='<input type="checkbox" value="1" name="compareFlags['.$kk.']" id="checkCompare_'.$kk.'"'.($compareFlags[$kk]?' checked="checked"':'').'> <label for="checkCompare_'.$kk.'">'.htmlspecialchars($vv).'</label>';
}
$outCode = 'Group by:<br />'.implode('<br />',$menu);
......
// Traverse all users
$users = t3lib_BEfunc::getUserNames();
$comparation=array();
reset($users);
$counter=0;
......
$numberAtTime=1000;
$tooManyUsers='';
while(list(,$r)=each($users)) {
foreach ($users as $r) {
if ($counter>=$offset) {
// This is used to test with other users. Development ONLY!
$tempBE_USER = t3lib_div::makeInstance('local_beUserAuth'); // New backend user object
......
$md5pre='';
$menu=array();
$uInfo = $tempBE_USER->ext_compileUserInfoForHash((array)$compareFlags);
reset($options);
while(list($kk,$vv)=each($options)) {
foreach ($options as $kk => $vv) {
if ($compareFlags[$kk]) {
$md5pre.=serialize($uInfo[$kk]).'|';
}
......
$allGroups=array();
// Header:
$allCells = array();
reset($options);
$link_createNewUser='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[be_users][0]=new',$this->doc->backPath,-1)).'">'.
'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/new_el.gif').' title="'.$GLOBALS['LANG']->getLL('new',1).'" alt="" />'.
......
$allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%"><td><b>Usernames:</b></td><td width="12">'.$link_createNewUser.'</td></tr></table>';
while(list($kk,$vv)=each($options)) {
foreach ($options as $kk => $vv) {
if ($compareFlags[$kk]) {
$allCells[$kk] = '<b>'.$vv.':</b>';
}
}
$allGroups[]=$allCells;
reset($comparation);
while(list(,$dat)=each($comparation)) {
foreach ($comparation as $dat) {
$allCells = array();
$curUid = $GLOBALS['BE_USER']->user['uid'];
$uListArr=array();
reset($dat['users']);
while(list(,$uDat)=each($dat['users'])) {
foreach($dat['users'] as $uDat) {
$uItem = '<tr><td width="130">'.t3lib_iconWorks::getIconImage('be_users',$uDat,$GLOBALS['BACK_PATH'],'align="top" title="'.$uDat['uid'].'"').$this->linkUser($uDat['username'],$uDat).'&nbsp;&nbsp;</td><td nowrap="nowrap">'.$this->elementLinks('be_users',$uDat);
if ($curUid != $uDat['uid'] && !$uDat['disable'] && ($uDat['starttime'] == 0 || $uDat['starttime'] < time()) && ($uDat['endtime'] == 0 || $uDat['endtime'] > time())) {
$uItem .= '<a href="'.t3lib_div::linkThisScript(array('SwitchUser'=>$uDat['uid'])).'" target="_top"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/su.gif').' border="0" align="top" title="'.htmlspecialchars('Switch user to: '.$uDat['username']).' [change-to mode]" alt="" /></a>'.
......
}
$allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.implode('',$uListArr).'</table>';
reset($options);
while(list($kk,$vv)=each($options)) {
foreach ($options as $kk => $vv) {
if ($compareFlags[$kk]) {
$allCells[$kk] = $dat[$kk];
}
......
// Make table
$outTable='';
reset($allGroups);
$TDparams=' nowrap="nowrap" class="bgColor5" valign="top"';
while(list(,$allCells)=each($allGroups)) {
$i = 0;
foreach ($allGroups as $allCells) {
$outTable.='<tr><td'.$TDparams.'>'.implode('</td><td'.$TDparams.'>',$allCells).'</td></tr>';
$TDparams=' nowrap="nowrap" class="bgColor4" valign="top"';
$TDparams=' nowrap="nowrap" class="'.($i++ % 2 == 0 ? 'bgcolor4' : 'bgcolor6').'" valign="top"';
}
$outTable='<table border="0" cellpadding="2" cellspacing="2">'.$outTable.'</table>';
$outTable.=fw('<br /><br />(All cached group lists updated.)');
......
return $content;
}
/**
* [Describe function...]
* Creates a HTML anchor to the user record
*
* @param [type] $str: ...
* @param [type] $rec: ...
* @return [type] ...
* @param string the string used to identify the user (inside the <a>...</a>)
* @param array the BE user record to link
* @return string the HTML anchor
*/
function linkUser($str,$rec) {
return '<a href="'.htmlspecialchars($this->MCONF['_']).'&be_user_uid='.$rec['uid'].'">'.$str.'</a>';
}
/**
* [Describe function...]
* Builds a list of all links for a specific element (here: BE user) and returns it for print.
*
* @param [type] $table: ...
* @param [type] $row: ...
* @return [type] ...
* @param string the db table that should be used
* @param array the BE user record to use
* @return string a HTML formatted list of the link
*/
function elementLinks($table,$row) {
// Info:
......
return implode('',$cells);
}
/**
* [Describe function...]
* Inits all BE-users available, for development ONLY!
*
* @return [type] ...
* @return void
*/
function initUsers() {
// Initializing all users in order to generate the usergroup_cached_list
$users = t3lib_BEfunc::getUserNames();
reset($users);
while(list(,$r)=each($users)) {
// This is used to test with other users. Development ONLY!
// This is used to test with other users. Development ONLY!
foreach ($users as $r) {
$tempBE_USER = t3lib_div::makeInstance('local_beUserAuth'); // New backend user object
$tempBE_USER->OS = TYPO3_OS;
$tempBE_USER->setBeUserByUid($r['uid']);
......
}
/**
* [Describe function...]
* Returns the local path for this string (removes the PATH_site if it is included)
*
* @param [type] $str: ...
* @return [type] ...
* @param string the path that will be checked
* @return string the local path
*/
function localPath($str) {
if (substr($str,0,strlen(PATH_site))==PATH_site) {
return substr($str,strlen(PATH_site));
} else return $str;
} else {
return $str;
}
}
/**
* [Describe function...]
* Switches to a given user (SU-mode) and then redirects to the start page of the backend to refresh the navigation etc.
*
* @param [type] $switchUser: ...
* @return [type] ...
* @param array BE-user record that will be switched to
* @return void
*/
function switchUser($switchUser) {
$uRec=t3lib_BEfunc::getRecord('be_users',$switchUser);
typo3/sysext/t3skin/stylesheets/typo3-colors.css (working copy)
.bgColor5 {
background-color: #D7DBE2;
}
background-color: #D7DBE2;
}
.bgColor6 {
background-color: #e0e0e0;
}
(2-2/3)