Размер файла: 1.84Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.org.ua *
**********************************/
$locate = 'in_downloads';
$file_id = abs(intval($_GET['id']));
if(!isset($file_id) && $db->query("SELECT * FROM `downloads_files` WHERE `id` = '$file_id'")->rowCount() == 0 || $user['level'] < 4)
{
header('location: /downloads/');
exit;
}
$filei = $db->query("SELECT * FROM `downloads_files` WHERE `id` = '". $file_id ."'")->fetch();
$root_dir = $db->query("SELECT `server_path` FROM `downloads` WHERE `id` = '". abs(intval($filei['ref_id'])) ."'")->fetchColumn();
if(isset($_GET['act']) && $_GET['act'] == 'delete')
{
if(isset($_POST['yes']))
{
rrmdir(ROOT.'/files/downloads/'.$root_dir.'/'.$filei['server_dir']);
$db->query("DELETE FROM `downloads_files` WHERE `id` = '". $file_id ."'");
$db->query("DELETE FROM `downloads` WHERE `id` = '". $filei['from_id'] ."'");
header('location: /downloads/');
exit;
}
elseif(isset($_POST['no']))
{
header('location: /downloads/file/'.$file_id);
exit;
}
}
$title = $lang->word('dl_edit_file').' | '.$lang->word('downloads');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('dl_edit_file'));
echo '<div class="post">
<form action="/downloads/delete_file/'.$file_id.'?act=delete" method="post">
'.$lang->word('dl_file_delete_attention').' <b>'.$filei['name'].'</>?<br/>
<input type="submit" name="yes" value="'. $lang->word('yyes') .'" /> <input type="submit" name="no" value="'. $lang->word('yno') .'" />
</form>
</div>';
$tpl->div('block', img('download.png') . ' <a href="/downloads/">'. $lang->word('downloads') .'</a><br/>'
. HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
?>