fifa-in,
Код (+/-)
/**
* @package JohnCMS
* @link http://johncms.com
* @copyright Copyright (C) 2008-2015 JohnCMS Community
* @license LICENSE.txt (see attached file)
* @version VERSION.txt (see attached file)
* @author about
*/
define('_IN_JOHNCMS', 1);
require_once('library/inc.php');
$lng_lib = core::load_lng('library');
$sql = mysql_query("SELECT `id`, `name`, `dir`, `description` FROM `library_cats` WHERE `parent`=0 ORDER BY `pos` ASC");
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `library_cats` WHERE `parent`=0"), 0);
if ($total) {
while ($row = mysql_fetch_assoc($sql)) {
echo '<div class="list' . (++$i % 2 ? 2 : 1) . '">'
. '<a href="library/index.php??do=dir&id=' . $row['id'] . '">' . functions::checkout($row['name']) . '</a> ('
. mysql_result(mysql_query("SELECT COUNT(*) FROM `" . ($row['dir'] ? 'library_cats' : 'library_texts') . "` WHERE " . ($row['dir'] ? '`parent`=' . $row['id'] : '`cat_id`=' . $row['id'])), 0) . ')';
if (!empty($row['description'])) {
echo '<div style="font-size: x-small; padding-top: 2px"><span class="gray">' . functions::checkout($row['description']) . '</span></div>';
}
echo '</div>';
}
}
$limit = 3;
$total = mysql_result(mysql_query('SELECT COUNT(*) FROM `library_texts` WHERE `premod`=1'), 0);
if ($total) {
$sql = mysql_query("SELECT `id`, `name`, `time`, `uploader`, `uploader_id`, `count_views`, `count_comments`, `comments`, `announce` FROM `library_texts` WHERE `premod`=1 ORDER BY `id` DESC LIMIT " . $limit);
while ($row = mysql_fetch_assoc($sql)) {
echo '<div class="list' . (++$i % 2 ? 2 : 1) . '">'
. (file_exists('files/library/images/small/' . $row['id'] . '.png')
? '<div class="avatar"><img src="files/library/images/small/' . $row['id'] . '.png" alt="screen" /></div>'
: '')
. '<div class="righttable"><a href="library/index.php?id=' . $row['id'] . '">' . functions::checkout($row['name']) . '</a></div>';
}
} else {
echo '<div class="menu">' . $lng['list_empty'] . '</div>';
}