*/ /** * Klasa MailAccount * * @package stMailPlugin * @subpackage libs */ class MailAccount extends BaseMailAccount { public function hydrate(\ResultSet $rs, $startcol = 1) { $result = parent::hydrate($rs, $startcol); $crypt = Crypt::getInstance(); if ($this->version >= 2 || $crypt->isEncrypted($this->crypt)) { $this->password = $crypt->Decrypt($this->password, $this->crypt); } return $result; } public function save($con = null) { $updateNotification = $this->isModified(); if ($this->getIsDefault() && $this->isColumnModified(MailAccountPeer::IS_DEFAULT)) { $sc = new Criteria(); $sc->add(MailAccountPeer::ID, $this->getId(), Criteria::NOT_EQUAL); $uc = new Criteria(); $uc->add(MailAccountPeer::IS_DEFAULT, false); $con = Propel::getConnection(); BasePeer::doUpdate($sc, $uc, $con); } if ($this->getIsNewsletter() && $this->isColumnModified(MailAccountPeer::IS_DEFAULT)) { $sc = new Criteria(); $sc->add(MailAccountPeer::ID, $this->getId(), Criteria::NOT_EQUAL); $uc = new Criteria(); $uc->add(MailAccountPeer::IS_NEWSLETTER, false); $con = Propel::getConnection(); BasePeer::doUpdate($sc, $uc, $con); } $crypt = Crypt::getInstance(); if ($this->isModified(MailAccountPeer::PASSWORD) || $this->version < 2 || !$crypt->isEncrypted($this->crypt)) { $this->setPassword($crypt->Encrypt($this->getPassword())); $this->setCrypt(Crypt::VERSION); $this->setVersion(2); } $result = parent::save($con); if ($updateNotification) { stMailer::getInstance()->validateAccountConfiguration(); } return $result; } public function delete($con = null) { $result = parent::delete($con); stMailer::getInstance()->validateAccountConfiguration(); return $result; } }