From 7c047bea332efaa11af0d02878d91823c4bba1ad Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 28 Nov 2012 01:23:16 -0800 Subject: Allow anybody to completely over-ride any module on their own site without any core code edits. Just copy an existing module file to 'custom/{module}.php' and edit to your liking. --- index.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/index.php b/index.php index 393d0cf4d..64cf55f7a 100644 --- a/index.php +++ b/index.php @@ -96,10 +96,6 @@ if((x($_GET,'zid')) && (! $install)) { if((x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login')) require("auth.php"); -if(! x($_SESSION,'authenticated')) - header('X-Account-Management-Status: none'); - - /* * Create the page head after setting the language * and getting any auth credentials @@ -172,24 +168,31 @@ if(strlen($a->module)) { $a->module_loaded = true; } + + if((strpos($a->module,'admin') === 0) && (! is_site_admin())) { + $a->module_loaded = false; + notice( t('Permission denied.') . EOL); + goaway(z_root()); + } + /** - * If not, next look for a 'standard' program module in the 'mod' directory + * If the site has a custom module to over-ride the standard module, use it. + * Otherwise, look for the standard program module in the 'mod' directory */ - if((! $a->module_loaded) && (file_exists("mod/{$a->module}.php"))) { - if((strpos($a->module,'admin') === 0) && (! is_site_admin())) { - $a->module_loaded = false; - notice( t('Permission denied.') . EOL); - goaway(z_root()); + + if(! $a->module_loaded) { + if(file_exists("custom/{$a->module}.php")) { + include_once("custom/{$a->module}.php"); + $a->module_loaded = true; } - else { + elseif(file_exists("mod/{$a->module}.php")) { include_once("mod/{$a->module}.php"); $a->module_loaded = true; } } - /** * * The URL provided does not resolve to a valid module. -- cgit v1.2.3