<?php
$in_user = $options["in"];if(!isset($in_user))$in_user="[in]";
$out_user = $options["out"];if(!isset($out_user))$out_user="[out]";
$text = htmlspecialchars($text);
$text = preg_replace("/\b(https?|ftp|file|nntp|telnet):\/\/\S+/","<a href='\\0'>\\0</a>", $text);
preg_match_all( "/(^IN\n([^\x0C]*)\x0C|^OUT\n([^\x0C]*)\x0C)/ms", $text, $a );
$text="";
foreach ( $a[0] as $msg )
{
preg_match ("/^(IN|OUT)\nMSG\n([0-9]*\n)/", $msg, $date );
$date = date ("j.n.Y H:i:s", (int)$date[2]);
$inout = preg_replace ("/^(IN)\nMSG\n([0-9]*\n)([0-9]*\n)(.*)\x0C/ms",
"<tr style='background: #eeffee;'>".
"<td class='micq1'>".$in_user."</td>".
"<td class='micq2' nowrap>".$date."</td>".
"<td class='micq3'>\\4</td>".
"</tr>", $msg);
$inout = preg_replace ("/^(OUT)\nMSG\n([0-9]*\n)([0-9]*\n)(.*)\x0C/ms",
"<tr style='background: #eeeeff;'>".
"<td class='micq1'>".$out_user."</td>".
"<td class='micq2' nowrap>".$date."</td>".
"<td class='micq3'>\\4</td>".
"</tr>", $inout);
$text = $text . $inout;
}
$text = str_replace( "\n", "<br />", $text );
print "<div><table>".$text."</table></div>";
?>