示例#1
0
 public function __get($key)
 {
     if ($key == 'mysql') {
         if (is_null($this->mysql)) {
             $this->mysql = MySQLConnect::getConnect();
         }
         return $this->mysql;
     }
     return parent::__get($key);
 }
示例#2
0
 public function doTest()
 {
     $mail = new Mail(MySQLConnect::getConnect());
     //$id = 1;
     //$mail->read($id);
     //$mail->subject = 'Hello';
     //$mail->body = 'Its a message body....';
     //$mail->update();
     $mail->create();
     var_dump($mail);
     return $this->website->page('login');
 }
示例#3
0
 public function registry(Post $post, $salt, Theme $theme)
 {
     $success = false;
     $post->password = crypt($post->password, $salt);
     $post->drop('password2');
     $post->drop('csrf');
     try {
         if (!MySQLConnect::getConnect()->add('users', $post)) {
             throw new UserException('registry error');
         }
     } catch (MySQLConnectUniqueExistsException $e) {
         throw new UserExistsException('user already exists');
     }
     $mailer = new Mailer($post->email);
     $mailtpl = $theme->getEmail('registry', $post);
     $mailCRUD = new CRUD('mails');
     $mailCRUD->merge = $post;
     $mailCRUD->content = $mailtpl;
     if ($mailer->send('Registry activate', $mailtpl)) {
         $mail->save();
         $success = true;
     }
     return $success;
 }