@@ -55,9 +55,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (!empty($this->json)) { |
| 39 | - foreach($this->json[self::POS_READY] as $json_name => $json_value) { |
|
| 39 | + foreach ($this->json[self::POS_READY] as $json_name => $json_value) { |
|
| 40 | 40 | $lines[] = Html::script($json_value, ['type' => 'application/json', 'id' => $json_name]); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -33,8 +33,8 @@ |
||
| 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 | ], |
@@ -60,10 +60,10 @@ |
||
| 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 | } |
@@ -12,13 +12,13 @@ |
||
| 12 | 12 | class Category extends \yii\base\BaseObject implements \common\interfaces\CategoryInterface { |
| 13 | 13 | |
| 14 | 14 | public static $categories = [ |
| 15 | - [ "id" => 1, "name" => "Restoration"], |
|
| 16 | - [ "id" => 2, "name" => "Forgetting Priorities"], |
|
| 17 | - [ "id" => 3, "name" => "Anxiety"], |
|
| 18 | - [ "id" => 4, "name" => "Speeding Up"], |
|
| 19 | - [ "id" => 5, "name" => "Ticked Off"], |
|
| 20 | - [ "id" => 6, "name" => "Exhausted"], |
|
| 21 | - [ "id" => 7, "name" => "Relapse/Moral Failure"], |
|
| 15 | + ["id" => 1, "name" => "Restoration"], |
|
| 16 | + ["id" => 2, "name" => "Forgetting Priorities"], |
|
| 17 | + ["id" => 3, "name" => "Anxiety"], |
|
| 18 | + ["id" => 4, "name" => "Speeding Up"], |
|
| 19 | + ["id" => 5, "name" => "Ticked Off"], |
|
| 20 | + ["id" => 6, "name" => "Exhausted"], |
|
| 21 | + ["id" => 7, "name" => "Relapse/Moral Failure"], |
|
| 22 | 22 | ]; |
| 23 | 23 | |
| 24 | 24 | public static $colors = [ |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | 'common\interfaces\QuestionInterface' => \common\models\Question::class, |
| 11 | 11 | 'common\interfaces\BehaviorInterface' => \common\models\Behavior::class, |
| 12 | 12 | 'common\interfaces\CategoryInterface' => \common\models\Category::class, |
| 13 | - 'common\interfaces\TimeInterface' => function () { |
|
| 14 | - if(Yii::$app->user->getIsGuest()) { |
|
| 13 | + 'common\interfaces\TimeInterface' => function() { |
|
| 14 | + if (Yii::$app->user->getIsGuest()) { |
|
| 15 | 15 | return new \common\components\Time('UTC'); |
| 16 | 16 | } else { |
| 17 | 17 | return new \common\components\Time(Yii::$app->user->identity->timezone); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | ], |
| 29 | 29 | 'components' => [ |
| 30 | 30 | // by default, sessions are stored in a local file |
| 31 | - 'cache' => [ // DummyCache never actually caches anything |
|
| 31 | + 'cache' => [// DummyCache never actually caches anything |
|
| 32 | 32 | 'class'=> yii\caching\DummyCache::class, |
| 33 | 33 | ], |
| 34 | 34 | 'mailer' => [ |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | use \Codeception\Specify; |
| 15 | 15 | |
| 16 | 16 | private $user; |
| 17 | - private $filepath = __DIR__.'/../../_output/test_graph.png'; |
|
| 18 | - private $filepath_extra = __DIR__.'/../../_output/charts/test_graph.png'; |
|
| 17 | + private $filepath = __DIR__ . '/../../_output/test_graph.png'; |
|
| 18 | + private $filepath_extra = __DIR__ . '/../../_output/charts/test_graph.png'; |
|
| 19 | 19 | |
| 20 | 20 | public function setUp() { |
| 21 | 21 | $this->user = $this->getMockBuilder('\site\tests\_support\MockUser') |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | ->willReturn('random1DH4sh'); |
| 37 | 37 | $graph = new Graph($this->user); |
| 38 | 38 | |
| 39 | - expect('the expected graph image filepath will be returned', $this->assertEquals(dirname(dirname(dirname(dirname(__DIR__)))).'/site/web/charts/random1DH4sh.png', $graph->getFilepath())); |
|
| 39 | + expect('the expected graph image filepath will be returned', $this->assertEquals(dirname(dirname(dirname(dirname(__DIR__)))) . '/site/web/charts/random1DH4sh.png', $graph->getFilepath())); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function testGetUrl() { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | ->method('getFilepath') |
| 58 | 58 | ->willReturn($this->filepath); |
| 59 | 59 | |
| 60 | - if(!file_exists($this->filepath) && preg_match('%/_output/test_graph.png$%', $this->filepath)) { |
|
| 60 | + if (!file_exists($this->filepath) && preg_match('%/_output/test_graph.png$%', $this->filepath)) { |
|
| 61 | 61 | touch($this->filepath); |
| 62 | 62 | expect('just a check to be sure $filepath is sane', $this->assertStringEndsWith('/_output/test_graph.png', $this->filepath)); |
| 63 | 63 | expect('the generated file should exist', $this->assertFileExists($this->filepath)); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | expect('the generated file should be readable', $this->assertFileExists($this->filepath_extra)); |
| 90 | 90 | |
| 91 | 91 | // cleanup |
| 92 | - if(file_exists($this->filepath_extra) && preg_match('%/_output/charts/test_graph.png%', $this->filepath_extra)) { |
|
| 92 | + if (file_exists($this->filepath_extra) && preg_match('%/_output/charts/test_graph.png%', $this->filepath_extra)) { |
|
| 93 | 93 | // just in case something is weird, we don't want to straight rm this file |
| 94 | 94 | unlink($this->filepath_extra); |
| 95 | 95 | rmdir(dirname($this->filepath_extra)); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | -function checkinBreakdown () { |
|
| 100 | +function checkinBreakdown() { |
|
| 101 | 101 | return [ |
| 102 | 102 | '2019-01-31' => [], |
| 103 | 103 | '2019-02-01' => [], |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | '2019-02-27' => [], |
| 231 | 231 | '2019-02-28' => [], |
| 232 | 232 | '2019-03-01' => [ |
| 233 | - 2 => [ 'name' => 'Forgetting Priorities', |
|
| 233 | + 2 => ['name' => 'Forgetting Priorities', |
|
| 234 | 234 | 'count' => 6, |
| 235 | 235 | 'color' => '#4CA100', |
| 236 | 236 | 'highlight' => '#61B219', |
@@ -41,11 +41,11 @@ |
||
| 41 | 41 | |
| 42 | 42 | // Set up dependency injections |
| 43 | 43 | Yii::$container |
| 44 | - ->set(\common\interfaces\TimeInterface::class, function () { return new \common\components\Time('UTC'); }); |
|
| 44 | + ->set(\common\interfaces\TimeInterface::class, function() { return new \common\components\Time('UTC'); }); |
|
| 45 | 45 | Yii::$container |
| 46 | - ->set(\common\components\Graph::class, function () { return $this->graph; }); |
|
| 46 | + ->set(\common\components\Graph::class, function() { return $this->graph; }); |
|
| 47 | 47 | Yii::$container |
| 48 | - ->set(\common\interfaces\UserBehaviorInterface::class, function () { return new FakeUserBehavior(); }); |
|
| 48 | + ->set(\common\interfaces\UserBehaviorInterface::class, function() { return new FakeUserBehavior(); }); |
|
| 49 | 49 | |
| 50 | 50 | // Actually begin testing |
| 51 | 51 | $form->attributes = $this->values; |
@@ -70,11 +70,11 @@ |
||
| 70 | 70 | ]); ?> |
| 71 | 71 | <?= $form->field($profile, 'timezone')->dropDownList(array_combine($timezones, $timezones)); ?> |
| 72 | 72 | <?= $form->field($profile, 'expose_graph')->checkbox() ?> |
| 73 | - <?php if($profile->expose_graph): ?> |
|
| 73 | + <?php if ($profile->expose_graph): ?> |
|
| 74 | 74 | <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> |
| 75 | 75 | <?php endif; ?> |
| 76 | 76 | <?= $form->field($profile, 'send_email')->checkbox() ?> |
| 77 | - <div id='send_email_fields' <?php if(!$profile->send_email) { ?>style="display: none;"<?php } ?>> |
|
| 77 | + <div id='send_email_fields' <?php if (!$profile->send_email) { ?>style="display: none;"<?php } ?>> |
|
| 78 | 78 | <?= $form->field($profile, 'partner_email1')->input('email'); ?> |
| 79 | 79 | <?= $form->field($profile, 'partner_email2')->input('email'); ?> |
| 80 | 80 | <?= $form->field($profile, 'partner_email3')->input('email'); ?> |