File size: 1.96Kb
<?php
function add_chat($cache, $user, $text) {
}
function echo_chat($cache, $user, $chat_to_user) {
$cache_chat = readcache($cache);
if (!is_array($cache_chat)) $cache_chat = array();
echo '<form method="post" action="/arena?tvt&go=add">
<input class="fdark w98 mb10" type="text" name="text" value="" size="20" maxlength="255">
<input type="submit" class="button blue w30" name="submit" value="Отправить"/>
<a class="small ccc" href="/chat">Обновить</a>
</form>';
if (empty($cache_chat))
{
echo '<div class="p5 cntr"><span class="small ccc">В чате нету сообщений</span></div>';
echo '</div>';
} else {
krsort($cache_chat);
require_once './element_function/element_function_pagination.php';
$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
$pagination = pagination(10, $page, count($cache_chat));
foreach(array_slice($cache_chat, $pagination['start'], $pagination['num'], true) as $k => $massiv) {
$chat_user = cache_user($massiv['user_id']);
$on_off = (!empty($online[$massiv['user_id']])) ? 'online' : 'offline';
echo '
<div class="mt5">
<a class="yellow1 sndr bl" href="/user?id='.$massiv['user_id'].'">
<span class="small fr pt2 lngreen">'.Timer($massiv['time']).'</span>
'.ikonka_user($chat_user['lost_race'], $on_off).' <span class="small">'.$chat_user['lost_login'].'</span>
</a>';
echo '<span class="small">'.Color_Privilege(2, ReplaceText($user['lost_login'], $massiv['text'])).'</span>';
echo '<br/><a class="ccc small" href="/chat?to='.$chat_user['lost_login'].'">[Ответить]</a>';
echo ($user['lost_privilege'] > 0) ? ' <a class="red small" href="/chat?delete='.$k.'">[X]</a> <a class="red small" href="/chat#">[Бан]</a>' : '';
echo '<br/> </div>';
}
echo '</div>';
echo pagination_echo($pagination['page'],$pagination['total'],'/chat?page=');
}
}
?>