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=trim($_POST['year']);
$title=trim($_POST['title']);
$title=str_replace("'","\\'",$title);
$author=trim($_POST['author']);
$author=str_replace("'","\\'",$author);
$refs=trim($_POST['refs']);
$refs=str_replace("'","\\'",$refs);
$doi=trim($_POST['doi']);
$preprint=trim($_POST['preprint']);
$codenum=trim($_POST['codenum']);
$oldfile=trim($_POST['oldfile']);
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 "