From e1cf98e08d4d92edf492396b82c67efa97a0ece8 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Tue, 12 Jul 2011 22:07:51 +0000
Subject: [PATCH] Minor cleanups/renaming

---
 DOCS/TODOs.txt                | 37 +++++++++--------
 autoreg.php                   |  4 +-
 inc/functions.php             |  6 +--
 inc/libs/rallye_functions.php |  1 +
 inc/pool/pool-bonus.php       | 28 ++++++-------
 inc/pool/pool-user.php        | 78 +++++++++++++++++------------------
 inc/template-functions.php    |  9 ++--
 inc/wrapper-functions.php     |  8 ++--
 mailid_top.php                |  2 +
 9 files changed, 91 insertions(+), 82 deletions(-)

diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt
index 6a46df3961..c24b10110e 100644
--- a/DOCS/TODOs.txt
+++ b/DOCS/TODOs.txt
@@ -68,10 +68,11 @@
 ./inc/libs/doubler_functions.php:44:// @TODO Lame description
 ./inc/libs/doubler_functions.php:91:			// @TODO Can't this be moved into EL?
 ./inc/libs/mailid_functions.php:47:		// @TODO Rewrite this to a dynamic include or so
-./inc/libs/rallye_functions.php:703:// @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId()
-./inc/libs/rallye_functions.php:768:	$EXPIRE = 3; // @TODO The hard-coded value...
-./inc/libs/rallye_functions.php:854:// @TODO Please document this function
-./inc/libs/rallye_functions.php:910:		// Load count @TODO Can't we rewrite this to our API?
+./inc/libs/rallye_functions.php:439:	// @TODO Deprecated variable and global statement, please try to rewrite this
+./inc/libs/rallye_functions.php:704:// @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId()
+./inc/libs/rallye_functions.php:769:	$EXPIRE = 3; // @TODO The hard-coded value...
+./inc/libs/rallye_functions.php:855:// @TODO Please document this function
+./inc/libs/rallye_functions.php:911:		// Load count @TODO Can't we rewrite this to our API?
 ./inc/libs/register_functions.php:290:	// @TODO Rewrite these all to a single filter
 ./inc/libs/sponsor_functions.php:159:					// @TODO Rewrite this to API function
 ./inc/libs/sponsor_functions.php:430:			// @TODO Rewrite this to API function
@@ -178,26 +179,28 @@
 ./inc/mysql-manager.php:44:// @TODO Can we cache this?
 ./inc/purge/purge-inact.php:55:	// @TODO Rewrite these if() blocks to a filter
 ./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array'
-./inc/template-functions.php:1069:			// @TODO Deprecate this thing
-./inc/template-functions.php:1080:			// @TODO Deprecate this thing
-./inc/template-functions.php:1173:	// @TODO This can be easily moved out after the merge from EL branch to this is complete
-./inc/template-functions.php:1206:		// @TODO Add a little more infos here
-./inc/template-functions.php:1520:// @TODO Lame description for this function
-./inc/template-functions.php:1542:			// @TODO Move this in a filter
+./inc/template-functions.php:1072:			// @TODO Deprecate this thing
+./inc/template-functions.php:1083:			// @TODO Deprecate this thing
+./inc/template-functions.php:1176:	// @TODO This can be easily moved out after the merge from EL branch to this is complete
+./inc/template-functions.php:1209:		// @TODO Add a little more infos here
+./inc/template-functions.php:1523:// @TODO Lame description for this function
+./inc/template-functions.php:1545:			// @TODO Move this in a filter
 ./inc/template-functions.php:189:	 * @TODO On some pages this is buggy
 ./inc/template-functions.php:269:		// @TODO Remove this sanity-check if all is fine
