⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 4 页
字号:
	/**	 * [Describe function...]	 *	 * @return	[type]		...	 */	function printContent()	{		$this->content.=$this->doc->endPage();		echo $this->content;	}	/***************************	 *	 * OTHER FUNCTIONS:	 *	 ***************************/	/**	 * @param	[type]		$compareFlags: ...	 * @return	[type]		...	 */	function compareUsers($compareFlags)	{			// Menu:		$options = array(			'filemounts' => 'Filemounts',			'webmounts' => 'Webmounts',			'tempPath' => 'Default upload path',			'firstMainGroup' => 'Main user group',			'groupList' => 'Member of groups',			'pagetypes_select' => 'Page types access',			'tables_select' => 'Select tables',			'tables_modify' => 'Modify tables',			'non_exclude_fields' => 'Non-exclude fields',			'explicit_allowdeny' => 'Explicit Allow/Deny',			'allowed_languages' => 'Limit to languages',			'workspace_perms' => 'Workspace permissions',			'workspace_membership' => 'Workspace membership',			'custom_options' => 'Custom options',			'modules' => 'Modules',			'userTS' => 'TSconfig',			'userTS_hl' => 'TSconfig HL',		);		$be_user_uid = t3lib_div::_GP('be_user_uid');		if ($be_user_uid)	{				// This is used to test with other users. Development ONLY!			$tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');	// New backend user object			$tempBE_USER->userTS_dontGetCached=1;			$tempBE_USER->OS = TYPO3_OS;			$tempBE_USER->setBeUserByUid($be_user_uid);			$tempBE_USER->fetchGroupData();			$uInfo = $tempBE_USER->ext_compileUserInfoForHash();			$uInfo_dat = $tempBE_USER->ext_printOverview($uInfo,$options,1);			$lines=array();			reset($options);			while(list($kk,$vv)=each($options))	{				if ($kk=='modules')	{					$loadModules = t3lib_div::makeInstance('t3lib_loadModules');					$loadModules->load($GLOBALS['TBE_MODULES'],$tempBE_USER);					$alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');					$uInfo_dat[$kk] = $alt_menuObj->topMenu($loadModules->modules,1,$GLOBALS['BACK_PATH']);				}				$lines[]='<tr class="bgColor4">					<td nowrap="nowrap" valign="top">'.$vv.':&nbsp;&nbsp;</td>					<td>'.$uInfo_dat[$kk].'&nbsp;</td>				</tr>';				if ($kk=='webmounts' && !$tempBE_USER->isAdmin())	{					$lines[]='<tr class="bgColor4">						<td nowrap="nowrap" valign="top">Non-mounted readable pages:&nbsp;&nbsp;</td>						<td>'.$tempBE_USER->ext_getReadableButNonmounted().'&nbsp;</td>					</tr>';				}			}			$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>';			$outTable.= '<td>'.$tempBE_USER->user['realName'].($tempBE_USER->user['email'] ? ', <a href="mailto:'.$tempBE_USER->user['email'].'">'.$tempBE_USER->user['email'].'</a>' : '').'</td>';			$outTable.= '<td>'.$this->elementLinks('be_users',$tempBE_USER->user).'</td></tr></table>';			$outTable.= '<strong><a href="'.htmlspecialchars($this->MCONF['_']).'">&lt; Back to overview</a></strong><br />';			$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))	{				$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);			$outCode.='<br /><input type="submit" name="ads" value="Update">';			$content = $this->doc->section('Group and Compare Users',$outCode,0,1);				// Traverse all users			$users = t3lib_BEfunc::getUserNames();			$comparation=array();			reset($users);			$counter=0;			$offset=0;			$numberAtTime=1000;			$tooManyUsers='';			while(list(,$r)=each($users))	{				if ($counter>=$offset)	{						// This is used to test with other users. Development ONLY!					$tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');	// New backend user object					$tempBE_USER->OS = TYPO3_OS;					$tempBE_USER->setBeUserByUid($r['uid']);					$tempBE_USER->fetchGroupData();						// Making group data					$md5pre='';					$menu=array();					$uInfo = $tempBE_USER->ext_compileUserInfoForHash((array)$compareFlags);					reset($options);					while(list($kk,$vv)=each($options))	{						if ($compareFlags[$kk])	{							$md5pre.=serialize($uInfo[$kk]).'|';						}					}						// setting md5:					$md5=md5($md5pre);					if (!isset($comparation[$md5]))	{						$comparation[$md5]=$tempBE_USER->ext_printOverview($uInfo,$compareFlags);						$comparation[$md5]['users']=array();					}					$comparation[$md5]['users'][]=$tempBE_USER->user;	//array('uid'=>$r['uid'],'username'=>$r['username'],'realName'=>$tempBE_USER->user['realName'],'email'=>$tempBE_USER->user['email'],'admin'=>$tempBE_USER->user['admin']);					unset($tempBE_USER);				}				$counter++;				if ($counter>=($numberAtTime+$offset)) {					$tooManyUsers='There were more than '.$numberAtTime.' users (total: '.count($users).') and this tool can display only '.$numberAtTime.' at a time!';					break;				}			}				// Print the groups:			$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="" />'.				'</a>';			$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))	{				if ($compareFlags[$kk])	{					$allCells[$kk] = '<b>'.$vv.':</b>';				}			}			$allGroups[]=$allCells;			reset($comparation);			while(list(,$dat)=each($comparation))	{				$allCells = array();				$curUid = $GLOBALS['BE_USER']->user['uid'];				$uListArr=array();				reset($dat['users']);				while(list(,$uDat)=each($dat['users']))	{					$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>'.							'<a href="'.t3lib_div::linkThisScript(array('SwitchUser'=>$uDat['uid'], 'switchBackUser' => 1)).'" target="_top"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/su_back.gif').' border="0" align="top" title="'.htmlspecialchars('Switch user to: '.$uDat['username']).' [switch-back mode]" alt="" /></a>';					}					$uItem .= '</td></tr>';					$uListArr[] = $uItem;				}				$allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.implode('',$uListArr).'</table>';				reset($options);				while(list($kk,$vv)=each($options))	{					if ($compareFlags[$kk])	{						$allCells[$kk] = $dat[$kk];					}				}				$allGroups[]=$allCells;			}				// Make table			$outTable='';			reset($allGroups);			$TDparams=' nowrap="nowrap" class="bgColor5" valign="top"';			while(list(,$allCells)=each($allGroups))	{				$outTable.='<tr><td'.$TDparams.'>'.implode('</td><td'.$TDparams.'>',$allCells).'</td></tr>';				$TDparams=' nowrap="nowrap" class="bgColor4" valign="top"';			}			$outTable='<table border="0" cellpadding="2" cellspacing="2">'.$outTable.'</table>';			$outTable.=fw('<br /><br />(All cached group lists updated.)');			$outTable.=$tooManyUsers?'<br /><br /><strong><span class="typo3-red">'.$tooManyUsers.'</span></strong>':'';			$content.= $this->doc->spacer(10);			$content.= $this->doc->section('Result',$outTable,0,1);		}		return $content;	}	/**	 * [Describe function...]	 *	 * @param	[type]		$str: ...	 * @param	[type]		$rec: ...	 * @return	[type]		...	 */	function linkUser($str,$rec)	{		return '<a href="'.htmlspecialchars($this->MCONF['_']).'&be_user_uid='.$rec['uid'].'">'.$str.'</a>';	}	/**	 * [Describe function...]	 *	 * @param	[type]		$table: ...	 * @param	[type]		$row: ...	 * @return	[type]		...	 */	function elementLinks($table,$row)	{			// Info:		$cells[]='<a href="#" onclick="top.launchView(\''.$table.'\', \''.$row['uid'].'\',\''.$GLOBALS['BACK_PATH'].'\'); return false;"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/zoom2.gif').' border="0" align="top" title="Show information" alt="" /></a>';			// Edit:		$params='&edit['.$table.']['.$row['uid'].']=edit';		$cells[]='<a href="#" onclick="'.t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'').'"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/edit2.gif').' border="0" align="top" title="Edit" alt="" /></a>';			// Hide:		$hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];		if ($row[$hiddenField])	{			$params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0';			$cells[]='<a href="'.$this->doc->issueCommand($params).'"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/button_unhide.gif').' border="0" title="Enable" align="top" alt="" /></a>';		} else {			$params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1';			$cells[]='<a href="'.$this->doc->issueCommand($params).'"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/button_hide.gif').' border="0" title="Disable" align="top" alt="" /></a>';		}			// Delete		$params='&cmd['.$table.']['.$row['uid'].'][delete]=1';		$cells[]='<a href="'.$this->doc->issueCommand($params).'" onclick="return confirm(unescape(\''.rawurlencode('Are you sure you want to delete this element?').'\'));"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/garbage.gif').' border="0" align="top" title="Delete(!)" alt="" /></a>';		return implode('',$cells);	}	/**	 * [Describe function...]	 *	 * @return	[type]		...	 */	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!			$tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');	// New backend user object			$tempBE_USER->OS = TYPO3_OS;			$tempBE_USER->setBeUserByUid($r['uid']);			$tempBE_USER->fetchGroupData();		}	}	/**	 * [Describe function...]	 *	 * @param	[type]		$str: ...	 * @return	[type]		...	 */	function localPath($str)	{		if (substr($str,0,strlen(PATH_site))==PATH_site)	{			return substr($str,strlen(PATH_site));		} else return $str;	}	/**	 * [Describe function...]	 *	 * @param	[type]		$switchUser: ...	 * @return	[type]		...	 */	function switchUser($switchUser)	{		$uRec=t3lib_BEfunc::getRecord('be_users',$switchUser);		if (is_array($uRec) && $GLOBALS['BE_USER']->isAdmin())	{			$updateData['ses_userid'] = $uRec['uid'];				// user switchback			if (t3lib_div::_GP('switchBackUser'))	{				$updateData['ses_backuserid'] = intval($GLOBALS['BE_USER']->user['uid']);			}			$GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_sessions', 'ses_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->id, 'be_sessions').' AND ses_name=\'be_typo_user\' AND ses_userid='.intval($GLOBALS['BE_USER']->user['uid']),$updateData);			header('Location: '.t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'].'index.php'.($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']?'':'?commandLI=1')));			exit;		}	}	/***************************	 *	 * "WHO IS ONLINE" FUNCTIONS:	 *	 ***************************/	/**	 * @author Martin Kutschker	 */	function whoIsOnline()	{		$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';		$from_table = '(be_sessions, be_users u) LEFT OUTER JOIN be_users bu ON (ses_backuserid=bu.uid)';		$where_clause = 'ses_userid=u.uid';		$orderBy = 'u.username';		if (t3lib_div::testInt($GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout']))	{			$where_clause .= ' AND '.$GLOBALS['EXEC_TIME'].'<(ses_tstamp+'.$GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'].')';		} else {			$timeout = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout']);			if ($timeout > 0)	{				$where_clause .= ' AND '.$GLOBALS['EXEC_TIME'].'<(ses_tstamp+'.$timeout.')';			}		}			// Fetch active sessions of other users from storage:		$sessions = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($select_fields,$from_table,$where_clause,'',$orderBy);			// Process and visualized each active session as a table row:		if (is_array($sessions)) {			foreach ($sessions as $session) {				$hostName = ($session['ses_iplock'] != '[DISABLED]' ? gethostbyaddr($session['ses_iplock']) : '[DISABLED]');				$outTable .= '					<tr class="bgColor4" height="17" valign="top">' .						'<td nowrap="nowrap">' .							date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $session['ses_tstamp']) .						'</td>' .						'<td nowrap="nowrap">' .							'<span title="'.$hostName.'">'.$session['ses_iplock'].'</span>' .						'</td>' .						'<td width="130">' .							t3lib_iconWorks::getIconImage('be_users',$session,$GLOBALS['BACK_PATH'],'align="top" title="'.$session['uid'].'"').htmlspecialchars($session['username']).'&nbsp;' .						'</td>' .						'<td nowrap="nowrap">'.htmlspecialchars($session['realName']).'&nbsp;&nbsp;</td>' .						'<td nowrap="nowrap">'.$this->elementLinks('be_users',$session).'</td>' .						'<td nowrap="nowrap" valign="top">'.($session['bu_username'] ? '&nbsp;SU from: ' : '').htmlspecialchars($session['bu_username']).'&nbsp;</td>' .						'<td nowrap="nowrap" valign="top">&nbsp;'.htmlspecialchars($session['bu_realName']).'</td>' .					'</tr>';			}		}			// Wrap <table> tag around the rows:		$outTable = '		<table border="0" cellpadding="2" cellspacing="2">			<tr class="bgColor5">				<td valign="top"><b>Timestamp:</b></td>				<td valign="top"><b>Host:</b></td>				<td valign="top" colspan="5"><b>Username:</b></td>			</tr>'.$outTable.'		</table>';		$content.= $this->doc->section('Who Is Online',$outTable,0,1);		return $content;	}}// Include extension?if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/beuser/mod/index.php'])	{	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/beuser/mod/index.php']);}// Make instance:$SOBE = t3lib_div::makeInstance('SC_mod_tools_be_user_index');$SOBE->init();$SOBE->main();$SOBE->printContent();?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -