Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

final minor tweaks to the html classes; configs and documentation not…

… yet updated
  • Loading branch information...
commit 079a0e598b93ce9b13dd319f26c1f13347bb2bbb 1 parent 5f95dad
tommyrot authored
Showing with 50 additions and 43 deletions.
  1. +23 −23 html.class.php
  2. +8 −8 sss.conf
  3. +19 −12 www/history.php
View
46 html.class.php
@@ -34,14 +34,14 @@
private $channel = '';
private $cid = '';
private $history = false;
+ private $maxrows_people_alltime = 30;
+ private $maxrows_people2 = 40;
+ private $maxrows_people_month = 10;
+ private $maxrows_people_timeofday = 10;
+ private $maxrows_people_year = 10;
+ private $maxrows_recenturls = 25;
private $minlines = 500;
private $minrows = 3;
- private $rows_people_alltime = 30;
- private $rows_people2 = 40;
- private $rows_people_month = 10;
- private $rows_people_timeofday = 10;
- private $rows_people_year = 10;
- private $rows_recenturls = 25;
private $sectionbits = 127;
private $stylesheet = 'sss.css';
private $userstats = false;
@@ -72,15 +72,15 @@
'channel' => 'string',
'cid' => 'string',
'history' => 'bool',
+ 'maxrows_people2' => 'int',
+ 'maxrows_people_alltime' => 'int',
+ 'maxrows_people_month' => 'int',
+ 'maxrows_people_timeofday' => 'int',
+ 'maxrows_people_year' => 'int',
+ 'maxrows_recenturls' => 'int',
'minlines' => 'int',
'minrows' => 'int',
'outputbits' => 'int',
- 'rows_people2' => 'int',
- 'rows_people_alltime' => 'int',
- 'rows_people_month' => 'int',
- 'rows_people_timeofday' => 'int',
- 'rows_people_year' => 'int',
- 'rows_recenturls' => 'int',
'sectionbits' => 'int',
'stylesheet' => 'string',
'userstats' => 'bool');
@@ -228,11 +228,11 @@ public function make_html($mysqli)
$this->output .= $this->make_table_activity('month');
$this->output .= $this->make_table_activity_distribution_day();
$this->output .= $this->make_table_activity('year');
- $this->output .= $this->make_table_people('alltime', $this->rows_people_alltime);
- $this->output .= $this->make_table_people2($this->rows_people_alltime, $this->rows_people2);
- $this->output .= $this->make_table_people('year', $this->rows_people_year);
- $this->output .= $this->make_table_people('month', $this->rows_people_month);
- $this->output .= $this->make_table_people_timeofday($this->rows_people_timeofday);
+ $this->output .= $this->make_table_people('alltime', $this->maxrows_people_alltime);
+ $this->output .= $this->make_table_people2($this->maxrows_people_alltime, $this->maxrows_people2);
+ $this->output .= $this->make_table_people('year', $this->maxrows_people_year);
+ $this->output .= $this->make_table_people('month', $this->maxrows_people_month);
+ $this->output .= $this->make_table_people_timeofday($this->maxrows_people_timeofday);
}
/**
@@ -613,9 +613,9 @@ public function make_html($mysqli)
$t->set_value('key1', 'Date');
$t->set_value('key2', 'User');
$t->set_value('key3', 'URL');
- $t->set_value('minrows', $this->rows_recenturls);
- $t->set_value('query_main', 'select `lastused` as `v1`, `csnick` as `v2`, `url` as `v3` from `user_urls` join `user_status` on `user_urls`.`uid` = `user_status`.`uid` join `user_details` on `user_details`.`uid` = `user_status`.`ruid` order by `v1` desc limit '.$this->rows_recenturls);
- $t->set_value('rows', $this->rows_recenturls);
+ $t->set_value('maxrows', $this->maxrows_recenturls);
+ $t->set_value('minrows', $this->maxrows_recenturls);
+ $t->set_value('query_main', 'select `lastused` as `v1`, `csnick` as `v2`, `url` as `v3` from `user_urls` join `user_status` on `user_urls`.`uid` = `user_status`.`uid` join `user_details` on `user_details`.`uid` = `user_status`.`ruid` order by `v1` desc limit '.$this->maxrows_recenturls);
$t->set_value('type', 'urls');
$output .= $t->make_table($this->mysqli);
@@ -1134,11 +1134,11 @@ private function make_table_people_timeofday($maxrows)
protected $key1 = '';
protected $key2 = '';
protected $key3 = '';
+ protected $maxrows = 5;
protected $minrows = 3;
protected $percentage = false;
protected $query_main = '';
protected $query_total = '';
- protected $rows = 5;
protected $type = 'small';
protected $total = 0;
@@ -1166,7 +1166,7 @@ public function make_table($mysqli)
while ($result = mysqli_fetch_object($query)) {
$i++;
- if ($i > $this->rows) {
+ if ($i > $this->maxrows) {
break;
}
@@ -1186,7 +1186,7 @@ public function make_table($mysqli)
}
}
- for ($i = count($content) + 1; $i <= $this->rows; $i++) {
+ for ($i = count($content) + 1; $i <= $this->maxrows; $i++) {
if ($this->type == 'small') {
$content[] = array('&nbsp;', '', '');
} elseif ($this->type == 'large' || $this->type == 'topics' || $this->type == 'urls' || $this->type == 'medium' || $this->type == 'domains') {
View
16 sss.conf
@@ -9,7 +9,7 @@
channel = ""
# The timezone the logs are in, see http://php.net/manual/en/timezones.php
-# for valid combinations.
+# for valid values. Used for time offset calculations and conversions.
timezone = "UTC"
# IP address or FQDN of the MySQL server.
@@ -27,14 +27,14 @@ db_pass = ""
# Name of the MySQL database used for superseriousstats.
db_name = "sss"
-# This string contains the format of date within a logfile filename. For more
-# information see http://php.net/date_create_from_format
+# This string contains the format of the date within a logfile filename.
# Examples:
# filename: #chatroom.20030131 dateformat: *.Ymd
# filename: #chatroom.20030131 dateformat: \#c\h\atroo\m.Ymd
# filename: chatroom.log-31012003 dateformat: *.*-dmY
# filename: chatroom.log-31012003.gz dateformat: *.*-dmY.\g\z
# filename: chatroom.log-31012003.gz dateformat: *.*-dmY.*
+# See http://php.net/date_create_from_format for more specific syntax options.
logfile_dateformat = ""
# The parser to use depending on logfile format. Parsers included with sss are:
@@ -116,20 +116,20 @@ outputbits = "7"
sectionbits = "127"
# Amount of rows for the "Most Talkative People - Alltime" table.
-rows_people_alltime = "30"
+maxrows_people_alltime = "30"
# Amount of users to show in the "Less Talkative People - Alltime" table.
# Number should be a multiple of 4; the amount of columns the table has.
-rows_people_alltime2 = "40"
+maxrows_people_alltime2 = "40"
# Amount of rows for the "Most Talkative People - Month" table.
-rows_people_month = "10"
+maxrows_people_month = "10"
# Amount of rows for the "Most Talkative People by Time of Day" table.
-rows_people_timeofday = "10"
+maxrows_people_timeofday = "10"
# Amount of rows for the "Most Talkative People - Year" table.
-rows_people_year = "10"
+maxrows_people_year = "10"
# Amount of rows for the "Recent URLs" table.
rows_recenturls = "25"
View
31 www/history.php
@@ -36,9 +36,9 @@
private $db_user = '';
private $debug = false;
private $mainpage = './';
- private $rows_people_month = 30;
- private $rows_people_timeofday = 10;
- private $rows_people_year = 30;
+ private $maxrows_people_month = 30;
+ private $maxrows_people_timeofday = 10;
+ private $maxrows_people_year = 30;
private $stylesheet = 'sss.css';
private $timezone = 'UTC';
private $userstats = false;
@@ -179,20 +179,27 @@ public function make_html()
$output .= $this->make_index();
/**
- * Only make tables for times in which there was activity.
+ * Only call make_table_* functions for times in which there was activity. This activity includes bots since we got it from the results used in make_index().
*/
if (!is_null($this->year) && array_key_exists($this->year, $this->activity) && (is_null($this->month) || array_key_exists($this->month, $this->activity[$this->year]))) {
+ /**
+ * Set $l_total to the total number of lines in the specific scope. Following activity_* functions require this value.
+ */
if (is_null($this->month)) {
$this->l_total = $this->activity[$this->year][0];
- $output .= $this->make_table_activity_distribution_hour('year');
- $output .= $this->make_table_people('year', $this->rows_people_year);
} else {
$this->l_total = $this->activity[$this->year][$this->month];
- $output .= $this->make_table_activity_distribution_hour('month');
- $output .= $this->make_table_people('month', $this->rows_people_month);
}
- $output .= $this->make_table_people_timeofday($this->rows_people_timeofday);
+ $output .= $this->make_table_activity_distribution_hour();
+
+ if (is_null($this->month)) {
+ $output .= $this->make_table_people('year', $this->maxrows_people_year);
+ } else {
+ $output .= $this->make_table_people('month', $this->maxrows_people_month);
+ }
+
+ $output .= $this->make_table_people_timeofday($this->maxrows_people_timeofday);
}
/**
@@ -231,11 +238,11 @@ private function make_index() {
return '<table class="index">'.$tr0.$tr1.$tr2.$trx.'</table>'."\n";
}
- private function make_table_activity_distribution_hour($type)
+ private function make_table_activity_distribution_hour()
{
- if ($type == 'year') {
+ if (is_null($this->month)) {
$query = @mysqli_query($this->mysqli, 'select sum(`l_00`) as `l_00`, sum(`l_01`) as `l_01`, sum(`l_02`) as `l_02`, sum(`l_03`) as `l_03`, sum(`l_04`) as `l_04`, sum(`l_05`) as `l_05`, sum(`l_06`) as `l_06`, sum(`l_07`) as `l_07`, sum(`l_08`) as `l_08`, sum(`l_09`) as `l_09`, sum(`l_10`) as `l_10`, sum(`l_11`) as `l_11`, sum(`l_12`) as `l_12`, sum(`l_13`) as `l_13`, sum(`l_14`) as `l_14`, sum(`l_15`) as `l_15`, sum(`l_16`) as `l_16`, sum(`l_17`) as `l_17`, sum(`l_18`) as `l_18`, sum(`l_19`) as `l_19`, sum(`l_20`) as `l_20`, sum(`l_21`) as `l_21`, sum(`l_22`) as `l_22`, sum(`l_23`) as `l_23` from `channel` where year(`date`) = '.$this->year) or $this->output('critical', 'mysqli: '.mysqli_error($this->mysqli));
- } elseif ($type == 'month') {
+ } else {
$query = @mysqli_query($this->mysqli, 'select sum(`l_00`) as `l_00`, sum(`l_01`) as `l_01`, sum(`l_02`) as `l_02`, sum(`l_03`) as `l_03`, sum(`l_04`) as `l_04`, sum(`l_05`) as `l_05`, sum(`l_06`) as `l_06`, sum(`l_07`) as `l_07`, sum(`l_08`) as `l_08`, sum(`l_09`) as `l_09`, sum(`l_10`) as `l_10`, sum(`l_11`) as `l_11`, sum(`l_12`) as `l_12`, sum(`l_13`) as `l_13`, sum(`l_14`) as `l_14`, sum(`l_15`) as `l_15`, sum(`l_16`) as `l_16`, sum(`l_17`) as `l_17`, sum(`l_18`) as `l_18`, sum(`l_19`) as `l_19`, sum(`l_20`) as `l_20`, sum(`l_21`) as `l_21`, sum(`l_22`) as `l_22`, sum(`l_23`) as `l_23` from `channel` where date_format(`date`, \'%Y-%m\') = \''.date('Y-m', mktime(0, 0, 0, $this->month, 1, $this->year)).'\'') or $this->output('critical', 'mysqli: '.mysqli_error($this->mysqli));
}
Please sign in to comment.
Something went wrong with that request. Please try again.