-./inc/template-functions.php:597:// @TODO $simple/$constants are deprecated
-./inc/template-functions.php:623:	// @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates
+./inc/template-functions.php:432:	// @TODO $DATA is deprecated and should be avoided and replaced with $content
+./inc/template-functions.php:598:// @TODO $simple/$constants are deprecated
+./inc/template-functions.php:624:	// @TODO Do only use $content and deprecate $DATA in templates
 ./inc/wrapper-functions.php:130:// @TODO Implement $compress
 ./inc/wrapper-functions.php:137:// @TODO Implement $decompress
 ./inc/wrapper-functions.php:514:// @TODO Do some more sanity check here
 ./mailid.php:139:					// @TODO Rewrite this to a filter
 ./mailid.php:96:		// @TODO Rewrite this to a filter
-./mailid_top.php:103:		// @TODO Rewrite this to a filter
-./mailid_top.php:136:					// @TODO Rewrite this to a filter
-./mailid_top.php:183:							// @TODO Rewrite this to a filter
-./mailid_top.php:190:									// @TODO Rewrite this to a filter
-./mailid_top.php:225:									// @TODO Rewrite these blocks to filter
+./mailid_top.php:105:		// @TODO Rewrite this to a filter
+./mailid_top.php:138:					// @TODO Rewrite this to a filter
+./mailid_top.php:185:							// @TODO Rewrite this to a filter
+./mailid_top.php:18: * @TODO Merge this script with mailid.php                              *
+./mailid_top.php:192:									// @TODO Rewrite this to a filter
+./mailid_top.php:227:									// @TODO Rewrite these blocks to filter
 ./network-check.php:54:// @TODO Add processing of request here
 ./show_bonus.php:105:			// @TODO No more needed? $content['points'] = translateComma($content['points']);
 ./view.php:68:		// @TODO No banner found, output some default banner
diff --git a/autoreg.php b/autoreg.php
index fbd0cc7902..54b0b9eb8f 100644
--- a/autoreg.php
+++ b/autoreg.php
@@ -6,9 +6,9 @@
  * -------------------------------------------------------------------- *
  * File              : autoreg.php                                      *
  * -------------------------------------------------------------------- *
- * Short description : The surfbar itself                               *
+ * Short description : API script for ext-autoreg                       *
  * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Die Surfbar selbst                               *
+ * Kurzbeschreibung  : API-Script fuer ext-autoreg                      *
  * -------------------------------------------------------------------- *
  * $Revision::                                                        $ *
  * $Date::                                                            $ *
