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.
This commit is contained in:
parent
2fe2de1d5a
commit
7c047bea33
27
index.php
27
index.php
@ -96,10 +96,6 @@ if((x($_GET,'zid')) && (! $install)) {
|
|||||||
if((x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login'))
|
if((x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login'))
|
||||||
require("auth.php");
|
require("auth.php");
|
||||||
|
|
||||||
if(! x($_SESSION,'authenticated'))
|
|
||||||
header('X-Account-Management-Status: none');
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the page head after setting the language
|
* Create the page head after setting the language
|
||||||
* and getting any auth credentials
|
* and getting any auth credentials
|
||||||
@ -172,24 +168,31 @@ if(strlen($a->module)) {
|
|||||||
$a->module_loaded = true;
|
$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())) {
|
if(! $a->module_loaded) {
|
||||||
$a->module_loaded = false;
|
if(file_exists("custom/{$a->module}.php")) {
|
||||||
notice( t('Permission denied.') . EOL);
|
include_once("custom/{$a->module}.php");
|
||||||
goaway(z_root());
|
$a->module_loaded = true;
|
||||||
}
|
}
|
||||||
else {
|
elseif(file_exists("mod/{$a->module}.php")) {
|
||||||
include_once("mod/{$a->module}.php");
|
include_once("mod/{$a->module}.php");
|
||||||
$a->module_loaded = true;
|
$a->module_loaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* The URL provided does not resolve to a valid module.
|
* The URL provided does not resolve to a valid module.
|
||||||
|
Reference in New Issue
Block a user