$Admin->save_roles(Contact::ROLE_ADMIN | Contact::ROLE_CHAIR | Contact::ROLE_PC, $Admin); // Load data. $json = json_decode(file_get_contents("{$ConfSitePATH}/test/db.json")); if (!$json) { die_hard("* test/testdb.json error: " . json_last_error_msg() . "\n"); } foreach ($json->contacts as $c) { $us = new UserStatus(); if (!$us->save($c)) { die_hard("* failed to create user {$c->email}\n"); } } foreach ($json->papers as $p) { $ps = new PaperStatus(null); if (!$ps->save_paper_json($p)) { die_hard("* failed to create paper {$p->title}:\n" . htmlspecialchars_decode(join("\n", $ps->error_html())) . "\n"); } } $assignset = new AssignmentSet($Admin, true); $assignset->parse($json->assignments_1, null, null); $assignset->execute(); class Xassert { public static $n = 0; public static $nsuccess = 0; public static $nerror = 0; public static $emap = array(E_ERROR => "PHP Fatal Error", E_WARNING => "PHP Warning", E_NOTICE => "PHP Notice", E_USER_ERROR => "PHP Error", E_USER_WARNING => "PHP Warning", E_USER_NOTICE => "PHP Notice"); } function xassert_error_handler($errno, $emsg, $file, $line) { if (error_reporting() || $errno != E_NOTICE) {
function update_paper($pj, $opj, $qreq, $action, $diffs) { global $Conf, $Me, $Opt, $OK, $Error, $prow; // XXX lock tables $ps = new PaperStatus($Me); $saved = $ps->save_paper_json($pj); if (!$saved && !$prow && count($qreq->_FILES)) { $ps->set_error_html("paper", "<strong>Your uploaded files were ignored.</strong>"); } if (!get($pj, "collaborators") && $Conf->setting("sub_collab")) { $field = $Conf->setting("sub_pcconf") ? "Other conflicts" : "Potential conflicts"; $ps->set_warning_html("collaborators", "Please enter the authors’ potential conflicts in the {$field} field. If none of the authors have potential conflicts, just enter “None”."); } $Error = $ps->error_fields(); if (!$saved) { $emsg = $ps->error_html(); Conf::msg_error("There were errors in saving your paper. Please fix them and try again." . (count($emsg) ? "<ul><li>" . join("</li><li>", $emsg) . "</li></ul>" : "")); return false; } // note differences in contacts $contacts = $ocontacts = []; foreach (get($pj, "contacts", []) as $v) { $contacts[] = strtolower(is_string($v) ? $v : $v->email); } if ($opj && get($opj, "contacts")) { foreach ($opj->contacts as $v) { $ocontacts[] = strtolower($v->email); } } sort($contacts); sort($ocontacts); if (json_encode($contacts) !== json_encode($ocontacts)) { $diffs["contacts"] = true; } // submit paper if no error so far $_REQUEST["paperId"] = $_GET["paperId"] = $qreq->paperId = $pj->pid; loadRows(); if ($action === "final") { $submitkey = "timeFinalSubmitted"; $storekey = "finalPaperStorageId"; } else { $submitkey = "timeSubmitted"; $storekey = "paperStorageId"; } $wasSubmitted = $opj && get($opj, "submitted"); if (get($pj, "submitted") || $Conf->can_pc_see_all_submissions()) { $Conf->update_papersub_setting(true); } if ($wasSubmitted != get($pj, "submitted")) { $diffs["submission"] = 1; } // confirmation message if ($action == "final") { $actiontext = "Updated final version of"; $template = "@submitfinalpaper"; } else { if (get($pj, "submitted") && !$wasSubmitted) { $actiontext = "Submitted"; $template = "@submitpaper"; } else { if (!$opj) { $actiontext = "Registered new"; $template = "@registerpaper"; } else { $actiontext = "Updated"; $template = "@updatepaper"; } } } // additional information $notes = array(); if ($action == "final") { if ($prow->{$submitkey} === null || $prow->{$submitkey} <= 0) { $notes[] = "The final version has not yet been submitted."; } $deadline = $Conf->printableTimeSetting("final_soft", "span"); if ($deadline != "N/A" && $Conf->deadlinesAfter("final_soft")) { $notes[] = "<strong>The deadline for submitting final versions was {$deadline}.</strong>"; } else { if ($deadline != "N/A") { $notes[] = "You have until {$deadline} to make further changes."; } } } else { if (get($pj, "submitted")) { $notes[] = "You will receive email when reviews are available."; } else { if ($prow->size == 0 && !opt("noPapers")) { $notes[] = "The submission has not yet been uploaded."; } else { if ($Conf->setting("sub_freeze") > 0) { $notes[] = "The submission has not yet been completed."; } else { $notes[] = "The submission is marked as not ready for review."; } } } $deadline = $Conf->printableTimeSetting("sub_update", "span"); if ($deadline != "N/A" && ($prow->timeSubmitted <= 0 || $Conf->setting("sub_freeze") <= 0)) { $notes[] = "Further updates are allowed until {$deadline}."; } $deadline = $Conf->printableTimeSetting("sub_sub", "span"); if ($deadline != "N/A" && $prow->timeSubmitted <= 0) { $notes[] = "<strong>If the submission " . ($Conf->setting("sub_freeze") > 0 ? "is not completed" : "is not ready for review") . " by {$deadline}, it will not be considered.</strong>"; } } $notes = join(" ", $notes); $webnotes = ""; if (count($ps->error_html())) { $webnotes .= " <ul><li>" . join("</li><li>", $ps->error_html()) . "</li></ul>"; } if (!count($diffs)) { $Conf->warnMsg("There were no changes to submission #{$prow->paperId}. " . $notes . $webnotes); return true; } // HTML confirmation if ($prow->{$submitkey} > 0) { $Conf->confirmMsg($actiontext . " submission #{$prow->paperId}. " . $notes . $webnotes); } else { $Conf->warnMsg($actiontext . " submission #{$prow->paperId}. " . $notes . $webnotes); } // mail confirmation to all contact authors if (!$Me->privChair || $qreq->doemail > 0) { $options = array("infoNames" => 1); if ($Me->privChair && $prow->conflictType < CONFLICT_AUTHOR) { $options["adminupdate"] = true; } if ($Me->privChair && isset($qreq->emailNote)) { $options["reason"] = $qreq->emailNote; } if ($notes !== "") { $options["notes"] = preg_replace(",</?(?:span.*?|strong)>,", "", $notes) . "\n\n"; } HotCRPMailer::send_contacts($template, $prow, $options); } // other mail confirmations if ($action == "final" && $OK && !count($Error)) { $prow->notify(WATCHTYPE_FINAL_SUBMIT, "final_submit_watch_callback", $Me); } $Me->log_activity($actiontext, $prow->paperId); return true; }
foreach ($jp as $j) { ++$index; if (isset($j->pid) && is_int($j->pid) && $j->pid > 0) { $prefix = "#{$j->pid}: "; } else { if (!isset($j->pid) && isset($j->id) && is_int($j->id) && $j->id > 0) { $prefix = "#{$j->id}: "; } else { if (!isset($j->pid) && !isset($j->id)) { $prefix = "new paper #{$index}: "; } else { fwrite(STDERR, "paper #{$index}: bad pid\n"); exit(1); } } } if (!$quiet) { fwrite(STDERR, $prefix); } $ps = new PaperStatus(null, ["no_email" => true, "disable_users" => $disable_users, "allow_error" => ["topics", "options"]]); $res = $ps->save_paper_json($j); if (!$quiet) { fwrite(STDERR, $res ? "saved\n" : "failed\n"); } foreach ($ps->error_html() as $msg) { fwrite(STDERR, $prefix . htmlspecialchars_decode($msg) . "\n"); } if (!$res) { exit(1); } }