Please fill in the required field(s):\n
\n") ;
foreach ($_misFieldArr as $_misField)
$MIS_FIELD_TXT .= sprintf("- $_misField
\n") ;
$MIS_FIELD_TXT .= sprintf("
\n");
unset ($_SESSION["paperid"]) ;
break ;
} else {
// Query the database for author email/paperid validation
$_qy = sprintf("SELECT email FROM authors WHERE paperid=%s",
$_POST['paperid']) ;
$_res = dbQuery($_qy,$CONN) ;
while ($_row = dbFetchRow($_res)) {
if (strtolower($_POST['email']) == strtolower($_row['email'])) {
$_SESSION["paperid"] = $_POST['paperid'] ;
break ;
} else {
unset($_SESSION['paperid']) ;
}
}
if (!isset ($_SESSION["paperid"])) {
$MIS_FIELD_TXT = "Email/paperid validation failed";
}
}
break;
case "update":
switch ($_POST['update_action']) {
case "paper_details":
foreach ($CFG['requiredPaperDetailsFields'] as $_field => $_descr) {
if (empty($_POST[$_field])) {
$_misFieldArr[] = $_descr ;
}
}
if (!isset ($_misFieldArr)) {
$_paperData=array(
"title" => $_POST['title'],
"tid1" => $_POST['tid1'],
"tid2" => $_POST['tid2'],
"tid3" => $_POST['tid3'],
"topic_other" => $_POST['topic_other'],
"presentation_form" => $_POST['presentation_form'],
"student_award" => $_POST['student_award'],
"url" => $_POST['url']
);
$_res=dbUpdateRecord ("papers", $_paperData, sprintf("paperid='%s'",$_SESSION["paperid"]), $CONN) ;
}
break;
case "file_upload":
$MAX_FILESIZE = 8*1024*1024;
foreach ($CFG['requiredFiles'] as $_field => $_descr) {
$tmp_filename = $_FILES[$_field]["tmp_name"];
$unixfile_output = `file $tmp_filename`;
if (empty($_FILES[$_field]["name"])) {
$_misFieldArr[] = $_descr ;
}
# can't just use ...["type"] because Windows lies and
# uses the extension to generate the mime type anyway
elseif (!(preg_match("/\.pdf$/i", $_FILES[$_field]["name"])) || !(preg_match("/PDF document/", $unixfile_output)) ) {
$_fileProblemArr[] = sprintf("The upload of the file '%s' specified in the field '%s' failed, because it is not a valid PDF file. Only PDF files can be submitted.
",
$_FILES[$_field]["name"],
$_descr
);
}
elseif (empty($_FILES[$_field]["size"])) {
$_fileProblemArr[] = sprintf("The upload of the file '%s' specified in the field '%s' failed, because it is an empty file. Verify that you are submitting the correct file and that its permissions allow it to be read.
",
$_FILES[$_field]["name"],
$_descr
);
}
elseif ($_FILES[$_field]["size"] < 1024) {
$_fileProblemArr[] = sprintf("The upload of the file '%s' specified in the field '%s' failed because this file is too small. Valid files must be at least 1K in size. This file was only %s bytes in size.
", $_FILES[$_field]["name"], $_descr, $_FILES[$_field]["size"] );
}
elseif ($_FILES[$_field]["size"] > $MAX_FILESIZE) {
$thissize = 1+ (int)($_FILES[$_field]["size"] / 1024);
$toobig = 1 + (int)(($_FILES[$_field]["size"]-$MAX_FILESIZE) / 1024);
$_fileProblemArr[] = sprintf("The upload of the file '%s' specified in the field '%s' failed because this file is too large. Valid files can be no more than 8 MB. This file was %s KB, which is too large by %s KB.
", $_FILES[$_field]["name"], $_descr, $thissize, $toobig );
}
/*
if (empty($_FILES[$_field]['name'])) {
$_misFieldArr[] = $_descr ;
}
elseif (empty($_FILES[$_field]['size'])) {
$_fileProblemArr[] = sprintf("The upload of the file '%s' specified in the field '%s' didn't succeed,
either the filename was invalid or the filesize was too big
",
$_FILES[$_field]['name'],
$_descr
);
} */
}
if (! isset($_misFieldArr) && ! isset($_fileProblemArr) ) {
if (preg_match("/(\.\w*)$/i", $_FILES['paperfile']['name'], $_ext)) {
$_paperExt = strtolower($_ext[1]) ;
} else {
$_paperExt = "" ;
}
$_saveAs = sprintf("%s/p%s%s",
$CFG['general']['uploadFilePath'],
$_SESSION["paperid"],
$_paperExt) ;
if (copy($_FILES['paperfile']['tmp_name'], $_saveAs)) {
$_paperData=array(
"internal" => "paper_re_upload",
"subm_date_time" => date("Y-m-d H:i:s"),
"paper_filename" => $_FILES['paperfile']['name'],
"paper_filesize" => $_FILES['paperfile']['size']
);
} else {
$_fileProblemArr[]= sprintf("The file specified ('%s') was not correctly saved ...",
$_FILES['field']['name']
) ;
$_paperData=array(
"internal" => "paper_re_upload_failed " . date("Y-m-d H:i:s"),
);
}
$_res=dbUpdateRecord ("papers", $_paperData, sprintf("paperid='%s'",$_SESSION["paperid"]), $CONN) ;
}
break;
case "author":
foreach ($CFG['requiredAuthorFields'] as $_field => $_descr) {
if (empty($_POST[$_field])) {
$_misFieldArr[] = $_descr;
}
}
if (! isset($_misFieldArr)) {
$authorData=array(
"familyname" => $_POST["familyname"],
"givenname" => $_POST["givenname"],
"affiliation" => $_POST["affiliation"],
"email" => $_POST["email"]
);
$_res=dbUpdateRecord ("authors", $authorData, sprintf("authorid=%s",$_POST["authorid"]), $CONN) ;
}
break;
case "abstract":
if (empty($_POST["abstract_text"]))
$_misFieldArr[] = $CFG["requiredPaperFields"]["abstract_text"];
$_paperData=array(
"abstract_text" => $_POST["abstract_text"]
);
$_res=dbUpdateRecord ("papers", $_paperData, sprintf("paperid='%s'",$_SESSION["paperid"]), $CONN) ;
break;
}
$MIS_FIELD_TXT = "" ;
if (! empty ($_misFieldArr) || ! empty ($_fileProblemArr)) {
if (isset($_fileProblemArr)) {
foreach ($_fileProblemArr as $_fileProblem)
$MIS_FIELD_TXT = $_fileProblem ;
}
if (isset($_misFieldArr)) {
$MIS_FIELD_TXT .= sprintf("The required field(s) were not filled in:\n
\n") ;
foreach ($_misFieldArr as $_misField)
$MIS_FIELD_TXT .= sprintf("- $_misField
\n") ;
$MIS_FIELD_TXT .= sprintf("
\n");
}
}
break;
default:
unset($_SESSION["paperid"]) ;
}
if (isset($_SESSION["paperid"])) {
// Get topic list from database
$_qy = "SELECT topic_id,topic FROM topics ORDER BY order_no,topic_id" ;
$_res = dbQuery($_qy,$CONN) ;
while ($_row=dbFetchRow($_res)) {
$TOPIC_ARR[$_row['topic_id']]=$_row['topic'] ;
$_SESSION['topic'] = $TOPIC_ARR ;
}
// Query the database for the paper info
$_qy = sprintf("SELECT * FROM papers WHERE paperid='%s'",
$_SESSION["paperid"]) ;
$_res = dbQuery($_qy, $CONN) ;
$_SESSION['paper'] = dbFetchRow($_res) ;
if ($_SESSION["config"]["showReview"] == "FALSE")
$_SESSION["paper"]["status"] = "Submitted and/or review in progress" ;
$_filename = sprintf("p%d.pdf",$_SESSION["paperid"]);
$_md5 = md5(sprintf("CONLOQ%s",$_filename));
$_fullname = $CFG["general"]["uploadFilePath"] . "/" . $_filename ;
if (file_exists($_fullname)) {
$_SESSION["paper"]["file_link"] = sprintf("%s",
$_filename,
$_md5,
$_filename
);
} else {
$_SESSION["paper"]["file_link"] = "file not available";
}
$_SESSION["getfilePath"] = $CFG["general"]["uploadFilePath"] ;
// Query for author information
$_qy = sprintf("SELECT * FROM authors WHERE paperid='%s' ORDER BY orderno",
$_SESSION["paperid"]
) ;
$_res = dbQuery($_qy, $CONN) ;
unset($_SESSION['author']);
while ($_row=dbFetchRow($_res))
$_SESSION['author'][$_row['orderno']] = $_row ;
// Query the database for review info
$_qy = sprintf("SELECT a_comment FROM reviews WHERE paperid=%s",
$_SESSION["paperid"]) ;
$_res = dbQuery($_qy, $CONN) ;
$_cnt = 1 ;
while ($_row=dbFetchRow($_res)) {
if (empty($_row['a_comment']))
$A_COMMENT[$_cnt++] = "No Comments" ;
else
$A_COMMENT[$_cnt++] = $_row['a_comment'] ;
}
if (! isset($A_COMMENT)) {
$A_COMMENT[0] = "No comments for this paper" ;
}
// Query the database for the session info
$_qy = sprintf("SELECT ses_title,ses_type FROM sessions,papers WHERE papers.paperid=%s
AND sessions.ses_id=papers.ses_id",
$_SESSION["paperid"]) ;
$_res = dbQuery($_qy, $CONN) ;
$_row = dbFetchRow($_res) ;
$SESSION_TITLE = $_row['ses_title'] ;
$SESSION_TYPE = $_row['ses_type'] ;
include "_inc_status.html" ;
if ($_SESSION['config']['showReview'] == "TRUE") {
include "_inc_status_review.html" ;
} else {
include "_inc_status_paper_details.html" ;
}
include "_inc_status_file_auth_abst.html" ;
} else {
include "_inc_status_login.html" ;
}