Файл: modules/domens/delete_dir.php
Строк: 38
<?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/domens/'.$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('/domens/');
} elseif(isset($_POST['no'])) {
go('/domens/');
}
$title = $lang->word('delete');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('delete'));
echo '<form action="/domens/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="/domens/">'. $lang->word('share') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
} else { go('/'); }
} else { go('/'); }
?>