diff --git a/HTML.class.php b/HTML.class.php
index 3ddc06e0..371f4551 100644
--- a/HTML.class.php
+++ b/HTML.class.php
@@ -37,7 +37,7 @@ final class HTML
private $db_user = '';
private $minLines = 500;
private $minRows = 3;
- private $outputbits = 31;
+ private $sectionbits = 31;
private $stylesheet = 'default.css';
private $userstats = FALSE;
@@ -68,7 +68,7 @@ final class HTML
'db_user' => 'string',
'minLines' => 'int',
'minRows' => 'int',
- 'outputbits' => 'int',
+ 'sectionbits' => 'int',
'stylesheet' => 'string',
'userstats' => 'bool');
private $year = '';
@@ -194,7 +194,7 @@ public function makeHTML()
/**
* Activity section
*/
- if ($this->outputbits & 1) {
+ if ($this->sectionbits & 1) {
$this->output .= '
Activity
'."\n";
$this->output .= $this->makeTable_MostActiveTimes(array('head' => 'Most Active Times'));
$this->output .= $this->makeTable_Activity(array('type' => 'days', 'head' => 'Daily Activity'));
@@ -210,7 +210,7 @@ public function makeHTML()
/**
* General Chat section
*/
- if ($this->outputbits & 2) {
+ if ($this->sectionbits & 2) {
$output = '';
$output .= $this->makeTable(array('size' => 'small', 'rows' => 5, 'head' => 'Most Talkative Chatters', 'key1' => 'Lines/Day', 'key2' => 'User', 'decimals' => 1, 'percentage' => FALSE, 'query' => 'SELECT (`l_total` / `activeDays`) AS `v1`, `csNick` AS `v2` FROM `query_lines` JOIN `user_details` ON `query_lines`.`UID` = `user_details`.`UID` JOIN `user_status` ON `query_lines`.`UID` = `user_status`.`UID` WHERE `status` != 3 AND `l_total` >= '.$this->minLines.' ORDER BY `v1` DESC, `v2` ASC LIMIT 5'));
$output .= $this->makeTable(array('size' => 'small', 'rows' => 5, 'head' => 'Most Fluent Chatters', 'key1' => 'Words/Line', 'key2' => 'User', 'decimals' => 1, 'percentage' => FALSE, 'query' => 'SELECT (`words` / `l_total`) AS `v1`, `csNick` AS `v2` FROM `query_lines` JOIN `user_details` ON `query_lines`.`UID` = `user_details`.`UID` JOIN `user_status` ON `query_lines`.`UID` = `user_status`.`UID` WHERE `status` != 3 AND `l_total` >= '.$this->minLines.' ORDER BY `v1` DESC, `v2` ASC LIMIT 5'));
@@ -242,7 +242,7 @@ public function makeHTML()
/**
* Modes section
*/
- if ($this->outputbits & 4) {
+ if ($this->sectionbits & 4) {
$output = '';
$modes = array('Most Ops \'+o\', Given' => array('Ops', 'm_op')
,'Most Ops \'+o\', Received' => array('Ops', 'm_opped')
@@ -265,7 +265,7 @@ public function makeHTML()
/**
* Events section
*/
- if ($this->outputbits & 8) {
+ if ($this->sectionbits & 8) {
$output = '';
$output .= $this->makeTable(array('size' => 'large', 'rows' => 5, 'head' => 'Most Kicks', 'key1' => 'Kicks', 'key2' => 'User', 'key3' => 'Example', 'decimals' => 0, 'percentage' => FALSE, 'query' => 'SELECT `kicks` AS `v1`, `csNick` AS `v2`, `ex_kicks` AS `v3` FROM `query_events` JOIN `user_details` ON `query_events`.`UID` = `user_details`.`UID` JOIN `user_status` ON `query_events`.`UID` = `user_status`.`UID` WHERE `status` != 3 AND `kicks` != 0 ORDER BY `v1` DESC, `v2` ASC LIMIT 5', 'query_total' => 'SELECT SUM(`kicks`) AS `total` FROM `query_events`'));
$output .= $this->makeTable(array('size' => 'large', 'rows' => 5, 'head' => 'Most Kicked', 'key1' => 'Kicked', 'key2' => 'User', 'key3' => 'Example', 'decimals' => 0, 'percentage' => FALSE, 'query' => 'SELECT `kicked` AS `v1`, `csNick` AS `v2`, `ex_kicked` AS `v3` FROM `query_events` JOIN `user_details` ON `query_events`.`UID` = `user_details`.`UID` JOIN `user_status` ON `query_events`.`UID` = `user_status`.`UID` WHERE `status` != 3 AND `kicked` != 0 ORDER BY `v1` DESC, `v2` ASC LIMIT 5', 'query_total' => 'SELECT SUM(`kicked`) AS `total` FROM `query_events`'));
@@ -285,7 +285,7 @@ public function makeHTML()
/**
* Smileys section
*/
- if ($this->outputbits & 16) {
+ if ($this->sectionbits & 16) {
$output = '';
$smileys = array('Big Cheerful Smile' => array('=]', 's_01')
,'Cheerful Smile' => array('=)', 's_02')
@@ -1004,25 +1004,25 @@ private function output($type, $msg)
switch ($type) {
case 'debug':
- if ($this->outputLevel & 8) {
+ if ($this->outputbits & 8) {
echo $dateTime.' [debug] '.$msg."\n";
}
break;
case 'notice':
- if ($this->outputLevel & 4) {
+ if ($this->outputbits & 4) {
echo $dateTime.' [notice] '.$msg."\n";
}
break;
case 'warning':
- if ($this->outputLevel & 2) {
+ if ($this->outputbits & 2) {
echo $dateTime.' [warning] '.$msg."\n";
}
break;
case 'critical':
- if ($this->outputLevel & 1) {
+ if ($this->outputbits & 1) {
echo $dateTime.' [critical] '.$msg."\n";
}
diff --git a/Maintenance.class.php b/Maintenance.class.php
index e6cd7b82..98d42e11 100644
--- a/Maintenance.class.php
+++ b/Maintenance.class.php
@@ -38,7 +38,7 @@ final class Maintenance
private $db_pass = '';
private $db_port = 0;
private $db_user = '';
- private $outputLevel = 1;
+ private $outputbits = 1;
private $sanitisationDay = 'mon';
/**
@@ -51,7 +51,7 @@ final class Maintenance
'db_pass' => 'string',
'db_port' => 'int',
'db_user' => 'string',
- 'outputLevel' => 'int',
+ 'outputbits' => 'int',
'sanitisationDay' => 'string');
/**
@@ -308,25 +308,25 @@ private function output($type, $msg)
switch ($type) {
case 'debug':
- if ($this->outputLevel & 8) {
+ if ($this->outputbits & 8) {
echo $dateTime.' [debug] '.$msg."\n";
}
break;
case 'notice':
- if ($this->outputLevel & 4) {
+ if ($this->outputbits & 4) {
echo $dateTime.' [notice] '.$msg."\n";
}
break;
case 'warning':
- if ($this->outputLevel & 2) {
+ if ($this->outputbits & 2) {
echo $dateTime.' [warning] '.$msg."\n";
}
break;
case 'critical':
- if ($this->outputLevel & 1) {
+ if ($this->outputbits & 1) {
echo $dateTime.' [critical] '.$msg."\n";
}
diff --git a/Parser.class.php b/Parser.class.php
index 3b778613..dac5ce58 100644
--- a/Parser.class.php
+++ b/Parser.class.php
@@ -32,7 +32,7 @@ abstract class Parser
private $minStreak = 5;
private $nick_maxLen = 255;
private $nick_minLen = 1;
- private $outputLevel = 1;
+ private $outputbits = 1;
private $quote_prefLen = 25;
private $wordTracking = FALSE;
@@ -86,7 +86,7 @@ abstract class Parser
'minStreak' => 'int',
'nick_maxLen' => 'int',
'nick_minLen' => 'int',
- 'outputLevel' => 'int',
+ 'outputbits' => 'int',
'quote_prefLen' => 'int',
'wordTracking' => 'bool');
private $smileys = array(
@@ -201,25 +201,25 @@ final protected function output($type, $msg)
switch ($type) {
case 'debug':
- if ($this->outputLevel & 8) {
+ if ($this->outputbits & 8) {
echo $dateTime.' [debug] '.$msg."\n";
}
break;
case 'notice':
- if ($this->outputLevel & 4) {
+ if ($this->outputbits & 4) {
echo $dateTime.' [notice] '.$msg."\n";
}
break;
case 'warning':
- if ($this->outputLevel & 2) {
+ if ($this->outputbits & 2) {
echo $dateTime.' [warning] '.$msg."\n";
}
break;
case 'critical':
- if ($this->outputLevel & 1) {
+ if ($this->outputbits & 1) {
echo $dateTime.' [critical] '.$msg."\n";
}
diff --git a/nicklinker.php b/nicklinker.php
index 6ec13cc7..b34cd754 100755
--- a/nicklinker.php
+++ b/nicklinker.php
@@ -26,7 +26,8 @@ final class nicklinker
private $db_pass = '';
private $db_port = 0;
private $db_user = '';
- private $outputLevel = 1;
+ private $outputbits = 1;
+ private $timezone = '';
/**
* Variables that shouldn't be tampered with.
@@ -38,7 +39,8 @@ final class nicklinker
'db_pass' => 'string',
'db_port' => 'int',
'db_user' => 'string',
- 'outputLevel' => 'int');
+ 'outputbits' => 'int',
+ 'timezone' => 'string');
private $settings_required_list = array('db_host', 'db_name', 'db_pass', 'db_port', 'db_user', 'timezone');
/**
@@ -202,25 +204,25 @@ private function output($type, $msg)
switch ($type) {
case 'debug':
- if ($this->outputLevel & 8) {
+ if ($this->outputbits & 8) {
echo $dateTime.' [debug] '.$msg."\n";
}
break;
case 'notice':
- if ($this->outputLevel & 4) {
+ if ($this->outputbits & 4) {
echo $dateTime.' [notice] '.$msg."\n";
}
break;
case 'warning':
- if ($this->outputLevel & 2) {
+ if ($this->outputbits & 2) {
echo $dateTime.' [warning] '.$msg."\n";
}
break;
case 'critical':
- if ($this->outputLevel & 1) {
+ if ($this->outputbits & 1) {
echo $dateTime.' [critical] '.$msg."\n";
}
diff --git a/sss.conf b/sss.conf
index a1b24278..352a8420 100644
--- a/sss.conf
+++ b/sss.conf
@@ -19,6 +19,6 @@ logfileSuffix = ".log"
# Below is a short list of commented out options you might find interesting to
# have a look at. The values shown are their defaults.
-# outputLevel = "1"
+# outputbits = "1"
# userstats = "FALSE"
# wordTracking = "FALSE"
diff --git a/sss.php b/sss.php
index 32d1e1fc..c3e292a0 100644
--- a/sss.php
+++ b/sss.php
@@ -26,7 +26,8 @@ final class sss
private $logfileFormat = '';
private $logfilePrefix = '';
private $logfileSuffix = '';
- private $outputLevel = 1;
+ private $outputbits = 1;
+ private $timezone = '';
private $writeData = TRUE;
/**
@@ -39,7 +40,8 @@ final class sss
'logfileFormat' => 'string',
'logfilePrefix' => 'string',
'logfileSuffix' => 'string',
- 'outputLevel' => 'int',
+ 'outputbits' => 'int',
+ 'timezone' => 'string',
'writeData' => 'bool');
private $settings_required_list = array('channel', 'db_host', 'db_name', 'db_pass', 'db_port', 'db_user', 'logfileDateFormat', 'logfileFormat', 'logfilePrefix', 'logfileSuffix', 'timezone');
@@ -68,7 +70,7 @@ public function __construct()
}
if (array_key_exists('b', $options)) {
- $this->settings['outputbits'] = $options['b'];
+ $this->settings['sectionBits'] = $options['b'];
}
if (array_key_exists('i', $options)) {
@@ -124,25 +126,25 @@ private function output($type, $msg)
switch ($type) {
case 'debug':
- if ($this->outputLevel & 8) {
+ if ($this->outputbits & 8) {
echo $dateTime.' [debug] '.$msg."\n";
}
break;
case 'notice':
- if ($this->outputLevel & 4) {
+ if ($this->outputbits & 4) {
echo $dateTime.' [notice] '.$msg."\n";
}
break;
case 'warning':
- if ($this->outputLevel & 2) {
+ if ($this->outputbits & 2) {
echo $dateTime.' [warning] '.$msg."\n";
}
break;
case 'critical':
- if ($this->outputLevel & 1) {
+ if ($this->outputbits & 1) {
echo $dateTime.' [critical] '.$msg."\n";
}
@@ -155,7 +157,7 @@ private function output($type, $msg)
*/
private function parseLog($filedir)
{
- $filedir = preg_replace('/YESTERDAY/', date($this->settings['logfileDateFormat'], strtotime('yesterday')), $filedir);
+ $filedir = preg_replace('/YESTERDAY/', date($this->logfileDateFormat, strtotime('yesterday')), $filedir);
if (($rp = realpath($filedir)) !== FALSE) {
if (is_dir($rp)) {
@@ -180,8 +182,8 @@ private function parseLog($filedir)
$needMaintenance = FALSE;
foreach ($logfiles as $logfile) {
- if ((empty($this->settings['logfilePrefix']) || stripos(basename($logfile), $this->settings['logfilePrefix']) !== FALSE) && (empty($this->settings['logfileSuffix']) || stripos(basename($logfile), $this->settings['logfileSuffix']) !== FALSE)) {
- $date = str_replace(array($this->settings['logfilePrefix'], $this->settings['logfileSuffix']), '', basename($logfile));
+ if ((empty($this->logfilePrefix) || stripos(basename($logfile), $this->logfilePrefix) !== FALSE) && (empty($this->logfileSuffix) || stripos(basename($logfile), $this->logfileSuffix) !== FALSE)) {
+ $date = str_replace(array($this->logfilePrefix, $this->logfileSuffix), '', basename($logfile));
$date = date('Y-m-d', strtotime($date));
if ($date == date('Y-m-d')) {
@@ -195,7 +197,7 @@ private function parseLog($filedir)
}
}
- $parser_class = 'Parser_'.$this->settings['logfileFormat'];
+ $parser_class = 'Parser_'.$this->logfileFormat;
$parser = new $parser_class($this->settings);
$parser->setValue('date', $date);
$parser->parseLog($logfile);
@@ -220,10 +222,10 @@ private function parseLog($filedir)
*/
private function printManual()
{
- $man = 'usage: php sss.php [-c ] [-i ] [-o [-b ]]'."\n"
+ $man = 'usage: php sss.php [-c ] [-i ] [-o [-b ]]'."\n"
. ' php sss.php [-c ] [-m]'."\n\n"
. 'the options are:'."\n"
- . ' -b set , add up the bits corresponding to the sections'."\n"
+ . ' -b set , add up the bits corresponding to the sections'."\n"
. ' you want to be included on the statspage:'."\n"
. ' 1 activity'."\n"
. ' 2 general chat'."\n"
@@ -286,10 +288,10 @@ private function readConfig($file)
}
}
- if (date_default_timezone_set($this->settings['timezone']) !== FALSE) {
- $this->output('notice', 'readConfig(): switched to timezone: \''.$this->settings['timezone'].'\'');
+ if (date_default_timezone_set($this->timezone) !== FALSE) {
+ $this->output('notice', 'readConfig(): switched to timezone: \''.$this->timezone.'\'');
} else {
- $this->output('critical', 'readConfig(): invalid timezone: \''.$this->settings['timezone'].'\'');
+ $this->output('critical', 'readConfig(): invalid timezone: \''.$this->timezone.'\'');
}
} else {
$this->output('critical', 'readConfig(): failed to open file: \''.$rp.'\'');