diff options
Diffstat (limited to 'includes/layout.php')
| -rw-r--r-- | includes/layout.php | 300 |
1 files changed, 300 insertions, 0 deletions
| diff --git a/includes/layout.php b/includes/layout.php new file mode 100644 index 0000000..8e92256 --- /dev/null +++ b/includes/layout.php | |||
| @@ -0,0 +1,300 @@ | |||
| 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/layout.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 | 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'); | ||
| 33 | |||
| 34 | unset($_GET['layout']); | ||
| 35 | |||
| 36 | header('Location: ' . getRewriteURL()); | ||
| 37 | exit; | ||
| 38 | } | ||
| 39 | |||
| 40 | $template = new FITemplate('layouts/' . getLayout() . '/layout'); | ||
| 41 | |||
| 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)); | ||
| 292 | } | ||
| 293 | |||
| 294 | $template->add('ME', getRewriteURL()); | ||
| 295 | |||
| 296 | $template->add('CONTENT', stripslashes($content)); | ||
| 297 | |||
| 298 | $template->display(); | ||
| 299 | |||
| 300 | ?> | ||
