]> git.mxchange.org Git - mailer.git/blobdiff - inc/filters.php
Template improved, old lost code removed, some fixes
[mailer.git] / inc / filters.php
index fd55e5785abbc2c10312add003fcb4cde87837d5..627a4007b89bc12e39c14db67edfe2de6421aae4 100644 (file)
@@ -127,7 +127,7 @@ function FILTER_FLUSH_FILTERS () {
        // Should we rebuild cache?
        if (($inserted > 0) || ($removed > 0)) {
                // Destroy cache
-               rebuildCacheFile('filter', 'filter');
+               rebuildCache('filter', 'filter');
        } // END - if
 }
 
@@ -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
 
@@ -475,11 +475,12 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
                        if (function_exists($commandFunction)) {
                                // Prepare $matches, $key, $outputMode, etc.
                                $data = array(
-                                       'matches'  => $matches,
-                                       'key'      => $key,
-                                       'mode'     => $outputMode,
-                                       'code'     => $code,
-                                       'callback' => $callback
+                                       'matches'    => $matches,
+                                       'key'        => $key,
+                                       'mode'       => $outputMode,
+                                       'code'       => $code,
+                                       'callback'   => $callback,
+                                       'extra_func' => $extraFunction
                                );
 
                                // Call it
@@ -564,11 +565,11 @@ 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
-       rebuildCacheFile('extension', 'extension');
+       rebuildCache('extension', 'extension');
 }
 
 // Filter for flushing the output
@@ -703,14 +704,6 @@ function FILTER_LOAD_RUNTIME_INCLUDES () {
                // Load the include
                loadIncludeOnce($inc);
        } // END - foreach
-
-       // Load admin include file if he is admin
-       if (isAdmin()) {
-               // Administrative functions
-               loadIncludeOnce('inc/modules/admin/admin-inc.php');
-       } // END - if
-       //* DEBUG: */ addPointsThroughReferalSystem('test', 36, 1000);
-       //* DEBUG: */ die();
 }
 
 // Filter for checking admin ACL
@@ -920,9 +913,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($data['pass_hash']))
+       ) && (
+               setSession('admin_login', $data['login'])
+       ) && (
+               setSession('admin_last', time())
+       ));
+
+       // Return the data for further processing
+       return $data;
+}
+
 // [EOF]
 ?>