summary refs log tree commit diff stats
path: root/includes/footer.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/footer.php')
-rwxr-xr-xincludes/footer.php322
1 files changed, 117 insertions, 205 deletions
diff --git a/includes/footer.php b/includes/footer.php index 6713db0..19cc341 100755 --- a/includes/footer.php +++ b/includes/footer.php
@@ -24,244 +24,156 @@ require('headerproc.php');
24 24
25$template = new FITemplate('footer'); 25$template = new FITemplate('footer');
26 26
27if (isset($extraSidebars))
28{
29 $template->adds_block('EXTRA', array('SIDEBARS' => $extraSidebars));
30}
31
32if (isset($onFourm)) 27if (isset($onFourm))
33{ 28{
34 $template->adds_block('ONFOURM',array('exi'=>1)); 29 $template->adds_block('ONFOURM',array('exi'=>1));
35} 30}
36 31
37if (!isset($noRightbar)) 32$getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5";
33$getcomments2 = mysql_query($getcomments);
34$i=0;
35while ($getcomments3[$i] = mysql_fetch_array($getcomments2))
38{ 36{
39 $template->adds_block('RIGHTBAR',array('exi'=>1)); 37 if ($getcomments3[$i]['is_anon'] == 0)
40 38 {
41 if (!isset($noHatNav)) 39 $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getcomments3[$i]['user_id'];
42 { 40 $getuser2 = mysql_query($getuser);
43 $cnthatnav = "SELECT COUNT(*) FROM hatnav WHERE category = \"" . $pageCategory . "\""; 41 $getuser3 = mysql_fetch_array($getuser2);
44 $cnthatnav2 = mysql_query($cnthatnav);
45 $cnthatnav3 = mysql_fetch_array($cnthatnav2);
46 42
47 if ($cnthatnav3['COUNT(*)'] > 0) 43 $username = $getuser3['username'];
44 $website = $getuser3['user_website'];
45 } else if ($getcomments3[$i]['is_anon'] == 1)
48 { 46 {
49 $template->adds_block('USEHATNAV', array('exi'=>1)); 47 $getanon = "SELECT * FROM anon_commenters WHERE id = " . $getcomments3[$i]['user_id'];
50 if (!isset($genHatNav)) 48 $getanon2 = mysql_query($getanon);
51 { 49 $getanon3 = mysql_fetch_array($getanon2);
52 $gethnis = 'SELECT * FROM hatnav WHERE category = "' . $pageCategory . '"'; 50
53 $gethnis2 = mysql_query($gethnis); 51 if ($getanon3['id'] == $getcomments3[$i]['user_id'])
54 $i=0;
55 while ($gethnis3[$i] = mysql_fetch_array($gethnis2))
56 {
57 $template->adds_block('HATNAV', array( 'AID' => $gethnis3[$i]['AID'],
58 'HREF' => $gethnis3[$i]['href'],
59 'IMAGE' => '/theme/images/icons/' . $gethnis3[$i]['image'] . '.png',
60 'TEXT' => $gethnis3[$i]['text'],
61 'NEW' => dispIfNotOld($gethnis3[$i]['lastEdit'])));
62 $i++;
63 }
64 } else {
65 $i=0;
66 while ($i < $genHatNavNum)
67 { 52 {
68 $template->adds_block('HATNAV', array( 'AID' => 'post', 53 $username = $getanon3['username'] . ' (Guest)';
69 'HREF' => $genHatNav[$i]['href'], 54 $website = $getanon3['website'];
70 'IMAGE' => '/theme/images/blue.PNG',
71 'TEXT' => $genHatNav[$i]['text'],
72 'NEW' => ''));
73 $i++;
74 } 55 }
75 }
76 } 56 }
77 }
78 57
79 include('pages/polloftheweek.php'); 58 if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE)
80
81 $getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5";
82 $getpopular2 = mysql_query($getpopular);
83 $i=0;
84 while ($getpopular3[$i] = mysql_fetch_array($getpopular2))
85 { 59 {
86 $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], 60 $getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1);
87 'TITLE' => stripslashes($getpopular3[$i]['title']))); 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($getpost3['title']),
69 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username)));
88 $i++; 70 $i++;
89 } 71 } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE)
90
91 $getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5";
92 $getcomments2 = mysql_query($getcomments);
93 $i=0;
94 while ($getcomments3[$i] = mysql_fetch_array($getcomments2))
95 { 72 {
96 if ($getcomments3[$i]['is_anon'] == 0) 73 $num = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1);
97 { 74
98 $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getcomments3[$i]['user_id']; 75 $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'],
99 $getuser2 = mysql_query($getuser); 76 'AREA' => 'quotes',
100 $getuser3 = mysql_fetch_array($getuser2); 77 'CODED' => $num,
101 78 'ENDING' => '.php',
102 $username = $getuser3['username']; 79 'TITLE' => 'Quote #' . $num,
103 $website = $getuser3['user_website']; 80 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username)));
104 } else if ($getcomments3[$i]['is_anon'] == 1) 81 $i++;
105 { 82 } else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE)
106 $getanon = "SELECT * FROM anon_commenters WHERE id = " . $getcomments3[$i]['user_id'];
107 $getanon2 = mysql_query($getanon);
108 $getanon3 = mysql_fetch_array($getanon2);
109
110 if ($getanon3['id'] == $getcomments3[$i]['user_id'])
111 {
112 $username = $getanon3['username'] . ' (Guest)';
113 $website = $getanon3['website'];
114 }
115 }
116
117 if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE)
118 {
119 $getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1);
120 $getpost2 = mysql_query($getpost);
121 $getpost3 = mysql_fetch_array($getpost2);
122
123 $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'],
124 'AREA' => 'blog',
125 'CODED' => $getpost3['slug'],
126 'ENDING' => '/',
127 'TITLE' => stripslashes($getpost3['title']),
128 'AUTHOR' => (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username)));
129 $i++;
130 } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE)
131 {
132 $num = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1);
133
134 $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'],
135 'AREA' => 'quotes',
136 'CODED' => $num,
137 'ENDING' => '.php',
138 'TITLE' => 'Quote #' . $num,
139 'AUTHOR' => (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username)));
140 $i++;
141 } else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE)
142 {
143 $getpotw = "SELECT * FROM polloftheweek WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1);
144 $getpotw2 = mysql_query($getpotw);
145 $getpotw3 = mysql_fetch_array($getpotw2);
146
147 $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'],
148 'AREA' => 'poll',
149 'CODED' => $getpotw3['id'],
150 'ENDING' => '.php',
151 'TITLE' => 'Poll "' . $getpotw3['question'] . '"',
152 'AUTHOR' => (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username)));
153 $i++;
154 }
155 }
156
157 $users = array();
158 $getusers = "SELECT DISTINCT user_id FROM comments WHERE is_anon = 0";
159 $getusers2 = mysql_query($getusers);
160 $i=0;
161 while ($getusers3[$i] = mysql_fetch_array($getusers2))
162 { 83 {
163 $getcount = "SELECT COUNT(*) FROM comments WHERE user_id = " . $getusers3[$i]['user_id']; 84 $getpotw = "SELECT * FROM polloftheweek WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1);
164 $getcount2 = mysql_query($getcount); 85 $getpotw2 = mysql_query($getpotw);
165 $getcount3 = mysql_fetch_array($getcount2); 86 $getpotw3 = mysql_fetch_array($getpotw2);
166 87
167 $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id']; 88 $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'],
168 $getuser2 = mysql_query($getuser); 89 'AREA' => 'poll',
169 $getuser3 = mysql_fetch_array($getuser2); 90 'CODED' => $getpotw3['id'],
170 91 'ENDING' => '.php',
171 $username = $getuser3['username']; 92 'TITLE' => 'Poll "' . $getpotw3['question'] . '"',
172 $website = $getuser3['user_website']; 93 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username)));
173 94 $i++;
174 $name = (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username);
175 $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']);
176
177 $i++;
178 } 95 }
96}
179 97
180 function count_sort($a, $b) 98$users = array();
181 { 99$getusers = "SELECT DISTINCT user_id FROM comments WHERE is_anon = 0";
182 $a = $a['count']; 100$getusers2 = mysql_query($getusers);
183 $b = $b['count']; 101$i=0;
102while ($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);
184 107
185 if ($a > $b) 108 $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id'];
186 { 109 $getuser2 = mysql_query($getuser);
187 return -1; 110 $getuser3 = mysql_fetch_array($getuser2);
188 } else if ($a < $b)
189 {
190 return 1;
191 } else {
192 return 0;
193 }
194 }
195 111
196 usort($users, 'count_sort'); 112 $username = $getuser3['username'];
197 $i=0; 113 $website = $getuser3['user_website'];
198 foreach ($users as $value)
199 {
200 if ($i == 5)
201 {
202 break;
203 }
204 114
205 $template->adds_block('TOP', array( 'USERNAME' => $value['name'], 115 $name = (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username);
206 'COUNT' => $value['count'])); 116 $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']);
207 $i++;
208 }
209 117
210 $gethits = "SELECT * FROM config WHERE name = \"hits\""; 118 $i++;
211 $gethits2 = mysql_query($gethits); 119}
212 $gethits3 = mysql_fetch_array($gethits2);
213 $template->add('HITS', $gethits3['value']);
214 120
215 $gethits = "SELECT * FROM config WHERE name = \"todayHits\""; 121function count_sort($a, $b)
216 $gethits2 = mysql_query($gethits); 122{
217 $gethits3 = mysql_fetch_array($gethits2); 123 $a = $a['count'];
218 $template->add('TODAY', $gethits3['value']); 124 $b = $b['count'];
219 125
220 $getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5"; 126 if ($a > $b)
221 $getpost2 = mysql_query($getpost) or die($getpost);
222 $i=0;
223 while ($getpost3[$i] = mysql_fetch_array($getpost2))
224 { 127 {
225 $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getpost3[$i]['poster_id']; 128 return -1;
226 $getuser2 = mysql_query($getuser) or die($getuser); 129 } else if ($a < $b)
227 $getuser3 = mysql_fetch_array($getuser2); 130 {
228 131 return 1;
229 $template->adds_block('FOURM', array( 'SUBJECT' => $getpost3[$i]['post_subject'], 132 } else {
230 'TOPIC' => $getpost3[$i]['topic_id'], 133 return 0;
231 'POST' => $getpost3[$i]['post_id'],
232 'USERNAME' => $getuser3['username']));
233 } 134 }
135}
234 136
235 $gettags = "SELECT DISTINCT tag FROM tags WHERE post_type = \"published\""; 137usort($users, 'count_sort');
236 $gettags2 = mysql_query($gettags); 138$i=0;
237 $i=0; 139foreach ($users as $value)
238 while ($gettags3[$i] = mysql_fetch_array($gettags2)) 140{
141 if ($i == 5)
239 { 142 {
240 $cnttag = "SELECT COUNT(*) FROM tags WHERE tag = \"" . $gettags3[$i]['tag'] . "\" AND post_type = \"published\""; 143 break;
241 $cnttag2 = mysql_query($cnttag); 144 }
242 $cnttag3 = mysql_fetch_array($cnttag2);
243 145
244 $counts[$gettags3[$i]['tag']] = $cnttag3[0]; 146 $template->adds_block('TOP', array( 'USERNAME' => $value['name'],
147 'COUNT' => $value['count']));
148 $i++;
149}
245 150
246 $i++; 151$getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5";
247 } 152$getpost2 = mysql_query($getpost) or die($getpost);
153$i=0;
154while ($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}
248 165
249 $min_count = min($counts); 166$getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5";
250 $spread = max($counts) - $min_count; 167$getpopular2 = mysql_query($getpopular);
251 $spread = ($spread <= 0) ? 1 : $spread; 168$i=0;
252 $font_step = 8 / $spread; 169while ($getpopular3[$i] = mysql_fetch_array($getpopular2))
253 foreach ($counts as $tag => $count) 170{
254 { 171 $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'],
255 if ($count != $min_count) 172 'TITLE' => stripslashes($getpopular3[$i]['title'])));
256 { 173 $i++;
257 $template->adds_block('TAGCLOUD', array( 'TAG' => $tag,
258 'SIZE' => (8 + (($count - $min_count) * $font_step)),
259 'COUNT' => $count));
260 }
261 }
262} 174}
263 175
264$template->add('REVISION', exec('hg tip --template {rev}')); 176$template->add('REVISION', exec('hg -R "' . $_SERVER['DOCUMENT_ROOT'] . '" tip --template {rev}'));
265 177
266$template->display(); 178$template->display();
267 179