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

Dropbox.php

Zuletzt modifiziert: 01.05.2026, 11:28 - Dateigröße: 2.86 KiB


 001  <?php
 002   
 003  namespace OAuth\OAuth2\Service;
 004   
 005  use OAuth\Common\Consumer\CredentialsInterface;
 006  use OAuth\Common\Http\Client\ClientInterface;
 007  use OAuth\Common\Http\Exception\TokenResponseException;
 008  use OAuth\Common\Http\Uri\Uri;
 009  use OAuth\Common\Http\Uri\UriInterface;
 010  use OAuth\Common\Storage\TokenStorageInterface;
 011  use OAuth\OAuth2\Token\StdOAuth2Token;
 012   
 013  /**
 014   * Dropbox service.
 015   *
 016   * @author Flávio Heleno <flaviohbatista@gmail.com>
 017   *
 018   * @see https://www.dropbox.com/developers/core/docs
 019   */
 020  class Dropbox extends AbstractService
 021  {
 022      public function __construct(
 023          CredentialsInterface $credentials,
 024          ClientInterface $httpClient,
 025          TokenStorageInterface $storage,
 026          $scopes = [],
 027          ?UriInterface $baseApiUri = null
 028      ) {
 029          parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
 030   
 031          if (null === $baseApiUri) {
 032              $this->baseApiUri = new Uri('https://api.dropbox.com/1/');
 033          }
 034      }
 035   
 036      /**
 037       * {@inheritdoc}
 038       */
 039      public function getAuthorizationUri(array $additionalParameters = [])
 040      {
 041          $parameters = array_merge(
 042              $additionalParameters,
 043              [
 044                  'client_id' => $this->credentials->getConsumerId(),
 045                  'redirect_uri' => $this->credentials->getCallbackUrl(),
 046                  'response_type' => 'code',
 047              ]
 048          );
 049   
 050          $parameters['scope'] = implode(' ', $this->scopes);
 051   
 052          // Build the url
 053          $url = clone $this->getAuthorizationEndpoint();
 054          foreach ($parameters as $key => $val) {
 055              $url->addToQuery($key, $val);
 056          }
 057   
 058          return $url;
 059      }
 060   
 061      /**
 062       * {@inheritdoc}
 063       */
 064      public function getAuthorizationEndpoint()
 065      {
 066          return new Uri('https://www.dropbox.com/1/oauth2/authorize');
 067      }
 068   
 069      /**
 070       * {@inheritdoc}
 071       */
 072      public function getAccessTokenEndpoint()
 073      {
 074          return new Uri('https://api.dropbox.com/1/oauth2/token');
 075      }
 076   
 077      /**
 078       * {@inheritdoc}
 079       */
 080      protected function getAuthorizationMethod()
 081      {
 082          return static::AUTHORIZATION_METHOD_QUERY_STRING;
 083      }
 084   
 085      /**
 086       * {@inheritdoc}
 087       */
 088      protected function parseAccessTokenResponse($responseBody)
 089      {
 090          $data = json_decode($responseBody, true);
 091   
 092          if (null === $data || !is_array($data)) {
 093              throw new TokenResponseException('Unable to parse response.');
 094          } elseif (isset($data['error'])) {
 095              throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
 096          }
 097   
 098          $token = new StdOAuth2Token();
 099          $token->setAccessToken($data['access_token']);
 100   
 101          if (isset($data['refresh_token'])) {
 102              $token->setRefreshToken($data['refresh_token']);
 103              unset($data['refresh_token']);
 104          }
 105   
 106          unset($data['access_token']);
 107   
 108          $token->setExtraParams($data);
 109   
 110          return $token;
 111      }
 112  }
 113