- // Remove link from table
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE id=%s LIMIT 1",
- array(bigintval($lid)), __FILE__, __LINE__);
-
- // Load total points
- define('__TOTAL_POINTS', TRANSLATE_COMMA(
- GET_TOTAL_DATA($url_uid, "user_points", "points") -
- GET_TOTAL_DATA($url_uid, "user_data", "used_points"))
- );
-
- // Load template
- LOAD_TEMPLATE($template);
- }
- else
- {
- // Wrong image code! So add points to sender's account
- $DEPTH = 0;
- ADD_POINTS_REFSYSTEM($sender, $payment, false, 0, false, "direct");
+ // Export data into constants for the template
+ define('_POINTS_VALUE' , translateComma($payment));
+ define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true));
+
+ // Only when user extension = v0.1.2: Update mails-confirmed counter
+ // @TODO Rewrite these blocks to filter
+ if (GET_EXT_VERSION('user') >= '0.1.2') {
+ // Update counter
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET mails_confirmed=mails_confirmed + 1 WHERE userid=%s LIMIT 1",
+ array($url_uid), __FILE__, __LINE__);
+
+ // Update random confirmed as well?
+ if (GET_EXT_VERSION('user') >= '0.3.4') {
+ // Update second counter
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET rand_confirmed=rand_confirmed + 1 WHERE userid=%s LIMIT 1",
+ array($url_uid), __FILE__, __LINE__);
+ } // END - if
+ } // END - if
+
+ // Insert stats record
+ insertUserStatsRecord($url_uid, $type, $stats_data);
+
+ // Right code entered?
+ if (bigintval(REQUEST_POST('gfx_check')) == $img_code) {
+ // Add points over referal system is the default
+ $locked = false;
+ $template = 'mailid_points_done';
+
+ // Right code entered add points and remove entry
+ if (($ref_pay > 0) && (getConfig('allow_direct_pay') != 'Y')) {
+ // Don't add points over the referal system
+ $locked = true;
+ $template = 'mailid_points_locked';
+ } // END - if
+
+ // Count down ref_payout value
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=ref_payout-1 WHERE userid=%s AND ref_payout > 0 LIMIT 1",
+ array($url_uid), __FILE__, __LINE__);
+
+ // Add points
+ unset($GLOBALS['ref_level']);
+ ADD_POINTS_REFSYSTEM('mailid_okay', $url_uid, $payment, false, '0', $locked);
+
+ // Shall I add bonus points for "turbo clickers" ?
+ if (GET_EXT_VERSION('bonus') >= '0.2.2') {
+ // Is an active-rallye running and this is not a notification mail?
+ if ((getConfig('bonus_active') == 'Y') && ($notify == 'N')) {
+ // Shall I exclude the webmaster's own userid from the active-rallye?
+ if ((((getConfig('bonus_uid') == $url_uid) && (getConfig('bonus_include_own') == 'Y')) || (getConfig('bonus_uid') != $url_uid)) && (getConfig('def_refid') != $url_uid)) {
+ // Add points and remember ranking are done in this function....
+ BONUS_ADD_TURBO_POINTS($urlId, $url_uid, $type);
+
+ // Set template to mailid_points_done2 which contains a link to the ranking list
+ $template = 'mailid_points_done2';
+ if ($locked) $template = 'mailid_points_locked2';
+ define('_UID_VALUE' , $url_uid);
+ define('_TYPE_VALUE', $type);
+ define('_DATA_VALUE', translateComma($urlId));
+ } // END - if
+ } // END - if
+ } // END - if
+
+ // Load total points
+ define('__TOTAL_POINTS', translateComma(
+ GET_TOTAL_DATA($url_uid, 'user_points', 'points') -
+ GET_TOTAL_DATA($url_uid, 'user_data', 'used_points'))
+ );
+
+ // Load template
+ LOAD_TEMPLATE($template);
+ } else {
+ // Wrong image code! So add points to sender's account
+ unset($GLOBALS['ref_level']);
+ ADD_POINTS_REFSYSTEM_DIRECT('mailid_payback', $sender, $payment);
+
+ // Load template
+ LOAD_TEMPLATE('mailid_points_failed');
+ }