Файл: modules/user/friends_online.php
Строк: 73
<?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
*/
$id = num($_GET['id']);
if(!isset($_GET['id']) || User::profile('time', $id) == false)
{
redirect('/pages/not_found');
}
$friends_r = $db->query("SELECT `users`.* FROM `friends` LEFT JOIN `users` ON `friends`.`user_id`=`users`.`id` WHERE (`friends`.`friend_id` = '". $id ."' OR `friends`.`user_id` = '". $id ."') AND `friends`.`active`='1' AND `users`.`time` > " . (time() - 300) . " AND `users`.`id` != '{$user['id']}'")->rowCount();
// $friends_r = $db->query("SELECT * FROM `friends` WHERE (`friend_id` = '". $id ."' OR `user_id` = '". $id ."') AND `active`='1'")->rowCount();
$title = _t('friends_online');
include_header($title);
$tpl->div('title', _t('friends_online').' ('.$friends_r.')');
$pages = new Paginator($friends_r, $ames);
if($friends_r == 0)
{
$tpl->div('menu', _t('friends_no_online'));
}
else
{
$friends_q = $db->query("SELECT * FROM `friends` LEFT JOIN `users` ON `friends`.`user_id`=`users`.`id` WHERE (`friends`.`friend_id`='" . $id . "' OR `friends`.`user_id`='" . $id . "') AND `friends`.`active`='1' AND `users`.`time` > " . (time() - 300) . " AND `users`.`id` != '".$user['id']."' ORDER BY `users`.`time` DESC LIMIT $start, $ames");
while($friends = $friends_q->fetch())
{
echo '<div class="post">
'.($friends['user_id'] == $id ? nick($friends['friend_id']) : nick($friends['user_id'])).'
</div>';
}
$pages->view();
}
$tpl->div('block', NAV.' <a href="/user/profile/'.$id.'">'._t('back').'</a><br/> '
. NAV . ' <a href="/user/list/">'._t('users').'</a><br/> '
. HICO. ' <a href="/">'. _t('home') .'</a>');
include_footer();
?>