diff --git a/ingo/lib/Storage/Rule.php b/ingo/lib/Storage/Rule.php index 8b1913a8b64..1cfddf0ce0b 100644 --- a/ingo/lib/Storage/Rule.php +++ b/ingo/lib/Storage/Rule.php @@ -29,13 +29,6 @@ class Ingo_Storage_Rule */ protected $_obtype; - /** - * Whether the rule has been saved (if being saved separately). - * - * @var boolean - */ - protected $_saved = false; - /** * Returns the object rule type. * @@ -46,26 +39,6 @@ public function obType() return $this->_obtype; } - /** - * Marks the rule as saved or unsaved. - * - * @param boolean $data Whether the rule has been saved. - */ - public function setSaved($data) - { - $this->_saved = $data; - } - - /** - * Returns whether the rule has been saved. - * - * @return boolean True if the rule has been saved. - */ - public function isSaved() - { - return $this->_saved; - } - /** * Function to manage an internal address list. * diff --git a/ingo/lib/Storage/Sql.php b/ingo/lib/Storage/Sql.php index fd7c177e617..6e2f2676e76 100644 --- a/ingo/lib/Storage/Sql.php +++ b/ingo/lib/Storage/Sql.php @@ -24,6 +24,13 @@ */ class Ingo_Storage_Sql extends Ingo_Storage { + /** + * Whether the rule has been saved (if being saved separately). + * + * @var boolean + */ + protected $_saved = false; + /** * Retrieves the specified data from the storage backend. * @@ -87,7 +94,7 @@ protected function _retrieve($field, $readonly = false) if (!empty($data)) { $ob->setForwardAddresses(explode("\n", $data['forward_addresses'])); $ob->setForwardKeep((bool)$data['forward_keep']); - $ob->setSaved(true); + $this->_saved = true; } elseif ($data = @unserialize($GLOBALS['prefs']->getDefault('forward'))) { $ob->setForwardAddresses($data['a']); $ob->setForwardKeep($data['k']); @@ -113,7 +120,7 @@ protected function _retrieve($field, $readonly = false) $ob->setVacationIgnorelist((bool)$data['vacation_ignorelists']); $ob->setVacationReason(Horde_String::convertCharset($data['vacation_reason'], $this->_params['charset'], 'UTF-8')); $ob->setVacationSubject(Horde_String::convertCharset($data['vacation_subject'], $this->_params['charset'], 'UTF-8')); - $ob->setSaved(true); + $this->_saved = true; } elseif ($data = @unserialize($GLOBALS['prefs']->getDefault('vacation'))) { $ob->setVacationAddresses($data['addresses'], false); $ob->setVacationDays($data['days']); @@ -143,7 +150,7 @@ protected function _retrieve($field, $readonly = false) if (!empty($data)) { $ob->setSpamFolder($data['spam_folder']); $ob->setSpamLevel((int)$data['spam_level']); - $ob->setSaved(true); + $this->_saved = true; } elseif ($data = @unserialize($GLOBALS['prefs']->getDefault('spam'))) { $ob->setSpamFolder($data['folder']); $ob->setSpamLevel($data['level']); @@ -207,7 +214,7 @@ protected function _store($ob) throw new Ingo_Exception($e); } } - $ob->setSaved(true); + $this->_saved = true; break; case self::ACTION_FORWARD: @@ -216,7 +223,7 @@ protected function _store($ob) (int)(bool)$ob->getForwardKeep(), Ingo::getUser()); try { - if ($ob->isSaved()) { + if ($this->_saved) { $query = sprintf('UPDATE %s SET forward_addresses = ?, forward_keep = ? WHERE forward_owner = ?', $this->_params['table_forwards']); $this->_params['db']->update($query, $values); } else { @@ -226,7 +233,7 @@ protected function _store($ob) } catch (Horde_Db_Exception $e) { throw new Ingo_Exception($e); } - $ob->setSaved(true); + $this->_saved = true; break; case self::ACTION_VACATION: @@ -246,7 +253,7 @@ protected function _store($ob) Ingo::getUser() ); try { - if ($ob->isSaved()) { + if ($this->_saved) { $query = sprintf('UPDATE %s SET vacation_addresses = ?, vacation_subject = ?, vacation_reason = ?, vacation_days = ?, vacation_start = ?, vacation_end = ?, vacation_excludes = ?, vacation_ignorelists = ? WHERE vacation_owner = ?', $this->_params['table_vacations']); $this->_params['db']->update($query, $values); } else { @@ -256,7 +263,7 @@ protected function _store($ob) } catch (Horde_Db_Exception $e) { throw new Ingo_Exception($e); } - $ob->setSaved(true); + $this->_saved = true; break; case self::ACTION_SPAM: @@ -265,7 +272,7 @@ protected function _store($ob) $ob->getSpamFolder(), Ingo::getUser()); try { - if ($ob->isSaved()) { + if ($this->_saved) { $query = sprintf('UPDATE %s SET spam_level = ?, spam_folder = ? WHERE spam_owner = ?', $this->_params['table_spam']); $this->_params['db']->update($query, $values); } else { @@ -275,7 +282,7 @@ protected function _store($ob) } catch (Horde_Db_Exception $e) { throw new Ingo_Exception($e); } - $ob->setSaved(true); + $this->_saved = true; break; } }