+// Filter for flushing template cache
+function FILTER_FLUSH_TEMPLATE_CACHE () {
+ // Do not flush when debugging the template cache
+ if (isDebuggingTemplateCache()) return;
+
+ // Do we have cached eval() data?
+ if ((isset($GLOBALS['template_eval'])) && (count($GLOBALS['template_eval']) > 0)) {
+ // Now flush all
+ foreach ($GLOBALS['template_eval'] as $template => $eval) {
+ // Flush the cache (if not yet found)
+ flushTemplateCache($template, $eval);
+ } // END - if
+ } // END - if
+}
+
+// Filter for loading user data
+function FILTER_FETCH_USER_DATA ($userid = 0) {
+ // Is the userid not set? Then use member id
+ if (($userid == '0') || (is_null($userid))) $userid = getMemberId();
+
+ // Get user data
+ if (!fetchUserData($userid)) {
+ // Userid is not valid
+ debug_report_bug('User id '.$userid . ' is invalid.');
+ } // END - if
+
+ // Set member id
+ setMemberId($userid);
+}
+
+// Filter for reseting users' last login failure, only available with latest ext-sql_patches
+function FILTER_RESET_USER_LOGIN_FAILURE () {
+ // Is the user data valid?
+ if (!isMember()) {
+ // Do only run for logged in members
+ debug_report_bug('Please only run this filter for logged in users.');
+ } // END - if
+
+ // Remmeber login failures if available
+ if (isExtensionInstalledAndNewer('sql_patches', '0.6.1')) {
+ // Reset login failures
+ SQL_QUERY_ESC("UPDATE
+ `{?_MYSQL_PREFIX?}_user_data`
+SET
+ `login_failures`=0,
+ `last_failure`='0000-00-00 00:00:00'
+WHERE
+ `userid`=%s
+LIMIT 1",
+ array(getMemberId()), __FILE__, __LINE__);
+
+ // Store it in session
+ setSession('mxchange_member_failures' , getUserData('login_failures'));
+ setSession('mxchange_member_last_failure', getUserData('last_failure'));
+ } // END - if
+}
+
+// Try to login the admin by setting some session/cookie variables
+function FILTER_DO_LOGIN_ADMIN ($data) {
+ // Now set all session variables and store the result for later processing
+ $GLOBALS['admin_login_success'] = ((
+ setSession('admin_md5', encodeHashForCookie($data['pass_hash']))
+ ) && (
+ setSession('admin_login', $data['login'])
+ ) && (
+ setSession('admin_last', time())
+ ));
+
+ // Return the data for further processing
+ return $data;
+}
+