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

Google.php

Zuletzt modifiziert: 01.05.2026, 11:28 - Dateigröße: 9.07 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\Service\Exception\InvalidAccessTypeException;
 012  use OAuth\OAuth2\Token\StdOAuth2Token;
 013   
 014  class Google extends AbstractService
 015  {
 016      /**
 017       * Defined scopes - More scopes are listed here:
 018       * https://developers.google.com/oauthplayground/.
 019       *
 020       * Make a pull request if you need more scopes.
 021       */
 022   
 023      // Basic
 024      const SCOPE_EMAIL = 'email';
 025      const SCOPE_PROFILE = 'profile';
 026   
 027      const SCOPE_USERINFO_EMAIL = 'https://www.googleapis.com/auth/userinfo.email';
 028      const SCOPE_USERINFO_PROFILE = 'https://www.googleapis.com/auth/userinfo.profile';
 029   
 030      // Google+
 031      const SCOPE_GPLUS_ME = 'https://www.googleapis.com/auth/plus.me';
 032      const SCOPE_GPLUS_LOGIN = 'https://www.googleapis.com/auth/plus.login';
 033      const SCOPE_GPLUS_CIRCLES_READ = 'https://www.googleapis.com/auth/plus.circles.read';
 034      const SCOPE_GPLUS_CIRCLES_WRITE = 'https://www.googleapis.com/auth/plus.circles.write';
 035      const SCOPE_GPLUS_STREAM_READ = 'https://www.googleapis.com/auth/plus.stream.read';
 036      const SCOPE_GPLUS_STREAM_WRITE = 'https://www.googleapis.com/auth/plus.stream.write';
 037      const SCOPE_GPLUS_MEDIA = 'https://www.googleapis.com/auth/plus.media.upload';
 038      const SCOPE_EMAIL_PLUS = 'https://www.googleapis.com/auth/plus.profile.emails.read';
 039   
 040      // Google Drive
 041      const SCOPE_DOCUMENTSLIST = 'https://docs.google.com/feeds/';
 042      const SCOPE_SPREADSHEETS = 'https://spreadsheets.google.com/feeds/';
 043      const SCOPE_GOOGLEDRIVE = 'https://www.googleapis.com/auth/drive';
 044      const SCOPE_DRIVE_APPS = 'https://www.googleapis.com/auth/drive.appdata';
 045      const SCOPE_DRIVE_APPS_READ_ONLY = 'https://www.googleapis.com/auth/drive.apps.readonly';
 046      const SCOPE_GOOGLEDRIVE_FILES = 'https://www.googleapis.com/auth/drive.file';
 047      const SCOPE_DRIVE_METADATA_READ_ONLY = 'https://www.googleapis.com/auth/drive.metadata.readonly';
 048      const SCOPE_DRIVE_READ_ONLY = 'https://www.googleapis.com/auth/drive.readonly';
 049      const SCOPE_DRIVE_SCRIPTS = 'https://www.googleapis.com/auth/drive.scripts';
 050   
 051      // Adwords
 052      const SCOPE_ADSENSE = 'https://www.googleapis.com/auth/adsense';
 053      const SCOPE_ADWORDS = 'https://www.googleapis.com/auth/adwords';
 054      const SCOPE_ADWORDS_DEPRECATED = 'https://www.googleapis.com/auth/adwords/'; //deprecated in v201406 API version
 055      const SCOPE_GAN = 'https://www.googleapis.com/auth/gan'; // google affiliate network...?
 056   
 057      //Doubleclick for Publishers
 058      const SCOPE_DFP = 'https://www.googleapis.com/auth/dfp';
 059      const SCOPE_DFP_TRAFFICKING = 'https://www.googleapis.com/auth/dfatrafficking';
 060      const SCOPE_DFP_REPORTING = 'https://www.googleapis.com/auth/dfareporting';
 061   
 062      // Google Analytics
 063      const SCOPE_ANALYTICS = 'https://www.googleapis.com/auth/analytics';
 064      const SCOPE_ANALYTICS_EDIT = 'https://www.googleapis.com/auth/analytics.edit';
 065      const SCOPE_ANALYTICS_MANAGE_USERS = 'https://www.googleapis.com/auth/analytics.manage.users';
 066      const SCOPE_ANALYTICS_READ_ONLY = 'https://www.googleapis.com/auth/analytics.readonly';
 067   
 068      //Gmail
 069      const SCOPE_GMAIL_MODIFY = 'https://www.googleapis.com/auth/gmail.modify';
 070      const SCOPE_GMAIL_READONLY = 'https://www.googleapis.com/auth/gmail.readonly';
 071      const SCOPE_GMAIL_COMPOSE = 'https://www.googleapis.com/auth/gmail.compose';
 072      const SCOPE_GMAIL_SEND = 'https://www.googleapis.com/auth/gmail.send';
 073      const SCOPE_GMAIL_INSERT = 'https://www.googleapis.com/auth/gmail.insert';
 074      const SCOPE_GMAIL_LABELS = 'https://www.googleapis.com/auth/gmail.labels';
 075      const SCOPE_GMAIL_FULL = 'https://mail.google.com/';
 076   
 077      // Other services
 078      const SCOPE_BOOKS = 'https://www.googleapis.com/auth/books';
 079      const SCOPE_BLOGGER = 'https://www.googleapis.com/auth/blogger';
 080      const SCOPE_CALENDAR = 'https://www.googleapis.com/auth/calendar';
 081      const SCOPE_CALENDAR_READ_ONLY = 'https://www.googleapis.com/auth/calendar.readonly';
 082      const SCOPE_CONTACT = 'https://www.google.com/m8/feeds/';
 083      const SCOPE_CONTACTS_RO = 'https://www.googleapis.com/auth/contacts.readonly';
 084      const SCOPE_CHROMEWEBSTORE = 'https://www.googleapis.com/auth/chromewebstore.readonly';
 085      const SCOPE_GMAIL = 'https://mail.google.com/mail/feed/atom';
 086      const SCOPE_GMAIL_IMAP_SMTP = 'https://mail.google.com';
 087      const SCOPE_PICASAWEB = 'https://picasaweb.google.com/data/';
 088      const SCOPE_SITES = 'https://sites.google.com/feeds/';
 089      const SCOPE_URLSHORTENER = 'https://www.googleapis.com/auth/urlshortener';
 090      const SCOPE_WEBMASTERTOOLS = 'https://www.google.com/webmasters/tools/feeds/';
 091      const SCOPE_TASKS = 'https://www.googleapis.com/auth/tasks';
 092   
 093      // Cloud services
 094      const SCOPE_CLOUDSTORAGE = 'https://www.googleapis.com/auth/devstorage.read_write';
 095      const SCOPE_CONTENTFORSHOPPING = 'https://www.googleapis.com/auth/structuredcontent'; // what even is this
 096      const SCOPE_USER_PROVISIONING = 'https://apps-apis.google.com/a/feeds/user/';
 097      const SCOPE_GROUPS_PROVISIONING = 'https://apps-apis.google.com/a/feeds/groups/';
 098      const SCOPE_NICKNAME_PROVISIONING = 'https://apps-apis.google.com/a/feeds/alias/';
 099   
 100      // Old
 101      const SCOPE_ORKUT = 'https://www.googleapis.com/auth/orkut';
 102      const SCOPE_GOOGLELATITUDE =
 103          'https://www.googleapis.com/auth/latitude.all.best https://www.googleapis.com/auth/latitude.all.city';
 104      const SCOPE_OPENID = 'openid';
 105   
 106      // YouTube
 107      const SCOPE_YOUTUBE_GDATA = 'https://gdata.youtube.com';
 108      const SCOPE_YOUTUBE_ANALYTICS_MONETARY = 'https://www.googleapis.com/auth/yt-analytics-monetary.readonly';
 109      const SCOPE_YOUTUBE_ANALYTICS = 'https://www.googleapis.com/auth/yt-analytics.readonly';
 110      const SCOPE_YOUTUBE = 'https://www.googleapis.com/auth/youtube';
 111      const SCOPE_YOUTUBE_READ_ONLY = 'https://www.googleapis.com/auth/youtube.readonly';
 112      const SCOPE_YOUTUBE_UPLOAD = 'https://www.googleapis.com/auth/youtube.upload';
 113      const SCOPE_YOUTUBE_PARTNER = 'https://www.googleapis.com/auth/youtubepartner';
 114      const SCOPE_YOUTUBE_PARTNER_AUDIT = 'https://www.googleapis.com/auth/youtubepartner-channel-audit';
 115   
 116      // Google Glass
 117      const SCOPE_GLASS_TIMELINE = 'https://www.googleapis.com/auth/glass.timeline';
 118      const SCOPE_GLASS_LOCATION = 'https://www.googleapis.com/auth/glass.location';
 119   
 120      // Android Publisher
 121      const SCOPE_ANDROID_PUBLISHER = 'https://www.googleapis.com/auth/androidpublisher';
 122   
 123      // Google Classroom
 124      const SCOPE_CLASSROOM_COURSES = 'https://www.googleapis.com/auth/classroom.courses';
 125      const SCOPE_CLASSROOM_COURSES_READONLY = 'https://www.googleapis.com/auth/classroom.courses.readonly';
 126      const SCOPE_CLASSROOM_PROFILE_EMAILS = 'https://www.googleapis.com/auth/classroom.profile.emails';
 127      const SCOPE_CLASSROOM_PROFILE_PHOTOS = 'https://www.googleapis.com/auth/classroom.profile.photos';
 128      const SCOPE_CLASSROOM_ROSTERS = 'https://www.googleapis.com/auth/classroom.rosters';
 129      const SCOPE_CLASSROOM_ROSTERS_READONLY = 'https://www.googleapis.com/auth/classroom.rosters.readonly';
 130   
 131      protected $accessType = 'online';
 132   
 133      public function __construct(
 134          CredentialsInterface $credentials,
 135          ClientInterface $httpClient,
 136          TokenStorageInterface $storage,
 137          $scopes = [],
 138          ?UriInterface $baseApiUri = null
 139      ) {
 140          parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true);
 141   
 142          if (null === $baseApiUri) {
 143              $this->baseApiUri = new Uri('https://www.googleapis.com/oauth2/v1/');
 144          }
 145      }
 146   
 147      public function setAccessType($accessType): void
 148      {
 149          if (!in_array($accessType, ['online', 'offline'], true)) {
 150              throw new InvalidAccessTypeException('Invalid accessType, expected either online or offline');
 151          }
 152          $this->accessType = $accessType;
 153      }
 154   
 155      /**
 156       * {@inheritdoc}
 157       */
 158      public function getAuthorizationEndpoint()
 159      {
 160          return new Uri('https://accounts.google.com/o/oauth2/auth?access_type=' . $this->accessType);
 161      }
 162   
 163      /**
 164       * {@inheritdoc}
 165       */
 166      public function getAccessTokenEndpoint()
 167      {
 168          return new Uri('https://oauth2.googleapis.com/token');
 169      }
 170   
 171      /**
 172       * {@inheritdoc}
 173       */
 174      protected function parseAccessTokenResponse($responseBody)
 175      {
 176          $data = json_decode($responseBody, true);
 177   
 178          if (null === $data || !is_array($data)) {
 179              throw new TokenResponseException('Unable to parse response.');
 180          } elseif (isset($data['error'])) {
 181              throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
 182          }
 183   
 184          $token = new StdOAuth2Token();
 185          $token->setAccessToken($data['access_token']);
 186          $token->setLifetime($data['expires_in']);
 187   
 188          if (isset($data['refresh_token'])) {
 189              $token->setRefreshToken($data['refresh_token']);
 190              unset($data['refresh_token']);
 191          }
 192   
 193          unset($data['access_token'], $data['expires_in']);
 194   
 195          $token->setExtraParams($data);
 196   
 197          return $token;
 198      }
 199  }
 200