From: Roland Häder Date: Thu, 1 Jul 2010 04:45:22 +0000 (+0000) Subject: More rewrites to make use of (cached) wrapper functions X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=30ae22f62ae87c53a56baf0d134569ba91011111;p=mailer.git More rewrites to make use of (cached) wrapper functions --- diff --git a/beg.php b/beg.php index 57b930c8d9..65516a55b6 100644 --- a/beg.php +++ b/beg.php @@ -98,7 +98,7 @@ if (isGetRequestParameterSet('userid')) { } // END - if // User id valid and not webmaster's id? - if ((getUserData('userid') > 0) && (getConfig('beg_userid') != getUserData('userid'))) { + if ((isValidUserId(getUserData('userid'))) && (getConfig('beg_userid') != getUserData('userid'))) { // Update counter SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_clicks`=`beg_clicks`+1 WHERE `userid`=%s LIMIT 1", array(getUserData('userid')), __FILE__, __LINE__); @@ -109,7 +109,6 @@ if (isGetRequestParameterSet('userid')) { // Entry not found, points set and not logged in? if (((SQL_HASZERONUMS($result)) || (isAdmin())) && ($points > 0) && (!isMember()) && (getConfig('beg_pay_mode') == 'NONE')) { - // Admin is testing? if (!isAdmin()) { // Remember remote address, userid and timestamp for next click diff --git a/doubler.php b/doubler.php index 635448e77b..8685143cf2 100644 --- a/doubler.php +++ b/doubler.php @@ -117,7 +117,7 @@ if (isFormSent()) { incrementConfigEntry('doubler_points', $points); // Add second line for the referal but only when userid != refid - if ((determineReferalId() > 0) && (determineReferalId() != getUserData('userid'))) { + if ((isValidUserId(determineReferalId())) && (determineReferalId() != getUserData('userid'))) { // Okay add a refid line and apply refid percents SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES ('%s',0,'%s','".detectRemoteAddr()."',UNIX_TIMESTAMP(),'N','Y')", array( diff --git a/inc/autopurge/purge-general.php b/inc/autopurge/purge-general.php index 0e26307b13..68b98ac435 100644 --- a/inc/autopurge/purge-general.php +++ b/inc/autopurge/purge-general.php @@ -66,7 +66,7 @@ WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - {?auto_purge?}) ORDER BY s.userid ASC", __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Start deleting procedure $userid = '0'; $points = '0'; while ($content = SQL_FETCHARRAY($result)) { @@ -108,14 +108,14 @@ ORDER BY if (isExtensionActive('bonus', true)) { // Check for bonus campaigns $result = SQL_QUERY("SELECT `id`, `points` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='SEND' AND `timestamp` <= {?auto_purge?} ORDER BY `id` ASC", __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Start deleting procedure $points = '0'; while ($content = SQL_FETCHARRAY($result)) { // Check if confirmation links are purged or not $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s", array(bigintval($content['id'])), __FILE__, __LINE__); - if (SQL_NUMROWS($result_links) > 0) { + if (!SQL_HASZERONUMS($result_links)) { // At least one link was found, enougth to pay back the points $points += $content['points'] * SQL_NUMROWS($result_links); diff --git a/inc/autopurge/purge-inact.php b/inc/autopurge/purge-inact.php index 74dd7469a1..4a0ef16865 100644 --- a/inc/autopurge/purge-inact.php +++ b/inc/autopurge/purge-inact.php @@ -56,10 +56,7 @@ if (getConfig('autopurge_inactive') == 'Y') { // Init exclusion list // @TODO Rewrite these if() blocks to a filter $EXCLUDE_LIST = ''; - if (getConfig('def_refid') > 0) { - $EXCLUDE_LIST = ' AND d.`userid` != {?def_refid?}'; - } // END - if - + if (isValidUserId(getConfig('def_refid'))) $EXCLUDE_LIST .= ' AND d.`userid` != {?def_refid?}'; // Check for more extensions if (isExtensionActive('beg')) $EXCLUDE_LIST .= ' AND d.`userid` != {?beg_userid?}'; if (isExtensionActive('bonus')) $EXCLUDE_LIST .= ' AND d.`userid` != {?bonus_userid?}'; @@ -89,7 +86,7 @@ ORDER BY getApInactiveSince() ), __FILE__, __LINE__); - if (SQL_NUMROWS($result_inactive) > 0) { + if (!SQL_HASZERONUMS($result_inactive)) { // Prepare variables and constants... $useridsContent = ''; $content['since'] = (getApInactiveSince() / 60 / 60); @@ -140,7 +137,7 @@ WHERE ORDER BY `userid` ASC", __FILE__, __LINE__); - if (SQL_NUMROWS($result_inactive) > 0) { + if (!SQL_HASZERONUMS($result_inactive)) { // Prepare variable... $useridsContent = ''; diff --git a/inc/autopurge/purge-mails.php b/inc/autopurge/purge-mails.php index d605fc33a9..8f9e3308b1 100644 --- a/inc/autopurge/purge-mails.php +++ b/inc/autopurge/purge-mails.php @@ -62,7 +62,7 @@ ORDER BY $deletedStats = '0'; // Do we have "purged" mails? -if (SQL_NUMROWS($result_mails) > 0) { +if (!SQL_HASZERONUMS($result_mails)) { // Okay, check for their sender's while ($content = SQL_FETCHARRAY($result_mails)) { // Check now... @@ -101,7 +101,7 @@ ORDER BY `userid` ASC", __FILE__, __LINE__); // Do we have "purged" mails? -if (SQL_NUMROWS($result_mails) > 0) { +if (!SQL_HASZERONUMS($result_mails)) { // Okay, check for their sender's while ($content = SQL_FETCHARRAY($result_mails)) { // Check now... diff --git a/inc/autopurge/purge-unconfirmed.php b/inc/autopurge/purge-unconfirmed.php index 8b94274b75..162b4f6f48 100644 --- a/inc/autopurge/purge-unconfirmed.php +++ b/inc/autopurge/purge-unconfirmed.php @@ -59,7 +59,7 @@ WHERE `status`='UNCONFIRMED' AND `joined` < (UNIX_TIMESTAMP() - {?ap_unconfirmed_time?}) ORDER BY `userid` ASC", __FILE__, __LINE__); - if (SQL_NUMROWS($result_uncon) > 0) { + if (!SQL_HASZERONUMS($result_uncon)) { // Prepare variable... $userids = ''; $content['time'] = (getConfig('ap_unconfirmed_time') / 60 / 60); diff --git a/inc/filter-functions.php b/inc/filter-functions.php index 316bc6c93a..d0e881ae8c 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -71,7 +71,7 @@ ORDER BY `filter_id` ASC", __FUNCTION__, __LINE__); // Are there entries? - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Load all filters while ($filterArray = SQL_FETCHARRAY($result)) { // Get filter name and function diff --git a/inc/fix_filters.php b/inc/fix_filters.php index b2762810fe..f18079a787 100644 --- a/inc/fix_filters.php +++ b/inc/fix_filters.php @@ -51,7 +51,7 @@ ORDER BY `filter_name` ASC, `filter_function` ASC', __FILE__, __LINE__); // Do we have entries? (we should have!) -if (SQL_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // Load row by row while ($filter = SQL_FETCHARRAY($result)) { // Now search again for this filter and get it's total count diff --git a/inc/functions.php b/inc/functions.php index fbfc362017..69d696e544 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -907,7 +907,7 @@ function sendRawRequest ($host, $request) { $useProxy = false; // Are proxy settins set? - if ((isConfigEntrySet('proxy_host')) && (getConfig('proxy_host') != '') && (isConfigEntrySet('proxy_port')) && (getConfig('proxy_port') > 0)) { + if (isProxyUsed()) { // Then use it $useProxy = true; } // END - if @@ -1919,13 +1919,13 @@ function determineReferalId () { } elseif (isGetRequestParameterSet('ref')) { // Set refid=ref (the referal link uses such variable) $GLOBALS['refid'] = secureString(getRequestParameter('ref')); - } elseif ((isSessionVariableSet('refid')) && (getSession('refid') > 0)) { + } elseif ((isSessionVariableSet('refid')) && (isValidUserId(getSession('refid')))) { // Set session refid als global $GLOBALS['refid'] = bigintval(getSession('refid')); } elseif ((isExtensionInstalledAndNewer('user', '0.3.4')) && (isRandomReferalIdEnabled())) { // Select a random user which has confirmed enougth mails $GLOBALS['refid'] = determineRandomReferalId(); - } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (getConfig('def_refid') > 0)) { + } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getConfig('def_refid')))) { // Set default refid as refid in URL $GLOBALS['refid'] = getConfig('def_refid'); } else { @@ -1934,7 +1934,7 @@ function determineReferalId () { } // Set cookie when default refid > 0 - if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((getSession('refid') == '0') && (isConfigEntrySet('def_refid')) && (getConfig('def_refid') > 0))) { + if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((!isValidUserId(getSession('refid'))) && (isConfigEntrySet('def_refid')) && (isValidUserId(getConfig('def_refid'))))) { // Default is not found $found = false; diff --git a/inc/gen_refback.php b/inc/gen_refback.php index 47d20055ba..0ffa66449a 100644 --- a/inc/gen_refback.php +++ b/inc/gen_refback.php @@ -47,7 +47,7 @@ loadIncludeOnce('inc/libs/refback_functions.php'); // Sanity-check: Do we have ref level 0? $result = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0", __FILE__, __LINE__); -if (SQL_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // Remove index temporaly SQL_ALTER_TABLE("ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`", __FILE__, __LINE__); @@ -78,7 +78,7 @@ ORDER BY u.userid ASC', __FILE__, __LINE__); // Do we have entries? -if (SQL_NUMROWS($result_direct) > 0) { +if (!SQL_HASZERONUMS($result_direct) > 0) { // When 'walk' through all users while ($content = SQL_FETCHARRAY($result_direct)) { // Init level diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index 8570debddf..55fb01e9ce 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -151,7 +151,7 @@ function addBonusRanks ($data, $type, $userid) { // Load rankings $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s ORDER BY `level` ASC LIMIT {?bonus_lines?}", array($type, $data), __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Start generating the ranking list $max = SQL_NUMROWS($result); @@ -240,7 +240,7 @@ function handleBonusPoints ($mode) { // Subtract points from... switch (getConfig('bonus_mode')) { case 'JACKPOT': // ... jackpot - if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) == -1) && (getConfig('bonus_userid') > 0)) { + if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) == -1) && (isValidUserId(getConfig('bonus_userid')))) { if ($total >= $points) { // Subtract points from userid's account subtractPointsFromJackpot('bonus_payout_jackpot', getConfig('bonus_userid'), $points); diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index ba8b2902d0..5e331bd71e 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -86,7 +86,7 @@ LIMIT %s", $limit ), __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // List entries $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { @@ -146,7 +146,7 @@ function getDoublerTotalPointsLeft() { if (!empty($jackpot)) $points += $jackpot; } // END - if - if (getConfig('doubler_userid') > 0) { + if (isValidUserId(getConfig('doubler_userid'))) { // Get user's points $user = countSumTotalData(getConfig('doubler_userid'), 'user_points', 'points'); $points += $user; diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index da20b81374..246e054dfc 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -366,7 +366,7 @@ ORDER BY `network_short_name` ASC", __FUNCTION__, __LINE__); // Do we have entries? - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // List all entries $rows = array(); while ($row = SQL_FETCHARRAY($result)) { @@ -410,7 +410,7 @@ ORDER BY ), __FUNCTION__, __LINE__); // Do we have entries? - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // List all entries $rows = array(); while ($row = SQL_FETCHARRAY($result)) { @@ -454,7 +454,7 @@ ORDER BY t.`network_type_handle` ASC", __FUNCTION__, __LINE__); // Do we have entries? - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // List all entries $rows = array(); while ($row = SQL_FETCHARRAY($result)) { @@ -618,7 +618,7 @@ function doAdminNetworkProcessAddnetworkForm () { // Displays selected networks for editing function doAdminNetworkProcessHandlenetworkForm () { // Do we have selections? - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // Something has been selected, so start displaying one by one $OUT = ''; foreach (postRequestParameter('sel') as $id => $sel) { @@ -684,7 +684,7 @@ function doAdminNetworkProcessHandlenetworkForm () { // Handle network type form function doAdminNetworkProcessHandlenetworktypeForm () { // Do we have selections? - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // Load network data $networkData = getNetworkDataById(getRequestParameter('network')); @@ -742,7 +742,7 @@ function doAdminNetworkProcessHandlenetworktypeForm () { // Handle network request parameter form function doAdminNetworkProcessHandlerequestparamsForm () { // Do we have selections? - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // Init cache array $GLOBALS['network_params_disabled'] = array(); @@ -812,7 +812,7 @@ function doAdminNetworkProcessHandlerequestparamsForm () { // Changes given networks function doAdminNetworkProcessChangenetworkForm () { // Do we have selections? - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // By default nothing is updated $updated = 0; @@ -857,7 +857,7 @@ function doAdminNetworkProcessChangenetworkForm () { // Removes given networks function doAdminNetworkProcessRemovenetworkForm () { // Do we have selections? - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // By default nothing is removed $removed = 0; @@ -926,7 +926,7 @@ function doAdminNetworkProcessAddnetworktypeForm () { // Changes given network type handlers function doAdminNetworkProcessChangenetworktypeForm () { // Do we have selections? - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // By default nothing is updated $updated = 0; @@ -977,7 +977,7 @@ function doAdminNetworkProcessChangenetworktypeForm () { // Changes given network request parameters function doAdminNetworkProcessChangenetworkparamForm () { // Do we have selections? - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // By default nothing is updated $updated = 0; @@ -1028,7 +1028,7 @@ function doAdminNetworkProcessChangenetworkparamForm () { // Removes given network type handlers function doAdminNetworkProcessRemovenetworktypeForm () { // Do we have selections? - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // By default nothing is removed $removed = 0; @@ -1055,7 +1055,7 @@ function doAdminNetworkProcessRemovenetworktypeForm () { // Removes given network request parameters function doAdminNetworkProcessRemovenetworkparamForm () { // Do we have selections? - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // By default nothing is removed $removed = 0; diff --git a/inc/libs/online_functions.php b/inc/libs/online_functions.php index 14c8503b62..73ff9147fb 100644 --- a/inc/libs/online_functions.php +++ b/inc/libs/online_functions.php @@ -59,7 +59,7 @@ function FILTER_UPDATE_ONLINE_LIST () { $isAdmin = 'N'; // Valid userid? - if ((isMemberIdSet()) && (getMemberId() > 0) && (isMember())) { + if (isMember()) { // Is valid user $userid = getMemberId(); $isMember = 'Y'; diff --git a/inc/libs/payout_functions.php b/inc/libs/payout_functions.php index 8cdac37d2b..492eeda10e 100644 --- a/inc/libs/payout_functions.php +++ b/inc/libs/payout_functions.php @@ -56,7 +56,7 @@ WHERE ORDER BY `type` ASC", array($points), __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Now let's check while ($content = SQL_FETCHARRAY($result)) { // Are these points enougth? diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 62bc2a03cb..a840198c4a 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -193,7 +193,7 @@ ORDER BY array($rallye), __FUNCTION__, __LINE__); // Entries found? - if (SQL_NUMROWS($result_prices) > 0) { + if (!SQL_HASZERONUMS($result_prices)) { // Load prices if ($mode == "\n") $prices = '{--RALLYE_MEMBER_PRICES_ADDED--}:' . $mode . '------------------------------' . $mode; @@ -775,7 +775,7 @@ WHERE `expired`='Y'", array($EXPIRE), __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result_rallye) > 0) { + if (!SQL_HASZERONUMS($result_rallye)) { // Init SQLs initSqls(); diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index bc50b0a209..69f7fe73ca 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -163,7 +163,7 @@ ORDER BY // Entries found? //* DEBUG: */ print(__FUNCTION__ . '(' . __LINE__."):numRows=".SQL_NUMROWS($result)."
"); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Add all while ($content = SQL_FETCHARRAY($result)) { //* DEBUG: */ print(__FUNCTION__ . '(' . __LINE__."):rid={$rid},level={$level},userid={$content['userid']}
"); @@ -308,7 +308,7 @@ ORDER BY array(bigintval($userid), bigintval($level)), __FUNCTION__, __LINE__); // Are there some entries? - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Fetch all entries while ($row = SQL_FETCHARRAY($result)) { // Add row diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index e34ccd2b50..abe48e3d13 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -87,7 +87,7 @@ function registerGenerateCategoryTable ($mode, $return=false) { $result = SQL_QUERY("SELECT `id`, `cat`, `visible` FROM `{?_MYSQL_PREFIX?}_cats` ".$AND." ORDER BY `sort` ASC", __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // List alle visible modules (or all to the admin) $OUT .= ''; while ($content = SQL_FETCHARRAY($result)) { diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index 76296b04e9..81810de1d1 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -276,18 +276,32 @@ function addSponsorMenu ($current) { if (isAdmin()) $WHERE = ''; // Load main menu entries - $result_main = SQL_QUERY("SELECT action AS main_action, title AS main_title FROM `{?_MYSQL_PREFIX?}_sponsor_menu` -WHERE (`what`='' OR `what` IS NULL) ".$WHERE." -ORDER BY `sort`", __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result_main) > 0) { + $result_main = SQL_QUERY("SELECT + `action` AS `main_action`, `title` AS `main_title` +FROM + `{?_MYSQL_PREFIX?}_sponsor_menu` +WHERE + (`what`='' OR `what` IS NULL) + ".$WHERE." +ORDER BY + `sort` ASC", __FUNCTION__, __LINE__); + if (!SQL_HASZERONUMS($result_main)) { // Load every menu and it's sub menus while ($content = SQL_FETCHARRAY($result_main)) { // Load sub menus - $result_sub = SQL_QUERY_ESC("SELECT what AS sub_what, title AS sub_title FROM `{?_MYSQL_PREFIX?}_sponsor_menu` -WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$WHERE." -ORDER BY `sort`", + $result_sub = SQL_QUERY_ESC("SELECT + `what` AS `sub_what`, `title` AS `sub_title` +FROM + `{?_MYSQL_PREFIX?}_sponsor_menu` +WHERE + `action`='%s' AND + `what` != '' AND + `what` IS NOT NULL + ".$WHERE." +ORDER BY + `sort` ASC", array($content['main_action']), __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result_sub) > 0) { + if (!SQL_HASZERONUMS($result_sub)) { // Load sub menus $SUB = ''; while ($content2 = SQL_FETCHARRAY($result_sub)) { diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index fff246464e..9feb142f5a 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -565,7 +565,7 @@ ORDER BY ), __FUNCTION__, __LINE__); // Is there at least one record? - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Then load all! while ($dataRow = SQL_FETCHARRAY($result)) { // Shall we group these results? @@ -1020,7 +1020,7 @@ function SURFBAR_LOCKDOWN_ID ($urlId) { function SURFBAR_PAY_POINTS () { // Remove it from the URL owner //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid='.SURFBAR_GET_USERID().',costs='.SURFBAR_GET_COSTS().'', false); - if (SURFBAR_GET_USERID() > 0) { + if (isValidUserId(SURFBAR_GET_USERID())) { subtractPoints(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), SURFBAR_GET_USERID(), SURFBAR_GET_COSTS()); } // END - if @@ -1510,7 +1510,7 @@ ORDER BY array(getMemberId()), __FUNCTION__, __LINE__); // Are there entries? - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Load all rows while ($row = SQL_FETCHARRAY($result)) { // Add the row @@ -1535,7 +1535,7 @@ function SURFBAR_GET_ARRAY_FROM_STATUS ($status) { array($status), __FUNCTION__, __LINE__); // Some entries there? - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Load all actions // @TODO This can be somehow rewritten while ($content = SQL_FETCHARRAY($result)) { diff --git a/inc/mails/beg_mails.php b/inc/mails/beg_mails.php index cb5fc1c283..b4ea70bfd0 100644 --- a/inc/mails/beg_mails.php +++ b/inc/mails/beg_mails.php @@ -91,7 +91,7 @@ if (!empty($sql)) { // Check for accounts to be notified $result_main = SQL_QUERY($sql, __FILE__, __LINE__); - if (SQL_NUMROWS($result_main) > 0) { + if (!SQL_HASZERONUMS($result_main)) { // Normal notification mails or bonus mails? $sentBonusMails = ((getConfig('beg_notify_bonus') > 0) && ($mode == 'enable') && (isExtensionActive('bonus'))); diff --git a/inc/mails/bonus_mails.php b/inc/mails/bonus_mails.php index 7696dbf933..c236c76b44 100644 --- a/inc/mails/bonus_mails.php +++ b/inc/mails/bonus_mails.php @@ -93,7 +93,7 @@ if (!empty($sql)) { // Check for accounts to be notified $result_main = SQL_QUERY($sql, __FILE__, __LINE__); - if (SQL_NUMROWS($result_main) > 0) { + if (!SQL_HASZERONUMS($result_main)) { // Okay lets notify all users! while ($content = SQL_FETCHARRAY($result_main)) { // Update account diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index e4296a066b..12d20dcf4a 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -256,7 +256,7 @@ ORDER BY `id` DESC", __FUNCTION__, __LINE__); // Do we have entries? - if (SQL_NUMROWS($result_main) > 0) { + if (!SQL_HASZERONUMS($result_main)) { $OUT .= '
'; diff --git a/inc/modules/guest/what-stats.php b/inc/modules/guest/what-stats.php index 38ea6bbf47..9dd3fe9102 100644 --- a/inc/modules/guest/what-stats.php +++ b/inc/modules/guest/what-stats.php @@ -194,7 +194,7 @@ switch (getConfig('guest_stats')) { $mem_t10 = SQL_QUERY("SELECT `counter`, `title` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `counter` > 0".$AND." ORDER BY `counter` DESC LIMIT 0,10", __FILE__, __LINE__); $OUT = ''; - if (SQL_NUMROWS($guest_t10) > 0) { + if (!SQL_HASZERONUMS($guest_t10)) { // Guest clicks $OUT .= loadTemplate('guest_stats_header', true, '{--GUEST_TOP_GUEST_STATS--}'); while ($content = SQL_FETCHARRAY($guest_t10)) { @@ -203,7 +203,7 @@ switch (getConfig('guest_stats')) { } // END - while } // END - if - if (SQL_NUMROWS($mem_t10) > 0) { + if (!SQL_HASZERONUMS($mem_t10)) { // Member clicks $OUT .= loadTemplate('guest_stats_header', true, '{--GUEST_TOP_MEMBER_STATS--}'); while ($content = SQL_FETCHARRAY($mem_t10)) { @@ -212,7 +212,7 @@ switch (getConfig('guest_stats')) { } // END - while } // END - if - if ((SQL_NUMROWS($guest_t10) > 0) || (SQL_NUMROWS($mem_t10) > 0)) { + if ((!SQL_HASZERONUMS($guest_t10)) || (!SQL_HASZERONUMS($mem_t10))) { // Prepare content $content = array( 'rows' => $OUT, diff --git a/inc/modules/guest/what-wernis_portal.php b/inc/modules/guest/what-wernis_portal.php index 7a29cbe3e1..126a08492f 100644 --- a/inc/modules/guest/what-wernis_portal.php +++ b/inc/modules/guest/what-wernis_portal.php @@ -70,7 +70,7 @@ $rdf->set_Options( ); // Use proxy? -if ((getConfig('proxy_host') != '') && (getConfig('proxy_port') > 0)) { +if (isProxyUsed()) { // Set proxy data $rdf->set_proxy(getConfig('proxy_host'), getConfig('proxy_port')); diff --git a/inc/modules/member/what-beg2.php b/inc/modules/member/what-beg2.php index b5f03912f6..a0ff700d63 100644 --- a/inc/modules/member/what-beg2.php +++ b/inc/modules/member/what-beg2.php @@ -81,7 +81,7 @@ LIMIT {?beg_ranks?}", // Reset temporary variable and check for users $OUT = ''; -if (SQL_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // Load our winners... $cnt = 1; while ($content = SQL_FETCHARRAY($result)) { diff --git a/inc/modules/member/what-bonus.php b/inc/modules/member/what-bonus.php index c6191e92ff..6f88dcfa5d 100644 --- a/inc/modules/member/what-bonus.php +++ b/inc/modules/member/what-bonus.php @@ -94,7 +94,7 @@ LIMIT {?bonus_ranks?}", // Reset temporary variable and check for users $OUT = ''; -if (SQL_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // Load our winners... $cnt = 1; while ($content = SQL_FETCHARRAY($result)) { diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index d6744299fa..281248a795 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -444,7 +444,7 @@ FROM ".$whereStatement." ORDER BY `sort` ASC", __FILE__, __LINE__); - if (SQL_NUMROWS($result_cats) > 0) { + if (!SQL_HASZERONUMS($result_cats)) { if ($total > 0) { // Initialize array... $categories = array( @@ -534,7 +534,7 @@ LIMIT 1", $result = SQL_QUERY("SELECT `id`, `price`, `payment`, `mail_title` FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `payment` ASC", __FILE__, __LINE__); $types = array(); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Check for message id in URL $message = getMessageFromErrorCode(getRequestParameter('code')); diff --git a/inc/modules/member/what-payout.php b/inc/modules/member/what-payout.php index 246e0e3140..edb05b8042 100644 --- a/inc/modules/member/what-payout.php +++ b/inc/modules/member/what-payout.php @@ -77,7 +77,7 @@ WHERE ORDER BY `type` ASC", array($totalPoints), __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Free memory SQL_FREERESULT($result); @@ -95,7 +95,7 @@ WHERE ORDER BY p.payout_timestamp DESC", array(getMemberId()), __FILE__, __LINE__); - if (SQL_NUMROWS($result_payouts) > 0) { + if (!SQL_HASZERONUMS($result_payouts)) { // List all his requests $OUT = ''; while ($content = SQL_FETCHARRAY($result_payouts)) { diff --git a/inc/modules/member/what-refback.php b/inc/modules/member/what-refback.php index 128e19c846..b69124c94c 100644 --- a/inc/modules/member/what-refback.php +++ b/inc/modules/member/what-refback.php @@ -108,7 +108,7 @@ ORDER BY r.level ASC', __FILE__, __LINE__); // Are there some entries? (Shall be!) -if (SQL_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // List all levels $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { diff --git a/inc/modules/member/what-reflinks.php b/inc/modules/member/what-reflinks.php index 2e838689b8..c25d3ff012 100644 --- a/inc/modules/member/what-reflinks.php +++ b/inc/modules/member/what-reflinks.php @@ -69,7 +69,7 @@ $whereStatement = " WHERE `visible`='Y'"; if (isAdmin()) $whereStatement = ''; $result = SQL_QUERY("SELECT `id`, `url`, `alternate`, `counter`, `clicks` FROM `{?_MYSQL_PREFIX?}_refbanner`", __FILE__, __LINE__); -if (SQL_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // List available ref banners $OUT = ''; while ($row = SQL_FETCHARRAY($result)) { diff --git a/inc/modules/member/what-reflist.php b/inc/modules/member/what-reflist.php index d4b3e97f5e..cc34322a03 100644 --- a/inc/modules/member/what-reflist.php +++ b/inc/modules/member/what-reflist.php @@ -59,7 +59,7 @@ ORDER BY `level` ASC', __FILE__, __LINE__); // Are there some entries? (Shall be!) -if (SQL_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // List all levels $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { diff --git a/inc/modules/member/what-stats.php b/inc/modules/member/what-stats.php index 510dc049db..8a37457834 100644 --- a/inc/modules/member/what-stats.php +++ b/inc/modules/member/what-stats.php @@ -63,7 +63,7 @@ ORDER BY array(getMemberId()), __FILE__, __LINE__); // Are there mails left in pool? -if (SQL_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // Load all orders $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { @@ -95,7 +95,7 @@ ORDER BY `timestamp_ordered` DESC", array(getMemberId()), __FILE__, __LINE__); -if (SQL_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // Mail orders are in pool so we can display them $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index 699dc3d867..aad5bf37e2 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -88,7 +88,7 @@ switch ($mode) { $valid_reason = (isPostRequestParameterSet('reason')); // Test if a recipient is selected - $valid_recipient = (postRequestParameter('to_userid') > 0); + $valid_recipient = isValidUserId(postRequestParameter('to_userid')); // Check for nickname extension and set additional data // @TODO Rewrite this to a filter @@ -215,7 +215,7 @@ switch ($mode) { array(getMemberId()), __FILE__, __LINE__); } - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Load list $OUT = "