2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
12 // $Id: posts.inc.php 4812 2005-06-07 19:52:15Z joel $
14 if (!defined('AT_INCLUDE_PATH')) { exit; }
19 //Number of posts to display
24 // global $_course_id is set when a guest accessing a public course.
25 // This is to solve the issue that the google indexing fails as the session vars are lost.
27 if (isset($_SESSION['course_id'])) $_course_id = $_SESSION['course_id'];
29 $forum_list = get_group_concat('forums_courses', 'forum_id', "course_id={$_course_id}");
30 if ($forum_list != 0) {
31 $sql = "SELECT subject, post_id, forum_id, member_id FROM ".TABLE_PREFIX."forums_threads WHERE parent_id=0 AND forum_id IN ($forum_list) ORDER BY last_comment DESC LIMIT $post_limit";
32 $result = mysql_query($sql, $db);
34 if (mysql_num_rows($result) > 0) {
35 while ($row = mysql_fetch_assoc($result)) {
36 echo '° <a href="' . $_base_path.url_rewrite('forum/view.php?fid=' . $row['forum_id'] . htmlentities(SEP) . 'pid=' . $row['post_id']) . '" title="' . $row['subject'] . ': ' . htmlspecialchars(get_display_name($row['member_id'])) . '">' . AT_print(validate_length($row['subject'], 20, VALIDATE_LENGTH_FOR_DISPLAY), 'forums_threads.subject') . '</a><br />';
39 echo '<strong>'._AT('none_found').'</strong>';
42 echo '<strong>'._AT('none_found').'</strong>';
45 $savant->assign('dropdown_contents', ob_get_contents());
48 $savant->assign('title', _AT('forum_posts'));
49 $savant->display('include/box.tmpl.php');