From 5f0419cac4ec3c664bd1e26b229882faa7388db9 Mon Sep 17 00:00:00 2001 From: Cameron <e107inc@gmail.com> Date: Sat, 24 Dec 2016 12:41:06 -0800 Subject: [PATCH] Export of plugin prefs complete. --- e107_admin/db.php | 11 ++++++++--- e107_handlers/xml_class.php | 30 ++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/e107_admin/db.php b/e107_admin/db.php index 82900b207..6513fd5bc 100644 --- a/e107_admin/db.php +++ b/e107_admin/db.php @@ -68,7 +68,9 @@ if(isset($_POST['db_execute'])) if(isset($_POST['exportXmlFile'])) { - if(exportXmlFile($_POST['xml_prefs'],$_POST['xml_tables'],$_POST['package_images'])) + + + if(exportXmlFile($_POST['xml_prefs'],$_POST['xml_tables'],$_POST['xml_plugprefs'], $_POST['package_images'], false)) { $mes = e107::getMessage(); $mes->add(LAN_SUCCESS, E_MESSAGE_SUCCESS); @@ -1706,12 +1708,14 @@ function db_adminmenu() //FIXME - has problems when navigation is on the LEFT in * @param object $debug [optional] * @return none */ -function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE) +function exportXmlFile($prefs,$tables=array(),$plugPrefs, $package=FALSE,$debug=FALSE) { $xml = e107::getXml(); $tp = e107::getParser(); $mes = e107::getMessage(); + $desinationFolder = null; + if(vartrue($package)) { @@ -1733,8 +1737,9 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE) } } + $mode = ($debug === true) ? "debug" : false; - if($xml->e107Export($prefs,$tables,$debug)) + if($xml->e107Export($prefs,$tables,$plugPrefs, $mode)) { $mes->add(DBLAN_108." ".$desinationFolder."install.xml", E_MESSAGE_SUCCESS); if(varset($xml->fileConvertLog)) diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index 0a7a26fac..56c661a1e 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -872,7 +872,7 @@ class xmlClass * @param boolean $debug [optional] * @return string text / file for download */ - public function e107Export($xmlprefs, $tables, $mode = false) + public function e107Export($xmlprefs, $tables, $plugPrefs, $mode = false) { // error_reporting(0); $e107info = array(); @@ -921,6 +921,32 @@ class xmlClass $text .= "\t</prefs>\n"; } + + if(!empty($plugPrefs)) + { + $text .= "\t<pluginPrefs>\n"; + + foreach($plugPrefs as $plug) + { + $prefs = e107::getPlugConfig($plug)->getPref(); + + foreach($prefs as $key=>$val) + { + if(isset($val)) + { + $text .= "\t\t<".$plug." name=\"".$key."\">".$this->e107ExportValue($val)."</".$plug.">\n"; + } + + } + + } + + $text .= "\t</pluginPrefs>\n"; + } + + + + if(varset($tables)) { $text .= "\t<database>\n"; @@ -967,7 +993,7 @@ class xmlClass if($mode === 'debug') { echo "<pre>".htmlentities($text)."</pre>"; - return TRUE; + return null; } else {