diff --git a/e107_admin/db.php b/e107_admin/db.php
index 5a928a793..623cbc460 100644
--- a/e107_admin/db.php
+++ b/e107_admin/db.php
@@ -68,7 +68,7 @@ if(isset($_POST['exportXmlFile']))
{
- if(exportXmlFile($_POST['xml_prefs'],$_POST['xml_tables'],$_POST['xml_plugprefs'], $_POST['package_images'], false))
+ if(exportXmlFile($_POST['xml_prefs'],$_POST['xml_tables'],$_POST['xml_plugprefs'],$_POST['xml_themeprefs'], $_POST['package_images'], false))
{
$mes = e107::getMessage();
$mes->add(LAN_CREATED, E_MESSAGE_SUCCESS);
@@ -1203,6 +1203,42 @@ class system_tools
}
+ // theme preferences
+ $sitetheme = e107::pref('core','sitetheme'); // currently just sitetheme, but could easily be expanded.
+ $themelist = array($sitetheme);
+
+ $text .= "
+ ".$frm->checkbox_toggle('check-all-verify', 'xml_plugprefs')." Theme ".LAN_PREFS." |
+ ".DBLAN_98." |
+
+
";
+
+ // ksort($themelist);
+
+ foreach($themelist as $plug)
+ {
+ $data = e107::getThemeConfig($plug)->getPref();
+
+ $key = $plug;
+
+ $checked = false;
+
+ if(!empty($data))
+ {
+ $rows = count($data);
+
+ $text .= "
+
+ ".$frm->checkbox("xml_themeprefs[".$key."]",$key, $checked, array('label'=>LAN_PREFS.": ".$key))."
+ |
+ ".$rows." |
+
+
";
+ }
+ }
+
+
+
$text .= "
@@ -1642,7 +1678,7 @@ function db_adminmenu() //FIXME - has problems when navigation is on the LEFT in
* @param object $debug [optional]
* @return bool|null
*/
-function exportXmlFile($prefs,$tables=array(),$plugPrefs, $package=FALSE,$debug=FALSE)
+function exportXmlFile($prefs,$tables=array(),$plugPrefs=array(), $themePrefs=array(), $package=FALSE,$debug=FALSE)
{
$xml = e107::getXml();
$tp = e107::getParser();
@@ -1673,7 +1709,7 @@ function exportXmlFile($prefs,$tables=array(),$plugPrefs, $package=FALSE,$debug=
$mode = ($debug === true) ? array( "debug" =>1) : null;
- if($xml->e107Export($prefs,$tables,$plugPrefs, $mode))
+ if($xml->e107Export($prefs,$tables,$plugPrefs, $themePrefs, $mode))
{
$mes->add(DBLAN_108." ".$desinationFolder."install.xml", E_MESSAGE_SUCCESS);
if(varset($xml->fileConvertLog))
diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php
index b4e8fa416..e356a8c25 100755
--- a/e107_handlers/model_class.php
+++ b/e107_handlers/model_class.php
@@ -4112,7 +4112,7 @@ class e_admin_tree_model extends e_front_tree_model
$filename = "e107Export_" .$this->getModelTable()."_". date("YmdHi").".xml";
$query = $this->getFieldIdName().' IN ('.$idstr.') '; // ORDER BY '.$this->getParam('db_order') ;
- e107::getXML()->e107Export(null,$table,null,array('file'=>$filename,'query'=>$query));
+ e107::getXml()->e107Export(null,$table,null,null, array('file'=>$filename,'query'=>$query));
return null;
diff --git a/e107_handlers/pref_class.php b/e107_handlers/pref_class.php
index b5c822fa0..d56c05c67 100644
--- a/e107_handlers/pref_class.php
+++ b/e107_handlers/pref_class.php
@@ -798,7 +798,7 @@ final class e_core_pref extends e_pref
'menu' => 'menu_pref',
'search' => 'search_prefs',
'notify' => 'notify_prefs',
- 'history' => 'history_prefs'
+ 'history' => 'history_prefs',
);
/**
diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php
index 10fdb8029..1ab5e5c91 100644
--- a/e107_handlers/xml_class.php
+++ b/e107_handlers/xml_class.php
@@ -825,7 +825,7 @@ class xmlClass
}
if ($parse)
{
- return $this->parseXML('', ($parse === true));
+ return $this->parseXml('', ($parse === true));
}
else
{
@@ -903,7 +903,7 @@ class xmlClass
* @param array $options [optional] debug, return, query
* @return string text / file for download
*/
- public function e107Export($xmlprefs, $tables, $plugPrefs, $options = array())
+ public function e107Export($xmlprefs, $tables, $plugPrefs=null, $themePrefs=null, $options = array())
{
// error_reporting(0);
// $e107info = array();
@@ -975,6 +975,28 @@ class xmlClass
$text .= "\t\n";
}
+ if(!empty($themePrefs))
+ {
+ $text .= "\t\n";
+
+ foreach($themePrefs as $plug)
+ {
+ $prefs = e107::getThemeConfig($plug)->getPref();
+
+ foreach($prefs as $key=>$val)
+ {
+ if(isset($val))
+ {
+ $text .= "\t\t<".$plug." name=\"".$key."\">".$this->e107ExportValue($val)."".$plug.">\n";
+ }
+
+ }
+
+ }
+
+ $text .= "\t\n";
+ }
+
@@ -1071,7 +1093,22 @@ class xmlClass
public function e107ImportPrefs($XMLData, $prefType='core', $mode='core')
{
- $key = ($mode === 'core') ? 'prefs' : 'pluginPrefs';
+ switch($mode)
+ {
+ case "plugin":
+ $key = 'pluginPrefs';
+ break;
+
+ case "theme":
+ $key = 'themePrefs';
+ break;
+
+ case "core":
+ default:
+ $key = 'core';
+ }
+
+ // $key = ($mode === 'core') ? 'prefs' : 'pluginPrefs';
if(!vartrue($XMLData[$key][$prefType]))
{
@@ -1191,6 +1228,35 @@ class xmlClass
}
}
+ // --------------- Save Theme Prefs ---------------------
+
+ if(!empty($xmlArray['themePrefs']))
+ {
+ foreach($xmlArray['themePrefs'] as $type=>$array)
+ {
+
+ $pArray = $this->e107ImportPrefs($xmlArray,$type, 'theme');
+
+ if($mode == 'replace') // merge with existing, add new
+ {
+ e107::getThemeConfig($type)->setPref($pArray);
+ }
+ else // 'add' only new prefs
+ {
+ foreach ($pArray as $pname => $pval)
+ {
+ e107::getThemeConfig($type)->add($pname, $pval); // don't parse x/y/z
+ }
+ }
+
+ if($debug == false)
+ {
+ e107::getThemeConfig($type)
+ ->setParam('nologs', $noLogs)
+ ->save(FALSE,TRUE);
+ }
+ }
+ }