Просмотр файла modules/downloads/delete_dir.php

Размер файла: 1.78Kb
  1. <?php
  2. /**********************************
  3. * @package: PerfCMS *
  4. * @year: 2012 *
  5. * @author: Artas *
  6. * @link: http://perfcms.org.ua *
  7. **********************************/
  8. $locate = 'in_downloads';
  9. $dir_id = abs(intval($_GET['id']));
  10. if(!isset($dir_id) && $db->query("SELECT * FROM `downloads` WHERE `id` = '$dir_id'")->rowCount() == 0 || $user['level'] < 4)
  11. {
  12. header('location: /downloads/');
  13. exit;
  14. }
  15. $diri = $db->query("SELECT * FROM `downloads` WHERE `id` = '". $dir_id ."'")->fetch();
  16. if(isset($_GET['act']) && $_GET['act'] == 'delete')
  17. {
  18. if(isset($_POST['yes']))
  19. {
  20. rrmdir(ROOT.'/files/downloads/'.$diri['server_path']);
  21. $db->query("DELETE FROM `downloads_files` WHERE `ref_id` = '". $dir_id ."'");
  22. $db->query("DELETE FROM `downloads` WHERE `id` = '". $dir_id ."'");
  23. $db->query("DELETE FROM `downloads` WHERE `dir_id` = '". $dir_id ."'");
  24. // print_r($db->errorInfo());
  25. header('location: /downloads/');
  26. exit;
  27. }
  28. elseif(isset($_POST['no']))
  29. {
  30. header('location: /downloads/file/'.$dir_id);
  31. exit;
  32. }
  33. }
  34. $title = $lang->word('dl_edit_file').' | '.$lang->word('downloads');
  35. require_once(SYS.'/view/header.php');
  36. $tpl->div('title', $lang->word('dl_edit_file'));
  37. echo '<div class="post">
  38. <form action="/downloads/delete_dir/'.$dir_id.'?act=delete" method="post">
  39. '.$lang->word('dl_dir_delete_attention').' <b>'.$diri['name'].'</>?<br/>
  40. <input type="submit" name="yes" value="'. $lang->word('yyes') .'" /> <input type="submit" name="no" value="'. $lang->word('yno') .'" />
  41. </form>
  42. </div>';
  43. $tpl->div('block', img('download.png') . ' <a href="/downloads/">'. $lang->word('downloads') .'</a><br/>'
  44. . HICO .' <a href="/">'. $lang->word('home') .'</a>');
  45. require_once(SYS.'/view/footer.php');
  46. ?>