Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ucp_auth_link.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 /**
015 * @ignore
016 */
017 if (!defined('IN_PHPBB'))
018 {
019 exit;
020 }
021
022 class ucp_auth_link
023 {
024 /**
025 * @var string
026 */
027 public $u_action;
028
029 /**
030 * Generates the ucp_auth_link page and handles the auth link process
031 *
032 * @param int $id
033 * @param string $mode
034 */
035 public function main($id, $mode)
036 {
037 global $request, $template, $phpbb_container, $user;
038
039 $error = array();
040
041 /* @var $provider_collection \phpbb\auth\provider_collection */
042 $provider_collection = $phpbb_container->get('auth.provider_collection');
043 $auth_provider = $provider_collection->get_provider();
044
045 // confirm that the auth provider supports this page
046 $provider_data = $auth_provider->get_auth_link_data();
047 if ($provider_data === null)
048 {
049 $error[] = 'UCP_AUTH_LINK_NOT_SUPPORTED';
050 }
051
052 $s_hidden_fields = array();
053 add_form_key('ucp_auth_link');
054
055 $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
056
057 // This path is only for primary actions
058 if (!count($error) && $submit)
059 {
060 if (!check_form_key('ucp_auth_link'))
061 {
062 $error[] = 'FORM_INVALID';
063 }
064
065 if (!count($error))
066 {
067 // Any post data could be necessary for auth (un)linking
068 $link_data = $request->get_super_global(\phpbb\request\request_interface::POST);
069
070 // The current user_id is also necessary
071 $link_data['user_id'] = $user->data['user_id'];
072
073 // Tell the provider that the method is auth_link not login_link
074 $link_data['link_method'] = 'auth_link';
075
076 if ($request->variable('link', 0, false, \phpbb\request\request_interface::POST))
077 {
078 $error[] = $auth_provider->link_account($link_data);
079 }
080 else
081 {
082 $error[] = $auth_provider->unlink_account($link_data);
083 }
084
085 // Template data may have changed, get new data
086 $provider_data = $auth_provider->get_auth_link_data();
087 }
088 }
089
090 // In some cases, a request to an external server may be required. In
091 // these cases, the GET parameter 'link' should exist and should be true
092 if ($request->variable('link', false))
093 {
094 // In this case the link data should only be populated with the
095 // link_method as the provider dictates how data is returned to it.
096 $link_data = array('link_method' => 'auth_link');
097
098 $error[] = $auth_provider->link_account($link_data);
099
100 // Template data may have changed, get new data
101 $provider_data = $auth_provider->get_auth_link_data();
102 }
103
104 if (isset($provider_data['VARS']))
105 {
106 // Handle hidden fields separately
107 if (isset($provider_data['VARS']['HIDDEN_FIELDS']))
108 {
109 $s_hidden_fields = array_merge($s_hidden_fields, $provider_data['VARS']['HIDDEN_FIELDS']);
110 unset($provider_data['VARS']['HIDDEN_FIELDS']);
111 }
112
113 $template->assign_vars($provider_data['VARS']);
114 }
115
116 if (isset($provider_data['BLOCK_VAR_NAME']))
117 {
118 foreach ($provider_data['BLOCK_VARS'] as $block_vars)
119 {
120 // See if there are additional hidden fields. This should be an associative array
121 if (isset($block_vars['HIDDEN_FIELDS']))
122 {
123 $block_vars['HIDDEN_FIELDS'] = build_hidden_fields($block_vars['HIDDEN_FIELDS']);
124 }
125
126 $template->assign_block_vars($provider_data['BLOCK_VAR_NAME'], $block_vars);
127 }
128 }
129
130 $s_hidden_fields = build_hidden_fields($s_hidden_fields);
131
132 // Replace "error" strings with their real, localised form
133 $error = array_map(array($user, 'lang'), $error);
134 $error = implode('<br />', $error);
135
136 $template->assign_vars(array(
137 'ERROR' => $error,
138
139 'PROVIDER_TEMPLATE_FILE' => $provider_data['TEMPLATE_FILE'],
140
141 'S_HIDDEN_FIELDS' => $s_hidden_fields,
142 'S_UCP_ACTION' => $this->u_action,
143 ));
144
145 $this->tpl_name = 'ucp_auth_link';
146 $this->page_title = 'UCP_AUTH_LINK';
147 }
148 }
149