summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2006-09-19 02:52:05 +0200
committerneoraider <devnull@localhost>2006-09-19 02:52:05 +0200
commitebf846c0a4c5d415b1e461ddbf8c5bdbb297d4e2 (patch)
tree178e0e825c9c96deea9949be76c1adacfc295843
parent13edf825d1753e085c22909a9d3ad893303f78bc (diff)
downloadneon-ebf846c0a4c5d415b1e461ddbf8c5bdbb297d4e2.tar
neon-ebf846c0a4c5d415b1e461ddbf8c5bdbb297d4e2.zip
Einige weitere Anpassungen an die neue Modulverwaltung vorgenommen.
-rw-r--r--code/pages.inc.php37
-rw-r--r--code/templates.inc.php4
-rw-r--r--core/modules.inc.php15
3 files changed, 20 insertions, 36 deletions
diff --git a/code/pages.inc.php b/code/pages.inc.php
index 290b4bd..2024303 100644
--- a/code/pages.inc.php
+++ b/code/pages.inc.php
@@ -3,31 +3,8 @@
class Pages {
- var $pages = array(
- 'Login.c' => null,
- 'Logout.c' => null,
- 'Modules.c' => null,
- 'Modules:Config.c' => null,
- 'Modules:Enable.c' => null,
- 'Pages.c' => null,
- 'Pages:Copy.c' => null,
- 'Pages:Delete.c' => null,
- 'Pages:Edit.c' => null,
- 'Pages:Handle.c' => null,
- 'Pages:New.c' => null,
- 'Pages:Privs.c' => null,
- 'Pages:Rename.c' => null,
- 'Users.c' => null,
- 'Users:Delete.c' => null,
- 'Users:Group.c' => null,
- 'Users:Handle.c' => null,
- 'Users:New.c' => null,
- 'Users:Password.c' => null,
- 'Users:Rename.c' => null,
- 'Login.n' => null,
- 'default.e' => null,
- 'phpexec.e' => null
- );
+ var $pages = array();
+
function Get($page, $type, $extra = null) {
if(!$this->Exists($page, $type))
@@ -67,9 +44,6 @@
}
function Exists($page, $type) {
- if(array_key_exists($page . '.' . $type, $this->pages))
- return true;
-
if(array_key_exists($page . '.' . $type, $GLOBALS['modules']->pages))
return true;
@@ -103,7 +77,7 @@
function GetPageData($page, $type) {
if(!$this->Exists($page, $type)) return null;
- if(!$this->pages[$page . '.' . $type]) {
+ if(!array_key_exists($page . '.' . $type, $this->pages)) {
$res = $GLOBALS['db']->Execute('SELECT template, data FROM pages WHERE name = ? AND type = ?', array($page, $type));
if($res->RecordCount()) {
@@ -114,10 +88,7 @@
'access' => '', 'data' => $data);
}
else {
- $filename = $GLOBALS['modules']->pages[$page . '.' . $type]['path'] . 'pages/'
- . strtr($type, array('c' => 'content', 'e' => 'editor', 'n' => 'nav')) . '/' . $page . '.xml';
-
- $xmldata = $GLOBALS['xmlparser']->ParseFile($filename);
+ $xmldata = $GLOBALS['xmlparser']->ParseFile($GLOBALS['modules']->GetPagePath($page, $type));
if(!$xmldata) return null;
$info = $GLOBALS['xmlparser']->FindTag($xmldata, 'info');
diff --git a/code/templates.inc.php b/code/templates.inc.php
index 9db1ff2..0c95d55 100644
--- a/code/templates.inc.php
+++ b/code/templates.inc.php
@@ -1,4 +1,4 @@
<?PHP
- foreach($GLOBALS['modules']->templates as $file => $module)
- require_once($module['path'] . 'templates/' . $file . '.inc.php');
+ foreach(array_keys($GLOBALS['modules']->templates) as $file)
+ require_once($GLOBALS['modules']->GetTemplatePath($file));
?>
diff --git a/core/modules.inc.php b/core/modules.inc.php
index c1ebc80..395b8ad 100644
--- a/core/modules.inc.php
+++ b/core/modules.inc.php
@@ -5,7 +5,7 @@
function Uses() {
foreach(func_get_args() as $file) {
if(isset($GLOBALS['modules']->code[$file]))
- require_once($GLOBALS['modules']->code[$file]['path'] . 'code/' . $file . '.inc.php');
+ require_once($GLOBALS['modules']->GetCodePath($file));
else
die('Fatal: a required code file was not found.');
}
@@ -123,6 +123,19 @@
return $module;
}
+ function GetCodePath($name) {
+ return $this->code[$name]['path'] . 'code/' . $name . '.inc.php';
+ }
+
+ function GetPagePath($name, $type) {
+ return $this->pages[$name . '.' . $type]['path'] . 'pages/' .
+ strtr($type, array('c' => 'content', 'e' => 'editor', 'n' => 'nav')) . '/' . $name . '.xml';
+ }
+
+ function GetTemplatePath($name) {
+ return $this->templates[$name]['path'] . 'templates/' . $name . '.inc.php';
+ }
+
function Exists($name) {
return array_key_exists($name, $this->modules);
}