All pastes #474113 Raw Edit

Something

public text v1 · immutable
·published 2007-05-06 17:00 UTC
rendered paste body
#!/usr/bin/php -q
<?php

/* chag is hebrew for holiday

erev chag is hebrew for eve of holiday

*/

$in = fopen("php://stdin","r");

$stdlog = fopen("/var/log/asterisk/my_agi.log", "w");


// Do function definitions before we start the main loop
function read() {
  global $in, $debug;
  $input = str_replace("\n", "", fgets($in, 4096));
  return $input;
}

function errlog($line) {
  global $err;
  echo "VERBOSE \"$line\"\n";
}

function write($line) {
  global $debug;
  echo $line."\n";
} 

$chag["Rosh Hashana2"] = "1/2";
$chag["Yom Kippur"] = "1/10";
$chag["Succos"] = "1/15";
$chag["Succos"] = "1/16";
$chag["Succos"] = "1/18";
$chag["Succos"] = "1/19";
$chag["Succos"] = "1/20";
$chag["Succos"] = "1/21";
$chag["Lag Be'omer"] = "9/18";

list ($month, $day, $year) = explode ('/', date ('m/d/Y'));
$today_full =jdtojewish(gregoriantojd($month, $day, $year)) ;
echo"Today's full hebrew date is $today_full" . "<br /><br />";

 

list($month, $day, $year) = explode ('/', $today_full);
$today = "$month/$day";
$tommorowday = $day + 1;
$tommorow = "$month/$tommorowday";

echo "Today's hebrew date is $today" . "<br /><br />";
echo "Tommorows's hebrew date is $tommorow" . "<br /><br />";

$found_today = array_search($today,$chag);
$found_tommorow = array_search($tommorow,$chag);

if ($found_today) {
	write ("SET VARIABLE $chag \"chag\""); 
	} elseif ($found_tommorow) {
//	echo "Today is erev chag $found_tommorow!";
//	} else {
	write ("SET VARIABLE $chag \"notchag\""); 


	}

/*
if ($found_today) {
	echo "Today is the chag of $found_today!";
	} elseif ($found_tommorow) {
	echo "Today is erev chag $found_tommorow!";
	} else {
	echo "Today is not a chag or even erev chag." . "<br /><br />";
	}
*/
?>