From 386b0047b42e7f9e86eb9c75f99db9f3894099f1 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 2 May 2013 22:30:42 +0200 Subject: [PATCH] add save and reading of extension configuration --- inc/inc.ClassSettings.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index d90969744..6bf943bc7 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -185,6 +185,7 @@ class Settings { /* {{{ */ var $_ldapAccountDomainName = ""; var $_ldapType = 1; // 0 = ldap; 1 = AD var $_converters = array(); // list of commands used to convert files to text for Indexer + var $_extensions = array(); // configuration for extensions /** * Constructor @@ -473,6 +474,17 @@ class Settings { /* {{{ */ $tab = $converter->attributes(); $this->_converters[trim(strval($tab['mimeType']))] = trim(strval($converter)); } + + // XML Path: /configuration/extensions + $extensions = $xml->xpath('/configuration/extensions/extension'); + $this->_extensions = array(); + foreach($extensions as $extension) { + $extname = strval($extension->attributes()['name']); + foreach($extension->children() as $parameter) { + $this->_extensions[$extname][strval($parameter->attributes()['name'])] = strval($parameter); + } + } + return true; } /* }}} */ @@ -727,6 +739,29 @@ class Settings { /* {{{ */ } // foreach + // XML Path: /configuration/extensions + $extnodes = $xml->xpath('/configuration/extensions'); + if(!$extnodes) { + $nodeParent = $xml->xpath('/configuration'); + $extnodes = $nodeParent[0]->addChild("extensions"); + } else { + unset($xml->extensions); + $extnodes = $xml->addChild("extensions"); + } + foreach($this->_extensions as $name => $extension) + { + // search XML node + $extnode = $extnodes->addChild('extension'); + $this->setXMLAttributValue($extnode, 'name', $name); + foreach($GLOBALS['EXT_CONF'][$name]['config'] as $fieldname=>$conf) { + $parameter = $extnode->addChild('parameter'); + $parameter[0] = $extension[$fieldname]; + $this->setXMLAttributValue($parameter, 'name', $fieldname); + } + + + } // foreach + // Save return $xml->asXML($configFilePath); } /* }}} */