./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
./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
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
// Reset extension name
setCurrentExtensionName($ext_name);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
- //* DEBUG: */ debugOutput(getCurrentExtensionName().':<pre>' . print_r($test, true) . '</pre>');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',test=' . intval($test));
} // END - if
} elseif ($ext_ver != getCurrentExtensionVersion()) {
// Ok, update this extension now
setExtensionMode('register');
// Remains true if extension registration reports no failures
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
- //* DEBUG: */ debugOutput(getCurrentExtensionName().':<pre>' . print_r($test, true) . '</pre>');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',test=' . intval($test));
$test = (($test === true) && (getExtensionReportsFailure() === false));
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
- //* DEBUG: */ debugOutput(getCurrentExtensionName().':<pre>' . print_r($test, true) . '</pre>');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',test=' . intval($test));
// Does everthing before wents ok?
if ($test === 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',
// Re-init queries and notes
initExtensionSqls(true);
- initExtensionNotes();
+ initExtensionNotes(true);
// Mark it as installed
$GLOBALS['ext_is_installed'][getCurrentExtensionName()] = true;
} // END - if
// Return status code
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ' - EXIT!');
- //* DEBUG: */ debugOutput(getCurrentExtensionName().':<pre>'.print_r($ret, true).'</pre>');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_name=' . $ext_name . ',test=' . intval($test) . ' - EXIT!');
return $ret;
}
$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');
} // 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
}
// 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
// @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__);
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');
// 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])) {
} // 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'];
}
} // 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());
// 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 {
}
// 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
// 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();
// 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!<br />';
+ //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY!');
if (isset($GLOBALS['cache_array']['extension']['ext_name'])) {
// Load all found extensions if found
- //* DEBUG */ print __FUNCTION__.': CACHE - START!<br />';
+ //* 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<br />';
+ //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name='.$ext_name.' - START');
loadExtension($ext_name, 'init', getExtensionVersion($ext_name));
- //* DEBUG */ print __FUNCTION__.': '.$ext_name.' - END<br />';
+ //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name='.$ext_name.' - END');
} // END - foreach
- //* DEBUG */ print __FUNCTION__.': CACHE - END!<br />';
+ //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHE - END!');
} // END - if
- //* DEBUG */ print __FUNCTION__.': EXIT!<br />';
+ //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'EXIT!');
}
// Setter for extension mode
// 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;
}
// 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');
}
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
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
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
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
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
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
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
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
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
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
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
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
`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
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
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
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
}
// "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])) {
// 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
// Is this filter there?
if (!function_exists($filterFunction)) {
// Unregister it
- unregisterFilter($filterName, $filterFunction);
+ unregisterFilter(__FUNCTION__, __LINE__, $filterName, $filterFunction);
// Skip this entry
continue;
// 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'])) {
// Some security stuff...
if (!defined('__SECURITY')) {
die();
-}
+} // END - if
// Init variables
$bsent = '0'; $bclicks = '0'; $bcount = '0';
// Some security stuff...
if (!defined('__SECURITY')) {
die();
-}
+} // END - if
// Make sure our functions are there
loadIncludeOnce('inc/libs/refback_functions.php');
// Some security stuff...
if (!defined('__SECURITY')) {
die();
-}
+} // END - if
// Filter for updates/extends on the online list
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__);
getAction(),
getWhat(),
$userid,
- $rid,
- $MEM,
- $ADMIN,
+ determineReferalId(),
+ $isMember,
+ $isAdmin,
detectRemoteAddr(),
session_id()
), __FUNCTION__, __LINE__);
getAction(),
getWhat(),
$userid,
- $rid,
- $MEM,
- $ADMIN,
+ determineReferalId(),
+ $isMember,
+ $isAdmin,
session_id(),
detectRemoteAddr()
), __FUNCTION__, __LINE__);
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
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) {
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
} // END - if
// Run embeded SQL commands
- doExtensionSqls($ext_id, getExtensionMode());
+ doExtensionSqls($taskId, getExtensionMode());
}
}
} 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
// 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';
// 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,
);
} 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
// 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
} else {
// Prepare data for the row template
$content = array(
- 'id' => $ext_id
+ 'id' => $taskId
);
// Not valid!
} 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
} 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'))));
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
// 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));
$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 = '';
-<br />
<div align="center">
<div class="admin_table dashed" style="width:400px;margin-bottom:5px">
<ul style="padding:0px;margin:0px">