From d61574a61e4b46f8c7ad0e75f0e2261ab8405670 Mon Sep 17 00:00:00 2001
From: Henry Sudhof <kellanved@phpbb.com>
Date: Fri, 26 Jun 2009 20:18:05 +0000
Subject: [PATCH] Okay it should work again. Thanks Raimon. In the future,
 please test if your changes are really a good idea.

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9694 89ea8834-ac86-4346-8a33-228a782c2dd0
---
 phpBB/includes/ucp/ucp_register.php | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 8192f5489b..ef6b076ebc 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -77,19 +77,6 @@ class ucp_register
 			}
 		}
 
-		$vc_response = false;
-		if ($config['enable_confirm'])
-		{
-			include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
-			$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
-			$captcha->init(CONFIRM_REG);
-
-			// If confirm id is submitted we check the status of the captcha here
-			if (request_var('confirm_code', ''))
-			{
-				$vc_response = $captcha->validate();
-			}
-		}
 
 		$cp = new custom_profile();
 
@@ -171,6 +158,15 @@ class ucp_register
 			$this->tpl_name = 'ucp_agreement';
 			return;
 		}
+		
+		
+		// The CAPTCHA kicks in here. We can't help that the information gets lost on language change. 
+		if ($config['enable_confirm'])
+		{
+			include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
+			$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+			$captcha->init(CONFIRM_REG);
+		}
 
 		// Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1
 		$timezone = date('Z') / 3600;
@@ -230,7 +226,8 @@ class ucp_register
 
 			if ($config['enable_confirm'])
 			{
-				if (!$captcha->is_solved())
+				$vc_response = $captcha->validate();
+				if (!$captcha->is_solved() && $vc_response)
 				{
 					$error[] = $vc_response;
 				}