summaryrefslogtreecommitdiffstats
path: root/code/content.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'code/content.inc.php')
-rw-r--r--code/content.inc.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/code/content.inc.php b/code/content.inc.php
index c92f1b2..8a20507 100644
--- a/code/content.inc.php
+++ b/code/content.inc.php
@@ -7,11 +7,25 @@
include('code/handlers.inc.php');
function GetPage($name) {
+ $user = $GLOBALS['user'];
+
$res = DBQuery('SELECT access, handler, data FROM pages WHERE name = ?', $name);
- if(($res->fields[0] & (1 << $GLOBALS['user']->GetGid())) == 0)
- return $GLOBALS['handlers'][$res->fields[1]]->HandleErrorMessage('Forbidden', array('page' => $name));
+ if(!$res->RecordCount()) {
+ $message = $GLOBALS['handlers']['default']->HandleErrorMessage('PageNotFound', array('page' => $name));
+
+ if(!$message['title']) $message['title'] = $name;
+
+ return $message;
+ }
+ if((($user->GetUid() == 0) || ($user->GetGid() != 0)) && ($res->fields[0] & (1 << $user->GetGid())) == 0) {
+ $message = $GLOBALS['handlers'][$res->fields[1]]->HandleErrorMessage('Forbidden', array('page' => $name));
+
+ if(!$message['title']) $message['title'] = $name;
+
+ return $message;
+ }
parse_str($res->fields[2], $data);
$data['_page'] = $name;