From 893957c41481a0cd5eb624096337762ffa54ff28 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sun, 9 Aug 2009 09:14:58 -0400 Subject: Created layout 7 The following changes were also made in this revision: * All HTML was changed to XHTML and a !DOCTYPE was included to reflect this * Rewrote quotes tracking system to be much less complicated and actually working * Changed quotes rendering to look more like Chirpy than Rash * Fixed comment textarea bug * Rewrote a ton of CSS so it's not as bloated * Added a JavaScript confirmation when deleting a comment * AJAXified voting on the POTW * AJAXified voting and flagging quotes * AJAXified commenting * AJAXified voting on posts * Added DateFinder back after it was accidentally deleted in Layout 4.5 The following database changes must be performed as soon as possible: * Fix title of NO post (the < is missing the semicolon) * Restore post Frasty Tha Snaman from a backup * Reset "flag" field of all rows in "rash_quotes" to 0 * Remove the "vote" and "flag" columns of "rash_tracking" * Rename the "quote_id" column of "rash_tracking" to "vote" The following external code changes must also be performed as soon as possible: * Add the following line to the end of the // Four Island block in The Fourm's functions.php: require('/svr/www/hatkirby/fourisland/main/includes/specialdates.php'); --- includes/bbcode.php | 66 ++++++---- includes/comments.php | 6 +- includes/footer.php | 322 +++++++++++++++++----------------------------- includes/functions.php | 48 ++++++- includes/header.php | 47 +++---- includes/smilies.php | 2 +- includes/specialdates.php | 52 +++++++- 7 files changed, 281 insertions(+), 262 deletions(-) (limited to 'includes') diff --git a/includes/bbcode.php b/includes/bbcode.php index af0b1a4..b116e7a 100755 --- a/includes/bbcode.php +++ b/includes/bbcode.php @@ -30,30 +30,33 @@ class BBCode function init() { - $this->bbcodes['b'] = '{CONTENT}'; - $this->bbcodes['i'] = '{CONTENT}'; - $this->bbcodes['u'] = '{CONTENT}'; - $this->bbcodes['url'] = '{CONTENT}'; - $this->bbcodes2['url'] = '{CONTENT}'; - $this->bbcodes['img'] = 'Image'; - $this->bbcodes2['img'] = '{PARAM}'; - $this->bbcodes['big'] = '{CONTENT}'; - $this->bbcodes['small'] = '{CONTENT}'; - $this->bbcodes['ul'] = ''; - $this->bbcodes['ol'] = '
    {CONTENT}
'; - $this->bbcodes['li'] = '
  • {CONTENT}
  • '; - $this->bbcodes['code'] = '{CONTENT}'; - $this->bbcodes['pre'] = '

    {CONTENT}
    '; - $this->bbcodes2['blog'] = '{CONTENT}'; - $this->bbcodes2['quote'] = '{CONTENT}'; - $this->bbcodes['ins'] = '{CONTENT}'; - $this->bbcodes['del'] = '{CONTENT}'; - $this->bbcodes['bquote'] = '

    {CONTENT}
    Anonymous
    '; - $this->bbcodes2['bquote'] = '

    {CONTENT}
    {PARAM}
    '; - $this->bbcodes2['abbr'] = '{CONTENT}'; - $this->bbcodes['hidden'] = '{CONTENT}'; - $this->bbcodes['thumb'] = 'Image'; - $this->bbcodes['thumb2'] = 'Image'; + $this->bbcodes['b'] = '{CONTENT}'; + $this->bbcodes['i'] = '{CONTENT}'; + $this->bbcodes['u'] = '{CONTENT}'; + $this->bbcodes['url'] = '{CONTENT}'; + $this->bbcodes2['url'] = '{CONTENT}'; + $this->bbcodes['img'] = 'Image'; + $this->bbcodes2['img'] = '{PARAM}'; + $this->bbcodes['big'] = '{CONTENT}'; + $this->bbcodes['small'] = '{CONTENT}'; + $this->bbcodes['ul'] = ''; + $this->bbcodes['ol'] = '
      {CONTENT}
    '; + $this->bbcodes['li'] = '
  • {CONTENT}
  • '; + $this->bbcodes['code'] = '{CONTENT}'; + $this->bbcodes['pre'] = '
    {CONTENT}
    '; + $this->bbcodes['pref'] = '
    {CONTENT}
    '; + $this->bbcodes2['blog'] = '{CONTENT}'; + $this->bbcodes['quote'] = '#{CONTENT}'; + $this->bbcodes2['quote'] = '{CONTENT}'; + $this->bbcodes['ins'] = '{CONTENT}'; + $this->bbcodes['del'] = '{CONTENT}'; + $this->bbcodes['bquote'] = '
    {CONTENT}
    Anonymous
    '; + $this->bbcodes2['bquote'] = '
    {CONTENT}
    {PARAM}
    '; + $this->bbcodes2['abbr'] = '{CONTENT}'; + $this->bbcodes['hidden'] = '{CONTENT}'; + $this->bbcodes['thumb'] = 'Image'; + $this->bbcodes['thumb2'] = 'Image'; + $this->bbcodes['project'] = '{CONTENT}'; $this->init = true; } @@ -73,8 +76,15 @@ class BBCode { $bbcode_uid = unique_id(); $bbpos = strpos($to_parse, '[' . $name . ']'); - $to_parse = substr_replace($to_parse, '[' . $name . ':' . $bbcode_uid . ']', $bbpos, strlen($name) + 2); - $to_parse = substr_replace($to_parse, '[/' . $name . ':' . $bbcode_uid . ']', strpos(substr($to_parse, $bbpos), '[/' . $name . ']') + $bbpos, strlen($name) + 3); + $otag = '[' . $name . ':' . $bbcode_uid . ']'; + $ctag = '[/' . $name . ':' . $bbcode_uid . ']'; + $to_parse = substr_replace($to_parse, $otag, $bbpos, strlen($name) + 2); + $to_parse = substr_replace($to_parse, $ctag, strpos(substr($to_parse, $bbpos), '[/' . $name . ']') + $bbpos, strlen($name) + 3); + + if (strpos($this->bbcodes[$name], '
    ') !== -1)
    +				{
    +					$to_parse = substr_replace($to_parse, str_replace('[br]', '', substr($to_parse, strpos($to_parse, $otag) + strlen($otag), strpos($to_parse, $ctag) - (strpos($to_parse, $otag) + strlen($otag)))), strpos($to_parse, $otag) + strlen($otag), strpos($to_parse, $ctag) - (strpos($to_parse, $otag) + strlen($otag)));
    +				}
     
     				$value = str_replace('{CONTENT}', '\1', $value);
     				$to_parse = preg_replace('/\[' . $name . ':' . $bbcode_uid . '\](.*)\[\/' . $name . ':' . $bbcode_uid . '\]/', $value, $to_parse);
    @@ -96,13 +106,13 @@ class BBCode
     			}
     		}
     
    -		return str_replace('[br]','
    ',$to_parse); + return str_replace('[br]','
    ',$to_parse); } } function parseBBCode($text) { - global $bbcode; + static $bbcode; if (!isset($bbcode)) { $bbcode = new BBCode(); diff --git a/includes/comments.php b/includes/comments.php index e050073..0f48444 100755 --- a/includes/comments.php +++ b/includes/comments.php @@ -69,8 +69,8 @@ while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) if (isset($username)) { $template->add_ref($curID, 'COMMENTS', array( 'CODEDEMAIL' => md5(strtolower($email)), - 'USERNAME' => (($website != '') ? '' . $username . '' : $username), - 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), + 'USERNAME' => (($website != '') ? '' . $username . '' : $username), + 'DATE' => date("F jS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), 'ID' => $getcomments3[$i]['id'], 'TEXT' => parseText($getcomments3[$i]['comment']))); @@ -78,7 +78,7 @@ while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) { if ((isAdmin()) || (($getcomments3[$i]['is_anon'] == 0) && (getSessionUserID() === $getcomments3[$i]['user_id']))) { - $template->adds_ref_sub($curID, 'EDITOR', array('BEFORE' => $getcomments3[$i]['comment'])); + $template->adds_ref_sub($curID, 'EDITOR', array('BEFORE' => htmlspecialchars($getcomments3[$i]['comment']))); } } } 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'); $template = new FITemplate('footer'); -if (isset($extraSidebars)) -{ - $template->adds_block('EXTRA', array('SIDEBARS' => $extraSidebars)); -} - if (isset($onFourm)) { $template->adds_block('ONFOURM',array('exi'=>1)); } -if (!isset($noRightbar)) +$getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5"; +$getcomments2 = mysql_query($getcomments); +$i=0; +while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) { - $template->adds_block('RIGHTBAR',array('exi'=>1)); - - if (!isset($noHatNav)) - { - $cnthatnav = "SELECT COUNT(*) FROM hatnav WHERE category = \"" . $pageCategory . "\""; - $cnthatnav2 = mysql_query($cnthatnav); - $cnthatnav3 = mysql_fetch_array($cnthatnav2); + 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); - if ($cnthatnav3['COUNT(*)'] > 0) + $username = $getuser3['username']; + $website = $getuser3['user_website']; + } else if ($getcomments3[$i]['is_anon'] == 1) { - $template->adds_block('USEHATNAV', array('exi'=>1)); - if (!isset($genHatNav)) - { - $gethnis = 'SELECT * FROM hatnav WHERE category = "' . $pageCategory . '"'; - $gethnis2 = mysql_query($gethnis); - $i=0; - while ($gethnis3[$i] = mysql_fetch_array($gethnis2)) - { - $template->adds_block('HATNAV', array( 'AID' => $gethnis3[$i]['AID'], - 'HREF' => $gethnis3[$i]['href'], - 'IMAGE' => '/theme/images/icons/' . $gethnis3[$i]['image'] . '.png', - 'TEXT' => $gethnis3[$i]['text'], - 'NEW' => dispIfNotOld($gethnis3[$i]['lastEdit']))); - $i++; - } - } else { - $i=0; - while ($i < $genHatNavNum) + $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']) { - $template->adds_block('HATNAV', array( 'AID' => 'post', - 'HREF' => $genHatNav[$i]['href'], - 'IMAGE' => '/theme/images/blue.PNG', - 'TEXT' => $genHatNav[$i]['text'], - 'NEW' => '')); - $i++; + $username = $getanon3['username'] . ' (Guest)'; + $website = $getanon3['website']; } - } } - } - include('pages/polloftheweek.php'); - - $getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5"; - $getpopular2 = mysql_query($getpopular); - $i=0; - while ($getpopular3[$i] = mysql_fetch_array($getpopular2)) + if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE) { - $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], - 'TITLE' => stripslashes($getpopular3[$i]['title']))); + $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($getpost3['title']), + 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); $i++; - } - - $getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5"; - $getcomments2 = mysql_query($getcomments); - $i=0; - while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) + } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE) { - 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($getpost3['title']), - 'AUTHOR' => (($website != '') ? '' . $username . '' : $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 != '') ? '' . $username . '' : $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 "' . $getpotw3['question'] . '"', - 'AUTHOR' => (($website != '') ? '' . $username . '' : $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)) + $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 != '') ? '' . $username . '' : $username))); + $i++; + } else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE) { - $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 != '') ? '' . $username . '' : $username); - $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']); - - $i++; + $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 "' . $getpotw3['question'] . '"', + 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); + $i++; } +} - function count_sort($a, $b) - { - $a = $a['count']; - $b = $b['count']; +$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); - if ($a > $b) - { - return -1; - } else if ($a < $b) - { - return 1; - } else { - return 0; - } - } + $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id']; + $getuser2 = mysql_query($getuser); + $getuser3 = mysql_fetch_array($getuser2); - usort($users, 'count_sort'); - $i=0; - foreach ($users as $value) - { - if ($i == 5) - { - break; - } + $username = $getuser3['username']; + $website = $getuser3['user_website']; - $template->adds_block('TOP', array( 'USERNAME' => $value['name'], - 'COUNT' => $value['count'])); - $i++; - } + $name = (($website != '') ? '' . $username . '' : $username); + $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']); - $gethits = "SELECT * FROM config WHERE name = \"hits\""; - $gethits2 = mysql_query($gethits); - $gethits3 = mysql_fetch_array($gethits2); - $template->add('HITS', $gethits3['value']); + $i++; +} - $gethits = "SELECT * FROM config WHERE name = \"todayHits\""; - $gethits2 = mysql_query($gethits); - $gethits3 = mysql_fetch_array($gethits2); - $template->add('TODAY', $gethits3['value']); +function count_sort($a, $b) +{ + $a = $a['count']; + $b = $b['count']; - $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)) + if ($a > $b) { - $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'])); + return -1; + } else if ($a < $b) + { + return 1; + } else { + return 0; } +} - $gettags = "SELECT DISTINCT tag FROM tags WHERE post_type = \"published\""; - $gettags2 = mysql_query($gettags); - $i=0; - while ($gettags3[$i] = mysql_fetch_array($gettags2)) +usort($users, 'count_sort'); +$i=0; +foreach ($users as $value) +{ + if ($i == 5) { - $cnttag = "SELECT COUNT(*) FROM tags WHERE tag = \"" . $gettags3[$i]['tag'] . "\" AND post_type = \"published\""; - $cnttag2 = mysql_query($cnttag); - $cnttag3 = mysql_fetch_array($cnttag2); + break; + } - $counts[$gettags3[$i]['tag']] = $cnttag3[0]; + $template->adds_block('TOP', array( 'USERNAME' => $value['name'], + 'COUNT' => $value['count'])); + $i++; +} - $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'])); +} - $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)); - } - } +$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' => stripslashes($getpopular3[$i]['title']))); + $i++; } -$template->add('REVISION', exec('hg tip --template {rev}')); +$template->add('REVISION', exec('hg -R "' . $_SERVER['DOCUMENT_ROOT'] . '" tip --template {rev}')); $template->display(); diff --git a/includes/functions.php b/includes/functions.php index 9eb1634..090e9d0 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -272,7 +272,7 @@ function displayRelated($title, $avoid = 0) $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], 'CODED' => $getrelated3[$i]['slug'], 'AUTHOR' => $getrelated3[$i]['author'], - 'DATE' => date('F d<\S\U\P>S Y',strtotime($getrelated3[$i]['pubDate'])))); + 'DATE' => date('F jS Y',strtotime($getrelated3[$i]['pubDate'])))); $i++; } @@ -304,4 +304,50 @@ function getCommentUrl($getcomment3) } } +function getPollOfTheWeek($id = -1) +{ + static $showed_form = false; + + $potw = new FITemplate('polloftheweek'); + + if ($id == -1) + { + $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1"; + } else { + $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $id; + } + $getpoll2 = mysql_query($getpoll); + $getpoll3 = mysql_fetch_array($getpoll2); + + $potw->add('QUESTION', $getpoll3['question']); + $potw->add('OPTION1', $getpoll3['option1']); + $potw->add('OPTION2', $getpoll3['option2']); + $potw->add('OPTION3', $getpoll3['option3']); + $potw->add('OPTION4', $getpoll3['option4']); + + $getip = "SELECT * FROM didpollalready WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; + $getip2 = mysql_query($getip); + $getip3 = mysql_fetch_array($getip2); + + if (($getip3['ip'] != $_SERVER['REMOTE_ADDR']) && ($id == -1) && ($showed_form == false)) + { + $potw->adds_block('FORM',array('exi'=>1)); + $showed_form = true; + } else { + $potw->adds_block('DISPLAY',array('exi'=>1)); + + $potw->add('PERCENT1', getpercent($getpoll3,'1')); + $potw->add('PERCENT2', getpercent($getpoll3,'2')); + $potw->add('PERCENT3', getpercent($getpoll3,'3')); + $potw->add('PERCENT4', getpercent($getpoll3,'4')); + } + + ob_start(); + $potw->display(); + $result = ob_get_contents(); + ob_end_clean(); + + return $result; +} + ?> diff --git a/includes/header.php b/includes/header.php index 427ad93..5a6b8e2 100755 --- a/includes/header.php +++ b/includes/header.php @@ -24,31 +24,10 @@ require('headerproc.php'); $headerTemp = new FITemplate('header'); -if (!isset($_GET['emulateTime'])) -{ - if ((date('G') >= 20) || (date('G') <= 6)) - { - $bodyID = 'night'; - } else { - $bodyID = 'day'; - } -} else { - $bodyID = $_GET['emulateTime']; -} - -$headerTemp->add('BODYID',$bodyID); $headerTemp->add('CATEGORY',(isset($pageCategory)) ? $pageCategory : 'none'); $headerTemp->add('AID',(isset($pageAID)) ? $pageAID : 'none'); -$headerTemp->add('BODYTAGS',(isset($bodyTags)) ? $bodyTags : ''); -$headerTemp->add('HEADTAGS',isset($headtags) ? $headtags : ''); $headerTemp->add('EXTRATITLE',isset($title) ? ($title . ' - ') : ''); -$headerTemp->add('PAGEID',(isset($pageID)) ? $pageID : 'none'); -$headerTemp->add(strtoupper($pageCategory) . 'ACTIVE', ' CLASS="active"'); - -if (isset($_POST['message'])) -{ - $headerTemp->adds_block('MESSAGE',array('MSG' => $_POST['message'])); -} +$headerTemp->add(strtoupper($pageCategory) . 'ACTIVE', ' class="active"'); if (($pageCategory != 'fourm') && ($pageCategory != 'wiki')) { @@ -63,6 +42,30 @@ if (($pageCategory != 'fourm') && ($pageCategory != 'wiki')) } } +if (isset($hatNav) && is_array($hatNav)) +{ + $headerTemp->adds_block('CREATE_HATNAV', array('exi'=>1)); + + foreach ($hatNav as $item) + { + $headerTemp->adds_block('HATNAV',array('TITLE' => $item['title'], 'URL' => $item['url'], 'ICON' => $item['icon'])); + } +} + +$headerTemp->add('POTW', getPollOfTheWeek()); + +$gethits = "SELECT * FROM config WHERE name = \"hits\""; +$gethits2 = mysql_query($gethits); +$gethits3 = mysql_fetch_array($gethits2); +$headerTemp->add('HITS', $gethits3['value']); + +$gethits = "SELECT * FROM config WHERE name = \"todayHits\""; +$gethits2 = mysql_query($gethits); +$gethits3 = mysql_fetch_array($gethits2); +$headerTemp->add('TODAY', $gethits3['value']); + +$headerTemp->add('DATEFINDER', sd_dateFinder()); + $headerTemp->display(); ?> diff --git a/includes/smilies.php b/includes/smilies.php index e7579a6..fbadc57 100755 --- a/includes/smilies.php +++ b/includes/smilies.php @@ -45,7 +45,7 @@ class Smilies foreach ($this->smilies as $name => $value) { - $text = str_replace($name, '' . $name . '', $text); + $text = str_replace($name, '' . $name . '', $text); } return $text; diff --git a/includes/specialdates.php b/includes/specialdates.php index 4c774a7..067de6d 100755 --- a/includes/specialdates.php +++ b/includes/specialdates.php @@ -48,10 +48,10 @@ sd_solar_annual('WCA Day',5,5); //DateFinder sd_lunar_annual('Mothers Day',5,7,2); //BG Pic; DateFinder; Header Pic sd_lunar_annual('Memorial Day',5,1,4); //BG Pic; DateFinder; Header Pic sd_easter(); //BG Pic; DateFinder -sd_solar_annual('Hatkirbys B-Day',6,7); //BG Pic; DateFinder; Header Pic sd_solar_annual('Flag Day',6,14); //BG Pic; DateFinder +sd_solar_annual('Hatkirbys B-Day',6,17); //BG Pic; DateFinder; Header Pic sd_lunar_annual('Fathers Day',6,7,3); //BG Pic; DateFinder -sd_solar_annual('CTNH',6,17); //Header Pic +sd_solar_annual('CTNH',6,17); //Header Pic; DateFinder sd_solar_annual('Independance Day',7,4); //BG Pic; DateFinder sd_lunar_annual('SysAdminDay',7,5,4); //DateFinder sd_lunar_annual('Labor Day',9,1,1); //Yet to be implemented @@ -308,4 +308,52 @@ function sd_addDateIn($id,$dateid) $specialdates[$dateid] = $id; } +function sd_dateFinder() +{ + if (sd_ifNoSpecialDay()) + { + $did = sd_getMonthStart(date('n')-1); + $did += (date('j')-1); + $did = sd_findNextDay() - $did; + return ($did . ' more days until the next holiday!'); + } else { + switch (sd_getCurrentDay()) + { + case 'New Years Day': return 'Happy new years!'; + case 'Martin Luther King Day': return 'Happy Martin Luther King Day!'; + case 'Groundhog Day': return 'It\'s groundhog day? Will he see his shadow?'; + case 'Presidents Day': return 'Happy President\'s Day!'; + case 'Valentines Day': return 'Happy Valentines Day! Will you be mine?'; + case 'St Patricks Day': return 'Happy St. Patrick\'s Day! If you\'re not wearing green, I\'ll pinch you!'; + case 'Mothers Day': return 'Happy Mothers Day!'; + case 'Memorial Day': return 'Remember...'; + case 'Easter': return 'Happy Easter! Where are those eggs?'; + case 'Mardi Gras': return 'Happy Mardi Gras! Time to get fat!'; + case 'Ash Wednesday': return 'Happy Ash Wednesday! Did you get your ashes?'; + case 'Palm Sunday': return 'Happy Palm Sunday!'; + case 'Holy Thursday': return 'Happy Holy Thursday!'; + case 'Hatkirbys B-Day': return 'Happy Birthday to me! Happy Birthday to me! Happy Birthday dear Hatkirby! Happy Birthday to me!'; + case 'Flag Day': return 'Happy Flag Day!'; + case 'Fathers Day': return 'Happy Fathers Day!'; + case 'Independance Day': return 'Happy 4th of July!'; + case 'Labor Day': return 'Happy Labor Day!'; + case 'Four Island A': return ('Happy birthday Four Island! Four Island is ' . (date('Y')-2007) . ' years old!'); + case 'Columbus Day': return 'Happy Columbus Day!'; + case 'Halloween': return 'Happy Halloween!'; + case 'Veterans Day': return 'Only 2 minutes of silence. Remember... remember...'; + case 'Thanksgiving': return 'Happy Thanksgiving! Gobble gobble gobble gobble!'; + case 'Kirby Week': return 'It\'s Kirby Week! Not only is it a time of celebreation and fun on Four Island, it\'s only a week before Christmas!'; + case 'Christmas Eve': return '"1 Day Left" says Fourie!'; + case 'Christmas Day': return 'Merry Christmas! Time for presents!'; + case 'New Years Eve': return '5... 4... 3... 2...'; + case 'SysAdminDay': return 'If you can read this, thank your sysadmin'; + case 'WCA Day': return 'Webcomic Appreciation Day! Stare in wonder at all of your favorite webcomics! Like Pillowcase, for instance!'; + case 'Leap Day': return 'What day is it? LEAP DAY? This only happens once every four years! LET\'S LEAP IN JOY!'; + case 'Tris CIEday': return 'This is the day that shei came.'; + case 'Silence Day': return 'Support LGBT people by keeping the silence until 5 PM.'; + case 'CTNH': return 'It never happened.'; + } + } +} + ?> -- cgit 1.4.1