Размер файла: 1.91Kb
- <?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_archive` WHERE `id` = '$file_id'")->rowCount() == 0 || $user['level'] < 4)
- {
- header('location: /downloads/');
- exit;
- }
- $filei = $db->query("SELECT * FROM `downloads_archive` WHERE `id` = '". $file_id ."'")->fetch();
- $fila = $db->query("SELECT * FROM `downloads_files` WHERE `id` = '". $filei['file_id'] ."'")->fetch();
- $root_dir = $db->query("SELECT `server_path` FROM `downloads` WHERE `id` = '". abs(intval($fila['ref_id'])) ."'")->fetchColumn();
- if(isset($_GET['act']) && $_GET['act'] == 'delete')
- {
- if(isset($_POST['yes']))
- {
- unlink(ROOT.'/files/downloads/'.$root_dir.'/'.$fila['server_dir'].'/'.$filei['server_name']);
- $db->query("DELETE FROM `downloads_archive` WHERE `id` = '". $file_id ."'");
- header('location: /downloads/');
- exit;
- }
- elseif(isset($_POST['no']))
- {
- header('location: /downloads/file/'.$filei['from_id']);
- exit;
- }
- }
-
- $title = $lang->word('dl_delete_file').' | '.$lang->word('downloads');
- require_once(SYS.'/view/header.php');
- $tpl->div('title', $lang->word('dl_delete_file'));
- echo '<div class="post">
- <form action="/downloads/delete_attachment/'.$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');
- ?>