assign('mas_do',get_sibnet_do(6)); $smarty->assign('toptitle','Новости - '._SHOT_TOP_DESC_); $pageurl='/news/'; $smarty->assign('pageurl',$pageurl); $action=@$_GET['action']; if (@$pst[0]<>'') { $action=$pst[0]; } if (isset($_POST['action'])) { $action=$_POST['action']; } //<--постраничный вывод if(!empty($_GET['page'])) { $page=intval(abs(@$_GET['page']-1)); } else $page=0; $smarty->assign("sel_page",$page+1); $s=array("/&page=[0-9]*/","/pst=[a-z]*/"); $r=array(); $smarty->assign("url",in_text('/news'.preg_replace($s,$r,$_SERVER['QUERY_STRING']))); $page_limit=8; //постраничный вывод--> $order=@$_GET['sort']; if ($order!='date' and $order!='rate') $order='date'; $News = new UserNews(); if (_USERID_>0) { //брем инфу о юзере $q="SELECT * FROM users WHERE id="._USERID_." LIMIT 1"; $res=$DB->query($q); $row=$DB->nextRow($res); $smarty->assign('user',$row); } $smarty->assign('mas_files',get_sibnet_files(4)); $smarty->assign('mas_lib',get_sibnet_lib(3)); $smarty->assign('mas_newcomments',get_new_sale_comments(12)); switch ($action) { default: //<--постраничный вывод $q="SELECT COUNT(*) AS ct FROM user_news WHERE publ=2 LIMIT 1"; $res=$DB->query($q); $row=$DB->nextRow($res); $pages = $row['ct'] > 4 ? intval(ceil(($row['ct']-4)/$page_limit)) : 0; $smarty->assign("pages", $pages); switch (@$_GET['order']) { case 'popular' : $order = 'ctview'; break; case 'comments' : $order = 'ctcomments'; break; default: $order = 'id'; } $smarty->assign('order', $order); $smarty->assign('mas_usernews', $News->ShowPublNews($order,0,4)); $smarty->assign('mas_usernews_archive', $News->ShowPublNews($order,$page,$page_limit,2,4)); $smarty->display('usernews/archive.tpl'); break; case 'show': $mas=array(); //обратная навигация $mas_back_nav=array(); $mas_back_nav[]=array('name'=>'Новости','link'=>'/news/'); $newsid = intval($pst[1]); $news = $News->Show($newsid); //parce videoid from url if (isset($news['video'])) { $matches = array(); preg_match("/video\.sibnet\.ru[a-zA-Z0-9\/]+video([0-9]+)-/", $news['video'], $matches); $news['sibnet_videoid'] = intval(@$matches[1]); } $smarty->assign('news',$news); if ($news['img']<>'') $smarty->assign('social_img','http://auto.sibnet.ru/upload/news_m/'.$news['img']); $smarty->assign('social_title',$news['title']); $smarty->assign('social_anons',$news['lead']); $smarty->assign('social_url',in_text('http://auto.sibnet.ru'.$_SERVER['REQUEST_URI'])); add_one_views('user_news',intval($pst[1])); //комментарии с постраничной $pagenamb=@$_GET['page']; $smarty->assign('pagenamb',$pagenamb); $mas_comments=show_comments($news['commentsid'],$news['ctcomments'],10,$pagenamb,'/news/show/'.$news['id'].'/&'); $smarty->assign('pagenav',$mas_comments["maspage"]); $smarty->assign('mas_comments',$mas_comments['comments']); $smarty->assign('mas_foto',$News->img_lst_form($pst[1])); $smarty->display('usernews/show.tpl'); break; // ------------- Временная страничка правил конкурса --------------- // // ----------------------------------------------------------------- // case 'konkurs_rulez': $smarty->display('konkurs_rulez.tpl'); break; } include("../inc/bottom.php");