Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

facebook.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 2.34 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  namespace phpbb\auth\provider\oauth\service;
 015   
 016  /**
 017   * Facebook OAuth service
 018   */
 019  class facebook extends base
 020  {
 021      /** @var \phpbb\config\config */
 022      protected $config;
 023   
 024      /** @var \phpbb\request\request_interface */
 025      protected $request;
 026   
 027      /**
 028       * Constructor.
 029       *
 030       * @param \phpbb\config\config                $config        Config object
 031       * @param \phpbb\request\request_interface    $request    Request object
 032       */
 033      public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request)
 034      {
 035          $this->config    = $config;
 036          $this->request    = $request;
 037      }
 038   
 039      /**
 040       * {@inheritdoc}
 041       */
 042      public function get_service_credentials()
 043      {
 044          return [
 045              'key'        => $this->config['auth_oauth_facebook_key'],
 046              'secret'    => $this->config['auth_oauth_facebook_secret'],
 047          ];
 048      }
 049   
 050      /**
 051       * {@inheritdoc}
 052       */
 053      public function perform_auth_login()
 054      {
 055          if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
 056          {
 057              throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
 058          }
 059   
 060          try
 061          {
 062              // This was a callback request, get the token
 063              $this->service_provider->requestAccessToken($this->request->variable('code', ''));
 064          }
 065          catch (\OAuth\Common\Http\Exception\TokenResponseException $e)
 066          {
 067              throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST');
 068          }
 069   
 070          try
 071          {
 072              // Send a request with it
 073              $result = (array) json_decode($this->service_provider->request('/me'), true);
 074          }
 075          catch (\OAuth\Common\Exception\Exception $e)
 076          {
 077              throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST');
 078          }
 079   
 080          // Return the unique identifier
 081          return $result['id'];
 082      }
 083   
 084      /**
 085       * {@inheritdoc}
 086       */
 087      public function perform_token_auth()
 088      {
 089          if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
 090          {
 091              throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
 092          }
 093   
 094          try
 095          {
 096              // Send a request with it
 097              $result = (array) json_decode($this->service_provider->request('/me'), true);
 098          }
 099          catch (\OAuth\Common\Exception\Exception $e)
 100          {
 101              throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST');
 102          }
 103   
 104          // Return the unique identifier
 105          return $result['id'];
 106      }
 107  }
 108