File size: 5.68Kb
<?
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';
define ('order', isset( $_GET['order'] ) ? htmlspecialchars($_GET['order']) : null);
if (order != 'new' || order != 'popular') $order = '`id`';
if (order == 'new' ) $new = "WHERE `time` > '".($time -86400)."'";
if (order == 'popular' ) $order = '`view`';
$str = (order ==null ? '?':'').(order =='new' ? '?order=new&':'').(order =='popular' ? '?order=popular&':'');
// Заголовок
$set['title'] = 'Новости';
include_once '../sys/inc/thead.php';
title();
aut();
echo '
<link rel="stylesheet" href="style.css" type="text/css">
<div class="main_bg">
<div class="lc_br wbg font0 relative oh" id="header_path">
<a href="/" style="font-size:0;"> <img src="ico/home.png" alt=""> </a>
<span class="lc_brw">
<img src="ico/sep.png" alt="" class="lc_br_sep"> <span class="lc_br_text">
Новости</span></span>
</div>
</div>
<div class="wrapper-nobg">
<form action="/news/search/" method="post">
<div>
<table class="table__wrap search-wrap input-txt_grid">
<tbody><tr>
<td class="input-txt_grid_input">
<div class="input-txt_wrapper_search relative">
<input type="text" class="input-txt" name="search" value="'.(empty($_SESSION['search']) ? '' : ''.htmlspecialchars($_SESSION['search']).'').'" maxlength="250"> </div>
</td> <td class="input-txt_grid_sep"></td> <td class="input-txt_grid_btn">
<input type="submit" class="search__btn" name="cfms"> </td>
</tr> </tbody></table> </div>
</form>
<div class="tabs_block oh">
<a href="list/" class="tab_item left"> Категории </a>
<div class="tab_item left tab_active black"> Записи </div>
</div>
<div class="wrapper block">
'.(order == null ? 'Все':'<a href="?"> Все </a>').' |
'.(order == 'new' ? 'Новые':'<a href="?order=new"> Новые </a>').' |
'.(order == 'popular' ? 'Популярные':'<a href="?order=popular"> Популярные </a>').'
</div>';
$сount = mysql_result(mysql_query("SELECT COUNT(*) FROM `news` ".$new." ORDER BY ".$order.""),0);
if($сount == 0)echo '<div class="wrapper block">Список пуст.</div>';
$k_page = k_page($сount,$set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$query = mysql_query("SELECT * FROM `news` ".$new." ORDER BY ".$order." DESC LIMIT $start, $set[p_str]");
while ($act = mysql_fetch_assoc($query))
{
$list = mysql_fetch_assoc(mysql_query("SELECT name FROM `news_list` WHERE `id` = '".$act['list']."' LIMIT 1"));
$name = htmlspecialchars ($list['name']);
$comm = mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id_news` = '".$act['id']."' "),0);
$like = mysql_result(mysql_query("SELECT COUNT(*) FROM `like_object` WHERE `id_object` = '".$act['id']."' AND `type` = 'news' AND `like` = '1'"),0);
$dlike = mysql_result(mysql_query("SELECT COUNT(*) FROM `like_object` WHERE `id_object` = '".$act['id']."' AND `type` = 'news' AND `like` = '0'"),0);
echo'
<div class="wrapper" style ="margin: -1px 5px;">
<div class="block attaches_limiter">
<div class="oh">
<span class="right"> <span class="grey">' . vremja($act['time']) . '</span> </span>
<img class="p14" src="/news/ico/news.png" alt="(ON)">
<a class="break-word arrow_link strong_link" href="/news/news/?id='.$act['id'].'"> '.text($act['title']) .' </a>
'.($act['file'] > null ?'</br><img src="/news/photo/img/'.$act['file'].'" style =" max-width: 100% !important;max-height: 400px;"class="preview s0_360">':'').'
</br><div class="text">'.output_text($act['msg']).'</div>
<div class="pad_t_a">
<a href="/news/news/?id='.$act['id'].'" class="inl-link">
<span class="m"> Прочитать полностью </span>
</a>
<img src="/news/ico/arr_r_darkblue.png" class="m arr" width="8" height="12">
</div>
<div class="oh grey pad_t_a"> '.$name.'
<span class="right">
<img src="/news/ico/eye.png " alt="" class="m">
<span class="m">'.$act['view'].'</span>
</span></div>
</div></div></div>
'.(isset($user) ? '
<div class="oh bord-top js-action_bar action-bar">
<table class="table__wrap table__wrap-fixed grey">
<tbody><tr>
<td class="table__cell relative m" style=" border-left: 1px solid #cdd4e1;">
<a href="/news/news/?id='.$act['id'].'" class="link" title="Обсудить">
<img src="/news/ico/comment.png" alt="" class="m">
<span class="grey">'.$comm.'</span> </a> </td>
<td class="table__cell relative m">
<a href="/news/like/?id='.$act['id'].'&type=1" class="link" title="">
<img src="/news/ico/vote_up.png" alt="" class="m p16">
<span class="grey">'.$like.'</span> </a> </td>
<td class="table__cell relative m">
<a href="/news/like/?id='.$act['id'].'&type=0" class="link" title="">
<img src="/news/ico/vote_down.png" alt="" class="m p16">
<span class="grey">'.$dlike.'</span> </a> </td>
</tr></tbody></table>
</div>
<div class="oh bord-top js-action_bar action-bar"> </div>
':'').'
</br>
';
}
if ($k_page>1)str($str,$k_page,$page);
if (user_access('adm_news'))
{
echo '
<div class="wrapper block">
<img src="/news/ico/ok_blue.png" alt="*" /> <a href="/news/add/" class= "break-word arrow_link strong_link">Создать запись</a><br />
</div>
';
}
echo'</div>';
include_once '../sys/inc/tfoot.php';
?>