From 73d5e907a797e976e59f328d4f2fd0b8bfcebde6 Mon Sep 17 00:00:00 2001 From: neoraider Date: Mon, 9 Jan 2006 19:49:02 +0000 Subject: Allgemein ist jetzt alles etwas weiter. Vieles ist jetzt durch Klassen gel?st, und einige andere Teile von Neon sind jetzt besser strukturiert. --- code/content.inc.php | 10 +++++++--- code/handlers.inc.php | 13 +++++++++++++ code/message.inc.php | 4 ++-- code/user.inc.php | 33 +++++++++++++++++++++++++++++++++ code/util.inc.php | 2 ++ 5 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 code/handlers.inc.php create mode 100644 code/user.inc.php (limited to 'code') diff --git a/code/content.inc.php b/code/content.inc.php index 5fc2d76..c92f1b2 100644 --- a/code/content.inc.php +++ b/code/content.inc.php @@ -3,15 +3,19 @@ define('CONTENT_INC', 1); include('code/db.inc.php'); + include('code/user.inc.php'); + include('code/handlers.inc.php'); function GetPage($name) { $res = DBQuery('SELECT access, handler, data FROM pages WHERE name = ?', $name); - parse_str($res->fields[2], $data); + if(($res->fields[0] & (1 << $GLOBALS['user']->GetGid())) == 0) + return $GLOBALS['handlers'][$res->fields[1]]->HandleErrorMessage('Forbidden', array('page' => $name)); - include('handlers/' . $res->fields[1]); + parse_str($res->fields[2], $data); + $data['_page'] = $name; - return $handlers[$res->fields[1]]($data); + return $GLOBALS['handlers'][$res->fields[1]]->HandleContentData($data); } } ?> diff --git a/code/handlers.inc.php b/code/handlers.inc.php new file mode 100644 index 0000000..d259273 --- /dev/null +++ b/code/handlers.inc.php @@ -0,0 +1,13 @@ + diff --git a/code/message.inc.php b/code/message.inc.php index 7f9343d..8e0a3f0 100644 --- a/code/message.inc.php +++ b/code/message.inc.php @@ -12,8 +12,8 @@ if($config['language'] != 'en') @include('lang/' . $config['language'] . '.inc.php'); - function Message($type, $subst = array()) { - return Subst($GLOBALS['message'][$type], $subst); + function Message($type, $data = array()) { + return Subst($GLOBALS['message'][$type], $data); } } ?> diff --git a/code/user.inc.php b/code/user.inc.php new file mode 100644 index 0000000..00c7355 --- /dev/null +++ b/code/user.inc.php @@ -0,0 +1,33 @@ +RecordCount()) { + $this->uid = $res->fields[0]; + $this->gid = $res->fields[1]; + } + } + } + + function GetUid() { + return $this->uid; + } + + function GetGid() { + return $this->gid; + } + } + + $user = new User; + } +?> diff --git a/code/util.inc.php b/code/util.inc.php index 275d3c7..c2a8adf 100644 --- a/code/util.inc.php +++ b/code/util.inc.php @@ -8,6 +8,8 @@ foreach($subst as $key => $value) $tr['$' . $key] = $value; + krsort($tr); + return strtr($string, $tr); } } -- cgit v1.2.3