[Phpcms-plugins-cvs] admin4phpCMS/modules/config class.module_config.php,1.1,1.2
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-05-28 12:07:55
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5436/modules/config Modified Files: class.module_config.php Log Message: added modules error and layout Index: class.module_config.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/config/class.module_config.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- class.module_config.php 26 May 2004 11:26:00 -0000 1.1 +++ class.module_config.php 28 May 2004 12:07:43 -0000 1.2 @@ -1,5 +1,6 @@ <?php +require_once 'XML/Tree.php'; class module_config extends module { var $configfile; @@ -7,6 +8,8 @@ function init () { $this->__registerEvent ('CONFIG_READ', 'doReadConfig'); $this->__registerAction ('doReadConfig', 'readConfig'); + $this->__registerEvent ('CONFIG_GET', 'doGetConfig'); + $this->__registerAction ('doGetConfig', 'getConfig'); $this->__registerEvent ('CONFIG_SAVE', 'doSaveConfig'); $this->__registerAction ('doSaveConfig', 'saveConfig'); $this->__registerEvent ('CONFIG_SET_FILE', 'doSetConfigFile'); @@ -14,8 +17,31 @@ } function readConfig (&$actiondata) { - $this->configfile = $actiondata ['configfile']; + if (isset ($actiondata['configfile'])) { + $this->configfile = $actiondata ['configfile']; + } + + if (!isset($this->configfile)) { + $actiondata = array ('errortext'=>'Konfigurationsdatei konnte nicht geladen werden!'); + $this->__callEvent ('ERROR_NOTICE', $actiondata); + return false; + } + + if (!file_exists ($this->configfile)) { + unset ($this->configfile); + $actiondata = array ('errortext'=>'Konfigurationsdatei konnte nicht geladen werden!'); + $this->__callEvent ('ERROR_NOTICE', $actiondata); + return false; + } + $XML =& new XML_Tree ($this->configfile); + $this->configdata =& $XML->getTreeFromFile (); + return true; + } + + function getConfig (&$actiondata) { + $actiondata['config'] =& $this->configdata; + return true; } function saveConfig (&$actiondata) { @@ -23,9 +49,11 @@ } function setConfigFile (&$actiondata) { - + $this->configfile = $actiondata['configfile']; } } + + ?> \ No newline at end of file |