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

UrlConfig.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 2.75 KiB


 001  <?php
 002   
 003  /**
 004  * @package   s9e\TextFormatter
 005  * @copyright Copyright (c) 2010-2022 The s9e authors
 006  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
 007  */
 008  namespace s9e\TextFormatter\Configurator;
 009   
 010  use RuntimeException;
 011  use s9e\TextFormatter\Configurator\Collections\HostnameList;
 012  use s9e\TextFormatter\Configurator\Collections\SchemeList;
 013  use s9e\TextFormatter\Configurator\Helpers\ConfigHelper;
 014   
 015  class UrlConfig implements ConfigProvider
 016  {
 017      /**
 018      * @var SchemeList List of allowed schemes
 019      */
 020      protected $allowedSchemes;
 021   
 022      /**
 023      * @var HostnameList List of disallowed hosts
 024      */
 025      protected $disallowedHosts;
 026   
 027      /**
 028      * @var HostnameList List of allowed hosts
 029      */
 030      protected $restrictedHosts;
 031   
 032      /**
 033      * Constructor
 034      */
 035      public function __construct()
 036      {
 037          $this->disallowedHosts = new HostnameList;
 038          $this->restrictedHosts = new HostnameList;
 039   
 040          $this->allowedSchemes   = new SchemeList;
 041          $this->allowedSchemes[] = 'http';
 042          $this->allowedSchemes[] = 'https';
 043      }
 044   
 045      /**
 046      * {@inheritdoc}
 047      */
 048      public function asConfig()
 049      {
 050          return ConfigHelper::toArray(get_object_vars($this));
 051      }
 052   
 053      /**
 054      * Allow a URL scheme
 055      *
 056      * @param string $scheme URL scheme, e.g. "file" or "ed2k"
 057      * @return void
 058      */
 059      public function allowScheme($scheme)
 060      {
 061          if (strtolower($scheme) === 'javascript')
 062          {
 063              throw new RuntimeException('The JavaScript URL scheme cannot be allowed');
 064          }
 065   
 066          $this->allowedSchemes[] = $scheme;
 067      }
 068   
 069      /**
 070      * Disallow a hostname (or hostname mask) from being used in URLs
 071      *
 072      * @param  string $host            Hostname or hostmask
 073      * @param  bool   $matchSubdomains Whether to match subdomains of given host
 074      * @return void
 075      */
 076      public function disallowHost($host, $matchSubdomains = true)
 077      {
 078          $this->disallowedHosts[] = $host;
 079   
 080          if ($matchSubdomains && substr($host, 0, 1) !== '*')
 081          {
 082              $this->disallowedHosts[] = '*.' . $host;
 083          }
 084      }
 085   
 086      /**
 087      * Remove a scheme from the list of allowed URL schemes
 088      *
 089      * @param  string $scheme URL scheme, e.g. "file" or "ed2k"
 090      * @return void
 091      */
 092      public function disallowScheme($scheme)
 093      {
 094          $this->allowedSchemes->remove($scheme);
 095      }
 096   
 097      /**
 098      * Return the list of allowed URL schemes
 099      *
 100      * @return array
 101      */
 102      public function getAllowedSchemes()
 103      {
 104          return iterator_to_array($this->allowedSchemes);
 105      }
 106   
 107      /**
 108      * Allow a hostname (or hostname mask) to being used in URLs while disallowing everything else
 109      *
 110      * Can be called multiple times to restricts URLs to a set of given hostnames
 111      *
 112      * @param  string $host            Hostname or hostmask
 113      * @param  bool   $matchSubdomains Whether to match subdomains of given host
 114      * @return void
 115      */
 116      public function restrictHost($host, $matchSubdomains = true)
 117      {
 118          $this->restrictedHosts[] = $host;
 119   
 120          if ($matchSubdomains && substr($host, 0, 1) !== '*')
 121          {
 122              $this->restrictedHosts[] = '*.' . $host;
 123          }
 124      }
 125  }