<?php
defined('GCMS') or die('ОШИБКА!');
define('ROOT','/');
#############Новости#############
$maxid = $db -> dbcount('MAX(`id`)','news');
$all = $db -> query("SELECT * FROM `news` WHERE `id` = '".$maxid."' LIMIT 1");
$assoc = $all -> fetch_assoc();
if ($assoc > 0){
$text = $func -> tags($func -> smiles($assoc['new']));
$user = $assoc['user'];
if(mb_strlen($text)>80){$up='<a href="news/new'.$assoc['id'].'">[Читать далее]</a>';}
$user = $assoc['user'];
$msg .= '<div class="spisok">'.$diz -> img('news.png').'<a href="/news/"> Новости</a> ('.$func -> vremja($assoc['time']).') 
</div><div class="fon">
'.mb_substr($text,0,80).''.$up.'</br><b>Добавил: </b>'. $func -> user($user).'';
$r1 = $db -> dbcount('COUNT(*)','reit','`where`="news" and `komy` = '.$assoc['id'].' and `rei`="1"');
$r2 = $db -> dbcount('COUNT(*)','reit','`where`="news" and `komy` = '.$assoc['id'].' and `rei`="0"');
$msg.='<br/><b>Рейтинг: </b>+'.$r1.'/-'.$r2.'<br/>';
if ($assoc['onf']==1){
$pob = $db -> dbcount('COUNT(*)','forum_posts','`tema` = '.$assoc['temaonf'].'');
if ($pob==0)$pob=NULL;
else $pob=''.$pob;
$msg .= '<a href="./forum/tema'.$assoc['temaonf'].'">Обсудить на форуме</a> ('.$pob.')';
}elseif($assoc['onf']==2){
$pob = $db -> dbcount('COUNT(*)','comes','`where`="news" and `idwh` = '.$assoc['id'].'');
$msg .= '<a href="news/com'.$assoc['id'].'">Комментарии</a> ('.$pob.')';
}
$msg.='</div>';
}
###Другие модули###
$menu = $db -> query("SELECT * FROM `menu` ORDER BY `sid` ASC");
while ($sil = $menu -> fetch_assoc())
{
if ($sil['tip']=='link'){$msg .='<div class="menu">'.$diz -> img(''.$sil['icon'].'').'';
$msg .='<a href='.$sil['url'].'> '.$sil['name'].'';}else{
$msg .= '</div><div class="new">'.$sil['name'].'</div>';
}
if ($sil['chet']!=NULL && is_file(ROOT.$sil['chet']))
{
$msg .= '</a> ';
include ROOT.$sil['chet'];
}
if ($sil['tip']=='link'){$msg .= '</div>';}
}
?>