Completed
Push — master ( 4f361a...3360ce )
by Megh
03:00
created
src/app/controllers/page.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/app/controllers/auth.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -608,41 +608,41 @@
 block discarded – undo
608 608
 
609 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
             ]);
615 615
             return;
616
-      }
617
-
618
-      global $SECRET_STRING;
619
-
620
-      $verified = false;
621
-      for ($i = 0; $i < 500; $i++) {
622
-          $possible_hash = sha1($i . $nick . $email . $SECRET_STRING);
623
-          if ($possible_hash == $hash) {
624
-              $verified = true;
625
-              break;
626
-          }
627
-      }
628
-
629
-      if (!$verified) {
630
-          $this->load_view('contest/unsubscribe', [
631
-              'message' => 'Unable to process your request.'
632
-          ]);
633
-         return;
634
-      }
635
-
636
-      if ($this->auth_model->unsubscribe_user($nick, $email)) {
637
-          $this->load_view('contest/unsubscribe', [
638
-              'message' => 'You have been successfully unsubscribe from our mailing list.'
639
-          ]);
640
-      }
641
-      else {
642
-          $this->load_view('contest/unsubscribe', [
643
-              'message' => 'Unable to process your request.'
644
-          ]);
645
-      }
616
+        }
617
+
618
+        global $SECRET_STRING;
619
+
620
+        $verified = false;
621
+        for ($i = 0; $i < 500; $i++) {
622
+            $possible_hash = sha1($i . $nick . $email . $SECRET_STRING);
623
+            if ($possible_hash == $hash) {
624
+                $verified = true;
625
+                break;
626
+            }
627
+        }
628
+
629
+        if (!$verified) {
630
+            $this->load_view('contest/unsubscribe', [
631
+                'message' => 'Unable to process your request.'
632
+            ]);
633
+            return;
634
+        }
635
+
636
+        if ($this->auth_model->unsubscribe_user($nick, $email)) {
637
+            $this->load_view('contest/unsubscribe', [
638
+                'message' => 'You have been successfully unsubscribe from our mailing list.'
639
+            ]);
640
+        }
641
+        else {
642
+            $this->load_view('contest/unsubscribe', [
643
+                'message' => 'Unable to process your request.'
644
+            ]);
645
+        }
646 646
 
647 647
     }
648 648
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             ]);
Please login to merge, or discard this patch.