From 397eb5dee2611cfaa1ff494d73e6785b88109cd6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 19 Feb 2009 23:48:16 +0000 Subject: [PATCH] All, except security block, include()/require() rewritten to own LOAD_INC()/LOAD_INC_ONCE() functions --- .gitattributes | 1 + admin.php | 2 +- agb.php | 2 +- beg.php | 6 +- birthday_confirm.php | 6 +- click.php | 2 +- confirm.php | 2 +- css.php | 8 +- debug.php | 9 +- doubler.php | 8 +- img.php | 15 ++-- inc/config.php | 2 +- inc/db/lib.php | 13 ++- inc/extensions.php | 14 ++-- inc/extensions/ext-autopurge.php | 2 +- inc/extensions/ext-beg.php | 2 +- inc/extensions/ext-birthday.php | 2 +- inc/extensions/ext-bonus.php | 8 +- inc/extensions/ext-cache.php | 2 +- inc/extensions/ext-doubler.php | 2 +- inc/extensions/ext-mediadata.php | 2 +- inc/extensions/ext-newsletter.php | 2 +- inc/extensions/ext-profile.php | 2 +- inc/extensions/ext-refback.php | 4 +- inc/extensions/ext-sql_patches.php | 8 +- inc/filters.php | 2 +- inc/footer.php | 2 +- inc/functions.php | 82 ++++++++++++++----- inc/gen_mediadata.php | 2 +- inc/gen_refback.php | 2 +- inc/gen_sql_patches.php | 9 +- inc/header.php | 8 +- inc/install-inc.php | 35 ++------ inc/language.php | 13 ++- inc/libs/cache_functions.php | 2 +- inc/libs/rallye_functions.php | 2 +- inc/libs/security_functions.php | 2 +- inc/libs/sponsor_functions.php | 6 +- inc/libs/theme_functions.php | 8 +- inc/load_extensions.php | 12 +-- inc/loader/load_cache-admin.php | 4 +- inc/loader/load_cache-config.php | 2 +- inc/loader/load_cache-modreg.php | 2 +- inc/loader/load_cache-refdepths.php | 2 +- inc/loader/load_cache-refsystem.php | 2 +- inc/loader/load_cache-them.php | 2 +- inc/modules/admin.php | 4 +- inc/modules/admin/action- | 4 +- inc/modules/admin/action-admins.php | 4 +- inc/modules/admin/action-bank.php | 4 +- inc/modules/admin/action-country.php | 4 +- inc/modules/admin/action-doubler.php | 4 +- inc/modules/admin/action-email.php | 4 +- inc/modules/admin/action-holiday.php | 4 +- inc/modules/admin/action-login.php | 4 +- inc/modules/admin/action-menu.php | 4 +- inc/modules/admin/action-misc.php | 4 +- inc/modules/admin/action-mods.php | 4 +- inc/modules/admin/action-newsletter.php | 4 +- inc/modules/admin/action-payouts.php | 4 +- inc/modules/admin/action-primera.php | 4 +- inc/modules/admin/action-rallye.php | 4 +- inc/modules/admin/action-repair.php | 4 +- inc/modules/admin/action-setup.php | 4 +- inc/modules/admin/action-sponsor.php | 4 +- inc/modules/admin/action-stats.php | 4 +- inc/modules/admin/action-surfbar.php | 4 +- inc/modules/admin/action-task.php | 4 +- inc/modules/admin/action-theme.php | 4 +- inc/modules/admin/action-transfer.php | 4 +- inc/modules/admin/action-user.php | 4 +- inc/modules/admin/action-wernis.php | 4 +- inc/modules/admin/admin-inc.php | 10 +-- inc/modules/admin/overview-inc.php | 2 +- inc/modules/admin/what-config_secure.php | 2 +- inc/modules/admin/what-edit_sponsor.php | 2 +- inc/modules/admin/what-list_task.php | 2 +- inc/modules/admin/what-lock_user.php | 2 +- inc/modules/admin/what-logs.php | 2 +- inc/modules/admin/what-overview.php | 2 +- inc/modules/admin/what-theme_check.php | 2 +- inc/modules/admin/what-theme_edit.php | 7 +- inc/modules/admin/what-theme_import.php | 12 +-- inc/modules/admin/what-usage.php | 26 +++--- inc/modules/guest/action- | 4 +- inc/modules/guest/action-admin.php | 4 +- inc/modules/guest/action-main.php | 4 +- inc/modules/guest/action-members.php | 4 +- inc/modules/guest/action-sponsor.php | 4 +- inc/modules/guest/what-login.php | 2 +- inc/modules/guest/what-wernis_portal.php | 2 +- inc/modules/index.php | 6 +- inc/modules/login.php | 4 +- inc/modules/member/action- | 6 +- inc/modules/member/action-account.php | 6 +- inc/modules/member/action-bank.php | 6 +- inc/modules/member/action-extras.php | 6 +- inc/modules/member/action-logout.php | 6 +- inc/modules/member/action-main.php | 6 +- inc/modules/member/action-order.php | 6 +- inc/modules/member/action-rals.php | 6 +- inc/modules/member/action-stats.php | 6 +- inc/modules/member/action-surfbar.php | 6 +- inc/modules/member/what-reflinks.php | 2 +- inc/modules/member/what-themes.php | 6 +- inc/mysql-connect.php | 38 ++++----- inc/mysql-manager.php | 13 ++- inc/session.php | 4 +- inc/stylesheet.php | 2 +- index.php | 6 +- install.php | 10 +-- js.php | 13 ++- lead-confirm.php | 6 +- login.php | 2 +- mailid.php | 6 +- mailid_top.php | 6 +- modules.php | 16 ++-- ref.php | 2 +- show_bonus.php | 6 +- sponsor_confirm.php | 2 +- sponsor_ref.php | 2 +- surfbar.php | 8 +- .../de/html/install/install_fatal_errors.tpl | 27 ++++++ view.php | 2 +- 124 files changed, 415 insertions(+), 360 deletions(-) create mode 100644 templates/de/html/install/install_fatal_errors.tpl diff --git a/.gitattributes b/.gitattributes index c4281ff592..3056141d0c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1326,6 +1326,7 @@ templates/de/html/index.tpl -text templates/de/html/index_forward.tpl -text templates/de/html/infos.tpl -text templates/de/html/install/.htaccess -text +templates/de/html/install/install_fatal_errors.tpl -text templates/de/html/install/install_fatal_row.tpl -text templates/de/html/install/install_fatal_table.tpl -text templates/de/html/install/install_finished.tpl -text diff --git a/admin.php b/admin.php index 3a173f4d9e..ef2153f008 100644 --- a/admin.php +++ b/admin.php @@ -44,7 +44,7 @@ $GLOBALS['module'] = "admin"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { diff --git a/agb.php b/agb.php index be4e7dca8c..9e82d2d8b6 100644 --- a/agb.php +++ b/agb.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "agb"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { diff --git a/beg.php b/beg.php index 077e3cdcc5..e1e41d1e34 100644 --- a/beg.php +++ b/beg.php @@ -46,7 +46,7 @@ $CSS = -1; $msg = null; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the "beg" extension active? if (!EXT_IS_ACTIVE("beg")) { @@ -186,7 +186,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { SQL_FREERESULT($result); // Include header - require_once(PATH."inc/header.php"); + LOAD_INC_ONCE("inc/header.php"); // Load final template LOAD_TEMPLATE("beg_link"); @@ -205,7 +205,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { } // Include footer - require_once(PATH."inc/footer.php"); + LOAD_INC_ONCE("inc/footer.php"); } elseif (($status != "CONFIRMED") && ($status != "failed")) { // Maybe locked/unconfirmed account? $msg = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status); diff --git a/birthday_confirm.php b/birthday_confirm.php index a40adc6cef..d33f8dc73b 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "birthday_confirm"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the "birthday" extension active? if (!EXT_IS_ACTIVE("birthday")) { @@ -116,7 +116,7 @@ WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1", $GLOBALS['module'] = "birthday_confirm"; // Include header - require(PATH."inc/header.php"); + LOAD_INC("inc/header.php"); // Load birthday header template (for your banners, e.g.?) define('__BIRTHDAY_HEADER', LOAD_TEMPLATE("birthday_header", true)); @@ -128,7 +128,7 @@ WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1", LOAD_TEMPLATE("birthday_confirm"); // Include footer - require(PATH."inc/footer.php"); + LOAD_INC("inc/footer.php"); } else { // You have to install first! LOAD_URL("install.php"); diff --git a/click.php b/click.php index ee59e6f825..1f7398fba1 100644 --- a/click.php +++ b/click.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "click"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); if (((!empty($_GET['user'])) || (!empty($_GET['reseller']))) && (!empty($_GET['banner']))) { // Update clicks counter... diff --git a/confirm.php b/confirm.php index 612d3480fd..a86970d13f 100644 --- a/confirm.php +++ b/confirm.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "confirm"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the script installed? if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered'))) { diff --git a/css.php b/css.php index 368716c995..1496f788b1 100644 --- a/css.php +++ b/css.php @@ -55,16 +55,16 @@ $GLOBALS['module'] = "css"; header("Content-type: text/css"); // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Load header -require_once(PATH."inc/header.php"); +LOAD_INC_ONCE("inc/header.php"); // Load CSS code -require_once(PATH."inc/stylesheet.php"); +LOAD_INC_ONCE("inc/stylesheet.php"); // Load footer -require_once(PATH."inc/footer.php"); +LOAD_INC_ONCE("inc/footer.php"); // ?> diff --git a/debug.php b/debug.php index 025ec75cfd..f08058f0d9 100644 --- a/debug.php +++ b/debug.php @@ -43,7 +43,7 @@ $GLOBALS['action'] = ""; $GLOBALS['module'] = "debug"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Redirect only to registration page when this script is installed if ((isBooleanConstantAndTrue('mxchange_installed')) && (getTotalFatalErrors() == 0)) { @@ -58,16 +58,15 @@ if ((isBooleanConstantAndTrue('mxchange_installed')) && (getTotalFatalErrors() = // Handle the request if (DEBUG_HANDLE_REQUEST($_POST['request'])) { // Construct FQFN for the module - $fqfn = sprintf("%sinc/debug/%s/request_%s", - PATH, + $INC = sprintf("inc/debug/%s/request_%s", getConfig('debug_mode'), SQL_ESCAPE($_POST['request']) ); // Is the module there? Else we log it! - if (FILE_READABLE($fqfn)) { + if (FILE_READABLE($INC)) { // Load the request module - require($fqfn); + LOAD_INC($INC); } else { // Missing request file, may happen while development DEBUG_ABUSE_LOG(__FILE__, __LINE__, "request_404", $_POST['request']); diff --git a/doubler.php b/doubler.php index 182b473cbb..2b0d5c6dd7 100644 --- a/doubler.php +++ b/doubler.php @@ -46,7 +46,7 @@ $GLOBALS['refid'] = 0; $CSS = 0; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the "doubler" extension active? if (!EXT_IS_ACTIVE("doubler")) { @@ -208,10 +208,10 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { if (!defined('__ERROR_MSG')) define('__ERROR_MSG' , ""); // Shall I check for points immediately? - if (getConfig('doubler_send_mode') == "DIRECT") require(PATH."inc/doubler_send.php"); + if (getConfig('doubler_send_mode') == "DIRECT") LOAD_INC("inc/doubler_send.php"); // Output header - require(PATH."inc/header.php"); + LOAD_INC("inc/header.php"); // Banner in text define('__DOUBLER_BANNER', LOAD_TEMPLATE("doubler_banner", true)); @@ -272,7 +272,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { LOAD_TEMPLATE("doubler_index"); // Output footer - require(PATH."inc/footer.php"); + LOAD_INC("inc/footer.php"); } else { // You have to install first! LOAD_URL("install.php"); diff --git a/img.php b/img.php index 15fb090ac9..b6e1636eee 100644 --- a/img.php +++ b/img.php @@ -42,33 +42,32 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "img"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { // Load header - require_once(PATH."inc/header.php"); + LOAD_INC_ONCE("inc/header.php"); // Code set? if (!empty($_GET['code'])) { // Generate image GENERATE_IMAGE(bigintval($_GET['code'])); } elseif (!empty($_GET['tag'])) { - // Tag set so create FQFN - $fqfn = sprintf("%sinc/img/tag-%s.php", - PATH, + // Tag set so create the IFN (Include-FileName) + $INC = sprintf("inc/img/tag-%s.php", SQL_ESCAPE($_GET['tag']) ); // Include is readable? - if (FILE_READABLE($fqfn)) { + if (FILE_READABLE($INC)) { // Include it - require($fqfn); + LOAD_INC($INC); } // END - if } // Finish generation here - require_once(PATH."inc/footer.php"); + LOAD_INC_ONCE("inc/footer.php"); } else { // You have to install first! LOAD_URL("install.php"); diff --git a/inc/config.php b/inc/config.php index 536cae8378..c645e2e263 100644 --- a/inc/config.php +++ b/inc/config.php @@ -162,7 +162,7 @@ define('SSL_COOKIES', false); define('ENABLE_BACKLINK', true); // Connect to the MySQL database... -require_once(PATH."inc/mysql-connect.php"); +LOAD_INC_ONCE("inc/mysql-connect.php"); // ?> diff --git a/inc/db/lib.php b/inc/db/lib.php index 083e5f240d..645721deac 100644 --- a/inc/db/lib.php +++ b/inc/db/lib.php @@ -38,21 +38,18 @@ if (!defined('__SECURITY')) { } // Select MySQL 3 as default database type -if (_DB_TYPE == "_DB_TYPE") define('_DB_TYPE', "mysql3"); +if (!defined('_DB_TYPE')) define('_DB_TYPE', "mysql3"); // Create include file name -$FQFN = sprintf("%sinc/db/lib-%s.php", PATH, _DB_TYPE); +$INC = sprintf("inc/db/lib-%s.php", constant('_DB_TYPE')); -if (FILE_READABLE($FQFN)) { +if (FILE_READABLE($INC)) { // Include abstraction layer - require_once($FQFN); + LOAD_INC_ONCE($INC); } else { // Bye, bye... - die("Cannot load database abstraction layer "._DB_TYPE." -> R.I.P."); + die("Cannot load database abstraction layer ".constant('_DB_TYPE')." -> R.I.P."); } -// Remove this globally used variable -unset($FQFN); - // ?> diff --git a/inc/extensions.php b/inc/extensions.php index 91646a16cc..c299557333 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -55,7 +55,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run } // END - if // Construct FQFN for extension file - $extInclude = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name); + $extInclude = sprintf("inc/extensions/ext-%s.php", $ext_name); // Is the extension file NOT there? if (!FILE_READABLE($extInclude)) { @@ -67,25 +67,25 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run } // END - if // Construct FQFN for language file - $langInclude = sprintf("%sinc/language/%s_%s.php", PATH, $ext_name, GET_LANGUAGE()); + $langInclude = sprintf("inc/language/%s_%s.php", $ext_name, GET_LANGUAGE()); // Is this include there? if ((FILE_READABLE($langInclude)) && (!isset($EXT_LOADED['lang'][$ext_name]))) { // Then load it //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Language loaded."); $EXT_LOADED['lang'][$ext_name] = true; - require($langInclude); + LOAD_INC_ONCE($langInclude); } // END - if // Construct FQFN for functions file - $funcsInclude = sprintf("%sinc/libs/%s_functions.php", PATH, $ext_name); + $funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name); // Is this include there? if ((FILE_READABLE($funcsInclude)) && (!isset($EXT_LOADED['funcs'][$ext_name]))) { // Then load it //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Functions loaded."); $EXT_LOADED['funcs'][$ext_name] = true; - require($funcsInclude); + LOAD_INC_ONCE($funcsInclude); } // END - if // Extensions are not deprecated by default @@ -102,7 +102,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run // Include the extension file //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Extension loaded."); - require($extInclude); + LOAD_INC($extInclude); // Is this extension deprecated? if ($EXT_DEPRECATED == "Y") { @@ -667,7 +667,7 @@ function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) { if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) == "")) { // Template file $tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl", - PATH, + constant('PATH'), GET_LANGUAGE(), $ext ); diff --git a/inc/extensions/ext-autopurge.php b/inc/extensions/ext-autopurge.php index ff66f2cb1f..9c46b91e5a 100644 --- a/inc/extensions/ext-autopurge.php +++ b/inc/extensions/ext-autopurge.php @@ -257,7 +257,7 @@ default: // Do stuff when extension is loaded if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) { // Yes, we have. So let's auto-purge some campaigns, inactive users and unconfirmed accounts - $INC_POOL[] = sprintf("%sinc/autopurge.php", PATH); + $INC_POOL[] = sprintf("%sinc/autopurge.php", constant('PATH')); } break; } diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index 846ad3177f..8d392d6473 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -271,7 +271,7 @@ default: // Do stuff when extension is loaded // Check for beg rallye is active and send mails out if ((getConfig('beg_rallye') == "Y") && (getConfig('beg_new_mem_notify') == "Y")) { // Include file for sending out mails - $INC_POOL[] = sprintf("%sinc/mails/beg_mails.php", PATH); + $INC_POOL[] = sprintf("%sinc/mails/beg_mails.php", constant('PATH')); } // END - if break; } diff --git a/inc/extensions/ext-birthday.php b/inc/extensions/ext-birthday.php index 15664c8d13..07cdfd488f 100644 --- a/inc/extensions/ext-birthday.php +++ b/inc/extensions/ext-birthday.php @@ -196,7 +196,7 @@ default: // Do stuff when extension is loaded if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (getConfig('birthday_points') > 0)) { // Daily reset was run and we shall pay points so we start checking for members who // has a birthday for today - $INC_POOL[] = sprintf("%sinc/mails/birthday_mails.php", PATH); + $INC_POOL[] = sprintf("%sinc/mails/birthday_mails.php", constant('PATH')); } break; } diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index 70e8151cd8..0bcddc787e 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -550,18 +550,18 @@ default: // Do stuff when extension is loaded // Daily reset was run so let's check if active rallye is activated if (getConfig('bonus_active') == "Y") { // Run active rallye - if (getConfig('bonus_stats') > 0) $INC_POOL[] = sprintf("%sinc/stats_bonus.php", PATH); - $INC_POOL[] = sprintf("%sinc/monthly/monthly_bonus.php", PATH); + if (getConfig('bonus_stats') > 0) $INC_POOL[] = sprintf("%sinc/stats_bonus.php", constant('PATH')); + $INC_POOL[] = sprintf("%sinc/monthly/monthly_bonus.php", constant('PATH')); } else { // Reset points - $INC_POOL[] = sprintf("%sinc/reset/reset_bonus.php", PATH); + $INC_POOL[] = sprintf("%sinc/reset/reset_bonus.php", constant('PATH')); } } // Check for bonus rallye is active and send mails out if ((getConfig('bonus_active') == "Y") && (getConfig('bonus_new_mem_notify') == "Y")) { // Include file for sending out mails - $INC_POOL[] = sprintf("%sinc/mails/bonus_mails.php", PATH); + $INC_POOL[] = sprintf("%sinc/mails/bonus_mails.php", constant('PATH')); } break; } diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 5a0dc15e6d..3a7f56e5b1 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -248,7 +248,7 @@ default: // Do stuff when extension is loaded global $cacheInstance; // Initialize cache system only when it's needed - $cacheInstance = new CacheSystem(getConfig('cache_update'), PATH."inc/".getConfig('cache_path'), getConfig('cache_tested')); + $cacheInstance = new CacheSystem(getConfig('cache_update'), constant('PATH')."inc/".getConfig('cache_path'), getConfig('cache_tested')); if ($cacheInstance->getStatus() != "done") { // Failed to initialize cache sustem addFatalMessage(__FILE__."(".__LINE__."): ".CACHE_CANNOT_INITIALIZE); diff --git a/inc/extensions/ext-doubler.php b/inc/extensions/ext-doubler.php index 2a9dac417f..e8c82f7615 100644 --- a/inc/extensions/ext-doubler.php +++ b/inc/extensions/ext-doubler.php @@ -240,7 +240,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha default: // Do stuff when extension is loaded if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (getConfig('doubler_send_mode') == "RESET")) { // So let's check for points - $INC_POOL[] = sprintf("%sinc/doubler_send.php", PATH); + $INC_POOL[] = sprintf("%sinc/doubler_send.php", constant('PATH')); } break; } diff --git a/inc/extensions/ext-mediadata.php b/inc/extensions/ext-mediadata.php index bc23dc9c41..23eb6ec06a 100644 --- a/inc/extensions/ext-mediadata.php +++ b/inc/extensions/ext-mediadata.php @@ -145,7 +145,7 @@ default: // Do stuff when extension is loaded if ((isset($dry_run)) && (isset($EXT_LOAD_MODE))) { if ((!$dry_run) && ($EXT_LOAD_MODE == "update") && ($EXT_VER == "0.0.4")) { // Add auto-check file - $INC_POOL[] = sprintf("%sinc/gen_mediadata.php", PATH); + $INC_POOL[] = sprintf("%sinc/gen_mediadata.php", constant('PATH')); } // END - if } // END - if diff --git a/inc/extensions/ext-newsletter.php b/inc/extensions/ext-newsletter.php index fd5f2f560e..5810b4e1f0 100644 --- a/inc/extensions/ext-newsletter.php +++ b/inc/extensions/ext-newsletter.php @@ -170,7 +170,7 @@ default: // Do stuff when extension is loaded if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) { // Daily reset was run so let's check out for expired newsletter orders - $INC_POOL[] = sprintf("%sinc/monthly/monthly_newsletter.php", PATH); + $INC_POOL[] = sprintf("%sinc/monthly/monthly_newsletter.php", constant('PATH')); } break; } diff --git a/inc/extensions/ext-profile.php b/inc/extensions/ext-profile.php index e0f5c58412..ae60910112 100644 --- a/inc/extensions/ext-profile.php +++ b/inc/extensions/ext-profile.php @@ -125,7 +125,7 @@ default: // Do stuff when extension is loaded // Do we have a daily-reset-run? if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) { // So let's check for profiles which needs an update - $INC_POOL[] = sprintf("%sinc/profile-updte.php", PATH); + $INC_POOL[] = sprintf("%sinc/profile-updte.php", constant('PATH')); } break; } diff --git a/inc/extensions/ext-refback.php b/inc/extensions/ext-refback.php index e1e165ce7d..8edb325efd 100644 --- a/inc/extensions/ext-refback.php +++ b/inc/extensions/ext-refback.php @@ -111,7 +111,9 @@ default: // Do stuff when extension is loaded // Shall we include special files? if ($EXT_LOAD_MODE == "register") { // Execute this special file on this update - $INC_POOL[] = PATH."inc/gen_refback.php"; + $INC_POOL[] = sprintf("%sinc/gen_refback.php", + constant('PATH') + ); } // END - if // Keep this extension always active! diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 8da3cde53a..2c3ef53d4f 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -735,13 +735,13 @@ default: // Do stuff when extension is loaded global $cacheInstance; // Maybe need setup of secret key! - require_once(PATH."inc/gen_sql_patches.php"); + LOAD_INC_ONCE("inc/gen_sql_patches.php"); // @TODO Rewrite this to a filter! if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheInstance)) && (is_object($cacheInstance))) { // Remove extensions and mod_reg cache file - require_once(PATH."inc/libs/cache_functions.php"); - require_once(PATH."inc/extensions/ext-cache.php"); + LOAD_INC_ONCE("inc/libs/cache_functions.php"); + LOAD_INC_ONCE("inc/extensions/ext-cache.php"); if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile(); if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile(); } // END - if @@ -750,7 +750,7 @@ default: // Do stuff when extension is loaded // Test again if ((getConfig('file_hash') != "") && (getConfig('master_salt') != "") && (getConfig('pass_scramble') != "")) { // File hash fas generated so we can also file the secret file... hopefully. - $hashFile = sprintf("%sinc/.secret/.%s", PATH, getConfig('file_hash')); + $hashFile = sprintf("%sinc/.secret/.%s", constant('PATH'), getConfig('file_hash')); if (FILE_READABLE($hashFile)) { // Read file $_CONFIG['secret_key'] = READ_FILE($hashFile); diff --git a/inc/filters.php b/inc/filters.php index 3ef321ce32..846668aa08 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -407,7 +407,7 @@ function FILTER_LOAD_INCLUDES ($data) { if (count($INC_POOL) > 0) { // Loads every include file foreach ($INC_POOL as $FQFN) { - require_once($FQFN); + LOAD_INC_ONCE($FQFN); } // END - foreach // Reset array diff --git a/inc/footer.php b/inc/footer.php index c32e5cdbde..e2d31c6e6d 100644 --- a/inc/footer.php +++ b/inc/footer.php @@ -45,7 +45,7 @@ if (($footer != "1") && ($footer != "2") && ($CSS != "1")) { // Output the generated HTML code or do nothing in direct-mode if (getTotalFatalErrors() > 0) { // Output fatal error messages - require_once(PATH."inc/fatal_errors.php"); + LOAD_INC_ONCE("inc/fatal_errors.php"); } // END - if // Shall we display the copyright notice? diff --git a/inc/functions.php b/inc/functions.php index e545aa0d6e..f071322d04 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -40,7 +40,7 @@ if (!defined('__SECURITY')) { // Check if our config file is writeable or not function IS_INC_WRITEABLE($inc) { // Generate FQFN - $fqfn = sprintf("%sinc/%s.php", PATH, $inc); + $fqfn = sprintf("%sinc/%s.php", constant('PATH'), $inc); // Abort by simple test if ((FILE_READABLE($fqfn)) && (!is_writeable($fqfn))) { @@ -265,7 +265,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { $date_time = MAKE_DATETIME(time(), "1"); // Base directory - $BASE = sprintf("%stemplates/%s/html/", PATH, GET_LANGUAGE()); + $BASE = sprintf("%stemplates/%s/html/", constant('PATH'), GET_LANGUAGE()); $MODE = ""; // Check for admin/guest/member templates @@ -476,12 +476,12 @@ function SEND_RAW_EMAIL ($to, $subject, $msg, $from) { // Shall we use PHPMailer class or legacy mode? if (CHECK_PHPMAILER_USAGE()) { // Use PHPMailer class with SMTP enabled - require_once(PATH."inc/phpmailer/class.phpmailer.php"); - require_once(PATH."inc/phpmailer/class.smtp.php"); + LOAD_INC_ONCE("inc/phpmailer/class.phpmailer.php"); + LOAD_INC_ONCE("inc/phpmailer/class.smtp.php"); // get new instance $mail = new PHPMailer(); - $mail->PluginDir = sprintf("%sinc/phpmailer/", PATH); + $mail->PluginDir = sprintf("%sinc/phpmailer/", constant('PATH')); $mail->IsSMTP(); $mail->SMTPAuth = true; @@ -701,7 +701,7 @@ function GET_LANGUAGE() { global $cacheArray; // Set default return value to default language from config - $ret = DEFAULT_LANG; + $ret = constant('DEFAULT_LANG'); // Init variable $lang = ""; @@ -724,7 +724,7 @@ function GET_LANGUAGE() { $ret = get_session('mx_lang'); // Fixes a warning before the session has the mx_lang constant - if (empty($ret)) $ret = DEFAULT_LANG; + if (empty($ret)) $ret = constant('DEFAULT_LANG'); } // Cache entry @@ -823,7 +823,7 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { $DATA['email'] = $email; // Base directory - $BASE = sprintf("%stemplates/%s/emails/", PATH, GET_LANGUAGE()); + $BASE = sprintf("%stemplates/%s/emails/", constant('PATH'), GET_LANGUAGE()); // Check for admin/guest/member templates if (strpos($template, "admin_") > -1) { @@ -950,9 +950,9 @@ function LOAD_URL($URL, $addUrlData=true) { header ("Location: ".str_replace("&", "&", $URL)); } else { // Output error message - require(PATH."inc/header.php"); + LOAD_INC("inc/header.php"); LOAD_TEMPLATE("redirect_url", false, str_replace("&", "&", $URL)); - require(PATH."inc/footer.php"); + LOAD_INC("inc/footer.php"); } exit(); } @@ -1319,7 +1319,7 @@ function GENERATE_IMAGE($img_code, $header=true) { } // Load image - $img = sprintf("%s/theme/%s/images/code_bg.%s", PATH, GET_CURR_THEME(), getConfig('img_type')); + $img = sprintf("%s/theme/%s/images/code_bg.%s", constant('PATH'), GET_CURR_THEME(), getConfig('img_type')); if (FILE_READABLE($img)) { // Switch image type switch (getConfig('img_type')) @@ -2240,13 +2240,13 @@ function FIX_DELETED_COOKIES ($cookies) { // Output error messages in a fasioned way and die... function mxchange_die ($msg) { // Load header - require_once(PATH."inc/header.php"); + LOAD_INC_ONCE("inc/header.php"); // Load the message template LOAD_TEMPLATE("admin_settings_saved", false, $msg); // Load footer - require(PATH."inc/footer.php"); + LOAD_INC("inc/footer.php"); // Exit explicitly exit; @@ -2639,13 +2639,13 @@ function REBUILD_CACHE ($cache, $inc="") { // Include file given? if (!empty($inc)) { // Construct FQFN - $fqfn = sprintf("%sinc/loader/load_cache-%s.php", PATH, $inc); + $INC = sprintf("inc/loader/load_cache-%s.php", $inc); // Is the include there? - if (FILE_READABLE($fqfn)) { + if (FILE_READABLE($INC)) { // And rebuild it from scratch //* DEBUG: */ print __FUNCTION__."(".__LINE__."): inc={$inc} - LOADED!
\n"; - require($fqfn); + LOAD_INC($INC); } else { // Include not found! DEBUG_LOG(__FUNCTION__, __LINE__, "Include {$inc} not found. cache={$cache}"); @@ -2915,13 +2915,13 @@ function GET_CURR_THEME() { } // END - if } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) && ((isBooleanConstantAndTrue('mxchange_installing')) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) { // Prepare FQFN for checking - $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_GET['theme'])); + $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), SQL_ESCAPE($_GET['theme'])); // Installation mode active if ((!empty($_GET['theme'])) && (FILE_READABLE($theme))) { // Set cookie from URL data set_session('mxchange_theme', SQL_ESCAPE($_GET['theme'])); - } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme'])))) { + } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", constant('PATH'), SQL_ESCAPE($_POST['theme'])))) { // Set cookie from posted data set_session('mxchange_theme', SQL_ESCAPE($_POST['theme'])); } @@ -2934,7 +2934,7 @@ function GET_CURR_THEME() { } // Add (maybe) found theme.php file to inclusion list - $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($ret)); + $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), SQL_ESCAPE($ret)); // Try to load the requested include file if (FILE_READABLE($theme)) $INC_POOL[] = $theme; @@ -3069,7 +3069,7 @@ function getActualVersion ($type = 0) { $new = false; // FQFN of revision file - $FQFN = sprintf("%sinc/cache/.revision", PATH); + $FQFN = sprintf("%sinc/cache/.revision", constant('PATH')); // Check for revision file if (!FILE_READABLE($FQFN)) { @@ -3105,6 +3105,48 @@ function getActualVersion ($type = 0) { return trim($akt_vers[$type]); } } + +// Loads an include file and logs any missing files for debug purposes +function LOAD_INC ($INC) { + // Get constant path + $PATH = constant('PATH'); + + // Use the include file name directly + // @TODO Try to find all locations where an FQFN is given to these two + // @TODO functions and avoid it. + $FQFN = $INC; + + // Check if PATH is in $INC + if (substr($INC, 0, $PATH) != $PATH) { + // Add it. This is why we need a trailing slash in config.php + $FQFN = $PATH . $INC; + } // END - if + + // Is the include file there? + if (!FILE_READABLE($FQFN)) { + // Not there so log it + DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Include file %s not found.", basename($INC))); + return false; + } // END - if + + // Try to load it + require($FQFN); +} + +// Loads an include file once +function LOAD_INC_ONCE ($INC) { + global $cacheArray; + + // Is it not loaded? + if (!isset($cacheArray['load_once'][$INC])) { + // Then try to load it + LOAD_INC($INC); + + // And mark it as loaded + $cacheArray['load_once'][$INC] = true; + } // END - if +} + ////////////////////////////////////////////////// // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS // ////////////////////////////////////////////////// diff --git a/inc/gen_mediadata.php b/inc/gen_mediadata.php index bdf11b0320..eae47eab4f 100644 --- a/inc/gen_mediadata.php +++ b/inc/gen_mediadata.php @@ -71,7 +71,7 @@ FROM `{!_MYSQL_PREFIX!}_bonus`", __FILE__, __LINE__); } // END - if // Load (maybe) missing file -require_once(PATH."inc/libs/mediadata_functions.php"); +LOAD_INC_ONCE("inc/libs/mediadata_functions.php"); // Insert info to database MEDIA_UPDATE_ENTRY(array("total_send" , "normal_send") , "init", $nsent); diff --git a/inc/gen_refback.php b/inc/gen_refback.php index 6aa3729e89..596aa5b916 100644 --- a/inc/gen_refback.php +++ b/inc/gen_refback.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // Make sure our functions are there -require_once(PATH."inc/libs/refback_functions.php"); +LOAD_INC_ONCE("inc/libs/refback_functions.php"); // Sanity-check: Do we have ref level 0? $result = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_refsystem` WHERE level=0", __FILE__, __LINE__); diff --git a/inc/gen_sql_patches.php b/inc/gen_sql_patches.php index efa7941201..0c9afaab5c 100644 --- a/inc/gen_sql_patches.php +++ b/inc/gen_sql_patches.php @@ -72,7 +72,10 @@ if (getConfig('master_salt') == "") { if (getConfig('file_hash') == "") { // Create filename from hashed random string $file_hash = sha1(GEN_PASS(mt_rand(128, 256))); - $file = PATH."inc/.secret/.".$file_hash; + $file = sprintf("%sinc/.secret/.%s", + constant('PATH'), + $file_hash + ); // Count of chars to be taken from back of the string $nums = mt_rand(40, 45); @@ -95,7 +98,9 @@ if (getConfig('file_hash') == "") { array($file_hash), __FILE__, __LINE__); // Generate FQFN for .htaccess file - $FQFN = PATH."inc/.secret/.htaccess"; + $FQFN = sprintf("%sinc/.secret/.htaccess", + constant('PATH') + ); // Is the .htaccess file there? if (!FILE_READABLE($FQFN)) { diff --git a/inc/header.php b/inc/header.php index 6c85f0bfaf..b04464c288 100644 --- a/inc/header.php +++ b/inc/header.php @@ -80,10 +80,10 @@ if (($header != "1") && ($header != "2")) { define('__PAGE_TITLE', html_entity_decode($TITLE)); } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) { // Load language file because it was missing in installation finalizer step... *sigh* - require_once(sprintf("%sinc/language/install_%s.php", - PATH, + $FQFN = sprintf("inc/language/install_%s.php", GET_LANGUAGE() - )); + ); + LOAD_INC_ONCE($FQFN); // Installation mode define('__PAGE_TITLE', getMessage('INSTALLATION_OF_MXCHANGE')); @@ -118,7 +118,7 @@ if (($header != "1") && ($header != "2")) { LOAD_TEMPLATE("header"); // Include stylesheet - require_once(PATH."inc/stylesheet.php"); + LOAD_INC_ONCE("inc/stylesheet.php"); } // END - if // Closing HEAD tag diff --git a/inc/install-inc.php b/inc/install-inc.php index 3a7422e0ae..c33ac6ed94 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -419,33 +419,8 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT define('__SMTP_USER' , $_POST['smtp_user']); define('__SMTP_PASS' , $_POST['smtp_pass']); - OUTPUT_HTML("
- - - - - - - - - - - -
-
".HEADER_MYSQL_ERRORS." -
 
- ".TEXT_MYSQL_ERRORS." -
-
    -".__FATAL_ERROR_LI." -
-".__MYSQL_DATA." - - - - -
-
"); + // Load template + LOAD_TEMPLATE("install_fatal_errors"); } else { // Installation is done! LOAD_URL($burl."/install.php?page=finalize"); @@ -456,13 +431,13 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT } else { // Something goes wrong during installation! :-( addFatalMessage(INSTALL_FINALIZER_FAILED); - include ("inc/fatal_errors.php"); + LOAD_INC("inc/fatal_errors.php"); } break; default: - DEBUG_LOG(__FILE__, __LINE__, sprintf("Wrong page %s detected.", $_GET['page'])); - OUTPUT_HTML("
".WRONG_PAGE.""); + DEBUG_LOG(__FILE__, __LINE__, sprintf("Wrong page %s detected!}, $_GET['page'])); + OUTPUT_HTML("
{!WRONG_PAGE!}"); break; } } else { diff --git a/inc/language.php b/inc/language.php index 1f8275c4cc..6399eca657 100644 --- a/inc/language.php +++ b/inc/language.php @@ -38,27 +38,26 @@ if (!defined('__SECURITY')) { } // Set default language -if (empty($mx_lang)) $mx_lang = DEFAULT_LANG; +if (empty($mx_lang)) $mx_lang = constant('DEFAULT_LANG'); // Generate FQFN -$FQFN = sprintf("%sinc/language/%s.php", PATH, $mx_lang); +$FQFN = sprintf("%sinc/language/%s.php", constant('PATH'), $mx_lang); // Look for file if (!FILE_READABLE($FQFN)) { // Switch to default (DO NOT CHANGE!!!) - set_session('mx_lang', 'de'); + set_session('mx_lang', constant('DEFAULT_LANG')); $mx_lang = "de"; - $FQFN = sprintf("%sinc/language/%s.php", PATH, "de"); + $INC = sprintf("inc/language/%s.php", constant('DEFAULT_LANG')); } // END - if // Load language file -require($FQFN); -unset($FQFN); +LOAD_INC($INC); // Check for installation mode if (isBooleanConstantAndTrue('mxchange_installing')) { // Load matching language file - require(PATH."inc/language/install_".$mx_lang.".php"); + LOAD_INC("inc/language/install_".$mx_lang.".php"); } // diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index bb5db58000..4e12fb90c3 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -178,7 +178,7 @@ class CacheSystem { $cache_version = null; // Load cache file - require_once($this->inc); + LOAD_INC_ONCE($this->inc); // Is there an array? if (is_array($data)) { diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 4389864886..fb4fa4a8a5 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -695,7 +695,7 @@ function RALLYE_TEMPLATE_SELECTION($name="template", $default="") { // Check templates directory $OUT = ""; $ral = array(); - $BASE = sprintf("%stemplates/%s/html/rallye/", PATH, GET_LANGUAGE()); + $BASE = sprintf("%stemplates/%s/html/rallye/", constant('PATH'), GET_LANGUAGE()); $dir = opendir($BASE); while ($read = readdir($dir)) { diff --git a/inc/libs/security_functions.php b/inc/libs/security_functions.php index 02b5132855..1f08065de4 100644 --- a/inc/libs/security_functions.php +++ b/inc/libs/security_functions.php @@ -93,7 +93,7 @@ $SEC_CHARS = array( "{CLOSE_ANCHOR2}", "{SLASH}", "{DOT}", - '{QUOT}', + "{QUOT}", "{DOLLAR}", "{OPEN_ANCHOR}", "{CLOSE_ANCHOR}", diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index 1bc1c7ed7f..48300f1b1d 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -354,10 +354,10 @@ function GENERATE_SPONSOR_CONTENT($what) { global $_CONFIG; $OUT = ""; - $FILE = sprintf("%sinc/modules/sponsor/%s.php", PATH, $what); - if (FILE_READABLE($FILE)) { + $INC = sprintf("inc/modules/sponsor/%s.php", $what); + if (FILE_READABLE($INC)) { // Every sponsor action will output nothing directly. It will be written into $OUT! - require_once($FILE); + LOAD_INC_ONCE($INC); } else { // File not found! $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_CONTENT_404_1.$what.SPONSOR_CONTENT_404_2); diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index 61b32431eb..6289a3d561 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -53,10 +53,10 @@ function THEME_SELECTION_BOX($mod, $act, $wht, $result) { // Load all themes while (list($theme) = SQL_FETCHROW($result)) { // Load it's theme.php file - $INC = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($theme)); + $INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($theme)); if (FILE_READABLE($INC)) { // And save all data in array - require($INC); + LOAD_INC($INC); $THEMES['theme_unix'][] = $theme; $THEMES['theme_name'][] = $THEME_NAME; } // END - if @@ -208,9 +208,9 @@ if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) { set_session('mxchange_theme', $newTheme); // Remove current from array and set new - $theme = sprintf("%stheme/%s/theme.php", PATH, $currTheme); + $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), $currTheme); unset($INC_POOL[array_search($theme, $INC_POOL)]); - $INC_POOL[] = sprintf("%stheme/%s/theme.php", PATH, $newTheme); + $INC_POOL[] = sprintf("%stheme/%s/theme.php", constant('PATH'), $newTheme); } // END - if // diff --git a/inc/load_extensions.php b/inc/load_extensions.php index c033051562..f77b7c7242 100644 --- a/inc/load_extensions.php +++ b/inc/load_extensions.php @@ -95,7 +95,7 @@ if ($cacheMode == "load") { $cacheInstance->destroyCacheFile(); // Retry it - require(__FILE__); + LOAD_INC(__FILE__); return; } // END - if @@ -163,7 +163,7 @@ if ($cacheMode == "load") { INIT_FILTER_SYSTEM(); // Load more cache files (like admins) - require_once(PATH."inc/load_cache.php"); + LOAD_INC_ONCE("inc/load_cache.php"); // Remove array unset($EXT_POOL); @@ -192,7 +192,7 @@ $DEL = array(); // At least one found? if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1") && ($CSS != "-1")) || ($cacheMode == "no"))) { // Load session management - require_once(PATH."inc/session.php"); + LOAD_INC_ONCE("inc/session.php"); // Extensions are registered so we load them while ($content = SQL_FETCHARRAY($res_ext_crt)) { @@ -203,7 +203,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1") } // END - if // Load extensions - $file1 = sprintf("%sinc/extensions/ext-%s.php", PATH, $content['ext_name']); + $file1 = sprintf("%sinc/extensions/ext-%s.php", constant('PATH'), $content['ext_name']); // Does the extension file exists? if (FILE_READABLE($file1)) { @@ -225,7 +225,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1") // CSS file handling: if ((!isset($content['ext_css'])) || ($content['ext_css'] == "Y")) { // Create FQFN for the CSS file - $CSS_FILE = sprintf("%stheme/%s/css/%s.css", PATH, GET_CURR_THEME(), $content['ext_name']); + $CSS_FILE = sprintf("%stheme/%s/css/%s.css", constant('PATH'), GET_CURR_THEME(), $content['ext_name']); // Is the file there? if (FILE_READABLE($CSS_FILE)) { @@ -260,7 +260,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1") $cacheInstance->finalize(); // Load more cache files (like admins) - require_once(PATH."inc/load_cache.php"); + LOAD_INC_ONCE("inc/load_cache.php"); } // END - if // Free memory diff --git a/inc/loader/load_cache-admin.php b/inc/loader/load_cache-admin.php index 5f240f5526..eef5335ccb 100644 --- a/inc/loader/load_cache-admin.php +++ b/inc/loader/load_cache-admin.php @@ -107,7 +107,7 @@ ORDER BY login", __FILE__, __LINE__); $cacheInstance->finalize(); // Reload the cache - require(__FILE__); + LOAD_INC(__FILE__); } // Next cached table are the admins_acls... @@ -138,7 +138,7 @@ if (GET_EXT_VERSION("admins") >= "0.3") { $cacheInstance->finalize(); // Reload the cache - require(__FILE__); + LOAD_INC(__FILE__); } } // END - if diff --git a/inc/loader/load_cache-config.php b/inc/loader/load_cache-config.php index 133a6dcbef..72853a24f6 100644 --- a/inc/loader/load_cache-config.php +++ b/inc/loader/load_cache-config.php @@ -66,7 +66,7 @@ if (($cacheInstance->loadCacheFile("config", true)) && ($cacheInstance->extensio $cacheInstance->finalize(); // Reload the cache - require(__FILE__); + LOAD_INC(__FILE__); } // diff --git a/inc/loader/load_cache-modreg.php b/inc/loader/load_cache-modreg.php index b6eb02a2da..7e6411ae5b 100644 --- a/inc/loader/load_cache-modreg.php +++ b/inc/loader/load_cache-modreg.php @@ -96,7 +96,7 @@ FROM `{!_MYSQL_PREFIX!}_mod_reg` ORDER BY `id`", __FILE__, __LINE__); $cacheInstance->finalize(); // Reload the cache - require(__FILE__); + LOAD_INC(__FILE__); } // diff --git a/inc/loader/load_cache-refdepths.php b/inc/loader/load_cache-refdepths.php index 208d8825ad..7c5bf3ff55 100644 --- a/inc/loader/load_cache-refdepths.php +++ b/inc/loader/load_cache-refdepths.php @@ -64,7 +64,7 @@ if (($cacheInstance->loadCacheFile("refdepths")) && ($cacheInstance->extensionVe $cacheInstance->finalize(); // Reload the cache - require(__FILE__); + LOAD_INC(__FILE__); } // diff --git a/inc/loader/load_cache-refsystem.php b/inc/loader/load_cache-refsystem.php index 87dce53986..b65764680e 100644 --- a/inc/loader/load_cache-refsystem.php +++ b/inc/loader/load_cache-refsystem.php @@ -64,7 +64,7 @@ if (($cacheInstance->loadCacheFile("refsystem")) && ($cacheInstance->extensionVe $cacheInstance->finalize(); // Reload the cache - require(__FILE__); + LOAD_INC(__FILE__); } // diff --git a/inc/loader/load_cache-them.php b/inc/loader/load_cache-them.php index c516fe9c9d..0b453f1b4b 100644 --- a/inc/loader/load_cache-them.php +++ b/inc/loader/load_cache-them.php @@ -91,7 +91,7 @@ if (($cacheInstance->loadCacheFile("themes")) && ($cacheInstance->extensionVersi $cacheInstance->finalize(); // Reload the cache - require(__FILE__); + LOAD_INC(__FILE__); } // diff --git a/inc/modules/admin.php b/inc/modules/admin.php index fec5cc9fc5..2d11145709 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -44,7 +44,7 @@ if ((empty($GLOBALS['action'])) && ($check == "admin_only")) { } // END - if // Load include file -require_once(PATH."inc/modules/admin/admin-inc.php"); +LOAD_INC_ONCE("inc/modules/admin/admin-inc.php"); // Fix "deleted" cookies in PHP4 (PHP5 does remove them, PHP4 sets them to deleted!) FIX_DELETED_COOKIES(array('admin_login', 'admin_md5', 'admin_last', 'admin_to')); @@ -355,7 +355,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) { if (!empty($_GET['area'])) $area = SQL_ESCAPE($_GET['area']); // Load "logical-area menu-system" file - require_once(PATH."inc/modules/admin/lasys-inc.php"); + LOAD_INC_ONCE("inc/modules/admin/lasys-inc.php"); // Create new-style menu system will "logical areas" ADMIN_LOGICAL_AREA_SYSTEM($area, $act, $GLOBALS['what']); diff --git a/inc/modules/admin/action- b/inc/modules/admin/action- index 4991768fdd..cdaccba72d 100644 --- a/inc/modules/admin/action- +++ b/inc/modules/admin/action- @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-admins.php b/inc/modules/admin/action-admins.php index 584cea7a8e..69eaf11bc2 100644 --- a/inc/modules/admin/action-admins.php +++ b/inc/modules/admin/action-admins.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-bank.php b/inc/modules/admin/action-bank.php index ff6fd6a254..2247dfdb83 100644 --- a/inc/modules/admin/action-bank.php +++ b/inc/modules/admin/action-bank.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-country.php b/inc/modules/admin/action-country.php index 6407fa2fce..572b5a83db 100644 --- a/inc/modules/admin/action-country.php +++ b/inc/modules/admin/action-country.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-doubler.php b/inc/modules/admin/action-doubler.php index c289625a17..ec9c8cf303 100644 --- a/inc/modules/admin/action-doubler.php +++ b/inc/modules/admin/action-doubler.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { // "what file" not found addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); diff --git a/inc/modules/admin/action-email.php b/inc/modules/admin/action-email.php index fa176d7b91..303a858393 100644 --- a/inc/modules/admin/action-email.php +++ b/inc/modules/admin/action-email.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-holiday.php b/inc/modules/admin/action-holiday.php index 1085578127..dcdc7e38df 100644 --- a/inc/modules/admin/action-holiday.php +++ b/inc/modules/admin/action-holiday.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-login.php b/inc/modules/admin/action-login.php index 9fad8a1079..cc980cf9b7 100644 --- a/inc/modules/admin/action-login.php +++ b/inc/modules/admin/action-login.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-menu.php b/inc/modules/admin/action-menu.php index 0377e5def5..eec930c8ea 100644 --- a/inc/modules/admin/action-menu.php +++ b/inc/modules/admin/action-menu.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-misc.php b/inc/modules/admin/action-misc.php index 2f261a6382..6f6b74abfc 100644 --- a/inc/modules/admin/action-misc.php +++ b/inc/modules/admin/action-misc.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-mods.php b/inc/modules/admin/action-mods.php index 609fda6601..a0ecec34ec 100644 --- a/inc/modules/admin/action-mods.php +++ b/inc/modules/admin/action-mods.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-newsletter.php b/inc/modules/admin/action-newsletter.php index 438d613c70..eae1d188f8 100644 --- a/inc/modules/admin/action-newsletter.php +++ b/inc/modules/admin/action-newsletter.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-payouts.php b/inc/modules/admin/action-payouts.php index b4b15bfb2f..29af434667 100644 --- a/inc/modules/admin/action-payouts.php +++ b/inc/modules/admin/action-payouts.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-primera.php b/inc/modules/admin/action-primera.php index f2549d1421..48bc6cc5fc 100644 --- a/inc/modules/admin/action-primera.php +++ b/inc/modules/admin/action-primera.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-rallye.php b/inc/modules/admin/action-rallye.php index b6f3046ae6..9b7df7e7d1 100644 --- a/inc/modules/admin/action-rallye.php +++ b/inc/modules/admin/action-rallye.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-repair.php b/inc/modules/admin/action-repair.php index 0add6351e0..f94fd846ef 100644 --- a/inc/modules/admin/action-repair.php +++ b/inc/modules/admin/action-repair.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-setup.php b/inc/modules/admin/action-setup.php index 560c878404..d2cb9c50c9 100644 --- a/inc/modules/admin/action-setup.php +++ b/inc/modules/admin/action-setup.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-sponsor.php b/inc/modules/admin/action-sponsor.php index fb1c52700d..b9452b7958 100644 --- a/inc/modules/admin/action-sponsor.php +++ b/inc/modules/admin/action-sponsor.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-stats.php b/inc/modules/admin/action-stats.php index 86ff0f2843..4100288347 100644 --- a/inc/modules/admin/action-stats.php +++ b/inc/modules/admin/action-stats.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-surfbar.php b/inc/modules/admin/action-surfbar.php index ff29f1784c..9b721fe396 100644 --- a/inc/modules/admin/action-surfbar.php +++ b/inc/modules/admin/action-surfbar.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-task.php b/inc/modules/admin/action-task.php index 06b0b88efe..20274b9c2d 100644 --- a/inc/modules/admin/action-task.php +++ b/inc/modules/admin/action-task.php @@ -44,10 +44,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-theme.php b/inc/modules/admin/action-theme.php index 494674dd3c..d1e14ad33b 100644 --- a/inc/modules/admin/action-theme.php +++ b/inc/modules/admin/action-theme.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-transfer.php b/inc/modules/admin/action-transfer.php index 5aaa6fdc5a..8175c2f86e 100644 --- a/inc/modules/admin/action-transfer.php +++ b/inc/modules/admin/action-transfer.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-user.php b/inc/modules/admin/action-user.php index b2a3e9e1ac..cdc524036e 100644 --- a/inc/modules/admin/action-user.php +++ b/inc/modules/admin/action-user.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/action-wernis.php b/inc/modules/admin/action-wernis.php index 46a97dfeef..4957c8f847 100644 --- a/inc/modules/admin/action-wernis.php +++ b/inc/modules/admin/action-wernis.php @@ -41,10 +41,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Load the include file -$INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); +$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); if (FILE_READABLE($INC)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } else { addFatalMessage(ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2); } diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 75f66ff5b2..f729b1da8f 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -349,10 +349,10 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__); if (SQL_NUMROWS($result_action) == 1) { // Is valid but does the inlcude file exists? - $INC = sprintf("%sinc/modules/admin/action-%s.php", PATH, $act); + $INC = sprintf("inc/modules/admin/action-%s.php", $act); if ((FILE_READABLE($INC)) && (VALIDATE_MENU_ACTION("admin", $act, $wht)) && (__ACL_ALLOW == true)) { // Ok, we finally load the admin action module - require($INC); + LOAD_INC($INC); } elseif (__ACL_ALLOW == false) { // Access denied LOAD_TEMPLATE("admin_menu_failed", false, getMessage('ADMIN_ACCESS_DENIED')); @@ -469,7 +469,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) { \n"; while (list($wht_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) { // Filename - $INC = sprintf("%sinc/modules/admin/what-%s.php", PATH, $wht_sub); + $INC = sprintf("%sinc/modules/admin/what-%s.php", constant('PATH'), $wht_sub); if ((EXT_IS_ACTIVE("admins")) && (GET_EXT_VERSION("admins") > "0.2")) { $ACL = ADMINS_CHECK_ACL("", $wht_sub); } else { @@ -729,7 +729,7 @@ function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="con // Generate a selection box function ADMIN_MAKE_MENU_SELECTION ($menu, $type, $name, $default="") { // Open the requested menu directory - $handle = opendir(sprintf("%sinc/modules/%s/", PATH, $menu)) or mxchange_die("Cannot load menu ".$menu."!"); + $handle = opendir(sprintf("%sinc/modules/%s/", constant('PATH'), $menu)) or mxchange_die("Cannot load menu ".$menu."!"); // Init the selection box $OUT = ""); diff --git a/inc/session.php b/inc/session.php index 89f370509a..37f988dd22 100644 --- a/inc/session.php +++ b/inc/session.php @@ -57,10 +57,10 @@ global $PHPSESSID; $PHPSESSID = @session_id(); // Load language system -require_once(PATH."inc/language.php"); +LOAD_INC_ONCE("inc/language.php"); // Load extensions here -require_once(PATH."inc/load_extensions.php"); +LOAD_INC_ONCE("inc/load_extensions.php"); // Determine and set referal id DETERMINE_REFID(); diff --git a/inc/stylesheet.php b/inc/stylesheet.php index c93b50b02c..4840655c26 100644 --- a/inc/stylesheet.php +++ b/inc/stylesheet.php @@ -59,7 +59,7 @@ if (($CSS == "1") || (getConfig('css_php') == "DIRECT")) { // Output inclusion lines foreach ($STYLES as $value) { // Only include found CSS files (to reduce 404 requests) - $BASE = sprintf("%stheme/%s/css/", PATH, GET_CURR_THEME()); + $BASE = sprintf("%stheme/%s/css/", constant('PATH'), GET_CURR_THEME()); $file = $BASE.$value; // Do include only existing files and whose are not empty diff --git a/index.php b/index.php index d5ee879dcd..fc1220d829 100644 --- a/index.php +++ b/index.php @@ -43,12 +43,12 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "index"; // Load config.php -require("inc/config.php"); +require_once("inc/config.php"); // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { // Header - require(PATH."inc/header.php"); + LOAD_INC("inc/header.php"); // Fix missing array elements here if (getConfig('index_delay') == null) $_CONFIG['index_delay'] = 0; @@ -81,7 +81,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { } // Footer - require(PATH."inc/footer.php"); + LOAD_INC("inc/footer.php"); } else { // You have to install first! LOAD_URL("install.php"); diff --git a/install.php b/install.php index a700f22dab..b6f2416d36 100644 --- a/install.php +++ b/install.php @@ -45,7 +45,7 @@ define('mxchange_installing', true); // Load security system -require("inc/libs/security_functions.php"); +require_once("inc/libs/security_functions.php"); // Init "action" and "what" global $what, $action; @@ -59,10 +59,10 @@ $CSS = 0; $GLOBALS['module'] = "install"; // Load config file -require("inc/config.php"); +require_once("inc/config.php"); // Header -require(PATH."inc/header.php"); +LOAD_INC("inc/header.php"); // Reload page to page=welcome when it is not specified if (!isset($_GET['page'])) { @@ -81,14 +81,14 @@ if (getTotalFatalErrors() == 0) { LOAD_TEMPLATE("install_header"); // Here start's our installtion stuff - require_once(PATH."inc/install-inc.php"); + LOAD_INC_ONCE("inc/install-inc.php"); // Close main installation table LOAD_TEMPLATE("install_footer"); } // Footer -require(PATH."inc/footer.php"); +LOAD_INC("inc/footer.php"); // ?> diff --git a/js.php b/js.php index 0ced4dccaf..d5598fb1a7 100644 --- a/js.php +++ b/js.php @@ -51,7 +51,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $CSS = "1"; $GLOBALS['module'] = "js"; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is this script installed and a JavaScript tag is provied? if ((isBooleanConstantAndTrue('mxchange_installed')) && (isset($_GET['tag']))) { @@ -59,22 +59,21 @@ if ((isBooleanConstantAndTrue('mxchange_installed')) && (isset($_GET['tag']))) { @header("Content-type: text/javascript"); // Load header - require_once(PATH."inc/header.php"); + LOAD_INC_ONCE("inc/header.php"); // Prepare include file for looking - $fqfn = sprintf("%sinc/js/tag-%s.php", - PATH, + $INC = sprintf("inc/js/tag-%s.php", SQL_ESCAPE($_GET['tag']) ); // Is that file readable? - if (FILE_READABLE($fqfn)) { + if (FILE_READABLE($INC)) { // Include it - require_once($fqfn); + LOAD_INC_ONCE($INC); } // END - if // Load footer - require_once(PATH."inc/footer.php"); + LOAD_INC_ONCE("inc/footer.php"); } // END - if // diff --git a/lead-confirm.php b/lead-confirm.php index f014f2d754..793814e683 100644 --- a/lead-confirm.php +++ b/lead-confirm.php @@ -43,12 +43,12 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "lead-confirm"; // Load config.php -require("inc/config.php"); +require_once("inc/config.php"); // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { // Header - require(PATH."inc/header.php"); + LOAD_INC("inc/header.php"); // Initialize the array for the template $content = array( @@ -83,7 +83,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { LOAD_TEMPLATE("lead_code", false, $content); // Footer - require(PATH."inc/footer.php"); + LOAD_INC("inc/footer.php"); } else { // You have to install first! LOAD_URL("install.php"); diff --git a/login.php b/login.php index 27537535c7..3d9dab567b 100644 --- a/login.php +++ b/login.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "login"; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { diff --git a/mailid.php b/mailid.php index 4778ba9130..d1bae743d0 100644 --- a/mailid.php +++ b/mailid.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "mailid"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); if (isBooleanConstantAndTrue('mxchange_installed')) { // Is the extension active @@ -156,7 +156,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { } // Add header - require_once(PATH."inc/header.php"); + LOAD_INC_ONCE("inc/header.php"); // Was that mail a valid one? if ($VALID) { @@ -216,7 +216,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { } } else { // Include footer - require_once(PATH."inc/footer.php"); + LOAD_INC_ONCE("inc/footer.php"); } } else { // You have to install first! diff --git a/mailid_top.php b/mailid_top.php index 1c9405aa35..513b898ab6 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "mailid"; $CSS = 0; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); if (isBooleanConstantAndTrue('mxchange_installed')) { // Is the extension active @@ -62,7 +62,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // 01 1 12 2 2 21 1 22 10 if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors() == 0)) { // No image? Then output header - if ($mode != "img") require_once(PATH."inc/header.php"); + if ($mode != "img") LOAD_INC_ONCE("inc/header.php"); // Maybe he wants to confirm an email? if ($url_mid > 0) { @@ -348,7 +348,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Insert footer if no image if ($mode != "img") { // Write footer - require_once(PATH."inc/footer.php"); + LOAD_INC_ONCE("inc/footer.php"); } // END - if } } elseif ($mode != "img") { diff --git a/modules.php b/modules.php index 4215f5c97c..f1b619b29e 100644 --- a/modules.php +++ b/modules.php @@ -55,7 +55,7 @@ if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']); $GLOBALS['module'] = secureString($_GET['module']); // Needed include files -require("inc/config.php"); +require_once("inc/config.php"); // Check if logged in if (IS_MEMBER()) { @@ -94,7 +94,7 @@ if (IS_MEMBER()) { } // The header file -require_once(PATH."inc/header.php"); +LOAD_INC_ONCE("inc/header.php"); // Modules are by default not valid! $MOD_VALID = false; $check = "failed"; @@ -102,6 +102,9 @@ if ((getConfig('maintenance') == "Y") && (!IS_ADMIN()) && ($GLOBALS['module'] != // Maintain mode is active and you are no admin addFatalMessage(getMessage('LANG_DOWN_MAINTAINCE')); } elseif (($link) && ($db) && (getTotalFatalErrors() == 0)) { + // Construct module name + define('__MODULE', sprintf("inc/modules/%s.php", SQL_ESCAPE($GLOBALS['module']))); + // Did we found the module listed in allowed modules and are we successfully connected? $check = CHECK_MODULE($GLOBALS['module']); switch ($check) @@ -109,9 +112,6 @@ if ((getConfig('maintenance') == "Y") && (!IS_ADMIN()) && ($GLOBALS['module'] != case "admin_only": case "mem_only": case "done": - // Construct module name - define('__MODULE', sprintf("%sinc/modules/%s.php", PATH, SQL_ESCAPE($GLOBALS['module']))); - // Does the module exists on local file system? if ((FILE_READABLE(__MODULE)) && (getTotalFatalErrors() == 0)) { // Module is valid, active and located on the local disc... @@ -129,7 +129,7 @@ if ((getConfig('maintenance') == "Y") && (!IS_ADMIN()) && ($GLOBALS['module'] != break; case "locked": - if (!FILE_READABLE(PATH."inc/modules/".$GLOBALS['module'].".php")) { + if (!FILE_READABLE(__MODULE)) { // Module does addionally not exists addFatalMessage(LANG_MOD_REG_404_1.$GLOBALS['module'].LANG_MOD_REG_404_2); } // END - if @@ -154,11 +154,11 @@ if (($MOD_VALID) && (defined('__MODULE'))) { ///////////////////////////////////////////// // // Everything is okay so we can load the module - include (__MODULE); + LOAD_INC_ONCE(__MODULE); } // END - if // Next-to-end add the footer -require_once(PATH."inc/footer.php"); +LOAD_INC_ONCE("inc/footer.php"); // ?> diff --git a/ref.php b/ref.php index 604a86d189..ef79784df3 100644 --- a/ref.php +++ b/ref.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "ref"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Redirect only to registration page when this script is installed if (isBooleanConstantAndTrue('mxchange_installed')) { diff --git a/show_bonus.php b/show_bonus.php index ddff568683..d86e5fedbf 100644 --- a/show_bonus.php +++ b/show_bonus.php @@ -44,7 +44,7 @@ $GLOBALS['action'] = ""; $GLOBALS['module'] = "show_bonus"; $CSS = 0; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the "bonus" extension active? if (!EXT_IS_ACTIVE("bonus")) { @@ -55,7 +55,7 @@ if (!EXT_IS_ACTIVE("bonus")) { // List only rankings when script is installed if (isBooleanConstantAndTrue('mxchange_installed')) { // Include header - require(PATH."inc/header.php"); + LOAD_INC("inc/header.php"); if (($_GET['uid'] > 0) && ($_GET['d'] > 0) && (!empty($_GET['t']))) { // Set row name @@ -133,7 +133,7 @@ LIMIT 1", LOAD_TEMPLATE("show_bonus"); // Include footer - require(PATH."inc/footer.php"); + LOAD_INC("inc/footer.php"); } else { // You have to install first! LOAD_URL("install.php"); diff --git a/sponsor_confirm.php b/sponsor_confirm.php index 5b601d88ca..d849c935c2 100644 --- a/sponsor_confirm.php +++ b/sponsor_confirm.php @@ -34,7 +34,7 @@ require_once("inc/libs/security_functions.php"); // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { diff --git a/sponsor_ref.php b/sponsor_ref.php index 065aef6868..e6326473af 100644 --- a/sponsor_ref.php +++ b/sponsor_ref.php @@ -34,7 +34,7 @@ require_once("inc/libs/security_functions.php"); // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Redirect only to registration page when this script is installed if (defined('mxchange_installed') && (isBooleanConstantAndTrue(mxchange_installed))) { diff --git a/surfbar.php b/surfbar.php index a640ea603a..07d22fb273 100644 --- a/surfbar.php +++ b/surfbar.php @@ -47,7 +47,7 @@ $CSS = 0; $msg = null; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { @@ -67,7 +67,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { if ((SURFBAR_CHECK_RELOAD_FULL()) || ((isset($_GET['frame'])) && (in_array($_GET['frame'], array("stop", "stop2", "stats", "textlinks"))))) { // Reload-lock is full, surfbar stopped so... // Load header - require_once(PATH."inc/header.php"); + LOAD_INC_ONCE("inc/header.php"); // Load template if (((isset($_GET['frame'])) && ($_GET['frame'] == "stop")) || (!isset($_GET['frame']))) { @@ -183,7 +183,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { } // Load header - require_once(PATH."inc/header.php"); + LOAD_INC_ONCE("inc/header.php"); // Load that template //* DEBUG: */ die("templateName={$templateName}
\ncontent=
".print_r($content, true)."
"); @@ -191,7 +191,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { } // Load footer - require_once(PATH."inc/footer.php"); + LOAD_INC_ONCE("inc/footer.php"); } else { // You have to install first! LOAD_URL("install.php"); diff --git a/templates/de/html/install/install_fatal_errors.tpl b/templates/de/html/install/install_fatal_errors.tpl new file mode 100644 index 0000000000..c68e2e917d --- /dev/null +++ b/templates/de/html/install/install_fatal_errors.tpl @@ -0,0 +1,27 @@ + +
"); -$INC_ACTION = sprintf("%sinc/modules/member/action-%s.php", PATH, $act); +$INC_ACTION = sprintf("inc/modules/member/action-%s.php", $act); if ((FILE_READABLE($INC_ACTION)) && (VALIDATE_MENU_ACTION("member", GET_ACTION("member", $GLOBALS['what']), $GLOBALS['what']))) { // Requested module is available so we load it - include ($INC_ACTION); + LOAD_INC($INC_ACTION); } else { // Invalid module specified or not found... LOAD_URL("modules.php?module=login"); diff --git a/inc/modules/member/action- b/inc/modules/member/action- index 7fcb665657..91e6a066ab 100644 --- a/inc/modules/member/action- +++ b/inc/modules/member/action- @@ -49,10 +49,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/action-account.php b/inc/modules/member/action-account.php index 538709a7cb..9f19674939 100644 --- a/inc/modules/member/action-account.php +++ b/inc/modules/member/action-account.php @@ -46,10 +46,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/action-bank.php b/inc/modules/member/action-bank.php index b641a2cf45..8aad934946 100644 --- a/inc/modules/member/action-bank.php +++ b/inc/modules/member/action-bank.php @@ -49,10 +49,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/action-extras.php b/inc/modules/member/action-extras.php index ffef8c9ffe..6aae2a0497 100644 --- a/inc/modules/member/action-extras.php +++ b/inc/modules/member/action-extras.php @@ -46,10 +46,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/action-logout.php b/inc/modules/member/action-logout.php index 557c54c2bf..e3f4de5bba 100644 --- a/inc/modules/member/action-logout.php +++ b/inc/modules/member/action-logout.php @@ -46,10 +46,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/action-main.php b/inc/modules/member/action-main.php index 27bd965b3c..7158a4cffb 100644 --- a/inc/modules/member/action-main.php +++ b/inc/modules/member/action-main.php @@ -46,10 +46,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/action-order.php b/inc/modules/member/action-order.php index d8455dc7ad..5248f12891 100644 --- a/inc/modules/member/action-order.php +++ b/inc/modules/member/action-order.php @@ -49,10 +49,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/action-rals.php b/inc/modules/member/action-rals.php index df0838f205..5815abf4aa 100644 --- a/inc/modules/member/action-rals.php +++ b/inc/modules/member/action-rals.php @@ -46,10 +46,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/action-stats.php b/inc/modules/member/action-stats.php index 284de3b7c3..c7e9111a81 100644 --- a/inc/modules/member/action-stats.php +++ b/inc/modules/member/action-stats.php @@ -46,10 +46,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/action-surfbar.php b/inc/modules/member/action-surfbar.php index c2090cdf44..214a66bbf3 100644 --- a/inc/modules/member/action-surfbar.php +++ b/inc/modules/member/action-surfbar.php @@ -49,10 +49,10 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Load the include file -$INC_WHAT = sprintf("%sinc/modules/member/what-%s.php", PATH, SQL_ESCAPE($GLOBALS['what'])); -if (FILE_READABLE($INC_WHAT)) { +$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what'])); +if (FILE_READABLE($INC)) { // Ok, we finally load the member action module - require($INC_WHAT); + LOAD_INC($INC); } else { addFatalMessage(MEMBER_404_ACTION_1.$GLOBALS['what'].MEMBER_404_ACTION_2); } diff --git a/inc/modules/member/what-reflinks.php b/inc/modules/member/what-reflinks.php index 8b400c254c..4a88da8c96 100644 --- a/inc/modules/member/what-reflinks.php +++ b/inc/modules/member/what-reflinks.php @@ -78,7 +78,7 @@ if (SQL_NUMROWS($result) > 0) { // List available ref banners $SW = 2; $OUT = ""; while (list($id, $url, $alt, $count, $clks) = SQL_FETCHROW($result)) { - $test = str_replace(URL, PATH, $url); $size = 0; + $test = str_replace(URL, constant('PATH'), $url); $size = 0; if ($test == $url) { // Download banner (I hope you keep the banner on same server???) $fp = GET_URL($url); $file = ""; diff --git a/inc/modules/member/what-themes.php b/inc/modules/member/what-themes.php index 2034e6e63b..e260fae8b0 100644 --- a/inc/modules/member/what-themes.php +++ b/inc/modules/member/what-themes.php @@ -74,11 +74,11 @@ $THEMES = array( $handle = opendir(PATH."theme/") or mxchange_die("Cannot read themes dir!"); while ($entry = readdir($handle)) { // Construct absolute theme.php file name - $theme = sprintf("%stheme/%s/theme.php", PATH, $entry); + $INC = sprintf("theme/%s/theme.php", $entry); - if (($entry != ".") && ($entry != "..") && (FILE_READABLE($theme)) && (THEME_IS_ACTIVE($entry))) { + if (($entry != ".") && ($entry != "..") && (FILE_READABLE($INC)) && (THEME_IS_ACTIVE($entry))) { // Found a valid directory so let's load it's theme.php file - require($theme); + LOAD_INC($INC); // Add found theme to array $THEMES['theme_unix'][] = $entry; diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index c9e95630ec..697481ec2e 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -41,19 +41,19 @@ if (!defined('__SECURITY')) { define('DEBUG_SQL', false); // Non-database functions -require_once(PATH."inc/functions.php"); +LOAD_INC_ONCE("inc/functions.php"); // Filter functions -require_once(PATH."inc/filters.php"); +LOAD_INC_ONCE("inc/filters.php"); // Functions which interact with the database -require_once(PATH."inc/mysql-manager.php"); +LOAD_INC_ONCE("inc/mysql-manager.php"); // Load extensions and language -require_once(PATH."inc/extensions.php"); +LOAD_INC_ONCE("inc/extensions.php"); // Load database library -require_once(PATH."inc/db/lib.php"); +LOAD_INC_ONCE("inc/db/lib.php"); // Error handler function function __errorHandler ($errno, $errstr, $errfile, $errline) { @@ -166,21 +166,21 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT $_CONFIG = merge_array($_CONFIG, LOAD_CONFIG()); // Load "databases" aka static arrays - require_once(PATH."inc/databases.php"); + LOAD_INC_ONCE("inc/databases.php"); // Loading patching system is required here... - require_once(PATH."inc/patch-system.php"); // Initialize patch system + LOAD_INC_ONCE("inc/patch-system.php"); // Initialize patch system // Session management - require_once(PATH."inc/session.php"); + LOAD_INC_ONCE("inc/session.php"); // Run daily reset - require_once(PATH."inc/check-reset.php"); + LOAD_INC_ONCE("inc/check-reset.php"); // Load admin include file if he is admin if (IS_ADMIN()) { // Administrative functions - require_once(PATH."inc/modules/admin/admin-inc.php"); + LOAD_INC_ONCE("inc/modules/admin/admin-inc.php"); } // END - if //* DEBUG: */ ADD_POINTS_REFSYSTEM("test", 36, 1000); //* DEBUG: */ die(); @@ -216,7 +216,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT } // END - if // Update sending pool - if (($CSS != "1") && ($CSS != "-1")) require_once(PATH."inc/pool-update.php"); // Sends out mails in configureable steps + if (($CSS != "1") && ($CSS != "-1")) LOAD_INC_ONCE("inc/pool-update.php"); // Sends out mails in configureable steps // Load all active extension including language files when not upgrading. // Check module for testing and count one click @@ -241,14 +241,14 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT } } else { // Add language system - require_once(PATH."inc/language.php"); + LOAD_INC_ONCE("inc/language.php"); // Wrong database? addFatalMessage(getMessage('WRONG_DB_SELECTED')); } } else { // Add language system - require_once(PATH."inc/language.php"); + LOAD_INC_ONCE("inc/language.php"); // No link to database! addFatalMessage(getMessage('NO_DB_LINK')); @@ -256,7 +256,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT } } else { // Add language system - require_once(PATH."inc/language.php"); + LOAD_INC_ONCE("inc/language.php"); // Maybe you forgot to enter your MySQL data? addFatalMessage(getMessage('MYSQL_DATA_MISSING')); @@ -271,8 +271,8 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT $link = false; // No database link by default // Include required files - require_once(PATH."inc/databases.php"); - require_once(PATH."inc/session.php"); + LOAD_INC_ONCE("inc/databases.php"); + LOAD_INC_ONCE("inc/session.php"); // Check if we are in installation routine if ((basename($_SERVER['PHP_SELF']) != "install.php") && ($CSS != "1") && ($CSS != -1)) { @@ -297,9 +297,9 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT if ((getTotalFatalErrors() > 0) && (isBooleanConstantAndTrue('mxchange_installed')) && (!defined('mxchange_installing')) && ($CSS != "1")) { // One or more fatal error(s) occur during connect... - require_once(PATH."inc/header.php"); - require_once(PATH."inc/fatal_errors.php"); - require_once(PATH."inc/footer.php"); + LOAD_INC_ONCE("inc/header.php"); + LOAD_INC_ONCE("inc/fatal_errors.php"); + LOAD_INC_ONCE("inc/footer.php"); } // END - if // diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 9e82899320..7afa45ddfe 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -155,7 +155,7 @@ function CHECK_MODULE ($mod) { // Still no luck or not found? if (($ret == "cache_miss") || (!$found)) { // ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name --- - if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", PATH, $extension, $mod)))) { + if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) { // Data is missing so we add it if (GET_EXT_VERSION("sql_patches") >= "0.3.6") { // Since 0.3.6 we have a has_menu column, this took me a half hour @@ -369,9 +369,8 @@ function ADD_MENU ($MODE, $act, $wht) { // Full file name for checking menu //* DEBUG: */ echo __LINE__.":!!!!".$sub_what."!!!
\n"; - $test_inc = sprintf("%sinc/modules/%s/what-%s.php", PATH, $MODE, $sub_what); - $test = (FILE_READABLE($test_inc)); - if ($test) { + $FQFN = sprintf("%sinc/modules/%s/what-%s.php", constant('PATH'), $MODE, $sub_what); + if (FILE_READABLE($FQFN)) { if ((!empty($wht)) && (($wht == $sub_what))) { $content = ""; } @@ -385,7 +384,7 @@ function ADD_MENU ($MODE, $act, $wht) { // Menu title $content .= getConfig('menu_blur_spacer') . $sub_title; - if ($test) { + if (FILE_READABLE($FQFN)) { $content .= ""; } else { $content .= ""; @@ -411,14 +410,14 @@ function ADD_MENU ($MODE, $act, $wht) { } else { // This is a menu block... ;-) $BLOCK_MODE = true; - $INC_BLOCK = sprintf("%sinc/modules/%s/action-%s.php", PATH, $MODE, $main_action); + $INC_BLOCK = sprintf("inc/modules/%s/action-%s.php", $MODE, $main_action); if (FILE_READABLE($INC_BLOCK)) { // Load include file if ((!EXT_IS_ACTIVE($main_action)) || ($main_action == "online")) OUTPUT_HTML("
"); //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*
\n"; - include ($INC_BLOCK); + LOAD_INC($INC_BLOCK); //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*
\n"; if ((!EXT_IS_ACTIVE($main_action)) || ($main_action == "online")) OUTPUT_HTML("
+ + + + + + + + + + +
+
{!HEADER_MYSQL_ERRORS!}
+
 
+ {!TEXT_MYSQL_ERRORS!} +
+
    +{!__FATAL_ERROR_LI!} +
+{!__MYSQL_DATA!} + + + + +
+ diff --git a/view.php b/view.php index a22e83582c..034483213f 100644 --- a/view.php +++ b/view.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "view"; $CSS = -1; // Load the required file(s) -require("inc/config.php"); +require_once("inc/config.php"); if (((!empty($_GET['user'])) || (!empty($_GET['reseller']))) && (!empty($_GET['banner']))) { // Count banner view... we currently don't need the user's id but maybe -- 2.30.2