static function fail_message($errors) { global $Conf, $Me, $Opt; if (is_string($errors)) { $errors = array($errors); } if (@$Opt["maintenance"]) { $errors = array("The site is down for maintenance. " . (is_string($Opt["maintenance"]) ? $Opt["maintenance"] : "Please check back later.")); } if (PHP_SAPI == "cli") { fwrite(STDERR, join("\n", $errors) . "\n"); exit(1); } else { if (@$_REQUEST["ajax"]) { header("Content-Type: " . (@$_REQUEST["jsontext"] ? "text/plain" : "application/json")); if (@$Opt["maintenance"]) { echo "{\"error\":\"maintenance\"}\n"; } else { echo "{\"error\":\"unconfigured installation\"}\n"; } } else { if (!$Conf) { $Conf = new Conference(false); } if ($Opt["shortName"] == "__invalid__") { $Opt["shortName"] = "HotCRP"; } $Me = null; header("HTTP/1.1 404 Not Found"); $Conf->header("HotCRP Error", "", false); foreach ($errors as $i => &$e) { $e = ($i ? "<div class=\"hint\">" : "<p>") . htmlspecialchars($e) . ($i ? "</div>" : "</p>"); } echo join("", $errors); $Conf->footer(); } } exit; }