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

Размер файла: 1.57Kb
  1. <?php
  2. /**********************************
  3. * @package: PerfCMS *
  4. * @year: 2012 *
  5. * @author: Artas *
  6. * @link: http://perfcms.pp.ua *
  7. **********************************/
  8. $locate = 'in_forum';
  9. if(!isset($user) || !isset($_GET['id'])) { go('/'); }
  10. if($db->query("SELECT * FROM `forum_pt` WHERE `id` = '".abs(intval($_GET['id']))."'")->rowCount() == 0) {
  11. go('/forum/');
  12. }
  13. $edit_post = $db->query("SELECT * FROM `forum_pt` WHERE `id` = '".abs(intval($_GET['id']))."'")->fetch();
  14. if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
  15. $text = substr(input($_POST['text']), 0, 3500);
  16.  
  17. $db->query("UPDATE `forum_pt` SET `text` = '". $text ."', `edit_time` = '". time() ."', `edit_user_id` = '". $user['id'] ."', `count_edit` = '". ($edit_post['count_edit']+1) ."' WHERE `id` = '".abs(intval($_GET['id']))."'");
  18. go('/forum/topic'.abs(intval($_GET['topic_id'])).'/?page=end');
  19. // print_r($db->errorInfo());
  20. }
  21. $title = $lang->word('edit_post');
  22. require_once(SYS.'/view/header.php');
  23. $tpl->div('title', $lang->word('edit_post'));
  24. echo '<form action="/forum/edit_post/'.abs(intval($_GET['id'])).'/'.$_GET['topic_id'].'/?act=edit" method="post">
  25. <div class="menu">
  26. <b>'. $lang->word('message') .'</b>:<br/>
  27. <textarea name="text" rows="5" cols="26">'. $edit_post['text'] .'</textarea><br/>
  28. <input name="edit" type="submit" value="'. $lang->word('edit') .'" /><br/>
  29. </div>
  30. </form>';
  31. $tpl->div('block', NAV .'<a href="/forum/">'. $lang->word('forum') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
  32. require_once(SYS.'/view/footer.php');
  33. ?>