diff options
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/functions.php | 60 | ||||
-rwxr-xr-x | includes/header.php | 96 | ||||
-rw-r--r--[-rwxr-xr-x] | includes/layout.php (renamed from includes/footer.php) | 472 |
3 files changed, 356 insertions, 272 deletions
diff --git a/includes/functions.php b/includes/functions.php index 6b5d8e9..bc839df 100755 --- a/includes/functions.php +++ b/includes/functions.php | |||
@@ -376,4 +376,64 @@ function getTagColor($i) | |||
376 | } | 376 | } |
377 | } | 377 | } |
378 | 378 | ||
379 | function getLayout() | ||
380 | { | ||
381 | if (!isset($_COOKIE['layout'])) | ||
382 | { | ||
383 | return '7'; | ||
384 | } else { | ||
385 | return $_COOKIE['layout']; | ||
386 | } | ||
387 | } | ||
388 | |||
389 | function getRewriteURL() | ||
390 | { | ||
391 | if (!isset($_GET['area'])) | ||
392 | { | ||
393 | return '/'; | ||
394 | } else { | ||
395 | if ($_GET['area'] == 'blog') | ||
396 | { | ||
397 | if (isset($_GET['author'])) | ||
398 | { | ||
399 | return '/blog/author/' . $_GET['author'] . '.php'; | ||
400 | } else if (isset($_GET['tag'])) | ||
401 | { | ||
402 | return '/blog/tag/' . $_GET['tag'] . '.php'; | ||
403 | } else if (isset($_GET['post'])) | ||
404 | { | ||
405 | return '/blog/' . $_GET['post'] . '/'; | ||
406 | } else { | ||
407 | return '/blog/'; | ||
408 | } | ||
409 | } else if ($_GET['area'] == 'poll') | ||
410 | { | ||
411 | if (isset($_GET['id'])) | ||
412 | { | ||
413 | return '/poll/' . $_GET['id'] . '.php'; | ||
414 | } else { | ||
415 | return '/poll/'; | ||
416 | } | ||
417 | } else if ($_GET['area'] == 'quotes') | ||
418 | { | ||
419 | if (isset($_GET['act'])) | ||
420 | { | ||
421 | return '/quotes/' . $_GET['act'] . '.php'; | ||
422 | } else { | ||
423 | return '/quotes/'; | ||
424 | } | ||
425 | } else if ($_GET['area'] == 'error') | ||
426 | { | ||
427 | if (isset($_GET['id'])) | ||
428 | { | ||
429 | return '/error/' . $_GET['id'] . '.php'; | ||
430 | } else { | ||
431 | return '/error/'; | ||
432 | } | ||
433 | } else { | ||
434 | return '/' . $_GET['area'] . '/'; | ||
435 | } | ||
436 | } | ||
437 | } | ||
438 | |||
379 | ?> | 439 | ?> |
diff --git a/includes/header.php b/includes/header.php deleted file mode 100755 index 003e002..0000000 --- a/includes/header.php +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/header.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $headerTemp = new FITemplate('header'); | ||
26 | |||
27 | $headerTemp->add('CATEGORY',(isset($pageCategory)) ? $pageCategory : 'none'); | ||
28 | $headerTemp->add('AID',(isset($pageAID)) ? $pageAID : 'none'); | ||
29 | $headerTemp->add('EXTRATITLE',isset($title) ? ($title . ' - ') : ''); | ||
30 | $headerTemp->add(strtoupper($pageCategory) . 'ACTIVE', ' class="active"'); | ||
31 | |||
32 | if (($pageCategory != 'fourm') && ($pageCategory != 'wiki')) | ||
33 | { | ||
34 | $headerTemp->add('REDIRPAGE',rawurlencode($_SERVER['REQUEST_URI'])); | ||
35 | $headerTemp->add('LOGDATA',echoLogData()); | ||
36 | $headerTemp->add('SID',getSessionID()); | ||
37 | $headerTemp->adds_block('MEMBERS',array('exi' => 1)); | ||
38 | |||
39 | if (isAdmin()) | ||
40 | { | ||
41 | $headerTemp->adds_block('ADMIN',array('exi' => 1)); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | if (isset($hatNav) && is_array($hatNav)) | ||
46 | { | ||
47 | $headerTemp->adds_block('CREATE_HATNAV', array('exi'=>1)); | ||
48 | |||
49 | foreach ($hatNav as $item) | ||
50 | { | ||
51 | $headerTemp->adds_block('HATNAV',array('TITLE' => $item['title'], 'URL' => $item['url'], 'ICON' => $item['icon'])); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | $headerTemp->add('POTW', getPollOfTheWeek()); | ||
56 | |||
57 | $gethits = "SELECT * FROM config WHERE name = \"hits\""; | ||
58 | $gethits2 = mysql_query($gethits); | ||
59 | $gethits3 = mysql_fetch_array($gethits2); | ||
60 | $headerTemp->add('HITS', $gethits3['value']); | ||
61 | |||
62 | $gethits = "SELECT * FROM config WHERE name = \"todayHits\""; | ||
63 | $gethits2 = mysql_query($gethits); | ||
64 | $gethits3 = mysql_fetch_array($gethits2); | ||
65 | $headerTemp->add('TODAY', $gethits3['value']); | ||
66 | |||
67 | $headerTemp->add('DATEFINDER', sd_dateFinder()); | ||
68 | |||
69 | if ($usingIE) | ||
70 | { | ||
71 | $headerTemp->add('FLASH', 'It appears you are using Internet Explorer. Four Island is not likely to work properly in IE due to a <a href="http://www.webdevout.net/articles/beware-of-xhtml#ie">huge bug</a> in it. <a href="http://getfirefox.com/">There are better browsers out there, why not try one?</a>'); | ||
72 | } | ||
73 | |||
74 | $getaffs = "SELECT * FROM links WHERE type = \"affiliates\" ORDER BY id ASC"; | ||
75 | $getaffs2 = mysql_query($getaffs); | ||
76 | $i=0; | ||
77 | while ($getaffs3 = mysql_fetch_array($getaffs2)) | ||
78 | { | ||
79 | $headerTemp->adds_block('AFFILIATES', array( 'COLOR' => getTagColor($i++), | ||
80 | 'TITLE' => htmlentities($getaffs3['title']), | ||
81 | 'URL' => $getaffs3['url'])); | ||
82 | } | ||
83 | |||
84 | $getwebps = "SELECT * FROM links WHERE type = \"webprojs\" ORDER BY id ASC"; | ||
85 | $getwebps2 = mysql_query($getwebps); | ||
86 | $i=0; | ||
87 | while ($getwebps3 = mysql_fetch_array($getwebps2)) | ||
88 | { | ||
89 | $headerTemp->adds_block('WEBPROJS', array( 'COLOR' => getTagColor($i++), | ||
90 | 'TITLE' => htmlentities($getwebps3['title']), | ||
91 | 'URL' => $getwebps3['url'])); | ||
92 | } | ||
93 | |||
94 | $headerTemp->display(); | ||
95 | |||
96 | ?> | ||
diff --git a/includes/footer.php b/includes/layout.php index d1f9668..8e92256 100755..100644 --- a/includes/footer.php +++ b/includes/layout.php | |||
@@ -1,180 +1,300 @@ | |||
1 | <?php | 1 | <?php |
2 | /* | 2 | /* |
3 | 444444444 | 3 | 444444444 |
4 | 4::::::::4 | 4 | 4::::::::4 |
5 | 4:::::::::4 | 5 | 4:::::::::4 |
6 | 4::::44::::4 | 6 | 4::::44::::4 |
7 | 4::::4 4::::4 Four Island | 7 | 4::::4 4::::4 Four Island |
8 | 4::::4 4::::4 | 8 | 4::::4 4::::4 |
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | 9 | 4::::4 4::::4 Written and maintained by Starla Insigna |
10 | 4::::444444::::444 | 10 | 4::::444444::::444 |
11 | 4::::::::::::::::4 includes/footer.php | 11 | 4::::::::::::::::4 includes/layout.php |
12 | 4444444444:::::444 | 12 | 4444444444:::::444 |
13 | 4::::4 Please do not use, reproduce or steal the | 13 | 4::::4 Please do not use, reproduce or steal the |
14 | 4::::4 contents of this file without explicit | 14 | 4::::4 contents of this file without explicit |
15 | 4::::4 permission from Hatkirby. | 15 | 4::::4 permission from Hatkirby. |
16 | 44::::::44 | 16 | 44::::::44 |
17 | 4::::::::4 | 17 | 4::::::::4 |
18 | 4444444444 | 18 | 4444444444 |
19 | */ | 19 | */ |
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | if (isset($_GET['layout'])) | ||
26 | { | ||
27 | if (!file_exists('theme/layouts/' . basename($_GET['layout']))) | ||
28 | { | ||
29 | $_GET['layout'] = '7'; | ||
30 | } | ||
31 | |||
32 | setcookie('layout', $_GET['layout'], time()+60*60*24*30, '/', '.fourisland.com'); | ||
20 | 33 | ||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | 34 | unset($_GET['layout']); |
22 | 35 | ||
23 | require('headerproc.php'); | 36 | header('Location: ' . getRewriteURL()); |
24 | 37 | exit; | |
25 | $template = new FITemplate('footer'); | 38 | } |
26 | 39 | ||
27 | if (isset($onFourm)) | 40 | $template = new FITemplate('layouts/' . getLayout() . '/layout'); |
28 | { | 41 | |
29 | $template->adds_block('ONFOURM',array('exi'=>1)); | 42 | $template->add('CATEGORY',(isset($pageCategory)) ? $pageCategory : 'none'); |
43 | $template->add('AID',(isset($pageAID)) ? $pageAID : 'none'); | ||
44 | $template->add('EXTRATITLE',isset($title) ? ($title . ' - ') : ''); | ||
45 | $template->add(strtoupper($pageCategory) . 'ACTIVE', ' class="active"'); | ||
46 | |||
47 | if (($pageCategory != 'fourm') && ($pageCategory != 'wiki')) | ||
48 | { | ||
49 | $template->add('REDIRPAGE',rawurlencode($_SERVER['REQUEST_URI'])); | ||
50 | $template->add('LOGDATA',echoLogData()); | ||
51 | $template->add('LOWERLOGDATA','log' . strtolower(echoLogData())); | ||
52 | $template->add('SID',getSessionID()); | ||
53 | $template->adds_block('MEMBERS',array('exi' => 1)); | ||
54 | |||
55 | if (isAdmin()) | ||
56 | { | ||
57 | $template->adds_block('ADMIN',array('exi' => 1)); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | if (isset($hatNav) && is_array($hatNav)) | ||
62 | { | ||
63 | $template->adds_block('CREATE_HATNAV', array('exi'=>1)); | ||
64 | |||
65 | foreach ($hatNav as $item) | ||
66 | { | ||
67 | $template->adds_block('HATNAV',array('TITLE' => $item['title'], 'URL' => $item['url'], 'ICON' => $item['icon'])); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | $template->add('POTW', getPollOfTheWeek()); | ||
72 | |||
73 | $gethits = "SELECT * FROM config WHERE name = \"hits\""; | ||
74 | $gethits2 = mysql_query($gethits); | ||
75 | $gethits3 = mysql_fetch_array($gethits2); | ||
76 | $template->add('HITS', $gethits3['value']); | ||
77 | |||
78 | $gethits = "SELECT * FROM config WHERE name = \"todayHits\""; | ||
79 | $gethits2 = mysql_query($gethits); | ||
80 | $gethits3 = mysql_fetch_array($gethits2); | ||
81 | $template->add('TODAY', $gethits3['value']); | ||
82 | |||
83 | $template->add('DATEFINDER', sd_dateFinder()); | ||
84 | |||
85 | if ($usingIE) | ||
86 | { | ||
87 | $template->add('FLASH', 'It appears you are using Internet Explorer. Four Island is not likely to work properly in IE due to a <a href="http://www.webdevout.net/articles/beware-of-xhtml#ie">huge bug</a> in it. <a href="http://getfirefox.com/">There are better browsers out there, why not try one?</a>'); | ||
88 | } | ||
89 | |||
90 | $getaffs = "SELECT * FROM links WHERE type = \"affiliates\" ORDER BY id ASC"; | ||
91 | $getaffs2 = mysql_query($getaffs); | ||
92 | $i=0; | ||
93 | while ($getaffs3 = mysql_fetch_array($getaffs2)) | ||
94 | { | ||
95 | $template->adds_block('AFFILIATES', array( 'COLOR' => getTagColor($i++), | ||
96 | 'TITLE' => htmlentities($getaffs3['title']), | ||
97 | 'URL' => $getaffs3['url'])); | ||
98 | } | ||
99 | |||
100 | $getwebps = "SELECT * FROM links WHERE type = \"webprojs\" ORDER BY id ASC"; | ||
101 | $getwebps2 = mysql_query($getwebps); | ||
102 | $i=0; | ||
103 | while ($getwebps3 = mysql_fetch_array($getwebps2)) | ||
104 | { | ||
105 | $template->adds_block('WEBPROJS', array( 'COLOR' => getTagColor($i++), | ||
106 | 'TITLE' => htmlentities($getwebps3['title']), | ||
107 | 'URL' => $getwebps3['url'])); | ||
108 | } | ||
109 | |||
110 | if (isset($onFourm)) | ||
111 | { | ||
112 | $template->adds_block('ONFOURM',array('exi'=>1)); | ||
113 | } | ||
114 | |||
115 | $getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5"; | ||
116 | $getcomments2 = mysql_query($getcomments); | ||
117 | $i=0; | ||
118 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | ||
119 | { | ||
120 | if ($getcomments3[$i]['is_anon'] == 0) | ||
121 | { | ||
122 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getcomments3[$i]['user_id']; | ||
123 | $getuser2 = mysql_query($getuser); | ||
124 | $getuser3 = mysql_fetch_array($getuser2); | ||
125 | |||
126 | $username = $getuser3['username']; | ||
127 | $website = $getuser3['user_website']; | ||
128 | } else if ($getcomments3[$i]['is_anon'] == 1) | ||
129 | { | ||
130 | $getanon = "SELECT * FROM anon_commenters WHERE id = " . $getcomments3[$i]['user_id']; | ||
131 | $getanon2 = mysql_query($getanon); | ||
132 | $getanon3 = mysql_fetch_array($getanon2); | ||
133 | |||
134 | if ($getanon3['id'] == $getcomments3[$i]['user_id']) | ||
135 | { | ||
136 | $username = $getanon3['username'] . ' (Guest)'; | ||
137 | $website = $getanon3['website']; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE) | ||
142 | { | ||
143 | $getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
144 | $getpost2 = mysql_query($getpost); | ||
145 | $getpost3 = mysql_fetch_array($getpost2); | ||
146 | |||
147 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
148 | 'AREA' => 'blog', | ||
149 | 'CODED' => $getpost3['slug'], | ||
150 | 'ENDING' => '/', | ||
151 | 'TITLE' => stripslashes(htmlentities($getpost3['title'])), | ||
152 | 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username))); | ||
153 | $i++; | ||
154 | } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE) | ||
155 | { | ||
156 | $num = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
157 | |||
158 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
159 | 'AREA' => 'quotes', | ||
160 | 'CODED' => $num, | ||
161 | 'ENDING' => '.php', | ||
162 | 'TITLE' => 'Quote #' . $num, | ||
163 | 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username))); | ||
164 | $i++; | ||
165 | } else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE) | ||
166 | { | ||
167 | $getpotw = "SELECT * FROM polloftheweek WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
168 | $getpotw2 = mysql_query($getpotw); | ||
169 | $getpotw3 = mysql_fetch_array($getpotw2); | ||
170 | |||
171 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
172 | 'AREA' => 'poll', | ||
173 | 'CODED' => $getpotw3['id'], | ||
174 | 'ENDING' => '.php', | ||
175 | 'TITLE' => 'Poll "' . htmlentities($getpotw3['question']) . '"', | ||
176 | 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username))); | ||
177 | $i++; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | $users = array(); | ||
182 | $getusers = "SELECT DISTINCT user_id FROM comments WHERE is_anon = 0"; | ||
183 | $getusers2 = mysql_query($getusers); | ||
184 | $i=0; | ||
185 | while ($getusers3[$i] = mysql_fetch_array($getusers2)) | ||
186 | { | ||
187 | $getcount = "SELECT COUNT(*) FROM comments WHERE user_id = " . $getusers3[$i]['user_id']; | ||
188 | $getcount2 = mysql_query($getcount); | ||
189 | $getcount3 = mysql_fetch_array($getcount2); | ||
190 | |||
191 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id']; | ||
192 | $getuser2 = mysql_query($getuser); | ||
193 | $getuser3 = mysql_fetch_array($getuser2); | ||
194 | |||
195 | $username = $getuser3['username']; | ||
196 | $website = $getuser3['user_website']; | ||
197 | |||
198 | $name = (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username); | ||
199 | $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']); | ||
200 | |||
201 | $i++; | ||
202 | } | ||
203 | |||
204 | function count_sort($a, $b) | ||
205 | { | ||
206 | $a = $a['count']; | ||
207 | $b = $b['count']; | ||
208 | |||
209 | if ($a > $b) | ||
210 | { | ||
211 | return -1; | ||
212 | } else if ($a < $b) | ||
213 | { | ||
214 | return 1; | ||
215 | } else { | ||
216 | return 0; | ||
217 | } | ||
218 | } | ||
219 | |||
220 | usort($users, 'count_sort'); | ||
221 | $i=0; | ||
222 | foreach ($users as $value) | ||
223 | { | ||
224 | if ($i == 5) | ||
225 | { | ||
226 | break; | ||
227 | } | ||
228 | |||
229 | $template->adds_block('TOP', array( 'USERNAME' => $value['name'], | ||
230 | 'COUNT' => $value['count'])); | ||
231 | $i++; | ||
232 | } | ||
233 | |||
234 | $getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5"; | ||
235 | $getpost2 = mysql_query($getpost) or die($getpost); | ||
236 | $i=0; | ||
237 | while ($getpost3[$i] = mysql_fetch_array($getpost2)) | ||
238 | { | ||
239 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getpost3[$i]['poster_id']; | ||
240 | $getuser2 = mysql_query($getuser) or die($getuser); | ||
241 | $getuser3 = mysql_fetch_array($getuser2); | ||
242 | |||
243 | $template->adds_block('FOURM', array( 'SUBJECT' => $getpost3[$i]['post_subject'], | ||
244 | 'TOPIC' => $getpost3[$i]['topic_id'], | ||
245 | 'POST' => $getpost3[$i]['post_id'], | ||
246 | 'USERNAME' => $getuser3['username'])); | ||
247 | } | ||
248 | |||
249 | $getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5"; | ||
250 | $getpopular2 = mysql_query($getpopular); | ||
251 | $i=0; | ||
252 | while ($getpopular3[$i] = mysql_fetch_array($getpopular2)) | ||
253 | { | ||
254 | $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], | ||
255 | 'TITLE' => stripslashes(htmlentities($getpopular3[$i]['title'])))); | ||
256 | $i++; | ||
257 | } | ||
258 | |||
259 | $template->add('REVISION', exec('hg -R "' . $_SERVER['DOCUMENT_ROOT'] . '" tip --template {rev}')); | ||
260 | |||
261 | $gettags = "SELECT DISTINCT tag FROM tags WHERE post_type = \"published\""; | ||
262 | $gettags2 = mysql_query($gettags); | ||
263 | $i=0; | ||
264 | while ($gettags3[$i] = mysql_fetch_array($gettags2)) | ||
265 | { | ||
266 | $cnttag = "SELECT COUNT(*) FROM tags WHERE tag = \"" . $gettags3[$i]['tag'] . "\" AND post_type = \"published\""; | ||
267 | $cnttag2 = mysql_query($cnttag); | ||
268 | $cnttag3 = mysql_fetch_array($cnttag2); | ||
269 | |||
270 | $counts[$gettags3[$i]['tag']] = $cnttag3[0]; | ||
271 | |||
272 | $i++; | ||
273 | } | ||
274 | |||
275 | $min_count = min($counts); | ||
276 | $spread = max($counts) - $min_count; | ||
277 | $spread = ($spread <= 0) ? 1 : $spread; | ||
278 | $font_step = 8 / $spread; | ||
279 | foreach ($counts as $tag => $count) | ||
280 | { | ||
281 | if ($count != $min_count) | ||
282 | { | ||
283 | $template->adds_block('TAGCLOUD', array( 'TAG' => $tag, | ||
284 | 'SIZE' => (8 + (($count - $min_count) * $font_step)), | ||
285 | 'COUNT' => $count)); | ||
286 | } | ||
287 | } | ||
288 | |||
289 | if (!isset($noRightbar)) | ||
290 | { | ||
291 | $template->adds_block('RIGHTBAR', array('exi'=>1)); | ||
30 | } | 292 | } |
31 | 293 | ||
32 | $getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5"; | 294 | $template->add('ME', getRewriteURL()); |
33 | $getcomments2 = mysql_query($getcomments); | 295 | |
34 | $i=0; | 296 | $template->add('CONTENT', stripslashes($content)); |
35 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | 297 | |
36 | { | 298 | $template->display(); |
37 | if ($getcomments3[$i]['is_anon'] == 0) | 299 | |
38 | { | 300 | ?> |
39 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getcomments3[$i]['user_id']; | ||
40 | $getuser2 = mysql_query($getuser); | ||
41 | $getuser3 = mysql_fetch_array($getuser2); | ||
42 | |||
43 | $username = $getuser3['username']; | ||
44 | $website = $getuser3['user_website']; | ||
45 | } else if ($getcomments3[$i]['is_anon'] == 1) | ||
46 | { | ||
47 | $getanon = "SELECT * FROM anon_commenters WHERE id = " . $getcomments3[$i]['user_id']; | ||
48 | $getanon2 = mysql_query($getanon); | ||
49 | $getanon3 = mysql_fetch_array($getanon2); | ||
50 | |||
51 | if ($getanon3['id'] == $getcomments3[$i]['user_id']) | ||
52 | { | ||
53 | $username = $getanon3['username'] . ' (Guest)'; | ||
54 | $website = $getanon3['website']; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE) | ||
59 | { | ||
60 | $getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
61 | $getpost2 = mysql_query($getpost); | ||
62 | $getpost3 = mysql_fetch_array($getpost2); | ||
63 | |||
64 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
65 | 'AREA' => 'blog', | ||
66 | 'CODED' => $getpost3['slug'], | ||
67 | 'ENDING' => '/', | ||
68 | 'TITLE' => stripslashes(htmlentities($getpost3['title'])), | ||
69 | 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username))); | ||
70 | $i++; | ||
71 | } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE) | ||
72 | { | ||
73 | $num = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
74 | |||
75 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
76 | 'AREA' => 'quotes', | ||
77 | 'CODED' => $num, | ||
78 | 'ENDING' => '.php', | ||
79 | 'TITLE' => 'Quote #' . $num, | ||
80 | 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username))); | ||
81 | $i++; | ||
82 | } else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE) | ||
83 | { | ||
84 | $getpotw = "SELECT * FROM polloftheweek WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
85 | $getpotw2 = mysql_query($getpotw); | ||
86 | $getpotw3 = mysql_fetch_array($getpotw2); | ||
87 | |||
88 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
89 | 'AREA' => 'poll', | ||
90 | 'CODED' => $getpotw3['id'], | ||
91 | 'ENDING' => '.php', | ||
92 | 'TITLE' => 'Poll "' . htmlentities($getpotw3['question']) . '"', | ||
93 | 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username))); | ||
94 | $i++; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | $users = array(); | ||
99 | $getusers = "SELECT DISTINCT user_id FROM comments WHERE is_anon = 0"; | ||
100 | $getusers2 = mysql_query($getusers); | ||
101 | $i=0; | ||
102 | while ($getusers3[$i] = mysql_fetch_array($getusers2)) | ||
103 | { | ||
104 | $getcount = "SELECT COUNT(*) FROM comments WHERE user_id = " . $getusers3[$i]['user_id']; | ||
105 | $getcount2 = mysql_query($getcount); | ||
106 | $getcount3 = mysql_fetch_array($getcount2); | ||
107 | |||
108 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id']; | ||
109 | $getuser2 = mysql_query($getuser); | ||
110 | $getuser3 = mysql_fetch_array($getuser2); | ||
111 | |||
112 | $username = $getuser3['username']; | ||
113 | $website = $getuser3['user_website']; | ||
114 | |||
115 | $name = (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username); | ||
116 | $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']); | ||
117 | |||
118 | $i++; | ||
119 | } | ||
120 | |||
121 | function count_sort($a, $b) | ||
122 | { | ||
123 | $a = $a['count']; | ||
124 | $b = $b['count']; | ||
125 | |||
126 | if ($a > $b) | ||
127 | { | ||
128 | return -1; | ||
129 | } else if ($a < $b) | ||
130 | { | ||
131 | return 1; | ||
132 | } else { | ||
133 | return 0; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | usort($users, 'count_sort'); | ||
138 | $i=0; | ||
139 | foreach ($users as $value) | ||
140 | { | ||
141 | if ($i == 5) | ||
142 | { | ||
143 | break; | ||
144 | } | ||
145 | |||
146 | $template->adds_block('TOP', array( 'USERNAME' => $value['name'], | ||
147 | 'COUNT' => $value['count'])); | ||
148 | $i++; | ||
149 | } | ||
150 | |||
151 | $getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5"; | ||
152 | $getpost2 = mysql_query($getpost) or die($getpost); | ||
153 | $i=0; | ||
154 | while ($getpost3[$i] = mysql_fetch_array($getpost2)) | ||
155 | { | ||
156 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getpost3[$i]['poster_id']; | ||
157 | $getuser2 = mysql_query($getuser) or die($getuser); | ||
158 | $getuser3 = mysql_fetch_array($getuser2); | ||
159 | |||
160 | $template->adds_block('FOURM', array( 'SUBJECT' => $getpost3[$i]['post_subject'], | ||
161 | 'TOPIC' => $getpost3[$i]['topic_id'], | ||
162 | 'POST' => $getpost3[$i]['post_id'], | ||
163 | 'USERNAME' => $getuser3['username'])); | ||
164 | } | ||
165 | |||
166 | $getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5"; | ||
167 | $getpopular2 = mysql_query($getpopular); | ||
168 | $i=0; | ||
169 | while ($getpopular3[$i] = mysql_fetch_array($getpopular2)) | ||
170 | { | ||
171 | $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], | ||
172 | 'TITLE' => stripslashes(htmlentities($getpopular3[$i]['title'])))); | ||
173 | $i++; | ||
174 | } | ||
175 | |||
176 | $template->add('REVISION', exec('hg -R "' . $_SERVER['DOCUMENT_ROOT'] . '" tip --template {rev}')); | ||
177 | |||
178 | $template->display(); | ||
179 | |||
180 | ?> | ||