@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @return string The token |
| 21 | 21 | */ |
| 22 | 22 | public function new_csrf_token() { |
| 23 | - if (! isset($_SESSION['csrf_token'])) { |
|
| 23 | + if (!isset($_SESSION['csrf_token'])) { |
|
| 24 | 24 | $_SESSION['csrf_token'] = self::generate_token(); |
| 25 | 25 | } |
| 26 | 26 | return $_SESSION['csrf_token']; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * loads the 400 view and quits. |
| 40 | 40 | */ |
| 41 | 41 | public function check_csrf_token($value) { |
| 42 | - if (! isset($_SESSION['csrf_token']) |
|
| 42 | + if (!isset($_SESSION['csrf_token']) |
|
| 43 | 43 | || $value !== $_SESSION['csrf_token'] |
| 44 | 44 | ) { |
| 45 | 45 | // If no CSRF token is set, or the $value does not match it, error |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | $dedicated_view = $this->load_view($view_name, [ |
| 12 | 12 | 'error_code' => $code, |
| 13 | 13 | ]); |
| 14 | - if (! $dedicated_view) { |
|
| 14 | + if (!$dedicated_view) { |
|
| 15 | 15 | $this->load_view('http_error', [ |
| 16 | 16 | 'error_code' => $code, |
| 17 | 17 | ]); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!function_exists('getallheaders')) { |
|
| 2 | +if (!function_exists('getallheaders')) { |
|
| 3 | 3 | function getallheaders() { |
| 4 | 4 | if (!is_array($_SERVER)) { |
| 5 | 5 | return array(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | if (!empty($attributes["login"])) { |
| 30 | 30 | $user_data["nick"] = $attributes["login"]; |
| 31 | 31 | } |
| 32 | - } elseif(strpos($id, "Google2Profile") === 0) { |
|
| 32 | + } elseif (strpos($id, "Google2Profile") === 0) { |
|
| 33 | 33 | if (!empty($attributes["emails"])) { |
| 34 | 34 | $mails = json_decode($attributes["emails"], true); |
| 35 | 35 | if (count($mails) && !empty($mails[0]["value"])) { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $user_data["gender"] = "other"; |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | - } elseif(strpos($id, "FacebookProfile") === 0) { |
|
| 52 | + } elseif (strpos($id, "FacebookProfile") === 0) { |
|
| 53 | 53 | if (!empty($attributes["email"])) { |
| 54 | 54 | $user_data["mail"] = $attributes["email"]; |
| 55 | 55 | $user_data["email_verified"] = "1"; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | return $user_data; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function verify($hash=null) { |
|
| 110 | + public function verify($hash = null) { |
|
| 111 | 111 | if (!$hash) { |
| 112 | 112 | $this->http->response_code(400); |
| 113 | 113 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | if ($user !== false) { |
| 164 | 164 | $email = $user["mail"]; |
| 165 | - } else{ |
|
| 165 | + } else { |
|
| 166 | 166 | if (!empty($_POST["mail"])) { |
| 167 | 167 | $email = $_POST["mail"]; |
| 168 | 168 | } else { |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | unset($user_data["nick"]); |
| 302 | 302 | $complete = false; |
| 303 | 303 | $error[] = __("You can use only alphanumeric characters and underscore in nick"); |
| 304 | - } elseif(strlen($user_data["nick"]) < 2) { |
|
| 304 | + } elseif (strlen($user_data["nick"]) < 2) { |
|
| 305 | 305 | unset($user_data["nick"]); |
| 306 | 306 | $complete = false; |
| 307 | 307 | $error[] = __("Nick must be at least 2 characters long"); |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $verified = $this->auth_model->verify_mail($hash, false); |
| 392 | 392 | if (!$verified) { |
| 393 | 393 | $error[] = __("Invalid request"); |
| 394 | - } elseif(strlen($password) < 6) { |
|
| 394 | + } elseif (strlen($password) < 6) { |
|
| 395 | 395 | $error[] = __("Password must be at least 6 characters long"); |
| 396 | 396 | } else { |
| 397 | 397 | $email = $verified["email"]; |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | $create_user = true; |
| 507 | 507 | |
| 508 | - if (isset($user_data["mail"])){ |
|
| 508 | + if (isset($user_data["mail"])) { |
|
| 509 | 509 | $already_registered = $this->auth_model->get_user_by_mail($user_data["mail"]); |
| 510 | 510 | if ($already_registered) { |
| 511 | 511 | if ($already_registered["email_verified"]) { |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | "error" => $this->session_lib->flash_get("auth_last_error"), |
| 550 | 550 | "is_authenticated" => $this->auth_lib->is_authenticated() |
| 551 | 551 | ]); |
| 552 | - } elseif (!$user["email_verified"]){ |
|
| 552 | + } elseif (!$user["email_verified"]) { |
|
| 553 | 553 | $this->load_view("auth/email_resend", [ |
| 554 | 554 | "error" => $this->session_lib->flash_get("auth_last_error"), |
| 555 | 555 | "is_authenticated" => $this->auth_lib->is_authenticated() |
@@ -606,9 +606,9 @@ discard block |
||
| 606 | 606 | $this->http->redirect($next_page); |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - function unsubscribe($nick=null, $email=null, $hash=null) { |
|
| 609 | + function unsubscribe($nick = null, $email = null, $hash = null) { |
|
| 610 | 610 | |
| 611 | - if ( $nick == null || $email == null || $hash == null) { |
|
| 611 | + if ($nick == null || $email == null || $hash == null) { |
|
| 612 | 612 | $this->load_view('contest/unsubscribe', [ |
| 613 | 613 | 'message' => 'Unable to process your request' |
| 614 | 614 | ]); |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | -$text_input = function ($name, $large_text=false) use ($errors) { |
|
| 2 | +$text_input = function($name, $large_text = false) use ($errors) { |
|
| 3 | 3 | ?> |
| 4 | 4 | <?php if ($large_text): ?> |
| 5 | 5 | <textarea name="<?= $name ?>" class="pure-input-1" required=""><?= isset($_POST[$name]) ? $_POST[$name] : '' ?></textarea> |
| 6 | - <?php else: ?> |
|
| 6 | + <?php else : ?> |
|
| 7 | 7 | <input |
| 8 | 8 | name="<?= $name ?>" |
| 9 | 9 | value="<?= isset($_POST[$name]) ? $_POST[$name] : '' ?>" |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -$text_input = function ($name, $required=true) use ($errors) { |
|
| 2 | +$text_input = function($name, $required = true) use ($errors) { |
|
| 3 | 3 | ?> |
| 4 | 4 | <input |
| 5 | 5 | name="<?= $name ?>" |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -$text_input = function ($name, $type="text") use ($errors) { |
|
| 2 | +$text_input = function($name, $type = "text") use ($errors) { |
|
| 3 | 3 | ?> |
| 4 | 4 | <input |
| 5 | 5 | name="<?= $name ?>" |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | -$text_input = function ($name, $large_text=false) use ($errors) { |
|
| 2 | +$text_input = function($name, $large_text = false) use ($errors) { |
|
| 3 | 3 | ?> |
| 4 | 4 | <?php if ($large_text): ?> |
| 5 | 5 | <textarea name="<?= $name ?>" class="pure-input-1" required=""><?= isset($_POST[$name]) ? $_POST[$name] : '' ?></textarea> |
| 6 | - <?php else: ?> |
|
| 6 | + <?php else : ?> |
|
| 7 | 7 | <input |
| 8 | 8 | name="<?= $name ?>" |
| 9 | 9 | value="<?= isset($_POST[$name]) ? $_POST[$name] : '' ?>" |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | -$text_input = function ($name, $large_text=false) use ($errors) { |
|
| 2 | +$text_input = function($name, $large_text = false) use ($errors) { |
|
| 3 | 3 | ?> |
| 4 | 4 | <?php if ($large_text): ?> |
| 5 | 5 | <textarea name="<?= $name ?>" class="pure-input-1" required=""><?= isset($_POST[$name]) ? $_POST[$name] : '' ?></textarea> |
| 6 | - <?php else: ?> |
|
| 6 | + <?php else : ?> |
|
| 7 | 7 | <input |
| 8 | 8 | name="<?= $name ?>" |
| 9 | 9 | value="<?= isset($_POST[$name]) ? $_POST[$name] : '' ?>" |