From: Roland Häder <roland@mxchange.org>
Date: Wed, 4 Nov 2009 05:17:05 +0000 (+0000)
Subject: Typo 'referral'->'referal' fixed, more 'empty version' fixed
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a49d1f4613f3f7d47fb57d946e9f7f705bd34a9b;p=mailer.git

Typo 'referral'->'referal' fixed, more 'empty version' fixed
---

diff --git a/inc/functions.php b/inc/functions.php
index 8d4cc44e90..7b691f4bfe 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -2919,7 +2919,7 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
 }
 // Send notification to admin
 function sendAdminNotification ($subject, $templateName, $content=array(), $userid = 0) {
-	if (getExtensionVersion('admins') >= '0.4.1') {
+	if (isExtensionInstalledAndNewer('admins', '0.4.1')) {
 		// Send new way
 		sendAdminsEmails($subject, $templateName, $content, $userid);
 	} else {
diff --git a/inc/gen_refback.php b/inc/gen_refback.php
index 7d0a6b7d7b..77fd532d80 100644
--- a/inc/gen_refback.php
+++ b/inc/gen_refback.php
@@ -45,13 +45,13 @@ if (!defined('__SECURITY')) {
 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__);
+$result = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0", __FILE__, __LINE__);
 if (SQL_NUMROWS($result) > 0) {
 	// Remove index temporaly
 	SQL_ALTER_TABLE("ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`", __FILE__, __LINE__);
 
 	// Upgrade refsystem, ref-level 0 is silly here
-	SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET level=level+1", __FILE__, __LINE__);
+	SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1", __FILE__, __LINE__);
 
 	// Add it again
 	SQL_ALTER_TABLE("ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE `userid_level` ( `userid`,`level` )", __FILE__, __LINE__);
diff --git a/inc/language/de.php b/inc/language/de.php
index 7035eb773f..47235da07c 100644
--- a/inc/language/de.php
+++ b/inc/language/de.php
@@ -347,8 +347,8 @@ addMessages(array(
 	'YOUR_PERSONAL_REFLINK' => "Ihr pers&ouml;nlicher Ref-Link zum Werben neuer Mitglieder lautet",
 	'YOUR_REFCLICKS' => "Klicks auf Ihren Referal-Link",
 	'CLICKS' => "Klicks",
-	'YOU_REFERRAL_ONE' => "Sie haben heute ein neues Mitglied f&uuml;r unseren {?mt_word?} geworben!\n\nHier sehen Sie genau, in welcher Ebene Sie ihn geworben haben:",
-	'YOU_THANX_REFERRAL' => "Sie werden nun auch weiterhin {?POINTS?} &uuml;ber diese geworbene Person erhalten.\n\nVielen Dank f&uuml;r Ihr Mitwerben! Wir w&uuml;nschen Ihnen noch weiterhin viele neue Referals!\n\nMit freundlichen Gr&uuml;&szlig;en,",
+	'YOU_REFERAL_ONE' => "Sie haben heute ein neues Mitglied f&uuml;r unseren {?mt_word?} geworben!\n\nHier sehen Sie genau, in welcher Ebene Sie ihn geworben haben:",
+	'YOU_THANX_REFERAL' => "Sie werden nun auch weiterhin {?POINTS?} &uuml;ber diese geworbene Person erhalten.\n\nVielen Dank f&uuml;r Ihr Mitwerben! Wir w&uuml;nschen Ihnen noch weiterhin viele neue Referals!\n\nMit freundlichen Gr&uuml;&szlig;en,",
 	'POINTS_REF_REGISTER' => "Referal-Pauschale und prozentual vom Anmeldebonus.",
 	'NO_REFLEVEL_LEFT' => "Keine Referal-Ebenen mehr verf&uuml;gbar! Bitte melden Sie sich bei uns.",
 	'ENGINE' => "{?mt_word?}-Engine",
@@ -505,7 +505,7 @@ addMessages(array(
 	'MAILS_SENT' => "Mails versendet",
 	'HAS_JOINED' => "Beigetreten am",
 	'TOTAL_POINTS' => "{?POINTS?} gesamt",
-	'TOTAL_REFERRALS' => "Referals gesamt",
+	'TOTAL_REFERALS' => "Referals gesamt",
 	'ADMIN_MEMBER_FUNCTIONS' => "Administrative Funktionen",
 	'ADMIN_DEL_USER' => "L&ouml;schen",
 	'ADMIN_LOCK_USER' => "Sperren",
@@ -533,7 +533,7 @@ addMessages(array(
 	'GUEST_CONFIRM_SUBJ' => "Bitte Ihre Email-Adresse best&auml;tigen.",
 	'MEMBER_ORDER_ACCEPTED' => "Ihre Mailbuchung wurde freigeschaltet",
 	'MEMBER_ORDER_REJECTED' => "Ihre Mailbuchung wurde abgelehnt",
-	'THANX_REFERRAL_ONE' => "Vielen Dank f&uuml;r die Referal-Werbung.",
+	'THANX_REFERAL_ONE' => "Vielen Dank f&uuml;r die Referal-Werbung.",
 	'ADMIN_SEND_MAIL' => "Bonusmail versenden",
 	'ADMIN_BONUS_SEND' => "Bonusmail wurde in den Sende-Pool eingef&uuml;gt.",
 	'ENTER_POINTS' => "Verg&uuml;tung",
@@ -604,7 +604,7 @@ addMessages(array(
 	'PAYMENT_ID' => "Verg&uuml;tungs-Id",
 	'CHANGE_PAY' => "&Auml;ndern",
 	'REMOVE_PAY' => "L&ouml;schen",
-	'REFERRALS' => "Referals",
+	'REFERALS' => "Referals",
 	'POINTS_SUM' => "Gesamtsumme",
 	'NEW_VERSION_AVAILABLE' => "Neue Version verf&uuml;gbar.",
 	'YOUR_VERSION_IS' => "Installierte Version",
@@ -968,11 +968,11 @@ addMessages(array(
 	'ADMIN_ENTER_ALTERNATE_TEXT' => "Alternativen Text",
 	'ADMIN_SELECT_BANNER_ACTIVE' => "Ist der Banner aktiv?",
 	'ADMIN_SUBMIT_BANNER' => "Banner hinzuf&uuml;gen",
-	'ADMIN_LIST_REFERRALS_1' => "Referal-&Uuml;bersicht des Mitgliedes ",
-	'ADMIN_LIST_REFERRALS_2' => " in allen Ebenen:",
-	'ADMIN_LIST_REFERRALS_LEVEL_1' => "Referals in Ebene ",
-	'ADMIN_LIST_REFERRALS_LEVEL_2' => ":",
-	'ADMIN_LIST_REFERRALS_NOTE' => "<strong>&Auml;nderung:</strong> Klicken Sie die Mitglieder-Id an und gelangen Sie zum Mitgliederprofil. Klicken Sie Anzahl Referals an, werden die Referals des jeweiligen Mitgliedes aufgelistet.",
+	'ADMIN_LIST_REFERALS_1' => "Referal-&Uuml;bersicht des Mitgliedes ",
+	'ADMIN_LIST_REFERALS_2' => " in allen Ebenen:",
+	'ADMIN_LIST_REFERALS_LEVEL_1' => "Referals in Ebene ",
+	'ADMIN_LIST_REFERALS_LEVEL_2' => ":",
+	'ADMIN_LIST_REFERALS_NOTE' => "<strong>&Auml;nderung:</strong> Klicken Sie die Mitglieder-Id an und gelangen Sie zum Mitgliederprofil. Klicken Sie Anzahl Referals an, werden die Referals des jeweiligen Mitgliedes aufgelistet.",
 	'ADMIN_NORMAL_MAIL_ALREADY_DELETED' => "Mitglieder-Mail bereits gel&ouml;scht.",
 	'INITIAL_RELEASE' => "Erste Alpha-Version",
 	'NO_UPDATE_NOTES' => "Keine Update-Hinweise gefunden.",
@@ -1166,7 +1166,7 @@ addMessages(array(
 // Special user lists (what=list_user)
 	'ADMIN_LIST_STATUS_LOCKED_ACCOUNTS' => "Alle gesperrten Mitglieder-Accounts auflisten",
 	'ADMIN_LIST_STATUS_CONFIRMED_ACCOUNTS' => "Alle best&auml;tigten Mitglieder-Accounts auflisten",
-	'ADMIN_LIST_MODE_NOREFS_ACCOUNTS' => "Alle Mitglieder-Accounts ohne Referrals auflisten",
+	'ADMIN_LIST_MODE_NOREFS_ACCOUNTS' => "Alle Mitglieder-Accounts ohne Referals auflisten",
 
 // Admin task lines
 	'ADMIN_TASK_IS_MEMBER_SUPPORT' => "Support-Anfrage eines Mitgliedes",
diff --git a/inc/language/doubler_de.php b/inc/language/doubler_de.php
index e06060ea96..39fa31e2ed 100644
--- a/inc/language/doubler_de.php
+++ b/inc/language/doubler_de.php
@@ -55,7 +55,7 @@ addMessages(array(
 	'ADMIN_DOUBLER_DISPLAY_NEW' => "Anzahl ersten X neuen Eintr&auml;ge",
 	'ADMIN_DOUBLER_DISPLAY_PAY' => "Anzahl ersten X vor Auszahlung stehender Verdoppelungen",
 	'ADMIN_DOUBLER_DISPLAY_OLD' => "Anzahl ersten X bereits ausgezahlter Verdoppelungen",
-	'ADMIN_DOUBLER_REFERRAL' => "Prozentuale Referal-Verg&uuml;tung",
+	'ADMIN_DOUBLER_REFERAL' => "Prozentuale Referal-Verg&uuml;tung",
 	'ADMIN_DOUBLER_MINIMUM' => "Minimum {?POINTS?} die verdoppelt werden sollen",
 	'ADMIN_DOUBLER_MAXIMUM' => "Maximum {?POINTS?} die verdoppelt werden sollen",
 	'ADMIN_DOUBLER_LEFT' => "Auf dem Mitgliedsaccount nach Verdoppelung Minimum-{?POINTS?}-Guthaben",
@@ -96,17 +96,17 @@ addMessages(array(
 	'DOUBLER_EXAMPLE_2' => "Auszahlung:",
 	'DOUBLER_EXAMPLE_3' => ", sobald Sie an der Reihe sind, ohne(*) ein Risiko einzugehen.",
 	'DOUBLER_FULL_PAYOUT' => "100% Auszahlung",
-	'DOUBLER_REFERRAL_1' => "Refverdienst: Es gibt",
-	'DOUBLER_REFERRAL_2' => "Refverdienst. Wenn Sie {?POINTS?} auf dem Refkonto durch Werbung erwirtschaftet haben,",
-	'DOUBLER_REFERRAL_3' => "(Wichtig! Maximal Verdoppelung darf nicht &uuml;berschritten werden)",
-	'DOUBLER_REFERRAL_4' => "werden diese bei Ihrer n&auml;chsten Verdoppelung aufgeschlagen.",
-	'DOUBLER_REFERRAL_5' => "Beispiel: Sie haben",
-	'DOUBLER_REFERRAL_6' => "Refverdienst und verdoppeln",
-	'DOUBLER_REFERRAL_7' => ", Sie bekommen - sobald Sie an der Reihe sind -",
-	'DOUBLER_REFERRAL_8' => "zur&uuml;ck.",
+	'DOUBLER_REFERAL_1' => "Refverdienst: Es gibt",
+	'DOUBLER_REFERAL_2' => "Refverdienst. Wenn Sie {?POINTS?} auf dem Refkonto durch Werbung erwirtschaftet haben,",
+	'DOUBLER_REFERAL_3' => "(Wichtig! Maximal Verdoppelung darf nicht &uuml;berschritten werden)",
+	'DOUBLER_REFERAL_4' => "werden diese bei Ihrer n&auml;chsten Verdoppelung aufgeschlagen.",
+	'DOUBLER_REFERAL_5' => "Beispiel: Sie haben",
+	'DOUBLER_REFERAL_6' => "Refverdienst und verdoppeln",
+	'DOUBLER_REFERAL_7' => ", Sie bekommen - sobald Sie an der Reihe sind -",
+	'DOUBLER_REFERAL_8' => "zur&uuml;ck.",
 	'DOUBLER_TIMEOUT_1' => "Es werden Eintr&auml;ge nicht &auml;lter als",
 	'DOUBLER_TIMEOUT_2' => "angezeigt.",
-	'DOUBLER_REFERRAL_LINK' => "Den Reflink erfahren Sie nach jeder Verdoppelung.",
+	'DOUBLER_REFERAL_LINK' => "Den Reflink erfahren Sie nach jeder Verdoppelung.",
 	'DOUBLER_NOT_YET_REGISTERED' => "Noch nicht angemeldet?",
 	'DOUBLER_REGISTER_NOW' => "Weiter zur Anmeldung.",
 	'DOUBLER_YOUR_ADVERTISING_HERE' => "Hier k&ouml;nnte auch Ihre Werbung stehen:",
diff --git a/inc/language/sponsor_de.php b/inc/language/sponsor_de.php
index cc50f67aa4..35937c6005 100644
--- a/inc/language/sponsor_de.php
+++ b/inc/language/sponsor_de.php
@@ -102,7 +102,7 @@ addMessages(array(
 	'ADMIN_SPONSOR_ACTIONS' => "Aktionen am Sponsorenaccount",
 	'SPONSOR_ID' => "Sponsor-Id",
 	'SPONSOR_STATUS' => "Sponsor-Status",
-	'SPONSOR_REFERRALS' => "Sponsoren geworben",
+	'SPONSOR_REFERALS' => "Sponsoren geworben",
 	'ADMIN_SPONSOR_INVALID_MODE' => "Ung&uuml;tiger Modus <span class=\"data\">%s</span> angegeben.",
 	'ADMIN_SPONSOR_MODUS_TPL_404' => "Modus-Template <span class=\"data\">%s</span> nicht gefunden.",
 	'ADMIN_ADD_POINTS_TO_SPONSOR' => "{?POINTS?} gutschreiben",
@@ -165,7 +165,7 @@ addMessages(array(
 	'SPONSOR_PAY_ENTRIES_REMOVED' => "Buchungspakete gel&ouml;scht.",
 	'SPONSOR_PAYMENT_LIST_IS_EMPTY' => "Noch keine Buchungspakete eingerichtet.",
 	'ADMIN_SPONSOR_UNKNOWN_STATUS' => "Unbekannter Status <span class=\"data\">%s</span> wurde bei der Anmeldung zur&uuml;ckgeliefert.",
-	'SPONSOR_REFERRAL' => "Sponsoren-Referal",
+	'SPONSOR_REFERAL' => "Sponsoren-Referal",
 	'SPONSOR_REFID_WAS' => "Sie wurden vom Sponsor geworben",
 	'SPONSOR_ACCOUNT_IS_PENDING' => "EMail-Adresse best&auml;tigt! Sie haben soeben eine EMail mit weiteren Anweisungen erhalten.",
 
diff --git a/inc/modules/admin/what-list_refs.php b/inc/modules/admin/what-list_refs.php
index 6a1085f167..7f23f8b881 100644
--- a/inc/modules/admin/what-list_refs.php
+++ b/inc/modules/admin/what-list_refs.php
@@ -103,7 +103,7 @@ ORDER BY
 							// Is the data there?
 							if (fetchUserData($content['refid'])) {
 								// Check for referals
-								$refs_cnt = countSumTotalData(getUserData('userid'), 'refsystem', 'counter');
+								$refs_cnt = countSumTotalData(getUserData('userid'), 'user_refs', 'id', 'userid', true);
 
 								// Prepare data for the template
 								$content = array(
diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php
index 48c1c15878..53bfce2af9 100644
--- a/inc/modules/admin/what-list_user.php
+++ b/inc/modules/admin/what-list_user.php
@@ -328,7 +328,7 @@ LIMIT 1",
 			$content['locked']         = translateComma(countSumTotalData($content['userid'], 'user_points', 'locked_points'));
 			$content['lock_timestamp'] = generateDateTime($content['lock_timestamp'], 2);
 			$content['status']         = translateUserStatus($content['status']);
-			$content['refs']           = countSumTotalData($content['userid'], 'refsystem', 'counter');
+			$content['refs']           = countSumTotalData($content['userid'], 'user_refs', 'id', 'userid', true);
 
 			// If we have at least one referal, make it clickable to referal list
 			if ($content['refs'] > 0) $content['refs'] = $base . '&amp;what=list_refs&amp;userid=' . $content['userid'] . '">' . $content['refs'] . '</a>]';
diff --git a/inc/modules/admin/what-unlock_sponsor.php b/inc/modules/admin/what-unlock_sponsor.php
index a3e1eeb870..bd1f77f506 100644
--- a/inc/modules/admin/what-unlock_sponsor.php
+++ b/inc/modules/admin/what-unlock_sponsor.php
@@ -136,18 +136,18 @@ LIMIT 1",
 FROM `{?_MYSQL_PREFIX?}_sponsor_data`
 WHERE `id`='%s' LIMIT 1",
 					array(bigintval($content['refid'])), __FILE__, __LINE__);
-					$REFERRAL = SQL_FETCHARRAY($result);
+					$REFERAL = SQL_FETCHARRAY($result);
 
 					// Send warnings out?
-					if ($REFERRAL['receive_warnings'] == 'Y') {
+					if ($REFERAL['receive_warnings'] == 'Y') {
 						// Translate some data
-						$REFERRAL['points']     = translateComma($REFERRAL['points']);
-						$REFERRAL['ref_points'] = translateComma(getConfig('sponsor_ref_points'));
-						$REFERRAL['gender']     = translateGender($REFERRAL['gender']);
+						$REFERAL['points']     = translateComma($REFERAL['points']);
+						$REFERAL['ref_points'] = translateComma(getConfig('sponsor_ref_points'));
+						$REFERAL['gender']     = translateGender($REFERAL['gender']);
 
 						// Send notification to referal
-						$REF_MSG = loadEmailTemplate('sponsor_ref_notify', $REFERRAL);
-						sendEmail($REFERRAL['email'], getMessage('SPONSOR_REF_NOTIFY_SUBJ'), $REF_MSG);
+						$REF_MSG = loadEmailTemplate('sponsor_ref_notify', $REFERAL);
+						sendEmail($REFERAL['email'], getMessage('SPONSOR_REF_NOTIFY_SUBJ'), $REF_MSG);
 					}
 
 					// Free memory
diff --git a/inc/modules/guest/what-confirm.php b/inc/modules/guest/what-confirm.php
index 9f5fa62f35..f6fbe74847 100644
--- a/inc/modules/guest/what-confirm.php
+++ b/inc/modules/guest/what-confirm.php
@@ -55,17 +55,29 @@ if (isGetRequestElementSet('hash')) {
 	$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",
+	$result = SQL_QUERY_ESC("SELECT `userid`, `email`, `refid`,`gender` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1",
 		array(getRequestElement('hash')), __FILE__, __LINE__);
 	if (SQL_NUMROWS($result) == 1) {
 		// Ok, he want's to confirm now so we load some data
-		list($userid, $email, $rid) = SQL_FETCHROW($result);
+		list($userid, $email, $rid, $gender) = SQL_FETCHROW($result);
+
+		// Fetch user data
+		if (!fetchUserData($userid)) {
+			// Not found, should not happen
+			debug_report_bug('User account ' . $userid . ' not found.');
+		} // END - if
+
+		// Load all data and add points
+		$content = getUserDataArray();
+		$content['gender'] = translateGender($content['gender']);
+		$content['points'] = getConfig('points_register');
 
 		// 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(getRequestElement('hash')), __FILE__, __LINE__);
 		if (SQL_AFFECTEDROWS() == 1) {
-			$message = loadEmailTemplate('confirm-member', array('points' => getConfig('points_register')), bigintval($userid));
+			// Send email if updated
+			$message = loadEmailTemplate('confirm-member', $content, bigintval($userid));
 
 			// And send him right away the confirmation mail
 			sendEmail($email, getMessage('GUEST_THANX_CONFIRM'), $message);
@@ -135,7 +147,7 @@ if (isGetRequestElementSet('hash')) {
 	}
 
 	// Load template
-	loadTemplate('guest_confirm_table', false, $content);
+	loadTemplate('admin_settings_saved', false, $content['message']);
 } elseif ((isFormSent()) && (isPostRequestElementSet('email'))) {
 	// Confirmation link requested      0         1          2
 	if (fetchUserData(postRequestElement('email'), 'email')) {
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index 1c9a5c64cf..90c8d83eb0 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -1222,6 +1222,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
 	}
 
 	// Return value
+	//* DEBUG: */ print 'ret='.$ret.'<br />';
 	return $ret;
 }
 // Getter fro ref level percents
@@ -1365,7 +1366,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
 				// Load email template
 				$message = loadEmailTemplate('confirm-referal', $content, bigintval($userid));
 
-				sendEmail(getUserData('email'), THANX_REFERRAL_ONE, $message);
+				sendEmail(getUserData('email'), THANX_REFERAL_ONE, $message);
 			} elseif (($sendNotify) && (getUserData('refid') == 0) && ($locked === false) && ($add_mode == 'direct')) {
 				// Prepare content
 				$content = array(
@@ -1427,8 +1428,9 @@ function updateReferalCounter ($userid) {
 	if (($ref > 0) && ($ref != $userid)) {
 		// Move to next referal level and count his counter one up!
 		//* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - ADVANCE!<br />");
-		$GLOBALS['cache_array']['ref_level'][$userid]++; updateReferalCounter($ref);
-	} elseif ((($ref == $userid) || ($ref == 0)) && (getExtensionVersion('cache') >= '0.1.2')) {
+		$GLOBALS['cache_array']['ref_level'][$userid]++;
+		updateReferalCounter($ref);
+	} elseif ((($ref == $userid) || ($ref == 0)) && (isExtensionInstalledAndNewer('cache', '0.1.2'))) {
 		// Remove cache here
 		//* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />");
 		rebuildCacheFile('refsystem', 'refsystem');
diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php
index aa7b6a0218..9d61c0cf94 100644
--- a/inc/wrapper-functions.php
+++ b/inc/wrapper-functions.php
@@ -728,8 +728,11 @@ function getUserData ($column) {
 
 // Geter for whole user data array
 function getUserDataArray () {
+	// User id should not be zero
+	if (getCurrentUserId() == 0) debug_report_bug('User id is zero.');
+
 	// Get the whole array
-	return $GLOBALS['user_data'];
+	return $GLOBALS['user_data'][getCurrentUserId()];
 }
 
 // Checks if the user data is valid, this may indicate that the user has logged
diff --git a/templates/de/html/admin/admin_config_doubler.tpl b/templates/de/html/admin/admin_config_doubler.tpl
index b53800249b..887c5d349d 100644
--- a/templates/de/html/admin/admin_config_doubler.tpl
+++ b/templates/de/html/admin/admin_config_doubler.tpl
@@ -22,7 +22,7 @@
 	</tr>
 	<tr>
 		<td align="right" width="300" height="20">
-			{--ADMIN_DOUBLER_REFERRAL--}:
+			{--ADMIN_DOUBLER_REFERAL--}:
 		</td>
 		<td class="seperator" width="5">&nbsp;</td>
 		<td width="195" style="padding-left: 5px">
diff --git a/templates/de/html/admin/admin_list_refs.tpl b/templates/de/html/admin/admin_list_refs.tpl
index 145b93e3dd..4a2186b537 100644
--- a/templates/de/html/admin/admin_list_refs.tpl
+++ b/templates/de/html/admin/admin_list_refs.tpl
@@ -1,7 +1,7 @@
 <table border="0" cellspacing="0" cellpadding="0" width="99%" class="admin_table dashed">
 <tr>
 	<td colspan="6" class="admin_title" height="30">
-		<strong>{--ADMIN_LIST_REFERRALS_1--}<u>$content[userid]</u>{--ADMIN_LIST_REFERRALS_2--}</strong>
+		<strong>{--ADMIN_LIST_REFERALS_1--}<u>$content[userid]</u>{--ADMIN_LIST_REFERALS_2--}</strong>
 	</td>
 </tr>
 <tr>
@@ -15,7 +15,7 @@
 $content[rows]
 <tr>
 	<td colspan="6" class="admin_footer" style="padding-top: 7px; padding-bottom: 7px">
-		<div class="admin_note">{--ADMIN_LIST_REFERRALS_NOTE--}</div>
+		<div class="admin_note">{--ADMIN_LIST_REFERALS_NOTE--}</div>
 	</td>
 </tr>
 </table>
diff --git a/templates/de/html/admin/admin_list_refs2.tpl b/templates/de/html/admin/admin_list_refs2.tpl
index 76a1bfa910..452587d0e6 100644
--- a/templates/de/html/admin/admin_list_refs2.tpl
+++ b/templates/de/html/admin/admin_list_refs2.tpl
@@ -1,7 +1,7 @@
 <table border="0" cellspacing="0" cellpadding="0" width="99%" class="admin_table dashed">
 <tr>
 	<td class="admin_title bottom2" height="30">
-		<strong>{--ADMIN_LIST_REFERRALS_1--}<u>$content[userid]</u>{--ADMIN_LIST_REFERRALS_2--}</strong>
+		<strong>{--ADMIN_LIST_REFERALS_1--}<u>$content[userid]</u>{--ADMIN_LIST_REFERALS_2--}</strong>
 	</td>
 </tr>
 <tr><td class="seperator" height="6">&nbsp;</td></tr>
@@ -9,7 +9,7 @@ $content[rows]
 <tr><td class="seperator bottom2" height="1">&nbsp;</td></tr>
 <tr>
 	<td class="admin_footer" style="padding-top: 7px; padding-bottom: 7px">
-		<span class="admin_note">{--ADMIN_LIST_REFERRALS_NOTE--}</span>
+		<span class="admin_note">{--ADMIN_LIST_REFERALS_NOTE--}</span>
 	</td>
 </tr>
 </table>
diff --git a/templates/de/html/admin/admin_list_refs_level.tpl b/templates/de/html/admin/admin_list_refs_level.tpl
index fc2ba2e256..8a3d37c060 100644
--- a/templates/de/html/admin/admin_list_refs_level.tpl
+++ b/templates/de/html/admin/admin_list_refs_level.tpl
@@ -3,7 +3,7 @@
 <table border="0" cellspacing="0" cellpadding="0" width="99%" class="admin_table dashed">
 <tr>
 	<td colspan="6" class="admin_title" height="30" align="center">
-		<strong>{--ADMIN_LIST_REFERRALS_LEVEL_1--}<u>$content[level]</u>{--ADMIN_LIST_REFERRALS_LEVEL_2--}</strong><br />
+		<strong>{--ADMIN_LIST_REFERALS_LEVEL_1--}<u>$content[level]</u>{--ADMIN_LIST_REFERALS_LEVEL_2--}</strong><br />
 		$content[info]
 	</td>
 </tr>
diff --git a/templates/de/html/admin/admin_list_sponsor_details.tpl b/templates/de/html/admin/admin_list_sponsor_details.tpl
index 4cdc16d17c..0c8e62a0ad 100644
--- a/templates/de/html/admin/admin_list_sponsor_details.tpl
+++ b/templates/de/html/admin/admin_list_sponsor_details.tpl
@@ -113,7 +113,7 @@
   <td align="center" class="bottom2">$content[refid]</td>
 </tr>
 <tr>
-  <td align="right" class="bottom2 right2">{--SPONSOR_REFERRALS--}:&nbsp;</td>
+  <td align="right" class="bottom2 right2">{--SPONSOR_REFERALS--}:&nbsp;</td>
   <td align="center" class="bottom2">[&nbsp;<a href="{?URL?}/modules.php?module=admin&amp;what=list_sponsor&amp;rid=$content[id]"><strong>$content[ref_count]</strong></a>&nbsp;]</td>
 </tr>
 <tr>
diff --git a/templates/de/html/admin/admin_list_user_row.tpl b/templates/de/html/admin/admin_list_user_row.tpl
index fccf3f1c24..2759f6ff01 100644
--- a/templates/de/html/admin/admin_list_user_row.tpl
+++ b/templates/de/html/admin/admin_list_user_row.tpl
@@ -36,7 +36,7 @@
 	<td align="center" class="right2 switch_sw$content[sw]"><strong>{--MAILS_SENT--}:</strong></td>
 	<td align="center" class="right2 switch_sw$content[sw]"><strong>{--CLICK_RATE--}:</strong></td>
 	<td align="center" class="right2 switch_sw$content[sw]"><strong>{--POINTS_LOCKED--}:</strong></td>
-	<td align="center" class="switch_sw$content[sw]"><strong>{--TOTAL_REFERRALS--}:</strong></td>
+	<td align="center" class="switch_sw$content[sw]"><strong>{--TOTAL_REFERALS--}:</strong></td>
 </tr>
 <tr>
 	<td class="switch_sw$content[sw] seperator bottom2" width="5">&nbsp;</td>
diff --git a/templates/de/html/admin/admin_user_details.tpl b/templates/de/html/admin/admin_user_details.tpl
index 1e73a578f3..1c604d91b1 100644
--- a/templates/de/html/admin/admin_user_details.tpl
+++ b/templates/de/html/admin/admin_user_details.tpl
@@ -79,7 +79,7 @@
 		<td align="center" class="top right">{--TOTAL_POINTS--}:<br />
 			<strong>$content[total]</strong>
 		</td>
-		<td align="center" class="top right">{--TOTAL_REFERRALS--}:<br />
+		<td align="center" class="top right">{--TOTAL_REFERALS--}:<br />
 			<strong>$content[refs]</strong>
 		</td>
 		<td align="center" class="top right">{--TOTAL_CATS--}:<br />
diff --git a/templates/de/html/doubler/doubler_index.tpl b/templates/de/html/doubler/doubler_index.tpl
index b7c793b877..7017ad5744 100644
--- a/templates/de/html/doubler/doubler_index.tpl
+++ b/templates/de/html/doubler/doubler_index.tpl
@@ -73,12 +73,12 @@
 		<br />
 		<div class="big">{--DOUBLER_FULL_PAYOUT--}</div><br />
 		<br />
-		{--DOUBLER_REFERRAL_1--} <strong>$content[ref]%</strong>
-		{--DOUBLER_REFERRAL_2--} {--DOUBLER_REFERRAL_3--}
-		{--DOUBLER_REFERRAL_4--} {--DOUBLER_REFERRAL_5--} <strong>100
-		{?POINTS?}</strong> {--DOUBLER_REFERRAL_6--} <strong>100 {?POINTS?}</strong>
-		{--DOUBLER_REFERRAL_8--} <strong>300 {?POINTS?}</strong>
-		{--DOUBLER_REFERRAL_8--} {--DOUBLER_REFERRAL_LINK--}<br />
+		{--DOUBLER_REFERAL_1--} <strong>$content[ref]%</strong>
+		{--DOUBLER_REFERAL_2--} {--DOUBLER_REFERAL_3--}
+		{--DOUBLER_REFERAL_4--} {--DOUBLER_REFERAL_5--} <strong>100
+		{?POINTS?}</strong> {--DOUBLER_REFERAL_6--} <strong>100 {?POINTS?}</strong>
+		{--DOUBLER_REFERAL_8--} <strong>300 {?POINTS?}</strong>
+		{--DOUBLER_REFERAL_8--} {--DOUBLER_REFERAL_LINK--}<br />
 		$content[message]<br />
 		{--DOUBLER_NOT_YET_REGISTERED--} <a
 			href="{?URL?}/ref.php?refid=$content[refid]">{--DOUBLER_REGISTER_NOW--}</a><br />
diff --git a/templates/de/html/guest/guest_doubler.tpl b/templates/de/html/guest/guest_doubler.tpl
index 4f15976ecc..8f53bc12d2 100644
--- a/templates/de/html/guest/guest_doubler.tpl
+++ b/templates/de/html/guest/guest_doubler.tpl
@@ -16,9 +16,9 @@
 			<li><strong>{--DOUBLER_FULL_PAYOUT--}</strong></li>
 			<li>{--DOUBLER_POINTS_1--} <strong>$content[charge]%</strong> {--DOUBLER_POINTS_2--}</li>
 			<li>{--DOUBLER_EXAMPLE_1--} <strong>500 {?POINTS?}</strong> &raquo;&raquo; {--DOUBLER_EXAMPLE_2--} <strong>1000 {?POINTS?}</strong>{--DOUBLER_EXAMPLE_3--}</li>
-			<li>{--DOUBLER_REFERRAL_1--} <strong>$content[ref]%</strong> {--DOUBLER_REFERRAL_2--} {--DOUBLER_REFERRAL_3--} {--DOUBLER_REFERRAL_4--}
-			<li>{--DOUBLER_REFERRAL_5--} <strong>100 {?POINTS?}</strong> {--DOUBLER_REFERRAL_6--} <strong>100 {?POINTS?}</strong> {--DOUBLER_REFERRAL_8--} <strong>300 {?POINTS?}</strong> {--DOUBLER_REFERRAL_8--}</li>
-			<li>{--DOUBLER_REFERRAL_LINK--}</li>
+			<li>{--DOUBLER_REFERAL_1--} <strong>$content[ref]%</strong> {--DOUBLER_REFERAL_2--} {--DOUBLER_REFERAL_3--} {--DOUBLER_REFERAL_4--}
+			<li>{--DOUBLER_REFERAL_5--} <strong>100 {?POINTS?}</strong> {--DOUBLER_REFERAL_6--} <strong>100 {?POINTS?}</strong> {--DOUBLER_REFERAL_8--} <strong>300 {?POINTS?}</strong> {--DOUBLER_REFERAL_8--}</li>
+			<li>{--DOUBLER_REFERAL_LINK--}</li>
 			<li>{--DOUBLER_TIMEOUT_1--} <strong>$content[timeout_mark]</strong> {--DOUBLER_TIMEOUT_2--}</li>
 			<li>{--DOUBLER_HAVE_FUN--}</li>
 			<li><strong><a href="{?URL?}/doubler.php">{--DOUBLER_WANNA_TRY--}</a></strong></li>
diff --git a/templates/de/html/guest/guest_sponsor_reg.tpl b/templates/de/html/guest/guest_sponsor_reg.tpl
index b093814b67..4a1f1f4142 100644
--- a/templates/de/html/guest/guest_sponsor_reg.tpl
+++ b/templates/de/html/guest/guest_sponsor_reg.tpl
@@ -242,7 +242,7 @@
 <tr>
   <td class="guest_title2 bottom2" width="10" height="30">&nbsp;</td>
   <td class="guest_title2 bottom2" colspan="3" align="center">
-    <strong>{--SPONSOR_REFERRAL--}</strong>
+    <strong>{--SPONSOR_REFERAL--}</strong>
   </td>
   <td class="guest_title2 bottom2" width="10">&nbsp;</td>
 </tr>
diff --git a/templates/de/html/guest/guest_top10.tpl b/templates/de/html/guest/guest_top10.tpl
index 92e85e18ce..c7567304bd 100644
--- a/templates/de/html/guest/guest_top10.tpl
+++ b/templates/de/html/guest/guest_top10.tpl
@@ -83,7 +83,7 @@
 			<strong>{--_UID--}:</strong>
 		</td>
 		<td class="guest_title2 bottom2 right2">
-			<strong>{--TOTAL_REFERRALS--}:</strong>
+			<strong>{--TOTAL_REFERALS--}:</strong>
 		</td>
 		<td class="guest_title2 bottom2 right2">
 			<strong>{--TOTAL_POINTS--}:</strong>
diff --git a/templates/de/html/member/member_doubler.tpl b/templates/de/html/member/member_doubler.tpl
index dc470253d2..74c869ce2c 100644
--- a/templates/de/html/member/member_doubler.tpl
+++ b/templates/de/html/member/member_doubler.tpl
@@ -40,14 +40,14 @@ $content[payout_ref]</div>
 			{--DOUBLER_POINTS_2--}</li>
 			<li>{--DOUBLER_EXAMPLE_1--} <strong>500 {?POINTS?}</strong>
 			&raquo;&raquo; {--DOUBLER_EXAMPLE_2--} <strong>1000 {?POINTS?}</strong>{--DOUBLER_EXAMPLE_3--}</li>
-			<li>{--DOUBLER_REFERRAL_1--} <strong>$content[ref]%</strong>
-			{--DOUBLER_REFERRAL_2--} {--DOUBLER_REFERRAL_3--}
-			{--DOUBLER_REFERRAL_4--}
-			<li>{--DOUBLER_REFERRAL_5--} <strong>100 {?POINTS?}</strong>
-			{--DOUBLER_REFERRAL_6--} <strong>100 {?POINTS?}</strong>
-			{--DOUBLER_REFERRAL_8--} <strong>300 {?POINTS?}</strong>
-			{--DOUBLER_REFERRAL_8--}</li>
-			<li>{--DOUBLER_REFERRAL_LINK--}</li>
+			<li>{--DOUBLER_REFERAL_1--} <strong>$content[ref]%</strong>
+			{--DOUBLER_REFERAL_2--} {--DOUBLER_REFERAL_3--}
+			{--DOUBLER_REFERAL_4--}
+			<li>{--DOUBLER_REFERAL_5--} <strong>100 {?POINTS?}</strong>
+			{--DOUBLER_REFERAL_6--} <strong>100 {?POINTS?}</strong>
+			{--DOUBLER_REFERAL_8--} <strong>300 {?POINTS?}</strong>
+			{--DOUBLER_REFERAL_8--}</li>
+			<li>{--DOUBLER_REFERAL_LINK--}</li>
 			<li>{--DOUBLER_TIMEOUT_1--} <strong>$content[timeout_mark]</strong>
 			{--DOUBLER_TIMEOUT_2--}</li>
 			<li>{--DOUBLER_HAVE_FUN--}</li>
diff --git a/templates/de/html/member/member_points.tpl b/templates/de/html/member/member_points.tpl
index 4580daedaa..4c48d7bb7f 100644
--- a/templates/de/html/member/member_points.tpl
+++ b/templates/de/html/member/member_points.tpl
@@ -8,7 +8,7 @@
 		<td width="2" class="member_header"></td>
 		<td align="center" width="228" class="member_header"><strong>{?POINTS?}</strong></td>
 		<td width="2" class="member_header"></td>
-		<td align="center" width="100" class="member_header"><strong>{--REFERRALS--}</strong></td>
+		<td align="center" width="100" class="member_header"><strong>{--REFERALS--}</strong></td>
 		<td width="10" rowspan="$content[rowspan]"></td>
 	</tr>
 	$content[rows]