From cba41d1ab4c1360b606a891d179096f16c6b6b63 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 11 Jul 2018 21:46:34 +0200 Subject: [PATCH] page: stable include path (site then minimedit root) Uniform behaviour, preferring site-specific overrides and falling back to shared files (without requiring symlinks). --- page.inc.php | 6 +++--- page.php | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/page.inc.php b/page.inc.php index c42d5d6..80f773d 100644 --- a/page.inc.php +++ b/page.inc.php @@ -1,11 +1,11 @@ \n"; ob_start(); -include DOCROOT.'menu.html'; +include 'menu.html'; ob_start(); if (!empty($User)) { print '

'; @@ -46,7 +46,7 @@ print $body; register_shutdown_function(function () { print '

\n"; global $User; diff --git a/page.php b/page.php index 33a1f44..bb53a94 100644 --- a/page.php +++ b/page.php @@ -66,14 +66,15 @@ function getoutput($blocks = []) # custom error handling -define('DOCROOT', getcwd().'/'); +define('DOCROOT', getcwd()); +set_include_path(implode(PATH_SEPARATOR, [ DOCROOT, __DIR__ ])); function fail($error) { http_response_code(500); include_once 'page.inc.php'; ob_start(); - require_once DOCROOT.'500.html'; + require_once '500.html'; print getoutput(['debug' => $error]); } @@ -169,7 +170,7 @@ $Place += [ if (!$found) { # no resulting output http_response_code(404); - @require "./404.html"; + @require '404.html'; } include_once 'page.inc.php'; -- 2.30.0