| [ Index ] |
PHP Cross Reference of Nuke-Evolution v2.0.5 |
[Summary view] [Print] [Text view]
1 <?php 2 /*======================================================================= 3 Nuke-Evolution Basic: Enhanced PHP-Nuke Web Portal System 4 =======================================================================*/ 5 6 /************************************************************************ 7 Nuke-Evolution: Enhanced Forum Block 8 ============================================ 9 Copyright (c) 2005 by The Nuke-Evolution Team 10 11 Filename : block-Forums.php 12 Author : JeFFb68CAM (www.Evo-Mods.com) 13 Version : 3.0 14 Date : 11.05.2005 (mm.dd.yyyy) 15 16 Description : Enhanced Forum Block will show all your recent topics 17 on your homepage. It will match any theme you use for 18 your PHP-Nuke / Nuke-Evolution website. It is cached 19 so that it provides optimum performance with your 20 Nuke-Evolution web portal. 21 ************************************************************************/ 22 23 /*****[CHANGES]********************************************************** 24 -=[Base]=- 25 Nuke Patched v3.1.0 06/26/2005 26 Caching System v1.0.0 10/30/2005 27 -=[Mod]=- 28 Advanced Username Color v1.0.5 10/30/2005 29 ************************************************************************/ 30 31 if(!defined('NUKE_EVO')) exit; 32 33 global $prefix, $db, $sitename, $admin, $ThemeSel, $user_prefix, $board_config, $currentlang, $cache; 34 35 /***[CONFIGURATION]******************************************************/ 36 /* These options give you the ability to customize this block */ 37 /************************************************************************/ 38 $HideViewReadOnly = 1; # Set this to 1 to hide posts that a user it not authorized to see, set to 0 to let them see any and all posts. 39 $AlternateRowClass = 0; # Set this to 1 to give your block a little bit of 'class' by changing the style of each row, set to 0 to disable. 40 $Last_New_Topics = 10; # Set this to however many topics you'd like to be displayed. 41 $SplitAnnouncements = 1; # Set this to 1 to split your board's most recent Announcements and Global Announcements from the normal topics. 42 $NumAnnouncements = 2; # Set this to the number of announcements you'd like to be displayed. 43 /***[CONFIGURATION]******************************************************/ 44 /* These options give you the ability to customize this block */ 45 /************************************************************************/ 46 47 function make_a_row($row_class, $topic_first_post_id, $topic_title, $forum_name, $forum_id, $user_id, $username, $topic_replies, $topic_views, $post_time, $topic_last_post_id, $poster_name, $poster_id) { 48 global $ThemeSel; 49 50 $row = "<tr>" 51 ."<td height=\"34\" nowrap=\"nowrap\" class=\"$row_class\"><img src=\"themes/$ThemeSel/forums/images/folder_new.gif\" alt=\"New Topic\" border=\"0\" /></td>" 52 ."<td width=\"100%\" class=\"$row_class\"><a href=\"modules.php?name=Forums&file=viewtopic&p=$topic_first_post_id#$topic_first_post_id\">$topic_title</a></td>" 53 ."<td align=\"center\" class=\"$row_class\"><a href=\"modules.php?name=Forums&file=viewforum&f=$forum_id\">$forum_name</a></td>" 54 ."<td align=\"center\" class=\"$row_class\"><a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\">$username</a></td>" 55 ."<td align=\"center\" class=\"$row_class\">$topic_replies</td>" 56 ."<td align=\"center\" class=\"$row_class\">$topic_views</td>" 57 ."<td align=\"center\" nowrap=\"nowrap\" class=\"$row_class\"><font size=\"-2\"><i> $post_time </i></font><br />" 58 ."<a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$poster_id\">$poster_name</a> <a href=\"modules.php?name=Forums&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\">" 59 ."<img src=\"themes/$ThemeSel/forums/images/icon_newest_reply.gif\" alt=\"New Post\" border=\"0\"></a></td>" 60 ."</tr>"; 61 return $row; 62 } 63 64 function make_table($posts, $announcements, $SplitAnnouncements) { 65 $table = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">" 66 ."<tr>" 67 ."<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" 68 ."<tr>" 69 ."<td><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" class=\"forumline\">" 70 ."<tr>" 71 ."<th height=\"35\" colspan=\"2\" align=\"center\" nowrap=\"nowrap\" class=\"thcornerl\"><span class=\"block-title\"><strong>Topic</strong></span></th>" 72 ."<th width=\"70\" align=\"center\" nowrap=\"nowrap\" class=\"thtop\"><span class=\"block-title\"><strong> Forum </strong></span></th>" 73 ."<th width=\"70\" align=\"center\" nowrap=\"nowrap\" class=\"thtop\"><span class=\"block-title\"><strong> Author </strong></span></th>" 74 ."<th width=\"50\" align=\"center\" nowrap=\"nowrap\" class=\"thtop\"><span class=\"block-title\"><strong> Replies </strong></span></th>" 75 ."<th width=\"38\" align=\"center\" nowrap=\"nowrap\" class=\"thtop\"><span class=\"block-title\"><strong> Views </strong></span></th>" 76 ."<th align=\"center\" nowrap=\"nowrap\" class=\"thcornerr\"><span class=\"block-title\"><strong> Last Post </strong></span></th>" 77 ."</tr>"; 78 if ($SplitAnnouncements) { 79 $table .= "<tr><th class=\"thTop\" colspan=\"7\" height=\"28\" align=\"left\"><span class=\"cattitle\">Announcements</span></th></tr>"; 80 $table .= ($announcements) ? $announcements : "<tr><td class=\"row3\" colspan=\"7\" height=\"15\">There are no announcements.</td></tr>"; 81 } 82 $table .= ($SplitAnnouncements) ? "<tr><th class=\"thTop\" colspan=\"7\" height=\"28\" align=\"left\"><span class=\"cattitle\">Topics</span></th></tr>" : ""; 83 $table .= ($posts) ? $posts : "<tr><td class=\"row3\" colspan=\"7\" height=\"15\">There are no topics.</td></tr>"; 84 $table .= "<tr>" 85 ."<th class=\"thBottom\" height=\"28\" colspan=\"7\" align=\"right\" class=\"catbottom\">[ <a href=\"modules.php?name=Forums&file=recent\">Recent Topics</a> ] </th>" 86 ."</tr>" 87 ."</table></td>" 88 ."</tr>" 89 ."</table></td>" 90 ."</tr>" 91 ."</table>"; 92 return $table; 93 } 94 95 $Count_Topics = 0; 96 $where = ($SplitAnnouncements) ? "AND t.topic_type != '2' AND t.topic_type != '3'" : ""; 97 $where .= ($HideViewReadOnly) ? " AND f.auth_view = '0' AND f.auth_read = '0'" : ""; 98 /*****[BEGIN]****************************************** 99 [ Base: Caching System v3.0.0 ] 100 ******************************************************/ 101 //if (!$TopicData = $cache->load('TopicData', 'home')) { 102 /*****[END]******************************************** 103 [ Base: Caching System v3.0.0 ] 104 ******************************************************/ 105 $TopicData = array(); 106 107 $result = $db->sql_query( "SELECT t.topic_id, t.topic_type, f.forum_name, f.forum_id, t.topic_last_post_id, t.topic_first_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, p.post_time, p.poster_id, pu.username as postername, u.username, u.user_id FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f, ".$prefix."_bbposts p, ".$user_prefix."_users u, ".$user_prefix."_users pu WHERE t.forum_id=f.forum_id AND p.post_id=t.topic_last_post_id AND u.user_id=t.topic_poster AND pu.user_id=p.poster_id AND t.topic_moved_id = '0' $where ORDER BY topic_last_post_id DESC LIMIT $Last_New_Topics"); 108 while ( list( $topic_id, $topic_type, $forum_name, $forum_id, $topic_last_post_id, $topic_first_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $post_time, $poster_id, $poster_name, $username, $user_id ) = $db->sql_fetchrow( $result)) 109 110 { 111 $TopicData[$topic_id]['topic_id'] = $topic_id; 112 $TopicData[$topic_id]['topic_type'] = $topic_type; 113 $TopicData[$topic_id]['forum_name'] = $forum_name; 114 $TopicData[$topic_id]['forum_id'] = $forum_id ; 115 $TopicData[$topic_id]['topic_last_post_id'] = $topic_last_post_id ; 116 $TopicData[$topic_id]['topic_first_post_id'] = $topic_first_post_id; 117 $TopicData[$topic_id]['topic_title'] = $topic_title; 118 $TopicData[$topic_id]['topic_poster'] = $topic_poster; 119 $TopicData[$topic_id]['topic_views'] = $topic_views; 120 $TopicData[$topic_id]['topic_replies'] = $topic_replies; 121 $TopicData[$topic_id]['post_time'] = $post_time; 122 $TopicData[$topic_id]['poster_id'] = $poster_id; 123 $TopicData[$topic_id]['poster_name'] = $poster_name; 124 $TopicData[$topic_id]['username'] = $username; 125 $TopicData[$topic_id]['user_id'] = $user_id; 126 } 127 $db->sql_freeresult($result); 128 /*****[BEGIN]****************************************** 129 [ Base: Caching System v3.0.0 ] 130 ******************************************************/ 131 // $cache->save('TopicData', 'home', $TopicData); 132 /*****[END]******************************************** 133 [ Base: Caching System v3.0.0 ] 134 ******************************************************/ 135 //} 136 $TopicData = (is_array($TopicData)) ? $TopicData : array(); 137 foreach($TopicData as $topic_info) { 138 $row_class = ($Count_Topics % 2 && $AlternateRowClass) ? "row3" : "row2"; 139 $Count_Topics += 1; 140 /*****[BEGIN]****************************************** 141 [ Mod: Advanced Username Color v1.0.5 ] 142 ******************************************************/ 143 $username = UsernameColor($topic_info['username']); 144 $poster_name = UsernameColor($topic_info['poster_name']); 145 /*****[END]******************************************** 146 [ Mod: Advanced Username Color v1.0.5 ] 147 ******************************************************/ 148 $post_time = EvoDate( $board_config['default_dateformat'] , $topic_info['post_time'] , $board_config['board_timezone'] ); 149 150 $posts .= make_a_row($row_class, $topic_info['topic_first_post_id'], $topic_info['topic_title'], $topic_info['forum_name'], $topic_info['forum_id'], $topic_info['user_id'], $username, $topic_info['topic_replies'], $topic_info['topic_views'], $post_time, $topic_info['topic_last_post_id'], $poster_name, $topic_info['poster_id']); 151 } 152 153 # Start Custom Announcements Addon 154 if ($SplitAnnouncements) { 155 $Count_Announcements = 0; 156 $where = ($HideViewReadOnly) ? " AND f.auth_view = '0' AND f.auth_read = '0'" : ""; 157 /*****[BEGIN]****************************************** 158 [ Base: Caching System v3.0.0 ] 159 ******************************************************/ 160 //if (!$AnnounceData = $cache->load('AnnounceData', 'home')) { 161 /*****[END]******************************************** 162 [ Base: Caching System v3.0.0 ] 163 ******************************************************/ 164 $AnnounceData = array(); 165 166 $result = $db->sql_query( "SELECT t.topic_id, t.topic_type, f.forum_name, f.forum_id, t.topic_last_post_id, t.topic_first_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, p.post_time, p.poster_id, pu.username, u.username, u.user_id FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f, ".$prefix."_bbposts p, ".$user_prefix."_users u, ".$user_prefix."_users pu WHERE t.forum_id=f.forum_id AND p.post_id=t.topic_last_post_id AND u.user_id=t.topic_poster AND t.topic_type != '0' AND t.topic_type != '1' AND t.topic_type < '20' AND pu.user_id=p.poster_id AND t.topic_moved_id = '0' $where ORDER BY topic_last_post_id DESC LIMIT $NumAnnouncements"); 167 while ( list( $topic_id, $topic_type, $forum_name, $forum_id, $topic_last_post_id, $topic_first_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $post_time, $poster_id, $poster_name, $username, $user_id ) = $db->sql_fetchrow( $result)) 168 169 { 170 $AnnounceData[$topic_id]['topic_id'] = $topic_id; 171 $AnnounceData[$topic_id]['topic_type'] = $topic_type; 172 $AnnounceData[$topic_id]['forum_name'] = $forum_name; 173 $AnnounceData[$topic_id]['forum_id'] = $forum_id ; 174 $AnnounceData[$topic_id]['topic_last_post_id'] = $topic_last_post_id ; 175 $AnnounceData[$topic_id]['topic_first_post_id'] = $topic_first_post_id; 176 $AnnounceData[$topic_id]['topic_title'] = $topic_title; 177 $AnnounceData[$topic_id]['topic_poster'] = $topic_poster; 178 $AnnounceData[$topic_id]['topic_views'] = $topic_views; 179 $AnnounceData[$topic_id]['topic_replies'] = $topic_replies; 180 $AnnounceData[$topic_id]['post_time'] = $post_time; 181 $AnnounceData[$topic_id]['poster_id'] = $poster_id; 182 $AnnounceData[$topic_id]['poster_name'] = $poster_name; 183 $AnnounceData[$topic_id]['username'] = $username; 184 $AnnounceData[$topic_id]['user_id'] = $user_id; 185 } 186 $db->sql_freeresult($result); 187 /*****[BEGIN]****************************************** 188 [ Base: Caching System v3.0.0 ] 189 ******************************************************/ 190 // $cache->save('AnnounceData', 'home', $AnnounceData); 191 /*****[END]******************************************** 192 [ Base: Caching System v3.0.0 ] 193 ******************************************************/ 194 //} 195 $AnnounceData = (is_array($AnnounceData)) ? $AnnounceData : array(); 196 foreach($AnnounceData as $announce_info) { 197 $row_class = ($Count_Announcements % 2 && $AlternateRowClass) ? "row3" : "row2"; 198 $Count_Announcements += 1; 199 /*****[BEGIN]****************************************** 200 [ Mod: Advanced Username Color v1.0.5 ] 201 ******************************************************/ 202 $username = UsernameColor($announce_info['username']); 203 $poster_name = UsernameColor($announce_info['poster_name']); 204 /*****[END]******************************************** 205 [ Mod: Advanced Username Color v1.0.5 ] 206 ******************************************************/ 207 $post_time = EvoDate( $board_config['default_dateformat'] , $announce_info['post_time'] , $board_config['board_timezone'] ); 208 209 $announcements .= make_a_row($row_class, $announce_info['topic_first_post_id'], $announce_info['topic_title'], $announce_info['forum_name'], $announce_info['forum_id'], $announce_info['user_id'], $username, $announce_info['topic_replies'], $announce_info['topic_views'], $post_time, $announce_info['topic_last_post_id'], $poster_name, $announce_info['poster_id']); 210 } 211 } 212 213 $content .= make_table($posts, $announcements, $SplitAnnouncements); 214 215 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jun 6 11:38:01 2007 | Cross-referenced by PHPXref 0.7 |