]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
moved into
[mailer.git] / inc / mysql-manager.php
index 781acb611c96eb8582371e38506db7ea1d4bb088..d25ae4c41425990ee99c1889570b07c66e4ecb8c 100644 (file)
@@ -114,6 +114,12 @@ function checkModulePermissions ($mod) {
 
        // Check if cache is latest version
        if (GET_EXT_VERSION("cache") >= "0.1.2") {
+               // Is the cache there?
+               if (!isset($GLOBALS['cache_array']['modules'])) {
+                       // This should normally not happen...
+                       debug_report_bug("Cache 'modules' is gone.");
+               } // END - if
+
                // Is the module cached?
                if (isset($GLOBALS['cache_array']['modules']['locked'][$mod_chk])) {
                        // Check cache
@@ -369,7 +375,7 @@ function ADD_MENU ($MODE, $act, $wht) {
                while (list($main_title, $main_action) = SQL_FETCHROW($result_main)) {
                        //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
                        // Init variables
-                       $BLOCK_MODE = false; $act = $main_action;
+                       $GLOBALS['block_mode'] = false; $act = $main_action;
 
                        // Prepare content
                        $content = array(
@@ -431,7 +437,7 @@ function ADD_MENU ($MODE, $act, $wht) {
                                }
                        } else {
                                // This is a menu block... ;-)
-                               $BLOCK_MODE = true;
+                               $GLOBALS['block_mode'] = true;
                                $INC_BLOCK = sprintf("inc/modules/%s/action-%s.php", $MODE, $main_action);
                                if (FILE_READABLE($INC_BLOCK)) {
                                        // Load include file
@@ -2085,7 +2091,7 @@ ORDER BY ur.refid ASC",
 }
 
 // Recuced the amount of received emails for the receipients for given email
-function REDUCT_RECIPIENT_RECEIVED_MAILS ($column, $id, $count) {
+function REDUCED_RECIPIENT_RECEIVED_MAILS ($column, $id, $count) {
        // Search for mail in database
        $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `%s`=%s ORDER BY `userid` ASC LIMIT %s",
                array($column, bigintval($id), $count), __FUNCTION__, __LINE__);
@@ -2112,11 +2118,21 @@ function INIT_SQLS () {
        SET_SQLS(array());
 }
 
+// Checks wether the sqls array is initialized
+function IS_SQLS_INITIALIZED () {
+       return ((isset($GLOBALS['sqls'])) && (is_array($GLOBALS['sqls'])));
+}
+
 // Setter for SQLs array
 function SET_SQLS ($SQLs) {
        $GLOBALS['sqls'] = (array) $SQLs;
 }
 
+// Remover for SQLs array
+function UNSET_SQLS () {
+       unset($GLOBALS['sqls']);
+}
+
 // Getter for SQLs array
 function GET_SQLS () {
        return $GLOBALS['sqls'];
@@ -2124,6 +2140,7 @@ function GET_SQLS () {
 
 // Add an SQL to the list
 function ADD_SQL ($sql) {
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("sql=%s, count=%d", $sql, COUNT_SQLS()));
        $GLOBALS['sqls'][] = (string) $sql;
 }
 
@@ -2138,9 +2155,10 @@ function COUNT_SQLS () {
        $count = false;
 
        // Is the array there?
-       if (isset($GLOBALS['sqls'])) {
+       if (IS_SQLS_INITIALIZED()) {
                // Then count it
-               $count = count($GLOBALS['sql']);
+               $count = count($GLOBALS['sqls']);
+               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("count=%d", $count));
        } // END - if
 
        // Return it
@@ -2150,10 +2168,8 @@ function COUNT_SQLS () {
 // Checks wether the SQLs array is filled
 function IS_SQLS_VALID () {
        return (
-               (isset($GLOBALS['sqls'])) &&
-               (is_array($GLOBALS['sqls'])) &&
-               (COUNT_SQL() > 0) &&
-               (!empty($GLOBALS['sqls']))
+               (IS_SQLS_INITIALIZED()) &&
+               (COUNT_SQLS() > 0)
        );
 }