File size: 1.94Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.pp.ua *
**********************************/
$locate = 'in_share';
if(!isset($_GET['rid'])) { go('/share/'); }
$rid = abs(intval($_GET['rid']));
if($db->query("SELECT * FROM `share` WHERE `id` = '". $rid ."'")->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;
}
$sharef = $db->query("SELECT * FROM `share` WHERE `id` = '". $rid ."'")->fetch();
$title = $sharef['name'] .' | '.$lang->word('share');
require_once(SYS.'/view/header.php');
$tpl->div('title', $sharef['name'] .' | '.$lang->word('share'));
$share_r = $db->query("SELECT * FROM `share_c` WHERE `rid` = '". $rid ."'")->rowCount();
if($share_r == 0) {
echo $tpl->div('menu', $lang->word('no_folders'));
}
else {
$share_q = $db->query("SELECT * FROM `share_c` WHERE `rid` = '". $rid ."' ORDER BY name");
while($share = $share_q->fetch()) {
$tpl->div('menu', img('folder.png') . ' <a href="/share/folder/'. $share['id'] .'/">'. $share['name'] .'</a> ('. $db->query("SELECT * FROM `share_files` WHERE `cat_id` = '". $share['id'] ."'")->rowCount() .') ' . ($user['level'] >= 6 ? ' [<a href="/share/delete_folder/'.$share['id'].'/'. abs(intval($_GET['rid'])).'/">'.img('delete.png').'</a> | <a href="/share/edit_folder/'.$share['id'].'/">'.img('edit.png').'</a>]' : NULL) .' <br/>');
}
}
$tpl->div('block', ($user['level'] >=6 ? NAV.' <a href="/share/add_folder/'. $rid .'/">'. $lang->word('create_dir') .'</a><br/>' : NULL) . NAV . ' <a href="/share/">'. $lang->word('share') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
?>