Файл: modules/mail/index.php
Строк: 54
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
if(User::logged()) {
$locate = 'in_cabinet';
$title = _t('u_mail');
include_header($title);
$tpl->div('title', _t('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', _t('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();
}
$tpl->div('block', NAV .' <a href="/user/panel/">'. _t('user_panel') .'</a><br/>' . HICO .'<a href="/">'._t('home').'</a>');
include_footer();
} else { go('/'); }
?>