summaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2006-01-07 02:30:00 +0100
committerneoraider <devnull@localhost>2006-01-07 02:30:00 +0100
commit61f7b4cc39a399a16298453acbe5a8f49ad0513d (patch)
tree0689466391e396e8e62c883994148f09f60c467b /code
parenta89ac4fda6c7cab6cace4078491c29f215213ab2 (diff)
downloadneon-61f7b4cc39a399a16298453acbe5a8f49ad0513d.tar
neon-61f7b4cc39a399a16298453acbe5a8f49ad0513d.zip
Hmm... die Content-Handler sind jetzt ansatzweise implementiert.
Diffstat (limited to 'code')
-rw-r--r--code/content.inc.php17
-rw-r--r--code/db.inc.php8
-rw-r--r--code/message.inc.php4
-rw-r--r--code/subst.inc.php17
-rw-r--r--code/util.inc.php14
5 files changed, 40 insertions, 20 deletions
diff --git a/code/content.inc.php b/code/content.inc.php
new file mode 100644
index 0000000..5fc2d76
--- /dev/null
+++ b/code/content.inc.php
@@ -0,0 +1,17 @@
+<?PHP
+ if(!defined('CONTENT_INC')) {
+ define('CONTENT_INC', 1);
+
+ include('code/db.inc.php');
+
+ function GetPage($name) {
+ $res = DBQuery('SELECT access, handler, data FROM pages WHERE name = ?', $name);
+
+ parse_str($res->fields[2], $data);
+
+ include('handlers/' . $res->fields[1]);
+
+ return $handlers[$res->fields[1]]($data);
+ }
+ }
+?>
diff --git a/code/db.inc.php b/code/db.inc.php
index 0c30e86..2f83f58 100644
--- a/code/db.inc.php
+++ b/code/db.inc.php
@@ -2,10 +2,16 @@
if(!defined('DB_INC')) {
define('DB_INC', 1);
- include('adodb.inc.php');
include('config/config.inc.php');
+ include('adodb.inc.php');
+
$conn = ADONewConnection($config['driver']);
$conn->PConnect($config['server'], $config['user'], $config['password'], $config['db']);
+
+ function DBQuery($query, $args = null) {
+ $sql = $GLOBALS['conn']->Prepare($query);
+ return $GLOBALS['conn']->Execute($sql, $args);
+ }
}
?>
diff --git a/code/message.inc.php b/code/message.inc.php
index 013c697..7f9343d 100644
--- a/code/message.inc.php
+++ b/code/message.inc.php
@@ -4,10 +4,10 @@
include('config/config.inc.php');
- include('code/subst.inc.php');
+ include('code/util.inc.php');
$message['PageNotFound'] = 'The page $page does not exist.';
- $message['Forbidden'] = 'The page $page is protected.';
+ $message['Forbidden'] = 'The page $page is protected.';
$message['InternalError'] = 'An internal error has occourred.';
if($config['language'] != 'en') @include('lang/' . $config['language'] . '.inc.php');
diff --git a/code/subst.inc.php b/code/subst.inc.php
deleted file mode 100644
index 72935a2..0000000
--- a/code/subst.inc.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?PHP
- if(!defined('SUBST_INC')) {
- define('SUBST_INC', 1);
-
- function Subst($string, $subst = array()) {
- $tr['$$'] = '$';
-
- while(current($subst)) {
- $tr['$' . key($subst)] = $subst[key($subst)];
-
- next($subst);
- }
-
- return strtr($string, $tr);
- }
- }
-?>
diff --git a/code/util.inc.php b/code/util.inc.php
new file mode 100644
index 0000000..275d3c7
--- /dev/null
+++ b/code/util.inc.php
@@ -0,0 +1,14 @@
+<?PHP
+ if(!defined('UTIL_INC')) {
+ define('UTIL_INC', 1);
+
+ function Subst($string, $subst = array()) {
+ $tr['$$'] = '$';
+
+ foreach($subst as $key => $value)
+ $tr['$' . $key] = $value;
+
+ return strtr($string, $tr);
+ }
+ }
+?>