summaryrefslogtreecommitdiffstats
path: root/index.php
blob: db5847c5361004dc1119ead23c47294afd8d7086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?PHP
  require_once('core/config.inc.php');
  require_once('core/db.inc.php');
  require_once('core/modules.inc.php');
  require_once('core/xmlparser.inc.php');
  
  Uses('util', 'pages', 'links', 'subst');
  
  header('Content-type: text/html;charset=UTF-8');
  
  if($_GET['page']) $page = Unquote($_GET['page']);
  else $page = $GLOBALS['config']['home'];
  
  $res = $GLOBALS['db']->Execute('SELECT id, code FROM base ORDER BY id');
  
  $env = array('current_page' => $page);
  if($_GET['mode'] == 'edit') $env['current_page'] = '$editor:' . $page;
  
  $content = '';
  $body = false;
  while(!$res->EOF) {
    if($body == false && $res->fields[0] > 0) {
      $body = true;
      $content .= '</head><body>';
    }
    $content .= Subst($res->fields[1], $env);
    $res->MoveNext();
  }
  
  $env = array('current_page' => $page);
  if($_GET['mode'] == 'edit') $env['current_page'] = '$editor:' . $page;
  
  echo '<?xml version="1.0" encoding="UTF-8" ?>';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <?PHP
      echo $content;
    ?>
  </body>
</html>