From f7b0cf0b7fb9a1bf160878bdb33fc25ded0afd7b Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Mon, 13 Nov 2017 16:17:07 -0700 Subject: [PATCH] Refactor and enforce Content-Security-Policy --- app.php | 4 +-- lib/getshifttable.php | 2 +- mobile/index.php | 1 + pages/assignshift.php | 2 +- pages/editshift.php | 6 ++-- pages/home.php | 28 ++++++++++++++---- pages/punches.php | 4 +-- pages/shifts.php | 4 +-- required.php | 46 +++++++++++++++++++++++++++++- static/css/app.css | 61 +++++++++++++++++++++++++++++++++++++++- static/js/assignshift.js | 8 ++++-- static/js/punches.js | 6 +++- static/js/shifts.js | 6 +++- 13 files changed, 156 insertions(+), 22 deletions(-) diff --git a/app.php b/app.php index 22c26e4..153fa50 100644 --- a/app.php +++ b/app.php @@ -71,7 +71,7 @@ if (!is_empty($_GET['page'])) { } ?> - + -
+
diff --git a/lib/getshifttable.php b/lib/getshifttable.php index 396f4c7..c9d48af 100644 --- a/lib/getshifttable.php +++ b/lib/getshifttable.php @@ -137,7 +137,7 @@ for ($i = 0; $i < count($shifts); $i++) { break; } } - $shifts[$i][5] = "" . implode(", ", $days) . ""; + $shifts[$i][5] = "" . implode(", ", $days) . ""; } $out['status'] = "OK"; diff --git a/mobile/index.php b/mobile/index.php index 31d1db4..0cd6217 100644 --- a/mobile/index.php +++ b/mobile/index.php @@ -90,6 +90,7 @@ switch ($VARS['action']) { if (authenticate_user($VARS['username'], $VARS['password'], $autherror)) { if (account_has_permission($VARS['username'], "QWIKCLOCK")) { doLoginUser($VARS['username'], $VARS['password']); + $_SESSION['mobile'] = true; exit(json_encode(["status" => "OK"])); } else { exit(json_encode(["status" => "ERROR", "msg" => lang("no permission", false)])); diff --git a/pages/assignshift.php b/pages/assignshift.php index e829105..e18e496 100644 --- a/pages/assignshift.php +++ b/pages/assignshift.php @@ -65,7 +65,7 @@ if ($VARS['shift'] && $database->has('shifts', ['shiftid' => $VARS['shift']])) { foreach ($assigned as $user) { ?>
-
+
has('shifts', ['shiftid' => $VARS['id']]))
-
-
-
+
+
+
diff --git a/pages/home.php b/pages/home.php index b05a541..7870583 100644 --- a/pages/home.php +++ b/pages/home.php @@ -7,12 +7,17 @@ redirectifnotloggedin();
-
+

-
-
+
+ +
@@ -34,9 +39,22 @@ redirectifnotloggedin(); has('punches', ['AND' => ['uid' => $_SESSION['uid'], 'out' => null]]) === TRUE; ?> - + + + +
- +
diff --git a/pages/punches.php b/pages/punches.php index ae9545c..e9e07de 100644 --- a/pages/punches.php +++ b/pages/punches.php @@ -42,7 +42,7 @@ $totalpunches = count($punches);
-  +  @@ -68,7 +68,7 @@ $totalpunches = count($punches);
-