summaryrefslogtreecommitdiff
path: root/editable.php
diff options
context:
space:
mode:
authorlpouzenc <lpouzenc@gmail.com>2013-11-28 13:11:58 +0100
committerlpouzenc <lpouzenc@gmail.com>2013-11-28 13:11:58 +0100
commita77d63fd3ce1e93a554b62e6f63646f1fb568ecb (patch)
treebaf11cfbae3efa6c2773667565f01e08902ce90d /editable.php
downloadplaintextcms-a77d63fd3ce1e93a554b62e6f63646f1fb568ecb.tar.gz
plaintextcms-a77d63fd3ce1e93a554b62e6f63646f1fb568ecb.tar.bz2
plaintextcms-a77d63fd3ce1e93a554b62e6f63646f1fb568ecb.zip
Import initialHEADmaster
Diffstat (limited to 'editable.php')
-rw-r--r--editable.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/editable.php b/editable.php
new file mode 100644
index 0000000..245f688
--- /dev/null
+++ b/editable.php
@@ -0,0 +1,34 @@
+<?php
+ require_once('internal/utils.php');
+
+ $site_conf = sanitize_ini("site_conf.ini", SANITIZE_SITE_CONF);
+ if ( ! is_array($site_conf) ) die("Error parsing site_conf.ini");
+
+ // Never put \. in this regex !
+ $page=sanitize($_GET, 'page', '/[^a-z0-9\/]+/', $site_conf['default_page']);
+ if ( ! is_dir($page) die("Error : page does not exists ($page)");
+
+ $page_props = sanitize_ini("$page/props.ini", SANITIZE_PAGE_PROPS);
+ if ( ! is_array($page_props) ) die("Error parsing page properties ($page/props.ini)");
+
+ $tpl_relpath = "templates/" . $page_props['template'] . '/';
+?>
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title><?=$page_props['title']?></title>
+<link rel="stylesheet" href="<?=$tpl_relpath?>screen.css" />
+</head>
+
+<body>
+<?php
+ set_include_path( $tpl_relpath . PATH_SEPARATOR . $page );
+ include('layout-' . $page_props['layout'] . '.php');
+ restore_include_path();
+
+ include('internal/editor-bind-code.html');
+?>
+</body>
+</html>
+