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
00081 class t3lib_BEDisplayLog {
00082 var $lastTimeLabel = '';
00083 var $lastUserLabel = '';
00084 var $lastTypeLabel = '';
00085 var $lastActionLabel = '';
00086
00087 var $detailsOn = 1;
00088 var $stripPath = 1;
00089 var $errorSign = Array(
00090 1 => '!',
00091 2 => 'Sys!',
00092 3 => 'Secur!'
00093 );
00094
00095 var $be_user_Array = array();
00096
00102 function initArray() {
00103 $codeArr=Array();
00104 $codeArr[0][]='Time';
00105 $codeArr[0][]='User';
00106 $codeArr[0][]='Type';
00107 $codeArr[0][]='E';
00108 $codeArr[0][]='Action';
00109 $codeArr[0][]='Details';
00110 return $codeArr;
00111 }
00112
00119 function getTimeLabel($code) {
00120 $t=$GLOBALS['SOBE']->doc->formatTime($code,1);
00121 if ($this->lastTimeLabel!=$t) {
00122 $this->lastTimeLabel=$t;
00123 return $t;
00124 } else return '.';
00125
00126 }
00127
00134 function getUserLabel($code) {
00135 if ($this->lastUserLabel!=$code) {
00136 $this->lastUserLabel=$code;
00137 $label = $this->be_user_Array[$code]['username'];
00138 return $label ? $label : '['.$code.']';
00139 } else return '.';
00140 }
00141
00148 function getTypeLabel($code) {
00149 if ($this->lastTypeLabel!=$code) {
00150 $this->lastTypeLabel=$code;
00151 $label=$GLOBALS['LANG']->getLL('type_'.$code);
00152 return $label ? $label : '['.$code.']';
00153 } else return '.';
00154 }
00155
00162 function getActionLabel($code) {
00163 if ($this->lastActionLabel!=$code) {
00164 $this->lastActionLabel=$code;
00165 $label=$GLOBALS['LANG']->getLL('action_'.$code);
00166 return $label ? $label : '['.$code.']';
00167 } else return '.';
00168 }
00169
00180 function getDetails($code,$text,$data,$sys_log_uid=0) {
00181
00182 if (is_array($data)) {
00183 if ($this->detailsOn) {
00184 if (is_object($GLOBALS['LANG'])) {
00185 $label = $GLOBALS['LANG']->getLL('msg_'.$code);
00186 } else {
00187 list($label) = explode(',',$text);
00188 }
00189 if ($label) {$text=$label;}
00190 $text = sprintf($text, htmlspecialchars($data[0]),htmlspecialchars($data[1]),htmlspecialchars($data[2]),htmlspecialchars($data[3]),htmlspecialchars($data[4]));
00191 } else {
00192 $text = str_replace('%s','',$text);
00193 }
00194 }
00195
00196
00197 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,fieldlist', 'sys_history', 'sys_log_uid='.intval($sys_log_uid));
00198 $newRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00199 if (is_array($newRow)) {
00200 $text.=' Changes in fields: <em>'.$newRow['fieldlist'].'</em>.';
00201 $text.=' <a href="'.htmlspecialchars($GLOBALS['BACK_PATH'].'show_rechis.php?sh_uid='.$newRow['uid'].'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'"><b>->His</b></a>';
00202 }
00203
00204 return $text;
00205 }
00206
00212 function reset() {
00213 $this->lastTimeLabel='';
00214 $this->lastUserLabel='';
00215 $this->lastTypeLabel='';
00216 $this->lastActionLabel='';
00217 }
00218
00226 function getErrorFormatting($sign) {
00227 return '<font color="red"><b>'.$sign.'</b></font>';
00228 }
00229
00236 function formatDetailsForList($row) {
00237 $data = unserialize($row['log_data']);
00238 if ($row['type']==2) {
00239 $data=$this->stripPath($data);
00240 }
00241
00242 return $this->getDetails($row['type'].'_'.$row['action'].'_'.$row['details_nr'],$row['details'],$data,$row['uid']).' ('.$row['details_nr'].')';
00243 }
00244
00253 function stripPath($inArr) {
00254 if ($this->stripPath && is_array($inArr)) {
00255 while(list($key,$val)=each($inArr)) {
00256 $inArr[$key]=basename($val);
00257 }
00258 }
00259 return $inArr;
00260 }
00261 }
00262
00263
00264 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_bedisplaylog.php']) {
00265 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_bedisplaylog.php']);
00266 }
00267 ?>