$tyme = getdate();
$mon = $tyme["mon"];
$year = $tyme["year"];
$yrb4 = $year;
$mday = $tyme["mday"];
$monb4 = $mon-1;
$dyb4 = $mday;
if ($mon==1) {
$monb4 = 12;
$yrb4 = $yrb4-1;
}
$curmo = $mon;
$cmp = ($curmo<10) ? "0" : "";
$mp = ($monb4<10) ? "0" : "";
$dp = ($dyb4<10) ? "0" : "";
print "Recent SSC-IDEAS Stata modules";
print "SSC Stata modules
created or revised ";
$currdt=$year.$cmp.$curmo.$dp.$dyb4;
$prevdt=$yrb4.$mp.$monb4.$dp.$dyb4;
print "$yrb4-$mp$monb4-$dp$dyb4 to $year-$cmp$curmo-$dp$dyb4
\n\n
";
$fs=0;
$desc="";
$cred="";
$revd="";
$xFile = file ("ftp://ftp.bc.edu/pub/user/baum/RePEc/boc/bocode/bocodex.rdf");
$yFile = file ("ftp://ftp.bc.edu/pub/user/baum/RePEc/boc/bocode/bocodey.rdf");
$st = count($xFile);
for ($i=0; $i < count($yFile); $i++) {
$xFile[$st+$i] = $yFile[$i];
}
$zFile = file ("ftp://ftp.bc.edu/pub/user/baum/RePEc/boc/bocode/bocodez.rdf");
$st = count($xFile);
for ($i=0; $i < count($zFile); $i++) {
$xFile[$st+$i] = $zFile[$i];
}
for ($i=0; $i < count($xFile); $i++) {
if(ereg("^Title: (.+): Stata (.+)$",$xFile[$i],$matches)) {
$name = $matches[1];
$desc = $matches[2];
// echo "
$name | $desc
";
$an = "";
}
if(ereg("^Author-Name: (.+)$",$xFile[$i],$ma)) {
$an = $an.chop($ma[1])." ";
}
if(ereg("^Creation-Date: (.+)$",$xFile[$i],$cd)) {
$cred = $cd[1];
$cre=fmt($cred);
}
if(ereg("^Revision-Date: (.+)$",$xFile[$i],$rd)) {
$revd = $rd[1];
$rev = fmt($revd);
}
if(ereg("^Handle: (.+)bocode:(.+)$",$xFile[$i],$han)) {
if($cred > $prevdt | $revd > $prevdt) {
echo "
$name $desc
";
echo "Authors: $an";
if($revd>$cred) {
echo "
Revised: $rev
";
}
else {
echo "
Created: $cre
";
}
$cred="";
$revd="";
$an="";
}
}
}
print "\nEnd of recent additions and updates\n
\n
";
function fmt($d8) {
$y = floor($d8/10000);
$m = floor($d8/100-$y*100);
$d = floor($d8-$y*10000-$m*100);
$mp = ($m<10) ? "0" : "";
$dp = ($d<10) ? "0" : "";
$df = $y."-".$mp.$m."-".$dp.$d;
return $df;
}
?>