X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=e19b1689b05df9b64f6c9fdc057a31576abdfbdc;hp=9c0e40109c51376d3086e06529441b1641349167;hb=6f440d8172c3dd7ef3ac406747fb2a2264e7f620;hpb=916bba4f00ee924f0d88b8fc273dee5bfb798aed diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 9c0e40109c..e19b1689b0 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -79,7 +79,7 @@ function getModuleTitle ($mod) { if (empty($title)) { // No name found $title = sprintf("%s (%s)", getMessage('LANG_UNKNOWN_MODULE'), $mod); - if (SQL_NUMROWS($result) == 0) { + if (SQL_NUMROWS($result) == '0') { // Add module to database $dummy = checkModulePermissions($mod); } // END - if @@ -253,7 +253,7 @@ function checkModulePermissions ($mod = '') { // Destroy cache here // @TODO Rewrite this to a filter - if ((getOutputMode() == 0) || (getOutputMode() == -1)) rebuildCacheFile('modules', 'modules'); + if ((getOutputMode() == '0') || (getOutputMode() == -1)) rebuildCacheFile('modules', 'modules'); // And reload data unset($GLOBALS['module_status'][$mod]); @@ -262,7 +262,7 @@ function checkModulePermissions ($mod = '') { // Module not found we don't add it to the database $ret = '404'; } - } elseif (($ret == 'cache_miss') && (getOutputMode() == 0)) { + } elseif (($ret == 'cache_miss') && (getOutputMode() == '0')) { // Rebuild the cache files rebuildCacheFile('modules', 'modules'); } elseif ($found === false) { @@ -348,7 +348,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false, $output = tru // Begin the navigation line if ((!isset($GLOBALS['nav_depth'])) && ($return === false)) { - $GLOBALS['nav_depth'] = 0; + $GLOBALS['nav_depth'] = '0'; $prefix = "
{--YOU_ARE_HERE--} Home"; } else { if ($return === false) $GLOBALS['nav_depth']++; @@ -386,7 +386,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false, $output = tru //* DEBUG: */ print(__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' => "")); @@ -411,7 +411,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false, $output = tru // Adds a menu (mode = guest/member/admin/sponsor) to output function addMenu ($mode, $action, $what) { // Init some variables - $main_cnt = 0; + $main_cnt = '0'; $AND = ''; // is the menu action valid? @@ -451,7 +451,7 @@ function addMenu ($mode, $action, $what) { // Do we have some entries? if ($totalWhats > 0) { // Init counter - $cnt = 0; + $cnt = '0'; // Load all sub menus while ($content2 = SQL_FETCHARRAY($result_sub)) { @@ -580,7 +580,7 @@ function isMember () { if (isset($GLOBALS['is_member'])) { // Then return it return $GLOBALS['is_member']; - } elseif (getMemberId() == 0) { + } elseif (getMemberId() == '0') { // No member return false; } else { @@ -611,17 +611,15 @@ function isMember () { $ret = true; } else { // Maybe got locked etc. - //* DEBUG: */ print(__LINE__."!!!
"); + logDebugMessage(__FUNCTION__, __LINE__, 'status=' . getUserData('status')); destroyMemberSession(); } } else { // Cookie data is invalid! - //* DEBUG: */ print(__LINE__."***
"); destroyMemberSession(); } } else { // Cookie data is invalid! - //* DEBUG: */ print(__LINE__."///
"); destroyMemberSession(); } @@ -634,24 +632,31 @@ function isMember () { // Fetch user data for given user id function fetchUserData ($userid, $column='userid') { - // Don't look for invalid userids... - if ($userid < 1) { - // Invalid, so abort here - debug_report_bug('User id ' . $userid . ' is invalid.'); + // If we should look for userid secure&set it here + if (substr($column, -2, 2) == 'id') { + // Secure userid + $userid = bigintval($userid); + + // Set it here + setCurrentUserId($userid); + + // Don't look for invalid userids... + if ($userid < 1) { + // Invalid, so abort here + debug_report_bug('User id ' . $userid . ' is invalid.'); + } elseif (isUserDataValid()) { + // Use cache, so it is fine + return true; + } } elseif (isUserDataValid()) { // Use cache, so it is fine return true; } + // By default none was found $found = false; - // Do we have userid/refid? - if (($column == 'userid') || ($column == 'refid')) { - // Then secure the id - $userid = bigintval($userid); - } // END - if - // Query for the user $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `%s`='%s' LIMIT 1", array($column, $userid), __FUNCTION__, __LINE__); @@ -669,12 +674,12 @@ function fetchUserData ($userid, $column='userid') { if (isset($GLOBALS['user_data'][getCurrentUserId()]['last_failure'])) { // Backup the raw one and zero it $GLOBALS['user_data'][getCurrentUserId()]['last_failure_raw'] = $GLOBALS['user_data'][getCurrentUserId()]['last_failure']; - $GLOBALS['user_data'][getCurrentUserId()]['last_failure'] = 0; + $GLOBALS['user_data'][getCurrentUserId()]['last_failure'] = '0'; // Is it not zero? if ($GLOBALS['user_data'][getCurrentUserId()]['last_failure_raw'] != '0000-00-00 00:00:00') { // Seperate data/time - $array = explode(' ', $GLOBALS['user_data'][getCurrentUserId()]['last_failure']); + $array = explode(' ', $GLOBALS['user_data'][getCurrentUserId()]['last_failure_raw']); // Seperate data and time again $array['date'] = explode('-', $array[0]); @@ -1075,7 +1080,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) { @@ -1165,7 +1170,7 @@ function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $ array($rowName, $stats_id, bigintval($userid), $type), __FUNCTION__, __LINE__); // Was it *not* found? - if (SQL_NUMROWS($result) == 0) { + if (SQL_NUMROWS($result) == '0') { // So we add one! SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_links` (`%s`, `userid`, `link_type`) VALUES ('%s','%s','%s')", array($rowName, $stats_id, bigintval($userid), $type), __FUNCTION__, __LINE__); @@ -1186,7 +1191,7 @@ function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $ // Calculate sum (default) or count records of given criteria function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatement = 'userid', $countRows = false, $add = '') { - $ret = 0; + $ret = '0'; //* DEBUG: */ print($search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add.'
'); if ((empty($search)) && ($search != '0')) { // Count or sum whole table? @@ -1223,7 +1228,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen $ret = '0.00000'; } elseif (''.$ret.'' == '') { // Fix empty result - $ret = 0; + $ret = '0'; } // Return value @@ -1233,7 +1238,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen // Getter fro ref level percents function getReferalLevelPercents ($level) { // Default is zero - $per = 0; + $per = '0'; // Do we have cache? if ((isset($GLOBALS['cache_array']['refdepths']['level'])) && (isExtensionActive('cache'))) { @@ -1278,13 +1283,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: */ print("----------------------- ".__FUNCTION__." - ENTRY ------------------------