/edit.php

https://gitlab.com/VoyaTrax/vtforum · PHP · 114 lines · 73 code · 8 blank · 33 comment · 24 complexity · 06730819d916aa606488f439aaf4819e MD5 · raw file

  1. <?php
  2. // $Id: edit.php,v 1.3 2005/02/10 19:04:21 gij Exp $
  3. // ------------------------------------------------------------------------ //
  4. // XOOPS - PHP Content Management System //
  5. // Copyright (c) 2000 XOOPS.org //
  6. // <http://www.xoops.org/> //
  7. // ------------------------------------------------------------------------ //
  8. // This program is free software; you can redistribute it and/or modify //
  9. // it under the terms of the GNU General Public License as published by //
  10. // the Free Software Foundation; either version 2 of the License, or //
  11. // (at your option) any later version. //
  12. // //
  13. // You may not change or alter any portion of this comment or credits //
  14. // of supporting developers from this source code or any supporting //
  15. // source code which is considered copyrighted (c) material of the //
  16. // original comment or credit authors. //
  17. // //
  18. // This program is distributed in the hope that it will be useful, //
  19. // but WITHOUT ANY WARRANTY; without even the implied warranty of //
  20. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
  21. // GNU General Public License for more details. //
  22. // //
  23. // You should have received a copy of the GNU General Public License //
  24. // along with this program; if not, write to the Free Software //
  25. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
  26. // ------------------------------------------------------------------------ //
  27. // Author: Kazumi Ono (AKA onokazu) //
  28. // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
  29. // Project: The XOOPS Project //
  30. // ------------------------------------------------------------------------- //
  31. include 'header.php';
  32. include_once XOOPS_ROOT_PATH.'/modules/vtforum/class/class.forumposts.php';
  33. $forumpost = new ForumPosts( intval( @$_GET['post_id'] ) ) ;
  34. $post_id = $forumpost->postid() ;
  35. if( empty( $post_id ) ) {
  36. die(_MD_VTFORUM_ERRORPOST);
  37. }
  38. $topic_id = $forumpost->topic() ;
  39. $forum = $forumpost->forum() ;
  40. // lock check
  41. if ( vtforum_is_locked($topic_id) ) {
  42. die(_MD_VTFORUM_TOPICLOCKED);
  43. }
  44. $sql = sprintf("SELECT forum_type, forum_name, forum_access, allow_html, allow_sig, posts_per_page, hot_threshold, topics_per_page FROM %s WHERE forum_id = %u", $xoopsDB->prefix("vtforum_forums"), $forum);
  45. if ( !$result = $xoopsDB->query($sql) ) {
  46. die(_MD_VTFORUM_ERROROCCURED);
  47. }
  48. $forumdata = $xoopsDB->fetchArray($result);
  49. $myts =& MyTextSanitizer::getInstance();
  50. // CHECK ACCESS RIGHTS BY FORUM TYPE
  51. if ( $forumdata['forum_type'] == 1 ) {
  52. // To get here, we have a logged-in user. So, check whether that user is allowed to post in
  53. // this private forum.
  54. $accesserror = 0; //initialize
  55. if ( $xoopsUser ) {
  56. if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
  57. if ( !vtforum_check_priv_forum_post($xoopsUser->uid(), $forum) ) {
  58. $accesserror = 1;
  59. }
  60. }
  61. } else {
  62. $accesserror = 1;
  63. }
  64. if ( $accesserror == 1 ) {
  65. die(_MD_VTFORUM_NORIGHTTOPOST);
  66. }
  67. } else {
  68. $accesserror = 0;
  69. if ( $forumdata['forum_access'] == 3 ) {
  70. if ( $xoopsUser ) {
  71. if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
  72. if ( !vtforum_is_moderator($forum, $xoopsUser->uid()) ) {
  73. $accesserror = 1;
  74. }
  75. }
  76. } else {
  77. $accesserror = 1;
  78. }
  79. } elseif ( $forumdata['forum_access'] == 1 && !$xoopsUser ) {
  80. $accesserror = 1;
  81. }
  82. if ( $accesserror == 1 ) {
  83. die(_MD_VTFORUM_NORIGHTTOPOST);
  84. }
  85. }
  86. include XOOPS_ROOT_PATH."/header.php";
  87. $nohtml = $forumpost->nohtml();
  88. $nosmiley = $forumpost->nosmiley();
  89. $icon = $forumpost->icon();
  90. $attachsig = $forumpost->attachsig();
  91. $topic_id=$forumpost->topic();
  92. if ( $forumpost->istopic() ) {
  93. $istopic = 1;
  94. } else {
  95. $istopic = 0;
  96. }
  97. $subject=$forumpost->subject("Edit");
  98. $message=$forumpost->text("Edit");
  99. $solved=$forumpost->solved();
  100. $hidden = "";
  101. $myts =& MyTextSanitizer::getInstance();
  102. $viewmode = $myts->htmlspecialchars($viewmode);
  103. $formTitle = _MD_VTFORUM_EDITMODEC ;
  104. include XOOPS_ROOT_PATH.'/modules/vtforum/include/forumform.inc.php';
  105. include XOOPS_ROOT_PATH.'/footer.php';
  106. ?>