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

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

switch($act):


default:
$shcmsengine['title'] = 'Категории '; 
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">Категории</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('Разделы не существует');
}
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'] = 'Категории - '.$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('В данной категории нет новостей');
	}
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'] = 'Новости - '.$more['title']; 
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'].'">Коментарии: '.$comm.'</a>&nbsp;|&nbsp; Просмотров: '.$more['prosm'].'&nbsp;|&nbsp;';
echo $timedate->times($more['time']);
			echo '&nbsp;|&nbsp;Категория:  <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">Назад</a>';
}elseif($act == 'more') {
echo '<a class="link_str" href="categories.php?act=news&id='.$id.'">Назад</a>';
}else {
echo '<a class="link_str" href="index.php">К новостям</a>';
}




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