Размер файла: 3.74Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.ru *
**********************************/
$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('menu', $lang->word('dir_not_exists'));
$tpl->div('block', NAV.' <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' : '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="/share/file/'. $files['id'] .'/">'. $files['name'] .'</a> ('.strtoupper($files['ext']).')<br/>
'.(preg_match('/jpeg|jpg|gif|png|bmp/i', $files['ext']) ? '<img style="border: 1px solid #000;" weight="80" height="60" src="/files/share/'. $files['path_name'] .'" alt="Screen" /><br/>'."\n" : (file_exists(ROOT.'/files/preview/'.$files['path_name'].'.png') ? '<img style="border: 1px solid #000;" weight="80" height="60" src="/files/preview/'.$files['path_name'].'.png" alt="Screen" /><br/>'."\n" : NULL)) .'
'. substr($files['text'], 0, 60).'...
</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/'. $_GET['cat_id'] .'/?type=import">'.$lang->word('import').'</a><br/>'. 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/'. $_GET['cat_id'] .'/?type=import">'.$lang->word('import').'</a><br/>'. img('upload.png').' <a href="/share/add_file/'. $cat_id .'/">'. $lang->word('add_file') .'</a><br/>' : NULL)) . NAV . ' <a href="/share/'. $fid .'/">'. $db->query("SELECT name FROM `share` WHERE `id` = '". $fid ."'")->fetchColumn().'</a><br/>' . NAV . ' <a href="/share/">'. $lang->word('share') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
?>