Example #1
0
 /**
  * Can load default profile or J! profile in addition to standard behavior 
  * 
  * @param type $data 
  */
 public function load($data)
 {
     if (!parent::load($data)) {
         if (!is_numeric($data) || $data != self::DEFAULT_SMTP_ID && $data != self::JOOMLA_SMTP_ID) {
             return false;
         }
         // If user wants to load DEFAULT SMTPP then determine it.
         if ($data == self::DEFAULT_SMTP_ID) {
             $data = $this->getDefaultSmtpId();
         }
         // If we determine that need to load J! SMTPP
         // then change filter to load it.
         if ($data == self::JOOMLA_SMTP_ID) {
             $data = array('is_joomla' => 1);
             $isJoomla = true;
         }
         if (!parent::load($data)) {
             if (empty($isJoomla)) {
                 return false;
             }
             if (!$this->save((array) $this->_getJoomlaProfile())) {
                 return false;
             }
         }
     }
     // If loaded profile is J! profile
     // then fill it with J! SMTP settings
     if ($this->isJoomlaProfile()) {
         $this->addFromArray($this->_getJoomlaProfile());
     }
     if (empty($this->_data->params)) {
         $this->_data->params = (object) $this->_defaults['params'];
         $this->save();
     }
     return true;
 }
Example #2
0
 /**
  * Deletes subscriber's and/or user's row
  * 
  * @return type 
  */
 public function delete()
 {
     if ($this->isJoomlaUserType()) {
         throw Exception('The deleting of Joomla users is not allowed');
     }
     if (!$this->getId() || !parent::delete($this->getId())) {
         return false;
     }
     return true;
 }
Example #3
0
 /**
  * Load default Mailbox profile
  * 
  * @param type $data 
  */
 public function loadDefault()
 {
     return parent::load($this->getDefaultId());
 }