dokeos-forum
[ class tree: dokeos-forum ] [ index: dokeos-forum ] [ all elements ]

Source for file editpost.php

Documentation is available at editpost.php

  1. <?php
  2. /*
  3. ==============================================================================
  4.     Dokeos - elearning and course management software
  5.  
  6.     Copyright (c) 2006-2008 Dokeos S.A.
  7.     Copyright (c) 2006 Ghent University (UGent)
  8.  
  9.     For a full list of contributors, see "credits.txt".
  10.     The full license can be read in "license.txt".
  11.  
  12.     This program is free software; you can redistribute it and/or
  13.     modify it under the terms of the GNU General Public License
  14.     as published by the Free Software Foundation; either version 2
  15.     of the License, or (at your option) any later version.
  16.  
  17.     See the GNU General Public License for more details.
  18.  
  19.     Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  20.     Mail: info@dokeos.com
  21. ==============================================================================
  22. */
  23.  
  24. /**
  25. *    These files are a complete rework of the forum. The database structure is
  26. *    based on phpBB but all the code is rewritten. A lot of new functionalities
  27. *    are added:
  28. *     - forum categories and forums can be sorted up or down, locked or made invisible
  29. *    - consistent and integrated forum administration
  30. *     - forum options:     are students allowed to edit their post?
  31. *                         moderation of posts (approval)
  32. *                         reply only forums (students cannot create new threads)
  33. *                         multiple forums per group
  34. *    - sticky messages
  35. *     - new view option: nested view
  36. *     - quoting a message
  37. *
  38. *    @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  39. *    @Copyright Ghent University
  40. *    @Copyright Patrick Cool
  41. *
  42. *     @package dokeos.forum
  43. */
  44.  
  45. /**
  46.  *************************************************************************
  47.  *                        IMPORTANT NOTICE
  48.  * Please do not change anything is this code yet because there are still
  49.  * some significant code that need to happen and I do not have the time to
  50.  * merge files and test it all over again. So for the moment, please do not
  51.  * touch the code
  52.  *                             -- Patrick Cool <patrick.cool@UGent.be>
  53.  *************************************************************************
  54.  */
  55.  
  56. /*
  57. ==============================================================================
  58.         INIT SECTION
  59. ==============================================================================
  60. */
  61. // name of the language file that needs to be included
  62. $language_file 'forum';
  63.  
  64. // including the global dokeos file
  65. require ('../inc/global.inc.php');
  66.  
  67. // the section (tabs)
  68. $this_section=SECTION_COURSES;
  69. // notice for unauthorized people.
  70.  
  71.  
  72. // FCKeditor configuration
  73. $fck_attribute['Width''100%';
  74. $fck_attribute['Height''300';
  75. $fck_attribute['ToolbarSet''Middle';
  76. $fck_attribute['Config']['IMUploadPath''upload/forum/';
  77. $fck_attribute['Config']['FlashUploadPath''upload/forum/';
  78.  
  79. // including additional library scripts
  80. require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  81. include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
  82.  
  83. {
  84.     $fck_attribute['Config']['UserStatus''student';
  85. }
  86.  
  87. $nameTools=get_lang('Forum');
  88.  
  89. /*
  90. -----------------------------------------------------------
  91.     Including necessary files
  92. -----------------------------------------------------------
  93. */
  94. include('forumconfig.inc.php');
  95. include('forumfunction.inc.php');
  96.  
  97. /*
  98. ==============================================================================
  99.         MAIN DISPLAY SECTION
  100. ==============================================================================
  101. */
  102. /*
  103. -----------------------------------------------------------
  104.     Retrieving forum and forum categorie information
  105. -----------------------------------------------------------
  106. */
  107. // we are getting all the information about the current forum and forum category.
  108. // note pcool: I tried to use only one sql statement (and function) for this
  109. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
  110. $current_thread=get_thread_information($_GET['thread'])// note: this has to be validated that it is an existing thread
  111. $current_forum=get_forum_information($_GET['forum'])// note: this has to be validated that it is an existing forum.
  112. $current_forum_category=get_forumcategory_information($current_forum['forum_category']);
  113. $current_post=get_post_information($_GET['post']);
  114. /*
  115. -----------------------------------------------------------
  116.     Header and Breadcrumbs
  117. -----------------------------------------------------------
  118. */
  119. $interbreadcrumb[]=array("url" => "index.php","name" => $nameTools);
  120. $interbreadcrumb[]=array("url" => "viewforumcategory.php?forumcategory=".$current_forum_category['cat_id'],"name" => prepare4display($current_forum_category['cat_title']));
  121. $interbreadcrumb[]=array("url" => "viewforum.php?forum=".Security::remove_XSS($_GET['forum']),"name" => prepare4display($current_forum['forum_title']));
  122. $interbreadcrumb[]=array("url" => "viewthread.php?forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".$_GET['thread'],"name" => prepare4display($current_thread['thread_title']));
  123. $interbreadcrumb[]=array("url" => "reply.php?forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread']),"name" => get_lang('EditPost'));
  124.  
  125. /*
  126. -----------------------------------------------------------
  127.     Resource Linker
  128. -----------------------------------------------------------
  129. */
  130. if (isset($_POST['add_resources']AND $_POST['add_resources']==get_lang('Resources'))
  131. {
  132.     $_SESSION['formelements']=$_POST;
  133.     $_SESSION['origin']=$_SERVER['REQUEST_URI'];
  134.     $_SESSION['breadcrumbs']=$interbreadcrumb;
  135.     header("Location: ../resourcelinker/resourcelinker.php");
  136. }
  137.  
  138. /*
  139. -----------------------------------------------------------
  140.     Header
  141. -----------------------------------------------------------
  142. */
  143. ////echo '<link href="forumstyles.css" rel="stylesheet" type="text/css" />';
  144. /*
  145. -----------------------------------------------------------
  146.     Is the user allowed here?
  147. -----------------------------------------------------------
  148. */
  149. // the user is not allowed here if
  150. // 1. the forumcategory, forum or thread is invisible (visibility==0)
  151. // 2. the forumcategory, forum or thread is locked (locked <>0)
  152. // 3. if anonymous posts are not allowed
  153. // 4. if editing of replies is not allowed
  154. // The only exception is the course manager
  155. // I have split this is several pieces for clarity.
  156. //if (!api_is_allowed_to_edit() AND (($current_forum_category['visibility']==0 OR $current_forum['visibility']==0) OR ($current_forum_category['locked']<>0 OR $current_forum['locked']<>0 OR $current_thread['locked']<>0)))
  157. if (!api_is_allowed_to_edit(AND (($current_forum_category['visibility']==OR $current_forum['visibility']==0)))
  158. {
  159. }
  160. if (!api_is_allowed_to_edit(AND ($current_forum_category['locked']<>OR $current_forum['locked']<>OR $current_thread['locked']<>0))
  161. {
  162. }
  163. if (!$_user['user_id'AND $current_forum['allow_anonymous']==0)
  164. {
  165. }
  166. if (!api_is_allowed_to_edit(AND $current_forum['allow_edit']==0)
  167. {
  168. }
  169.  
  170.  
  171. /*
  172. -----------------------------------------------------------
  173.     Display Forum Category and the Forum information
  174. -----------------------------------------------------------
  175. */
  176. echo "<table class=\"data_table\" width='100%'>\n";
  177.  
  178.  
  179. // the forum category
  180. echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"2\">";
  181. echo '<a href="viewforum.php?forum='.$current_forum['forum_id'].'" '.class_visible_invisible($current_forum['visibility']).'>'.prepare4display($current_forum['forum_title']).'</a><br />';
  182. echo '<span class="forum_description">'.prepare4display($current_forum['forum_comment']).'</span>';echo "</th>\n";
  183. echo "</th>\n";
  184. echo "\t</tr>\n";
  185. echo '</table>';
  186.  
  187. // the form for the reply
  188. $values=show_edit_post_form($current_post$current_thread$current_forum$_SESSION['formelements']);
  189. if (!empty($valuesand $_POST['SubmitPost'])
  190. {
  191.     store_edit_post($values);
  192. }
  193.  
  194. /*
  195. ==============================================================================
  196.         FOOTER
  197. ==============================================================================
  198. */
  199.  
  200. ?>

Documentation generated on Thu, 12 Jun 2008 13:22:22 -0500 by phpDocumentor 1.4.1