<?
/*
=============================================
 Движок:  SHCMS Engine
=============================================
 Название файла: Библиотека
=============================================
 Official website: http://shcms.ru
=============================================
 Данный код защищен авторскими правами
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
if($_GET['id']){$id=$_GET['id'];}
$lib = mysql_fetch_array(mysql_query("SELECT * FROM `libs` WHERE `id` = '$id'"));
$shcmsengine['title'] = 'Библиотека - '.$lib['name'].'';
include_once'../template/head.php';

    $allfield = mysql_result(mysql_query("SELECT COUNT(*) FROM `libs_stat` WHERE `dir` = '$id' "),0);
    $newlist = new Navigation($allfield, 10, true);  						   
    $libs =  mysql_query("SELECT * FROM `libs_stat` WHERE `dir` = '$id' ORDER BY `id` DESC ". $newlist->limit()."");
    $libr = mysql_fetch_array($libs);
    
	if($libr != NULL)
    {
        do
        {
            echo '<div class="posts"><img src="../template/icon/file_libs.png"/> <a href="lib.php?id='.$libr['id'].'">'.$libr['name'].'</a>
            <br/>
            <div style="text-align:right">'.$timedate->times($libr['time']).'</div></div>';
        }
        while($libr = mysql_fetch_array($libs));
            echo '<div class="pages">';
            echo $newlist->pagination("id=".$id."");
            echo '</div>';
    }
	else
	{
        echo '<div class="posts">В данном разделе нет статей</div>';
	}

    if($user_id)
    {
        echo '<div class="user_foot">Навигация</div>';
        echo '<div class="posts"><a href="new.stat.php?id='.$id.'">Создать статью</a></div>';
        echo '<div class="posts"><a href="my.stat.php">Управление статьями</a></div>';
    }

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