X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=1d87752921cfa0fab7d0b9b37cfc618e05ccb2e8;hp=593e21e0295076ec8c555f1c7b1a459850dfe5fe;hb=8a2ab6a6beb399e024ec5a56b487b03c4f65551c;hpb=5ef6ed7373ae85e5635e39e2a0adf9496a8add05;ds=sidebyside
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index 593e21e029..1d87752921 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -79,9 +79,8 @@ function ADD_MODULE_TITLE($mod)
}
return $name;
}
-//
-function CHECK_MODULE($mod)
-{
+// Check validity of a given module name (no file extension)
+function CHECK_MODULE($mod) {
// We need them now here...
global $MODULES, $CONFIG, $CACHE;
@@ -89,17 +88,15 @@ function CHECK_MODULE($mod)
$mod = preg_replace("/[^a-z_]/", "", $mod);
// Check for prefix is a extension...
- $MOD_SPLIT = explode("_", $mod);
+ $modSplit = explode("_", $mod);
$extension = ""; $mod_chk = $mod;
- //* DEBUG: */ echo __LINE__."*".count($MOD_SPLIT)."*/".$mod."*
";
- if (count($MOD_SPLIT) == 2)
- {
+ //* DEBUG: */ echo __LINE__."*".count($modSplit)."*/".$mod."*
";
+ if (count($modSplit) == 2) {
// Okay, there is a seperator (_) in the name so is the first part a module?
- //* DEBUG: */ echo __LINE__."*".$MOD_SPLIT[0]."*
";
- if (EXT_IS_ACTIVE($MOD_SPLIT[0]))
- {
+ //* DEBUG: */ echo __LINE__."*".$modSplit[0]."*
";
+ if (EXT_IS_ACTIVE($modSplit[0])) {
// The prefix is an extension's name, so let's set it
- $extension = $MOD_SPLIT[0]; $mod = $MOD_SPLIT[1];
+ $extension = $modSplit[0]; $mod = $modSplit[1];
}
}
@@ -111,8 +108,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") && (is_array($MODULES['module'])))
- {
+ if ((GET_EXT_VERSION("cache") >= "0.1.2") && (is_array($MODULES['module']))) {
// Is the module cached?
if (isset($MODULES['locked'][$mod_chk])) {
// Check cache
@@ -128,13 +124,10 @@ function CHECK_MODULE($mod)
// No, then we have to update it!
$ret = "cache_miss";
}
- }
- else
- {
+ } else {
// 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__);
- if (SQL_NUMROWS($result) == 1)
- {
+ if (SQL_NUMROWS($result) == 1) {
// Read data
list($locked, $hidden, $admin, $mem) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
@@ -145,33 +138,24 @@ 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_LOGGED_IN()))))
- {
+ if ((IS_ADMIN()) || (($locked == 'N') && ($admin == 'N') && (($mem == 'N') || (IS_LOGGED_IN())))) {
// If you are admin you are welcome for everything!
$ret = "done";
- }
- elseif ($locked == 'Y')
- {
+ } elseif ($locked == 'Y') {
// Module is locked
$ret = "locked";
- }
- elseif (($mem == 'Y') && (!IS_LOGGED_IN()))
- {
+ } elseif (($mem == 'Y') && (!IS_LOGGED_IN())) {
// You have to login first!
$ret = "mem_only";
- }
- elseif (($admin == 'Y') && (!IS_ADMIN()))
- {
+ } elseif (($admin == 'Y') && (!IS_ADMIN())) {
// Only the Admin is allowed to enter this module!
$ret = "admin_only";
}
// Still no luck or not found?
- if (($ret == "major") || ($ret == "cache_miss") || (!$found))
- {
+ if (($ret == "major") || ($ret == "cache_miss") || (!$found)) {
// ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name ---
- if ((file_exists(PATH."inc/modules/".$mod.".php")) || (file_exists(PATH.$mod.".php")) || (file_exists(PATH.$extension."/".$mod.".php")))
- {
+ if ((file_exists(PATH."inc/modules/".$mod.".php")) || (file_exists(PATH.$mod.".php")) || (file_exists(PATH.$extension."/".$mod.".php"))) {
// Data is missing so we add it
if (GET_EXT_VERSION("sql_patches") >= "0.3.6") {
// Since 0.3.6 we have a has_menu column, this took me a half hour
@@ -212,14 +196,13 @@ function CHECK_MODULE($mod)
// Return the value
return $ret;
}
-//
+// Add menu description pending on given file name (without path!)
function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true)
{
global $DEPTH, $CONFIG;
$LINK_ADD = ""; $OUT = ""; $AND = "";
// First we have to do some analysis...
- if (ereg("action-", $file))
- {
+ if (ereg("action-", $file)) {
// This is an action file!
$type = "action";
$search = substr($file, 7);
@@ -236,9 +219,7 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true)
break;
}
$AND = " AND what=''";
- }
- elseif (ereg("what-", $file))
- {
+ } elseif (ereg("what-", $file)) {
// This is an admin what file!
$type = "what";
$search = substr($file, 5);
@@ -252,84 +233,67 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true)
case "guest":
case "member":
$MOD_CHECK = $GLOBALS['module'];
- if (!IS_ADMIN())
- {
+ if (!IS_ADMIN()) {
$AND = " AND visible='Y' AND locked='N'";
}
break;
}
$DUMMY = substr($search, 0, -4);
$AND .= " AND action='".GET_ACTION($ACC_LVL, $DUMMY)."'";
- }
- elseif (($ACC_LVL == "sponsor") || ($ACC_LVL == "engine"))
- {
+ } elseif (($ACC_LVL == "sponsor") || ($ACC_LVL == "engine")) {
// Sponsor / engine menu
$type = "what";
$search = $file;
$MOD_CHECK = $GLOBALS['module'];
$AND = "";
- }
- else
- {
+ } else {
// Other
$type = "menu";
$search = $file;
$MOD_CHECK = $GLOBALS['module'];
$AND = "";
}
- if ((!isset($DEPTH)) && (!$return))
- {
+ if ((!isset($DEPTH)) && (!$return)) {
$DEPTH = "0";
$prefix = "