From: Roland Häder Date: Sun, 22 Aug 2010 13:39:59 +0000 (+0000) Subject: Moved for preparation of filters in user confirmation, TODOs.txt updated X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=53aff78b88e6e8756f0aa21bb30a5f6b3c569211;p=mailer.git Moved for preparation of filters in user confirmation, TODOs.txt updated --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 42bf640d8c..214df446bc 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -40,12 +40,12 @@ ./inc/extensions-functions.php:434:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) ./inc/extensions-functions.php:564: // @TODO Extension is loaded, what next? ./inc/functions.php:112: // @TODO Extension 'msg' does not exist -./inc/functions.php:1493: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? -./inc/functions.php:1516: // @TODO Rewrite this old lost code to a template -./inc/functions.php:1584: // @TODO Are these convertions still required? -./inc/functions.php:1602:// @TODO Rewrite this function to use readFromFile() and writeToFile() -./inc/functions.php:175:// @TODO Rewrite this to an extension 'smtp' -./inc/functions.php:2258: // @TODO This is still very static, rewrite it somehow +./inc/functions.php:1499: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? +./inc/functions.php:1522: // @TODO Rewrite this old lost code to a template +./inc/functions.php:1590: // @TODO Are these convertions still required? +./inc/functions.php:1608:// @TODO Rewrite this function to use readFromFile() and writeToFile() +./inc/functions.php:181:// @TODO Rewrite this to an extension 'smtp' +./inc/functions.php:2264: // @TODO This is still very static, rewrite it somehow ./inc/gen_sql_patches.php:96:// @TODO Rewrite this to a filter ./inc/install-functions.php:59: // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0); ./inc/language/de.php:1116:// @TODO Rewrite these two constants @@ -147,7 +147,6 @@ ./inc/modules/admin/what-usage.php:89: // @TODO This code is double, see loadTemplate() and loadEmailTemplate() in functions.php ./inc/modules/admin/what-usr_online.php:51: // @TODO Add a filter for sponsor ./inc/modules/guest/what-beg.php:53:// @TODO No more needed? define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_userid_timeout'))); -./inc/modules/guest/what-confirm.php:111: // @TODO Try to rewrite the following unset() ./inc/modules/guest/what-login.php:123: // @TODO Move this HTML code into a template ./inc/modules/guest/what-mediadata.php:183:// @TODO Rewrite all these if-blocks to filters ./inc/modules/guest/what-mediadata.php:70: // @TODO Find a better formular than this one @@ -178,19 +177,20 @@ ./inc/mysql-manager.php:1536: // @TODO Rewrite this to a filter ./inc/mysql-manager.php:1903: // @TODO Rewrite this to a filter ./inc/mysql-manager.php:1947:// @TODO Fix inconsistency between last_module and getWhat() +./inc/mysql-manager.php:2022: // @TODO Try to rewrite the following unset() ./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 ./inc/reset/reset_birthday.php:91: // @TODO 4 is hard-coded here, should we move it out in config? ./inc/revision-functions.php:153:// @TODO Please describe this function -./inc/template-functions.php:1136: // @TODO This can be easily moved out after the merge from EL branch to this is complete -./inc/template-functions.php:1169: // @TODO Add a little more infos here -./inc/template-functions.php:1457:// @TODO Lame description for this function -./inc/template-functions.php:1476: // @TODO Move this in a filter +./inc/template-functions.php:1141: // @TODO This can be easily moved out after the merge from EL branch to this is complete +./inc/template-functions.php:1174: // @TODO Add a little more infos here +./inc/template-functions.php:1462:// @TODO Lame description for this function +./inc/template-functions.php:1481: // @TODO Move this in a filter ./inc/template-functions.php:189: * @TODO On some pages this is buggy ./inc/template-functions.php:265: // @TODO Remove this sanity-check if all is fine -./inc/template-functions.php:576:// @TODO $simple/$constants are deprecated -./inc/template-functions.php:603: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates +./inc/template-functions.php:579:// @TODO $simple/$constants are deprecated +./inc/template-functions.php:606: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates ./inc/wrapper-functions.php:132:// @TODO Implement $compress ./inc/wrapper-functions.php:139:// @TODO Implement $decompress ./inc/wrapper-functions.php:454:// @TODO Do some more sanity check here diff --git a/inc/modules/guest/what-confirm.php b/inc/modules/guest/what-confirm.php index ad16f5ea30..a971107401 100644 --- a/inc/modules/guest/what-confirm.php +++ b/inc/modules/guest/what-confirm.php @@ -45,108 +45,9 @@ if (!defined('__SECURITY')) { // Add description as navigation point addMenuDescription('guest', __FILE__); -// Init content -$content = array( - 'message' => '{--GUEST_CONFIRMED_FAILED--}', - 'userid' => 0, -); - if (isGetRequestParameterSet('hash')) { - // Initialize the user id - $userid = '0'; - - // Search for an unconfirmed or confirmed account - $result = SQL_QUERY_ESC("SELECT `userid`, `email`, `refid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1", - array(getRequestParameter('hash')), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { - // Ok, he want's to confirm now so we load some data - list($userid, $email, $refid) = SQL_FETCHROW($result); - - // Fetch user data - if (!fetchUserData($userid)) { - // Not found, should not happen - debug_report_bug(__FILE__, __LINE__, 'User account ' . $userid . ' not found.'); - } // END - if - - // Load all data and add points - $content = getUserDataArray(); - - // Unlock his account (but only when it is on UNCONFIRMED!) - SQL_QUERY_ESC("UPDATE - `{?_MYSQL_PREFIX?}_user_data` -SET - `status`='CONFIRMED', - `ref_payout`={?ref_payout?}, - `user_hash`=NULL -WHERE - `user_hash`='%s' AND - `status`='UNCONFIRMED' -LIMIT 1", - array(getRequestParameter('hash')), __FILE__, __LINE__); - if (SQL_AFFECTEDROWS() == 1) { - // Send email if updated - $message = loadEmailTemplate('confirm-member', $content, bigintval($userid)); - - // And send him right away the confirmation mail - sendEmail($email, '{--GUEST_THANX_CONFIRM--}', $message); - - // Maybe he got "referaled"? - if (($refid > 0) && ($refid != $userid)) { - // Select the referal userid - if (fetchUserData($refid)) { - // Update ref counter... - updateReferalCounter($refid); - - // If version matches add ref bonus to refid's account - if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) { - // Add points (directly only!) - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_ref`=`bonus_ref`+{?bonus_ref?} WHERE `userid`=%s LIMIT 1", - array(bigintval($refid)), __FILE__, __LINE__); - - // Subtract points from system - handleBonusPoints(getConfig('bonus_ref')); - } // END - if - - // Add one-time referal bonus over referal system or directly - // @TODO Try to rewrite the following unset() - unset($GLOBALS['ref_level']); - addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), true, bigintval($userid), getConfig('reg_points_mode')); - } // END - if - } // END - if - - if (isExtensionActive('rallye')) { - // Add user to rallye (or not?) - addUserToReferalRallye(bigintval($userid)); - } // END - if - - // Account confirmed! - if (isExtensionActive('lead')) { - // Set special lead cookie - setSession('lead_userid', bigintval($userid)); - - // Lead-Code mode enabled - redirectToUrl('lead-confirm.php'); - } else { - $content['message'] = '{--GUEST_CONFIRMED_DONE--}'; - $content['userid'] = bigintval($userid); - } - } elseif (isExtensionActive('lead')) { - // Set special lead cookie - setSession('lead_userid', bigintval($userid)); - - // Lead-Code mode enabled - redirectToUrl('lead-confirm.php'); - } else { - // Nobody was found unter this hash key... or our new member want's to confirm twice? - $content['message'] = '{--GUEST_CONFIRMED_TWICE--}'; - } - } else { - // Nobody was found unter this hash key... or our new member want's to confirm twice? - $content['message'] = '{--GUEST_CONFIRMED_TWICE--}'; - } - - // Load template - loadTemplate('admin_settings_saved', false, $content['message']); + // Do user account confirmation + doConfirmUserAccount(getRequestParameter('hash')); } elseif ((isFormSent()) && (isPostRequestParameterSet('email'))) { // Confirmation link requested 0 1 2 if (fetchUserData(postRequestParameter('email'), 'email')) { diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 18b9be1b48..1342824775 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1955,5 +1955,110 @@ function updateLastActivity($userid) { ), __FUNCTION__, __LINE__); } +// Confirms a user account +function doConfirmUserAccount () { + // Init content + $content = array( + 'message' => '{--GUEST_CONFIRMED_FAILED--}', + 'userid' => 0, + ); + + // Initialize the user id + $userid = '0'; + + // Search for an unconfirmed or confirmed account + $result = SQL_QUERY_ESC("SELECT `userid`, `email`, `refid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1", + array(getRequestParameter('hash')), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { + // Ok, he want's to confirm now so we load some data + list($userid, $email, $refid) = SQL_FETCHROW($result); + + // Fetch user data + if (!fetchUserData($userid)) { + // Not found, should not happen + debug_report_bug(__FILE__, __LINE__, 'User account ' . $userid . ' not found.'); + } // END - if + + // Load all data and add points + $content = getUserDataArray(); + + // Unlock his account (but only when it is on UNCONFIRMED!) + SQL_QUERY_ESC("UPDATE + `{?_MYSQL_PREFIX?}_user_data` +SET + `status`='CONFIRMED', + `ref_payout`={?ref_payout?}, + `user_hash`=NULL +WHERE + `user_hash`='%s' AND + `status`='UNCONFIRMED' +LIMIT 1", + array(getRequestParameter('hash')), __FILE__, __LINE__); + if (SQL_AFFECTEDROWS() == 1) { + // Send email if updated + $message = loadEmailTemplate('confirm-member', $content, bigintval($userid)); + + // And send him right away the confirmation mail + sendEmail($email, '{--GUEST_THANX_CONFIRM--}', $message); + + // Maybe he got "referaled"? + if (($refid > 0) && ($refid != $userid)) { + // Select the referal userid + if (fetchUserData($refid)) { + // Update ref counter... + updateReferalCounter($refid); + + // If version matches add ref bonus to refid's account + if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) { + // Add points (directly only!) + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_ref`=`bonus_ref`+{?bonus_ref?} WHERE `userid`=%s LIMIT 1", + array(bigintval($refid)), __FILE__, __LINE__); + + // Subtract points from system + handleBonusPoints(getConfig('bonus_ref')); + } // END - if + + // Add one-time referal bonus over referal system or directly + // @TODO Try to rewrite the following unset() + unset($GLOBALS['ref_level']); + addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), true, bigintval($userid), getConfig('reg_points_mode')); + } // END - if + } // END - if + + if (isExtensionActive('rallye')) { + // Add user to rallye (or not?) + addUserToReferalRallye(bigintval($userid)); + } // END - if + + // Account confirmed! + if (isExtensionActive('lead')) { + // Set special lead cookie + setSession('lead_userid', bigintval($userid)); + + // Lead-Code mode enabled + redirectToUrl('lead-confirm.php'); + } else { + $content['message'] = '{--GUEST_CONFIRMED_DONE--}'; + $content['userid'] = bigintval($userid); + } + } elseif (isExtensionActive('lead')) { + // Set special lead cookie + setSession('lead_userid', bigintval($userid)); + + // Lead-Code mode enabled + redirectToUrl('lead-confirm.php'); + } else { + // Nobody was found unter this hash key... or our new member want's to confirm twice? + $content['message'] = '{--GUEST_CONFIRMED_TWICE--}'; + } + } else { + // Nobody was found unter this hash key... or our new member want's to confirm twice? + $content['message'] = '{--GUEST_CONFIRMED_TWICE--}'; + } + + // Load template + loadTemplate('admin_settings_saved', false, $content['message']); +} + // [EOF] ?>