diff --git a/src/admin/admin_header.php b/src/admin/admin_header.php index 58cf354..4412997 100644 --- a/src/admin/admin_header.php +++ b/src/admin/admin_header.php @@ -24,10 +24,12 @@ */ include "../../../include/cp_header.php"; +include_once ICMS_ROOT_PATH."/modules/".icms::$module->getVar("dirname")."/include/bootstrap.php"; include_once ICMS_ROOT_PATH."/modules/".icms::$module->getVar("dirname")."/include/vars.php"; -include_once ICMS_ROOT_PATH."/modules/".icms::$module->getVar("dirname")."/class/art/functions.php"; -include_once ICMS_ROOT_PATH."/modules/".icms::$module->getVar("dirname")."/class/art/functions.admin.php"; - +if (!iforum_load_art_functions('admin')) { + trigger_error('Unable to initialize the iForum Art admin runtime.', E_USER_WARNING); + return; +} // include the default language file for the admin interface if (!@include_once(ICMS_ROOT_PATH."/modules/".icms::$module->getVar("dirname")."/language/" . $icmsConfig['language'] . "/main.php")) diff --git a/src/header.php b/src/header.php index b031931..9b5e9b4 100644 --- a/src/header.php +++ b/src/header.php @@ -24,9 +24,9 @@ */ include_once '../../mainfile.php'; +include_once ICMS_ROOT_PATH."/modules/".icms::$module->getVar("dirname")."/include/bootstrap.php"; include_once ICMS_ROOT_PATH."/modules/".icms::$module->getVar("dirname")."/include/vars.php"; include_once ICMS_ROOT_PATH."/modules/".icms::$module->getVar("dirname")."/include/functions.php"; -include_once ICMS_ROOT_PATH."/modules/".icms::$module->getVar("dirname")."/class/art/functions.php"; $myts = icms_core_Textsanitizer::getInstance(); diff --git a/src/icms_version.php b/src/icms_version.php index f311013..b2e1de1 100644 --- a/src/icms_version.php +++ b/src/icms_version.php @@ -52,7 +52,7 @@ $modversion['submit_feature'] = "https://www.impresscms.org/modules/iforum/"; $modversion['submit_bug'] = "https://www.impresscms.org/modules/iforum/"; -include_once(ICMS_ROOT_PATH."/modules/".$modulename."/class/art/functions.ini.php"); +include_once(ICMS_ROOT_PATH."/modules/".$modulename."/include/bootstrap.php"); include_once(ICMS_ROOT_PATH."/modules/".$modulename."/include/functions.php"); // Is performing module install/update? $isModuleAction = icms_moduleAction($modversion['dirname']); diff --git a/src/include/bootstrap.php b/src/include/bootstrap.php index 0adf5bc..afe9ded 100644 --- a/src/include/bootstrap.php +++ b/src/include/bootstrap.php @@ -66,3 +66,47 @@ function &iforum_get_handler($handlerName) return $handler; } + +function iforum_load_art_functions_ini() +{ + if (defined('FRAMEWORKS_ART_FUNCTIONS_INI')) { + return true; + } + + include_once iforum_get_module_path('class/art/functions.ini.php'); + + return defined('FRAMEWORKS_ART_FUNCTIONS_INI'); +} + +function iforum_load_art_functions($group = '') +{ + if (!iforum_load_art_functions_ini()) { + return false; + } + + $constant = 'FRAMEWORKS_ART_FUNCTIONS'; + if ($group !== '') { + $constant .= '_' . strtoupper($group); + } + + if ($group === '') { + include_once iforum_get_module_path('class/art/functions.php'); + } else { + if (!function_exists('load_functions')) { + return false; + } + + load_functions($group); + } + + return defined($constant); +} + +function iforum_load_art_object() +{ + if (!iforum_load_art_functions_ini() || !function_exists('load_object')) { + return false; + } + + return load_object(); +} diff --git a/src/include/functions.ini.php b/src/include/functions.ini.php index 6c792bf..bdf0354 100644 --- a/src/include/functions.ini.php +++ b/src/include/functions.ini.php @@ -27,15 +27,18 @@ { exit(); } + +include_once dirname(__DIR__).'/include/bootstrap.php'; if (defined("IFORUM_FUNCTIONS_INI")) return; - define("IFORUM_FUNCTIONS_INI", 1); - -include_once(ICMS_ROOT_PATH."/modules/".basename(dirname(__FILE__, 2))."/class/art/functions.php"); - +define("IFORUM_FUNCTIONS_INI", 1); + +/** +* @deprecated since 2.4.0, use iforum_load_art_object() instead; kept for compatibility and planned for removal in 3.0.0. +*/ function iforum_load_object() { - return load_object(); + return iforum_load_art_object(); } function iforum_message($message ) diff --git a/src/include/functions.php b/src/include/functions.php index 14bb6b7..54d7c98 100644 --- a/src/include/functions.php +++ b/src/include/functions.php @@ -27,6 +27,10 @@ define("IFORUM_FUNCTIONS", true); include_once dirname(__FILE__)."/functions.ini.php"; +if (!iforum_load_art_functions()) { + trigger_error('Unable to initialize the iForum Art runtime.', E_USER_WARNING); + return; +} if (!defined("_GLOBAL_LEFT")) { define('_GLOBAL_LEFT', ((defined('_ADM_USE_RTL') && _ADM_USE_RTL )?"right":"left"));