From ec5b2499fff7cd30e1c221dbd63b37ef507d41b8 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sun, 28 Mar 2010 09:42:25 -0400 Subject: Added April Fools Day joke --- includes/common.php | 8 ++++ includes/functions.php | 12 +++--- includes/layout.php | 19 +++++++-- includes/parsers.php | 1 + includes/specialdates.php | 99 +++++++++++++++++++++++++------------------ index.php | 13 +++--- pages/archive.php | 2 +- pages/blog.php | 8 ++-- pages/poll.php | 10 ++--- pages/quotes.php | 2 +- theme/images/afd-l7.png | Bin 0 -> 11912 bytes theme/layouts/4.5/layout.tpl | 2 +- theme/layouts/6.2/style.php | 4 +- theme/layouts/7/holiday.php | 11 +++++ 14 files changed, 120 insertions(+), 71 deletions(-) create mode 100644 theme/images/afd-l7.png diff --git a/includes/common.php b/includes/common.php index 1239c68..8ca6958 100755 --- a/includes/common.php +++ b/includes/common.php @@ -47,6 +47,14 @@ if (isset($_GET['layout'])) exit; } +if (sd_isSpecialDay('April Fools Day') && ($_COOKIE['layout'] != '7')) +{ + setcookie('layout', 7, time()+60*60*24*30, '/', '.fourisland.com'); + + header('Location: ' . getRewriteURL()); + exit; +} + if (preg_match('|MSIE ([0-9].[0-9]{1,2})|', $_SERVER['HTTP_USER_AGENT'], $matched)) { $usingIE = true; diff --git a/includes/functions.php b/includes/functions.php index efb3c13..f0dad53 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -281,7 +281,7 @@ function displayRelated($title, $avoid = 0) $template = new FITemplate('related'); } - $template->adds_block('POST', array( 'TITLE' => htmlentities($getrelated3[$i]['title']), + $template->adds_block('POST', array( 'TITLE' => doAprilFoolsDay(htmlentities($getrelated3[$i]['title'])), 'CODED' => $getrelated3[$i]['slug'], 'AUTHOR' => $getrelated3[$i]['author'], 'DATE' => date('F jS Y',strtotime($getrelated3[$i]['pubDate'])))); @@ -331,11 +331,11 @@ function getPollOfTheWeek($id = -1) $getpoll2 = mysql_query($getpoll); $getpoll3 = mysql_fetch_array($getpoll2); - $potw->add('QUESTION', stripslashes(htmlentities($getpoll3['question']))); - $potw->add('OPTION1', stripslashes(htmlentities($getpoll3['option1']))); - $potw->add('OPTION2', stripslashes(htmlentities($getpoll3['option2']))); - $potw->add('OPTION3', stripslashes(htmlentities($getpoll3['option3']))); - $potw->add('OPTION4', stripslashes(htmlentities($getpoll3['option4']))); + $potw->add('QUESTION', doAprilFoolsDay(stripslashes(htmlentities($getpoll3['question'])))); + $potw->add('OPTION1', doAprilFoolsDay(stripslashes(htmlentities($getpoll3['option1'])))); + $potw->add('OPTION2', doAprilFoolsDay(stripslashes(htmlentities($getpoll3['option2'])))); + $potw->add('OPTION3', doAprilFoolsDay(stripslashes(htmlentities($getpoll3['option3'])))); + $potw->add('OPTION4', doAprilFoolsDay(stripslashes(htmlentities($getpoll3['option4'])))); $getip = "SELECT * FROM didpollalready WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; $getip2 = mysql_query($getip); diff --git a/includes/layout.php b/includes/layout.php index b11c56f..566ce50 100755 --- a/includes/layout.php +++ b/includes/layout.php @@ -47,7 +47,7 @@ if (isset($hatNav) && is_array($hatNav)) foreach ($hatNav as $item) { - $template->adds_block('HATNAV',array('TITLE' => $item['title'], 'URL' => $item['url'], 'ICON' => $item['icon'])); + $template->adds_block('HATNAV',array('TITLE' => doAprilFoolsDay($item['title']), 'URL' => $item['url'], 'ICON' => $item['icon'])); } } @@ -76,7 +76,7 @@ $i=0; while ($getaffs3 = mysql_fetch_array($getaffs2)) { $template->adds_block('AFFILIATES', array( 'COLOR' => getTagColor($i++), - 'TITLE' => htmlentities($getaffs3['title']), + 'TITLE' => doAprilFoolsDay(htmlentities($getaffs3['title'])), 'URL' => $getaffs3['url'])); } @@ -86,7 +86,7 @@ $i=0; while ($getwebps3 = mysql_fetch_array($getwebps2)) { $template->adds_block('WEBPROJS', array( 'COLOR' => getTagColor($i++), - 'TITLE' => htmlentities($getwebps3['title']), + 'TITLE' => doAprilFoolsDay(htmlentities($getwebps3['title'])), 'URL' => $getwebps3['url'])); } @@ -235,7 +235,7 @@ $i=0; while ($getpopular3[$i] = mysql_fetch_array($getpopular2)) { $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], - 'TITLE' => stripslashes(htmlentities($getpopular3[$i]['title'])))); + 'TITLE' => doAprilFoolsDay(stripslashes(htmlentities($getpopular3[$i]['title']))))); $i++; } @@ -278,6 +278,17 @@ $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); ?> diff --git a/includes/parsers.php b/includes/parsers.php index 5e984c2..b7dd869 100755 --- a/includes/parsers.php +++ b/includes/parsers.php @@ -29,6 +29,7 @@ function parseText($text) { $text = parseBBCode($text); $text = parseSmilies($text); + $text = doAprilFoolsDay($text); return $text; } diff --git a/includes/specialdates.php b/includes/specialdates.php index 067de6d..52baf2e 100755 --- a/includes/specialdates.php +++ b/includes/specialdates.php @@ -42,6 +42,7 @@ sd_lunar_annual('Presidents Day',2,1,3); //DateFinder sd_solar_annual('Valentines Day',2,14); //BG Pic; DateFinder sd_solar_multiannual('Leap Day',2,29,4,2004); //DateFinder sd_solar_annual('St Patricks Day',3,17); //DateFinder +sd_solar_annual('April Fools Day',4,1); //Awesome sd_solar_annual('Tri\'s CIEday',4,22); //DateFinder sd_solar_annual('Silence Day',4,25); //DateFinder sd_solar_annual('WCA Day',5,5); //DateFinder @@ -310,50 +311,64 @@ function sd_addDateIn($id,$dateid) 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.'; + 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.'; - } + case 'CTNH': return 'It never happened.'; + case 'April Fools Day': return 'Long live the three!'; + } } } +function doAprilFoolsDay($text) +{ + if (sd_isSpecialDay('April Fools Day')) + { + $text = str_replace('four', 'three', $text); + $text = str_replace('Four', 'Three', $text); + //$text = str_replace('4', '3', $text); + $text = str_replace('FOUR', 'THREE', $text); + } + + return $text; +} + ?> diff --git a/index.php b/index.php index 79fce10..2986730 100755 --- a/index.php +++ b/index.php @@ -24,12 +24,12 @@ header('X-Pingback: http://fourisland.com/xmlrpc.php'); include('../security/config.php'); include('includes/db.php'); -include('includes/common.php'); - -if (strpos($_SERVER['REQUEST_URI'],'index.php')) -{ - header('Location: ' . getRewriteURL()); - exit; +include('includes/common.php'); + +if (strpos($_SERVER['REQUEST_URI'],'index.php')) +{ + header('Location: ' . getRewriteURL()); + exit; } ob_start(); @@ -44,6 +44,7 @@ if (file_exists('pages/' . $pageName . '.php')) } $content = ob_get_contents(); + ob_end_clean(); include('includes/layout.php'); diff --git a/pages/archive.php b/pages/archive.php index 71a251d..024d3b5 100755 --- a/pages/archive.php +++ b/pages/archive.php @@ -87,7 +87,7 @@ while ($getposts3[$i] = mysql_fetch_array($getposts2)) $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), 'CODED' => $getposts3[$i]['slug'], - 'TITLE' => htmlentities(stripslashes($getposts3[$i]['title'])))); + 'TITLE' => doAprilFoolsDay(htmlentities(stripslashes($getposts3[$i]['title']))))); $i++; } if ($i==0) diff --git a/pages/blog.php b/pages/blog.php index af5ddbf..ae10756 100755 --- a/pages/blog.php +++ b/pages/blog.php @@ -54,7 +54,7 @@ if (isset($_GET['post'])) if (isset($getback3['title'])) { $template->adds_block('BACK', array( 'CODED' => $getback3['slug'], - 'TITLE' => htmlentities(stripslashes($getback3['title'])))); + 'TITLE' => doAprilFoolsDay(htmlentities(stripslashes($getback3['title']))))); } $getnext = "SELECT * FROM updates WHERE id > " . $getpost3['id'] . " ORDER BY id ASC LIMIT 0,1"; @@ -63,7 +63,7 @@ if (isset($_GET['post'])) if (isset($getnext3['title'])) { $template->adds_block('NEXT', array( 'CODED' => $getnext3['slug'], - 'TITLE' => htmlentities(stripslashes($getnext3['title'])))); + 'TITLE' => doAprilFoolsDay(htmlentities(stripslashes($getnext3['title']))))); } $template->add_ref(0, 'POST', array( 'ID' => $getpost3['id'], @@ -72,7 +72,7 @@ if (isset($_GET['post'])) 'MONTH' => date('M',strtotime($getpost3['pubDate'])), 'DAY' => date('d',strtotime($getpost3['pubDate'])), 'CODED' => $getpost3['slug'], - 'TITLE' => htmlentities(stripslashes($getpost3['title'])), + 'TITLE' => doAprilFoolsDay(htmlentities(stripslashes($getpost3['title']))), 'AUTHOR' => $getpost3['author'], 'RATING' => $getpost3['rating'], 'TEXT' => parseText(stripslashes($getpost3['text'])))); @@ -171,7 +171,7 @@ if (isset($_GET['post'])) 'MONTH' => date('M',strtotime($getpost3['pubDate'])), 'DAY' => date('d',strtotime($getpost3['pubDate'])), 'CODED' => $getpost3['slug'], - 'TITLE' => htmlentities(stripslashes($getpost3['title'])), + 'TITLE' => doAprilFoolsDay(htmlentities(stripslashes($getpost3['title']))), 'AUTHOR' => $getpost3['author'], 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), 'COMMENTS' => $comText, diff --git a/pages/poll.php b/pages/poll.php index 3099e32..e228712 100755 --- a/pages/poll.php +++ b/pages/poll.php @@ -53,7 +53,7 @@ if (!isset($_GET['id'])) $question .= '....'; } $template->adds_block('POLL', array( 'ID' => $getpolls3[$i]['id'], - 'QUESTION' => htmlentities(stripslashes($question)), + 'QUESTION' => doAprilFoolsDay(htmlentities(stripslashes($question))), 'WEEK' => date('F jS Y', strtotime($getpolls3[$i]['week'])), 'EVEN' => (($i % 2 == 1) ? ' class="even"' : ''))); $i++; @@ -97,10 +97,10 @@ if (!isset($_GET['id'])) $template->adds_block('COMPLETE', array( 'RSS' => parseText(stripslashes($getpoll3['text'])), 'AUTHOR' => $getrss3['author'], 'DATE' => date("F jS Y \a\\t g:i:s a",strtotime($getpoll3['week'])), - 'OPTION1' => stripslashes($getpoll3['option1']), - 'OPTION2' => stripslashes($getpoll3['option2']), - 'OPTION3' => stripslashes($getpoll3['option3']), - 'OPTION4' => stripslashes($getpoll3['option4']), + 'OPTION1' => doAprilFoolsDay(stripslashes($getpoll3['option1'])), + 'OPTION2' => doAprilFoolsDay(stripslashes($getpoll3['option2'])), + 'OPTION3' => doAprilFoolsDay(stripslashes($getpoll3['option3'])), + 'OPTION4' => doAprilFoolsDay(stripslashes($getpoll3['option4'])), 'CLICKS1' => $getpoll3['clicks1'], 'CLICKS2' => $getpoll3['clicks2'], 'CLICKS3' => $getpoll3['clicks3'], diff --git a/pages/quotes.php b/pages/quotes.php index 4fce952..1d380bb 100755 --- a/pages/quotes.php +++ b/pages/quotes.php @@ -236,7 +236,7 @@ function quote_generation($query, $origin, $page = 1, $quote_limit = 50, $page_l $template->add_ref($curID,'QUOTES',array( 'NUMBER' => $getquotes3[$i]['id'], 'RATING' => $getquotes3[$i]['rating'], 'DATE' => ($getquotes3[$i]['date'] != 0 ? date('F jS Y \a\\t g:i:s a', $getquotes3[$i]['date']) : ''), - 'QUOTE' => str_replace("\n","
",htmlentities(stripslashes($getquotes3[$i]['quote']))), + 'QUOTE' => doAprilFoolsDay(str_replace("\n","
",htmlentities(stripslashes($getquotes3[$i]['quote'])))), 'COMMENTS' => $comments)); if (($gettrack3['ip'] != $_SERVER['REMOTE_ADDR']) || (array_search($getquotes3[$i]['id'],$trackArr) === FALSE)) diff --git a/theme/images/afd-l7.png b/theme/images/afd-l7.png new file mode 100644 index 0000000..4d61fc5 Binary files /dev/null and b/theme/images/afd-l7.png differ diff --git a/theme/layouts/4.5/layout.tpl b/theme/layouts/4.5/layout.tpl index 6155d57..ea5884e 100755 --- a/theme/layouts/4.5/layout.tpl +++ b/theme/layouts/4.5/layout.tpl @@ -35,7 +35,7 @@