Skip to content

Commit

Permalink
fixed the exultlogs archive for PHP8.
Browse files Browse the repository at this point in the history
Added logs from my IRC client for dates the bot was down.

Added a "condensed" version of the logs that
- only lists the pages with actual content
- removed Chanserv, server, channel messages
- removed join and quit messages
- kept the nickname changes for context
- extensively colored the nicknames of Exult team members
  • Loading branch information
DominusExult committed Apr 27, 2024
1 parent 5d54f0c commit 8a6a43b
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 167 deletions.
5 changes: 3 additions & 2 deletions content/irc.dat
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<p>You can meet some of us on IRC. Go to irc.libera.chat (port 6667) and join channel #exult.
You can also read <a href="exultlog.php?log=toc">the logs</a> of
discussions thanks to the wonderful &quot;exultbot&quot;. Unfortunately, the bot broke in 2021.</p>
You can also read the logs of our discussions in <a href="exultlog.php?log=toc">condensed</a>
or <a href="exultlogfull.php?log=toc">full</a> form. Unfortunately, our wonderfull
&quot;exultbot&quot; broke in 2021 and the logs are no longer actively maintained.</p>
339 changes: 177 additions & 162 deletions exultbot_include.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,197 +2,212 @@

function html_header()
{
header("Content-Type: text/html; charset=iso-8859-1");
print "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">";
print "<html>";
header('Content-Type: text/html; charset=iso-8859-1');
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
echo '<html>';
}

function log_header()
{
global $channel;
global $channel;

html_header();
print "<head><title>$channel logs</title></head><body>";
html_header();
echo "<head><title>$channel logs</title></head><body>";
}

$log = $_GET['log'];

$exultlogdate = "([123]?\d)(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(\d\d\d\d)";

