Advertisement
Guest User

Kusaba X Edit Post

a guest
Dec 11th, 2012
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. On the Kusaba X board, here is what to add to edit posts:
  2.  
  3. **************************************
  4. Edit manage.class.php
  5. Add Post Editing
  6. **************************************
  7.  
  8. /* Post editing */
  9.  
  10. function editpostui() {
  11. global $tc_db, $tpl_page;
  12. $this->ModeratorsOnly();
  13.  
  14. }
  15.  
  16. function editpost() {
  17. global $tc_db, $tpl_page;
  18. $this->ModeratorsOnly(); /*OR $this->AdministatorsOnly(); */ /*Select whether you want this option was for modetartors or only administators */
  19.  
  20. $board = isset($_GET['boarddir']) ? $_GET['boarddir'] : '';
  21. $editpostid = isset($_GET['editpostid']) ? $_GET['editpostid'] : '';
  22. $board_id = $tc_db->GetOne("SELECT HIGH_PRIORITY `id` FROM `". KU_DBPREFIX . "boards` WHERE `name` = ".$tc_db->qstr($board));
  23.  
  24. if($_POST['message'] || $_POST['subject']) {
  25. if($_POST['message']) {
  26. $tc_db->Execute("UPDATE `" . KU_DBPREFIX . "posts` SET `message` = ".$tc_db->qstr($_POST['message'])." WHERE `boardid` = ".$board_id." AND `id` = ".$tc_db->qstr($editpostid)." ");
  27. }
  28. if($_POST['subject']) {
  29. $tc_db->Execute("UPDATE `" . KU_DBPREFIX . "posts` SET `subject` = ".$tc_db->qstr($_POST['subject'])." WHERE `boardid` = ".$board_id." AND `id` = ".$tc_db->qstr($editpostid)." ");
  30. }
  31. $board_class = new Board($board);
  32. $board_class->RegenerateThreads(intval($_POST['thread']));
  33. $board_class->RegeneratePages();
  34. unset($board_class);
  35. $tpl_page .= _gettext('Edit successful.') . ' <br /><hr />';
  36. }
  37.  
  38. $results = $tc_db->GetAll("SELECT HIGH_PRIORITY `parentid`,`message`,`subject` FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_id . " AND `id` = " . $tc_db->qstr($editpostid) . " ");
  39.  
  40. foreach ($results as $line) {
  41. $parentid = $line['parentid'];
  42. $message = $line['message'];
  43. $subject = $line['subject'];
  44. }
  45. if($parentid == 0) { $parentid = $editpostid; }
  46.  
  47. $tpl_page .= '<h2>'. _gettext('Edit post ID: '.$editpostid.' from board: /'.$board.'/') . '</h2><br />';
  48. $tpl_page .= '<form action="" method="post">
  49. Subject:<br /><input type="text" name="subject" value="'.$subject.'" /><br />
  50. HTML:<br /><textarea cols="80" rows="15" name="message">'.$message.'</textarea><input type="hidden" name="thread" value="'.$parentid.'" /><br /><input type="submit" name="edit" value="Edit" /></form>';
  51. }
  52.  
  53. ***********************
  54. Edit kusaba.js
  55. ***********************
  56.  
  57. Find the following line:
  58.  
  59. f += 'id=' + e[2] + '&postid=' + e[2] + '&cp=y" title="' + _('Child Pornography') + '" onclick="return confirm(_(\'Are you sure that this is child pornography?\'));">CP<\/a>&#93;
  60.  
  61. and at the end of the line add the following:
  62.  
  63. <a href="' + ku_boardspath + '/manage_page.php?action=editpost&boarddir=' + e[1] + '&editpostid=' + e[2] + '" target="_blank" title="Edit post">[Edit Post]</a>';
  64.  
  65. which it should look like the following:
  66.  
  67. f += 'id=' + e[2] + '&postid=' + e[2] + '&cp=y" title="' + _('Child Pornography') + '" onclick="return confirm(_(\'Are you sure that this is child pornography?\'));">CP<\/a>&#93;<a href="' + ku_boardspath + '/manage_page.php?action=editpost&boarddir=' + e[1] + '&editpostid=' + e[2] + '" target="_blank" title="Edit post">[Edit Post]</a>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement