iframe_thread.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2006 Dokeos S.A.
  6. Copyright (c) 2006 Ghent University (UGent)
  7. For a full list of contributors, see "credits.txt".
  8. The full license can be read in "license.txt".
  9. This program is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU General Public License
  11. as published by the Free Software Foundation; either version 2
  12. of the License, or (at your option) any later version.
  13. See the GNU General Public License for more details.
  14. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  15. Mail: info@dokeos.com
  16. ==============================================================================
  17. */
  18. /**
  19. * These files are a complete rework of the forum. The database structure is
  20. * based on phpBB but all the code is rewritten. A lot of new functionalities
  21. * are added:
  22. * - forum categories and forums can be sorted up or down, locked or made invisible
  23. * - consistent and integrated forum administration
  24. * - forum options: are students allowed to edit their post?
  25. * moderation of posts (approval)
  26. * reply only forums (students cannot create new threads)
  27. * multiple forums per group
  28. * - sticky messages
  29. * - new view option: nested view
  30. * - quoting a message
  31. *
  32. * @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  33. * @Copyright Ghent University
  34. * @Copyright Patrick Cool
  35. *
  36. * @package dokeos.forum
  37. */
  38. /**
  39. **************************************************************************
  40. * IMPORTANT NOTICE
  41. * Please do not change anything is this code yet because there are still
  42. * some significant code that need to happen and I do not have the time to
  43. * merge files and test it all over again. So for the moment, please do not
  44. * touch the code
  45. * -- Patrick Cool <patrick.cool@UGent.be>
  46. **************************************************************************
  47. */
  48. /*
  49. ==============================================================================
  50. INIT SECTION
  51. ==============================================================================
  52. */
  53. include('../inc/global.inc.php');
  54. $this_section=SECTION_COURSES;
  55. /* ------------ ACCESS RIGHTS ------------ */
  56. // notice for unauthorized people.
  57. api_protect_course_script(true);
  58. /*
  59. -----------------------------------------------------------
  60. Language Initialisation
  61. -----------------------------------------------------------
  62. */
  63. // name of the language file that needs to be included
  64. $language_file = 'forum';
  65. require ('../inc/global.inc.php');
  66. require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  67. include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
  68. $fck_attribute['Width'] = '100%';
  69. $fck_attribute['Height'] = '400';
  70. $fck_attribute['ToolbarSet'] = 'Middle';
  71. $fck_attribute['Config']['IMUploadPath'] = 'upload/forum/';
  72. $fck_attribute['Config']['FlashUploadPath'] = 'upload/forum/';
  73. if(!api_is_allowed_to_edit()) $fck_attribute['Config']['UserStatus'] = 'student';
  74. $nameTools=get_lang('Forum');
  75. ?>
  76. <!DOCTYPE html
  77. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  78. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  79. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  80. <head>
  81. <title></title>
  82. <style type="text/css" media="screen, projection">
  83. /*<![CDATA[*/
  84. @import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
  85. /*]]>*/
  86. </style>
  87. </head>
  88. <body>
  89. <?php
  90. /*
  91. -----------------------------------------------------------
  92. Including necessary files
  93. -----------------------------------------------------------
  94. */
  95. include('forumconfig.inc.php');
  96. include('forumfunction.inc.php');
  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($current_thread['forum_id']); // note: this has to be validated that it is an existing forum.
  112. $current_forum_category=get_forumcategory_information($current_forum['forum_category']);
  113. /*
  114. -----------------------------------------------------------
  115. Is the user allowed here?
  116. -----------------------------------------------------------
  117. */
  118. // if the user is not a course administrator and the forum is hidden
  119. // then the user is not allowed here.
  120. if (!api_is_allowed_to_edit() AND ($current_forum['visibility']==0 OR $current_thread['visibility']==0))
  121. {
  122. forum_not_allowed_here();
  123. }
  124. /*
  125. -----------------------------------------------------------
  126. Display Forum Category and the Forum information
  127. -----------------------------------------------------------
  128. */
  129. // we are getting all the information about the current forum and forum category.
  130. // note pcool: I tried to use only one sql statement (and function) for this
  131. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
  132. /*
  133. echo "<table width='100%'>\n";
  134. // the forum category
  135. echo "\t<tr class=\"forum_category\">\n\t\t<td colspan=\"6\">";
  136. echo '<a href="index.php" '.class_visible_invisible($current_forum_category['visibility']).'>'.$current_forum_category['cat_title'].'</a><br />';
  137. echo '<span>'.$current_forum_category['cat_comment'].'</span>';
  138. echo "</td>\n";
  139. echo "\t</tr>\n";
  140. // the forum
  141. echo "\t<tr class=\"forum_header\">\n";
  142. echo "\t\t<td colspan=\"6\"><a href=\"viewforum.php?forum=".$current_forum['forum_id']."\" ".class_visible_invisible($current_forum['visibility']).">".$current_forum['forum_title']."</a><br />";
  143. echo '<span>'.$current_forum['forum_comment'].'</span>';
  144. echo "</td>\n";
  145. echo "\t</tr>\n";
  146. echo "</table>";
  147. */
  148. $sql="SELECT * FROM $table_posts posts, $table_users users
  149. WHERE posts.thread_id='".$current_thread['thread_id']."'
  150. AND posts.poster_id=users.user_id
  151. ORDER BY posts.post_id ASC";
  152. $result=api_sql_query($sql, __FILE__, __LINE__);
  153. echo "<table width=\"100%\" cellspacing=\"5\" border=\"0\">\n";
  154. while ($row=mysql_fetch_array($result))
  155. {
  156. echo "\t<tr>\n";
  157. echo "\t\t<td rowspan=\"2\" class=\"forum_message_left\">";
  158. if ($row['user_id']=='0')
  159. {
  160. $name=$row['poster_name'];
  161. }
  162. else
  163. {
  164. $name=$row['firstname'].' '.$row['lastname'];
  165. }
  166. echo display_user_link($row['user_id'], $name).'<br />';
  167. echo $row['post_date'].'<br /><br />';
  168. echo "</td>\n";
  169. echo "\t\t<td class=\"forum_message_post_title\">".$row['post_title']."</td>\n";
  170. echo "\t</tr>\n";
  171. echo "\t<tr>\n";
  172. echo "\t\t<td class=\"forum_message_post_text\">".$row['post_text']."</td>\n";
  173. echo "\t</tr>\n";
  174. }
  175. echo "</table>";
  176. ?>
  177. </body>
  178. </html>