["type"=>"VARCHAR(255)","nullable"=>false], "rxServer"=>["type"=>"VARCHAR(255)", "nullable"=>true], "rxProto"=>["type"=>"VARCHAR(255)", "nullable"=>true], "txServer"=>["type"=>"VARCHAR(255)", "nullable"=>true], "txProto"=>["type"=>"VARCHAR(255)", "nullable"=>true], "login"=>["type"=>"VARCHAR(255)", "nullable"=>false], "password"=>["type"=>"TEXT", "nullable"=>true], "module"=>["type"=>"VARCHAR(255)", "nullable"=>true], "rxFolder"=>["type"=>"VARCHAR(255)", "nullable"=>true], "rxArchiveFolder"=>["type"=>"VARCHAR(255)", "nullable"=>true], ]; public function __get($key) { switch ($key) { case "password": return xcrypt::decrypt($this->__password); case "rxLogin": return $this->login; case "rxPassword": return xcrypt::decrypt($this->__password); case "rxLogin": return $this->login; case "rxPassword": return xcrypt::decrypt($this->__password); default: return parent::__get($key); } } public function __set($key, $val) { switch ($key) { case "password": $this->__password = xcrypt::encrypt($val); break; default: parent::__set($key, $val); } } public function connect() { return new mailClient($this); } protected function validateSave() { if (empty($this->login) || empty($this->__password) || empty($this->address)) { return false;} return true; } public static function getDefaultAccount(&$sql=null) { $ref = new static(); $sql = $ref->getSql(); $rv = $sql->quickExec1Line("select * from `tblMailAccounts` where `default` = 1 limit 1"); if ($rv) { return new static($rv); } else {return null;} } }