[Phpcms-plugins-cvs] admin4phpCMS/modules/config config.dtd,NONE,1.1 config.xml,NONE,1.1 class.modul
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-05-30 18:04:22
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9898/modules/config Modified Files: class.module_config.php Added Files: config.dtd config.xml Log Message: restructuring of some files --- NEW FILE: config.xml --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE framework SYSTEM "config.dtd"> <framework> <module id="user" name="user-service" include="class.module_user.php" class="module_user"> <config name="userfile" value="Auth_XML.xml" /> <config name="permfile" value="Perm_XML.xml" /> </module> <module id="layout" name="layout-service" include="class.module_layout.php" class="module_layout"> <config name="tplfile" value="layout/layout.xml" /> </module> <module id="error" name="error-service" include="class.module_error.php" class="module_error" /> <module id="mail" name="email-service" include="class.module_mail.php" class="module_mail"> <config name="admin-email" value="ma...@mj..." /> <config name="from-email" value="fra...@ma..." /> </module> <module id="log" name="log-service" include="class.module_log.php" class="module_log"> <config name="logfile" value="log/framework.log" /> <config name="logrotate" /> <config name="logrotate-days" value="2" /> <config name="chmod" value="0606" /> </module> </framework> Index: class.module_config.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/config/class.module_config.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- class.module_config.php 28 May 2004 12:07:43 -0000 1.2 +++ class.module_config.php 30 May 2004 18:03:40 -0000 1.3 @@ -1,46 +1,56 @@ <?php require_once 'XML/Tree.php'; + class module_config extends module { var $configfile; 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'); - $this->__registerAction ('doSetConfigFile', 'setConfigFile'); + $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'); + $this->_registerAction ('doSetConfigFile', 'setConfigFile'); } function readConfig (&$actiondata) { if (isset ($actiondata['configfile'])) { $this->configfile = $actiondata ['configfile']; + } else { + $this->configfile = dirname (__FILE__).'/config.xml'; } if (!isset($this->configfile)) { $actiondata = array ('errortext'=>'Konfigurationsdatei konnte nicht geladen werden!'); - $this->__callEvent ('ERROR_NOTICE', $actiondata); + $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); + $this->_callEvent ('ERROR_NOTICE', $actiondata); return false; } $XML =& new XML_Tree ($this->configfile); - $this->configdata =& $XML->getTreeFromFile (); + $configdata =& $XML->getTreeFromFile (); + for ($i = 0; $i < count ($configdata->children); $i++) { + $this->config[$configdata->children[$i]->attributes['id']] =& $configdata->children[$i]; + } return true; } function getConfig (&$actiondata) { - $actiondata['config'] =& $this->configdata; + if (!isset($actiondata['module']) || !isset ($this->config[$actiondata['module']])) { + $actiondata['config'] =& $this->config; + } else { + $actiondata['config'] =& $this->config[$actiondata['module']]; + } return true; } --- NEW FILE: config.dtd --- <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT framework (module)+> <!ELEMENT module (config)+> <!ATTLIST module name CDATA #IMPLIED id ID #REQUIRED class CDATA #REQUIRED include CDATA #REQUIRED > <!ELEMENT config (#PCDATA)> <!ATTLIST config name ID #REQUIRED value CDATA #IMPLIED > |