%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.248 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/water/frontend/controllers/ |
Upload File : |
<?php namespace frontend\controllers; use frontend\models\ResendVerificationEmailForm; use frontend\models\VerifyEmailForm; use Yii; use yii\base\InvalidArgumentException; use yii\web\BadRequestHttpException; use yii\web\Controller; use yii\filters\VerbFilter; use yii\filters\AccessControl; use common\models\LoginForm; use frontend\models\PasswordResetRequestForm; use frontend\models\ResetPasswordForm; use frontend\models\SignupForm; use frontend\models\ContactForm; /** * Site controller */ class SiteController extends Controller { /** * {@inheritdoc} */ public function behaviors() { return [ 'access' => [ 'class' => AccessControl::className(), 'only' => ['logout', 'signup'], 'rules' => [ [ 'actions' => ['signup'], 'allow' => true, 'roles' => ['?'], ], [ 'actions' => ['logout'], 'allow' => true, 'roles' => ['@'], ], ], ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'logout' => ['post'], ], ], ]; } /** * {@inheritdoc} */ public function actions() { return [ 'error' => [ 'class' => 'yii\web\ErrorAction', ], 'captcha' => [ 'class' => 'yii\captcha\CaptchaAction', 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, ], ]; } /** * Displays homepage. * * @return mixed */ public function actionIndex() { return $this->render('index'); } /** * Logs in a user. * * @return mixed */ public function actionLogin() { if (!Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } else { $model->password = ''; return $this->render('login', [ 'model' => $model, ]); } } /** * Logs out the current user. * * @return mixed */ public function actionLogout() { Yii::$app->user->logout(); return $this->goHome(); } /** * Displays contact page. * * @return mixed */ public function actionContact() { $model = new ContactForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail(Yii::$app->params['adminEmail'])) { Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.'); } else { Yii::$app->session->setFlash('error', 'There was an error sending your message.'); } return $this->refresh(); } else { return $this->render('contact', [ 'model' => $model, ]); } } /** * Displays about page. * * @return mixed */ public function actionAbout() { return $this->render('about'); } /** * Signs user up. * * @return mixed */ public function actionSignup() { $model = new SignupForm(); if ($model->load(Yii::$app->request->post()) && $model->signup()) { Yii::$app->session->setFlash('success', 'Thank you for registration. Please check your inbox for verification email.'); return $this->goHome(); } return $this->render('signup', [ 'model' => $model, ]); } /** * Requests password reset. * * @return mixed */ public function actionRequestPasswordReset() { $model = new PasswordResetRequestForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail()) { Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); return $this->goHome(); } else { Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for the provided email address.'); } } return $this->render('requestPasswordResetToken', [ 'model' => $model, ]); } /** * Resets password. * * @param string $token * @return mixed * @throws BadRequestHttpException */ public function actionResetPassword($token) { try { $model = new ResetPasswordForm($token); } catch (InvalidArgumentException $e) { throw new BadRequestHttpException($e->getMessage()); } if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { Yii::$app->session->setFlash('success', 'New password saved.'); return $this->goHome(); } return $this->render('resetPassword', [ 'model' => $model, ]); } /** * Verify email address * * @param string $token * @throws BadRequestHttpException * @return yii\web\Response */ public function actionVerifyEmail($token) { try { $model = new VerifyEmailForm($token); } catch (InvalidArgumentException $e) { throw new BadRequestHttpException($e->getMessage()); } if ($user = $model->verifyEmail()) { if (Yii::$app->user->login($user)) { Yii::$app->session->setFlash('success', 'Your email has been confirmed!'); return $this->goHome(); } } Yii::$app->session->setFlash('error', 'Sorry, we are unable to verify your account with provided token.'); return $this->goHome(); } /** * Resend verification email * * @return mixed */ public function actionResendVerificationEmail() { $model = new ResendVerificationEmailForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail()) { Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); return $this->goHome(); } Yii::$app->session->setFlash('error', 'Sorry, we are unable to resend verification email for the provided email address.'); } return $this->render('resendVerificationEmail', [ 'model' => $model ]); } }