Просмотр файла uncos/categories.php

Размер файла: 4.62Kb
<?
/*
=============================================
Движок:  SHCMS Engine
=============================================
Название файла: Категории новостей
=============================================
Official website: http://shcms.ru
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';

switch($act):


//Вывод всех категорий
default:
$shcmsengine['title'] = Lang::get('Категории'); 
include_once'../template/head.php';
$news_cat = mysql_query("SELECT * FROM `uncos_category`");
if(mysql_num_rows($news_cat) != 0 ) {
echo '<div class="maintitle mainrazd">'.Lang::get('Категории').'</div>
<div class="maintext">';
while($categories = mysql_fetch_array($news_cat)) {
$count_cat = mysql_result(mysql_query("SELECT COUNT(*) FROM `uncos` WHERE `categories` = '$categories[id]'"),0);
printf('<div class="posts"><a href="?act=news&id=%s">%s</a> <span class="mainforum">'.$count_cat.'</span></div>',$categories['id'],$categories['name']);
}
echo '</div>';
}else {
	errors(Lang::get('Разделы не существует'));
}
break;

//Вывод новостей из выбранной  категории
case 'news':
if(isset($_GET['id'])) {$id = $_GET['id'];}
$news_title = mysql_fetch_array(mysql_query("SELECT * FROM `uncos_category` WHERE `id` = '$id'"));
$shcmsengine['title'] = Lang::get('Категории - %s',$news_title['name']); 
include_once'../template/head.php';

 $allfield = mysql_result(mysql_query("SELECT COUNT(*) FROM `uncos` WHERE `categories` = '$id'"),0);
    $newlist = new Navigation($allfield, 10, true);

$news_cat = mysql_query("SELECT * FROM `uncos` WHERE `categories` = '$id' ORDER BY `id` DESC ". $newlist->limit());
if(mysql_num_rows($news_cat) != 0) {
while($uncos_categories = mysql_fetch_array($news_cat)) {

                $uncos_result = mysql_result(mysql_query("SELECT COUNT(*) FROM `uncos_comment` WHERE `id_uncos`='$uncos_categories[id]'"),0);
                echo "<div class='maintitle'><img src='/template/icon/news.png'/> <a href='?act=more&id=".$uncos_categories['id']."'><b>".$uncos_categories['title']." </b></a>";
				echo "<div class='maintime'>".$timedate->times($uncos_categories['time'])."</div></div>";
                echo "<div class='maintext'>".processing($uncos_categories ['text2'])."<div style='text-align:right'>";
                users_list($uncos_categories['user_id']);
				echo "</div></div>";

}
        echo '<div class="pages">';
        echo $newlist->pagination();
        echo '</div>';
	}else {
	errors(Lang::get('В данной категории нет новостей'));
	}
break;

case 'more':

if(isset($_GET['id'])) {$id = $_GET['id'];}
$more = mysql_fetch_array(mysql_query("SELECT * FROM `uncos` WHERE `id` = '$id'"));
$categories = mysql_fetch_array(mysql_query("SELECT * FROM `uncos_category` WHERE `id` ='$more[categories]'"));
mysql_query("UPDATE `uncos` SET `prosm` = '".($more['prosm']+1)."' WHERE `id` = '$id'");
$shcmsengine['title'] = Lang::get('Новости - %s',$more['title']); 
//Keywords = Ключевые слова для поисковиков ()
$shcmsengine['keywords'] = $more['title'];
//Description = Описание
$shcmsengine['description'] = $more['text'];
include_once'../template/head.php';

echo '<div class="maintitle mainrazd"><center style="color:red;">'.$more['title'].'</center></div>';
echo '<div class="maintext">'.processing($more['text']);
echo '<div style="text-align:right; font-size:11px;">';
users_list($more['user_id']);
echo '</div>';
echo '</div>';
$comm = mysql_result(mysql_query("SELECT COUNT(*) FROM `uncos_comment` WHERE `id_uncos` = '$id'"),0);
echo '<div class="maintext" style="font-size:11px;text-align:right;"><a href="comments.php?id='.$more['id'].'">'.Lang::get('Коментарии:').'&nbsp;'.$comm.'</a>&nbsp;|&nbsp; '.Lang::get('Просмотров:').'&nbsp; '.$more['prosm'].'&nbsp;|&nbsp;';
echo $timedate->times($more['time']);
			echo '&nbsp;|&nbsp;'.Lang::get('Категория:').'  <a href="?act=news&id='.$categories['id'].'">'.$categories['name'].'</a>';
                echo '</div>';
break;
endswitch;

//путь вернуться назад
if($act == 'news') {
echo '<a class="link_str" href="categories.php">'.Lang::get('Назад').'</a>';
}elseif($act == 'more') {
echo '<a class="link_str" href="categories.php?act=news&id='.$id.'">'.Lang::get('Назад').'</a>';
}else {
echo '<a class="link_str" href="index.php">'.Lang::get('К новостям').'</a>';
}




include_once'../template/foot.php';
?>