]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
Fixes for running SQL queries
[mailer.git] / inc / mysql-manager.php
index 21e7f49846b3b240985bed1b866363b1b1f12663..7a4e9833adb57d38c63fa226e44989630bb21d61 100644 (file)
@@ -105,7 +105,7 @@ function CHECK_MODULE ($mod) {
 
        // Check if cache is latest version
        $locked = "Y"; $hidden = "N"; $admin = "N"; $mem = "N"; $found = false;
-       if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (is_array($cacheArray['modules']['module']))) {
+       if (GET_EXT_VERSION("cache") >= "0.1.2") {
                // Is the module cached?
                if (isset($cacheArray['modules']['locked'][$mod_chk])) {
                        // Check cache
@@ -132,25 +132,28 @@ function CHECK_MODULE ($mod) {
                }
        }
 
-       // Check returned values against current access permissions
-       //
-       //  Admin access            ----- Guest access -----           --- Guest   or   member? ---
-       if ((IS_ADMIN()) || (($locked == "N") && ($admin == "N") && (($mem == "N") || (IS_MEMBER())))) {
-               // If you are admin you are welcome for everything!
-               $ret = "done";
-       } elseif ($locked == "Y") {
-               // Module is locked
-               $ret = "locked";
-       } elseif (($mem == "Y") && (!IS_MEMBER())) {
-               // You have to login first!
-               $ret = "mem_only";
-       } elseif (($admin == "Y") && (!IS_ADMIN())) {
-               // Only the Admin is allowed to enter this module!
-               $ret = "admin_only";
-       }
+       // Is the module found?
+       if ($found) {
+               // Check returned values against current access permissions
+               //
+               //  Admin access            ----- Guest access -----           --- Guest   or   member? ---
+               if ((IS_ADMIN()) || (($locked == "N") && ($admin == "N") && (($mem == "N") || (IS_MEMBER())))) {
+                       // If you are admin you are welcome for everything!
+                       $ret = "done";
+               } elseif ($locked == "Y") {
+                       // Module is locked
+                       $ret = "locked";
+               } elseif (($mem == "Y") && (!IS_MEMBER())) {
+                       // You have to login first!
+                       $ret = "mem_only";
+               } elseif (($admin == "Y") && (!IS_ADMIN())) {
+                       // Only the Admin is allowed to enter this module!
+                       $ret = "admin_only";
+               }
+       } // END - if
 
        // Still no luck or not found?
-       if (($ret == "major") || ($ret == "cache_miss") || (!$found)) {
+       if (($ret == "cache_miss") || (!$found)) {
                //              ----- Legacy module -----                                   ---- Module in base folder  ----                       --- Module with extension's name ---
                if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", PATH, $extension, $mod)))) {
                        // Data is missing so we add it
@@ -182,7 +185,17 @@ function CHECK_MODULE ($mod) {
                        // Module not found we don't add it to the database
                        $ret = "404";
                }
-       } // END - if
+       } elseif (!$found) {
+               // Problem with module detected
+               DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Problem in module %s detected. ret=%s, locked=%s, hidden=%s, mem=%s, admin=%s",
+                       $mod,
+                       $ret,
+                       $locked,
+                       $hidden,
+                       $mem,
+                       $admin
+               ));
+       }
 
        // Return the value
        return $ret;
@@ -1177,7 +1190,7 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
                        // No entry updated?
                        if (SQL_AFFECTEDROWS() < 1) {
                                // First ref in this level! :-)
-                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid,ref_depth,%s) VALUES (%s,%s,%s)",
+                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid,ref_depth,%s) VALUES (%s,'%s',%s)",
                                        array($data, bigintval($uid), bigintval($GLOBALS['ref_level']), $ref_points), __FILE__, __LINE__);
                                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},uid={$uid},depth={$GLOBALS['ref_level']},mode={$add_mode} - INSERTED! (".SQL_AFFECTEDROWS().")<br />\n";
                        } // END - if