iframe_thread.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * These files are a complete rework of the forum. The database structure is
  5. * based on phpBB but all the code is rewritten. A lot of new functionalities
  6. * are added:
  7. * - forum categories and forums can be sorted up or down, locked or made invisible
  8. * - consistent and integrated forum administration
  9. * - forum options: are students allowed to edit their post?
  10. * moderation of posts (approval)
  11. * reply only forums (students cannot create new threads)
  12. * multiple forums per group
  13. * - sticky messages
  14. * - new view option: nested view
  15. * - quoting a message
  16. *
  17. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  18. * @copyright Ghent University
  19. *
  20. * @package chamilo.forum
  21. */
  22. /* INIT SECTION */
  23. /* Language Initialisation */
  24. // Name of the language file that needs to be included
  25. $language_file = 'forum';
  26. //$this_section = SECTION_COURSES;
  27. require_once '../inc/global.inc.php';
  28. /* ACCESS RIGHTS */
  29. // A notice for unauthorized people.
  30. api_protect_course_script(true);
  31. require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
  32. include_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
  33. $nameTools = get_lang('ToolForum');
  34. ?>
  35. <!DOCTYPE html
  36. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  37. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  38. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  39. <head>
  40. <title></title>
  41. <style type="text/css" media="screen, projection">
  42. /*<![CDATA[*/
  43. @import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
  44. /*]]>*/
  45. </style>
  46. </head>
  47. <body>
  48. <?php
  49. /* Including necessary files */
  50. require 'forumconfig.inc.php';
  51. require_once 'forumfunction.inc.php';
  52. /* MAIN DISPLAY SECTION */
  53. /* Retrieving forum and forum categorie information */
  54. // We are getting all the information about the current forum and forum category.
  55. // Note pcool: I tried to use only one sql statement (and function) for this,
  56. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table.
  57. $current_thread=get_thread_information($_GET['thread']); // Note: this has to be validated that it is an existing thread.
  58. $current_forum=get_forum_information($current_thread['forum_id']); // Note: this has to be validated that it is an existing forum.
  59. $current_forum_category=get_forumcategory_information($current_forum['forum_category']);
  60. /* Is the user allowed here? */
  61. // if the user is not a course administrator and the forum is hidden
  62. // then the user is not allowed here.
  63. if (!api_is_allowed_to_edit(false, true) AND ($current_forum['visibility'] == 0 OR $current_thread['visibility'] == 0)) {
  64. $forum_allow = forum_not_allowed_here();
  65. if ($forum_allow === false) {
  66. exit;
  67. }
  68. }
  69. /* Display Forum Category and the Forum information */
  70. // We are getting all the information about the current forum and forum category.
  71. // Note pcool: I tried to use only one sql statement (and function) for this,
  72. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table.
  73. $sql = "SELECT * FROM $table_posts posts, $table_users users
  74. WHERE posts.thread_id='".$current_thread['thread_id']."'
  75. AND posts.poster_id=users.user_id
  76. ORDER BY posts.post_id ASC";
  77. $result = Database::query($sql);
  78. echo "<table width=\"100%\" cellspacing=\"5\" border=\"0\">";
  79. while ($row = Database::fetch_array($result)) {
  80. echo "<tr>";
  81. echo "<td rowspan=\"2\" class=\"forum_message_left\">";
  82. if ($row['user_id']=='0') {
  83. $name = $row['poster_name'];
  84. } else {
  85. $name = api_get_person_name($row['firstname'], $row['lastname']);
  86. }
  87. echo $name.'<br />';
  88. echo api_convert_and_format_date($row['post_date']).'<br /><br />';
  89. echo "</td>";
  90. echo "<td class=\"forum_message_post_title\">".Security::remove_XSS($row['post_title'])."</td>";
  91. echo "</tr>";
  92. echo "<tr>";
  93. echo "<td class=\"forum_message_post_text\">".Security::remove_XSS($row['post_text'], STUDENT)."</td>";
  94. echo "</tr>";
  95. }
  96. echo "</table>";
  97. ?>
  98. </body>
  99. </html>