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 +++++++++++++++++++++++++++-------------------- 5 files changed, 87 insertions(+), 52 deletions(-) (limited to 'includes') 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; +} + ?> -- cgit 1.4.1