<?php

/*
-----------------------------------------------------------------
Mақолаҳо
-----------------------------------------------------------------
*/
$kmess = '33';
echo '<div class="phdr"><b>Yangi maqolalar</b></div>';
$bolm_sql = mysql_query("SELECT `id`, `name`, `dir`, `description` FROM `library_cats` WHERE `parent`=0 ORDER BY `pos` DESC");
$sql = mysql_result(mysql_query('SELECT COUNT(*) FROM `library_texts` WHERE `premod`=1'), 0);
$page = $page >= ceil($sql / $kmess) ? ceil($sql / $kmess) : $page;
$start = $page == 1 ? 0 : ($page - 1) * $kmess;
$bolm = mysql_fetch_assoc($bolm_sql);

$req_lib = mysql_query("SELECT * FROM `library_texts` WHERE `premod`='1' ORDER BY `time` DESC LIMIT " . $start . "," . 10);
if ($sql) {
$i = 0; 
while ($lib = mysql_fetch_assoc($req_lib)) { 
echo'<div class="menu">';

if (file_exists((ROOTPATH . 'files/library/images/big/' . $lib['id'] . '.png'))){

$img_style = 'width: 80px; height: 50px; float: left; clear: both; margin: 10px';
echo '<a href="' . $set['homeurl'] . '/library/index.php?id=' . $lib['id'] . '"><img style="' . $img_style . '" src="' . $set['homeurl'] . '/files/library/images/big/' . $lib['id'] . '.png" alt="screen" />';
}else{
$img_style = 'width: 80px; height: 50px; float: left; clear: both; margin: 10px';
echo '<img style="' . $img_style . '" src="' . $set['homeurl'] . '/files/library/images/big/96.png" alt="screen" />';
}
echo ''
. '<a href="' . $set['homeurl'] . '/library/index.php?id=' . $lib['id'] . '"><b>' . $lib['name'] . '</b></a><br>'
. '<div class="newsviews"><img src="http://ajoyib.ru/img/views.png" alt="" class="icon"/>' . $lib['count_views'] . '</div>'
. '<div class="newscomm"><img src="http://ajoyib.ru/img/comm.png" alt="" class="icon"/> <a href="' . $set['homeurl'] . '/library/index.php?act=comments&id=' . $lib['id'] . '">' . $lib['count_comments'] . '</a></div><br/>';
echo '<div class="sub">Qo`shdi: <a href="'.$home.'/users/profile.php?user=' . $lib['uploader_id'] . '">' . $lib['uploader'] . '</a></div>' . $lng['section'] . ':</td>' . '<td><a href="/library/?do=dir&amp;id=' . $lib['cat_id'] . '"> ' . functions::checkout(mysql_result(mysql_query("SELECT `name` FROM `library_cats` WHERE `id`=" . $lib['cat_id']), 0)) . '</a></div>';
echo '</div>';
}
}


