Размер файла: 1.7Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.ru *
**********************************/
if(isset($user)) {
$locate = 'in_cabinet';
$title = $lang->word('u_mail');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('u_mail'));
$mailn = $db->query("SELECT * FROM `mail_chat` WHERE `user_id` = '$user[id]' OR `who_id` = '$user[id]'")->rowCount();
$pages = new Paginator($mailn, $ames);
if($mailn == 0) {
$tpl->div('post', $lang->word('no_posts'));
} else {
$mailq = $db->query("SELECT * FROM `mail_chat` WHERE `user_id` = '$user[id]' OR `who_id` = '$user[id]' ORDER BY time_last_message DESC LIMIT $start, $ames");
while($mail = $mailq->fetch()) {
$new_mail = $db->query("SELECT * FROM `mail` WHERE `who_id` = '$user[id]' AND `read` = '0' AND `mail_chat_id` = '$mail[id]'")->rowCount();
if ($mail['user_id'] == $user['id']) {
echo '<div class="menu">
» <a href="/mail/chat/'. $mail['who_id'] .'">'. tnick($mail['who_id']) .'</a> ('. rtime($mail['time_last_message']) .')'. ($new_mail > 0?' <span class="green">+ '. $new_mail .'</span>':NULL) .'
</div>';
} else {
echo '<div class="menu">
<a href="/mail/chat/'. $mail['user_id'] .'">'. tnick($mail['user_id']) .'</a> ('. rtime($mail['time_last_message']) .')'. ($new_mail > 0?' <span class="green">+ '. $new_mail .'</span>':NULL) .'
</div>';
}
}
$pages->view('/mail/?');
}
$tpl->div('block', NAV .' <a href="/user/panel/">'. $lang->word('user_panel') .'</a><br/>' . HICO .'<a href="/">'.$lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
} else { go('/'); }
?>