diff --git a/errpages/httperror.php b/errpages/httperror.php index f4a57e1..b71390b 100644 --- a/errpages/httperror.php +++ b/errpages/httperror.php @@ -100,7 +100,7 @@ function isLive() { define('ERROR_CODE', 1); define('EXPLANATION', 2); -$errorcodes = json_decode(file_get_contents('./errpages/httperror.json'), true); +$errorcodes = json_decode(file_get_contents(getenv('ERRPAGE_JSON_PATH') . 'httperror.json'), true); if(@$errorcodes["{$http_status}"]) { $error_code = $errorcodes["{$http_status}"][ERROR_CODE]; diff --git a/testhttperror.php b/testhttperror.php index a55ba49..cea7f50 100644 --- a/testhttperror.php +++ b/testhttperror.php @@ -2,11 +2,17 @@ // this script is for testing ./errpages/httperror.php, just // change the code below $testcode = 401; +// NOTE: The version of httperror.php that uses a JSON file +// for error code content does not use this. Typically this +// was used only for 404 errors. +$_SERVER['REQUEST_URI'] = '/bad_path/no_resource'; // this just proves we can overwrite $_SERVER $_SERVER['HTTPS'] = 'on'; $_SERVER['SERVER_PORT'] = 443; // get the code to httperror.php... putenv("REDIRECT_STATUS={$testcode}"); // test! +putenv("ERRPAGE_JSON_PATH=./errpages/"); require_once './errpages/httperror.php'; +//require_once './errpages/_test.php'; ?> \ No newline at end of file