<?php
require_once("inc_common.php");
include($engine_path."messages_get_list.php");
include($ld_engine_path."rooms_get_list.php");
if (!in_array($room, $room_ids))
$room = intval($room_ids[0]);
$out_messages = "";
$already_showed = 0;
$mess_to_displ = array();
for ($i=$total_messages-1; $i>=0; $i--) {
if ($already_showed>=$history_size) break;
$mesg_array = explode ("\t", $messages[$i], MESG_TOTALFIELDS);
if ($room == $mesg_array[MESG_ROOM]) {
$message = strip_tags($mesg_array[MESG_BODY], '<img><b><font><span><div><br>');
$message = str_replace("parent.voc_who_reload = 1;","","$message");
$message = wordwrap($message, 75," ", 1);
$to_out = "";
if ($mesg_array[MESG_TO] == "") {
$to_out = str_replace("[HOURS]",date("H",$mesg_array[MESG_TIME]),$message_format);
$to_out = str_replace("[MIN]",date("i",$mesg_array[MESG_TIME]),$to_out);
$to_out = str_replace("[SEC]",date("s",$mesg_array[MESG_TIME]),$to_out);
$to_out = str_replace("[NICK]",'<b>'.strip_tags($mesg_array[MESG_FROMWOTAGS]).'</b>', $to_out);
$to_out = str_replace("[NICK_WO_TAGS]",strip_tags($mesg_array[MESG_FROMWOTAGS]),$to_out);
$to_out = str_replace("[MESSAGE]",$message,$to_out);
}
if ($to_out != "") {
$mess_to_displ[] = '<div style="padding-bottom:2px;">'.strip_tags($to_out, '<img><b><font><span><div><br>').'</div>';
$out_messages = strip_tags($to_out, '<img><b><font><span><div><br>')."<br>\n". $out_messages;
$already_showed++;
}
}
}
$out_messages = join("\n", $mess_to_displ);
echo $out_messages;
?>