Файл: plugins/notes/user.php
Строк: 105
<?
/*
=======================================
Модификация PluginS
=======================================
*/
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
/* Бан пользователя */
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `razdel` = 'notes' AND `id_user` = '$user[id]' AND (`time` > '$time' OR `view` = '0' OR `navsegda` = '1')"), 0)!=0)
{
header('Location: /ban.php?'.SID);exit;
}
if (isset($user))$ank['id']=$user['id'];
if (isset($_GET['id']))$ank['id']=intval($_GET['id']);
$ank=get_user($ank['id']);
if ($ank['id']==0)
{
$ank=get_user($ank['id']);
echo "<span class="status">Доступ запрещен!</span><br />n";
exit;
}
$set['title']='Дневники ' . $ank['nick'] . '';
include_once '../../sys/inc/thead.php';
title();
aut();
if(isset($user) && $user['id']==$ank['id'])
{
echo'<div class="foot">';
echo "<a href="add.php">Создать дневник</a>";
echo '</div>';
}
$sortir=isset($_GET['sort']) ? $_GET['sort'] : NULL;
echo "<div class='foot'>";
switch($sortir){
case 't':
$order='order by `time` desc';
echo"<b>Новые</b> | <a href='?id=$ank[id]&sort=c'>Популярные</a>n";
break;
case 'c':
$order='order by `count` desc';
echo"<a href='?id=$ank[id]&sort=t'>Новые</a> | <b>Популярные</b>n";
break;
default:
$order='order by `time` desc';
echo"<b>Новые</b> | <a href='?id=$ank[id]&sort=c'>Популярные</a>n";
}
echo "</div>";
$where="AND ( `private`='0'";
$frend=mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE (`user` = '$user[id]' AND `frend` = '$ank[id]') OR (`user` = '$ank[id]' AND `frend` = '$user[id]') LIMIT 1"),0);
$where.=($frend==2)?" OR `private`='1'":null;
$where.=($ank['id']==$user['id'])?" OR `private`='1' OR `private`='2'":null;
$where.=')';
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` WHERE `id_user` = '$ank[id]' "),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `notes` WHERE `id_user` = '$ank[id]' $where $order LIMIT $start, $set[p_str]");
echo "<table class='post'>n";
if ($k_post==0)
{
echo " <div class='mess'>n";
echo "Нет записейn";
echo " </div>n";
}
$num=0;
while ($post = mysql_fetch_assoc($q))
{
/*-----------зебра-----------*/
if ($num==0){
echo '<div class="nav1">';
$num=1;
}
elseif ($num==1){
echo '<div class="nav2">';
$num=0;
}
/*---------------------------*/
echo group($post['id_user'])." ";
echo user::nick($post['id_user'],1,1,1)." : <a href='list.php?id=$post[id]'><font color=#06F>".text($post['name'])."</font></a> <font color=#666>".vremja($post['time'])."</font><br/>";
echo substr(text($post['msg']),0,80)." ...<br/>";
echo "<img src='/style/icons/comm_num_gray.png'><font color=#666>".mysql_result(mysql_query("SELECT COUNT(*)FROM `notes_komm` WHERE `id_notes`='$post[id]'"),0)."</font>";
echo "</div>";
}
echo "</table>n";
if (isset($_GET['sort'])) $dop="sort=$_GET[sort]&";
else $dop='';
if ($k_page>1)str('?id=' . $ank['id'] . '&'.$dop.'',$k_page,$page); // Вывод страниц
include_once '../../sys/inc/tfoot.php';
?>