%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,mail,shell_exec,system,proc_open,popen,ini_alter,dl,proc_close,curl_exec,curl_multi_exec,readfile,parse_ini_file,escapeshellarg,escapeshellcmd,show_source,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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,mail,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/water/vendor/dektrium/yii2-user/ |
Upload File : |
<?php /* * This file is part of the Dektrium project. * * (c) Dektrium project <http://github.com/dektrium/> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace dektrium\user; use dektrium\user\models\Token; use dektrium\user\models\User; use Yii; use yii\base\Component; /** * Mailer. * * @author Dmitry Erofeev <dmeroff@gmail.com> */ class Mailer extends Component { /** @var string */ public $viewPath = '@dektrium/user/views/mail'; /** @var string|array Default: `Yii::$app->params['adminEmail']` OR `no-reply@example.com` */ public $sender; /** @var \yii\mail\BaseMailer Default: `Yii::$app->mailer` */ public $mailerComponent; /** @var string */ protected $welcomeSubject; /** @var string */ protected $newPasswordSubject; /** @var string */ protected $confirmationSubject; /** @var string */ protected $reconfirmationSubject; /** @var string */ protected $recoverySubject; /** @var \dektrium\user\Module */ protected $module; /** * @return string */ public function getWelcomeSubject() { if ($this->welcomeSubject == null) { $this->setWelcomeSubject(Yii::t('user', 'Welcome to {0}', Yii::$app->name)); } return $this->welcomeSubject; } /** * @param string $welcomeSubject */ public function setWelcomeSubject($welcomeSubject) { $this->welcomeSubject = $welcomeSubject; } /** * @return string */ public function getNewPasswordSubject() { if ($this->newPasswordSubject == null) { $this->setNewPasswordSubject(Yii::t('user', 'Your password on {0} has been changed', Yii::$app->name)); } return $this->newPasswordSubject; } /** * @param string $newPasswordSubject */ public function setNewPasswordSubject($newPasswordSubject) { $this->newPasswordSubject = $newPasswordSubject; } /** * @return string */ public function getConfirmationSubject() { if ($this->confirmationSubject == null) { $this->setConfirmationSubject(Yii::t('user', 'Confirm account on {0}', Yii::$app->name)); } return $this->confirmationSubject; } /** * @param string $confirmationSubject */ public function setConfirmationSubject($confirmationSubject) { $this->confirmationSubject = $confirmationSubject; } /** * @return string */ public function getReconfirmationSubject() { if ($this->reconfirmationSubject == null) { $this->setReconfirmationSubject(Yii::t('user', 'Confirm email change on {0}', Yii::$app->name)); } return $this->reconfirmationSubject; } /** * @param string $reconfirmationSubject */ public function setReconfirmationSubject($reconfirmationSubject) { $this->reconfirmationSubject = $reconfirmationSubject; } /** * @return string */ public function getRecoverySubject() { if ($this->recoverySubject == null) { $this->setRecoverySubject(Yii::t('user', 'Complete password reset on {0}', Yii::$app->name)); } return $this->recoverySubject; } /** * @param string $recoverySubject */ public function setRecoverySubject($recoverySubject) { $this->recoverySubject = $recoverySubject; } /** @inheritdoc */ public function init() { $this->module = Yii::$app->getModule('user'); parent::init(); } /** * Sends an email to a user after registration. * * @param User $user * @param Token $token * @param bool $showPassword * * @return bool */ public function sendWelcomeMessage(User $user, Token $token = null, $showPassword = false) { return $this->sendMessage( $user->email, $this->getWelcomeSubject(), 'welcome', ['user' => $user, 'token' => $token, 'module' => $this->module, 'showPassword' => $showPassword] ); } /** * Sends a new generated password to a user. * * @param User $user * @param Password $password * * @return bool */ public function sendGeneratedPassword(User $user, $password) { return $this->sendMessage( $user->email, $this->getNewPasswordSubject(), 'new_password', ['user' => $user, 'password' => $password, 'module' => $this->module] ); } /** * Sends an email to a user with confirmation link. * * @param User $user * @param Token $token * * @return bool */ public function sendConfirmationMessage(User $user, Token $token) { return $this->sendMessage( $user->email, $this->getConfirmationSubject(), 'confirmation', ['user' => $user, 'token' => $token] ); } /** * Sends an email to a user with reconfirmation link. * * @param User $user * @param Token $token * * @return bool */ public function sendReconfirmationMessage(User $user, Token $token) { if ($token->type == Token::TYPE_CONFIRM_NEW_EMAIL) { $email = $user->unconfirmed_email; } else { $email = $user->email; } return $this->sendMessage( $email, $this->getReconfirmationSubject(), 'reconfirmation', ['user' => $user, 'token' => $token] ); } /** * Sends an email to a user with recovery link. * * @param User $user * @param Token $token * * @return bool */ public function sendRecoveryMessage(User $user, Token $token) { return $this->sendMessage( $user->email, $this->getRecoverySubject(), 'recovery', ['user' => $user, 'token' => $token] ); } /** * @param string $to * @param string $subject * @param string $view * @param array $params * * @return bool */ protected function sendMessage($to, $subject, $view, $params = []) { $mailer = $this->mailerComponent === null ? Yii::$app->mailer : Yii::$app->get($this->mailerComponent); $mailer->viewPath = $this->viewPath; $mailer->getView()->theme = Yii::$app->view->theme; if ($this->sender === null) { $this->sender = isset(Yii::$app->params['adminEmail']) ? Yii::$app->params['adminEmail'] : 'no-reply@example.com'; } return $mailer->compose(['html' => $view, 'text' => 'text/' . $view], $params) ->setTo($to) ->setFrom($this->sender) ->setSubject($subject) ->send(); } }