Changeset 307 for minimanager/forum.php
- Timestamp:
- Mar 13, 2008, 8:18:42 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/forum.php
r304 r307 97 97 if (isset($_COOKIE["lang"])){ 98 98 $forumlang = $_COOKIE["lang"]; 99 if (!file_exists("lang/ forum_$forumlang.php")) $forumlang = $language;99 if (!file_exists("lang/Forum_$forumlang.php")) $forumlang = $language; 100 100 } else $forumlang = $language; 101 require_once("lang/ forum_$forumlang.php");101 require_once("lang/Forum_$forumlang.php"); 102 102 103 103 foreach($forum_skeleton as $cid => $category){ … … 120 120 global $enablesidecheck, $forum_skeleton, $forum_lang, $user_lvl, $output, $realm_db; 121 121 if($enablesidecheck) 122 $side = get_side(); 123 $mysql = new SQL; 124 $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 125 $result = $mysql->query("SELECT `authorname`,`id`,`name`,`forum` FROM `posts` WHERE `id` IN (SELECT MAX(`id`) FROM `posts` GROUP BY `forum`) ORDER BY `forum`;"); 126 $lasts = array(); 127 if($mysql->num_rows($result) > 0){ 128 while($row = $mysql->fetch_row($result)) 129 $lasts[$row[3]] = $row; 130 } 131 $output .= "<div class=\"top\"><h1>{$forum_lang["forums"]}</h1>{$forum_lang["you_are_here"]} : <a href=\"forum.php\">{$forum_lang["forum_index"]}</a></div><center><table class=\"lined\">"; 132 foreach($forum_skeleton as $category){ 133 if(($category["level_read"] > $user_lvl)) 122 $side = get_side(); 123 $mysql = new SQL; 124 $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 125 $result = $mysql->query("SELECT `authorname`,`id`,`name`,`time`,`forum` FROM `posts` WHERE `id` IN (SELECT MAX(`id`) FROM `posts` GROUP BY `forum`) ORDER BY `forum`;"); 126 $lasts = array(); 127 if($mysql->num_rows($result) > 0){ 128 while($row = $mysql->fetch_row($result)) 129 $lasts[$row[4]] = $row; 130 } 131 $output .= "<div class=\"top\"><h1>{$forum_lang["forums"]}</h1>{$forum_lang["you_are_here"]} : <a href=\"forum.php\">{$forum_lang["forum_index"]}</a></div><center><table class=\"lined\">"; 132 foreach($forum_skeleton as $category){ if(($category["level_read"] > $user_lvl)) 134 133 continue; 135 134 if($user_lvl == 0 && $enablesidecheck){ … … 138 137 continue; 139 138 else if($category["side_access"] != $side) // Forumside different of the user side 140 continue; 141 } 142 } 143 $output .= "<tr><td class=\"head\" align=\"left\" colspan=\"2\">".$category["name"]."</td></tr>"; 144 foreach($category["forums"] as $id => $forum){ 145 if($forum["level_read"] > $user_lvl) 146 continue; 147 if($user_lvl == 0 && $enablesidecheck){ 139 continue; 140 } 141 } 142 $output .= "<tr><td class=\"head\" align=\"left\">".$category["name"]."</td> 143 <td class=\"head\">{$forum_lang["topics"]}</td> 144 <td class=\"head\">{$forum_lang["replies"]}</td> 145 <td class=\"head\" align=\"right\">".$forum_lang["last_post"]."</td></tr>"; 146 foreach($category["forums"] as $id => $forum){ 147 if($forum["level_read"] > $user_lvl) 148 continue; if($user_lvl == 0 && $enablesidecheck){ 148 149 if($forum["side_access"] != "ALL"){ // Not an all side forum 149 150 if($side == "NO") // No char 150 151 continue; 151 152 else if($forum["side_access"] != $side) // Forumside different of the user side 152 continue; 153 } 154 } 155 $output .= "<tr><td align=\"left\"><a href=\"forum.php?action=view_forum&id=$id\">{$forum["name"]}</a><br />{$forum["desc"]}</td>"; 156 if(isset($lasts[$id])){ 157 $lasts[$id][2] = htmlspecialchars($lasts[$id][2]); 158 $output .= "<td align=\"right\">{$forum_lang["last_post_by"]} {$lasts[$id][0]} {$forum_lang["in"]} <a href=\"forum.php?action=view_topic&postid={$lasts[$id][1]}\">{$lasts[$id][2]}</a></td></tr>"; 159 } 160 else{ 161 $output .= "<td align=\"right\">{$forum_lang["no_topics"]}</td></tr>"; 162 } 153 continue; 154 } 155 } 156 $totaltopics = $mysql->query("SELECT id FROM posts WHERE forum = '$id' AND id = `topic`;"); 157 $numtopics = $mysql->num_rows($totaltopics); 158 $totalreplies = $mysql->query("SELECT id FROM posts WHERE forum = '$id';"); 159 $numreplies = $mysql->num_rows($totalreplies); 160 $output .= "<tr><td align=\"left\"><a href=\"forum.php?action=view_forum&id=$id\">{$forum["name"]}</a><br />{$forum["desc"]}</td> 161 <td>{$numtopics}</td> 162 <td>{$numreplies}</td>"; 163 if(isset($lasts[$id])){ 164 $lasts[$id][2] = htmlspecialchars($lasts[$id][2]); 165 $output .= "<td align=\"right\"><a href=\"forum.php?action=view_topic&postid={$lasts[$id][1]}\">{$lasts[$id][2]}</a><br />by {$lasts[$id][0]} <br /> {$lasts[$id][3]} </td></tr>"; 166 } 167 else{ 168 $output .= "<td align=\"right\">{$forum_lang["no_topics"]}</td></tr>"; 169 } 163 170 } 164 171 } … … 294 301 // Thx qsa for the query structure 295 302 $query = "SELECT account,name,SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ', 37),' ',-1) AS gen,race,class, 296 SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',35),' ',-1) AS level,(SELECT gmlevel FROM `{$realm_db['name']}`.account WHERE `{$realm_db['name']}`.account.id = `{$characters_db[$realm_id]['name']}`.character .account) as gmlevel297 FROM `{$characters_db[$realm_id]['name']}`.character WHERE totaltime IN ( SELECT MAX(totaltime) FROM `{$characters_db[$realm_id]['name']}`.characterWHERE account IN (";303 SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',35),' ',-1) AS level,(SELECT gmlevel FROM `{$realm_db['name']}`.account WHERE `{$realm_db['name']}`.account.id = `{$characters_db[$realm_id]['name']}`.characters.account) as gmlevel 304 FROM `{$characters_db[$realm_id]['name']}`.characters WHERE totaltime IN ( SELECT MAX(totaltime) FROM `{$characters_db[$realm_id]['name']}`.characters WHERE account IN ("; 298 305 while($post = $mysql->fetch_row($posts)){ 299 306 $query .= "$post[1],";
Note:
See TracChangeset
for help on using the changeset viewer.