summaryrefslogtreecommitdiff
path: root/app.php
diff options
context:
space:
mode:
Diffstat (limited to 'app.php')
-rwxr-xr-x[-rw-r--r--]app.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/app.php b/app.php
index 62fdda7..6a4b41e 100644..100755
--- a/app.php
+++ b/app.php
@@ -24,17 +24,22 @@ define('ROOT_DIR', __DIR__ . '/');
define('HTML_DIR', __DIR__ . '/html/');
define('PHP_DIR', __DIR__ . '/php/');
-require_once PHP_DIR . 'templates.php';
+require_once PHP_DIR . 'replace.php';
+require_once PHP_DIR . 'execute.php';
+require_once PHP_DIR . 'path-clean.php';
-$file = $_GET['file'] ?? 'index.html';
+$file = path_clean($_GET['file'] ?? 'index.html');
-$components = [
- '{{HEADER}}' => HTML_DIR . 'header.html',
- '{{CONTENT}}' => ROOT_DIR . $file,
- '{{FOOTER}}' => PHP_DIR . 'footer.php'
+$device = 'desktop';
+
+$targets = [
+ '{{header}}' => file_get_contents(HTML_DIR . 'header.html'),
+ '{{content}}' => file_get_contents(ROOT_DIR . $file),
+ '{{footer}}' => execute(PHP_DIR . 'footer.php'),
+ '{{device}}' => $device
];
-$app_html = template_process(HTML_DIR . 'app.html', $components);
+$app_html = replace(HTML_DIR . 'app.html', $targets);
echo $app_html;
?>