Skip to content
Permalink
Browse files

Braces.

  • Loading branch information...
kohler committed Sep 1, 2019
1 parent 024a0bb commit 4e2896d793c6dff02455fdd5b6dff475d568b183
Showing with 21 additions and 13 deletions.
  1. +16 −10 api.php
  2. +1 −1 src/api/api_session.php
  3. +4 −2 src/initweb.php
26 api.php
@@ -11,23 +11,25 @@
$_GET["p"] = $fn;
$fn = Navigation::path_component(1, true);
}
if ($fn)
if ($fn) {
$_GET["fn"] = $fn;
else if (isset($_GET["track"]))
} else if (isset($_GET["track"])) {
$_GET["fn"] = "track";
else {
} else {
http_response_code(404);
header("Content-Type: text/plain; charset=utf-8");
echo json_encode(["ok" => false, "error" => "API function missing"]);
exit;
}
}
if ($_GET["fn"] === "deadlines")
if ($_GET["fn"] === "deadlines") {
$_GET["fn"] = "status";
}
if (!isset($_GET["p"])
&& ($p = Navigation::path_component(1, true))
&& ctype_digit($p))
&& ctype_digit($p)) {
$_GET["p"] = $p;
}
// trackerstatus is a special case: prevent session creation
global $Me;
@@ -41,8 +43,9 @@
// initialization
require_once("src/initweb.php");
if ($Qreq->base !== null)
if ($Qreq->base !== null) {
$Conf->set_siteurl($Qreq->base);
}
if (!$Me->has_account_here()
&& ($key = $Me->capability("tracker_kiosk"))) {
$kiosks = $Conf->setting_json("__tracker_kiosk") ? : (object) array();
@@ -54,8 +57,9 @@
$Me->tracker_kiosk_state = $kiosks->$key->show_papers ? 2 : 1;
}
}
if ($Qreq->p)
if ($Qreq->p) {
$Conf->set_paper_request($Qreq, $Me);
}
// requests
if ($Conf->has_api($Qreq->fn)) {
@@ -95,10 +99,11 @@
// from here on: `status` and `track` requests
$is_track = $Qreq->fn === "track";
if ($is_track)
if ($is_track) {
MeetingTracker::track_api($Me, $Qreq); // may fall through to act like `status`
else if ($Qreq->fn !== "status")
} else if ($Qreq->fn !== "status") {
json_exit(404, "Unknown request “" . $Qreq->fn . "");
}
$j = $Me->my_deadlines($Conf->paper);
@@ -109,7 +114,8 @@
$j->p = [$Conf->paper->paperId => $pj];
}
if ($is_track && ($new_trackerid = $Qreq->annex("new_trackerid")))
if ($is_track && ($new_trackerid = $Qreq->annex("new_trackerid"))) {
$j->new_trackerid = $new_trackerid;
}
$j->ok = true;
json_exit($j);
@@ -7,7 +7,7 @@ static function setsession(Contact $user, $qreq) {
if (is_string($qreq)) {
$v = $qreq;
} else {
$v = $qreq->v;
$v = (string) $qreq->v;
}
$error = false;
@@ -44,8 +44,9 @@
$Conf->prepare_content_security_policy();
// Don't set up a session if $Me is false
if ($Me === false)
if ($Me === false) {
return;
}
// Initialize user
@@ -137,8 +138,9 @@ function initialize_user() {
// if bounced through login, add post data
if (isset($_SESSION["login_bounce"][4])
&& $_SESSION["login_bounce"][4] <= $Now)
&& $_SESSION["login_bounce"][4] <= $Now) {
unset($_SESSION["login_bounce"]);
}
if (!$Me->is_empty()
&& isset($_SESSION["login_bounce"])

0 comments on commit 4e2896d

Please sign in to comment.
You can’t perform that action at this time.