X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=9aa35d0f2d7b07d3d9e39e2b69fda346afd3902b;hb=35e30db36415c79180aa2cacf7259883deef5584;hp=754ca58d903baf831c74568228c15f7b0462d87e;hpb=1ebf518b9552f71ee95de6f4b80e6de3a27716d1;p=mailer.git
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index 754ca58d90..9aa35d0f2d 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -253,7 +253,7 @@ function checkModulePermissions ($mod = '') {
// Destroy cache here
// @TODO Rewrite this to a filter
- if (getOutputMode() == '0') rebuildCacheFile('modreg', 'modreg');
+ if (getOutputMode() == 0) rebuildCacheFile('modules', 'modules');
// And reload data
unset($GLOBALS['module_status'][$mod]);
@@ -264,7 +264,7 @@ function checkModulePermissions ($mod = '') {
}
} elseif (($ret == 'cache_miss') && (getOutputMode() == 0)) {
// Rebuild the cache files
- rebuildCacheFile('modreg', 'modreg');
+ rebuildCacheFile('modules', 'modules');
} elseif ($found === false) {
// Problem with module detected
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Problem in module %s detected. ret=%s, locked=%s, hidden=%s, mem=%s, admin=%s, output_mode=%s",
@@ -386,7 +386,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false, $output = tru
//* DEBUG: */ outputHtml(__LINE__.'+'.$type."+
");
// Add closing div and br-tag
$OUT .= "
\n";
- $GLOBALS['nav_depth'] = '0';
+ $GLOBALS['nav_depth'] = 0;
// Run the filter chain
$ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'content' => ""));
@@ -513,21 +513,21 @@ function addMenu ($mode, $action, $what) {
enableBlockMode();
// Load menu block
- $inc_BLOCK = sprintf("inc/modules/%s/action-%s.php", $mode, $content['action']);
- if (isFileReadable($inc_BLOCK)) {
+ $INC = sprintf("inc/modules/%s/action-%s.php", $mode, $content['action']);
+ if (isFileReadable($INC)) {
// Load include file
if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_begin', true, $mode);
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
");
- loadInclude($inc_BLOCK);
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
");
- if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_end', true);
+ //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
");
+ loadInclude($INC);
+ //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
");
+ if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_end', true, $mode);
}
//* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
");
}
$main_cnt++;
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
");
+ //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.':'.getWhat()."*
");
if (SQL_NUMROWS($result_main) > $main_cnt) {
// Add seperator
$GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode);
@@ -648,23 +648,23 @@ function isAdmin ($admin = '') {
// Get admin login and password from session/cookies
$admin = getSession('admin_login');
$passCookie = getSession('admin_md5');
- }
+ } // END - if
//* DEBUG: */ outputHtml(__LINE__."ADMIN:".$admin.'/'.$passCookie."
");
// Search in array for entry
if (isset($GLOBALS['admin_hash'])) {
// Use cached string
$valPass = $GLOBALS['admin_hash'];
- } elseif ((!empty($passCookie)) && (isset($GLOBALS['cache_array']['admins']['password'][$admin])) && (!empty($admin))) {
+ } elseif ((!empty($passCookie)) && (isAdminHashSet($admin) === true) && (!empty($admin))) {
// Login data is valid or not?
- $valPass = generatePassString($GLOBALS['cache_array']['admins']['password'][$admin]);
+ $valPass = generatePassString(getAdminHash($admin));
// Cache it away
$GLOBALS['admin_hash'] = $valPass;
// Count cache hits
incrementStatsEntry('cache_hits');
- } elseif ((!empty($admin)) && ((!isExtensionActive('cache'))) || (!isset($GLOBALS['cache_array']['admins']['password'][$admin]))) {
+ } elseif ((!empty($admin)) && ((!isExtensionActive('cache'))) || (isAdminHashSet($admin) === false)) {
// Search for admin
$result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY `password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1",
array($admin), __FUNCTION__, __LINE__);
@@ -676,7 +676,7 @@ function isAdmin ($admin = '') {
list($passDB) = SQL_FETCHROW($result);
// Temporary cache it
- $GLOBALS['cache_array']['admins']['password'][$admin] = $passDB;
+ setAdminHash($admin, $passDB);
// Generate password hash
$valPass = generatePassString($passDB);
@@ -688,8 +688,8 @@ function isAdmin ($admin = '') {
if (!empty($valPass)) {
// Check if password is valid
- //* DEBUG: */ outputHtml(__FUNCTION__."*".$valPass.'/'.$passCookie."*
");
- $ret = (($valPass == $passCookie) || ((strlen($valPass) == 32) && ($valPass == md5($passCookie))) || (($valPass == "*FAILED*") && (!isExtensionActive('cache'))));
+ //* DEBUG: */ print(__FUNCTION__ . ':' . $valPass . '/' . $passCookie . '
');
+ $ret = (($valPass == $passCookie) || ((strlen($valPass) == 32) && ($valPass == md5($passCookie))) || (($valPass == '*FAILED*') && (!isExtensionActive('cache'))));
} // END - if
// Return result of comparision
@@ -766,9 +766,9 @@ function isEmailTaken ($email) {
}
// Validate the given menu action
-function isMenuActionValid ($mode, $action, $what, $UPDATE=false) {
+function isMenuActionValid ($mode, $action, $what, $updateEntry=false) {
// Is the cache entry there and we shall not update?
- if ((isset($GLOBALS['action_valid'][$mode][$action][$what])) && ($UPDATE === false)) {
+ if ((isset($GLOBALS['action_valid'][$mode][$action][$what])) && ($updateEntry === false)) {
// Count cache hit
incrementStatsEntry('cache_hits');
@@ -784,7 +784,7 @@ function isMenuActionValid ($mode, $action, $what, $UPDATE=false) {
if ((!isAdmin()) && ($mode != 'admin')) $add = " AND `locked`='N'";
//* DEBUG: */ outputHtml(__LINE__.':'.$mode.'/'.$action.'/'.$what."*
");
- if (($mode != 'admin') && ($UPDATE === true)) {
+ if (($mode != 'admin') && ($updateEntry === true)) {
// Update guest or member menu
$sql = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$add." LIMIT 1",
array($mode, $action, $what), __FUNCTION__, __LINE__, false);
@@ -800,7 +800,7 @@ function isMenuActionValid ($mode, $action, $what, $UPDATE=false) {
// Run SQL command
$result = SQL_QUERY($sql, __FUNCTION__, __LINE__);
- if ($UPDATE === true) {
+ if ($updateEntry === true) {
// Check updated/affected rows
$ret = (SQL_AFFECTEDROWS() == 1);
} else {
@@ -939,13 +939,6 @@ function sendModeMails ($mod, $modes) {
loadTemplate('admin_settings_saved', false, $content);
}
-// Update module counter
-function countModuleHit($mod) {
- // 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",
- array($mod), __FUNCTION__, __LINE__);
-}
-
// Get action value from mode (admin/guest/member) and what-value
function getModeAction ($mode, $what) {
// Init status
@@ -995,9 +988,8 @@ function getModeAction ($mode, $what) {
} elseif ((!isExtensionInstalled('sql_patches')) && ($mode != 'admin')) {
// No sql_patches installed, but maybe we need to register an admin?
if (isAdminRegistered()) {
- // Redirect
- // @TODO Why does this lead into an endless loop but we still need it???
- // @TODO Commented out redirectToUrl('admin.php');
+ // Redirect to admin area
+ redirectToUrl('admin.php');
} // END - if
}
@@ -1011,7 +1003,7 @@ function getCategory ($cid) {
$ret = getMessage('_CATEGORY_404');
// Is the category id set?
- if ($cid == '0') {
+ if ($cid == 0) {
// No category
$ret = getMessage('_CATEGORY_NONE');
} elseif ($cid > 0) {
@@ -1159,7 +1151,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
$ret = '0.00000';
} elseif (''.$ret.'' == '') {
// Fix empty result
- $ret = '0';
+ $ret = 0;
}
// Return value
@@ -1171,19 +1163,19 @@ function getReferalLevelPercents ($level) {
$per = 0;
// Do we have cache?
- if ((isset($GLOBALS['cache_array']['ref_depths']['level'])) && (isExtensionActive('cache'))) {
+ if ((isset($GLOBALS['cache_array']['refdepths']['level'])) && (isExtensionActive('cache'))) {
// First look for level
- $key = array_search($level, $GLOBALS['cache_array']['ref_depths']['level']);
+ $key = array_search($level, $GLOBALS['cache_array']['refdepths']['level']);
if ($key !== false) {
// Entry found!
- $per = $GLOBALS['cache_array']['ref_depths']['percents'][$key];
+ $per = $GLOBALS['cache_array']['refdepths']['percents'][$key];
// Count cache hit
incrementStatsEntry('cache_hits');
- }
+ } // END - if
} elseif (!isExtensionActive('cache')) {
// Get referal data
- $result_level = SQL_QUERY_ESC("SELECT percents FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE level='%s' LIMIT 1",
+ $result_level = SQL_QUERY_ESC("SELECT `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `level`='%s' LIMIT 1",
array(bigintval($level)), __FUNCTION__, __LINE__);
// Entry found?
@@ -1213,13 +1205,13 @@ function getReferalLevelPercents ($level) {
* add_mode = Add points only to $userid or also refs? (WARNING! Changing 'ref' to 'direct'
* for default value will cause no referal will get points ever!!!)
*/
-function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $rid = '0', $locked = false, $add_mode = 'ref') {
+function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $rid = 0, $locked = false, $add_mode = 'ref') {
//* DEBUG: */ outputHtml("----------------------- ".__FUNCTION__." - ENTRY ------------------------