Even more fixes, loading session was on wrong page (needs db link up)
[mailer.git] / inc / filters.php
index f48e19967b735678f8e08346cbe1dd5f8d1a810d..fea4d142fd393beb224031759ad8b34a2e00ab65 100644 (file)
@@ -69,7 +69,7 @@ function INIT_FILTER_SYSTEM () {
                // Load all active filers
                $result = SQL_QUERY("SELECT `filter_name`, `filter_function`, `filter_active`".$ADD."
 FROM `{!_MYSQL_PREFIX!}_filters`
-ORDER BY `filter_id` ASC", __FILE__, __LINE__);
+ORDER BY `filter_id` ASC", __FUNCTION__, __LINE__);
 
                // Are there entries?
                if (SQL_NUMROWS($result) > 0) {
@@ -406,23 +406,35 @@ function FILTER_LOAD_INCLUDES ($data) {
 
 // Filter for running SQL commands
 function FILTER_RUN_SQLS ($data) {
+       // Debug message
+       //* 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
+               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Found ".COUNT_SQLS()." queries to run.");
                foreach (GET_SQLS() as $sql) {
+                       // Trim spaces away
                        $sql = trim($sql);
+
+                       // Is there still a query left?
                        if (!empty($sql)) {
                                // Do we have an "ALTER TABLE" command?
                                if (substr(strtolower($sql), 0, 11) == "alter table") {
                                        // Analyse the alteration command
-                                       SQL_ALTER_TABLE($sql, __FILE__, __LINE__);
+                                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Alterting table: {$sql}");
+                                       SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__);
                                } else {
                                        // Run regular SQL command
-                                       $result = SQL_QUERY($sql, __FILE__, __LINE__, false);
+                                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Running regular query: {$sql}");
+                                       $result = SQL_QUERY($sql, __FUNCTION__, __LINE__, false);
                                }
                        } // END - if
                } // END - foreach
        } // END - if
+
+       // Debug message
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Left!");
 }
 
 // Filter for updating/validating login data
@@ -438,7 +450,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($GLOBALS['userid']), __FILE__, __LINE__);
+               array($GLOBALS['userid']), __FUNCTION__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
@@ -462,7 +474,7 @@ function FILTER_UPDATE_LOGIN_DATA () {
 
                // 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'], GET_REMOTE_ADDR(), $GLOBALS['userid']), __FILE__, __LINE__);
+                       array($GLOBALS['what'], GET_REMOTE_ADDR(), $GLOBALS['userid']), __FUNCTION__, __LINE__);
        }  else {
                // Destroy session, we cannot update!
                destroy_user_session();