Файл: plugins/notes/index.php
Строк: 125
<?
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 (isset($user) && 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;
}
$set['title']='Блоги';
include_once '../../sys/inc/thead.php';
title();
aut(); // форма авторизации
//Панель навигации
echo '<table style="text-align:center;" class="mess" cellspacing="0" cellpadding="0">';
echo '<td style="border-right:none;" class="panel">Блоги</td>';
echo '<td><a style="border-right:none;" class="panel" href="dir.php">Категории</a></td>';
echo '<td><a class="panel" href="search.php">Поиск</a></td>';
echo '</table>';
echo '<div class="hr"></div>';
/**** Сортировка*****/
$sortir = isset($_GET['sort']) ? $_GET['sort'] : NULL;
switch($sortir)
{
case 't':
$order='order by `time` desc';
echo"<div class='foot'><b>Новые</b> | <a href='?sort=c'>Популярные</a></div>n";
break;
case 'c':
$order='order by `count` desc';
echo"<div class='foot'><a href='?sort=t'>Новые</a> | <b>Популярные</b></div>n";
/* Сортировка популярных дневников по времени */
echo "<div class='nav2'>";
if(isset($_GET['new']) && $_GET['new']=='t'){
echo"<b>Новые</b> | <a href='?sort=c&new=m'>За месяц</a> | <a href='?sort=c&new=v'>За всё время</a>n";
$new=" AND `time`>'".(time()-600)."' ";
}elseif(isset($_GET['new']) && $_GET['new']=='m'){
echo"<a href='?sort=c&new=t'>Новые</a> | <b>За месяц</b> | <a href='?sort=c&new=v'>За всё время</a>n";
$new=" AND `time`>'".(time()-2592000)."' ";
}elseif(isset($_GET['new']) && $_GET['new']=='v'){
echo"<a href='?sort=c&new=t'>Новые</a> | <a href='?sort=c&new=m'>За месяц</a> | <b>За всё время</b>n";
$new=null;
}elseif(isset($_GET['sort']) && $_GET['sort']=='c'){
echo"<b>Новые</b> | <a href='?sort=c&new=m'>За месяц</a> | <a href='?sort=c&new=v'>За всё время</a>n";
$new=" AND `time`>'".(time()-600)."' ";
}else{ $new=null; }
echo "</div>";
/* Сортировка популярных дневников по времени */
break;
default:
$order='order by `time` desc';
//echo "<div class='foot'><b>Новые</b> | <a href='?sort=c'>Популярные</a></div>";
}
if(!isset($_GET['sort']) OR $_GET['sort']!='c'){
$new=null; }
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` WHERE `private`='0'"),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` $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";
}
while ($post = mysql_fetch_assoc($q))
{
echo '<table style="border-bottom:none;" class="mess">';
echo '<td style="vertical-align: top;" width="3%">' .avatar($post['id_user']).'</td><td>';
echo group($post['id_user']);
echo " ".user::nick($post['id_user'])."";
echo '' . online($post['id_user']) . '</br>';
echo "Добавлено ".vremja($post['time'])."</td>";
echo '</table>';
echo '<div class="mess">';
echo "<a href='/plugins/notes/list.php?id=".$post['id']."'><font color='#757577'>".text($post['name'])."</font></a></br>";
echo rez_text($post['msg'],80)."</br></br>";
notes_sh($post['id']);
echo "<span style='font-size: 12px; color: #67676e;'><i class='far fa-eye'></i> ".$post['count']."</span>";
echo '<span style="float:right;">';
echo "<span style='font-size: 12px; color: #67676e;'><i class='far fa-comment-alt'></i> ".mysql_result(mysql_query("SELECT COUNT(`id`)FROM `notes_komm` WHERE `id_notes`='$post[id]'"),0)."</span> ";
$l1=mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `like` = '0' AND `id_notes` = '".$post['id']."' LIMIT 1"),0);
$l2=mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `like` = '1' AND `id_notes` = '".$post['id']."' LIMIT 1"),0);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `id_user` = '".$user['id']."' AND `id_notes` = '".$notes['id']."' LIMIT 1"),0)==0)
echo "<span style='font-size: 12px; color: #67676e;'><i class='fas fa-thumbs-up'></i> ".($l2-$l1)."</span>";
echo '</div>';
}
echo "</table>n";
if (isset($_GET['sort'])) $dop="sort=".my_esc($_GET['sort'])."&";
else $dop='';
if ($k_page>1)str('?'.$dop.'',$k_page,$page); // Вывод страниц
include_once '../../sys/inc/tfoot.php';
?>