X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions.php;h=149750d9d9d1b8c7d9efd1c5ba59851bf6b08570;hb=27e833b22e7e95bd4f54eedd981d8f857555a1f7;hp=22f218150d7cfc16d48aa0c5c416eb67d3827d7a;hpb=89fe43216a2b6cc95a8ef15dbe3fda435daae6f8;p=mailer.git
diff --git a/inc/extensions.php b/inc/extensions.php
index 22f218150d..149750d9d9 100644
--- a/inc/extensions.php
+++ b/inc/extensions.php
@@ -68,7 +68,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = '', $EXT_VER = '', $dry_run
// Construct include filename and FQFN for extension file
$INC = sprintf("inc/extensions/ext-%s.php", $ext_name);
- $FQFN = constant('PATH') . $INC;
+ $FQFN = getConfig('PATH') . $INC;
// Is the extension file NOT there?
if (!isIncludeReadable($INC)) {
@@ -79,21 +79,8 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = '', $EXT_VER = '', $dry_run
return false;
} // END - if
- // Construct FQFN for language file
- $langInclude = sprintf("inc/language/%s_%s.php", $ext_name, getLanguage());
-
- // Is this include there?
- if ((isFileReadable($langInclude)) && (!isset($GLOBALS['ext_loaded']['lang'][$ext_name]))) {
- // Then load it
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Language loaded.");
- $GLOBALS['ext_loaded']['lang'][$ext_name] = true;
- loadIncludeOnce($langInclude);
- } elseif ((isDebugModeEnabled()) && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme')) {
- // No language file is not so good...
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("WARNING: Extension %s has no language file or we cannot read from it. lang=%s",
- $ext_name, getLanguage()
- ));
- }
+ // Load extension's own language file
+ loadLanguageFile($ext_name);
// Construct FQFN for functions file
$funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name);
@@ -106,7 +93,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = '', $EXT_VER = '', $dry_run
loadIncludeOnce($funcsInclude);
} elseif ((isDebugModeEnabled()) && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme')) {
// No functions file is not so good...
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("WARNING: Extension %s has no own functions file or we cannot read from it.",
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("NOTICE: Extension %s has no own functions file or we cannot read from it.",
$ext_name
));
} // END - if
@@ -148,7 +135,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
// Set current extension name
EXT_SET_CURR_NAME($ext_name);
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME()." - ENTERED!
\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME()." - ENTERED!
");
// This shall never do a non-admin user or if the extension is active (already installed)
if ((!IS_ADMIN()) || (EXT_IS_ACTIVE($ext_name))) {
return false;
@@ -157,7 +144,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
// When this extension is already in install/update phase, all is fine
if (EXT_IS_REGISTER_RUNNING($ext_name)) {
// Then abort here which is fine
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME()." - ALREADY!
\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME()." - ALREADY!
");
return true;
} // END - if
@@ -236,12 +223,12 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
// Entry found?
if ($task > 0) {
// Try to register the extension
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().":ext_update=".$ext_update.",taskId=".$task."
\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().":ext_update=".$ext_update.",taskId=".$task."
");
$test = REGISTER_EXTENSION($ext_update, $task, $dry_run, false);
// Reset extension name
EXT_SET_CURR_NAME($ext_name);
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($test);
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'); var_dump($test);
} // END - if
} elseif ($ext_ver != EXT_GET_VERSION()) {
// Ok, update this extension now
@@ -273,9 +260,9 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
$EXT_LOAD_MODE = 'register';
// Remains true if extension registration reports no failures
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($test);
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'); var_dump($test);
$test = (($test === true) && (EXT_GET_REPORTS_FAILURE() === false));
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($test);
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'); var_dump($test);
// Does everthing before wents ok?
if ($test === true) {
@@ -290,7 +277,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
runFilterChain('pre_extension_installed', array('dry_run' => $dry_run));
// Register extension
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:insert=".EXT_GET_CURR_NAME().'/'.EXT_GET_VERSION()." - INSERT!
\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:insert=".EXT_GET_CURR_NAME().'/'.EXT_GET_VERSION()." - INSERT!
");
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_extensions` (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')",
array(EXT_GET_CURR_NAME(), EXT_GET_ALWAYS_ACTIVE(), EXT_GET_VERSION()), __FUNCTION__, __LINE__);
@@ -328,7 +315,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
$ret = false;
}
} elseif (($task_id > 0) && (EXT_GET_CURR_NAME() != '')) {
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME()."
\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME()."
");
// Remove task from system when id and extension's name is valid
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `id`=%s AND `status`='NEW' LIMIT 1",
array(bigintval($task_id)), __FUNCTION__, __LINE__);
@@ -349,7 +336,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
} // END - if
// Return status code
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME()." - LEFT!
\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME()." - LEFT!
");
//* DEBUG: */ var_dump($ret);
return $ret;
}
@@ -549,7 +536,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
// And load SQL queries in order of version history
for ($idx = ($start + 1); $idx < count($history); $idx++) {
// Set current extension name
- //* DEBUG: */ print __FUNCTION__.'['.__LINE__.':] ext_name='.$ext_name."
\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__.'['.__LINE__.':] ext_name='.$ext_name."
");
EXT_SET_CURR_NAME($ext_name);
// Set extension version
@@ -606,8 +593,8 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
CREATE_EXTENSION_UPDATE_TASK(getCurrentAdminId(), EXT_GET_CURR_NAME(), $GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], SQL_ESCAPE(EXT_GET_NOTES(EXT_GET_NOTES())));
// Update extension's version
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_version='%s' WHERE `ext_name`='%s' LIMIT 1",
- array($GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], EXT_GET_CURR_NAME()), __FUNCTION__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET `ext_version`='%s' WHERE `ext_name`='%s' LIMIT 1",
+ array($GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], EXT_GET_CURR_NAME()), __FUNCTION__, __LINE__);
// Remove arrays
UNSET_SQLS();
@@ -799,7 +786,7 @@ function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) {
// Template file
$tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
- constant('PATH'),
+ getConfig('PATH'),
getLanguage(),
$ext
);
@@ -875,7 +862,7 @@ function MODULE_HAS_MENU ($mod, $forceDb = false) {
}
// Return status
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($ret);
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($ret));
return $ret;
}