File size: 1.75Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.pp.ua *
**********************************/
$locate = 'in_share';
if($user['level'] == 2 || $user['level'] >= 6) {
if(isset($_GET['rid'])) {
if(isset($_POST['yes'])) {
$db->query("DELETE FROM `share` WHERE `id` = '". abs(intval($_GET['rid'])) ."'");
$cid = $db->query("SELECT id FROM `share_c` WHERE `rid` = '". abs(intval($_GET['rid'])) ."'")->fetchColumn();
$dfiles_q = $db->query("SELECT * FROM `share_files` WHERE `cat_id` = '".$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_files` WHERE `cat_id` = '". abs(intval($cid)) ."'");
$db->query("DELETE FROM `share_comms` WHERE `file_id` = '". abs(intval($fid)) ."'");
$db->query("DELETE FROM `share_c` WHERE `rid` = '". abs(intval($_GET['rid'])) ."'");
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_dir/'.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('/'); }
?>