]> git.mxchange.org Git - mailer.git/blobdiff - inc/filters.php
Huge rewrite:
[mailer.git] / inc / filters.php
index cf7d0dd08f60827da9cd6a93714444524fde4d9e..a0988c9539578bc6251ec4bf6600827225cf2dcc 100644 (file)
@@ -447,12 +447,12 @@ function FILTER_LOAD_INCLUDES () {
 // Filter for running SQL commands
 function FILTER_RUN_SQLS ($data) {
        // Debug message
 // Filter for running SQL commands
 function FILTER_RUN_SQLS ($data) {
        // Debug message
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Entered!");
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "- Entered!");
 
        // Is the array there?
        if ((IS_SQLS_VALID()) && ((!isset($data['dry_run'])) || ($data['dry_run'] == false))) {
                // Run SQL commands
 
        // Is the array there?
        if ((IS_SQLS_VALID()) && ((!isset($data['dry_run'])) || ($data['dry_run'] == false))) {
                // Run SQL commands
-               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Found ".COUNT_SQLS()." queries to run.");
+               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "- Found ".COUNT_SQLS()." queries to run.");
                foreach (GET_SQLS() as $sql) {
                        // Trim spaces away
                        $sql = trim($sql);
                foreach (GET_SQLS() as $sql) {
                        // Trim spaces away
                        $sql = trim($sql);
@@ -474,7 +474,7 @@ function FILTER_RUN_SQLS ($data) {
        } // END - if
 
        // Debug message
        } // END - if
 
        // Debug message
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Left!");
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "- Left!");
 }
 
 // Filter for updating/validating login data
 }
 
 // Filter for updating/validating login data
@@ -489,20 +489,20 @@ function FILTER_UPDATE_LOGIN_DATA () {
        setUserId(getSession('userid'));
 
        // Load last module and last online time
        setUserId(getSession('userid'));
 
        // 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",
+       $result = SQL_QUERY_ESC("SELECT `last_module`, `last_online` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
                array(getUserId()), __FUNCTION__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
                // Load last module and online time
                array(getUserId()), __FUNCTION__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
                // Load last module and online time
-               list($mod, $onl) = SQL_FETCHROW($result);
+               $DATA = SQL_FETCHARRAY($result);
 
                // Maybe first login time?
 
                // Maybe first login time?
-               if (empty($mod)) $mod = 'login';
+               if (empty($DATA['last_module'])) $DATA['last_module'] = 'login';
 
                // This will be displayed on welcome page! :-)
                if (empty($GLOBALS['last']['module'])) {
 
                // This will be displayed on welcome page! :-)
                if (empty($GLOBALS['last']['module'])) {
-                       $GLOBALS['last']['module'] = $mod; $GLOBALS['last']['online'] = $onl;
+                       $GLOBALS['last']['module'] = $DATA['last_module']; $GLOBALS['last']['online'] = $DATA['last_online'];
                } // END - if
 
                // 'what' not set?
                } // END - if
 
                // 'what' not set?
@@ -513,8 +513,12 @@ function FILTER_UPDATE_LOGIN_DATA () {
                } // END - if
 
                // Update last module / online time
                } // 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(getWhat(), detectRemoteAddr(), getUserId()), __FUNCTION__, __LINE__);
+               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(
+                               getWhat(),
+                               detectRemoteAddr(),
+                               getUserId()
+                       ), __FUNCTION__, __LINE__);
        }  else {
                // Destroy session, we cannot update!
                destroyUserSession();
        }  else {
                // Destroy session, we cannot update!
                destroyUserSession();