Файл: modules/friends/index.php
Строк: 72
<?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()) {
header('location: /');
exit;
}
$friends_r = $db->query("SELECT * FROM `friends` WHERE (`friend_id` = '". $user['id'] ."' OR `user_id` = '". $user['id'] ."') AND `active` = '1'")->rowCount();
$title = _t('friends');
include_header($title);
$tpl->div('title', _t('friends').' ('.$friends_r.')');
$pages = new Paginator($friends_r, $ames);
if($friends_r == 0)
{
$tpl->div('menu', _t('friends_no'));
}
else
{
$friends_q = $db->query("SELECT * FROM `friends` WHERE (`friend_id` = '". $user['id'] ."' OR `user_id` = '". $user['id'] ."') AND `active` = '1' ORDER BY friend_id DESC LIMIT $start, $ames");
while($friends = $friends_q->fetch())
{
if($friends['user_id'] == $user['id'])
{
$friend_id = $friends['friend_id'];
}
else
{
$friend_id = $friends['user_id'];
}
echo '<div class="menu">
'.nick($friend_id, '[<a href="/friends/delete/'.$friends['id'].'">'._t('delete').'</a>]').'
</div>';
}
$pages->view();
}
$tpl->div('block', NAV .' <a href="/user/friends_online/'.User::Id().'">'._t('friends_online').'</a><br/> '.
NAV.' <a href="/friends/requests">'._t('friends_requests').'</a> ('.$db->query("SELECT * FROM `friends` WHERE `friend_id` = '". $user['id'] ."' AND `active` = '0'")->rowCount().')<br/> '
. NAV . ' <a href="/user/panel/">'._t('user_panel').'</a><br/> '
. HICO. ' <a href="/">'. _t('home') .'</a>');
include_footer();
?>