Empty log listing at http://irc.apertus.org/ and file not found error for individual pages, e.g.:
http://irc.apertus.org/index.php?day=01&month=05&year=2015
Description
committed source code: https://github.com/apertus-open-source-cinema/irc-log-viewer
help would be appreciated!
More info about the error on 30th April:
- at 23:45 UTC, the logs overview (month listing) wasn't visible
- the issue fixed itself at midnight
cause:
- in index.php lines 213, 218: is_dir($logdir) would return false as the $logdir var is constructed from $year and $month which are set to:
$month = date('m');
$year = date('Y');
(lines 76-96)
The web server clock is CET, so it'd would be looking for a future, non-existant log dir as the IRC logger writes files according to UTC.
EDIT: A similar issue stops the [Today] button working for a couple of hours each night as CET is a couple of hours ahead of UTC during summer.
I'm not that proficient in PHP, maybe:
- the server base time could be changed to UTC or
- set date.timezone in php.ini to UTC or
- set date_default_timezone_set('UTC') at the top of index.php
+ some sort of offset for line 193 'Current Server Time (Central Europe)' ?
line numbers correspond to this version/hash of index.php:
https://github.com/apertus-open-source-cinema/irc-log-viewer/blob/41cbb55bada854d45e4320b4468998396d5abce6/index.php
Created a fork for testing;
https://github.com/intracube-paul/irc-log-viewer
changes:
- add utcDatTime() function where server time can be offset to return UTC (substitute for date() )
- add logLink() which returns <a class="loglink" ...> for each logfile in the overview mode
- add PHP_EOL in places for cleaner HTML
- ($showoverview) section now reads the actual log dir names rather than trying to construct from the current date. regex tests on dirs and files to exclude any non log files
- changed some var names for readability
URLs are now clickable links as long as they start with http:// or https://
any feedback welcome.
Thanks for the fix/patch!
Sorry I had been so busy that I could not test/deploy it yet. I hope to do that soon. (claiming task)
About the clickable URLs:
We on purpose decided against clickable links in the logs to reduce spam/phishing/exploits severity.
Cleaning those malicious URLs from the logs would be extremely time consuming in case a bot or whoever decided to attack us/our channel.
Would it be any help if I do a patch with the minimum changes to fix the original bug?
yes that would be great!
I can push it live and we can just see if the problem is gone, yes I know very sophisticated code review but better than nothing at all happening....