Login / Status
developer.Resource
Home . Community . People . Kasper's Korner . PHPoem #1
Sponsors
hosted by punkt.deTYPO3 and Open Source MagazineAOE Media

PHPoem #1

I tried to run this script during last weeks Typo3 development, but although it succeeded partly succesful it was never stable. In fact it froze the server from time to time...

 

- kasper

 

<?php
/**
* PHPoem 
* Work Efficiency Agent 
*
* @author Kasper Skårhøj <kasper@typo3.com>
*/
 
// Set environment:
 
$wifeStatus="Not home this week";
$workMode="extended";
initWeekAtWork($wifeStatus,$workMode);
 
// Initialize settings
ignore_friends_calling(1);
tapeAllEpisodesOfFriends(1);
enablePlaylistWithChristianMusic(1);
 
// Check conditions
checkCoffeeInKitchen();
checkSupplyOfNonsmellySocks();
 
 
$weekdays = explode(",", "monday,tuesday,wednesday,thursday,friday");
foreach ($weekdays as $day) {
 
  // New morning:
  echo "Talk to God first, Kasper.";
  if ($HTTP_GET_VARS["statement"]=="I'll do that later") {
     echo "OK, that's your choise, 
     but you know how important that is.";
  }
 
  doProgramming(); 
 
  // Check environment during morning
  if (missWife()==true) 
     echo "You cannot see her yet. Must wait to end of week.";
  if (sunShinesAndWhetherIsGreat("outside")) 
     echo "You are not on holiday yet!";
 
  doProgramming(); 
 
  // Require resources
  $food = mysql_query("
   SELECT FROM refridgerator 
   WHERE eatable AND expiredate NOT < ".time()." 
   LIMIT 1");
   if (mysql_num_rows($food)) {
      consumeIt ("10 minutes max");
   else
      callPizzaDelivery("4: Margarita", "+gorgonzola");
 
   doProgramming(); 
 
   // Check physical body state
   payAttentionToHandsAndBack();
   if(handsHurtingDueToUseOfKeyboard()==true) {
      ignore(1);
   }
 
 
   // Checking overflow
   if (! willThisEverEnd("?")){
   if (maxExecutionTimeNotSet()) 
      die("Fatal error: Could not complete your request.");
   }
 
   // Set clockradio 3 hours from current time
   sleep(60*60*3);
 
 
} // end day
 
 
 
 
 
// I haven't implemented this function yet. 
// It should fit in somewhere above, but I couldn't find time to do it.
// Maybe thats the key to the solution?
 
function takeTimeOf() {
  echo "
     Call a friend, go to the parks or rollerskate down to the harbour. 
     Don't forget to surprise your wife today, you know she loves it! 
     Be her servant, Kasper! 
     Did you open your Bible today? 
     Did you put this day in the hands of Jesus?
  ";
}
 
 
/*
* If you have any comments, find any bugs 
* or have suggestions to changes, please email me.
* Maybe you have struggled with scripts like this yourself?
*/
?>