[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 /** 15 * @ignore 16 */ 17 if (!defined('IN_PHPBB')) 18 { 19 exit; 20 } 21 22 class ucp_auth_link 23 { 24 /** 25 * @var string 26 */ 27 public $u_action; 28 29 /** 30 * Generates the ucp_auth_link page and handles the auth link process 31 * 32 * @param int $id 33 * @param string $mode 34 */ 35 public function main($id, $mode) 36 { 37 global $request, $template, $phpbb_container, $user; 38 39 $error = array(); 40 41 $provider_collection = $phpbb_container->get('auth.provider_collection'); 42 $auth_provider = $provider_collection->get_provider(); 43 44 // confirm that the auth provider supports this page 45 $provider_data = $auth_provider->get_auth_link_data(); 46 if ($provider_data === null) 47 { 48 $error[] = 'UCP_AUTH_LINK_NOT_SUPPORTED'; 49 } 50 51 $s_hidden_fields = array(); 52 add_form_key('ucp_auth_link'); 53 54 $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); 55 56 // This path is only for primary actions 57 if (!sizeof($error) && $submit) 58 { 59 if (!check_form_key('ucp_auth_link')) 60 { 61 $error[] = 'FORM_INVALID'; 62 } 63 64 if (!sizeof($error)) 65 { 66 // Any post data could be necessary for auth (un)linking 67 $link_data = $request->get_super_global(\phpbb\request\request_interface::POST); 68 69 // The current user_id is also necessary 70 $link_data['user_id'] = $user->data['user_id']; 71 72 // Tell the provider that the method is auth_link not login_link 73 $link_data['link_method'] = 'auth_link'; 74 75 if ($request->variable('link', 0, false, \phpbb\request\request_interface::POST)) 76 { 77 $error[] = $auth_provider->link_account($link_data); 78 } 79 else 80 { 81 $error[] = $auth_provider->unlink_account($link_data); 82 } 83 84 // Template data may have changed, get new data 85 $provider_data = $auth_provider->get_auth_link_data(); 86 } 87 } 88 89 // In some cases, a request to an external server may be required. In 90 // these cases, the GET parameter 'link' should exist and should be true 91 if ($request->variable('link', false)) 92 { 93 // In this case the link data should only be populated with the 94 // link_method as the provider dictates how data is returned to it. 95 $link_data = array('link_method' => 'auth_link'); 96 97 $error[] = $auth_provider->link_account($link_data); 98 99 // Template data may have changed, get new data 100 $provider_data = $auth_provider->get_auth_link_data(); 101 } 102 103 if (isset($provider_data['VARS'])) 104 { 105 // Handle hidden fields separately 106 if (isset($provider_data['VARS']['HIDDEN_FIELDS'])) 107 { 108 $s_hidden_fields = array_merge($s_hidden_fields, $provider_data['VARS']['HIDDEN_FIELDS']); 109 unset($provider_data['VARS']['HIDDEN_FIELDS']); 110 } 111 112 $template->assign_vars($provider_data['VARS']); 113 } 114 115 if (isset($provider_data['BLOCK_VAR_NAME'])) 116 { 117 foreach ($provider_data['BLOCK_VARS'] as $block_vars) 118 { 119 // See if there are additional hidden fields. This should be an associative array 120 if (isset($block_vars['HIDDEN_FIELDS'])) 121 { 122 $block_vars['HIDDEN_FIELDS'] = build_hidden_fields($block_vars['HIDDEN_FIELDS']); 123 } 124 125 $template->assign_block_vars($provider_data['BLOCK_VAR_NAME'], $block_vars); 126 } 127 } 128 129 $s_hidden_fields = build_hidden_fields($s_hidden_fields); 130 131 // Replace "error" strings with their real, localised form 132 $error = array_map(array($user, 'lang'), $error); 133 $error = implode('<br />', $error); 134 135 $template->assign_vars(array( 136 'ERROR' => $error, 137 138 'PROVIDER_TEMPLATE_FILE' => $provider_data['TEMPLATE_FILE'], 139 140 'S_HIDDEN_FIELDS' => $s_hidden_fields, 141 'S_UCP_ACTION' => $this->u_action, 142 )); 143 144 $this->tpl_name = 'ucp_auth_link'; 145 $this->page_title = 'UCP_AUTH_LINK'; 146 } 147 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |