summaryrefslogtreecommitdiffstats
path: root/code/content.inc.php
blob: c92f1b291e9920532ccfd7dab383a2ed75d5018e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?PHP
  if(!defined('CONTENT_INC')) {
    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);
      
      if(($res->fields[0] & (1 << $GLOBALS['user']->GetGid())) == 0)
        return $GLOBALS['handlers'][$res->fields[1]]->HandleErrorMessage('Forbidden', array('page' => $name));
      
      parse_str($res->fields[2], $data);
      $data['_page'] = $name;
      
      return $GLOBALS['handlers'][$res->fields[1]]->HandleContentData($data);
    }
  }
?>