Файл: modules/domens/folder.php
Строк: 64
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.org.ua *
**********************************/
$locate = 'in_share';
if(!isset($_GET['cat_id'])) { go('/domens/'); }
$cat_id = abs(intval($_GET['cat_id']));
if($db->query("SELECT * FROM `share_c` WHERE `id` = '". $cat_id ."'")->rowCount() == 0) {
$title = $lang->word('share');
require_once(SYS.'/view/header.php');
$tpl->div('menu', $lang->word('dir_not_exists'));
$tpl->div('block', NAV.' <a href="/domens/">'. $lang->word('share') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
exit;
}
$filesc = $db->query("SELECT * FROM `share_c` WHERE `id` = '". $cat_id ."'")->fetch();
$title = $filesc['name'];
require_once(SYS.'/view/header.php');
$tpl->div('title', $filesc['name']);
echo '<div class="post">'. $lang->word('sort') .' '.(isset($_GET['sort']) && $_GET['sort'] == 'name' ? '<a href="/domens/folder/'.$cat_id.'/">'.$lang->word('sdate').'</a>/<b>'. $lang->word('sname') .'</b>' : '<b>'.$lang->word('sdate').'</b>/<a href="/domens/folder/'.$cat_id.'/?sort=name">'.$lang->word('sname').'</a>').'</div>';
$files_r = $db->query("SELECT * FROM `share_files` WHERE `cat_id` = '". $cat_id ."'")->rowCount();
$pages = new Paginator($files_r, $ames);
if($files_r == 0) {
echo $tpl->div('menu', $lang->word('no_files'));
}
else {
$files_q = $db->query("SELECT * FROM `share_files` WHERE `cat_id` = '". $cat_id ."' ORDER BY ".(isset($_GET['sort']) && $_GET['sort'] == 'name' ? 'name ASC' : 'time')." LIMIT $start, $ames");
while($files = $files_q->fetch()) {
echo '<div class="menu">
'.(preg_match('/jpeg|jpg|gif|png|bmp/i', $files['ext']) ? img('image.png') : NULL).'
'.(preg_match('/jar|sis|sisx|jad|apk/i', $files['ext']) ? img('application.png') : NULL).'
'.(preg_match('/mp4|3gp|avi|flv/i', $files['ext']) ? img('video.png') : NULL).'
'.(preg_match('/mp3|aac|amr|wav|midi|mid/i', $files['ext']) ? img('music.png') : NULL).'
'.(preg_match('/zip|rar|tar.gz|7z/i', $files['ext']) ? img('box.png') : NULL).'
<a href="/domens/file/'. $files['id'] .'/">'. $files['name'] .'</a><br/>
Цена: '.$files['cena'].' руб.
</div>';
}
$pages->view('/domens/folder/'. $cat_id .'/?');
}
$fid = $db->query("SELECT rid FROM `share_c` WHERE `id` = '". $cat_id ."'")->fetchColumn();
$tpl->div('block', ($filesc['who_upload'] == 2 && isset($user) ? img('upload.png').' <a href="/domens/add_file/'. $cat_id .'/">'. $lang->word('add_file') .'</a><br/>' : ($filesc['who_upload'] == 1 && ($user['level'] == 4 || $user['level'] >=6) ? img('upload.png'). '<a href="/domens/add_file/'. $cat_id .'/?type=import">'.$lang->word('import').'</a><br/>'. img('upload.png').' <a href="/domens/add_file/'. $cat_id .'/">'. $lang->word('add_file') .'</a><br/>' : NULL)) . NAV . ' <a href="/domens/'. $fid .'/">'. $db->query("SELECT name FROM `share` WHERE `id` = '". $fid ."'")->fetchColumn().'</a><br/>' . HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
?>