Просмотр файла modules/forum/delete_post.php

Размер файла: 1.87Kb
  1. <?php
  2. /**********************************
  3. * @package: PerfCMS *
  4. * @year: 2012 *
  5. * @author: Artas *
  6. * @link: http://perfcms.pp.ua *
  7. **********************************/
  8. $locate = 'in_forum';
  9. $edit_post = $db->query("SELECT * FROM `forum_pt` WHERE `id` = '".abs(intval($_GET['post_id']))."'")->fetch();
  10. if($user['id'] != $edit_post['user_id'] && $user['level'] < 2 && $user['level'] < 5) { go('/'); exit;}
  11. if(isset($_GET['post_id']))
  12. {
  13. if(isset($_POST['yes']))
  14. {
  15. if(!empty($postWithFile['file']))
  16. {
  17. unlink(ROOT.'/files/forum/'.$edit_post['file']);
  18. }
  19. if($db->query("SELECT * FROM `forum_pt` WHERE `topic_id` = '".abs(intval($_GET['topic_id']))."'")->rowCount() == 1)
  20. {
  21. $db->query("DELETE FROM `forum_pt` WHERE `id` = '". abs(intval($_GET['post_id'])) ."'");
  22. $db->query("DELETE FROM `forum_t` WHERE `id` = '". abs(intval($_GET['topic_id'])) ."'");
  23. go('/forum/');
  24. }
  25. else
  26. {
  27. $db->query("DELETE FROM `forum_pt` WHERE `id` = '". abs(intval($_GET['post_id'])) ."'");
  28. go('/forum/topic'.abs(intval($_GET['topic_id'])).'/?page=end');
  29. }
  30. }
  31. elseif(isset($_POST['no']))
  32. {
  33. go('/forum/topic'.abs(intval($_GET['topic_id'])).'/?page=end');
  34. }
  35. $title = $lang->word('delete');
  36. require_once(SYS.'/view/header.php');
  37. $tpl->div('title', $lang->word('delete'));
  38. echo '<form action="/forum/delete_post/'. abs(intval($_GET['post_id'])) .'/'.abs(intval(abs(intval($_GET['topic_id'])))).'/" method="post">
  39. <div class="menu">
  40. <b>'. $lang->word('r_sure') .'</b><br/>
  41. <input name="yes" type="submit" value="'. $lang->word('yyes') .'" /> <input name="no" type="submit" value="'. $lang->word('yno') .'" /><br/>
  42. </div>
  43. </form>';
  44. $tpl->div('block', NAV .'<a href="/forum/">'. $lang->word('forum') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
  45. require_once(SYS.'/view/footer.php');
  46. } else { go('/'); }
  47. ?>