Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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

Redmine.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 2.81 KiB


01  <?php
02   
03  namespace OAuth\OAuth1\Service;
04   
05  use Exception;
06  use OAuth\Common\Consumer\CredentialsInterface;
07  use OAuth\Common\Http\Client\ClientInterface;
08  use OAuth\Common\Http\Exception\TokenResponseException;
09  use OAuth\Common\Http\Uri\Uri;
10  use OAuth\Common\Http\Uri\UriInterface;
11  use OAuth\Common\Storage\TokenStorageInterface;
12  use OAuth\OAuth1\Signature\SignatureInterface;
13  use OAuth\OAuth1\Token\StdOAuth1Token;
14   
15  class Redmine extends AbstractService
16  {
17      public function __construct(
18          CredentialsInterface $credentials,
19          ClientInterface $httpClient,
20          TokenStorageInterface $storage,
21          SignatureInterface $signature,
22          UriInterface $baseApiUri
23      ) {
24          parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
25   
26          if (null === $baseApiUri) {
27              throw new Exception('baseApiUri is a required argument.');
28          }
29      }
30   
31      /**
32       * {@inheritdoc}
33       */
34      public function getRequestTokenEndpoint()
35      {
36          return new Uri($this->baseApiUri->getAbsoluteUri() . '/request_token');
37      }
38   
39      /**
40       * {@inheritdoc}
41       */
42      public function getAuthorizationEndpoint()
43      {
44          return new Uri($this->baseApiUri->getAbsoluteUri() . '/authorize');
45      }
46   
47      /**
48       * {@inheritdoc}
49       */
50      public function getAccessTokenEndpoint()
51      {
52          return new Uri($this->baseApiUri->getAbsoluteUri() . '/access_token');
53      }
54   
55      /**
56       * {@inheritdoc}
57       */
58      protected function parseRequestTokenResponse($responseBody)
59      {
60          parse_str($responseBody, $data);
61   
62          if (null === $data || !is_array($data)) {
63              throw new TokenResponseException('Unable to parse response.');
64          } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') {
65              throw new TokenResponseException('Error in retrieving token.');
66          }
67   
68          return $this->parseAccessTokenResponse($responseBody);
69      }
70   
71      /**
72       * {@inheritdoc}
73       */
74      protected function parseAccessTokenResponse($responseBody)
75      {
76          parse_str($responseBody, $data);
77   
78          if (null === $data || !is_array($data)) {
79              throw new TokenResponseException('Unable to parse response.');
80          } elseif (isset($data['error'])) {
81              throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
82          }
83   
84          $token = new StdOAuth1Token();
85   
86          $token->setRequestToken($data['oauth_token']);
87          $token->setRequestTokenSecret($data['oauth_token_secret']);
88          $token->setAccessToken($data['oauth_token']);
89          $token->setAccessTokenSecret($data['oauth_token_secret']);
90   
91          $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES);
92          unset($data['oauth_token'], $data['oauth_token_secret']);
93          $token->setExtraParams($data);
94   
95          return $token;
96      }
97  }
98