View file uncos/index.php

File size: 3.21Kb
<?
/*
=============================================
Движок:  SHCMS Engine
=============================================
Название файла: Новости
=============================================
Official website: http://shcms.ru
=============================================
*/

define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
$shcmsengine['title'] = 'Новости';
include_once'../template/head.php';
    $allfield = mysql_result(mysql_query("SELECT COUNT(*) FROM uncos"),0);
    $newlist = new Navigation($allfield, 10, true); 
    $news1 = mysql_query("SELECT * FROM `uncos` ORDER BY `id` DESC ". $newlist->limit());
    $news = mysql_fetch_array($news1);

    if(isset($_GET['delet']))
    {
            if($use['team'] ==6)
            {
                if($_GET['id_ne'])
                {
				    $id_ne = $_GET['id_ne'];
				}


    $del_new = mysql_query("DELETE FROM `uncos` WHERE `id`='$id_ne'");
        if($del_new == true)
        {
            echo '<div class="actshcms">Новость успешно удалена</div>';
	        include_once'../template/foot.php';
            header("Refresh: 1; url=?");
            exit();
        }
        else
        {
            echo '<div class="errors">Ошибка удаление новости</div>';
	        include_once'../template/foot.php';
            header("Refresh: 1; url=?");
            exit();
        }
            }
    }

        if($news == null)
        {
            echo '<div class="posts"><img class="img_s" src="/template/icon/empty.png">Новостей сейчас нет</div>';
        }
        else
        {
            do
            {
                $uncos_result = mysql_result(mysql_query("SELECT COUNT(*) FROM `uncos_comment` WHERE `id_uncos`='$news[id]'"),0);
                echo "<div class='posts'><img src='/template/icon/news.png'/> <b>".$news['title']." </b>";
				echo "<div class='maintime'>".$timedate->times($news['time'])."</div>";
                echo "<br/>".processing($news['text'])."<span style='float:right'>";
                users_list($news['user_id']);
				echo "</span></div> <div class='posts'><a href='comments.php?id=".$news['id']."'>Комментарии (".$uncos_result.")</a>";
                
				    if($news['send'] == 0 && $users_user['team'] == 6 && $user_id)
                    {
					    echo "| <a href='news_send.php?id_send=".$news['id']."'>Разослать</a>";
					}
            if($user4['team'] ==6)
            {
                echo "<span style='float:right;'> <a href='?delet&id_ne=".$news['id']."'>Удалить</a></span>";
            }
                echo '</div>';
            }
            while($news = mysql_fetch_array($news1));
        echo '<div class="pages">';
        echo $newlist->pagination();
        echo '</div>';
        }
if($user_id)
{
if($user4['team'] == 6){
echo '<div class="maintitle mainrazd">Навигация</div>';
echo'<div class="maintext"><div class="posts"><a href="add_news.php">Добавить новость</a></div>';}
}echo'<div class="posts"><a href="search.php">Поиск новостей</a></div></div>';
	include_once'../template/foot.php';

	?>