Huge patchset (I don't recall all details):
[mailer.git] / inc / filters.php
index fd55e5785abbc2c10312add003fcb4cde87837d5..6626a7655b5a20731033120be57140290861fc5c 100644 (file)
@@ -137,10 +137,10 @@ function FILTER_CALL_HANDLER_LOGIN_FAILTURES ($data) {
        $content = $data;
 
        // Handle failed logins here if not in guest
-       //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):type={$data['type']},action={getAction()},what={getWhat()},level={$data['access_level']}<br />");
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "type=".$data['type'].",action=".getAction().",what=".getWhat().",level=".$data['access_level']."<br />");
        if ((($data['type'] == 'what') || ($data['type'] == 'action') && ((!isWhatSet()) || (getWhat() == 'overview') || (getWhat() == getConfig('index_home')))) && ($data['access_level'] != 'guest') && ((isExtensionInstalledAndNewer('sql_patches', '0.4.7')) || (isExtensionInstalledAndNewer('admins', '0.7.0')))) {
                // Handle failure
-               $content['content'] .= handleLoginFailtures($data['access_level']);
+               $content['content'] .= handleLoginFailures($data['access_level']);
        } // END - if
 
        // Return the content
@@ -167,7 +167,7 @@ function FILTER_AUTO_ACTIVATE_EXTENSION ($data) {
        // Is this extension always activated?
        if (getExtensionAlwaysActive() == 'Y') {
                // Then activate the extension
-               //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>): ext_name={$data['ext_name']}<br />");
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "ext_name={$data['ext_name']}<br />");
                doActivateExtension($data['ext_name']);
        } // END - if
 
@@ -564,7 +564,7 @@ function FILTER_REMOVE_EXTENSION () {
        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
                array(getCurrentExtensionName()), __FUNCTION__, __LINE__);
 
-       // Remove the extension from global cache array as well
+       // Remove the extension from cache array as well
        removeExtensionFromArray();
 
        // Remove the cache
@@ -920,9 +920,24 @@ LIMIT 1",
 
                // Store it in session
                setSession('mxchange_member_failures' , getUserData('login_failures'));
-               setSession('mxchange_member_last_fail', getUserData('last_failure'));
+               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(generateHash($data['pass_hash'], '', false)))
+       ) && (
+               setSession('admin_login', $data['login'])
+       ) && (
+               setSession('admin_last', time())
+       ));
+
+       // Return the data for further processing
+       return $data;
+}
+
 // [EOF]
 ?>