Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

ucp_auth_link.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 3.75 KiB


 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 $config, $request, $template, $phpbb_container, $user;
 038   
 039          $error = array();
 040   
 041          $auth_provider = $phpbb_container->get('auth.provider.' . $config['auth_method']);
 042   
 043          // confirm that the auth provider supports this page
 044          $provider_data = $auth_provider->get_auth_link_data();
 045          if ($provider_data === null)
 046          {
 047              $error[] = 'UCP_AUTH_LINK_NOT_SUPPORTED';
 048          }
 049   
 050          $s_hidden_fields = array();
 051          add_form_key('ucp_auth_link');
 052   
 053          $submit    = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
 054   
 055          // This path is only for primary actions
 056          if (!sizeof($error) && $submit)
 057          {
 058              if (!check_form_key('ucp_auth_link'))
 059              {
 060                  $error[] = 'FORM_INVALID';
 061              }
 062   
 063              if (!sizeof($error))
 064              {
 065                  // Any post data could be necessary for auth (un)linking
 066                  $link_data = $request->get_super_global(\phpbb\request\request_interface::POST);
 067   
 068                  // The current user_id is also necessary
 069                  $link_data['user_id'] = $user->data['user_id'];
 070   
 071                  // Tell the provider that the method is auth_link not login_link
 072                  $link_data['link_method'] = 'auth_link';
 073   
 074                  if ($request->variable('link', 0, false, \phpbb\request\request_interface::POST))
 075                  {
 076                      $error[] = $auth_provider->link_account($link_data);
 077                  }
 078                  else
 079                  {
 080                      $error[] = $auth_provider->unlink_account($link_data);
 081                  }
 082   
 083                  // Template data may have changed, get new data
 084                  $provider_data = $auth_provider->get_auth_link_data();
 085              }
 086          }
 087   
 088          // In some cases, a request to an external server may be required. In
 089          // these cases, the GET parameter 'link' should exist and should be true
 090          if ($request->variable('link', false))
 091          {
 092              // In this case the link data should only be populated with the
 093              // link_method as the provider dictates how data is returned to it.
 094              $link_data = array('link_method' => 'auth_link');
 095   
 096              $error[] = $auth_provider->link_account($link_data);
 097   
 098              // Template data may have changed, get new data
 099              $provider_data = $auth_provider->get_auth_link_data();
 100          }
 101   
 102          if (isset($provider_data['VARS']))
 103          {
 104              // Handle hidden fields separately
 105              if (isset($provider_data['VARS']['HIDDEN_FIELDS']))
 106              {
 107                  $s_hidden_fields = array_merge($s_hidden_fields, $provider_data['VARS']['HIDDEN_FIELDS']);
 108                  unset($provider_data['VARS']['HIDDEN_FIELDS']);
 109              }
 110   
 111              $template->assign_vars($provider_data['VARS']);
 112          }
 113   
 114          if (isset($provider_data['BLOCK_VAR_NAME']))
 115          {
 116              foreach ($provider_data['BLOCK_VARS'] as $block_vars)
 117              {
 118                  // See if there are additional hidden fields. This should be an associative array
 119                  if (isset($block_vars['HIDDEN_FIELDS']))
 120                  {
 121                      $block_vars['HIDDEN_FIELDS'] = build_hidden_fields($block_vars['HIDDEN_FIELDS']);
 122                  }
 123   
 124                  $template->assign_block_vars($provider_data['BLOCK_VAR_NAME'], $block_vars);
 125              }
 126          }
 127   
 128          $s_hidden_fields = build_hidden_fields($s_hidden_fields);
 129   
 130          // Replace "error" strings with their real, localised form
 131          $error = array_map(array($user, 'lang'), $error);
 132          $error = implode('<br />', $error);
 133   
 134          $template->assign_vars(array(
 135              'ERROR'    => $error,
 136   
 137              'PROVIDER_TEMPLATE_FILE'    => $provider_data['TEMPLATE_FILE'],
 138   
 139              'S_HIDDEN_FIELDS'    => $s_hidden_fields,
 140              'S_UCP_ACTION'        => $this->u_action,
 141          ));
 142   
 143          $this->tpl_name = 'ucp_auth_link';
 144          $this->page_title = 'UCP_AUTH_LINK';
 145      }
 146  }
 147