File size: 1.63Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.pp.ua *
**********************************/
$locate = 'in_share';
if($user['level'] == 4 || $user['level'] >= 6) {
if(isset($_GET['rid'])) {
if(isset($_POST['yes'])) {
$cid = abs(intval($_GET['cid']));
$db->query("DELETE FROM `share_c` WHERE `id` = '". abs(intval($_GET['cid'])) ."'");
$dfiles_q = $db->query("SELECT * FROM `share_files` WHERE `cat_id` = '".abs(intval($cid))."'");
while($dfiles = $dfiles_q->fetch()) {
unlink(ROOT .'/files/share/'.$dfiles['path_name']);
}
$fid = $db->query("SELECT id FROM `share_files` WHERE `cat_id` = '". abs(intval($cid)) ."'")->fetchColumn();
$db->query("DELETE FROM `share_comms` WHERE `file_id` = '". abs(intval($fid)) ."'");
$db->query("DELETE FROM `share_files` WHERE `cat_id` = '". abs(intval($cid)) ."'");
go('/share/');
} elseif(isset($_POST['no'])) {
go('/share/');
}
$title = $lang->word('delete');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('delete'));
echo '<form action="/share/delete_folder/'.abs(intval($_GET['cid'])).'/'.abs(intval($_GET['rid'])).'/" method="post">
<div class="menu">
<b>'. $lang->word('r_sure') .'</b><br/>
<input name="yes" type="submit" value="'. $lang->word('yyes') .'" /> <input name="no" type="submit" value="'. $lang->word('yno') .'" /><br/>
</div>
</form>';
$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');
} else { go('/'); }
} else { go('/'); }
?>