Reference field is mandatory
");
$goOn = FALSE;
}
$testStr=trim($_POST['title']);
if (empty($testStr)) {
printf(" Title field is mandatory
");
$goOn = FALSE;
}
$testStr=trim($_POST['author']);
if (empty($testStr)) {
printf(" Author field is mandatory
");
$goOn = FALSE;
}
$testStr=trim($_POST['year']);
if (empty($testStr)) {
printf(" Year field is mandatory
");
$goOn = FALSE;
}
$testStr=trim($_POST['codenum']);
if (empty($testStr)) { /*Record is brand new*/
echo "event: new record
";
$rectyp="new";
} else { /*Record is an old one*/
echo "event: old record modified
";
$rectyp="mod";
}
if ($rectyp == "unk") {
echo "Unexpected record format.";
$goOn = FALSE;
}
if ( TRUE == $goOn ) {
$year=htmlentities(trim($_POST['year']),ENT_QUOTES);
$title=htmlentities(trim($_POST['title']),ENT_QUOTES);
$title=str_replace("'","\\'",$title);
$author=htmlentities(trim($_POST['author']),ENT_QUOTES);
$author=str_replace("'","\\'",$author);
$refs=htmlentities(trim($_POST['refs']),ENT_QUOTES);
$refs=str_replace("'","\\'",$refs);
$doi=htmlentities(trim($_POST['doi']),ENT_QUOTES);
$preprint=htmlentities(trim($_POST['preprint']),ENT_QUOTES);
$codenum=htmlentities(trim($_POST['codenum']),ENT_QUOTES);
$oldfile=htmlentities(trim($_POST['oldfile']),ENT_QUOTES);
if($rectyp == "new") {
$codenum=$year."-".date("U");
$entryhtm=$codenum.".html";
while ( file_exists("RCDS/".$entryhtm)) {
$codenum=$year."-".date("U");
$entryhtm=$codenum.".html";
}
} else {
$entryhtm=$codenum.".html";
if ($year != substr($codenum,0,4)) {
echo "Warning: changing the year; also changing record label: ";
$newcodenum=$year."-".date("U");
$newentryhtm=$newcodenum.".html";
while ( file_exists("RCDS/".$newentryhtm)) {
$newcodenum=$year."-".date("U");
$newentryhtm=$newcodenum.".html";
}
if (FALSE == copy("RCDS/".$entryhtm,"RCDS/".$newentryhtm)) {
echo "Can't move record file".$entryhtm."->".$newentryhtm;
echo "