X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=d25ae4c41425990ee99c1889570b07c66e4ecb8c;hp=6b244371c278f309b049efa4f6221b62aade5e79;hb=1e8b13eed299bc1fce44f44e01361de6d025092a;hpb=439a544d74b0f34908b8524777c8c50294c03073
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index 6b244371c2..d25ae4c414 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -44,7 +44,7 @@ function ADD_MODULE_TITLE ($mod) {
$result = false;
// Is the script installed?
- if (isBooleanConstantAndTrue('mxchange_installed')) {
+ if (isInstalled()) {
// Check if cache is valid
if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($GLOBALS['cache_array']['modules']['module'])) && (in_array($mod, $GLOBALS['cache_array']['modules']['module']))) {
// Load from cache
@@ -55,7 +55,7 @@ function ADD_MODULE_TITLE ($mod) {
} elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
$result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1",
- array($mod), __FILE__, __LINE__);
+ array($mod), __FUNCTION__, __LINE__);
list($name) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
}
@@ -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
- $dummy = CHECK_MODULE($mod);
+ $dummy = checkModulePermissions($mod);
} // END - if
} // END - if
@@ -79,7 +79,7 @@ function ADD_MODULE_TITLE ($mod) {
}
// 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);
@@ -100,7 +100,7 @@ function CHECK_MODULE ($mod) {
$ret = "major";
// Check if script is installed if not return a "done" to prevent some errors
- if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isInstalling()) || (!isBooleanConstantAndTrue('admin_registered'))) {
+ if ((!isInstalled()) || (isInstalling()) || (!isAdminRegistered())) {
// Not installed or no admin registered or in installation phase
return "done";
} // END - if
@@ -114,6 +114,12 @@ function CHECK_MODULE ($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
@@ -132,7 +138,7 @@ function CHECK_MODULE ($mod) {
} elseif (!EXT_IS_ACTIVE("cache")) {
// Check for module in database
$result = SQL_QUERY_ESC("SELECT locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1",
- array($mod_chk), __FILE__, __LINE__);
+ array($mod_chk), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Read data
list($locked, $hidden, $admin, $mem) = SQL_FETCHROW($result);
@@ -179,12 +185,12 @@ function CHECK_MODULE ($mod) {
// to find a loop here... *sigh*
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_mod_reg`
(module, locked, hidden, mem_only, admin_only, has_menu) VALUES
-('%s','Y','N','N','N','N')", array($mod_chk), __FILE__, __LINE__);
+('%s','Y','N','N','N','N')", array($mod_chk), __FUNCTION__, __LINE__);
} else {
// Wrong/missing sql_patches!
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_mod_reg`
(module, locked, hidden, mem_only, admin_only) VALUES
-('%s','Y','N','N','N')", array($mod_chk), __FILE__, __LINE__);
+('%s','Y','N','N','N')", array($mod_chk), __FUNCTION__, __LINE__);
}
// Everthing is fine?
@@ -194,10 +200,10 @@ function CHECK_MODULE ($mod) {
} // END - if
// Destroy cache here
- REBUILD_CACHE("mod_reg", "modreg");
+ rebuildCacheFiles("modreg", "modreg");
// 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";
@@ -298,7 +304,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
// Get the title from menu
$result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE %s='%s' ".$AND." LIMIT 1",
- array($ACC_LVL, $type, $search), __FILE__, __LINE__);
+ array($ACC_LVL, $type, $search), __FUNCTION__, __LINE__);
// Menu found?
if (SQL_NUMROWS($result) == 1) {
@@ -322,7 +328,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
$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
}
@@ -361,7 +367,7 @@ function ADD_MENU ($MODE, $act, $wht) {
// Load SQL data and add the menu to the output stream...
$result_main = SQL_QUERY_ESC("SELECT title, action FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (what='' OR `what` IS NULL)".$AND." ORDER BY `sort`",
- array($MODE), __FILE__, __LINE__);
+ array($MODE), __FUNCTION__, __LINE__);
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*
\n";
if (SQL_NUMROWS($result_main) > 0) {
OUTPUT_HTML("