From 4f089d36fcc801992932f3a1f47ab139b573a38d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 30 Jun 2010 22:28:22 +0000 Subject: [PATCH] Rewrites/fixes in extension registration --- DOCS/TODOs.txt | 6 +- inc/extensions-functions.php | 73 ++++++++-------- inc/extensions/ext-active.php | 2 +- inc/extensions/ext-admins.php | 8 +- inc/extensions/ext-bonus.php | 2 +- inc/extensions/ext-booking.php | 4 +- inc/extensions/ext-cache.php | 18 ++-- inc/extensions/ext-mediadata.php | 4 +- inc/extensions/ext-online.php | 2 +- inc/extensions/ext-other.php | 2 +- inc/extensions/ext-politician-stop.php | 2 +- inc/extensions/ext-rallye.php | 2 +- inc/extensions/ext-register.php | 2 +- inc/extensions/ext-removeip.php | 2 +- inc/extensions/ext-sql_patches.php | 2 +- inc/extensions/ext-theme.php | 4 +- inc/extensions/ext-timezone.php | 2 +- inc/extensions/ext-uberwach.php | 2 +- inc/filter-functions.php | 10 +-- inc/filters.php | 2 +- inc/gen_mediadata.php | 2 +- inc/gen_refback.php | 2 +- inc/libs/online_functions.php | 25 +++--- inc/modules/admin/what-extensions.php | 95 +++++++++++---------- inc/template-functions.php | 2 +- templates/de/html/admin/admin_next_link.tpl | 1 - 26 files changed, 141 insertions(+), 137 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 8776ad3ec8..e5559cdabf 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -39,8 +39,8 @@ ./inc/extensions/ext-yoomedia.php:123: // @TODO Can this be moved into a database table? ./inc/extensions/ext-yoomedia.php:56:// @TODO Only deprecated when 'ext-network' is ready! setExtensionDeprecated('Y'); ./inc/extensions-functions.php:143: // @TODO Do we still need this? setExtensionUpdateNotes(''); -./inc/extensions-functions.php:425:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) -./inc/extensions-functions.php:541: // @TODO Extension is loaded, what next? +./inc/extensions-functions.php:424:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) +./inc/extensions-functions.php:540: // @TODO Extension is loaded, what next? ./inc/functions.php:115: // @TODO Extension 'msg' does not exist ./inc/functions.php:1482: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? ./inc/functions.php:1505: // @TODO Rewrite this old lost code to a template @@ -116,7 +116,7 @@ ./inc/modules/admin/what-del_email.php:61: // @TODO Unused: cat_id, payment_id ./inc/modules/admin/what-edit_user.php:20: * @TODO Add support for ext-country * ./inc/modules/admin/what-email_stats.php:48:// @TODO Unused at the moment -./inc/modules/admin/what-extensions.php:354: // @TODO Rewrite this to a filter +./inc/modules/admin/what-extensions.php:357: // @TODO Rewrite this to a filter ./inc/modules/admin/what-guest_add.php:137: // @TODO This can be somehow rewritten to a function ./inc/modules/admin/what-guest_add.php:69: // @TODO Cant this be rewritten? ./inc/modules/admin/what-guest_add.php:85: // @TODO This can be somehow rewritten to a function diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index f1df6010e5..109b30f1d2 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -116,7 +116,7 @@ function loadExtension ($ext_name, $ext_mode = 'init', $ext_ver = '', $dry_run = if (isExtensionFunctionFileReadable($ext_name)) { // Not yet loaded? if ((($GLOBALS['cache_array']['extension']['ext_func'][$ext_name] == 'Y') || (!isset($GLOBALS['cache_array']['extension']['ext_func'][$ext_name]))) && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name]))) { - // Construct FQFN for functions file + // Construct IFN for functions file $funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name); // Mark it as loaded @@ -284,8 +284,7 @@ function registerExtension ($ext_name, $taskId, $dry_run = false, $logout = true // Reset extension name setCurrentExtensionName($ext_name); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); - //* DEBUG: */ debugOutput(getCurrentExtensionName().':
' . print_r($test, true) . '
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',test=' . intval($test)); } // END - if } elseif ($ext_ver != getCurrentExtensionVersion()) { // Ok, update this extension now @@ -325,11 +324,9 @@ function registerExtension ($ext_name, $taskId, $dry_run = false, $logout = true setExtensionMode('register'); // Remains true if extension registration reports no failures - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); - //* DEBUG: */ debugOutput(getCurrentExtensionName().':
' . print_r($test, true) . '
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',test=' . intval($test)); $test = (($test === true) && (getExtensionReportsFailure() === false)); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); - //* DEBUG: */ debugOutput(getCurrentExtensionName().':
' . print_r($test, true) . '
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',test=' . intval($test)); // Does everthing before wents ok? if ($test === true) { @@ -366,6 +363,9 @@ function registerExtension ($ext_name, $taskId, $dry_run = false, $logout = true ), __FUNCTION__, __LINE__); } + // Use the insert id as extension id and cache it for early usage + $GLOBALS['cache_array']['extension']['ext_id'][getCurrentExtensionName()] = SQL_INSERTID(); + // Remove cache file(s) if extension is active runFilterChain('post_extension_installed', array( 'pool' => 'extension', @@ -375,7 +375,7 @@ function registerExtension ($ext_name, $taskId, $dry_run = false, $logout = true // Re-init queries and notes initExtensionSqls(true); - initExtensionNotes(); + initExtensionNotes(true); // Mark it as installed $GLOBALS['ext_is_installed'][getCurrentExtensionName()] = true; @@ -416,8 +416,7 @@ function registerExtension ($ext_name, $taskId, $dry_run = false, $logout = true } // END - if // Return status code - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ' - EXIT!'); - //* DEBUG: */ debugOutput(getCurrentExtensionName().':
'.print_r($ret, true).'
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ',test=' . intval($test) . ' - EXIT!'); return $ret; } @@ -446,14 +445,14 @@ function doExtensionSqls ($ext_id, $load_mode) { $sqlRan = false; // Load extension in detected mode - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ":ext_name[{$ext_id}]=".getCurrentExtensionName().""); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name[' . $ext_id . ']=' . getCurrentExtensionName()); loadExtension(getCurrentExtensionName(), $load_mode, '', false); // Init these SQLs initSqls(); setSqlsArray(getExtensionSqls()); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ":SQLs::count=".countSqls().""); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SQLs::count=' . countSqls()); if (isSqlsValid()) { // Run SQL commands... runFilterChain('run_sqls'); @@ -469,10 +468,10 @@ function doExtensionSqls ($ext_id, $load_mode) { } // END - if // Is this the sql_patches? - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": id=".$ext_id.",currName=".getCurrentExtensionName().",loadMode=".$load_mode); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'id=' . $ext_id . ',currName=' . getCurrentExtensionName() . ',loadMode=' . $load_mode); if ((getCurrentExtensionName() == 'sql_patches') && (($load_mode == 'register') || ($load_mode == 'remove'))) { // Then redirect to logout - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": LOAD!"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ': LOAD!'); redirectToUrl('modules.php?module=admin&logout=1&' . $load_mode . '=sql_patches'); } // END - if } @@ -532,7 +531,7 @@ function isExtensionActive ($ext_name) { // Check cache if (isset($GLOBALS['cache_array']['extension']['ext_active'][$ext_name])) { // Load from cache - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "CACHE! ext_name={$ext_name}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHE! ext_name=' . $ext_name); $data['ext_active'] = $GLOBALS['cache_array']['extension']['ext_active'][$ext_name]; // Count cache hits @@ -541,7 +540,7 @@ function isExtensionActive ($ext_name) { // @TODO Extension is loaded, what next? debug_report_bug(__FUNCTION__, __LINE__, 'LOADED:' . $ext_name); } elseif (($ext_name == 'cache') || (!isExtensionInstalled('cache'))) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "DB! ext_name={$ext_name}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'DB! ext_name=' . $ext_name); // Load from database $result = SQL_QUERY_ESC("SELECT `ext_active` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); @@ -556,16 +555,16 @@ function isExtensionActive ($ext_name) { SQL_FREERESULT($result); // Write cache array - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "ext_name=".$ext_name."[DB]: ".$data['ext_active'].""); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . '[DB]: ' . $data['ext_active']); $GLOBALS['cache_array']['extension']['ext_active'][$ext_name] = $data['ext_active']; } else { // Extension not active! - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "ext_name=".$ext_name.": Not active!"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ': Not active!'); $GLOBALS['cache_array']['extension']['ext_active'][$ext_name] = 'N'; } // Debug message - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "ext_name=".$ext_name.",active=".$data['ext_active'].""); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',active=' . $data['ext_active']); // Is this extension activated? (For admins we always have active extensions...) return ($data['ext_active'] == 'Y'); @@ -584,7 +583,7 @@ function getExtensionVersion ($ext_name, $force = false) { // Extensions are all inactive during installation if (isInstallationPhase()) return ''; - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": ext_name=".$ext_name.""); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name); // Is the cache written? if (isset($GLOBALS['cache_array']['extension']['ext_version'][$ext_name])) { @@ -623,7 +622,7 @@ function getExtensionVersion ($ext_name, $force = false) { } // END - if // Return result - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": ret={$data['ext_version']}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_version=' . $data['ext_version']); return $data['ext_version']; } @@ -1231,7 +1230,7 @@ function addExtensionUpdateDependency ($updateDepends) { } // END - if // Is it not yet added? - /* DEBUG: + /* Only for debugging! if ((isset($updateDepends, $GLOBALS['ext_running_updates'][getCurrentExtensionName()])) && (in_array($updateDepends, getExtensionUpdatesRunning()))) { // Double-adding isn't fine, too debug_report_bug(__FUNCTION__, __LINE__, '() called twice: updateDepends=' . $updateDepends . ',currentExtension=' . getCurrentExtensionName()); @@ -1417,7 +1416,7 @@ function getExtensionVersionHistory () { // Setter for EXT_UPDATE_NOTES function setExtensionUpdateNotes ($updateNotes, $ext_ver = '') { // . '/' . getCurrentExtensionVersion() - //* DEBUG: */ debug_report_bug(__FUNCTION__.':' . getCurrentExtensionName() . '/' . getExtensionMode() . '/' . $ext_ver . '=' . $updateNotes); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getCurrentExtensionName()=' . getCurrentExtensionName() . ',getExtensionMode()=' . getExtensionMode() . ',ext_ver=' . $ext_ver . ',updateNotes()=' . strlen($updateNotes)); if (empty($ext_ver)) { $GLOBALS['ext_update_notes'][getCurrentExtensionName()][getCurrentExtensionVersion()] = (string) $updateNotes; } else { @@ -1436,9 +1435,9 @@ function isExtensionUpdateNoteSet ($ext_ver) { } // Init extension notice -function initExtensionNotes () { +function initExtensionNotes ($force = false) { // Is it already initialized? - if (isset($GLOBALS['ext_notes'][getCurrentExtensionName()])) { + if (($force === false) && (isset($GLOBALS['ext_notes'][getCurrentExtensionName()]))) { // This is mostly not wanted, so please report it debug_report_bug(__FUNCTION__, __LINE__, 'ext_notes already set for extension ' . getCurrentExtensionName()); } // END - if @@ -1477,7 +1476,7 @@ function getCurrentExtensionName () { // Init SQLs array for current extension function initExtensionSqls ($force = false) { // Auto-init the array or if forced - if ((!isset($GLOBALS['ext_sqls'][getCurrentExtensionName()])) || ($force === true)) { + if (($force === true) || (!isset($GLOBALS['ext_sqls'][getCurrentExtensionName()]))) { // Set the array $GLOBALS['ext_sqls'][getCurrentExtensionName()] = array(); @@ -1567,19 +1566,19 @@ function redirectOnUninstalledExtension ($ext_name) { // Filter for initialization of all extensions by loading them in 'init' mode function FILTER_INIT_EXTENSIONS () { // Do we have some entries? - //* DEBUG */ print __FUNCTION__.': ENTRY!
'; + //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY!'); if (isset($GLOBALS['cache_array']['extension']['ext_name'])) { // Load all found extensions if found - //* DEBUG */ print __FUNCTION__.': CACHE - START!
'; + //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHE - START!'); foreach ($GLOBALS['cache_array']['extension']['ext_name'] as $key => $ext_name) { // Load it - //* DEBUG */ print __FUNCTION__.': '.$ext_name.' - START
'; + //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name='.$ext_name.' - START'); loadExtension($ext_name, 'init', getExtensionVersion($ext_name)); - //* DEBUG */ print __FUNCTION__.': '.$ext_name.' - END
'; + //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name='.$ext_name.' - END'); } // END - foreach - //* DEBUG */ print __FUNCTION__.': CACHE - END!
'; + //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHE - END!'); } // END - if - //* DEBUG */ print __FUNCTION__.': EXIT!
'; + //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'EXIT!'); } // Setter for extension mode @@ -1594,7 +1593,7 @@ function getExtensionMode () { // Setter for dry-run function enableExtensionDryRun ($dry_run = true) { - //* DEBUG: */ debugOutput(__FUNCTION__.': '.getCurrentExtensionName().'='.intval($dry_run)); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getCurrentExtensionName()='.getCurrentExtensionName().',dry='.intval($dry_run)); $GLOBALS['ext_dry_run'] = (bool) $dry_run; } @@ -1736,24 +1735,30 @@ function isExtensionIncludeReadable ($ext_name = '') { // Checks if an extension's function file is readable function isExtensionFunctionFileReadable ($ext_name) { + // Is cache there? + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name); if (isset($GLOBALS['cache_array']['extension']['ext_func'][$ext_name])) { // Just count cache hits + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_func=' . $GLOBALS['cache_array']['extension']['ext_func'][$ext_name] .' - CACHE!'); incrementStatsEntry('cache_hits'); } else { - // Construct FQFN for functions file + // Construct IFN for functions file $funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name); // Is this include there? if ((isFileReadable($funcsInclude)) && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name])) && (getExtensionMode() == 'test')) { // Cache it! + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_func=Y - FOUND!'); $GLOBALS['cache_array']['extension']['ext_func'][$ext_name] = 'Y'; } else { // Cache it! + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_func=N - NOT FOUND!'); $GLOBALS['cache_array']['extension']['ext_func'][$ext_name] = 'N'; } } // Return result + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_func=' . $GLOBALS['cache_array']['extension']['ext_func'][$ext_name]); return ($GLOBALS['cache_array']['extension']['ext_func'][$ext_name] == 'Y'); } diff --git a/inc/extensions/ext-active.php b/inc/extensions/ext-active.php index 96638bc102..e35212c606 100644 --- a/inc/extensions/ext-active.php +++ b/inc/extensions/ext-active.php @@ -60,7 +60,7 @@ switch (getExtensionMode()) { addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_active'"); // Unregister filter - unregisterFilter('online_extra_links', 'ADD_LINK_ACTIVE_LIST', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'online_extra_links', 'ADD_LINK_ACTIVE_LIST', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-admins.php b/inc/extensions/ext-admins.php index fbf54e3c9d..93f877642b 100644 --- a/inc/extensions/ext-admins.php +++ b/inc/extensions/ext-admins.php @@ -67,10 +67,10 @@ switch (getExtensionMode()) { addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admins` DROP `default_acl`"); // Remove filters - unregisterFilter('sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', true, isExtensionDryRun()); - unregisterFilter('do_admin_login_done', 'RESET_ADMINS_LOGIN_FAILURES', true, isExtensionDryRun()); - unregisterFilter('do_admin_login_pass', 'COUNT_ADMINS_LOGIN_FAILURE', true, isExtensionDryRun()); - unregisterFilter('do_admin_login_done', 'REHASH_ADMINS_PASSWORD', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'do_admin_login_done', 'RESET_ADMINS_LOGIN_FAILURES', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'do_admin_login_pass', 'COUNT_ADMINS_LOGIN_FAILURE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'do_admin_login_done', 'REHASH_ADMINS_PASSWORD', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index f9d1b1241d..b7d4bda9d0 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -90,7 +90,7 @@ PRIMARY KEY (`id`) addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bonus_turbo`'); // Unregister filter - unregisterFilter('member_login_check', 'ADD_LOGIN_BONUS', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'member_login_check', 'ADD_LOGIN_BONUS', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-booking.php b/inc/extensions/ext-booking.php index 510a416033..a6a8995fd9 100644 --- a/inc/extensions/ext-booking.php +++ b/inc/extensions/ext-booking.php @@ -87,8 +87,8 @@ PRIMARY KEY (`id`) addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='booking'"); // Remove the filters - unregisterFilter('add_points', 'ADD_BOOKING_RECORD', true, isExtensionDryRun()); - unregisterFilter('sub_points', 'ADD_BOOKING_RECORD', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'add_points', 'ADD_BOOKING_RECORD', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'sub_points', 'ADD_BOOKING_RECORD', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 1028d3e617..4d0497e82d 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -62,15 +62,15 @@ switch (getExtensionMode()) { addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('cache_stats','config_config')"); // Unregister all filters - unregisterFilter('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); - unregisterFilter('extension_remove', 'CACHE_DESTROY_ALL', true, isExtensionDryRun()); - unregisterFilter('shutdown', 'CACHE_DESTROY_FILTER', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'extension_remove', 'CACHE_DESTROY_ALL', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'shutdown', 'CACHE_DESTROY_FILTER', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-mediadata.php b/inc/extensions/ext-mediadata.php index ee56ea3e7b..176ca4a0fd 100644 --- a/inc/extensions/ext-mediadata.php +++ b/inc/extensions/ext-mediadata.php @@ -68,8 +68,8 @@ switch (getExtensionMode()) { addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='mediadata'"); // Remove the filters - unregisterFilter('add_points', 'UPDATE_MEDIADATA_ENTRY', true, isExtensionDryRun()); - unregisterFilter('sub_points', 'UPDATE_MEDIADATA_ENTRY', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'add_points', 'UPDATE_MEDIADATA_ENTRY', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'sub_points', 'UPDATE_MEDIADATA_ENTRY', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-online.php b/inc/extensions/ext-online.php index 08e7edc0c1..3b91b79f3d 100644 --- a/inc/extensions/ext-online.php +++ b/inc/extensions/ext-online.php @@ -79,7 +79,7 @@ INDEX `admin_member` (`is_admin`, `is_member`) addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='online'"); // Unregister filter - unregisterFilter('init', 'UPDATE_ONLINE_LIST', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'init', 'UPDATE_ONLINE_LIST', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-other.php b/inc/extensions/ext-other.php index ac398cfc00..71541b5723 100644 --- a/inc/extensions/ext-other.php +++ b/inc/extensions/ext-other.php @@ -62,7 +62,7 @@ switch (getExtensionMode()) { addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_other'"); // Unregister filter - unregisterFilter('page_footer', 'DISPLAY_DEBUG_SQL', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'page_footer', 'DISPLAY_DEBUG_SQL', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-politician-stop.php b/inc/extensions/ext-politician-stop.php index 1cad577a2d..303fda1764 100644 --- a/inc/extensions/ext-politician-stop.php +++ b/inc/extensions/ext-politician-stop.php @@ -60,7 +60,7 @@ switch (getExtensionMode()) { case 'remove': // Do stuff when removing extension // Unregister filter - unregisterFilter('page_footer', 'DISPLAY_POLITICIAN_STOP_SNIPPET', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'page_footer', 'DISPLAY_POLITICIAN_STOP_SNIPPET', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index 82c7fe91fb..a4997d35b3 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -114,7 +114,7 @@ PRIMARY KEY (id) addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='rallyes'"); // Unregister filter - unregisterFilter('extra_autopurge', 'RALLYE_EXTRA_AUTOPURGE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'extra_autopurge', 'RALLYE_EXTRA_AUTOPURGE', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-register.php b/inc/extensions/ext-register.php index 55c190134a..44f4f99a5e 100644 --- a/inc/extensions/ext-register.php +++ b/inc/extensions/ext-register.php @@ -60,7 +60,7 @@ switch (getExtensionMode()) { addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_must_register`'); // Unregister a filter - unregisterFilter('register_must_fillout', 'REGISTER_MUST_FILLOUT', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'register_must_fillout', 'REGISTER_MUST_FILLOUT', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-removeip.php b/inc/extensions/ext-removeip.php index e25a464d94..1f656ce00c 100644 --- a/inc/extensions/ext-removeip.php +++ b/inc/extensions/ext-removeip.php @@ -69,7 +69,7 @@ switch (getExtensionMode()) addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_removeip' LIMIT 1"); // Remove filters - unregisterFilter('post_youhere_line', 'ADD_ANONYMITY_NOTICE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'post_youhere_line', 'ADD_ANONYMITY_NOTICE', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 872b85df59..7db75716c0 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -93,7 +93,7 @@ switch (getExtensionMode()) { `action`='account'"); // Unregister filter - unregisterFilter('member_login_check', 'RESET_USER_LOGIN_FAILURE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'member_login_check', 'RESET_USER_LOGIN_FAILURE', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-theme.php b/inc/extensions/ext-theme.php index 08c1ee0bbb..88f3a1ce5c 100644 --- a/inc/extensions/ext-theme.php +++ b/inc/extensions/ext-theme.php @@ -67,8 +67,8 @@ switch (getExtensionMode()) { addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='themes' OR `what`='themes'"); // Unregister filters - unregisterFilter('init', 'HANDLE_THEME_CHANGE', true, isExtensionDryRun()); - unregisterFilter('member_login_check', 'SET_USERS_THEME', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'init', 'HANDLE_THEME_CHANGE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'member_login_check', 'SET_USERS_THEME', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-timezone.php b/inc/extensions/ext-timezone.php index 46ec4d9367..c0a0de50d7 100644 --- a/inc/extensions/ext-timezone.php +++ b/inc/extensions/ext-timezone.php @@ -65,7 +65,7 @@ switch (getExtensionMode()) { addExtensionSQL("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_timezone' LIMIT 1"); // Unregister filter - unregisterFilter('init', 'INIT_TIMEZONE', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'init', 'INIT_TIMEZONE', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-uberwach.php b/inc/extensions/ext-uberwach.php index 28e00094f0..ba30a6bc55 100644 --- a/inc/extensions/ext-uberwach.php +++ b/inc/extensions/ext-uberwach.php @@ -58,7 +58,7 @@ switch (getExtensionMode()) { addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_uberwach' LIMIT 1"); // Unregister filter - unregisterFilter('page_footer', 'DISPLAY_UBERWACH_SNIPPET', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'page_footer', 'DISPLAY_UBERWACH_SNIPPET', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/filter-functions.php b/inc/filter-functions.php index 9030f97ad3..316bc6c93a 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -221,8 +221,8 @@ function registerFilter ($filterName, $filterFunction, $silentAbort = true, $for } // "Unregisters" a filter from the given chain -function unregisterFilter ($filterName, $filterFunction, $force = false, $dry_run = false) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',dry=' . intval($dry_run) . ' - ENTERED!'); +function unregisterFilter ($F, $L, $filterName, $filterFunction, $force = false, $dry_run = false) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',dry=' . intval($dry_run) . ' - ENTERED!'); // Extend the filter function name only if not loaded from database if (!isset($GLOBALS['cache_array']['filter']['loaded'][$filterName][$filterFunction])) { @@ -239,11 +239,11 @@ function unregisterFilter ($filterName, $filterFunction, $force = false, $dry_ru // Shall we remove? (default, not while just showing an extension removal) if ($dry_run === false) { // Mark for filter removal - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'REMOVE: filterName=' . $filterName . ',filterFunction=' . $filterFunction); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'REMOVE: F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction); $GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction] = 'R'; } // END - if - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',dry=' . intval($dry_run) . ' - EXIT!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',dry=' . intval($dry_run) . ' - EXIT!'); } // "Runs" the given filters, data is optional and can be any type of data @@ -275,7 +275,7 @@ function runFilterChain ($filterName, $data = null) { // Is this filter there? if (!function_exists($filterFunction)) { // Unregister it - unregisterFilter($filterName, $filterFunction); + unregisterFilter(__FUNCTION__, __LINE__, $filterName, $filterFunction); // Skip this entry continue; diff --git a/inc/filters.php b/inc/filters.php index 2a099fe802..4551d1d80c 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -151,7 +151,7 @@ function FILTER_CALL_HANDLER_LOGIN_FAILTURES ($data) { // Filter for redirecting to logout if sql_patches has been installed function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () { // Remove this filter - unregisterFilter('shutdown', __FUNCTION__); + unregisterFilter(__FUNCTION__, __LINE__, 'shutdown', __FUNCTION__); // Is the element set? if (isset($GLOBALS['ext_load_mode'])) { diff --git a/inc/gen_mediadata.php b/inc/gen_mediadata.php index 0412c5863a..7f4246a508 100644 --- a/inc/gen_mediadata.php +++ b/inc/gen_mediadata.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Init variables $bsent = '0'; $bclicks = '0'; $bcount = '0'; diff --git a/inc/gen_refback.php b/inc/gen_refback.php index 51f01e2622..47d20055ba 100644 --- a/inc/gen_refback.php +++ b/inc/gen_refback.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Make sure our functions are there loadIncludeOnce('inc/libs/refback_functions.php'); diff --git a/inc/libs/online_functions.php b/inc/libs/online_functions.php index 562ff0123e..479976c181 100644 --- a/inc/libs/online_functions.php +++ b/inc/libs/online_functions.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Filter for updates/extends on the online list function FILTER_UPDATE_ONLINE_LIST () { @@ -55,24 +55,21 @@ function FILTER_UPDATE_ONLINE_LIST () { // Initialize variables $userid = '0'; - $MEM = 'N'; - $ADMIN = 'N'; + $isMember = 'N'; + $isAdmin = 'N'; // Valid userid? if ((isMemberIdSet()) && (getMemberId() > 0) && (isMember())) { // Is valid user $userid = getMemberId(); - $MEM = 'Y'; + $isMember = 'Y'; } // END - if if (isAdmin()) { // Is administrator - $ADMIN = 'Y'; + $isAdmin = 'Y'; } // END - if - // Get refid - $rid = determineReferalId(); - // Now search for the user $result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{?_MYSQL_PREFIX?}_online` WHERE `sid`='%s' LIMIT 1", array(session_id()), __FUNCTION__, __LINE__); @@ -100,9 +97,9 @@ LIMIT 1", getAction(), getWhat(), $userid, - $rid, - $MEM, - $ADMIN, + determineReferalId(), + $isMember, + $isAdmin, detectRemoteAddr(), session_id() ), __FUNCTION__, __LINE__); @@ -114,9 +111,9 @@ LIMIT 1", getAction(), getWhat(), $userid, - $rid, - $MEM, - $ADMIN, + determineReferalId(), + $isMember, + $isAdmin, session_id(), detectRemoteAddr() ), __FUNCTION__, __LINE__); diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index c25ef8fe42..aad057e0f9 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -50,24 +50,24 @@ $do = 'overview'; if (isGetRequestParameterSet('reg_ext')) { // We are about to register a new extension - $do = 'register'; $ext_id = bigintval(getRequestParameter('reg_ext')); + $do = 'register'; $taskId = bigintval(getRequestParameter('reg_ext')); // The id comes from task management and it is - of course - *not* the extension's name! } elseif ((isFormSent('change')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // De-/activate extensions - foreach (postRequestParameter('sel') as $ext_id => $active) { + foreach (postRequestParameter('sel') as $taskId => $active) { // Shall we keep the extension always active? - if ((isset($GLOBALS['cache_array']['always_active'][getExtensionName($ext_id)])) && ($GLOBALS['cache_array']['always_active'][getExtensionName($ext_id)] == 'Y') && ($active == 'Y')) { + if ((isset($GLOBALS['cache_array']['always_active'][getExtensionName($taskId)])) && ($GLOBALS['cache_array']['always_active'][getExtensionName($taskId)] == 'Y') && ($active == 'Y')) { // Keep this extension active! - loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_EXTENSION_ALWAYS_ACTIVE', getExtensionName($ext_id))); + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_EXTENSION_ALWAYS_ACTIVE', getExtensionName($taskId))); } else { // De/activate extension $ACT = 'N'; setExtensionMode('deactivate'); if ($active != 'Y') { $ACT = 'Y'; setExtensionMode('activate'); } SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='%s' WHERE `id`=%s AND `ext_active`='%s' LIMIT 1", - array($ACT, bigintval($ext_id), $active), __FILE__, __LINE__); + array($ACT, bigintval($taskId), $active), __FILE__, __LINE__); // Run embeded SQL commands - doExtensionSqls($ext_id, getExtensionMode()); + doExtensionSqls($taskId, getExtensionMode()); } } // END - foreach @@ -78,9 +78,9 @@ if (isGetRequestParameterSet('reg_ext')) { if (isPostRequestParameterSet('modify')) { // Change entries $cache_update = '0'; - foreach (postRequestParameter('sel') as $ext_id => $sel) { + foreach (postRequestParameter('sel') as $taskId => $sel) { // Secure id - $ext_id = bigintval($ext_id); + $taskId = bigintval($taskId); // Change this extension? if ($sel == 1) { @@ -88,17 +88,17 @@ if (isGetRequestParameterSet('reg_ext')) { setExtensionMode('modify'); // Get entry for 'active' - $active = postRequestParameter('active', $ext_id); + $active = postRequestParameter('active', $taskId); // Update extension's record if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) { // Update also CSS column when extensions sql_patches is newer or exact v0.0.6 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_has_css`='%s', `ext_active`='%s' WHERE `id`=%s LIMIT 1", - array(postRequestParameter('css', $ext_id), $active, $ext_id), __FILE__, __LINE__); + array(postRequestParameter('css', $taskId), $active, $taskId), __FILE__, __LINE__); } else { // When extension is older than v0.0.6 there is no column for the CSS information SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='%s' WHERE `id`=%s LIMIT 1", - array($active, $ext_id), __FILE__, __LINE__); + array($active, $taskId), __FILE__, __LINE__); } // Run SQLs on activation / deactivation @@ -108,7 +108,7 @@ if (isGetRequestParameterSet('reg_ext')) { } // END - if // Run embeded SQL commands - doExtensionSqls($ext_id, getExtensionMode()); + doExtensionSqls($taskId, getExtensionMode()); } } @@ -117,7 +117,7 @@ if (isGetRequestParameterSet('reg_ext')) { } else { // Edit selected entries $OUT = ''; - foreach (postRequestParameter('sel') as $ext_id => $sel) { + foreach (postRequestParameter('sel') as $taskId => $sel) { // Edit this extension? if (($sel == 'Y') || ($sel != 'Y')) { // Default is no CSS for non-updated mailers @@ -126,12 +126,12 @@ if (isGetRequestParameterSet('reg_ext')) { // Load required data if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) { $result = SQL_QUERY_ESC("SELECT ext_has_css, ext_active FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `id`=%s LIMIT 1", - array(bigintval($ext_id)), __FILE__, __LINE__); + array(bigintval($taskId)), __FILE__, __LINE__); list($css, $active) = SQL_FETCHROW($result); SQL_FREERESULT($result); } else { $result = SQL_QUERY_ESC("SELECT ext_active FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `id`=%s LIMIT 1", - array(bigintval($ext_id)), __FILE__, __LINE__); + array(bigintval($taskId)), __FILE__, __LINE__); list($active) = SQL_FETCHROW($result); SQL_FREERESULT($result); $css = 'X'; @@ -140,14 +140,14 @@ if (isGetRequestParameterSet('reg_ext')) { // Prepare CSS column $cssSelection = '---'; if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) { - $cssSelection = addSelectionBox('yn', $css, 'css', $ext_id); + $cssSelection = addSelectionBox('yn', $css, 'css', $taskId); } // END - if // Prepare data for the row template $content = array( - 'id' => $ext_id, - 'name' => getExtensionName($ext_id), - 'active' => addSelectionBox('yn', $active, 'active', $ext_id), + 'id' => $taskId, + 'name' => getExtensionName($taskId), + 'active' => addSelectionBox('yn', $active, 'active', $taskId), 'css' => $cssSelection, ); @@ -163,18 +163,18 @@ if (isGetRequestParameterSet('reg_ext')) { } elseif ((isPostRequestParameterSet('delete')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // List extensions and when verbose is enabled SQL statements which will be executed $OUT = ''; - foreach (postRequestParameter('sel') as $ext_id => $sel) { + foreach (postRequestParameter('sel') as $taskId => $sel) { // Init variables $VERBOSE_OUT = ''; initSqls(); // Secure id number - $ext_id = bigintval($ext_id); + $taskId = bigintval($taskId); // Is the id valid? - if (isExtensionIdValid($ext_id)) { + if (isExtensionIdValid($taskId)) { // Get extension name - $ext_name = getExtensionName($ext_id); + $ext_name = getExtensionName($taskId); if (getConfig('verbose_sql') == 'Y') { // Load SQL commands in remove mode @@ -186,7 +186,7 @@ if (isGetRequestParameterSet('reg_ext')) { // Prepare data for the row template $content = array( - 'id' => $ext_id, + 'id' => $taskId, 'ext_name' => $ext_name, 'ext_ver' => getExtensionVersion($ext_name), 'verbose' => $VERBOSE_OUT @@ -197,7 +197,7 @@ if (isGetRequestParameterSet('reg_ext')) { } else { // Prepare data for the row template $content = array( - 'id' => $ext_id + 'id' => $taskId ); // Not valid! @@ -211,14 +211,14 @@ if (isGetRequestParameterSet('reg_ext')) { } elseif ((isFormSent('remove')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // Remove extensions from DB (you have to delete all files manually!) $cache_update = '0'; - foreach (postRequestParameter('sel') as $ext_id => $active) { + foreach (postRequestParameter('sel') as $taskId => $active) { // Secure id number - $ext_id = bigintval($ext_id); + $taskId = bigintval($taskId); // Is this extension selected and id valid? - if (($active == 1) && (isExtensionIdValid($ext_id))) { + if (($active == 1) && (isExtensionIdValid($taskId))) { // Run embeded SQL commands - doExtensionSqls($ext_id, 'remove'); + doExtensionSqls($taskId, 'remove'); } // END - if } // END - foreach @@ -230,6 +230,22 @@ if (isGetRequestParameterSet('reg_ext')) { } elseif (isGetRequestParameterSet('do')) { // Demo mode active! $do = 'demo'; +} elseif (isGetRequestParameterSet('registered')) { + // Extensions changed + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_EXTENSION_REGISTERED', getExtensionName(getRequestParameter('registered')))); + + // Show next link + if (isExtensionActive('task')) { + loadTemplate('admin_next_link', false, array( + 'url' => 'modules.php?module=admin&what=list_task', + 'title' => '{--ADMIN_EXTENSION_REGISTER_NEXT_LINK--}' + )); + } else { + loadTemplate('admin_next_link', false, array( + 'url' => 'modules.php?module=admin', + 'title' => '{--ADMIN_EXTENSION_REGISTER_NEXT_LINK--}' + )); + } } elseif (isGetRequestParameterSet('changed')) { // Extensions changed loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_EXTENSION_CHANGED', bigintval(getRequestParameter('changed')))); @@ -306,10 +322,10 @@ ORDER BY SQL_FREERESULT($result); // Is the id number valid and the task was found? - if (($ext_id > 0) && ($task_found == 1)) { + if (($taskId > 0) && ($task_found == 1)) { // id is valid so begin with registration, we first want to it's real name from task management (subject column) $result = SQL_QUERY_ESC("SELECT `subject` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `id`=%s LIMIT 1", - array(bigintval($ext_id)), __FILE__, __LINE__); + array(bigintval($taskId)), __FILE__, __LINE__); list($subject) = SQL_FETCHROW($result); // Free result @@ -327,24 +343,11 @@ ORDER BY // Is the extension deprecated? if (!isExtensionDeprecated()) { // ... so we can finally register and load it in registration mode - if (registerExtension($ext_name, $ext_id)) { + if (registerExtension($ext_name, $taskId)) { // Errors? if (!ifFatalErrorsDetected()) { // Extension was found and successfully registered - loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_EXTENSION_REGISTERED', $ext_name)); - - // Show next link - if (isExtensionActive('task')) { - loadTemplate('admin_next_link', false, array( - 'url' => 'modules.php?module=admin&what=list_task', - 'title' => '{--ADMIN_EXTENSION_REGISTER_NEXT_LINK--}' - )); - } else { - loadTemplate('admin_next_link', false, array( - 'url' => 'modules.php?module=admin', - 'title' => '{--ADMIN_EXTENSION_REGISTER_NEXT_LINK--}' - )); - } + redirectToUrl('modules.php?module=admin&what=extensions&registered=' . getExtensionId($ext_name)); } else { // Errors detected! loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_EXTENSION_NOT_REGISTERED', $ext_name)); diff --git a/inc/template-functions.php b/inc/template-functions.php index e29ca2856e..fad3dc2df3 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -234,7 +234,7 @@ function doFinalCompilation ($code, $insertComments = true) { $cnt = 0; // Compile all out - while (((strpos($code, '{--') !== false) || (strpos($code, '{DQUOTE}') !== false) || (strpos($code, '{?') !== false) || (strpos($code, '{%') !== false)) && ($cnt < 4)) { + while (((strpos($code, '{--') !== false) || (strpos($code, '{DQUOTE}') !== false) || (strpos($code, '{?') !== false) || (strpos($code, '{%') !== false)) && ($cnt < 5)) { // Init common variables $content = array(); $newContent = ''; diff --git a/templates/de/html/admin/admin_next_link.tpl b/templates/de/html/admin/admin_next_link.tpl index c0a2a67609..58521af6c7 100644 --- a/templates/de/html/admin/admin_next_link.tpl +++ b/templates/de/html/admin/admin_next_link.tpl @@ -1,4 +1,3 @@ -
    -- 2.39.5