Completed
Pull Request — master (#171)
by Corey
04:56
created
site/views/site/error.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 $exception = Yii::$app->errorHandler->exception;
17 17
 
18
-if($exception instanceof \yii\web\NotFoundHttpException):
18
+if ($exception instanceof \yii\web\NotFoundHttpException):
19 19
   $this->title = "The Faster Scale App | Page Not Found";
20 20
 ?>
21 21
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
   <p>Otherwise, please ensure your attempted url is correct.</p>
26 26
 
27 27
 <?php
28
-elseif($exception instanceof \yii\web\ServerErrorHttpException):
28
+elseif ($exception instanceof \yii\web\ServerErrorHttpException):
29 29
   $this->title = "The Faster Scale App | Oops";
30 30
 ?>
31 31
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
   <div class="alert alert-danger"><?= nl2br(Html::encode($name)) ?></div>
34 34
   <p>Well this is embarrassing...we're having an error on our side. So sorry for the annoyance. If you'd like to help, please send us a message on our <a href='<?=Url::to(['site/contact'])?>'>contact form</a>.</p>
35 35
 
36
-<?php else: ?>
36
+<?php else {
37
+  : ?>
37 38
 
38 39
 <div class="site-error">
39 40
   <h1><?= Html::encode($name) ?></h1>
@@ -41,4 +42,6 @@  discard block
 block discarded – undo
41 42
   <p>The above error occurred while the Web server was processing your request.</p>
42 43
   <p>Please contact us if you think this is a server error. Thank you.</p>
43 44
 </div>
44
-<?php endif; ?>
45
+<?php endif;
46
+}
47
+?>
Please login to merge, or discard this patch.
site/controllers/ProfileController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             'allow'   => true,
28 28
             'roles'   => ['@'],
29 29
           ], [
30
-            'actions' => [ 'change-email', ],
30
+            'actions' => ['change-email', ],
31 31
             'allow'   => true,
32 32
           ],
