X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=c4803ae00bd7d0d40acc5bb3457978d65a50a505;hb=cb30b8c591b92189065565d67063c7512b0eeb76;hp=ad02fe75d7d97711cf2329abe7055c5f7c97187a;hpb=41e2891fb998d13b22b8d7984358f258cc85267d;p=mailer.git diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index ad02fe75d7..c4803ae00b 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -32,7 +32,7 @@ ************************************************************************/ // Some security stuff... -if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) { +if (!defined('__SECURITY')) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; require($INC); } @@ -44,7 +44,8 @@ function ADD_MODULE_TITLE($mod) { // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { - if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (is_array($cacheArray['modules']['module'])) && (isset($cacheArray['modules']['module'][$mod]))) { + // Check if cache is valid + if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (in_array($mod, $cacheArray['modules']['module']))) { // Load from cache $name = $cacheArray['modules']['title'][$mod]; @@ -56,7 +57,7 @@ function ADD_MODULE_TITLE($mod) { list($name) = SQL_FETCHROW($result); SQL_FREERESULT($result); } - } + } // END - if // Trim name $name = trim($name); @@ -68,8 +69,10 @@ function ADD_MODULE_TITLE($mod) { if (SQL_NUMROWS($result) == 0) { // Add module to database $dummy = CHECK_MODULE($mod); - } - } + } // END - if + } // END - if + + // Return name return $name; } @@ -277,7 +280,7 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) { // Can we close the you-are-here navigation? //* DEBUG: */ echo __LINE__."*".$type."/".$GLOBALS['what']."*
\n"; //* DEBUG: */ die("
".print_r($_CONFIG, true)."
"); - if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || (($GLOBALS['what'] == $_CONFIG['index_home']) && ($ACC_LVL == "guest"))))) { + if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview")))) { //* DEBUG: */ echo __LINE__."+".$type."+
\n"; $OUT .= "
\n"; $DEPTH="0"; @@ -342,7 +345,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." 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,12 +440,18 @@ function IS_ADMIN($admin="") //* DEBUG: */ echo __LINE__."ADMIN:".$admin."/".$passCookie."
"; // Search in array for entry - if ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) { + if (isset($cacheArray['admin_hash'])) { + // Use cached string + $valPass = $cacheArray['admin_hash']; + } elseif ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) { // Count cache hits $_CONFIG['cache_hits']++; // Login data is valid or not? $valPass = generatePassString($cacheArray['admins']['password'][$admin]); + + // Cache it away + $cacheArray['admin_hash'] = $valPass; } elseif (!empty($admin)) { // Search for admin $result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY password FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1", @@ -454,9 +463,12 @@ function IS_ADMIN($admin="") // Admin login was found so let's load password from DB list($passDB) = SQL_FETCHROW($result); + // Temporary cache it + $cacheArray['admins']['password'][$admin] = $passDB; + // Generate password hash $valPass = generatePassString($passDB); - } + } // END - if // Free memory SQL_FREERESULT($result); @@ -618,9 +630,7 @@ function IS_MEMBER() // Free memory SQL_FREERESULT($result); - } - else - { + } else { // Cookie data is invalid! //* DEBUG: */ echo __LINE__."///
"; destroy_user_session(); @@ -628,6 +638,8 @@ function IS_MEMBER() // Remove array elements to prevent errors unset($GLOBALS['userid']); } + + // Return status return $ret; } // @@ -893,7 +905,7 @@ function COUNT_MODULE($mod) function GET_ACTION ($MODE, &$wht) { global $ret, $_CONFIG; - // DEPRECATED: Init status + // @DEPRECATED Init status $ret = ""; //* DEBUG: */ echo __LINE__."=".$MODE."/".$wht."/".$GLOBALS['action']."=
"; @@ -1084,7 +1096,7 @@ function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", * rid = inc/modules/guest/what-confirm.php need this * locked = Shall I pay it to normal (false) or locked (true) points ammount? * add_mode = Add points only to $uid or also refs? (WARNING! Changing "ref" to "direct" - * will cause no referral will get points ever!!!) + * for default value will cause no referral will get points ever!!!) */ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") { @@ -1113,8 +1125,11 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock $percents = "percents"; if (isset($_CONFIG['db_percents'])) $percents = $_CONFIG['db_percents']; $table = "refdepths"; if (isset($_CONFIG['db_table'])) $table = $_CONFIG['db_table']; + // Default is "normal" points + $data = "points"; + // Which points, locked or normal? - $data = "points"; if ($locked) $data = "locked_points"; + if ($locked) $data = "locked_points"; // Check user account $result_user = SQL_QUERY_ESC("SELECT refid, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s AND status='CONFIRMED' LIMIT 1", @@ -1768,7 +1783,7 @@ function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) { $msg = LOAD_TEMPLATE("ext_".$ext, true); } else { // Load default message - $msg = LOAD_EMAIL_TEMPLATE("admin_new_ext","", 0); + $msg = LOAD_TEMPLATE("admin_new_ext", "", 0); } // Task not created so it's a brand-new extension which we need to register and create a task for!