function nicedate($d) {
global $exultlogdate;
if (preg_match("/^$exultlogdate$/", $d, $elms)) {
$nd = $elms[1] . " " . $elms[2] . " " . $elms[3];
} else {
$nd = "";
}
return $nd;
function nicedate($d)
{
global $exultlogdate;
if (preg_match("/^$exultlogdate$/", $d, $elms)) {
$nd = $elms[1].' '.$elms[2].' '.$elms[3];
} else {
$nd = '';
}

return $nd;
}

$mnr["Jan"] = 1; $mnr["Feb"] = 2; $mnr["Mar"] = 3;
$mnr["Apr"] = 4; $mnr["May"] = 5; $mnr["Jun"] = 6;
$mnr["Jul"] = 7; $mnr["Aug"] = 8; $mnr["Sep"] = 9;
$mnr["Oct"] = 10; $mnr["Nov"] = 11; $mnr["Dec"] = 12;
$mnr['Jan'] = 1;
$mnr['Feb'] = 2;
$mnr['Mar'] = 3;
$mnr['Apr'] = 4;
$mnr['May'] = 5;
$mnr['Jun'] = 6;
$mnr['Jul'] = 7;
$mnr['Aug'] = 8;
$mnr['Sep'] = 9;
$mnr['Oct'] = 10;
$mnr['Nov'] = 11;
$mnr['Dec'] = 12;

$month = [1 => 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

function prevday($d)
{
global $mnr, $month, $exultlogdate;
global $startyear;
$monthdays = [1 => 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

$month = array(1 => "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
preg_match("/^$exultlogdate$/", $d, $elms);
$day = (int) $elms[1];
$monthnr = $mnr[(string) $elms[2]];
$year = (int) $elms[3];

if (0 == $year % 4 && (0 != $year % 100 || 0 == $year % 400)) {
++$monthdays[2];
}

function prevday($d) {
global $mnr, $month, $exultlogdate;
global $startyear;
$monthdays = array(1 => 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
--$day;
if ($day <= 0) {
--$monthnr;
if ($monthnr <= 0) {
--$year;
$monthnr = 12;
}

preg_match("/^$exultlogdate$/", $d, $elms);
$day = (int) $elms[1];
$monthnr = $mnr[(string)$elms[2]];
$year = (int) $elms[3];
$day = $monthdays[$monthnr];
}

if ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0))
$monthdays[2]++;
if ($year < $startyear) {
return '';
}

$day--;
if ($day <= 0) {
$monthnr--;
if ($monthnr <= 0) {
$year--;
$monthnr = 12;
}
return $day.$month[$monthnr].$year;
}

$day = $monthdays[$monthnr];
}
function nextday($d)
{
global $mnr, $month, $exultlogdate;
$monthdays = [1 => 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

if ($year < $startyear) {
return "";
}
preg_match("/^$exultlogdate$/", $d, $elms);
$day = (int) $elms[1];
$monthnr = $mnr[(string) $elms[2]];
$year = (int) $elms[3];

return $day . $month[$monthnr] . $year;
}
if (0 == $year % 4 && (0 != $year % 100 || 0 == $year % 400)) {
++$monthdays[2];
}

++$day;
if ($day > $monthdays[$monthnr]) {
$day = 1;
++$monthnr;
if ($monthnr > 12) {
++$year;
$monthnr = 1;
}
}

function nextday($d) {
global $mnr, $month, $exultlogdate;
$monthdays = array(1 => 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

preg_match("/^$exultlogdate$/", $d, $elms);
$day = (int) $elms[1];
$monthnr = $mnr[(string)$elms[2]];
$year = (int) $elms[3];

if ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0))
$monthdays[2]++;

$day++;
if ($day > $monthdays[$monthnr]) {
$day = 1;
$monthnr++;
if ($monthnr > 12) {
$year++;
$monthnr = 1;
}
}

if ($year > gmdate("Y")) {
return "";
}
return $day . $month[$monthnr] . $year;
if ($year > gmdate('Y')) {
return '';
}

return $day.$month[$monthnr].$year;
}

function datenr($d) {
global $exultlogdate;
global $mnr;

preg_match("/^$exultlogdate$/", $d, $elms);
$day = (int) $elms[1];
$month = $mnr[(string)$elms[2]];
$year = (int) $elms[3];

return ($year * 500) + ($month * 40) + $day + 1000;
function datenr($d)
{
global $exultlogdate;
global $mnr;

preg_match("/^$exultlogdate$/", $d, $elms);
$day = (int) $elms[1];
$month = $mnr[(string) $elms[2]];
$year = (int) $elms[3];

return ($year * 500) + ($month * 40) + $day + 1000;
}

function log_display()
{
global $exultlogdate, $month;
global $log;
global $startyear, $channel, $script, $name, $homepage, $logdir;

$logdate = "";

if ($log && preg_match("/^$exultlogdate$/", $log)) {
$logdate = $log;
} else if ($log == "toc") {
print "<h2>$channel@irc.freenode.net logs: archive</h2>";
print "<p><a href=\"$script\">Today</a><br/></p>";
$handle = opendir($logdir);
if (is_dir($logdir) && $handle) {
$logdates = array();
while ($entry = readdir($handle)) {
if (preg_match("/^${channel}_($exultlogdate)\.log$/", $entry, $elms)) {
$logdates[$elms[1]] = datenr($elms[1]);
global $exultlogdate, $month;
global $log;
global $startyear, $channel, $script, $name, $homepage, $logdir, $verbose;

$logdate = '';

if ($log && preg_match("/^$exultlogdate$/", $log)) {
$logdate = $log;
} elseif ('toc' == $log) {
echo "<h2>$channel logs: $verbose archive</h2>";
echo "<p><a href=\"$script\">Today</a><br/></p>";
echo "<a href=\"$homepage\">$name homepage</a><br/>";
$handle = opendir($logdir);
if (is_dir($logdir) && $handle) {
$logdates = [];
while ($entry = readdir($handle)) {
if (preg_match("/^{$channel}_($exultlogdate)\.log$/", $entry, $elms)) {
$logdates[$elms[1]] = datenr($elms[1]);
}
}
closedir($handle);

$curmonth = 'xyz';
$loc = 5;

echo '<table border="0"><tr><td>';
arsort($logdates);
reset($logdates);
foreach ($logdates as $entry => $d) {
preg_match("/^$exultlogdate$/", $entry, $elms);
$thismonth = $elms[2].$elms[3];
if ($thismonth != $curmonth) {
$loc = $loc + 1;
if (6 == $loc) {
$loc = 0;
}
if (!$loc) {
echo '<br></td></tr><tr><td valign="top" width="150">';
} else {
echo '<br></td><td valign="top" width="150">';
}
echo '<h3>'.$elms[2].' '.$elms[3].'</h3>';
$curmonth = $thismonth;
}
$ndate = nicedate($entry);
echo "<a href=\"$script?log=$entry\">$ndate</a><br/>";
} while (next($logdates)) {
}
echo '<br/></td></tr></table>';
}

return;
} else {
$logdate = gmdate('j').$month[(int) gmdate('m')].'20'.gmdate('y');
}
}
closedir($handle);

$curmonth = "xyz";
$loc = 5;

print "<table border=\"0\"><tr><td>";
arsort($logdates);
reset($logdates);
while (list ($entry, $d) = each($logdates)) {
preg_match("/^$exultlogdate$/", $entry, $elms);
$thismonth = $elms[2] . $elms[3];
if ($thismonth != $curmonth) {
$loc = $loc + 1;
if ($loc == 6) $loc = 0;
if (!$loc) {
print "<br></td></tr><tr><td valign=\"top\" width=\"150\">";
} else {
print "<br></td><td valign=\"top\" width=\"150\">";
}
print "<h3>". $elms[2]. " ". $elms[3]. "</h3>";
$curmonth = $thismonth;
}
$ndate = nicedate($entry);
print "<a href=\"$script?log=$entry\">$ndate</a><br/>";
} while (next($logdates));
print "<br/></td></tr></table>";
}
return;
} else {
$logdate = gmdate("j") . $month[(int)gmdate("m")] . "20" . gmdate("y");
}


if ($ndate = nicedate($logdate)) {

$yesterday = prevday($logdate);
$tomorrow = nextday($logdate);

print "<h2>$channel@irc.freenode.net logs for $ndate (GMT)</h2>";

$fn = "$logdir/${channel}_$logdate.log";

print "<a href=\"$script?log=toc\">Archive</a> ";
print "<a href=\"$script\">Today</a> ";
if ($yesterday) {
print "<a href=\"$script?log=$yesterday\">Yesterday</a> ";
}
if ($tomorrow) {
print "<a href=\"$script?log=$tomorrow\">Tomorrow</a>";
}
print "<br/>";
print "<a href=\"$homepage\">$name homepage</a><br/>";

print "<hr><br>";

if (file_exists($fn)) {
include "$logdir/${channel}_$logdate.log";
} else {
print "Sorry, logs for $ndate are not available.<br/>";
}
}

print "</body></html>";

}
if ($ndate = nicedate($logdate)) {
$yesterday = prevday($logdate);
$tomorrow = nextday($logdate);

echo "<h2>$channel $verbose logs for $ndate (GMT)</h2>";

?>
$fn = "$logdir/{$channel}_$logdate.log";

echo "<a href=\"$script?log=toc\">Archive</a> ";
echo "<a href=\"$script\">Today</a> ";
if ($yesterday) {
echo "<a href=\"$script?log=$yesterday\">Yesterday</a> ";
}
if ($tomorrow) {
echo "<a href=\"$script?log=$tomorrow\">Tomorrow</a>";
}
echo '<br/>';
echo "<a href=\"$homepage\">$name homepage</a><br/>";

echo '<hr><br>';

if (file_exists($fn)) {
include "$logdir/{$channel}_$logdate.log";
} else {
echo "Sorry, logs for $ndate are not available.<br/>";
}
}

echo '</body></html>';
}
7 changes: 4 additions & 3 deletions exultlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
$channel = "#exult";
$script = "exultlog.php";
$name = "Exult";
$homepage = "http://exult.sourceforge.net/";
$logdir = "exultlogs";
$homepage = "https://exult.info/";
$logdir = "exultlogs/condensed";
$startyear = 2000;

$verbose = "condensed";

include("exultbot_include.php");

log_header();
Expand Down
Loading

0 comments on commit 8a6a43b

Please sign in to comment.