Файл: modules/downloads/index.php
Строк: 97
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$locate = 'in_downloads';
$dir_id = 0;
$title = _t('downloads');
include_header($title);
$tpl->div('title', _t('downloads'));
$downloads_r = $db->query("SELECT * FROM `downloads` WHERE `dir_id` = '0'")->rowCount();
$pages = new Paginator($downloads_r, $ames);
if($downloads_r == 0)
{
$tpl->div('menu', _t('dl_dir_empty'));
}
else
{
$downloads_q = $db->query("SELECT * FROM `downloads` WHERE `dir_id` = '0' ORDER BY `type` ASC, `name` DESC LIMIT $start, $ames");
while($downloads = $downloads_q->fetch())
{
$downloads_file = $db->query("SELECT * FROM `downloads_files` WHERE `ref_id` = '$dir_id' AND `from_id` = '". $downloads['id'] ."'")->fetch();
echo '<div class="menu">
'.($downloads['type'] == 0 ? img('folder.png') : dlext($downloads_file['ext'])).' <a href="/downloads/'.($downloads['type'] == 0 ? 'dir/'.$downloads['id'] : 'file/'.$downloads_file['id']).'">'.($downloads['type'] == 0 ? $downloads['name'] : $downloads_file['name'].' ('.$downloads_file['ext'].')').'</a>'.($downloads['type'] == 0 ? null : ' ['.size($downloads_file['size']).']').'
'.($downloads['type'] == 0 ? '('.$db->query("SELECT * FROM `downloads` WHERE `dir_id` = '".$downloads['id']."' AND `type` = '0'")->rowCount().'/'.$db->query("SELECT * FROM `downloads` WHERE `dir_id` = '".$downloads['id']."' AND `type` = '1'")->rowCount().')' : NULL).'
'.($downloads['type'] == 0 && $user['level'] >=4 ? '[ <a href="/downloads/edit_dir/'.$downloads['id'].'">'.img('edit.png').'</a> | <a href="/downloads/delete_dir/'.$downloads['id'].'">'.img('delete.png').'</a> ]' : NULL).'
<br/>
'.($downloads['type']== 0 && !empty($downloads['description']) ? '<span style="font-size: xx-small;">'. $downloads['description'] .'</span>' : ($downloads['type'] == 1 && !empty($downloads_file['description']) ? mb_substr($downloads_file['description'], 0, 100).'...' : NULL)).'
</div>';
}
$pages->view();
}
$tpl->div('block', img('search.png') .' <a href="/downloads/search">'. _t('search') .'</a><br/> '
. ($user['level'] >=5 ? img('add.png').' <a href="/downloads/add_file?">'. _t('dl_add_file') .'</a><br/>'.
img('add.png').' <a href="/downloads/add_dir?">'. _t('dl_add_dir') .'</a><br/>' : NULL)
. HICO .' <a href="/">'. _t('home') .'</a>');
include_footer();
?>