From a8ffbce99f9ea99bd1fdca0e009001026e2d6950 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Sat, 24 Aug 2013 22:00:16 -0400 Subject: [feature/oauth] Changes due to code review PHPBB3-11673 --- phpBB/includes/ucp/ucp_auth_link.php | 32 ++++++++++++++------------------ phpBB/includes/ucp/ucp_login_link.php | 4 +++- 2 files changed, 17 insertions(+), 19 deletions(-) (limited to 'phpBB/includes/ucp') diff --git a/phpBB/includes/ucp/ucp_auth_link.php b/phpBB/includes/ucp/ucp_auth_link.php index e2bf369984..4fa984c9e7 100644 --- a/phpBB/includes/ucp/ucp_auth_link.php +++ b/phpBB/includes/ucp/ucp_auth_link.php @@ -17,8 +17,17 @@ if (!defined('IN_PHPBB')) class ucp_auth_link { + /** + * @var string + */ public $u_action; + /** + * Generates the ucp_auth_link page and handles the auth link process + * + * @param int $id + * @param string $mode + */ public function main($id, $mode) { global $config, $request, $template, $phpbb_container, $user; @@ -72,7 +81,7 @@ class ucp_auth_link } } - // In some cases, an request to an external server may be required in + // In some cases, a request to an external server may be required. In // these cases, the GET parameter 'link' should exist and should be true if ($request->variable('link', false)) { @@ -114,8 +123,11 @@ class ucp_auth_link $s_hidden_fields = build_hidden_fields($s_hidden_fields); + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + $template->assign_vars(array( - 'ERROR' => $this->build_error_text($error), + 'ERROR' => $error, 'PROVIDER_TEMPLATE_FILE' => $provider_data['TEMPLATE_FILE'], @@ -126,20 +138,4 @@ class ucp_auth_link $this->tpl_name = 'ucp_auth_link'; $this->page_title = 'UCP_AUTH_LINK'; } - - private function build_error_text(array $errors) - { - global $user; - - // Replace all errors that are language constants - foreach ($errors as $key => $error) - { - if (isset($user->lang[$error])) - { - $errors[$key] = $user->lang($error); - } - } - - return implode('
', $errors); - } } diff --git a/phpBB/includes/ucp/ucp_login_link.php b/phpBB/includes/ucp/ucp_login_link.php index 2ed6a985d5..4173c54c42 100644 --- a/phpBB/includes/ucp/ucp_login_link.php +++ b/phpBB/includes/ucp/ucp_login_link.php @@ -91,7 +91,9 @@ class ucp_login_link if ($result) { $login_link_error = $user->lang[$result]; - } else { + } + else + { // Finish login $result = $user->session_create($login_result['user_row']['user_id'], false, false, true); -- cgit v1.2.1