summaryrefslogtreecommitdiff
path: root/editable.php
diff options
context:
space:
mode:
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>
+