33 33
         ],
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     if ($editProfileForm->load(Yii::$app->request->post())) {
59 59
       $saved_user = $editProfileForm->saveProfile();
60
-      if($saved_user) {
60
+      if ($saved_user) {
61 61
         Yii::$app->session->setFlash('success', 'New profile data saved!');
62 62
       }
63 63
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     $model = Yii::$container->get(\site\models\DeleteAccountForm::class, [Yii::$app->user->identity]);
76 76
 
77 77
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
78
-      if($model->deleteAccount()) {
78
+      if ($model->deleteAccount()) {
79 79
         $this->redirect(['site/index']);
80 80
       } else {
81 81
         Yii::$app->session->setFlash('error', 'Wrong password!');
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     $model = Yii::$container->get(\site\models\ChangePasswordForm::class, [Yii::$app->user->identity]);
90 90
 
91 91
     if ($model->load(Yii::$app->request->post())) {
92
-      if($model->validate() && $model->changePassword()) {
92
+      if ($model->validate() && $model->changePassword()) {
93 93
         Yii::$app->session->setFlash('success', 'Password successfully changed');
94 94
       } else {
95 95
         Yii::$app->session->setFlash('error', 'Wrong password!');
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
   public function actionChangeEmail(string $token) {
114 114
     $user = Yii::$container->get(\common\interfaces\UserInterface::class)->findByChangeEmailToken($token);
115 115
 
116
-    if($user) {
116
+    if ($user) {
117 117
       $validator = new \yii\validators\EmailValidator();
118
-      if($validator->validate($user->desired_email, $error)) {
118
+      if ($validator->validate($user->desired_email, $error)) {
119 119
         $user->removeChangeEmailToken();
120 120
         $user->email = $user->desired_email;
121 121
         $user->desired_email = null;
122 122
         $user->save();
123
-        if(!Yii::$app->user->isGuest) {
123
+        if (!Yii::$app->user->isGuest) {
124 124
           Yii::$app->user->logout();
125 125
           Yii::$app->session->setFlash('success', 'Your email address was successfully changed. For security, we\'ve logged you out.');
126 126
         } else {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
   public function actionExport() {
142 142
     header("Content-Type: text/csv");
143
-    header("Content-Disposition: attachment; filename=fsa-data-export-".Yii::$app->user->identity->email."-".date('Ymd').".csv");
143
+    header("Content-Disposition: attachment; filename=fsa-data-export-" . Yii::$app->user->identity->email . "-" . date('Ymd') . ".csv");
144 144
 
145 145
     $reader = Yii::$app->user->identity->getExportData();
146 146
     $fp = fopen('php://output', 'w');
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
     fputcsv($fp, $header);
158 158
     $user_behavior = Yii::$container->get(\common\interfaces\UserBehaviorInterface::class);
159
-    while($row = $reader->read()) {
159
+    while ($row = $reader->read()) {
160 160
       $row = $user_behavior::decorateWithCategory([$row]);
161 161
       $row = Yii::$app->user->identity->cleanExportData($row);
162 162
       fputcsv($fp, $row[0]);
Please login to merge, or discard this patch.
site/controllers/SiteController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
   public function actionBlog()
56 56
   {
57 57
     $time = Yii::$container->get(\common\interfaces\TimeInterface::class); 
58
-    $key = "index_blog_".$time->getLocalDate('UTC');
58
+    $key = "index_blog_" . $time->getLocalDate('UTC');
59 59
     $posts = Yii::$app->cache->get($key);
60
-    if($posts === false) {
60
+    if ($posts === false) {
61 61
       $posts = \Yii::$app->getModule('blog')
62 62
                             ->fetch()
63 63
                             ->parse()
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
   {
91 91
     $model = new \site\models\ContactForm();
92 92
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
93
-      if($model->sendEmail(Yii::$app->params['adminEmail'])) {
93
+      if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
94 94
         Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
95 95
       } else {
96 96
         Yii::$app->session->setFlash('error', 'There was an error sending email.');
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
   public function actionSignup()
123 123
   {
124 124
     $model = Yii::$container->get(\site\models\SignupForm::class);
125
-    if($model->load(Yii::$app->request->post()) && $model->validate()) {
125
+    if ($model->load(Yii::$app->request->post()) && $model->validate()) {
126 126
       $model->signup();
127 127
       Yii::$app->session->setFlash('success', 'We have sent a verification email to the email address you provided. Please check your inbox and follow the instructions to verify your account.');
128
-      return $this->redirect('/',302);
128
+      return $this->redirect('/', 302);
129 129
     }
130 130
 
131 131
     return $this->render('signup', [
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
   public function actionRequestPasswordReset()
137 137
   {
138 138
     $model = Yii::$container->get(\site\models\PasswordResetRequestForm::class);
139
-    if($model->load(Yii::$app->request->post()) && $model->validate()) {
140
-      if(!$model->sendEmail()) {
139
+    if ($model->load(Yii::$app->request->post()) && $model->validate()) {
140
+      if (!$model->sendEmail()) {
141 141
         $ip = Yii::$app->getRequest()->getUserIP() ?: "UNKNOWN";
142
-        Yii::warning("$ip has tried to reset the password for ".$model->email);
142
+        Yii::warning("$ip has tried to reset the password for " . $model->email);
143 143
       }
144 144
 
145 145
       Yii::$app->session->setFlash('success', 'If there is an account with the submitted email address you will receive further instructions in your email inbox.');
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
       throw new BadRequestHttpException("Wrong or expired email verification token. If you aren't sure why this error occurs perhaps you've already verified your account. Please try logging in.");
184 184
     }
185 185
 
186
-    if($user->isTokenConfirmed($user->verify_email_token)) {
186
+    if ($user->isTokenConfirmed($user->verify_email_token)) {
187 187
       Yii::$app->session->setFlash('success', 'Your account has already been verified. Please log in.');
188
-      return $this->redirect('/login',302);
188
+      return $this->redirect('/login', 302);
189 189
     } else if (Yii::$app->getUser()->login($user)) {
190 190
       $user->confirmVerifyEmailToken();
191 191
       $user->save();
192 192
       Yii::$app->session->setFlash('success', 'Your account has been verified. Please continue with your check-in.');
193
-      return $this->redirect('/welcome',302);
193
+      return $this->redirect('/welcome', 302);
194 194
     }
195 195
   }
196 196
 
Please login to merge, or discard this patch.
common/components/Controller.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@
 block discarded – undo
33 33
   {
34 34
     return [
35 35
       'error' => [
36
-         'class' => 'yii\web\ErrorAction',
37
-       ],
36
+          'class' => 'yii\web\ErrorAction',
37
+        ],
38 38
       'captcha' => [
39 39
         'class' => 'yii\captcha\CaptchaAction',
40 40
       ],
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
       return false;
20 20
     }
21 21
 
22
-    if(!parent::beforeAction($action)) {
22
+    if (!parent::beforeAction($action)) {
23 23
       return false;
24 24
     }
25 25
 
Please login to merge, or discard this patch.
common/models/LoginForm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,10 +60,10 @@
 block discarded – undo
60 60
    */
61 61
   public function login()
62 62
   {
63
-    if($this->validate()) {
63
+    if ($this->validate()) {
64 64
       $user = $this->getUser();
65
-      if($user->isVerified()) {
66
-        return Yii::$app->user->login($user, $this->rememberMe ? 3600 * 24 * 30 : 0);
65
+      if ($user->isVerified()) {
66
+        return Yii::$app->user->login($user, $this->rememberMe ? 3600*24*30 : 0);
67 67
       } else {
68 68
         Yii::$app->session->setFlash('warning', 'You must verify your account before you can proceed. Please check your email inbox for a verification email and follow the instructions.');
69 69
       }
Please login to merge, or discard this patch.