X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fmysql-manager.php;h=98c45fe686e0b13b182ae9b1981886483f1e7850;hb=08b3c51b70b6498fd92a2760979d64470ad1b586;hp=9484506fc9896cfc92060df76c2e21ef76a5f9a3;hpb=a954ccdf4aba81ec0e75a1836aa4bc14cb245aba;p=mailer.git diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 9484506fc9..98c45fe686 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -37,10 +37,13 @@ if (!defined('__SECURITY')) { require($INC); } -// -function ADD_MODULE_TITLE($mod) { +// Returns the title for given module +function ADD_MODULE_TITLE ($mod) { global $cacheArray; - $name = ""; $result = false; + + // Init variables + $name = ""; + $result = false; // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { @@ -65,7 +68,7 @@ function ADD_MODULE_TITLE($mod) { // Still no luck or empty title? if (empty($name)) { // No name found - $name = sprintf("%s (%s)", LANG_UNKNOWN_MODULE, $mod); + $name = sprintf("%s (%s)", getMessage('LANG_UNKNOWN_MODULE'), $mod); if (SQL_NUMROWS($result) == 0) { // Add module to database $dummy = CHECK_MODULE($mod); @@ -133,7 +136,7 @@ function CHECK_MODULE ($mod) { } // Is the module found? - if ($found) { + if ($found === true) { // Check returned values against current access permissions // // Admin access ----- Guest access ----- --- Guest or member? --- @@ -204,6 +207,7 @@ function CHECK_MODULE ($mod) { // Add menu description pending on given file name (without path!) function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) { global $NAV_DEPTH; + // Use only filename of the file ;) $file = basename($file); @@ -248,7 +252,7 @@ function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) { break; } $dummy = substr($search, 0, -4); - $AND .= " AND action='".GET_ACTION($ACC_LVL, $dummy)."'"; + $AND .= " AND `action`='".GET_ACTION($ACC_LVL, $dummy)."'"; } elseif (($ACC_LVL == "sponsor") || ($ACC_LVL == "engine")) { // Sponsor / engine menu $type = "what"; @@ -264,7 +268,7 @@ function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) { } if ((!isset($NAV_DEPTH)) && (!$return)) { $NAV_DEPTH = 0; - $prefix = "
{!YOU_ARE_HERE!} Home"; + $prefix = "
{--YOU_ARE_HERE--} Home"; } else { if (!$return) $NAV_DEPTH++; $prefix = ""; @@ -322,6 +326,7 @@ function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) { return $OUT; } } + // function ADD_MENU ($MODE, $act, $wht) { // Init some variables @@ -330,7 +335,10 @@ function ADD_MENU ($MODE, $act, $wht) { $main_action = ""; $sub_what = ""; - if (!VALIDATE_MENU_ACTION($MODE, $act, $wht, true)) return getMessage('CODE_MENU_NOT_VALID'); + // is the menu action valid? + if (!VALIDATE_MENU_ACTION($MODE, $act, $wht, true)) { + return getMessage('CODE_MENU_NOT_VALID'); + } // END - if // Non-admin shall not see all menus if (!IS_ADMIN()) { @@ -358,7 +366,7 @@ function ADD_MENU ($MODE, $act, $wht) { // Load menu header template LOAD_TEMPLATE($MODE."_menu_title", false, $content); - $result_sub = SQL_QUERY_ESC("SELECT title, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE action='%s' AND `what` != '' AND `what` IS NOT NULL ".$AND." ORDER BY `sort`", + $result_sub = SQL_QUERY_ESC("SELECT title, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$AND." ORDER BY `sort`", array($MODE, $main_action), __FILE__, __LINE__); $ctl = SQL_NUMROWS($result_sub); if ($ctl > 0) { @@ -437,6 +445,7 @@ function ADD_MENU ($MODE, $act, $wht) { OUTPUT_HTML(""); } } + // This patched function will reduce many SELECT queries for the specified or current admin login function IS_ADMIN ($admin="") { global $cacheArray; @@ -458,14 +467,14 @@ function IS_ADMIN ($admin="") { // Use cached string $valPass = $cacheArray['admin_hash']; } elseif ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) { - // Count cache hits - incrementConfigEntry('cache_hits'); - // Login data is valid or not? $valPass = generatePassString($cacheArray['admins']['password'][$admin]); // Cache it away $cacheArray['admin_hash'] = $valPass; + + // Count cache hits + incrementConfigEntry('cache_hits'); } elseif ((!empty($admin)) && ((!EXT_IS_ACTIVE("cache"))) || (!isset($cacheArray['admins']['password'][$admin]))) { // Search for admin $result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY password FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1", @@ -498,24 +507,21 @@ function IS_ADMIN ($admin="") { //* DEBUG: */ if (!$ret) echo __LINE__."OK!
"; return $ret; } -// -function ADD_MAX_RECEIVE_LIST($MODE, $default="", $return=false) -{ + +// Generates a list of "max receiveable emails per day" +function ADD_MAX_RECEIVE_LIST ($MODE, $default = "", $return = false) { global $_POST; $OUT = ""; - switch ($MODE) - { + switch ($MODE) { case "guest": // Guests (in the registration form) are not allowed to select 0 mails per day. $result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value > 0 ORDER BY value", __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) - { + if (SQL_NUMROWS($result) > 0) { $OUT = ""; - while (list($value, $comment) = SQL_FETCHROW($result)) - { + while (list($value, $comment) = SQL_FETCHROW($result)) { $OUT .= "