2 /***************************************************************
5 * (c) 1999-2004 Kasper Skaarhoj (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 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
32 require_once(PATH_t3lib
."class.t3lib_pagetree.php");
33 require_once(PATH_t3lib
."class.t3lib_bedisplaylog.php");
34 class logFunctions_ext
extends t3lib_BEDisplayLog
{
35 function initArray() {
38 $codeArr[$i][]=$LANG->getLL("chLog_l_time");
39 $codeArr[$i][]=$LANG->getLL("chLog_l_user");
40 $codeArr[$i][]=$LANG->getLL("chLog_l_error");
41 $codeArr[$i][]=$LANG->getLL("chLog_l_action");
42 $codeArr[$i][]=$LANG->getLL("chLog_l_table");
43 $codeArr[$i][]=$LANG->getLL("chLog_l_details");
49 require_once(PATH_t3lib
."class.t3lib_extobjbase.php");
51 class tx_belog_webinfo
extends t3lib_extobjbase
{
52 var $localLangFile = "locallang.php";
59 0 => $LANG->getLL("chLog_users_0"),
60 "-1" => $LANG->getLL("chLog_users_-1")
63 0 => $LANG->getLL("chLog_time_0"),
64 1 => $LANG->getLL("chLog_time_1"),
65 2 => $LANG->getLL("chLog_time_2"),
66 10 => $LANG->getLL("chLog_time_10"),
67 11 => $LANG->getLL("chLog_time_11"),
68 12 => $LANG->getLL("chLog_time_12"),
69 20 => $LANG->getLL("chLog_time_20")
72 0 => $LANG->getLL("depth_0"),
73 1 => $LANG->getLL("depth_1"),
74 2 => $LANG->getLL("depth_2"),
75 3 => $LANG->getLL("depth_3")
80 // ***********************************
81 // MAIN function for log display
82 // ***********************************
83 function localLang() {
84 $LOCAL_LANG = $GLOBALS['LANG']->includeLLFile('EXT:belog/mod/locallang.xml',FALSE);
86 $GLOBALS["LOCAL_LANG"]=t3lib_div
::array_merge_recursive_overrule($GLOBALS["LOCAL_LANG"],$LOCAL_LANG);
90 * [Describe function...]
99 $lF = t3lib_div
::makeInstance("logFunctions_ext");
103 $menu.= " ".$LANG->getLL("chLog_menuUsers").": ".t3lib_BEfunc
::getFuncMenu($this->pObj
->id
,"SET[log_users]",$this->pObj
->MOD_SETTINGS
["log_users"],$this->pObj
->MOD_MENU
["log_users"]);
104 $menu.= " ".$LANG->getLL("chLog_menuDepth").": ".t3lib_BEfunc
::getFuncMenu($this->pObj
->id
,"SET[depth]",$this->pObj
->MOD_SETTINGS
["depth"],$this->pObj
->MOD_MENU
["depth"]);
105 $menu.= " ".$LANG->getLL("chLog_menuTime").": ".t3lib_BEfunc
::getFuncMenu($this->pObj
->id
,"SET[log_time]",$this->pObj
->MOD_SETTINGS
["log_time"],$this->pObj
->MOD_MENU
["log_time"]);
106 $theOutput.=$this->pObj
->doc
->section($LANG->getLL("chLog_title"),'<span class="nobr">'.$menu.'</span>',0,1);
112 // Get the idlist of pages for the treestructure.
113 $tree = t3lib_div
::makeInstance("t3lib_pageTree");
114 $tree->init("AND ".$this->pObj
->perms_clause
);
116 $tree->fieldArray
= Array("uid");
117 if ($this->pObj
->MOD_SETTINGS
["depth"]) {
118 $tree->getTree($this->pObj
->id
, $this->pObj
->MOD_SETTINGS
["depth"], "");
120 $tree->ids
[]=$this->pObj
->id
;
121 $idList = implode($tree->ids
,",");
123 //$where_part.=" AND ((tablename='pages' and recuid in (".$idList.")) OR (tablename!='pages' and recpid in (".$idList.")))"; // DB
124 $where_part.=" AND (event_pid in (".$idList."))"; // DB
129 switch($this->pObj
->MOD_SETTINGS
["log_time"]) {
132 $week = (date("w") ?
date("w") : 7)-1;
133 $starttime = mktime (0,0,0)-$week*3600*24;
137 $week = (date("w") ?
date("w") : 7)-1;
138 $starttime = mktime (0,0,0)-($week+
7)*3600*24;
139 $endtime = mktime (0,0,0)-$week*3600*24;
143 $starttime = mktime (0,0,0)-7*3600*24;
147 $starttime = mktime (0,0,0, date("m"),1);
151 $starttime = mktime (0,0,0, date("m")-1,1);
152 $endtime = mktime (0,0,0, date("m"),1);
156 $starttime = mktime (0,0,0)-31*3600*24;
160 $where_part.=" AND tstamp>=".$starttime." AND tstamp<".$endtime;
163 $where_part.=" AND type=1"; // DB
167 $this->pObj
->be_user_Array
= t3lib_BEfunc
::getUserNames();
168 if (!$this->pObj
->MOD_SETTINGS
["log_users"]) { // All users
169 // Get usernames and groupnames
170 if (!$GLOBALS["BE_USER"]->isAdmin()) {
171 $groupArray = explode(",",$GLOBALS["BE_USER"]->user
["usergroup_cached_list"]);
172 $this->pObj
->be_user_Array
= t3lib_BEfunc
::blindUserNames($this->pObj
->be_user_Array
,$groupArray,1);
175 if (is_array($this->pObj
->be_user_Array
)) {
176 while(list(,$val)=each($this->pObj
->be_user_Array
)) {
177 $selectUsers[]=$val["uid"];
180 $selectUsers[] = $GLOBALS["BE_USER"]->user
["uid"];
181 $where_part.=" AND userid in (".implode($selectUsers,",").")";
183 $where_part.=" AND userid=".$GLOBALS["BE_USER"]->user
["uid"]; // Self user
190 $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', '1=1'.$where_part, '', 'uid DESC', 100);
192 $codeArr = $lF->initArray();
194 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) {
195 $header = $this->pObj
->doc
->formatTime($row["tstamp"],10);
196 if (!$oldHeader) $oldHeader = $header;
198 if ($header!=$oldHeader) {
199 $theOutput.=$this->pObj
->doc
->spacer(10);
200 $theOutput.=$this->pObj
->doc
->section($oldHeader,$this->pObj
->doc
->table($codeArr));
201 $codeArr=$lF->initArray();
207 $codeArr[$i][]=$lF->getTimeLabel($row["tstamp"]);
208 $codeArr[$i][]=$lF->getUserLabel($row["userid"]);
209 $codeArr[$i][]=$row["error"] ?
$lF->getErrorFormatting($lF->errorSign
[$row["error"]]) : "";
210 $codeArr[$i][]=$lF->getActionLabel($row["type"]."_".$row["action"]);
211 $codeArr[$i][]=$row["tablename"];
212 $codeArr[$i][]=$lF->formatDetailsForList($row);
214 $theOutput.=$this->pObj
->doc
->spacer(10);
215 $theOutput.=$this->pObj
->doc
->section($header,$this->pObj
->doc
->table($codeArr));
217 $GLOBALS['TYPO3_DB']->sql_free_result($log);
223 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE
]["XCLASS"]["ext/belog/class.tx_belog_webinfo.php"]) {
224 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]["XCLASS"]["ext/belog/class.tx_belog_webinfo.php"]);