|
function statistics() {
|
|
if ($this->config['config']['stat'] &&
|
|
(!strcmp('',$this->config['config']['stat_typeNumList']) || t3lib_div::inList(str_replace(' ','',$this->config['config']['stat_typeNumList']), $this->type)) &&
|
|
(!$this->config['config']['stat_excludeBEuserHits'] || !$this->beUserLogin) &&
|
|
(!$this->config['config']['stat_excludeIPList'] || !t3lib_div::inList(str_replace(' ','',$this->config['config']['stat_excludeIPList']), t3lib_div::getIndpEnv('REMOTE_ADDR')))) {
|
|
$GLOBALS['TT']->push('Stat');
|
|
if (t3lib_extMgm::isLoaded('sys_stat') && $this->config['config']['stat_mysql']) {
|
|
// Jumpurl:
|
|
$sword = t3lib_div::GPvar('sword');
|
|
if ($sword) {
|
|
$jumpurl_msg='sword:'.$sword;
|
|
} elseif ($this->jumpurl) {
|
|
$jumpurl_msg='jumpurl:'.$this->jumpurl;
|
|
} else {
|
|
$jumpurl_msg='';
|
|
}
|
|
// Flags: bits: 0 = BE_user, 1=Cached page?
|
|
$flags=0;
|
|
if ($this->beUserLogin) {$flags|=1;}
|
|
if ($this->cacheContentFlag) {$flags|=2;}
|
|
// Ref url:
|
|
$refUrl = t3lib_div::getIndpEnv('HTTP_REFERER');
|
|
$thisUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR');
|
|
if (t3lib_div::isFirstPartOfStr($refUrl,$thisUrl)) {
|
|
$refUrl='[LOCAL]';
|
|
}
|
|
|
|
$query ='INSERT INTO sys_stat SET ';
|
|
$query.='page_id="'.$this->id.'",'; // id
|
|
$query.='page_type="'.$this->type.'",'; // type
|
|
$query.='jumpurl="'.addslashes($jumpurl_msg).'",'; // jumpurl message
|
|
$query.='feuser_id="'.$this->fe_user->user['uid'].'",'; // fe_user id, integer
|
|
$query.='cookie="'.addslashes($this->fe_user->id).'",'; // cookie as set or retrieve. If people has cookies disabled this will vary all the time...
|
|
$query.='sureCookie="'.hexdec(substr($this->fe_user->cookieId,0,8)).'",'; // This is the cookie value IF the cookie WAS actually set. However the first hit where the cookie is set will thus NOT be logged here. So this lets you select for a session of at least two clicks...
|
|
$query.='rl0="'.$this->config['rootLine'][0]['uid'].'",'; // RootLevel 0 uid
|
|
$query.='rl1="'.$this->config['rootLine'][1]['uid'].'",'; // RootLevel 1 uid
|
|
$query.='client_browser="'.addslashes($GLOBALS['CLIENT']['BROWSER']).'",'; // Client browser (net, msie, opera)
|
|
$query.='client_version="'.addslashes($GLOBALS['CLIENT']['VERSION']).'",'; // Client version (double value)
|
|
$query.='client_os="'.addslashes($GLOBALS['CLIENT']['SYSTEM']).'",'; // Client Operating system (win, mac, unix)
|
|
$query.='parsetime="'.intval($this->scriptParseTime).'",'; // Parsetime for the page.
|
|
$query.='flags="'.$flags.'",'; // Flags: Is be user logged in? Is page cached?
|
|
$query.='IP="'.addslashes(t3lib_div::getIndpEnv('REMOTE_ADDR')).'",'; // Remote IP address
|
|
$query.='host="'.addslashes(t3lib_div::getIndpEnv('REMOTE_HOST')).'",'; // Remote Host Address
|
|
$query.='referer="'.addslashes($refUrl).'",'; // Referer URL
|
|
$query.='browser="'.addslashes(t3lib_div::getIndpEnv('HTTP_USER_AGENT')).'",'; // User Agent Info.
|
|
$query.='tstamp='.$GLOBALS['EXEC_TIME']; // Time stamp
|
|
$GLOBALS['TT']->push('Store SQL');
|
|
mysql (TYPO3_db, $query);
|
|
$GLOBALS['TT']->pull();
|
|
echo mysql_error();
|
|
}
|
|
|
|
// Apache:
|
|
if ($this->config['config']['stat_apache'] && $this->config['stat_vars']['pageName']) {
|
|
if (@is_file($this->config['stat_vars']['logFile']) && TYPO3_OS!='WIN') {
|
|
$LogLine = ((t3lib_div::getIndpEnv('REMOTE_HOST') && !$this->config['config']['stat_apache_noHost']) ? t3lib_div::getIndpEnv('REMOTE_HOST') : t3lib_div::getIndpEnv('REMOTE_ADDR')).' - - '.Date('[d/M/Y:H:i:s +0000]',$GLOBALS['EXEC_TIME']).' "GET '.$this->config['stat_vars']['pageName'].' HTTP/1.1" 200 '.strlen($this->content);
|
|
if (!$this->config['config']['stat_apache_notExtended']) {
|
|
$LogLine.= ' "'.t3lib_div::getIndpEnv('HTTP_REFERER').'" "'.t3lib_div::getIndpEnv('HTTP_USER_AGENT').'"';
|
|
}
|
|
$execCmd = 'echo "'.addslashes($LogLine).'" >> '.$this->config['stat_vars']['logFile'];
|
|
$GLOBALS['TT']->push('Write to log file');
|
|
exec($execCmd);
|
|
$GLOBALS['TT']->pull();
|
|
$GLOBALS['TT']->setTSlogMessage('Writing to logfile: OK',0);
|
|
} else {
|
|
$GLOBALS['TT']->setTSlogMessage('Writing to logfile: Error - logFile did not exist or OS is Windows!',3);
|
|
}
|
|
}
|
|
$GLOBALS['TT']->pull();
|
|
}
|
|
}
|