]> git.mxchange.org Git - mailer.git/blobdiff - inc/filters.php
'what','action','module' and 'output_mode' wrapped into functions (WARNUNG: Code...
[mailer.git] / inc / filters.php
index 6f213c8b65515f4f14a070bc1b705b62aacf2cca..6d02e30e8409261650cab20ce3669268ccf6b6a2 100644 (file)
@@ -261,7 +261,8 @@ function FILTER_FLUSH_FILTERS () {
        } // END - if
 
        // Nothing is added/remove by default
-       $inserted = 0; $removed = 0;
+       $inserted = 0;
+       $removed = 0;
 
        // Prepare SQL queries
        $insertSQL = "INSERT INTO `{!_MYSQL_PREFIX!}_filters` (`filter_name`,`filter_function`,`filter_active`) VALUES";
@@ -328,8 +329,8 @@ function FILTER_CALL_HANDLER_LOGIN_FAILTURES ($data) {
        $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'))) {
+       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):type={$data['type']},action={getAction()},what={getWhat()},lvl={$data['access_level']}<br />\n";
+       if ((($data['type'] == 'what') || ($data['type'] == 'action') && ((!isWhatSet()) || (getWhat() == 'overview') || (getWhat() == getConfig('index_home')))) && ($data['access_level'] != 'guest') && ((GET_EXT_VERSION('sql_patches') >= '0.4.7') || (GET_EXT_VERSION('admins') >= '0.7.0'))) {
                // Handle failure
                $content['content'] .= HANDLE_LOGIN_FAILTURES($data['access_level']);
        } // END - if
@@ -459,7 +460,7 @@ function FILTER_UPDATE_LOGIN_DATA () {
 
        // Load last module and last online time
        $result = SQL_QUERY_ESC("SELECT last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-       array(getUserId()), __FUNCTION__, __LINE__);
+               array(getUserId()), __FUNCTION__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
@@ -467,23 +468,23 @@ function FILTER_UPDATE_LOGIN_DATA () {
                list($mod, $onl) = SQL_FETCHROW($result);
 
                // Maybe first login time?
-               if (empty($mod)) $mod = "login";
+               if (empty($mod)) $mod = 'login';
 
                // This will be displayed on welcome page! :-)
                if (empty($GLOBALS['last']['module'])) {
                        $GLOBALS['last']['module'] = $mod; $GLOBALS['last']['online'] = $onl;
                } // END - if
 
-               // "what" not set?
-               if (empty($GLOBALS['what'])) {
+               // 'what' not set?
+               if (!isWhatSet()) {
                        // Fix it to default
-                       $GLOBALS['what'] = "welcome";
-                       if (getConfig('index_home') != '') $GLOBALS['what'] = getConfig('index_home');
+                       setWhat('welcome');
+                       if (getConfig('index_home') != '') setWhatFromConfig('index_home');
                } // END - if
 
                // Update last module / online time
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `last_module`='%s', last_online=UNIX_TIMESTAMP(), REMOTE_ADDR='%s' WHERE userid=%s LIMIT 1",
-               array($GLOBALS['what'], detectRemoteAddr(), getUserId()), __FUNCTION__, __LINE__);
+                       array(getWhat(), detectRemoteAddr(), getUserId()), __FUNCTION__, __LINE__);
        }  else {
                // Destroy session, we cannot update!
                destroyUserSession();
@@ -501,14 +502,14 @@ function FILTER_CHECK_ADMIN_ACL () {
        // Ok, Cookie-Update done
        if ((GET_EXT_VERSION('admins') >= '0.3.0') && (EXT_IS_ACTIVE('admins'))) {
                // Check if action GET variable was set
-               $action = SQL_ESCAPE($GLOBALS['action']);
-               if (!empty($GLOBALS['what'])) {
+               $action = getAction();
+               if (isWhatSet()) {
                        // Get action value by what-value
-                       $action = getModeAction('admin', $GLOBALS['what']);
+                       $action = getModeAction('admin', getWhat());
                } // END - if
 
                // Check for access control line of current menu entry
-               $ret = adminsCheckAdminAcl($action, $GLOBALS['what']);
+               $ret = adminsCheckAdminAcl($action, getWhat());
        } // END - if
 
        // Return result