aboutsummaryrefslogtreecommitdiff
path: root/htdocs
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs')
-rw-r--r--htdocs/index.php27
-rw-r--r--htdocs/js.php3
-rw-r--r--htdocs/sass.php5
3 files changed, 5 insertions, 30 deletions
diff --git a/htdocs/index.php b/htdocs/index.php
index 150b14a..397696f 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -2,28 +2,5 @@
require_once __DIR__.'/../init.php';
-$r = (new Router())
- // route handler input
- // ----- ------- -----
- ->add('/', 'index')
- ->add('contacts/', 'contacts')
- ->add('projects.html', 'projects')
- ->add('blog/(\d+)/', 'post_id id=$(1)')
- ->add('([a-z0-9-]+)/', 'auto name=$(1)')
-
- ->add('feed.rss', 'RSS')
- ->add('rss/', 'RSS')
-
- ->add('admin/', 'admin/index')
- ->add('admin/{login,logout,log}/', 'admin/${1}')
-
- ->add('([a-z0-9-]+)/{delete,edit}/', 'admin/auto_${1} short_name=$(1)')
- ->add('([a-z0-9-]+)/create/', 'admin/page_add short_name=$(1)')
- ->add('write/', 'admin/post_add')
- ->add('admin/markdown-preview.ajax', 'admin/markdown_preview')
-
- ->add('uploads/', 'admin/uploads')
- ->add('uploads/{edit_note,delete}/(\d+)/','admin/upload_${1} id=$(1)')
-;
-
-(new RequestDispatcher($r))->dispatch(); \ No newline at end of file
+router_init();
+dispatch_request();
diff --git a/htdocs/js.php b/htdocs/js.php
index c9939fe..57d847f 100644
--- a/htdocs/js.php
+++ b/htdocs/js.php
@@ -1,11 +1,10 @@
<?php
require __DIR__.'/../init.php';
-global $config;
$name = $_REQUEST['name'] ?? '';
-if (!$config['is_dev'] || !$name || !is_dir($path = ROOT.'/htdocs/js/'.$name)) {
+if (!is_dev() || !$name || !is_dir($path = APP_ROOT.'/htdocs/js/'.$name)) {
http_response_code(403);
exit;
}
diff --git a/htdocs/sass.php b/htdocs/sass.php
index 186b706..ec1e185 100644
--- a/htdocs/sass.php
+++ b/htdocs/sass.php
@@ -1,7 +1,6 @@
<?php
require __DIR__.'/../init.php';
-global $config;
$name = $_REQUEST['name'] ?? '';
$theme = $_REQUEST['theme'] ?? '';
@@ -11,7 +10,7 @@ if ($theme != 'light' && $theme != 'dark') {
exit;
}
-if (!$config['is_dev'] || !$name || !file_exists($path = ROOT.'/htdocs/scss/entries/'.$name.'/'.$theme.'.scss')) {
+if (!is_dev() || !$name || !file_exists($path = APP_ROOT.'/htdocs/scss/entries/'.$name.'/'.$theme.'.scss')) {
// logError(__FILE__.': access denied');
http_response_code(403);
exit;
@@ -26,7 +25,7 @@ $descriptorspec = [
2 => ['pipe', 'w'], // stderr
];
-$process = proc_open($cmd, $descriptorspec, $pipes, ROOT);
+$process = proc_open($cmd, $descriptorspec, $pipes, APP_ROOT);
if (!is_resource($process)) {
http_response_code(500);
logError('could not open sassc process');