Файл: modules/share/folder.php
Строк: 63
<?php
if(isset($user)) {
$locate = 'in_share';
if(!isset($_GET['cat_id'])) { go('/share/'); }
$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('title', $lang->word('share'));
$tpl->div('menu', $lang->word('dir_not_exists'));
$tpl->div('block', img('share.png').' <a href="/share/">'. $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'] .' | '.$lang->word('share');
require_once(SYS.'/view/header.php');
$tpl->div('title', $filesc['name'] .' | '.$lang->word('share'));
echo '<div class="post">'. $lang->word('sort') .': '.(isset($_GET['sort']) && $_GET['sort'] == 'name' ? '<a href="/share/folder/'.$cat_id.'/">'.$lang->word('sdate').'</a>/<b>'. $lang->word('sname') .'</b>' : '<b>'.$lang->word('sdate').'</b>/<a href="/share/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 DESC')." 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|TORRENT|rar|tar.gz|7z/i', $files['ext']) ? img('box.png') : NULL).'
<a href="/share/file/'. $files['id'] .'/">'. $files['name'] .'</a> <small>('.strtoupper($files['ext']).')</small><br/>
</div>';
}
$pages->view('/share/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="/share/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="/share/add_file/'. $cat_id .'/">'. $lang->word('add_file') .'</a><br/>' : NULL)) . img('folder.png') . ' <a href="/share/'. $fid .'/">'. $db->query("SELECT name FROM `share` WHERE `id` = '". $fid ."'")->fetchColumn().'</a><br/>' . img('share.png') . ' <a href="/share/">'. $lang->word('share') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
} else {
$title = 'Загруз-центр';
require_once(SYS.'/view/header.php');
$tpl->div('title', 'Загруз-центр');
$tpl->div('menu', '<center>Загруз-центр доступен только зарегистрированным пользователям!</center>');
$tpl->div('block',HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
}
?>