Файл: pages/konts.php
Строк: 27
<?php
add_body_class('mail-contacts');
only_reg();
$set['title'] = __('Сообщения');
get_header();
$k_post = db::count("SELECT COUNT(*) FROM `mail_contacts` WHERE user_id = '" . $user['id'] . "'");
$k_page = k_page( $k_post, $set['p_str'] );
$page = page( $k_page );
$start = $set['p_str'] * $page - $set['p_str'];
$q = db::query("SELECT * FROM `mail_contacts` WHERE `user_id` = '" . $user['id'] . "' LIMIT $start, $set[p_str]");
if ($k_post == 0) {
echo '<div class="empty">' . __('Список контактов пуст') . '</div>';
}
$content = '';
while($post = $q->fetch_assoc()) {
$ank = get_user($post['contact_id']);
$last = db::fetch("SELECT * FROM mail WHERE (contact_id = '" . $ank['id'] . "' AND user_id = '" . $user['id'] . "') OR (contact_id = '" . $user['id'] . "' AND user_id = '" . $ank['id'] . "') ORDER BY id DESC LIMIT 1");
$msg = (isset($last['msg']) ? '<div class="ds-contact-text ' . ($last['read'] == 1 ? 'read' : 'no-read') . '">' . $last['msg'] . '</div>' : '');
$header = array(
'image' => '<a href="' . get_mail_url($post['contact_id']) . '">' . get_avatar($post['contact_id']) . '</a>',
'content' => array(
'post_title' => '<a href="' . get_mail_url($post['contact_id']) . '">' . get_user_nick($post['contact_id']) . '</a>',
'post_content' => $msg,
),
'action' => array(
),
);
echo get_template_post(array(
'href' => get_mail_url($post['contact_id']),
'header' => $header,
));
}
if ( $k_page > 1 )
str( "?", $k_page, $page );
get_footer();