1 | <?php |
1 | <?php |
2 | /*---------------------------------------------------+ |
2 | /*---------------------------------------------------+ |
3 | | PHP-Fusion 6 Content Management System |
3 | | PHP-Fusion 6 Content Management System |
4 | +----------------------------------------------------+ |
4 | +----------------------------------------------------+ |
5 | | Copyright © 2002 - 2006 Nick Jones |
5 | | Copyright © 2002 - 2006 Nick Jones |
6 | | http://www.php-fusion.co.uk/ |
6 | | http://www.php-fusion.co.uk/ |
7 | +----------------------------------------------------+ |
7 | +----------------------------------------------------+ |
8 | | Released under the terms & conditions of v2 of the |
8 | | Released under the terms & conditions of v2 of the |
9 | | GNU General Public License. For details refer to |
9 | | GNU General Public License. For details refer to |
10 | | the included gpl.txt file or visit http://gnu.org |
10 | | the included gpl.txt file or visit http://gnu.org |
11 | +----------------------------------------------------*/ |
11 | +----------------------------------------------------*/ |
12 | require_once "../maincore.php"; |
12 | require_once "../maincore.php"; |
13 | require_once BASEDIR."subheader.php"; |
13 | require_once BASEDIR."subheader.php"; |
14 | require_once BASEDIR."side_left.php"; |
14 | require_once BASEDIR."side_left.php"; |
15 | include LOCALE.LOCALESET."forum/main.php"; |
15 | include LOCALE.LOCALESET."forum/main.php"; |
16 | |
16 | |
17 | if (!isset($lastvisited) || !isNum($lastvisited)) $lastvisited = time(); |
17 | if (!isset($lastvisited) || !isNum($lastvisited)) $lastvisited = time(); |
18 | |
18 | |
19 | opentable($locale['400']); |
19 | opentable($locale['400']); |
20 | echo "<table cellpadding='0' cellspacing='0' width='100%' class='tbl-border'> |
20 | echo "<table cellpadding='0' cellspacing='0' width='100%' class='tbl-border'> |
21 | <tr> |
21 | <tr> |
22 | <td> |
22 | <td> |
23 | <table border='0' cellpadding='0' cellspacing='1' width='100%'> |
23 | <table border='0' cellpadding='0' cellspacing='1' width='100%'> |
24 | <tr> |
24 | <tr> |
25 | <td colspan='2' class='tbl2'>".$locale['401']."</td> |
25 | <td colspan='2' class='tbl2'>".$locale['401']."</td> |
26 | <td align='center' width='50' class='tbl2'>".$locale['402']."</td> |
26 | <td align='center' width='50' class='tbl2'>".$locale['402']."</td> |
27 | <td align='center' width='50' class='tbl2'>".$locale['403']."</td> |
27 | <td align='center' width='50' class='tbl2'>".$locale['403']."</td> |
28 | <td width='120' class='tbl2'>".$locale['404']."</td> |
28 | <td width='120' class='tbl2'>".$locale['404']."</td> |
29 | </tr>\n"; |
29 | </tr>\n"; |
30 | |
30 | |
31 | $forum_list = ""; $current_cat = ""; |
31 | $forum_list = ""; $current_cat = ""; |
32 | $result = dbquery( |
32 | $result = dbquery( |
33 | "SELECT f.*, COUNT(t.thread_id) AS thread_count, MAX(t.thread_lastpost) AS last_post, f2.forum_name AS forum_cat_name, u.user_id, u.user_name FROM ".$db_prefix."forums f |
33 | "SELECT f.*, COUNT(t.thread_id) AS thread_count, MAX(t.thread_lastpost) AS last_post, f2.forum_name AS forum_cat_name, u.user_id, u.user_name, u.user_avatar FROM ".$db_prefix."forums f |
34 | LEFT JOIN ".$db_prefix."threads t USING(forum_id) |
34 | LEFT JOIN ".$db_prefix."threads t USING(forum_id) |
35 | LEFT JOIN ".$db_prefix."forums f2 ON f.forum_cat = f2.forum_id |
35 | LEFT JOIN ".$db_prefix."forums f2 ON f.forum_cat = f2.forum_id |
36 | LEFT JOIN ".$db_prefix."users u ON f.forum_lastuser = u.user_id |
36 | LEFT JOIN ".$db_prefix."users u ON f.forum_lastuser = u.user_id |
37 | WHERE ".groupaccess('f.forum_access')." AND f.forum_cat!='0' GROUP BY forum_id ORDER BY f2.forum_order ASC, f.forum_order ASC" |
37 | WHERE ".groupaccess('f.forum_access')." AND f.forum_cat!='0' GROUP BY forum_id ORDER BY f2.forum_order ASC, f.forum_order ASC" |
38 | ); |
38 | ); |
39 | if (dbrows($result) != 0) { |
39 | if (dbrows($result) != 0) { |
40 | while ($data = dbarray($result)) { |
40 | while ($data = dbarray($result)) { |
41 | if ($data['forum_cat_name'] != $current_cat) { |
41 | if ($data['forum_cat_name'] != $current_cat) { |
42 | $current_cat = $data['forum_cat_name']; |
42 | $current_cat = $data['forum_cat_name']; |
43 | echo "<tr>\n<td colspan='5' class='forum-caption'>".$data['forum_cat_name']."</td>\n</tr>\n"; |
43 | echo "<tr>\n<td colspan='5' class='forum-caption'>".$data['forum_cat_name']."</td>\n</tr>\n"; |
44 | } |
44 | } |
45 | $moderators = ""; |
45 | $moderators = ""; |
46 | if ($data['forum_moderators']) { |
46 | if ($data['forum_moderators']) { |
47 | $res = "user_id='".str_replace(".", "' OR user_id='", $data['forum_moderators'])."'"; |
47 | $res = "user_id='".str_replace(".", "' OR user_id='", $data['forum_moderators'])."'"; |
48 | $result2 = dbquery("SELECT user_id,user_name FROM ".$db_prefix."users WHERE (".$res.")"); |
48 | $result2 = dbquery("SELECT user_id,user_name FROM ".$db_prefix."users WHERE (".$res.")"); |
49 | while ($data2 = dbarray($result2)) { |
49 | while ($data2 = dbarray($result2)) { |
50 | if ($moderators) $moderators .= ", "; |
50 | if ($moderators) $moderators .= ", "; |
51 | $moderators .= "<a href='".BASEDIR."profile.php?lookup=".$data2['user_id']."'>".$data2['user_name']."</a>"; |
51 | $moderators .= "<a href='".BASEDIR."profile.php?lookup=".$data2['user_id']."'>".$data2['user_name']."</a>"; |
52 | } |
52 | } |
53 | } |
53 | } |
54 | if ($data['last_post'] > $lastvisited) { |
54 | if ($data['last_post'] > $lastvisited) { |
55 | $fim = "<img src='".THEME."forum/foldernew.gif' alt='".$locale['560']."'>"; |
55 | $fim = "<img src='".THEME."forum/foldernew.gif' alt='".$locale['560']."'>"; |
56 | } else { |
56 | } else { |
57 | $fim = "<img src='".THEME."forum/folder.gif' alt='".$locale['561']."'>"; |
57 | $fim = "<img src='".THEME."forum/folder.gif' alt='".$locale['561']."'>"; |
58 | } |
58 | } |
59 | echo "<tr> |
59 | echo "<tr> |
60 | <td align='center' class='tbl2'>$fim</td> |
60 | <td align='center' class='tbl2'>$fim</td> |
61 | <td class='tbl1'><a href='viewforum.php?forum_id=".$data['forum_id']."'>".$data['forum_name']."</a><br> |
61 | <td class='tbl1'><a href='viewforum.php?forum_id=".$data['forum_id']."'>".$data['forum_name']."</a><br> |
62 | <span class='small'>".$data['forum_description'].($moderators ? "<br>\n".$locale['411'].$moderators."</span></td>\n" : "</span></td>\n")." |
62 | <span class='small'>".$data['forum_description'].($moderators ? "<br>\n".$locale['411'].$moderators."</span></td>\n" : "</span></td>\n")." |
63 | <td align='center' class='tbl2'>".$data['thread_count']."</td> |
63 | <td align='center' class='tbl2'>".$data['thread_count']."</td> |
64 | <td align='center' class='tbl1'>".dbcount("(post_id)", "posts", "forum_id='".$data['forum_id']."'")."</td> |
64 | <td align='center' class='tbl1'>".dbcount("(post_id)", "posts", "forum_id='".$data['forum_id']."'")."</td> |
65 | <td class='tbl2'>"; |
65 | <td class='tbl2' align='right' width='20%'>"; |
66 | if ($data['forum_lastpost'] == 0) { |
66 | if ($data['forum_lastpost'] == 0) { |
67 | echo $locale['405']."</td>\n</tr>\n"; |
67 | echo $locale['405']."</td>\n</tr>\n"; |
68 | } else { |
68 | } else { |
69 | echo showdate("forumdate", $data['forum_lastpost'])."<br> |
69 | echo "<table> |
70 | <span class='small'>".$locale['406']."<a href='".BASEDIR."profile.php?lookup=".$data['forum_lastuser']."'>".$data['user_name']."</a></span></td> |
70 | <tr> |
| |
71 | <td>".showdate("forumdate", $data['forum_lastpost'])."<br><span class='small''>".$locale['406']."<a href='".BASEDIR."profile.php?lookup=".$data['forum_lastuser']."'>".$data['user_name']."</a></span> </td> |
| |
72 | <td>".($data['user_avatar'] ? "<img src='".IMAGES."avatars/".$data['user_avatar']."' width=50 alt='".$data['user_name']."'>" : "")."</td> |
| |
73 | </tr> |
| |
74 | </table> |
| |
75 | </td> |
71 | </tr>\n"; |
76 | </tr>\n"; |
72 | } |
77 | } |
73 | } |
78 | } |
74 | } else { |
79 | } else { |
75 | echo "<tr>\n<td colspan='5' class='tbl1'>".$locale['407']."</td>\n</tr>\n"; |
80 | echo "<tr>\n<td colspan='5' class='tbl1'>".$locale['407']."</td>\n</tr>\n"; |
76 | } |
81 | } |
77 | echo "</table> |
82 | echo "</table> |
78 | </td> |
83 | </td> |
79 | </tr> |
84 | </tr> |
80 | </table> |
85 | </table> |
81 | <table cellpadding='0' cellspacing='0' width='100%'> |
86 | <table cellpadding='0' cellspacing='0' width='100%'> |
82 | <tr> |
87 | <tr> |
83 | <td class='forum'><br> |
88 | <td class='forum'><br> |
84 | <img src='".THEME."forum/foldernew.gif' alt='".$locale['560']."' style='vertical-align:middle;'> - ".$locale['409']."<br> |
89 | <img src='".THEME."forum/foldernew.gif' alt='".$locale['560']."' style='vertical-align:middle;'> - ".$locale['409']."<br> |
85 | <img src='".THEME."forum/folder.gif' alt='".$locale['561']."' style='vertical-align:middle;'> - ".$locale['410']." |
90 | <img src='".THEME."forum/folder.gif' alt='".$locale['561']."' style='vertical-align:middle;'> - ".$locale['410']." |
86 | </td><td align='right' valign='bottom' class='forum'> |
91 | </td><td align='right' valign='bottom' class='forum'> |
87 | <form name='searchform' method='post' action='".BASEDIR."search.php?stype=f'> |
92 | <form name='searchform' method='post' action='".BASEDIR."search.php?stype=f'> |
88 | <input type='text' name='stext' class='textbox' style='width:150px'> |
93 | <input type='text' name='stext' class='textbox' style='width:150px'> |
89 | <input type='submit' name='search' value='".$locale['550']."' class='button'> |
94 | <input type='submit' name='search' value='".$locale['550']."' class='button'> |
90 | </form> |
95 | </form> |
91 | </td> |
96 | </td> |
92 | </tr> |
97 | </tr> |
93 | </table>\n"; |
98 | </table>\n"; |
94 | closetable(); |
99 | closetable(); |
95 | |
100 | |
96 | require_once BASEDIR."side_right.php"; |
101 | require_once BASEDIR."side_right.php"; |
97 | require_once BASEDIR."footer.php"; |
102 | require_once BASEDIR."footer.php"; |
98 | ?> |
103 | ?> |
| |
104 | |