diff options
Diffstat (limited to 'includes/footer.php')
-rwxr-xr-x | includes/footer.php | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/includes/footer.php b/includes/footer.php index dadb6f5..0a93ae9 100755 --- a/includes/footer.php +++ b/includes/footer.php | |||
@@ -93,14 +93,14 @@ if (!isset($noRightbar)) | |||
93 | $i=0; | 93 | $i=0; |
94 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | 94 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) |
95 | { | 95 | { |
96 | $getuser = "SELECT * FROM users WHERE username = \"" . $getcomments3[$i]['username'] . "\""; | 96 | $getuser = "SELECT * FROM phpbb_users WHERE username = \"" . $getcomments3[$i]['username'] . "\""; |
97 | $getuser2 = mysql_query($getuser); | 97 | $getuser2 = mysql_query($getuser); |
98 | $getuser3 = mysql_fetch_array($getuser2); | 98 | $getuser3 = mysql_fetch_array($getuser2); |
99 | 99 | ||
100 | if ($getuser3['username'] == $getcomments3[$i]['username']) | 100 | if ($getuser3['username'] == $getcomments3[$i]['username']) |
101 | { | 101 | { |
102 | $username = $getuser3['username']; | 102 | $username = $getuser3['username']; |
103 | $website = $getuser3['website']; | 103 | $website = $getuser3['user_website']; |
104 | } else { | 104 | } else { |
105 | $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $getcomments3[$i]['username'] . "\""; | 105 | $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $getcomments3[$i]['username'] . "\""; |
106 | $getanon2 = mysql_query($getanon); | 106 | $getanon2 = mysql_query($getanon); |
@@ -125,7 +125,7 @@ if (!isset($noRightbar)) | |||
125 | 'CODED' => $getpost3['slug'], | 125 | 'CODED' => $getpost3['slug'], |
126 | 'ENDING' => '/', | 126 | 'ENDING' => '/', |
127 | 'TITLE' => stripslashes($getpost3['title']), | 127 | 'TITLE' => stripslashes($getpost3['title']), |
128 | 'AUTHOR' => (($website != '') ? '<A HREF="http://' . $website . '">' . $username . '</A>' : $username))); | 128 | 'AUTHOR' => (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username))); |
129 | $i++; | 129 | $i++; |
130 | } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE) | 130 | } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE) |
131 | { | 131 | { |
@@ -136,11 +136,12 @@ if (!isset($noRightbar)) | |||
136 | 'CODED' => $num, | 136 | 'CODED' => $num, |
137 | 'ENDING' => '.php', | 137 | 'ENDING' => '.php', |
138 | 'TITLE' => 'Quote #' . $num, | 138 | 'TITLE' => 'Quote #' . $num, |
139 | 'AUTHOR' => (($website != '') ? '<A HREF="http://' . $website . '">' . $username . '</A>' : $username))); | 139 | 'AUTHOR' => (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username))); |
140 | $i++; | 140 | $i++; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | $users = array(); | ||
144 | $getusers = "SELECT DISTINCT username FROM comments"; | 145 | $getusers = "SELECT DISTINCT username FROM comments"; |
145 | $getusers2 = mysql_query($getusers); | 146 | $getusers2 = mysql_query($getusers); |
146 | $i=0; | 147 | $i=0; |
@@ -150,14 +151,14 @@ if (!isset($noRightbar)) | |||
150 | $getcount2 = mysql_query($getcount); | 151 | $getcount2 = mysql_query($getcount); |
151 | $getcount3 = mysql_fetch_array($getcount2); | 152 | $getcount3 = mysql_fetch_array($getcount2); |
152 | 153 | ||
153 | $getuser = "SELECT * FROM users WHERE username = \"" . $getusers3[$i]['username'] . "\""; | 154 | $getuser = "SELECT * FROM phpbb_users WHERE username = \"" . $getusers3[$i]['username'] . "\""; |
154 | $getuser2 = mysql_query($getuser); | 155 | $getuser2 = mysql_query($getuser); |
155 | $getuser3 = mysql_fetch_array($getuser2); | 156 | $getuser3 = mysql_fetch_array($getuser2); |
156 | 157 | ||
157 | if ($getuser3['username'] == $getusers3[$i]['username']) | 158 | if ($getuser3['username'] == $getusers3[$i]['username']) |
158 | { | 159 | { |
159 | $username = $getuser3['username']; | 160 | $username = $getuser3['username']; |
160 | $website = $getuser3['website']; | 161 | $website = $getuser3['user_website']; |
161 | } else { | 162 | } else { |
162 | $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $getusers3[$i]['username'] . "\""; | 163 | $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $getusers3[$i]['username'] . "\""; |
163 | $getanon2 = mysql_query($getanon); | 164 | $getanon2 = mysql_query($getanon); |
@@ -170,23 +171,39 @@ if (!isset($noRightbar)) | |||
170 | } | 171 | } |
171 | } | 172 | } |
172 | 173 | ||
173 | $name = (($website != '') ? '<A HREF="http://' . $website . '">' . $username . '</A>' : $username); | 174 | $name = (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username); |
174 | $users[$name] = $getcount3[0]; | 175 | $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']); |
175 | 176 | ||
176 | $i++; | 177 | $i++; |
177 | } | 178 | } |
178 | 179 | ||
179 | arsort($users); | 180 | function count_sort($a, $b) |
181 | { | ||
182 | $a = $a['count']; | ||
183 | $b = $b['count']; | ||
184 | |||
185 | if ($a > $b) | ||
186 | { | ||
187 | return -1; | ||
188 | } else if ($a < $b) | ||
189 | { | ||
190 | return 1; | ||
191 | } else { | ||
192 | return 0; | ||
193 | } | ||
194 | } | ||
195 | |||
196 | usort($users, 'count_sort'); | ||
180 | $i=0; | 197 | $i=0; |
181 | foreach ($users as $name => $count) | 198 | foreach ($users as $value) |
182 | { | 199 | { |
183 | if ($i == 5) | 200 | if ($i == 5) |
184 | { | 201 | { |
185 | break; | 202 | break; |
186 | } | 203 | } |
187 | 204 | ||
188 | $template->adds_block('TOP', array( 'USERNAME' => $name, | 205 | $template->adds_block('TOP', array( 'USERNAME' => $value['name'], |
189 | 'COUNT' => $count)); | 206 | 'COUNT' => $value['count'])); |
190 | $i++; | 207 | $i++; |
191 | } | 208 | } |
192 | 209 | ||