{
global $prefs;
- $src = $prefs->getValue('search_sources');
- if (!is_array(json_decode($src))) {
- $prefs->setValue('search_sources', json_encode(explode("\t", $src)));
+ if (!$prefs->isDefault('search_sources')) {
+ $src = $prefs->getValue('search_sources');
+ if (!is_array(json_decode($src))) {
+ $prefs->setValue('search_sources', json_encode(explode("\t", $src)));
+ }
}
- $val = $prefs->getValue('search_fields');
- if (!is_array(json_decode($val, true))) {
- $fields = array();
- foreach (explode("\n", $val) as $field) {
- $field = trim($field);
- if (!empty($field)) {
- $tmp = explode("\t", $field);
- if (count($tmp) > 1) {
- $source = array_splice($tmp, 0, 1);
- $fields[$source[0]] = $tmp;
+ if (!$prefs->isDefault('search_fields')) {
+ $val = $prefs->getValue('search_fields');
+ if (!is_array(json_decode($val, true))) {
+ $fields = array();
+ foreach (explode("\n", $val) as $field) {
+ $field = trim($field);
+ if (!empty($field)) {
+ $tmp = explode("\t", $field);
+ if (count($tmp) > 1) {
+ $source = array_splice($tmp, 0, 1);
+ $fields[$source[0]] = $tmp;
+ }
}
}
+ $prefs->setValue('search_fields', $fields);
}
- $prefs->setValue('search_fields', $fields);
}
}
{
global $prefs;
+ if ($prefs->isDefault('forward_default')) {
+ return;
+ }
+
switch ($prefs->getValue('forward_default')) {
case 'forward_attachments':
$prefs->setValue('forward_default', 'both');
{
global $prefs;
- $update = false;
- $sortpref = @unserialize($prefs->getValue('sortpref'));
- foreach ($sortpref as $key => $val) {
- $sb = $this->_newSortbyValue($val['b']);
- if (!is_null($sb)) {
- $sortpref[$key]['b'] = $sb;
- $update = true;
+ if (!$prefs->isDefault('sortpref')) {
+ $update = false;
+ $sortpref = @unserialize($prefs->getValue('sortpref'));
+ foreach ($sortpref as $key => $val) {
+ $sb = $this->_newSortbyValue($val['b']);
+ if (!is_null($sb)) {
+ $sortpref[$key]['b'] = $sb;
+ $update = true;
+ }
}
- }
- if ($update) {
- $prefs->setValue('sortpref', serialize($sortpref));
+ if ($update) {
+ $prefs->setValue('sortpref', serialize($sortpref));
+ }
}
- $sb = $this->_newSortbyValue($prefs->getValue('sortby'));
- if (!is_null($sb)) {
- $prefs->setValue('sortby', $sb);
+ if (!$prefs->isDefault('sortby')) {
+ $sb = $this->_newSortbyValue($prefs->getValue('sortby'));
+ if (!is_null($sb)) {
+ $prefs->setValue('sortby', $sb);
+ }
}
}
*/
protected function _upgradeVirtualFolders()
{
+ if ($GLOBALS['prefs']->isDefault('vfolder')) {
+ return;
+ }
+
$vfolders = $GLOBALS['prefs']->getValue('vfolder');
if (!empty($vfolders)) {
$vfolders = @unserialize($vfolders);
{
global $prefs;
- $src = $prefs->getValue('search_sources');
- if (!is_array(json_decode($src))) {
- $prefs->setValue('search_sources', json_encode(explode("\t", $src)));
+ if (!$prefs->isDefault('search_sources')) {
+ $src = $prefs->getValue('search_sources');
+ if (!is_array(json_decode($src))) {
+ $prefs->setValue('search_sources', json_encode(explode("\t", $src)));
+ }
}
- $val = $prefs->getValue('search_fields');
- if (!is_array(json_decode($val, true))) {
- $fields = array();
- foreach (explode("\n", $val) as $field) {
- $field = trim($field);
- if (!empty($field)) {
- $tmp = explode("\t", $field);
- if (count($tmp) > 1) {
- $source = array_splice($tmp, 0, 1);
- $fields[$source[0]] = $tmp;
+ if (!$prefs->isDefault('search_fields')) {
+ $val = $prefs->getValue('search_fields');
+ if (!is_array(json_decode($val, true))) {
+ $fields = array();
+ foreach (explode("\n", $val) as $field) {
+ $field = trim($field);
+ if (!empty($field)) {
+ $tmp = explode("\t", $field);
+ if (count($tmp) > 1) {
+ $source = array_splice($tmp, 0, 1);
+ $fields[$source[0]] = $tmp;
+ }
}
}
+ $prefs->setValue('search_fields', $fields);
}
- $prefs->setValue('search_fields', $fields);
}
}
{
global $prefs;
- $abooks = $prefs->getValue('addressbooks');
- if (!is_array(json_decode($abooks))) {
- $abooks = @explode("\n", $abooks);
- if (empty($abooks)) {
- $abooks = array();
- }
+ if (!$prefs->isDefault('addressbooks')) {
+ $abooks = $prefs->getValue('addressbooks');
+ if (!is_array(json_decode($abooks))) {
+ $abooks = @explode("\n", $abooks);
+ if (empty($abooks)) {
+ $abooks = array();
+ }
- return $prefs->setValue('addressbooks', json_encode($abooks));
+ return $prefs->setValue('addressbooks', json_encode($abooks));
+ }
}
}
+++ /dev/null
-<?php
-/**
- * Login system task for automated upgrade tasks.
- *
- * Copyright 2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file LICENSE for license information (BSD). If you
- * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
- *
- * @author Michael Slusarz <slusarz@horde.org>
- * @package Whups
- */
-class Whups_LoginTasks_SystemTask_UpgradeFromWhups1 extends Horde_LoginTasks_SystemTask
-{
- /**
- * The interval at which to run the task.
- *
- * @var integer
- */
- public $interval = Horde_LoginTasks::ONCE;
-
- /**
- * Perform all functions for this task.
- */
- public function execute()
- {
- $this->_upgradeAbookPrefs();
- }
-
- /**
- * Upgrade to the new addressbook preferences.
- */
- protected function _upgradeAbookPrefs()
- {
- global $prefs;
-
- $src = $prefs->getValue('search_sources');
- if (!is_array(json_decode($src))) {
- $prefs->setValue('search_sources', json_encode(explode("\t", $src)));
- }
-
- $val = $prefs->getValue('search_fields');
- if (!is_array(json_decode($val, true))) {
- $fields = array();
- foreach (explode("\n", $val) as $field) {
- $field = trim($field);
- if (!empty($field)) {
- $tmp = explode("\t", $field);
- if (count($tmp) > 1) {
- $source = array_splice($tmp, 0, 1);
- $fields[$source[0]] = $tmp;
- }
- }
- }
- $prefs->setValue('search_fields', $fields);
- }
- }
-
-}
--- /dev/null
+<?php
+/**
+ * Login system task for automated upgrade tasks.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file LICENSE for license information (BSD). If you
+ * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
+ *
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @package Whups
+ */
+class Whups_LoginTasks_SystemTask_UpgradeFromWhups1 extends Horde_LoginTasks_SystemTask
+{
+ /**
+ * The interval at which to run the task.
+ *
+ * @var integer
+ */
+ public $interval = Horde_LoginTasks::ONCE;
+
+ /**
+ * Perform all functions for this task.
+ */
+ public function execute()
+ {
+ $this->_upgradeAbookPrefs();
+ }
+
+ /**
+ * Upgrade to the new addressbook preferences.
+ */
+ protected function _upgradeAbookPrefs()
+ {
+ global $prefs;
+
+ if (!$prefs->isDefault('search_sources')) {
+ $src = $prefs->getValue('search_sources');
+ if (!is_array(json_decode($src))) {
+ $prefs->setValue('search_sources', json_encode(explode("\t", $src)));
+ }
+ }
+
+ if (!$prefs->isDefault('search_fields')) {
+ $val = $prefs->getValue('search_fields');
+ if (!is_array(json_decode($val, true))) {
+ $fields = array();
+ foreach (explode("\n", $val) as $field) {
+ $field = trim($field);
+ if (!empty($field)) {
+ $tmp = explode("\t", $field);
+ if (count($tmp) > 1) {
+ $source = array_splice($tmp, 0, 1);
+ $fields[$source[0]] = $tmp;
+ }
+ }
+ }
+ $prefs->setValue('search_fields', $fields);
+ }
+ }
+ }
+
+}