1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Update Routines now checks default_install.xml for default core preferences. XML import function improvements and some PHP notice removal.

This commit is contained in:
CaMer0n
2009-09-01 02:00:56 +00:00
parent 3459bd6e88
commit 30e6ad4225
4 changed files with 90 additions and 53 deletions

View File

@@ -9,8 +9,8 @@
* Simple XML Parser
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $
* $Revision: 1.19 $
* $Date: 2009-08-31 13:12:03 $
* $Revision: 1.20 $
* $Date: 2009-09-01 02:00:56 $
* $Author: e107coders $
*/
@@ -617,6 +617,34 @@ class xmlClass
}
}
/**
* Return an Array of core preferences from e107 XML Dump data
* @param object $XMLData Raw XML e107 Export Data
* @param object $prefType [optional] the type of core pref: core|emote|ipool|menu etc.
* @return preference array equivalent to the old $pref global;
*/
public function e107ImportPrefs($XMLData,$prefType='core')
{
if(!vartrue($XMLData['prefs'][$prefType]))
{
return;
}
$pref = array();
foreach($XMLData['prefs'][$prefType] as $val)
{
$value = (substr($val['@value'],0,7) == "array (") ? e107::getArrayStorage()->ReadArray($val['@value']) : $val['@value'];
$name = $val['@attributes']['name'];
$pref[$name] = $value;
}
return $pref;
}
/**
* Import an e107 XML file into site preferences and DB tables
* @param path $file - e107 XML file path
@@ -642,14 +670,13 @@ class xmlClass
{
foreach($xmlArray['prefs'] as $type=>$array)
{
foreach ($array as $val)
$pArray = $this->e107ImportPrefs($xmlArray,$type);
e107::getConfig($type)->setPref($pArray);
if($debug == FALSE)
{
$value = (substr($val['@value'],0,7) == "array (") ? e107::getArrayStorage()->ReadArray($val['@value']) : $val['@value'];
e107::getConfig($type)->set($val['@attributes']['name'], $value);
}
e107::getConfig($type)->save(FALSE);
e107::getConfig($type)->save(FALSE,TRUE);
}
}
}
@@ -683,6 +710,8 @@ class xmlClass
return $ret;
}
}