@@ -48,7 +48,7 @@ |
||
48 | 48 | // check that the desired_email is not already the email of another user |
49 | 49 | $user = $this->user->findByEmail($this->desired_email); |
50 | 50 | // if it is, we do nothing and return true, don't leak the data |
51 | - if(!$user) { |
|
51 | + if (!$user) { |
|
52 | 52 | $this->user->desired_email = $this->desired_email; |
53 | 53 | $this->user->generateChangeEmailToken(); |
54 | 54 | $this->user->save(); |
@@ -24,11 +24,11 @@ |
||
24 | 24 | ]); ?> |
25 | 25 | <?= $form->field($profile, 'timezone')->dropDownList(array_combine($timezones, $timezones)); ?> |
26 | 26 | <?= $form->field($profile, 'expose_graph')->checkbox() ?> |
27 | - <?php if($profile->expose_graph): ?> |
|
27 | + <?php if ($profile->expose_graph): ?> |
|
28 | 28 | <div class='alert alert-success score-graph-info'>Your score graph can be found at:<br /> <a id="score-graph-link" target="_blank" href="<?=$graph_url?>"><?=$graph_url?></a></div> |
29 | 29 | <?php endif; ?> |
30 | 30 | <?= $form->field($profile, 'send_email')->checkbox() ?> |
31 | - <div id='email_threshold_fields' <?php if(!$profile->send_email) { ?>style="display: none;"<?php } ?>> |
|
31 | + <div id='email_threshold_fields' <?php if (!$profile->send_email) { ?>style="display: none;"<?php } ?>> |
|
32 | 32 | <?= $form->field($profile, 'email_threshold')->textInput(['class'=>'form-control', 'style'=>'width: 50px;'])->input('number', ['min' => 0, 'max' => 1000]) ?> |
33 | 33 | <?= $form->field($profile, 'partner_email1')->input('email'); ?> |
34 | 34 | <?= $form->field($profile, 'partner_email2')->input('email'); ?> |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | $graph = Yii::$container |
82 | 82 | ->get(\common\components\Graph::class, [$this->user]); |
83 | 83 | |
84 | - if($this->timezone) |
|
84 | + if ($this->timezone) |
|
85 | 85 | $user->timezone = $this->timezone; |
86 | - if($this->expose_graph) { |
|
86 | + if ($this->expose_graph) { |
|
87 | 87 | $user->expose_graph = true; |
88 | 88 | |
89 | 89 | // generate scores graph image |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | // if they haven't done a check-in in the last month this |
92 | 92 | // will explode because $scores_last_month is an empty |
93 | 93 | // array |
94 | - if($scores_last_month) { |
|
94 | + if ($scores_last_month) { |
|
95 | 95 | $graph->create($scores_last_month, true); |
96 | 96 | } |
97 | 97 | } else { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // remove scores graph image |
100 | 100 | $graph->destroy(); |
101 | 101 | } |
102 | - if($this->send_email) { |
|
102 | + if ($this->send_email) { |
|
103 | 103 | $user->email_threshold = $this->email_threshold; |
104 | 104 | $user->partner_email1 = $this->partner_email1; |
105 | 105 | $user->partner_email2 = $this->partner_email2; |
@@ -81,8 +81,9 @@ |
||
81 | 81 | $graph = Yii::$container |
82 | 82 | ->get(\common\components\Graph::class, [$this->user]); |
83 | 83 | |
84 | - if($this->timezone) |
|
85 | - $user->timezone = $this->timezone; |
|
84 | + if($this->timezone) { |
|
85 | + $user->timezone = $this->timezone; |
|
86 | + } |
|
86 | 87 | if($this->expose_graph) { |
87 | 88 | $user->expose_graph = true; |
88 | 89 |
@@ -27,7 +27,7 @@ discard block |
||
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 | ], |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | if ($editProfileForm->load(Yii::$app->request->post())) { |
74 | 74 | $saved_user = $editProfileForm->saveProfile(); |
75 | - if($saved_user) { |
|
75 | + if ($saved_user) { |
|
76 | 76 | Yii::$app->getSession()->setFlash('success', 'New profile data saved!'); |
77 | 77 | } |
78 | 78 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $model = Yii::$container->get(\site\models\DeleteAccountForm::class, [Yii::$app->user->identity]); |
91 | 91 | |
92 | 92 | if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
93 | - if($model->deleteAccount()) { |
|
93 | + if ($model->deleteAccount()) { |
|
94 | 94 | $this->redirect(['site/index']); |
95 | 95 | } else { |
96 | 96 | Yii::$app->getSession()->setFlash('error', 'Wrong password!'); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $model = Yii::$container->get(\site\models\ChangePasswordForm::class, [Yii::$app->user->identity]); |
105 | 105 | |
106 | 106 | if ($model->load(Yii::$app->request->post())) { |
107 | - if($model->validate() && $model->changePassword()) { |
|
107 | + if ($model->validate() && $model->changePassword()) { |
|
108 | 108 | Yii::$app->getSession()->setFlash('success', 'Password successfully changed'); |
109 | 109 | } else { |
110 | 110 | Yii::$app->getSession()->setFlash('error', 'Wrong password!'); |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | public function actionChangeEmail(string $token) { |
129 | 129 | $user = Yii::$container->get(\common\interfaces\UserInterface::class)->findByChangeEmailToken($token); |
130 | 130 | |
131 | - if($user) { |
|
131 | + if ($user) { |
|
132 | 132 | $validator = new \yii\validators\EmailValidator(); |
133 | - if($validator->validate($user->desired_email, $error)) { |
|
133 | + if ($validator->validate($user->desired_email, $error)) { |
|
134 | 134 | $user->removeChangeEmailToken(); |
135 | 135 | $user->email = $user->desired_email; |
136 | 136 | $user->desired_email = null; |
137 | 137 | $user->save(); |
138 | - if(!Yii::$app->user->isGuest) { |
|
138 | + if (!Yii::$app->user->isGuest) { |
|
139 | 139 | Yii::$app->user->logout(); |
140 | 140 | Yii::$app->session->setFlash('success', 'Your email address was successfully changed. For security, we\'ve logged you out.'); |
141 | 141 | } else { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | public function actionExport() { |
157 | 157 | header("Content-Type: text/csv"); |
158 | - header("Content-Disposition: attachment; filename=fsa-data-export-".Yii::$app->user->identity->email."-".date('Ymd').".csv"); |
|
158 | + header("Content-Disposition: attachment; filename=fsa-data-export-" . Yii::$app->user->identity->email . "-" . date('Ymd') . ".csv"); |
|
159 | 159 | |
160 | 160 | $reader = Yii::$app->user->identity->getExportData(); |
161 | 161 | $fp = fopen('php://output', 'w'); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | fputcsv($fp, $header); |
173 | 173 | $user_behavior = Yii::$container->get(\common\interfaces\UserBehaviorInterface::class); |
174 | - while($row = $reader->read()) { |
|
174 | + while ($row = $reader->read()) { |
|
175 | 175 | $row = $user_behavior::decorateWithCategory([$row]); |
176 | 176 | $row = Yii::$app->user->identity->cleanExportData($row); |
177 | 177 | fputcsv($fp, $row[0]); |