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

bitly.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 2.09 KiB


 01  <?php
 02  /**
 03  *
 04  * This file is part of the phpBB Forum Software package.
 05  *
 06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 07  * @license GNU General Public License, version 2 (GPL-2.0)
 08  *
 09  * For full copyright and license information, please see
 10  * the docs/CREDITS.txt file.
 11  *
 12  */
 13   
 14  namespace phpbb\auth\provider\oauth\service;
 15   
 16  /**
 17  * Bitly OAuth service
 18  */
 19  class bitly extends \phpbb\auth\provider\oauth\service\base
 20  {
 21      /**
 22      * phpBB config
 23      *
 24      * @var \phpbb\config\config
 25      */
 26      protected $config;
 27   
 28      /**
 29      * phpBB request
 30      *
 31      * @var \phpbb\request\request_interface
 32      */
 33      protected $request;
 34   
 35      /**
 36      * Constructor
 37      *
 38      * @param    \phpbb\config\config                $config
 39      * @param    \phpbb\request\request_interface    $request
 40      */
 41      public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request)
 42      {
 43          $this->config = $config;
 44          $this->request = $request;
 45      }
 46   
 47      /**
 48      * {@inheritdoc}
 49      */
 50      public function get_service_credentials()
 51      {
 52          return array(
 53              'key'        => $this->config['auth_oauth_bitly_key'],
 54              'secret'    => $this->config['auth_oauth_bitly_secret'],
 55          );
 56      }
 57   
 58      /**
 59      * {@inheritdoc}
 60      */
 61      public function perform_auth_login()
 62      {
 63          if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly))
 64          {
 65              throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
 66          }
 67   
 68          // This was a callback request from bitly, get the token
 69          $this->service_provider->requestAccessToken($this->request->variable('code', ''));
 70   
 71          // Send a request with it
 72          $result = json_decode($this->service_provider->request('user/info'), true);
 73   
 74          // Return the unique identifier returned from bitly
 75          return $result['data']['login'];
 76      }
 77   
 78      /**
 79      * {@inheritdoc}
 80      */
 81      public function perform_token_auth()
 82      {
 83          if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly))
 84          {
 85              throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
 86          }
 87   
 88          // Send a request with it
 89          $result = json_decode($this->service_provider->request('user/info'), true);
 90   
 91          // Return the unique identifier returned from bitly
 92          return $result['data']['login'];
 93      }
 94  }
 95