diff --git a/inc/functions.php b/inc/functions.php
index eac1fc7359..ad6274eb2e 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1328,7 +1328,7 @@ function isUrlValidSimple ($url) {
 
 // Wtites data to a config.php-style file
 // @TODO Rewrite this function to use readFromFile() and writeToFile()
-function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
+function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $inserted, $seek=0) {
 	// Initialize some variables
 	$done = false;
 	$seek++;
@@ -1358,7 +1358,7 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
 					// Read from source file
 					$line = fgets ($fp, 1024);
 
-					if (strpos($line, $search) > -1) { 
+					if (strpos($line, $search) > -1) {
 						$next = '0';
 						$found = true;
 					} // END - if
@@ -1366,7 +1366,7 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
 					if ($next > -1) {
 						if ($next === $seek) {
 							$next = -1;
-							$line = $prefix . $DATA . $suffix . "\n";
+							$line = $prefix . $inserted . $suffix . "\n";
 						} else {
 							$next++;
 						}
diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php
index c301b593e0..13bc3b07de 100644
--- a/inc/libs/rallye_functions.php
+++ b/inc/libs/rallye_functions.php
@@ -436,6 +436,7 @@ LIMIT 1",
 
 //
 function markReferalRallyesAsExpired ($result) {
+	// @TODO Deprecated variable and global statement, please try to rewrite this
 	global $DATA;
 
 	// Load rallye data
diff --git a/inc/pool/pool-bonus.php b/inc/pool/pool-bonus.php
index b2a2020bd9..92c7608279 100644
--- a/inc/pool/pool-bonus.php
+++ b/inc/pool/pool-bonus.php
@@ -64,18 +64,18 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
 	if (!SQL_HASZERONUMS($result_bonus)) {
 		// Send these mails away...
 		$count2 = '';
-		while ($DATA = SQL_FETCHARRAY($result_bonus)) {
+		while ($mailData = SQL_FETCHARRAY($result_bonus)) {
 			// Message is active in queue
 			SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `data_type`='QUEUE' WHERE `id`=%s LIMIT 1",
-				array(bigintval($DATA['id'])), __FILE__, __LINE__);
+				array(bigintval($mailData['id'])), __FILE__, __LINE__);
 
 			// "Explode" all receivers into an array
-			if (isInString(';', $DATA['receivers'])) {
+			if (isInString(';', $mailData['receivers'])) {
 				// There's more than one receiver in the list...
-				$receivers = explode(';', $DATA['receivers']);
-			} elseif (!empty($DATA['points'])) {
+				$receivers = explode(';', $mailData['receivers']);
+			} elseif (!empty($mailData['points'])) {
 				// Only one user left
-				$receivers = array($DATA['receivers']);
+				$receivers = array($mailData['receivers']);
 			} else {
 				// No users left
 				$receivers = array(0);
@@ -91,21 +91,21 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
 					//* DEBUG: */ debugOutput('OK!/L:'.__LINE__);
 
 					// Remove receiver from list
-					$status = removeReceiver($dummy, $key, $userid, $DATA['id'], $DATA['id'], true);
+					$status = removeReceiver($dummy, $key, $userid, $mailData['id'], $mailData['id'], true);
 
 					// Did it work?
 					switch ($status) {
 						case 'done': // Done!
 							// Prepare the mail
-							$mailText = loadEmailTemplate('member_bonus_pool_normal', $DATA, $userid);
+							$mailText = loadEmailTemplate('member_bonus_pool_normal', $mailData, $userid);
 
 							// Send mail away
-							if (isset($DATA['html_msg'])) {
+							if (isset($mailData['html_msg'])) {
 								// Send HTML?
-								sendEmail(getUserData('userid'), $DATA['subject'], $mailText, $DATA['html_msg']);
+								sendEmail(getUserData('userid'), $mailData['subject'], $mailText, $mailData['html_msg']);
 							} else {
 								// No HTML mail!
-								sendEmail(getUserData('userid'), $DATA['subject'], $mailText);
+								sendEmail(getUserData('userid'), $mailData['subject'], $mailText);
 							}
 
 							// Count one up and remove entry from dummy array
@@ -126,7 +126,7 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
 							break;
 
 						default: // Unknown return type
-							logDebugMessage(__FILE__, __LINE__, 'Unknown status ' . $status . ' detected. pool_id=' . $DATA['id'] . ',userid=' . $DATA['userid'] . ',stats_id=' . $stats_id);
+							logDebugMessage(__FILE__, __LINE__, 'Unknown status ' . $status . ' detected. pool_id=' . $mailData['id'] . ',userid=' . $mailData['userid'] . ',stats_id=' . $stats_id);
 							break;
 					} // END - switch
 				} // END - if
@@ -154,7 +154,7 @@ SET
 WHERE
 	`id`=%s
 LIMIT 1",
-					array(bigintval($DATA['id'])), __FILE__, __LINE__);
+					array(bigintval($mailData['id'])), __FILE__, __LINE__);
 				//* DEBUG: */ debugOutput('*L:'.__LINE__.'*');
 
 				// Update mediadata if version is 0.0.4 or higher
@@ -177,7 +177,7 @@ LIMIT 1",
 					array(
 						countSelection($dummy),
 						implode(';', $dummy),
-						bigintval($DATA['id'])
+						bigintval($mailData['id'])
 					), __FILE__, __LINE__);
 				//* DEBUG: */ debugOutput('*L:'.__LINE__.'<pre>'.print_r($dummy, true).'</pre>!!!');
 				break;
diff --git a/inc/pool/pool-user.php b/inc/pool/pool-user.php
index 1ddd1a9959..77ab6bc037 100644
--- a/inc/pool/pool-user.php
+++ b/inc/pool/pool-user.php
@@ -78,24 +78,24 @@ $pointsBack = array(0);
 
 if (!SQL_HASZERONUMS($result_main)) {
 	// Parse all mails
-	while ($DATA = SQL_FETCHARRAY($result_main, 0, false)) {
+	while ($mailData = SQL_FETCHARRAY($result_main, 0, false)) {
 		// Set mail order as 'active'. That means it will be sent out
 		SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='ACTIVE' WHERE `id`=%s AND `data_type`='NEW' LIMIT 1",
-			array($DATA['id']), __FILE__, __LINE__);
+			array($mailData['id']), __FILE__, __LINE__);
 
 		// Check fetched data for HTML
 		$isHtml = 'N';
-		if (isset($DATA['html_msg'])) $isHtml = $DATA['html_msg'];
+		if (isset($mailData['html_msg'])) $isHtml = $mailData['html_msg'];
 
 		// Entry updated?
 		if (!SQL_HASZEROAFFECTED()) {
 			// "Explode" all receivers into an array
-			if (isInString(';', $DATA['receivers'])) {
+			if (isInString(';', $mailData['receivers'])) {
 				// There's more than one receiver in the list...
-				$receivers = explode(';', $DATA['receivers']);
-			} elseif (!empty($DATA['receivers'])) {
+				$receivers = explode(';', $mailData['receivers']);
+			} elseif (!empty($mailData['receivers'])) {
 				// Only one user left
-				$receivers = array($DATA['receivers']);
+				$receivers = array($mailData['receivers']);
 			} else {
 				// No users left
 				$receivers = array(0);
@@ -110,18 +110,18 @@ if (!SQL_HASZERONUMS($result_main)) {
 				if (fetchUserData($userid)) {
 					// Do we have a stats entry?
 					$result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
-						array($DATA['id'], $DATA['sender_userid'], $DATA['timestamp']), __FILE__, __LINE__);
+						array($mailData['id'], $mailData['sender_userid'], $mailData['timestamp']), __FILE__, __LINE__);
 
 					// If there's no stats entry add it!
 					//* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!');
 					if (SQL_HASZERONUMS($result_stats)) {
 						// No entry was found, so we add him!
 						SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats` (`pool_id` , `userid`, `cat_id`, `payment_id`, `subject`, `url` , `max_rec` , `timestamp_ordered`, `timestamp_sstart`) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s' , UNIX_TIMESTAMP())",
-							array(bigintval($DATA['id']), bigintval($DATA['sender_userid']), bigintval($DATA['cat_id']), bigintval($DATA['payment_id']), $DATA['subject'], $DATA['url'], $DATA['target_send'], bigintval($DATA['timestamp'])), __FILE__, __LINE__);
+							array(bigintval($mailData['id']), bigintval($mailData['sender_userid']), bigintval($mailData['cat_id']), bigintval($mailData['payment_id']), $mailData['subject'], $mailData['url'], $mailData['target_send'], bigintval($mailData['timestamp'])), __FILE__, __LINE__);
 
 						// Receive it's id for the links table
 						$result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
-							array(bigintval($DATA['id']), bigintval($DATA['sender_userid']), bigintval($DATA['timestamp'])), __FILE__, __LINE__);
+							array(bigintval($mailData['id']), bigintval($mailData['sender_userid']), bigintval($mailData['timestamp'])), __FILE__, __LINE__);
 					} // END - if
 
 					//* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!');
@@ -130,27 +130,27 @@ if (!SQL_HASZERONUMS($result_main)) {
 						list($stats_id) = SQL_FETCHROW($result_stats);
 
 						// Remove receiver from list
-						$status = removeReceiver($dummy, $key, bigintval($userid), bigintval($DATA['id']), bigintval($stats_id));
+						$status = removeReceiver($dummy, $key, bigintval($userid), bigintval($mailData['id']), bigintval($stats_id));
 
-						//* DEBUG: */ debugOutput('?L:'.__LINE__.'/'.$dummy.'/'.$key.'/'.$userid.'('.['sender_userid'].')/'.$DATA['id'].'/'.$stats_id.'?');
+						//* DEBUG: */ debugOutput('?L:'.__LINE__.'/'.$dummy.'/'.$key.'/'.$userid.'('.['sender_userid'].')/'.$mailData['id'].'/'.$stats_id.'?');
 						switch ($status) {
 							case 'done':
 								// Prepare the mail
-								$DATA['stats_id'] = bigintval($stats_id);
+								$mailData['stats_id'] = bigintval($stats_id);
 
 								// Prepare content
-								$DATA['time']   = getPaymentPoints($DATA['payment_id'], 'time');
-								$DATA['points'] = getPaymentPoints($DATA['payment_id'], 'payment');
+								$mailData['time']   = getPaymentPoints($mailData['payment_id'], 'time');
+								$mailData['points'] = getPaymentPoints($mailData['payment_id'], 'payment');
 
 								// Load message template
-								$mailText = loadEmailTemplate('member_user_pool_normal', $DATA, bigintval($userid));
+								$mailText = loadEmailTemplate('member_user_pool_normal', $mailData, bigintval($userid));
 
 								// Send mail away
-								sendEmail(getUserData('userid'), $DATA['subject'], $mailText, $isHtml);
+								sendEmail(getUserData('userid'), $mailData['subject'], $mailText, $isHtml);
 
 								// Count sent mails...
 								SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `emails_sent`=`emails_sent`+1 WHERE `userid`=%s LIMIT 1",
-									array(bigintval($DATA['sender_userid'])), __FILE__, __LINE__);
+									array(bigintval($mailData['sender_userid'])), __FILE__, __LINE__);
 
 								if (isExtensionInstalledAndNewer('user', '0.1.4')) {
 									// Update mails received for receiver
@@ -177,30 +177,30 @@ if (!SQL_HASZERONUMS($result_main)) {
 								break;
 
 							default: // Unknown return type
-								logDebugMessage(__FILE__, __LINE__, 'Unknown status ' . $status . ' detected. pool_id=' . $DATA['id'] . ',sender=' . $DATA['sender_userid'] . ',stats_id=' . $stats_id);
+								logDebugMessage(__FILE__, __LINE__, 'Unknown status ' . $status . ' detected. pool_id=' . $mailData['id'] . ',sender=' . $mailData['sender_userid'] . ',stats_id=' . $stats_id);
 								break;
 						} // END - switch
 					} // END - if
 
 					// Do we have reached the maximum to send mails? || (getConfig('max_send') >= $GLOBALS['pool_cnt'])
-					//* DEBUG: */ debugOutput('*L:'.__LINE__.'/'.$GLOBALS['pool_cnt'].'>='.$DATA['target_send'].'/'.getConfig('max_send').'>='.$GLOBALS['pool_cnt'].'/'.$lastSentId.'!='.$DATA['id'].'*');
-					if ((($GLOBALS['pool_cnt'] >= $DATA['target_send'])) && ($lastSentId != $DATA['id'])) {
+					//* DEBUG: */ debugOutput('*L:'.__LINE__.'/'.$GLOBALS['pool_cnt'].'>='.$mailData['target_send'].'/'.getConfig('max_send').'>='.$GLOBALS['pool_cnt'].'/'.$lastSentId.'!='.$mailData['id'].'*');
+					if ((($GLOBALS['pool_cnt'] >= $mailData['target_send'])) && ($lastSentId != $mailData['id'])) {
 						// Prepare content
 						$content = array(
-							'sender_userid' => $DATA['sender_userid'],
-							'cat_id'        => $DATA['cat_id'],
-							'text'          => $DATA['text'],
-							'url'           => $DATA['url'],
-							'expiration'    => '{%pipe,createFancyTime=' . getPaymentPoints($DATA['payment_id'], 'time') . '%}'
+							'sender_userid' => $mailData['sender_userid'],
+							'cat_id'        => $mailData['cat_id'],
+							'text'          => $mailData['text'],
+							'url'           => $mailData['url'],
+							'expiration'    => '{%pipe,createFancyTime=' . getPaymentPoints($mailData['payment_id'], 'time') . '%}'
 						);
 
 						// Yes we do, so we notify admin and sender about fully sent mail!
 						sendAdminNotification('{--ADMIN_SEND_DONE_SUBJECT--}', 'admin_user_pool_done', $content, $userid);
 
 						// Get sender's data
-						if (fetchUserData($DATA['sender_userid'])) {
+						if (fetchUserData($mailData['sender_userid'])) {
 							// Load email template
-							$mailText = loadEmailTemplate('member_user_pool_done', $content, $DATA['sender_userid']);
+							$mailText = loadEmailTemplate('member_user_pool_done', $content, $mailData['sender_userid']);
 
 							// Send it also waway
 							sendEmail(getUserData('userid'), '{--MEMBER_SEND_DONE_SUBJECT--}', $mailText);
@@ -208,13 +208,13 @@ if (!SQL_HASZERONUMS($result_main)) {
 
 						// Set status to SEND because we completely send it away
 						SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='SEND', `target_send`=0, `receivers`='' WHERE `id`=%s LIMIT 1",
-							array(bigintval($DATA['id'])), __FILE__, __LINE__);
+							array(bigintval($mailData['id'])), __FILE__, __LINE__);
 
 						// Update send-completed-time
 						SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `timestamp_send`=UNIX_TIMESTAMP() WHERE `pool_id`=%s LIMIT 1",
-							array(bigintval($DATA['id'])), __FILE__, __LINE__);
+							array(bigintval($mailData['id'])), __FILE__, __LINE__);
 
-						$lastSentId = $DATA['id']; $GLOBALS['pool_cnt'] = '0';
+						$lastSentId = $mailData['id']; $GLOBALS['pool_cnt'] = '0';
 						$count2 += $GLOBALS['pool_cnt'];
 
 						// Update mediadata if version is 0.0.4 or higher
@@ -231,11 +231,11 @@ if (!SQL_HASZERONUMS($result_main)) {
 					elseif (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || ($count2 >= getConfig('max_send'))) {
 						// There are some mails left to send for next round, so we reset the status back to NEW (=still not fully delivered)
 						$add = '';
-						if ($GLOBALS['pool_cnt'] <= $DATA['target_send']) $add = ", target_send=target_send-".$GLOBALS['pool_cnt'];
+						if ($GLOBALS['pool_cnt'] <= $mailData['target_send']) $add = ", target_send=target_send-".$GLOBALS['pool_cnt'];
 						SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='NEW', receivers='%s'" . $add . " WHERE `id`=%s LIMIT 1",
 							array(
 								implode(';', $dummy),
-								bigintval($DATA['id'])
+								bigintval($mailData['id'])
 							), __FILE__, __LINE__);
 
 						//* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__.'*');
@@ -249,20 +249,20 @@ if (!SQL_HASZERONUMS($result_main)) {
 					if (($receivers['id'] == '0') || (empty($receivers['id']))) {
 						// List was empty
 						SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='SEND' WHERE `id`=%s LIMIT 1",
-							array(bigintval($DATA['id'])), __FILE__, __LINE__);
+							array(bigintval($mailData['id'])), __FILE__, __LINE__);
 					} else {
 						// Is the userid set?
 						if (isValidUserId($userid)) {
 							// User does not exists, pay points back
-							$points = getPaymentPoints($DATA['payment_id']);
-							addPointsThroughReferalSystem('pool_payback', $DATA['sender_userid'], $points);
+							$points = getPaymentPoints($mailData['payment_id']);
+							addPointsThroughReferalSystem('pool_payback', $mailData['sender_userid'], $points);
 
 							// Add points together and remove user
-							$pointsBack[$DATA['sender_userid']] += $points;
+							$pointsBack[$mailData['sender_userid']] += $points;
 						} // END - if
 
 						// Count up
-						$count_back[$DATA['sender_userid']]++;
+						$count_back[$mailData['sender_userid']]++;
 					}
 
 					// Remove entry from list
@@ -270,7 +270,7 @@ if (!SQL_HASZERONUMS($result_main)) {
 
 					// Update receivers
 					SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `receivers`='%s' WHERE `id`=%s LIMIT 1",
-						array(implode(';', $dummy), bigintval($DATA['id'])), __FILE__, __LINE__);
+						array(implode(';', $dummy), bigintval($mailData['id'])), __FILE__, __LINE__);
 				}
 			} // END - foreach
 		} // END - if
diff --git a/inc/template-functions.php b/inc/template-functions.php
index 10e1240b1d..29e3e092db 100644
--- a/inc/template-functions.php
+++ b/inc/template-functions.php
@@ -429,6 +429,7 @@ function detectExtraTemplatePath ($template) {
 
 // Loads an email template and compiles it
 function loadEmailTemplate ($template, $content = array(), $userid = '0', $loadUserData = true) {
+	// @TODO $DATA is deprecated and should be avoided and replaced with $content
 	global $DATA;
 
 	// Make sure all template names are lowercase!
@@ -620,8 +621,8 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true
 	$code = str_replace($secChars['to'], $secChars['from'], $code);
 
 	// Find $content[bla][blub] entries
-	// @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates
-	preg_match_all('/\$(content|GLOBALS|DATA)((\[([a-zA-Z0-9-_]+)\])*)/', $code, $matches);
+	// @TODO Do only use $content and deprecate $DATA in templates
+	preg_match_all('/\$(content|DATA)((\[([a-zA-Z0-9-_]+)\])*)/', $code, $matches);
 
 	// Are some matches found?
 	if ((count($matches) > 0) && (count($matches[0]) > 0)) {
@@ -647,7 +648,9 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true
 			} // END - foreach
 
 			// Skip this entry?
-			if ($fuzzyFound === true) continue;
+			if ($fuzzyFound === true) {
+				continue;
+			} // END - if
 
 			// Take all string elements
 			if ((is_string($matches[4][$key])) && (!isset($matchesFound[$match])) && (!isset($matchesFound[$key.'_' . $matches[4][$key]]))) {
diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php
index a826c3d69b..87e0a3d01c 100644
--- a/inc/wrapper-functions.php
+++ b/inc/wrapper-functions.php
@@ -2501,18 +2501,18 @@ function appendLineToFile ($file, $line) {
 }
 
 // Wrapper for changeDataInFile() but with full path added
-function changeDataInInclude ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
+function changeDataInInclude ($FQFN, $comment, $prefix, $suffix, $inserted, $seek=0) {
 	// Add full path
 	$FQFN = getPath() . $FQFN;
 
 	// Call inner function
-	return changeDataInFile($FQFN, $comment, $prefix, $suffix, $DATA, $seek);
+	return changeDataInFile($FQFN, $comment, $prefix, $suffix, $inserted, $seek);
 }
 
 // Wrapper for changing entries in config-local.php
-function changeDataInLocalConfigurationFile ($comment, $prefix, $suffix, $DATA, $seek = 0) {
+function changeDataInLocalConfigurationFile ($comment, $prefix, $suffix, $inserted, $seek = 0) {
 	// Call the inner function
-	return changeDataInInclude(getCachePath() . 'config-local.php', $comment, $prefix, $suffix, $DATA, $seek);
+	return changeDataInInclude(getCachePath() . 'config-local.php', $comment, $prefix, $suffix, $inserted, $seek);
 }
 
 // Shortens ucfirst(strtolower()) calls
diff --git a/mailid_top.php b/mailid_top.php
index 3afc87b511..b88616de73 100644
--- a/mailid_top.php
+++ b/mailid_top.php
@@ -15,6 +15,8 @@
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
+ * @TODO Merge this script with mailid.php                              *
+ * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
-- 
2.39.5