+ $SQLs[] = $removeSQL;
+ } // END - if
+
+ // Shall we update usage counters (ONLY FOR DEBUGGING!)
+ if (getConfig('update_filter_usage') == "Y") {
+ // Update all counters
+ foreach ($counter as $filterName => $filterArray) {
+ // Walk through all filters
+ foreach ($filterArray as $filterFunction => $cnt) {
+ // Construct and add the query
+ $SQLs[] = sprintf("UPDATE `"._MYSQL_PREFIX."_filters` SET `filter_counter`=%s WHERE `filter_name`='%s' AND `filter_function`='%s' LIMIT 1",
+ bigintval($cnt),
+ $filterName,
+ $filterFunction
+ );
+ } // END - foreach
+ } // END - foreach
+ } // END - if
+
+ // Run the run_sqls filter in non-dry mode
+ RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs));
+}
+
+// Filter for calling the handler for login failtures
+function FILTER_CALL_HANDLER_LOGIN_FAILTURES ($data) {
+ // Init content
+ $content = $data;
+
+ // Handle failed logins here if not in guest
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):type={$data['type']},action={$GLOBALS['action']},what={$GLOBALS['what']},lvl={$data['access_level']}<br />\n";
+ if ((($data['type'] == "what") || ($data['type'] == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || ($GLOBALS['what'] == getConfig('index_home')))) && ($data['access_level'] != "guest") && ((GET_EXT_VERSION("sql_patches") >= "0.4.7") || (GET_EXT_VERSION("admins") >= "0.7.0"))) {
+ // Handle failture
+ $content['content'] .= HANDLE_LOGIN_FAILTURES($data['access_level']);
+ } // END - if
+
+ // Return the content
+ return $content;
+}
+
+// Filter for redirecting to logout if sql_patches has been installed
+function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () {
+ // Remove this filter
+ UNREGISTER_FILTER('shutdown', __FUNCTION__);
+
+ // Is the element set?
+ if (isset($GLOBALS['ext_load_mode'])) {
+ // Redirect here
+ LOAD_URL("modules.php?module=admin&logout=1&".$GLOBALS['ext_load_mode']."=sql_patches");
+ } // END - if
+
+ // This should not happen!
+ DEBUG_LOG(__FUNCTION__, __LINE__, "Cannot auto-logout because no extension load-mode has been set.");
+}
+
+// Filter for auto-activation of a extension
+function FILTER_AUTO_ACTIVATE_EXTENSION ($data) {
+ global $EXT_ALWAYS_ACTIVE;
+
+ // Is this extension always activated?
+ if ($EXT_ALWAYS_ACTIVE == "Y") {
+ // Then activate the extension
+ //* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ext_name={$data['ext_name']}<br />\n";
+ ACTIVATE_EXTENSION($data['ext_name']);
+ } // END - if
+
+ // Return the data
+ return $data;
+}
+
+// Filter for solving task given task
+function FILTER_SOLVE_TASK ($data) {
+ // Don't solve anything if no admin!
+ if (!IS_ADMIN()) return $data;
+
+ // Is this a direct task id or array element task_id is found?
+ if (is_int($data)) {
+ // Then solve it...
+ ADMIN_SOLVE_TASK($data);
+ } elseif ((is_array($data)) && (isset($data['task_id']))) {
+ // Solve it...
+ ADMIN_SOLVE_TASK($data['task_id']);
+ }
+
+ // Return the data
+ return $data;
+}
+
+// Filter to load include files
+function FILTER_LOAD_INCLUDES ($data) {
+ global $CSS;
+
+ // Default is $data as inclusion list
+ $INC_POOL = $data;
+
+ // Is it an array?
+ if ((!isset($data)) || (!is_array($data))) {
+ // Then abort here
+ DEBUG_LOG(__FILE__, __LINE__, "INC_POOL is no array!");
+ return $data;
+ } elseif (isset($data['inc_pool'])) {
+ // Use this as new inclusion pool!
+ $INC_POOL = $data['inc_pool'];
+ }
+
+ // Check for added include files
+ if (count($INC_POOL) > 0) {
+ // Loads every include file
+ foreach ($INC_POOL as $FQFN) {
+ require_once($FQFN);
+ } // END - foreach
+
+ // Reset array
+ if (isset($data['inc_pool'])) $data['inc_pool'] = array();