$year=date("Y");
$month=lcfirst(date("M"));
$monthm=lcfirst(date("m"));
$monthf=date("F");
$thismonth=$monthm;
$today=date("j");
$cd = date("U");
$count=0;
echo "";
while ( $count < 6 )
{
$path="/Users/terning/Sites";
$dir=$path."/seminars/data/pages/".$year."/".$month."/";
$count++;
$event=0;
if ( is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
if ($file != "." && $file != ".." && strpos($file,".txt.lock") == false )
{
$lname=$file;
if( strpos($file,".txt") !== false )
$lname=substr_replace($file,'',strpos($file,".txt"),4);
$handle = @fopen($dir.$file,"r");
$name = fgets($handle);
$title = fgets($handle);
$date = fgets($handle);
fclose($handle);
while( strpos(substr($name,0,1), "=") !== false || strpos(substr($name,0,1), " ") !== false)
{
$name = substr($name,1, strlen($name));
}
while( strpos(substr($name,strlen($name)-2), "=") !== false || strpos(substr($name,strlen($name)-2), " ") !== false)
{
$name = substr($name,0, -1);
}
while( strpos(substr($title,0,1), "=")!== false || strpos(substr($title,0,1), " ") !== false)
{
$title = substr($title,1, strlen($title));
}
while( strpos(substr($title,strlen($title)-2), "=") !== false || strpos(substr($title,strlen($title)-2), " ") !== false)
{
$title = substr($title,0, -1);
}
if( strpos($date,",") !== false )
$date=substr_replace($date,'',strpos($date,","),strlen($date)-strpos($date,","));
$day=0;
if ( strpos($date,".") !== false )
$day=intval(substr($date,strpos($date,".")+1));
if ( strpos($date,"May") !== false )
$day=intval(substr($date,strpos($date,"May")+3));
$mediaurl="/seminars/data/media/".$year."/".$month."/";
$mediafound = false;
if ( is_file($path.$mediaurl.$lname.".pdf") || is_file($path.$mediaurl.$lname.".bb"))
$mediafound = true;
if ( ( ( $monthm == $thismonth && $day < $today ) || $monthm !== $thismonth ) && ! $mediafound )
{
echo "- ".$name." ".$title."\n";
}
}
}
closedir($dh);
}
}
if (date('n',$cd) > 1 )
$cd = date("U", mktime(0,0,0,date('m',$cd)-1,28,date('Y',$cd)));
else
{
$cd = date("U", mktime(0,0,0,12,28,date('Y',$cd)-1));
$year=date("Y",$cd);
}
$month=lcfirst(date("M",$cd));
$monthm=lcfirst(date("m",$cd));
$monthf=date("F",$cd);
}
echo "
";