iframe_thread.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2006 Dokeos SPRL
  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, rue du Corbeau, 108, 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. /*
  54. -----------------------------------------------------------
  55. Language Initialisation
  56. -----------------------------------------------------------
  57. */
  58. // name of the language file that needs to be included
  59. $language_file = 'forum';
  60. //$this_section=SECTION_COURSES;
  61. require_once '../inc/global.inc.php';
  62. /* ------------ ACCESS RIGHTS ------------ */
  63. // notice for unauthorized people.
  64. api_protect_course_script(true);
  65. require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  66. include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
  67. $fck_attribute['Width'] = '100%';
  68. $fck_attribute['Height'] = '400';
  69. $fck_attribute['Config']['IMUploadPath'] = 'upload/forum/';
  70. $fck_attribute['Config']['FlashUploadPath'] = 'upload/forum/';
  71. if (!api_is_allowed_to_edit(false,true)) {
  72. $fck_attribute['Config']['UserStatus'] = 'student';
  73. $fck_attribute['ToolbarSet'] = 'Forum_Student';
  74. }
  75. else
  76. {
  77. $fck_attribute['ToolbarSet'] = 'Forum';
  78. }
  79. $nameTools=get_lang('Forum');
  80. ?>
  81. <!DOCTYPE html
  82. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  83. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  84. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  85. <head>
  86. <title></title>
  87. <style type="text/css" media="screen, projection">
  88. /*<![CDATA[*/
  89. @import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
  90. /*]]>*/
  91. </style>
  92. </head>
  93. <body>
  94. <?php
  95. /*
  96. -----------------------------------------------------------
  97. Including necessary files
  98. -----------------------------------------------------------
  99. */
  100. require 'forumconfig.inc.php';
  101. require_once 'forumfunction.inc.php';
  102. /*
  103. ==============================================================================
  104. MAIN DISPLAY SECTION
  105. ==============================================================================
  106. */
  107. /*
  108. -----------------------------------------------------------
  109. Retrieving forum and forum categorie information
  110. -----------------------------------------------------------
  111. */
  112. // we are getting all the information about the current forum and forum category.
  113. // note pcool: I tried to use only one sql statement (and function) for this
  114. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
  115. $current_thread=get_thread_information($_GET['thread']); // note: this has to be validated that it is an existing thread
  116. $current_forum=get_forum_information($current_thread['forum_id']); // note: this has to be validated that it is an existing forum.
  117. $current_forum_category=get_forumcategory_information($current_forum['forum_category']);
  118. /*
  119. -----------------------------------------------------------
  120. Is the user allowed here?
  121. -----------------------------------------------------------
  122. */
  123. // if the user is not a course administrator and the forum is hidden
  124. // then the user is not allowed here.
  125. if (!api_is_allowed_to_edit(false,true) AND ($current_forum['visibility']==0 OR $current_thread['visibility']==0)) {
  126. forum_not_allowed_here();
  127. }
  128. /*
  129. -----------------------------------------------------------
  130. Display Forum Category and the Forum information
  131. -----------------------------------------------------------
  132. */
  133. // we are getting all the information about the current forum and forum category.
  134. // note pcool: I tried to use only one sql statement (and function) for this
  135. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
  136. $sql="SELECT * FROM $table_posts posts, $table_users users
  137. WHERE posts.thread_id='".$current_thread['thread_id']."'
  138. AND posts.poster_id=users.user_id
  139. ORDER BY posts.post_id ASC";
  140. $result=api_sql_query($sql, __FILE__, __LINE__);
  141. echo "<table width=\"100%\" cellspacing=\"5\" border=\"0\">\n";
  142. while ($row=Database::fetch_array($result)) {
  143. echo "\t<tr>\n";
  144. echo "\t\t<td rowspan=\"2\" class=\"forum_message_left\">";
  145. if ($row['user_id']=='0') {
  146. $name=$row['poster_name'];
  147. } else {
  148. $name=$row['firstname'].' '.$row['lastname'];
  149. }
  150. echo $name.'<br />';
  151. echo $row['post_date'].'<br /><br />';
  152. echo "</td>\n";
  153. echo "\t\t<td class=\"forum_message_post_title\">".$row['post_title']."</td>\n";
  154. echo "\t</tr>\n";
  155. echo "\t<tr>\n";
  156. echo "\t\t<td class=\"forum_message_post_text\">".$row['post_text']."</td>\n";
  157. echo "\t</tr>\n";
  158. }
  159. echo "</table>";
  160. ?>
  161. </body>
  162. </html>