about summary refs log tree commit diff stats
path: root/includes/layout.php
blob: 566ce5023973125f648ad6e1476145cdd704ff42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<?php
// +----------------------------------------------------------------------+
// | PHP Version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group                                |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available at through the world-wide-web at                           |
// | http://www.php.net/license/3_0.txt.                                  |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | license@php.net so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Authors: Aidan Lister <aidan@php.net>                                |
// +----------------------------------------------------------------------+
//
// $Id: is_a.php,v 1.2 2005/11/21 10:57:23 ggiunta Exp $


/**
 * Replace function is_a()
 *
 * @category    PHP
 * @package     PHP_Compat
 * @link        http://php.net/function.is_a
 * @author      Aidan Lister <aidan@php.net>
 * @version     $Revision: 1.2 $
 * @since       PHP 4.2.0
 * @require     PHP 4.0.0 (user_error) (is_subclass_of)
 */
if (!function_exists(&
<?php
/*
       444444444  
      4::::::::4  
     4:::::::::4  
    4::::44::::4  
   4::::4 4::::4   Four Island
  4::::4  4::::4  
 4::::4   4::::4   Written and maintained by Starla Insigna
4::::444444::::444
4::::::::::::::::4  includes/layout.php
4444444444:::::444
          4::::4   Please do not use, reproduce or steal the
          4::::4   contents of this file without explicit
          4::::4   permission from Hatkirby.
        44::::::44
        4::::::::4
        4444444444
*/

if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}

require('headerproc.php');

$template = new FITemplate('layouts/' . getLayout() . '/layout');

$template->add('CATEGORY',(isset($pageCategory)) ? $pageCategory : 'none');
$template->add('AID',(isset($pageAID)) ? $pageAID : 'none');
$template->add('EXTRATITLE',isset($title) ? ($title . ' - ') : '');
$template->add(strtoupper($pageCategory) . 'ACTIVE', ' class="active"');
$template->add('EXTRASIDEBAR', isset($extraSidebar) ? $extraSidebar : '');

$template->add('REDIRPAGE',rawurlencode($_SERVER['REQUEST_URI']));
$template->add('LOGDATA',echoLogData());
$template->add('LOWERLOGDATA','log' . strtolower(echoLogData()));
$template->add('SID',getSessionID());
$template->adds_block('MEMBERS',array('exi' => 1));

if (isAdmin())
{
	$template->adds_block('ADMIN',array('exi' => 1));
}

if (isset($hatNav) && is_array($hatNav))
{
	$template->adds_block('CREATE_HATNAV', array('exi'=>1));
	
	foreach ($hatNav as $item)
	{
		$template->adds_block('HATNAV',array('TITLE' => doAprilFoolsDay($item['title']), 'URL' => $item['url'], 'ICON' => $item['icon']));
	}
}

$template->add('POTW', getPollOfTheWeek());

$gethits = "SELECT * FROM config WHERE name = \"hits\"";
$gethits2 = mysql_query($gethits);
$gethits3 = mysql_fetch_array($gethits2);
$template->add('HITS', $gethits3['value']);

$gethits = "SELECT * FROM config WHERE name = \"todayHits\"";
$gethits2 = mysql_query($gethits);
$gethits3 = mysql_fetch_array($gethits2);
$template->add('TODAY', $gethits3['value']);

$template->add('DATEFINDER', sd_dateFinder());

if ($usingIE)
{
	$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>');
}

$getaffs = "SELECT * FROM links WHERE type = \"affiliates\" ORDER BY id ASC";
$getaffs2 = mysql_query($getaffs);
$i=0;
while ($getaffs3 = mysql_fetch_array($getaffs2))
{
	$template->adds_block('AFFILIATES', array(	'COLOR' => getTagColor($i++),
							'TITLE' => doAprilFoolsDay(htmlentities($getaffs3['title'])),
							'URL' => $getaffs3['url']));
}

$getwebps = "SELECT * FROM links WHERE type = \"webprojs\" ORDER BY id ASC";
$getwebps2 = mysql_query($getwebps);
$i=0;
while ($getwebps3 = mysql_fetch_array($getwebps2))
{
	$template->adds_block('WEBPROJS', array(	'COLOR' => getTagColor($i++),
							'TITLE' => doAprilFoolsDay(htmlentities($getwebps3['title'])),
							'URL' => $getwebps3['url']));
}

if (isset($onFourm))
{
	$template->adds_block('ONFOURM',array('exi'=>1));
}

$getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5";
$getcomments2 = mysql_query($getcomments);
$i=0;
while ($getcomments3[$i] = mysql_fetch_array($getcomments2))
{
	if ($getcomments3[$i]['is_anon'] == 0)
		{
				$getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getcomments3[$i]['user_id'];
				$getuser2 = mysql_query($getuser);
				$getuser3 = mysql_fetch_array($getuser2);

				$username = $getuser3['username'];
				$website = $getuser3['user_website'];
		} else if ($getcomments3[$i]['is_anon'] == 1) 
		{
				$getanon = "SELECT * FROM anon_commenters WHERE id = " . $getcomments3[$i]['user_id'];
				$getanon2 = mysql_query($getanon);
				$getanon3 = mysql_fetch_array($getanon2);

				if ($getanon3['id'] == $getcomments3[$i]['user_id'])
				{
						$username = $getanon3['username'] . ' (Guest)';
						$website = $getanon3['website'];
				}
		}

	if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE)
	{
		$getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1);
		$getpost2 = mysql_query($getpost);
		$getpost3 = mysql_fetch_array($getpost2);

		$template->adds_block('COMMENTS', array(	'ID' => $getcomments3[$i]['id'],
								'AREA' => 'blog',
								'CODED' => $getpost3['slug'],
								'ENDING' => '/',
								'TITLE' => stripslashes(htmlentities($getpost3['title'])),
								'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username)));
		$i++;
	} else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE)
	{
		$num = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1);

		$template->adds_block('COMMENTS', array(	'ID' => $getcomments3[$i]['id'],
								'AREA' => 'quotes',
								'CODED' => $num,
								'ENDING' => '.php',
								'TITLE' => 'Quote #' . $num,
								'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username)));
		$i++;			
	} else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE)
	{
		$getpotw = "SELECT * FROM polloftheweek WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1);
		$getpotw2 = mysql_query($getpotw);
		$getpotw3 = mysql_fetch_array($getpotw2);

		$template->adds_block('COMMENTS', array(	'ID' => $getcomments3[$i]['id'],
								'AREA' => 'poll',
								'CODED' => $getpotw3['id'],
								'ENDING' => '.php',
								'TITLE' => 'Poll "' . htmlentities($getpotw3['question']) . '"',
								'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username)));
		$i++;			
	}
}

$users = array();
$getusers = "SELECT DISTINCT user_id FROM comments WHERE is_anon = 0";
$getusers2 = mysql_query($getusers);
$i=0;
while ($getusers3[$i] = mysql_fetch_array($getusers2))
{
	$getcount = "SELECT COUNT(*) FROM comments WHERE user_id = " . $getusers3[$i]['user_id'];
	$getcount2 = mysql_query($getcount);
	$getcount3 = mysql_fetch_array($getcount2);

			$getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id'];
			$getuser2 = mysql_query($getuser);
			$getuser3 = mysql_fetch_array($getuser2);

			$username = $getuser3['username'];
			$website = $getuser3['user_website'];

	$name = (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username);
	$users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']);

	$i++;
}

function count_sort($a, $b)
{
	$a = $a['count'];
	$b = $b['count'];

	if ($a > $b)
	{
		return -1;
	} else if ($a < $b)
	{
		return 1;
	} else {
		return 0;
	}
}

usort($users, 'count_sort');
$i=0;
foreach ($users as $value)
{
	if ($i == 5)
	{
		break;
	}

	$template->adds_block('TOP', array(	'USERNAME' => $value['name'],
						'COUNT' => $value['count']));
	$i++;
}

$getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5";
$getpost2 = mysql_query($getpost) or die($getpost);
$i=0;
while ($getpost3[$i] = mysql_fetch_array($getpost2))
{
	$getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getpost3[$i]['poster_id'];
	$getuser2 = mysql_query($getuser) or die($getuser);
	$getuser3 = mysql_fetch_array($getuser2);

	$template->adds_block('FOURM', array(	'SUBJECT' => $getpost3[$i]['post_subject'],
						'TOPIC' => $getpost3[$i]['topic_id'],
						'POST' => $getpost3[$i]['post_id'],
						'USERNAME' => $getuser3['username']));
}

$getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5";
$getpopular2 = mysql_query($getpopular);
$i=0;
while ($getpopular3[$i] = mysql_fetch_array($getpopular2))
{
	$template->adds_block('POPULAR', array(	'CODED' => $getpopular3[$i]['slug'],
						'TITLE' => doAprilFoolsDay(stripslashes(htmlentities($getpopular3[$i]['title'])))));
	$i++;
}

$template->add('REVISION', exec('hg -R "' . $_SERVER['DOCUMENT_ROOT'] . '" tip --template {rev}'));

$gettags = "SELECT DISTINCT tag FROM tags WHERE post_type = \"published\"";
$gettags2 = mysql_query($gettags);
$i=0;
while ($gettags3[$i] = mysql_fetch_array($gettags2))
{
        $cnttag = "SELECT COUNT(*) FROM tags WHERE tag = \"" . $gettags3[$i]['tag'] . "\" AND post_type = \"published\"";
        $cnttag2 = mysql_query($cnttag);
        $cnttag3 = mysql_fetch_array($cnttag2);

        $counts[$gettags3[$i]['tag']] = $cnttag3[0];

        $i++;
}

$min_count = min($counts);
$spread = max($counts) - $min_count;
$spread = ($spread <= 0) ? 1 : $spread;
$font_step = 8 / $spread;
foreach ($counts as $tag => $count)
{
        if ($count != $min_count)
        {
                $template->adds_block('TAGCLOUD', array(        'TAG' => $tag,
                                                                'SIZE' => (8 + (($count - $min_count) * $font_step)),
                                                                'COUNT' => $count));
        }
}

if (!isset($noRightbar))
{
	$template->adds_block('RIGHTBAR', array('exi'=>1));
}

$template->add('ME', getRewriteURL());

$template->add('CONTENT', $content);

ob_start();
$template->display();
$document = ob_get_contents();
ob_end_clean();

$document = doAprilFoolsDay($document);
$document = str_replace(doAprilFoolsDay($content), $content, $document);
$document = str_replace("id=\"threem\"", "id=\"fourm\"", $document);
$document = str_replace("id=\"threeipedia\"", "id=\"fouripedia\"", $document);
$document = str_replace('CLASS="threem none threem-none"', 'CLASS="fourm none fourm-none"', $document);
$document = str_replace("threeisland.com/", "fourisland.com/", $document);
echo($document);

?>