<?PHP
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
<link rel="stylesheet" type="text/css" href="http://209.90.113.101/omnimaganoie.css" />
<?PHP
$noShowNames = array("omnomirc","omnimaga","spybot45","spybot46");
function parseColors($colorStr)
{
$colorStr = htmlspecialchars($colorStr);
$colorStr = clickable_links($colorStr);
//$colorStr = preg_replace("/^ <(.+?)>/",' <<a target="_parent" href="http://www.omnimaga.org/index.php?action=ezportal;sa=page;p=13&userSearch=\1">\1</a>>',$colorStr);
preg_match("/^ <(.+?)>/",$colorStr,$arrayName);
if (count($arrayName) > 0)
{
$colorStr = preg_replace("/^ <(.+?)>/",getOmnomNameColor($arrayName[1]),$colorStr);
}
$lcount = 0;
while(strpos($colorStr,"\x03") > 0)
{
preg_match("/(^.*)\x03([0-9]{1,2}),([0-9]{1,2})(.*)/",$colorStr,$arrayResults);
preg_match("/(^.*)\x03([0-9]{1,2})(.*)/",$colorStr,$arrayResults2);
if(count($arrayResults) > 4) //FG & BG
{
$colorStr = $arrayResults[1].'<span class="fg-'.$arrayResults[2]*1 .'"><span class="bg-'.$arrayResults[3]*1 .'">'.$arrayResults[4];
}
elseif(count($arrayResults2) > 3) //FG Only
{
$colorStr = $arrayResults2[1].'<span class="fg-' . $arrayResults2[2]*1 . '">'.$arrayResults2[3];
}
else //We have a color control character w/o a color, most clients interperet this as clear colors.
{
for($lcount;$lcount;$lcount--)
$colorStr=$colorStr."</span>";
$colorStr = preg_replace("/\x03/","",$colorStr,1);
$lcount--;
}
$lcount++;
}
for(;$lcount>=0;$lcount--)
$colorStr=$colorStr."</span>";
/*Strip codes*/
$colorStr = preg_replace("(\x03|\x02|\x1F|\x09|\x0F)","",$colorStr);
$colorStr = str_replace("\x07","<",$colorStr); // Removes beeps and is functional!
return($colorStr);
}
function clickable_links($text) {
$text = str_replace("http://www.omnimaga.org/","h111://www.omnimaga.org/",$text);
$text = str_replace("http://omniurl.tk/","h111://omniurl.tk/",$text);
$text = eregi_replace('((h111://(www.omnimaga.org/|omniurl.tk))[-a-zA-Z0-9@:;%_+.~#?&//=]+)', '<a target="_parent" href="\1">\1</a>', $text);
$text = eregi_replace('(((f|ht){1}(tp|tps)://)[-a-zA-Z0-9@:;%_+.~#?&//=]+)', '<a target="_blank" href="\1">\1</a>', $text);
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:;%_+.~#?&//=]+)', '\1<a target="_blank" href="http://\2">\2</a>', $text);
$text = str_replace("h111","http",$text);
return $text;
}
function getNameColor($name)
{
$rcolors = array(19, 20, 22, 24, 25, 26, 27, 28, 29);
$sum = $i = 0;
while (isset($name[$i]))
$sum += ord($name[$i++]);
$sum %= 9;
return '<span class="uName-'.$rcolors[$sum].'">'.$name.'</span>';
}
function getOmnomNameColor($name)
{
$rcolors = array(19, 20, 22, 24, 25, 26, 27, 28, 29);
$sum = $i = 0;
while (isset($name[$i]))
$sum += ord($name[$i++]);
$sum %= 9;
return ' <<a target="_parent" href="http://www.omnimaga.org/index.php?action=ezportal;sa=page;p=13&userSearch='.$name.'"><span class="uName-'.$rcolors[$sum].'">'.$name.'</span></a>>';
}
$myFile = "#" . $_GET["log"] . "." . date("Ymd") . ".log";
$arrayFile = file($myFile);
$count = count($arrayFile);
if (isset($_GET["trim"]))
$startAt = $count - $_GET["trim"];
$topic = $output = "";
$highlight = "\xFF";
if (isset($_GET["high"]))
$highlight = base64_decode($_GET["high"]);
for($i = 0;$i<$count;$i++)
{
$curLine = $arrayFile[$i];
//Try to get the topic
preg_match("/(Topic is|changes topic to) '(.*.)'/",$curLine,$topicGet);
if(count($topicGet))
$topic = $topicGet[2];
if ($i < $startAt) continue;
preg_match("/(^.*)(\[[0-9]{2}:[0-9]{2}:[0-9]{2}\]).\<(.+?)>(.*)/",$curLine,$curLineParts); //Try to match color, timestamp, message, and name
if(count($curLineParts) > 3)
{
$curLineParts[3] = str_replace("@","",$curLineParts[3]);
$curLineParts[3] = str_replace("+","",$curLineParts[3]);
$output = $output . '<span class="irc-date">'.$curLineParts[2].'</span>';
if (strpos(strtolower($curLineParts[4]),strtolower($highlight),in_array(strtolower($curLineParts[3]),$noShowNames)?strpos($curLineParts[4]," ",5):0))
$output = $output . '<span style="font-weight:bold;color:#F44">';
if (!in_array(strtolower($curLineParts[3]),$noShowNames))
{
$output = $output . " <" . getNameColor($curLineParts[3]) . ">";
$curLineParts[4] = str_replace("<","\x07",$curLineParts[4]);
}
$output = $output . parseColors(" ".$curLineParts[1].$curLineParts[4]);
if (strpos($curLineParts[4],$highlight))
$output = $output . '</span>';
}
else
{
preg_match("/(^.*)(\[[0-9]{2}:[0-9]{2}:[0-9]{2}\])(.*)/",$curLine,$curLineParts); //Try to match color, timestamp and message, no name
if(count($curLineParts)>3)
{
$output = $output . '<span class="irc-date">'.$curLineParts[2].'</span>';
$output = $output . parseColors(" ".$curLineParts[1] . $curLineParts[3]);
}
else //Give up and print line
{
$output = $output . parseColors($curLine);
}
}
$output = $output . '<br/>';
}
?>
<span class="irc-topic">Current Topic:<?PHP echo parseColors($topic); ?></span><br/><br/>
<?PHP echo $output; ?>