Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

twitter.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 2.36 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  * Twitter OAuth service
 018  */
 019  class twitter extends \phpbb\auth\provider\oauth\service\base
 020  {
 021      /**
 022      * phpBB config
 023      *
 024      * @var \phpbb\config\config
 025      */
 026      protected $config;
 027   
 028      /**
 029      * phpBB request
 030      *
 031      * @var \phpbb\request\request_interface
 032      */
 033      protected $request;
 034   
 035      /**
 036      * Constructor
 037      *
 038      * @param    \phpbb\config\config                $config
 039      * @param    \phpbb\request\request_interface    $request
 040      */
 041      public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request)
 042      {
 043          $this->config = $config;
 044          $this->request = $request;
 045      }
 046   
 047      /**
 048      * {@inheritdoc}
 049      */
 050      public function get_service_credentials()
 051      {
 052          return array(
 053              'key'        => $this->config['auth_oauth_twitter_key'],
 054              'secret'    => $this->config['auth_oauth_twitter_secret'],
 055          );
 056      }
 057   
 058      /**
 059      * {@inheritdoc}
 060      */
 061      public function perform_auth_login()
 062      {
 063          if (!($this->service_provider instanceof \OAuth\OAuth1\Service\Twitter))
 064          {
 065              throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
 066          }
 067   
 068          $storage = $this->service_provider->getStorage();
 069          $token = $storage->retrieveAccessToken('Twitter');
 070          $tokensecret = $token->getRequestTokenSecret();
 071   
 072          // This was a callback request from twitter, get the token
 073          $this->service_provider->requestAccessToken(
 074              $this->request->variable('oauth_token', ''),
 075              $this->request->variable('oauth_verifier', ''),
 076              $tokensecret
 077          );
 078   
 079          // Send a request with it
 080          $result = json_decode($this->service_provider->request('account/verify_credentials.json'), true);
 081   
 082          // Return the unique identifier returned from twitter
 083          return $result['id'];
 084      }
 085   
 086      /**
 087      * {@inheritdoc}
 088      */
 089      public function perform_token_auth()
 090      {
 091          if (!($this->service_provider instanceof \OAuth\OAuth1\Service\Twitter))
 092          {
 093              throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
 094          }
 095   
 096          // Send a request with it
 097          $result = json_decode($this->service_provider->request('account/verify_credentials.json'), true);
 098   
 099          // Return the unique identifier returned from twitter
 100          return $result['id'];
 101      }
 102  }
 103