]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
Several rewrites/renames, fixes for installation. Resolves #104
[mailer.git] / inc / mysql-manager.php
index 3a85acbd8176483252f528cddf46f48715c74e21..781acb611c96eb8582371e38506db7ea1d4bb088 100644 (file)
@@ -70,7 +70,7 @@ function ADD_MODULE_TITLE ($mod) {
                $name = sprintf("%s (%s)", getMessage('LANG_UNKNOWN_MODULE'), $mod);
                if (SQL_NUMROWS($result) == 0) {
                        // Add module to database
                $name = sprintf("%s (%s)", getMessage('LANG_UNKNOWN_MODULE'), $mod);
                if (SQL_NUMROWS($result) == 0) {
                        // Add module to database
-                       $dummy = CHECK_MODULE($mod);
+                       $dummy = checkModulePermissions($mod);
                } // END - if
        } // END - if
 
                } // END - if
        } // END - if
 
@@ -79,7 +79,7 @@ function ADD_MODULE_TITLE ($mod) {
 }
 
 // Check validity of a given module name (no file extension)
 }
 
 // Check validity of a given module name (no file extension)
-function CHECK_MODULE ($mod) {
+function checkModulePermissions ($mod) {
        // Filter module name (names with low chars and underlines are fine!)
        $mod = preg_replace("/[^a-z_]/", "", $mod);
 
        // Filter module name (names with low chars and underlines are fine!)
        $mod = preg_replace("/[^a-z_]/", "", $mod);
 
@@ -194,10 +194,10 @@ function CHECK_MODULE ($mod) {
                        } // END - if
 
                        // Destroy cache here
                        } // END - if
 
                        // Destroy cache here
-                       REBUILD_CACHE("mod_reg", "modreg");
+                       rebuildCacheFiles("modreg", "modreg");
 
                        // And reload data
 
                        // And reload data
-                       $ret = CHECK_MODULE($mod_chk);
+                       $ret = checkModulePermissions($mod_chk);
                } else {
                        // Module not found we don't add it to the database
                        $ret = "404";
                } else {
                        // Module not found we don't add it to the database
                        $ret = "404";
@@ -322,7 +322,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
                                $GLOBALS['nav_depth'] = "0";
 
                                // Run the filter chain
                                $GLOBALS['nav_depth'] = "0";
 
                                // Run the filter chain
-                               $ret = RUN_FILTER('post_youhere_line', array('access_level' => $ACC_LVL, 'type' => $type, 'content' => ""));
+                               $ret = runFilterChain('post_youhere_line', array('access_level' => $ACC_LVL, 'type' => $type, 'content' => ""));
                                $OUT .= $ret['content'];
                        } // END - if
                }
                                $OUT .= $ret['content'];
                        } // END - if
                }
@@ -862,7 +862,7 @@ function SEND_MODE_MAILS($mod, $modes) {
 }
 
 // Update module counter
 }
 
 // Update module counter
-function COUNT_MODULE($mod) {
+function countModuleHit($mod) {
        if ($mod != "css") {
                // Do count all other modules but not accesses on CSS file css.php!
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET clicks=clicks+1 WHERE module='%s' LIMIT 1",
        if ($mod != "css") {
                // Do count all other modules but not accesses on CSS file css.php!
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET clicks=clicks+1 WHERE module='%s' LIMIT 1",
@@ -1283,7 +1283,7 @@ function UPDATE_REF_COUNTER ($uid) {
        } elseif ((($ref == $uid) || ($ref == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2")) {
                // Remove cache here
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />\n";
        } elseif ((($ref == $uid) || ($ref == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2")) {
                // Remove cache here
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />\n";
-               REBUILD_CACHE("refsystem", "refsystem");
+               rebuildCacheFiles("refsystem", "refsystem");
        }
 
        // "Walk" back here
        }
 
        // "Walk" back here
@@ -1520,10 +1520,11 @@ function activateExchange() {
                ));
 
                // Run SQLs
                ));
 
                // Run SQLs
-               RUN_FILTER('run_sqls', array('dry_run' => false));
+               runFilterChain('run_sqls');
 
 
-               // Rebuild cache
-               REBUILD_CACHE("config", "config");
+               // Rebuild caches
+               rebuildCacheFiles("config", "config");
+               rebuildCacheFiles("modreg", "modreg");
        } // END - if
 }
 //
        } // END - if
 }
 //
@@ -1628,40 +1629,7 @@ function SUB_JACKPOT($points) {
 function IS_DEMO () {
        return ((EXT_IS_ACTIVE("demo")) && (get_session('admin_login') == "demo"));
 }
 function IS_DEMO () {
        return ((EXT_IS_ACTIVE("demo")) && (get_session('admin_login') == "demo"));
 }
-//
-function LOAD_CONFIG ($no="0") {
-       $CFG_DUMMY = array();
-
-       // Check for cache extension, cache-array and if the requested configuration is in cache
-       if ((is_array($GLOBALS['cache_array'])) && (isset($GLOBALS['cache_array']['config'][$no])) && (is_array($GLOBALS['cache_array']['config'][$no]))) {
-               // Load config from cache
-               //* DEBUG: */ echo gettype($GLOBALS['cache_array']['config'][$no])."<br />\n";
-               foreach ($GLOBALS['cache_array']['config'][$no] as $key => $value) {
-                       $CFG_DUMMY[$key] = $value;
-               } // END - foreach
-
-               // Count cache hits if exists
-               if ((isset($CFG_DUMMY['cache_hits'])) && (EXT_IS_ACTIVE("cache"))) {
-                       $CFG_DUMMY['cache_hits']++;
-               } // END - if
-       } elseif ((!EXT_IS_ACTIVE("cache")) || (!isset($GLOBALS['cache_array']['config'][$no]))) {
-               // Load config from DB
-               $result_config = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_config` WHERE config=%d LIMIT 1",
-                       array(bigintval($no)), __FUNCTION__, __LINE__);
-
-               // Get config from database
-               $CFG_DUMMY = SQL_FETCHARRAY($result_config);
 
 
-               // Free result
-               SQL_FREERESULT($result_config);
-
-               // Remember this config in the array
-               $GLOBALS['cache_array']['config'][$no] = $CFG_DUMMY;
-       }
-
-       // Return config array
-       return $CFG_DUMMY;
-}
 // Gets the matching what name from module
 function GET_WHAT ($modCheck) {
        // Is the request element set?
 // Gets the matching what name from module
 function GET_WHAT ($modCheck) {
        // Is the request element set?
@@ -1770,7 +1738,7 @@ function UPDATE_CONFIG ($entries, $values, $updateMode="") {
        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):entries={$entries},affectedRows={$affectedRows}<br />\n";
 
        // Rebuild cache
        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):entries={$entries},affectedRows={$affectedRows}<br />\n";
 
        // Rebuild cache
-       REBUILD_CACHE("config", "config");
+       rebuildCacheFiles("config", "config");
 }
 
 // Prepares an SQL statement part for HTML mail and/or holiday depency
 }
 
 // Prepares an SQL statement part for HTML mail and/or holiday depency