Possible fix for #125, applied fixes from profi-concept's branch
[mailer.git] / inc / mysql-manager.php
index 6d8037fa6c91dbe0f2044aab981c70ae9607401e..84c5fd08fc1c74fe8b5656de27f63356d148cace 100644 (file)
@@ -128,7 +128,7 @@ function checkModulePermissions ($mod) {
        } // END - if
 
        // Major error in module registry is the default
-       $ret = "major";
+       $ret = 'major';
 
        // Check if script is installed if not return a 'done' to prevent some errors
        if ((!isInstalled()) || (isInstalling()) || (!isAdminRegistered())) {
@@ -147,8 +147,8 @@ function checkModulePermissions ($mod) {
        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.");
+                       // This happens when a new extension is registered while ext-cache is installed
+                       $ret = 'cache_miss';
                } // END - if
 
                // Is the module cached?
@@ -164,7 +164,7 @@ function checkModulePermissions ($mod) {
                        $found = true;
                } else {
                        // No, then we have to update it!
-                       $ret = "cache_miss";
+                       $ret = 'cache_miss';
                }
        } elseif (!EXT_IS_ACTIVE('cache')) {
                // Check for module in database
@@ -188,13 +188,13 @@ function checkModulePermissions ($mod) {
                        $ret = 'done';
                } elseif ($locked == 'Y') {
                        // Module is locked
-                       $ret = "locked";
+                       $ret = 'locked';
                } elseif (($mem == 'Y') && (!IS_MEMBER())) {
                        // You have to login first!
-                       $ret = "mem_only";
+                       $ret = 'mem_only';
                } elseif (($admin == 'Y') && (!IS_ADMIN())) {
                        // Only the Admin is allowed to enter this module!
-                       $ret = "admin_only";
+                       $ret = 'admin_only';
                } else {
                        // @TODO Nothing helped???
                        DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("ret=%s,locked=%s,admin=%s,mem=%s",
@@ -207,7 +207,7 @@ function checkModulePermissions ($mod) {
        } // END - if
 
        // Still no luck or not found?
-       if (($ret == "cache_miss") || (!$found)) {
+       if (($ret == 'cache_miss') || (!$found)) {
                //              ----- Legacy module -----                                               ---- Module in base folder  ----                       --- Module with extension's name ---
                if ((isFileReadable(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) {
                        // Data is missing so we add it
@@ -227,11 +227,11 @@ function checkModulePermissions ($mod) {
                        // Everthing is fine?
                        if (SQL_AFFECTEDROWS() < 1) {
                                // Something bad happend!
-                               return "major";
+                               return 'major';
                        } // END - if
 
                        // Destroy cache here
-                       rebuildCacheFiles("modreg", "modreg");
+                       rebuildCacheFiles('modreg', 'modreg');
 
                        // And reload data
                        $ret = checkModulePermissions($mod_chk);
@@ -266,7 +266,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
        $AND = '';
 
        // First we have to do some analysis...
-       if (substr($file, 0, 7) == "action-") {
+       if (substr($file, 0, 7) == 'action-') {
                // This is an action file!
                $type = 'action';
                $search = substr($file, 7);
@@ -282,7 +282,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
                                break;
                }
                $AND = " AND (`what`='' OR `what` IS NULL)";
-       } elseif (substr($file, 0, 5) == "what-") {
+       } elseif (substr($file, 0, 5) == 'what-') {
                // This is an admin what file!
                $type = 'what';
                $search = substr($file, 5);