move code up one directory
[atutor.git] / mods / _standard / forums / forum / index.php
1 <?php
2 /****************************************************************************/
3 /* ATutor                                                                                                                                       */
4 /****************************************************************************/
5 /* Copyright (c) 2002-2010                                                  */
6 /* Inclusive Design Institute                                               */
7 /* http://atutor.ca                                                                                                                     */
8 /*                                                                                                                                                      */
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.                                                        */
12 /****************************************************************************/
13 // $Id$
14
15 define('AT_INCLUDE_PATH', '../../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 $fid = intval($_GET['fid']);
18
19 if (!isset($_GET['fid']) || !$fid) {
20         header('Location: list.php');
21         exit;
22 }
23 require(AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');
24
25 if (!valid_forum_user($fid)) {
26         require(AT_INCLUDE_PATH.'header.inc.php');
27         $msg->addError('FORUM_DENIED');
28         $msg->printErrors();
29         require(AT_INCLUDE_PATH.'footer.inc.php');
30 }
31
32 $_pages['mods/_standard/forums/forum/index.php']['title']    = get_forum_name($fid);
33 $_pages['mods/_standard/forums/forum/index.php']['parent']   = 'mods/_standard/forums/forum/list.php';
34 $_pages['mods/_standard/forums/forum/index.php']['children'] = array('mods/_standard/forums/forum/new_thread.php?fid='.$fid, 'search.php?search_within[]=forums');
35
36 $_pages['mods/_standard/forums/forum/new_thread.php?fid='.$fid]['title_var'] = 'new_thread';
37 $_pages['mods/_standard/forums/forum/new_thread.php?fid='.$fid]['parent']    = 'mods/_standard/forums/forum/index.php';
38
39 $_pages['search.php?search_within[]=forums']['title_var'] = 'search';
40 $_pages['search.php?search_within[]=forums']['parent']    = 'mods/_standard/forums/forum/index.php?fid='.$fid;
41
42 /* the last accessed field */
43 $last_accessed = array();
44 if ($_SESSION['valid_user'] && $_SESSION['enroll']) {
45         $sql    = "SELECT post_id, last_accessed + 0 AS last_accessed, subscribe FROM ".TABLE_PREFIX."forums_accessed WHERE member_id=$_SESSION[member_id]";
46         $result = mysql_query($sql, $db);
47         while ($row = mysql_fetch_assoc($result)) {
48                 $post_id = $row['post_id'];
49                 unset($row['post_id']);
50                 $last_accessed[$post_id] = $row;
51
52         }
53 }
54
55 require(AT_INCLUDE_PATH . 'header.inc.php');
56
57 require(AT_INCLUDE_PATH . '../mods/_standard/forums/html/forum.inc.php');
58
59 require(AT_INCLUDE_PATH . 'footer.inc.php');
60 ?>