$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 "{smcl}\n\n{browse \"http://ideas.uqam.ca/ideas/data/bocbocode.html\":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{hline}\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:(.+)\n$",$xFile[$i],$han)) {
if($cred > $prevdt | $revd > $prevdt) {
$handl=$han[2];
/* $handl=strtolower($han[2]); */
echo "\n{browse \"http://ideas.uqam.ca/ideas/data/Softwares/bocbocode$handl.html\":$name} {txt} $desc";
echo "Authors: $an\n";
if($revd>$cred) {
echo "Revised: $rev\n";
}
else {
echo "Created: $cre\n";
}
$cred="";
$revd="";
$an="";
}
}
}
print "\n{hline}\nEnd of recent additions and updates\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;
}
?>