Пример #1
0
 public function beforeSave()
 {
     $crypt = new EncryptionClass();
     if ($this->get('input_type') == 'password') {
         $this->set('value', $crypt->encrypt($this->app->config('globalSalt'), $this->get('value')));
     }
 }
Пример #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $salt = $input->getOption('salt');
     $adjustments = $input->getOption('adjust');
     $modulus = $input->getOption('modulus');
     $crypt = new EncryptionClass();
     $crypt->setAdjustment($adjustments);
     // 1st adjustment value (optional)
     $crypt->setModulus($modulus);
     // 2nd adjustment value (optional)
     $output->writeln($crypt->decrypt($salt, $input->getArgument('string')));
 }
 protected function setInstanceAttributes($instance)
 {
     if (!empty($this->params[$this->instanceName])) {
         if ($instance->get('input_type') == 'password') {
             // If nothing changed and "save" is pressed, don't re-encrypt the encrypted value.
             if ($this->params[$this->instanceName]['value'] == $instance->get('value')) {
                 $crypt = new EncryptionClass();
                 $this->params[$this->instanceName]['value'] = $crypt->decrypt($this->app->config('globalSalt'), $this->params[$this->instanceName]['value']);
             }
         }
         $instance->import($this->params[$this->instanceName]);
     }
     return $instance;
 }
Пример #4
0
 private function initMail()
 {
     require_once $this->app->config('basePath') . 'library/PHPMailer/class.phpmailer.php';
     $crypt = new EncryptionClass();
     $this->_mail = new \PHPMailer();
     $this->_mail->IsSMTP();
     // Set mailer to use SMTP
     $this->_mail->Host = $this->app->config('smtpHost');
     // Specify main and backup server
     $this->_mail->SMTPAuth = true;
     // Enable SMTP authentication
     $this->_mail->Username = $this->app->config('smtpUsername');
     // SMTP username
     $this->_mail->Password = $crypt->decrypt($this->app->config('globalSalt'), $this->app->config('smtpPassword'));
     // SMTP password
     $this->_mail->SMTPSecure = $this->app->config('smtpSecurity');
     // Enable encryption, 'ssl' also accepted
     $this->_mail->Port = $this->app->config("smtpPort");
     $this->_mail->From = $this->app->config('senderEmail');
     $this->_mail->FromName = $this->app->config('senderName');
     $this->_mail->AddReplyTo($this->app->config('replyToEmail'), $this->app->config('replyToName'));
     $this->_mail->WordWrap = 100;
     //		$this->_mail->SMTPDebug = 1; // for debugging
 }