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

Bitrix24.php

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


 001  <?php
 002   
 003  namespace OAuth\OAuth2\Service;
 004   
 005  use OAuth\Common\Http\Exception\TokenResponseException;
 006  use OAuth\Common\Http\Uri\Uri;
 007  use OAuth\OAuth2\Token\StdOAuth2Token;
 008   
 009  class Bitrix24 extends AbstractService
 010  {
 011      const SCOPE_DEPARTMENT = 'department';
 012      const SCOPE_CRM = 'crm';
 013      const SCOPE_CALENDAR = 'calendar';
 014      const SCOPE_USER = 'user';
 015      const SCOPE_ENTITY = 'entity';
 016      const SCOPE_TASK = 'task';
 017      const SCOPE_TASKS_EXTENDED = 'tasks_extended';
 018      const SCOPE_IM = 'im';
 019      const SCOPE_LOG = 'log';
 020      const SCOPE_SONET_GROUP = 'sonet_group';
 021   
 022      /**
 023       * {@inheritdoc}
 024       */
 025      public function getAuthorizationEndpoint()
 026      {
 027          return new Uri(sprintf('%s/oauth/authorize/', $this->baseApiUri));
 028      }
 029   
 030      /**
 031       * {@inheritdoc}
 032       */
 033      public function getAccessTokenEndpoint()
 034      {
 035          return new Uri(sprintf('%s/oauth/token/', $this->baseApiUri));
 036      }
 037   
 038      /**
 039       * {@inheritdoc}
 040       */
 041      protected function getAuthorizationMethod()
 042      {
 043          return static::AUTHORIZATION_METHOD_QUERY_STRING_V4;
 044      }
 045   
 046      /**
 047       * {@inheritdoc}
 048       */
 049      public function requestAccessToken($code, $state = null)
 050      {
 051          if (null !== $state) {
 052              $this->validateAuthorizationState($state);
 053          }
 054   
 055          $responseBody = $this->httpClient->retrieveResponse(
 056              $this->getAccessTokenUri($code),
 057              [],
 058              $this->getExtraOAuthHeaders(),
 059              'GET'
 060          );
 061   
 062          $token = $this->parseAccessTokenResponse($responseBody);
 063          $this->storage->storeAccessToken($this->service(), $token);
 064   
 065          return $token;
 066      }
 067   
 068      /**
 069       * {@inheritdoc}
 070       */
 071      public function getAccessTokenUri($code)
 072      {
 073          $parameters = [
 074              'code' => $code,
 075              'client_id' => $this->credentials->getConsumerId(),
 076              'client_secret' => $this->credentials->getConsumerSecret(),
 077              'redirect_uri' => $this->credentials->getCallbackUrl(),
 078              'grant_type' => 'authorization_code',
 079              'scope' => $this->scopes,
 080          ];
 081   
 082          $parameters['scope'] = implode(' ', $this->scopes);
 083   
 084          // Build the url
 085          $url = $this->getAccessTokenEndpoint();
 086          foreach ($parameters as $key => $val) {
 087              $url->addToQuery($key, $val);
 088          }
 089   
 090          return $url;
 091      }
 092   
 093      /**
 094       * {@inheritdoc}
 095       */
 096      protected function parseAccessTokenResponse($responseBody)
 097      {
 098          $data = json_decode($responseBody, true);
 099   
 100          if (null === $data || !is_array($data)) {
 101              throw new TokenResponseException('Unable to parse response.');
 102          } elseif (isset($data['error'])) {
 103              throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
 104          }
 105   
 106          $token = new StdOAuth2Token();
 107          $token->setAccessToken($data['access_token']);
 108          $token->setLifetime($data['expires_in']);
 109   
 110          if (isset($data['refresh_token'])) {
 111              $token->setRefreshToken($data['refresh_token']);
 112              unset($data['refresh_token']);
 113          }
 114   
 115          unset($data['access_token'], $data['expires_in']);
 116   
 117          $token->setExtraParams($data);
 118   
 119          return $token;
 120      }
 121  }
 122