From: Roland Häder Date: Fri, 2 Jul 2010 03:28:02 +0000 (+0000) Subject: Naming convention, internal TODOs solved: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e5dde615db05fb62ebe91bd1c030f40c9b91fe17;p=mailer.git Naming convention, internal TODOs solved: - Naming convention says referal ids should be represented as 'refid' and not 'rid' which is to short - Internal TODO solved which wants us to make usage of addPointsFoo() function - TODOs.txt updated --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index e804898285..d62a9233a4 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -1,7 +1,7 @@ ### WARNING: THIS FILE IS AUTO-GENERATED BY ./DOCS/todo-builder.sh (uid=/user=quix0r) ### ### DO NOT EDIT THIS FILE. ### ./autoreg.php:60:// @TODO Add processing of request here -./beg.php:173: // @TODO Opps, what is missing here??? +./beg.php:172: // @TODO Opps, what is missing here??? ./birthday_confirm.php:99: // @TODO Try to rewrite the following unset() ./inc/autopurge/purge-inact.php:57: // @TODO Rewrite these if() blocks to a filter ./inc/cache/config-local.php:126:// @TODO Rewrite the following three constants, somehow... @@ -72,8 +72,7 @@ ./inc/libs/refback_functions.php:61: // @TODO Try to rewrite the following unset() ./inc/libs/register_functions.php:296: // @TODO Rewrite these all to a single filter ./inc/libs/register_functions.php:372: // @TODO Rewrite this to a filter -./inc/libs/register_functions.php:379: // @TODO Rewrite this whole if() block to addPointsThroughReferalSystem(). This will also make following if() block obsolete -./inc/libs/register_functions.php:380: // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable +./inc/libs/register_functions.php:379: // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable ./inc/libs/surfbar_functions.php:1540: // @TODO This can be somehow rewritten ./inc/libs/surfbar_functions.php:712:// @TODO Can't we use our new expression language instead of this ugly code? ./inc/libs/surfbar_functions.php:953: // @TODO Invalid salt should be refused @@ -176,10 +175,11 @@ ./inc/modules/member/what-unconfirmed.php:143: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() ./inc/modules/order.php:76: // @TODO Unused: 2,4 ./inc/monthly/monthly_bonus.php:69: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1410: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() -./inc/mysql-manager.php:1510: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1890: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1934:// @TODO Fix inconsistency between last_module and getWhat() +./inc/mysql-manager.php:1164: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:1411: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() +./inc/mysql-manager.php:1511: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:1891: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:1935:// @TODO Fix inconsistency between last_module and getWhat() ./inc/mysql-manager.php:370: // @TODO Try to rewrite this to one or more functions ./inc/mysql-manager.php:46:// @TODO Can we cache this? ./inc/reset/reset_beg.php:51:// @TODO This should be converted in a daily beg rallye diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index 6606d3f6ee..d85a405b13 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -44,16 +44,16 @@ if (!defined('__SECURITY')) { // Add points to user or begging rallye account function addPointsBeg ($userid, $points) { - // Set mode depending on how many mails the member has to confirm - $locked = false; - if ((getConfig('ref_payout') > 0) && (getConfig('allow_direct_pay') != 'Y')) $locked = true; - // Is begging rallye active? if (getConfig('beg_rallye') == 'Y') { // Add points to rallye account SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1", array($points, $userid), __FUNCTION__, __LINE__); } else { + // Set mode depending on how many mails the member has to confirm + $locked = false; + if ((getConfig('ref_payout') > 0) && (getConfig('allow_direct_pay') != 'Y')) $locked = true; + // Add points to account // @TODO Try to rewrite the following unset() unset($GLOBALS['ref_level']); diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index 5e331bd71e..b9a603e4e2 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -103,12 +103,7 @@ LIMIT %s", } // END - if // Prepare data for the row template - $content = array( - 'userid' => $content['userid'], - 'rid' => $content['refid'], - 'points' => $content['points'], - 'timemark' => generateDateTime($content['timemark'], $DT_MODE), - ); + $content['timemark'] = generateDateTime($content['timemark'], $DT_MODE); // Load template and switch color $OUT .= loadTemplate($mode . '_doubler_list_rows', true, $content); diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 69f7fe73ca..844bc83f10 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -144,9 +144,9 @@ function getRefbackPercents ($userid, $ref) { } // "Getter" for userid array which will return only one entry -function getArrayFromRefbackLevel ($rid, $level) { +function getArrayFromRefbackLevel ($refid, $level) { //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
"); return $userIds; } @@ -228,7 +228,8 @@ function updateRefbackTable ($userid) { array(bigintval($userid), $GLOBALS['refback_level'], bigintval($GLOBALS['refback_refid'][$GLOBALS['refback_level']])), __FUNCTION__, __LINE__); // Move to next referal level and count his counter one up! - $GLOBALS['refback_level']++; updateRefbackTable($GLOBALS['refback_refid'][($GLOBALS['refback_level'] - 1)]); + $GLOBALS['refback_level']++; + updateRefbackTable($GLOBALS['refback_refid'][($GLOBALS['refback_level'] - 1)]); } // END - if // Do we have another level here? diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index abe48e3d13..665a4b7873 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -376,26 +376,8 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF } // END - if // Write his welcome-points - // @TODO Rewrite this whole if() block to addPointsThroughReferalSystem(). This will also make following if() block obsolete // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`=0 LIMIT 1", - array($userid), __FUNCTION__, __LINE__); - if (SQL_HASZERONUMS($result)) { - // Add only when the line was not found (maybe some more secure?) - $locked = 'points'; - - // Pay him later. First he has to confirm some mails! - if (getConfig('ref_payout') > 0) $locked = 'locked_points'; - - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`, `ref_depth`, `%s`) VALUES (%s,0,'{?points_register?}')", - array($locked, $userid), __FUNCTION__, __LINE__); - - // Update mediadata as well - if ((isExtensionInstalledAndNewer('mediadata', '0.0.4')) && ($locked == 'points')) { - // Update database - updateMediadataEntry(array('total_points'), 'add', getConfig('points_register')); - } // END - if - } // END - if + addPointsDirectly('register_welcome', $userid, getConfig('points_register')); // Write catgories if ((is_array(postRequestParameter('cat'))) && (count(postRequestParameter('cat')))) { diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index beff7d490e..43e15afc41 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -125,7 +125,8 @@ if (isFormSent()) { if ((getConfig('ref_payout') == '0') && (postRequestParameter('ref_payout') > 0)) { // Update account's ref_payout for "must-confirm" addSql(sprintf("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_payout`=(%s - `mails_confirmed`) -WHERE `mails_confirmed` < %s", $REF, $REF)); +WHERE + `mails_confirmed` < %s", $REF, $REF)); } elseif ((getConfig('ref_payout') > 0) && (postRequestParameter('ref_payout') == '0')) { // Update account's ref_payout for "not-must-confirm" addSql("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_payout`=0 WHERE `ref_payout` > 0"); diff --git a/inc/modules/admin/what-list_sponsor.php b/inc/modules/admin/what-list_sponsor.php index 32ad71a64a..1e9ff87d4f 100644 --- a/inc/modules/admin/what-list_sponsor.php +++ b/inc/modules/admin/what-list_sponsor.php @@ -86,10 +86,10 @@ WHERE // Sponsor not found loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_SPONSOR_404', bigintval(getRequestParameter('id')))); } -} elseif (isGetRequestParameterSet('rid')) { +} elseif (isGetRequestParameterSet('refid')) { // Search for sponsor $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `id`='%s' LIMIT 1", - array(bigintval(getRequestParameter('rid'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('refid'))), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Free memory SQL_FREERESULT($result); @@ -105,7 +105,7 @@ WHERE `refid`='%s' ORDER BY `id` ASC", - array(bigintval(getRequestParameter('rid'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('refid'))), __FILE__, __LINE__); if (!SQL_HASZERONUMS($result)) { // List refs now @@ -113,11 +113,11 @@ ORDER BY SQL_FREERESULT($result); } else { // No refs made so far - loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_SPONSOR_REFS_404', '' . bigintval(getRequestParameter('rid')) . '')); + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_SPONSOR_REFS_404', '' . bigintval(getRequestParameter('refid')) . '')); } } else { // Sponsor not found - loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_SPONSOR_404', bigintval(getRequestParameter('rid')))); + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_SPONSOR_404', bigintval(getRequestParameter('refid')))); } } else { // List all sponsors diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 283fd4b02d..105ea2961e 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -989,12 +989,12 @@ function getReferalLevelPercents ($level) { * userid = Referal id wich should receive... * points = ... xxx points * sendNotify = shall I send the referal an email or not? - * rid = inc/modules/guest/what-confirm.php need this + * refid = 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 $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, $refid = '0', $locked = false, $add_mode = 'ref') { //* DEBUG: */ debugOutput('----------------------- ' . __FUNCTION__ . ' - ENTRY ------------------------