} else { define('CMS_MODE', 'view'); } require_once '../config.inc.php'; CMS::initDb(); if (isset($_REQUEST['id'])) { $uri = intval($_REQUEST['id']); } else { if (isset($_REQUEST['uri'])) { $uri = $_REQUEST['uri']; } else { $uri = NULL; } } try { $PAGE = new CMS_Page($uri); } catch (Exception $e) { header('HTTP/1.1 404 Page Not Found'); header('Content-type: text/plain'); echo "404 Page Not Found\n\n"; echo "Exception: " . $e->getMessage(); exit; } unset($uri); if (strlen($PAGE->redirect) > 0) { $msg = "This page is a redirect to '{$PAGE->redirect}'."; require_once 'notemplate.php'; } else { try { $PAGE->getTemplate(); } catch (Exception $e) {
try { $PAGE = new CMS_Page($page_id); $reply['r'] = 'ok'; $reply['d'] = $PAGE->{$field}; } catch (Exception $e) { $reply['r'] = 'error'; } } } if ($q == 'set') { if ($logged) { $page_id = (int) $d['page_id']; $field = $d['field']; CMS::initDb(); try { $PAGE = new CMS_Page($page_id); $reply['r'] = 'ok'; $PAGE->{$field} = $_REQUEST['d']['value']; $PAGE->save(); } catch (Exception $e) { $reply['r'] = 'error'; } } } if ($q == 'page_new') { if ($logged) { $parent_id = $d['parent_id']; if ($parent_id < 1) { $parent_id = NULL; } $title = $d['title'];
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <base href="<?php echo CMS::baseUri(); ?> " /> <link rel="stylesheet" type="text/css" href="styles/screen.css" media="screen" /> </head> <body> <h1><?php $PAGE->field('header', 'label'); ?> </h1> <hr /> <ul> <?php foreach (CMS_Page::get()->children as $child) { ?> <li><a href="<?php echo $child->uri; ?> "><?php echo $child->title; ?> </a></li> <?php } ?> </ul> <hr /> <?php