iframe_thread.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. $nameTools=get_lang('Forum');
  68. ?>
  69. <!DOCTYPE html
  70. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  71. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  72. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  73. <head>
  74. <title></title>
  75. <style type="text/css" media="screen, projection">
  76. /*<![CDATA[*/
  77. @import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
  78. /*]]>*/
  79. </style>
  80. </head>
  81. <body>
  82. <?php
  83. /*
  84. -----------------------------------------------------------
  85. Including necessary files
  86. -----------------------------------------------------------
  87. */
  88. require 'forumconfig.inc.php';
  89. require_once 'forumfunction.inc.php';
  90. /*
  91. ==============================================================================
  92. MAIN DISPLAY SECTION
  93. ==============================================================================
  94. */
  95. /*
  96. -----------------------------------------------------------
  97. Retrieving forum and forum categorie information
  98. -----------------------------------------------------------
  99. */
  100. // we are getting all the information about the current forum and forum category.
  101. // note pcool: I tried to use only one sql statement (and function) for this
  102. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
  103. $current_thread=get_thread_information($_GET['thread']); // note: this has to be validated that it is an existing thread
  104. $current_forum=get_forum_information($current_thread['forum_id']); // note: this has to be validated that it is an existing forum.
  105. $current_forum_category=get_forumcategory_information($current_forum['forum_category']);
  106. /*
  107. -----------------------------------------------------------
  108. Is the user allowed here?
  109. -----------------------------------------------------------
  110. */
  111. // if the user is not a course administrator and the forum is hidden
  112. // then the user is not allowed here.
  113. if (!api_is_allowed_to_edit(false,true) AND ($current_forum['visibility']==0 OR $current_thread['visibility']==0)) {
  114. forum_not_allowed_here();
  115. }
  116. /*
  117. -----------------------------------------------------------
  118. Display Forum Category and the Forum information
  119. -----------------------------------------------------------
  120. */
  121. // we are getting all the information about the current forum and forum category.
  122. // note pcool: I tried to use only one sql statement (and function) for this
  123. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
  124. $sql="SELECT * FROM $table_posts posts, $table_users users
  125. WHERE posts.thread_id='".$current_thread['thread_id']."'
  126. AND posts.poster_id=users.user_id
  127. ORDER BY posts.post_id ASC";
  128. $result=Database::query($sql, __FILE__, __LINE__);
  129. echo "<table width=\"100%\" cellspacing=\"5\" border=\"0\">\n";
  130. while ($row=Database::fetch_array($result)) {
  131. echo "\t<tr>\n";
  132. echo "\t\t<td rowspan=\"2\" class=\"forum_message_left\">";
  133. if ($row['user_id']=='0') {
  134. $name=$row['poster_name'];
  135. } else {
  136. $name=api_get_person_name($row['firstname'], $row['lastname']);
  137. }
  138. echo $name.'<br />';
  139. echo $row['post_date'].'<br /><br />';
  140. echo "</td>\n";
  141. echo "\t\t<td class=\"forum_message_post_title\">".Security::remove_XSS($row['post_title'])."</td>\n";
  142. echo "\t</tr>\n";
  143. echo "\t<tr>\n";
  144. echo "\t\t<td class=\"forum_message_post_text\">".Security::remove_XSS($row['post_text'],STUDENT)."</td>\n";
  145. echo "\t</tr>\n";
  146. }
  147. echo "</table>";
  148. ?>
  149. </body>
  150. </html>