From 80057e95874e48abb5fef5d640dc67a3b98a8e2d Mon Sep 17 00:00:00 2001 From: secretr Date: Thu, 15 Apr 2010 15:33:20 +0000 Subject: [PATCH] EONE-49 (bug) --- e107_handlers/pref_class.php | 12 +++++++----- e107_handlers/xml_class.php | 18 +++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/e107_handlers/pref_class.php b/e107_handlers/pref_class.php index f4abce3c2..ad8fa14f3 100644 --- a/e107_handlers/pref_class.php +++ b/e107_handlers/pref_class.php @@ -536,10 +536,12 @@ class e_pref extends e_admin_model } // auto admin log - $new = $this->getPref(); - $admin_log->logArrayDiffs($new, $old, 'LAN_FIXME'); - unset($new, $old); - + if(is_array($old)) // fix install problems - no old prefs available + { + $new = $this->getPref(); + $admin_log->logArrayDiffs($new, $old, 'LAN_FIXME'); + unset($new, $old); + } if(e107::getDb()->db_Select_gen("REPLACE INTO `#core` (e107_name,e107_value) values ('".$this->prefid."_Backup', '".addslashes($dbdata)."') ")) { $admin_log->logMessage('Backup of '.$this->alias.' ('.$this->prefid.') successfully created.', E_MESSAGE_DEBUG, E_MESSAGE_SUCCESS, $session_messages); @@ -730,7 +732,7 @@ final class e_core_pref extends e_pref 'emote' => 'emote_default', //TODO include other emote packs of the user. 'menu' => 'menu_pref', 'search' => 'search_prefs', - 'notify' => 'notify_prefs' + 'notify' => 'notify_prefs', ); /** diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index 266108ade..ed0d68099 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -563,7 +563,7 @@ class xmlClass foreach($this->stringTags as $vl) { - if(varset($vars[$vl][0])) + if(isset($vars[$vl]) && isset($vars[$vl][0])) { $vars[$vl] = $vars[$vl][0]; } @@ -804,7 +804,7 @@ class xmlClass { if(!vartrue($XMLData['prefs'][$prefType])) { - return; + return array(); } $mes = eMessage::getInstance(); @@ -834,7 +834,7 @@ class xmlClass public function e107Import($file,$mode='replace',$debug=FALSE) { - $xmlArray = $this->loadXMLfile($file,'advanced'); + $xmlArray = $this->loadXMLfile($file, 'advanced'); if($debug) { @@ -844,20 +844,24 @@ class xmlClass } $ret = array(); - //FIXME - doesn't work from install_.php. if(vartrue($xmlArray['prefs'])) // Save Core Prefs { foreach($xmlArray['prefs'] as $type=>$array) { $pArray = $this->e107ImportPrefs($xmlArray,$type); + if($mode == 'replace') { e107::getConfig($type)->setPref($pArray); } - else + else // 'add' { - e107::getConfig($type)->addPref($pArray); // FIXME addPref() doesn't behave the same way as setPref() with arrays. + foreach ($pArray as $pname => $pval) + { + e107::getConfig($type)->add($pname, $pval); // don't parse x/y/z + } + // e107::getConfig($type)->addPref($pArray); } if($debug == FALSE) @@ -866,7 +870,7 @@ class xmlClass } } } - + if(vartrue($xmlArray['database'])) { foreach($xmlArray['database']['dbTable'] as $val)