[ Index ] |
|
Code source de Typo3 4.1.3 |
1 <?php 2 /*************************************************************** 3 * Copyright notice 4 * 5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) 6 * All rights reserved 7 * 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. 13 * 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. 18 * 19 * 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. 24 * 25 * This copyright notice MUST APPEAR in all copies of the script! 26 ***************************************************************/ 27 /** 28 * Module: Log-viewing 29 * 30 * This module lets you view the changelog. 31 * 32 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 33 */ 34 35 36 #unset($MCONF); 37 #require ('conf.php'); 38 #require ($BACK_PATH.'init.php'); 39 #require ($BACK_PATH.'template.php'); 40 $LANG->includeLLFile('EXT:belog/mod/locallang.php'); 41 require_once (PATH_t3lib.'class.t3lib_bedisplaylog.php'); 42 require_once (PATH_t3lib.'class.t3lib_pagetree.php'); 43 44 $BE_USER->modAccess($MCONF,1); 45 46 47 48 49 /** 50 * Tools log script class 51 * 52 * @author Kasper Skaarhoj <kasperYYYY@typo3.com> 53 * @package TYPO3 54 * @subpackage tx_belog 55 */ 56 class SC_mod_tools_log_index { 57 var $MCONF=array(); 58 var $MOD_MENU=array(); 59 var $MOD_SETTINGS=array(); 60 var $doc; 61 62 var $content; 63 var $lF; 64 var $be_user_Array; 65 66 /** 67 * Initialize module 68 * 69 * @return void 70 */ 71 function init() { 72 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 73 $this->MCONF = $GLOBALS['MCONF']; 74 75 $this->lF = t3lib_div::makeInstance('t3lib_BEDisplayLog'); 76 $this->menuConfig(); 77 78 $this->doc = t3lib_div::makeInstance('noDoc'); 79 $this->doc->backPath = $BACK_PATH; 80 81 // JavaScript 82 $this->doc->JScode = ' 83 <script language="javascript" type="text/javascript"> 84 script_ended = 0; 85 function jumpToUrl(URL) { 86 window.location.href = URL; 87 } 88 </script> 89 '; 90 91 $this->doc->tableLayout = Array ( 92 '0' => Array ( 93 '0' => Array('<td valign="top"><b>','</b></td>'), 94 'defCol' => Array('<td><img src="'.$this->doc->backPath.'clear.gif" width="10" height="1"></td><td valign="top"><b>','</b></td>') 95 ), 96 'defRow' => Array ( 97 '0' => Array('<td valign="top">','</td>'), 98 'defCol' => Array('<td><img src="'.$this->doc->backPath.'clear.gif" width="10" height="1"></td><td valign="top">','</td>') 99 ) 100 ); 101 $this->doc->form = '<form action="" method="post">'; 102 103 $this->be_user_Array = t3lib_BEfunc::getUserNames(); 104 $this->lF->be_user_Array = &$this->be_user_Array; 105 } 106 107 /** 108 * Menu configuration 109 * 110 * @return void 111 */ 112 function menuConfig() { 113 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 114 115 // MENU-ITEMS: 116 // If array, then it's a selector box menu 117 // If empty string it's just a variable, that'll be saved. 118 // Values NOT in this array will not be saved in the settings-array for the module. 119 $this->MOD_MENU = array( 120 'users' => array( 121 0 => 'All users', 122 '-1' => 'Self' 123 ), 124 'time' => array( 125 0 => 'This week', 126 1 => 'Last week', 127 2 => 'Last 7 days', 128 10 => 'This month', 129 11 => 'Last month', 130 12 => 'Last 31 days', 131 20 => 'No limit' 132 ), 133 'max' => array( 134 20 => '20', 135 50 => '50', 136 100 => '100', 137 200 => '200', 138 500 => '500' 139 ), 140 'action' => array( 141 0 => 'All', 142 1 => 'Database', 143 2 => 'File', 144 254 => 'Settings', 145 255 => 'Login', 146 '-1' => 'Errors' 147 ) 148 ); 149 150 // Adding groups to the users_array 151 $groups = t3lib_BEfunc::getGroupNames(); 152 if (is_array($groups)) { 153 while(list(,$grVals)=each($groups)) { 154 $this->MOD_MENU['users'][$grVals['uid']] = 'Group: '.$grVals['title']; 155 } 156 } 157 158 // CLEANSE SETTINGS 159 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']); 160 } 161 162 /** 163 * Main function 164 * 165 * @return void 166 */ 167 function main() { 168 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 169 170 $this->content.=$this->doc->startPage('Administration log'); 171 $this->content.=$this->doc->header('Administration log'); 172 $this->content.=$this->doc->spacer(5); 173 174 175 // Menu compiled: 176 $menuU= t3lib_BEfunc::getFuncMenu(0,'SET[users]',$this->MOD_SETTINGS['users'],$this->MOD_MENU['users']); 177 $menuM= t3lib_BEfunc::getFuncMenu(0,'SET[max]',$this->MOD_SETTINGS['max'],$this->MOD_MENU['max']); 178 $menuT= t3lib_BEfunc::getFuncMenu(0,'SET[time]',$this->MOD_SETTINGS['time'],$this->MOD_MENU['time']); 179 $menuA= t3lib_BEfunc::getFuncMenu(0,'SET[action]',$this->MOD_SETTINGS['action'],$this->MOD_MENU['action']); 180 181 182 $this->content.=$this->doc->section('',$this->doc->menuTable( 183 array( 184 array('Users:',$menuU), 185 array('Time:',$menuT) 186 ), 187 array( 188 array('Max:',$menuM), 189 array('Action:',$menuA) 190 ) 191 )); 192 $this->content.=$this->doc->divider(5); 193 194 195 $codeArr = $this->lF->initArray(); 196 $oldHeader=''; 197 $c=0; 198 199 // Action (type): 200 $where_part=''; 201 if ($this->MOD_SETTINGS['action'] > 0) { 202 $where_part.=' AND type='.intval($this->MOD_SETTINGS['action']); 203 } elseif ($this->MOD_SETTINGS['action'] == -1) { 204 $where_part.=' AND error'; 205 } 206 207 208 $starttime=0; 209 $endtime=time(); 210 211 // Time: 212 switch($this->MOD_SETTINGS['time']) { 213 case 0: 214 // This week 215 $week = (date('w') ? date('w') : 7)-1; 216 $starttime = mktime (0,0,0)-$week*3600*24; 217 break; 218 case 1: 219 // Last week 220 $week = (date('w') ? date('w') : 7)-1; 221 $starttime = mktime (0,0,0)-($week+7)*3600*24; 222 $endtime = mktime (0,0,0)-$week*3600*24; 223 break; 224 case 2: 225 // Last 7 days 226 $starttime = mktime (0,0,0)-7*3600*24; 227 break; 228 case 10: 229 // This month 230 $starttime = mktime (0,0,0, date('m'),1); 231 break; 232 case 11: 233 // Last month 234 $starttime = mktime (0,0,0, date('m')-1,1); 235 $endtime = mktime (0,0,0, date('m'),1); 236 break; 237 case 12: 238 // Last 31 days 239 $starttime = mktime (0,0,0)-31*3600*24; 240 break; 241 } 242 if ($starttime) { 243 $where_part.=' AND tstamp>='.$starttime.' AND tstamp<'.$endtime; 244 } 245 246 247 // Users 248 if ($this->MOD_SETTINGS['users'] > 0) { // All users 249 $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array,array($this->MOD_SETTINGS['users']),1); 250 if (is_array($this->be_user_Array)) { 251 while(list(,$val)=each($this->be_user_Array)) { 252 if ($val['uid']!=$BE_USER->user['uid']) { 253 $selectUsers[]=$val['uid']; 254 } 255 } 256 } 257 $selectUsers[] = 0; 258 $where_part.=' AND userid in ('.implode($selectUsers,',').')'; 259 } elseif ($this->MOD_SETTINGS['users']==-1) { 260 $where_part.=' AND userid='.$BE_USER->user['uid']; // Self user 261 } 262 263 if ($GLOBALS['BE_USER']->workspace!==0) { 264 $where_part.=' AND workspace='.intval($GLOBALS['BE_USER']->workspace); 265 } 266 267 268 269 270 $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', '1=1'.$where_part, '', 'uid DESC', intval($this->MOD_SETTINGS['max'])); 271 272 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) { 273 $header=$this->doc->formatTime($row['tstamp'],10); 274 if (!$oldHeader) $oldHeader=$header; 275 276 if ($header!=$oldHeader) { 277 $this->content.=$this->doc->spacer(10); 278 $this->content.=$this->doc->section($oldHeader,$this->doc->table($codeArr)); 279 $codeArr=$this->lF->initArray(); 280 $oldHeader=$header; 281 $this->lF->reset(); 282 } 283 284 $i++; 285 $codeArr[$i][]=$this->lF->getTimeLabel($row['tstamp']); 286 $codeArr[$i][]=$this->lF->getUserLabel($row['userid'],$row['workspace']); 287 $codeArr[$i][]=$this->lF->getTypeLabel($row['type']); 288 $codeArr[$i][]=$row['error'] ? $this->lF->getErrorFormatting($this->lF->errorSign[$row['error']],$row['error']) : ''; 289 $codeArr[$i][]=$this->lF->getActionLabel($row['type'].'_'.$row['action']); 290 $codeArr[$i][]=$this->lF->formatDetailsForList($row); 291 } 292 $this->content.=$this->doc->spacer(10); 293 $this->content.=$this->doc->section($header,$this->doc->table($codeArr)); 294 295 $GLOBALS['TYPO3_DB']->sql_free_result($log); 296 297 if ($BE_USER->mayMakeShortcut()) { 298 $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('','users,time,max,action',$this->MCONF['name'])); 299 } 300 } 301 302 /** 303 * Output content 304 * 305 * @return string HTML 306 */ 307 function printContent() { 308 309 $this->content.=$this->doc->spacer(20); 310 $this->content.=$this->doc->endPage(); 311 echo $this->content; 312 } 313 } 314 315 // Include extension? 316 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/belog/mod/index.php']) { 317 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/belog/mod/index.php']); 318 } 319 320 321 322 323 324 325 326 327 328 329 330 331 // Make instance: 332 $SOBE = t3lib_div::makeInstance('SC_mod_tools_log_index'); 333 $SOBE->init(); 334 $SOBE->main(); 335 $SOBE->printContent(); 336 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Nov 25 17:13:16 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |