Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ServerBag.php
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\HttpFoundation;
013
014 /**
015 * ServerBag is a container for HTTP headers from the $_SERVER variable.
016 *
017 * @author Fabien Potencier <fabien@symfony.com>
018 * @author Bulat Shakirzyanov <mallluhuct@gmail.com>
019 * @author Robert Kiss <kepten@gmail.com>
020 */
021 class ServerBag extends ParameterBag
022 {
023 /**
024 * Gets the HTTP headers.
025 *
026 * @return array
027 */
028 public function getHeaders()
029 {
030 $headers = array();
031 $contentHeaders = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true);
032 foreach ($this->parameters as $key => $value) {
033 if (0 === strpos($key, 'HTTP_')) {
034 $headers[substr($key, 5)] = $value;
035 }
036 // CONTENT_* are not prefixed with HTTP_
037 elseif (isset($contentHeaders[$key])) {
038 $headers[$key] = $value;
039 }
040 }
041
042 if (isset($this->parameters['PHP_AUTH_USER'])) {
043 $headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER'];
044 $headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : '';
045 } else {
046 /*
047 * php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
048 * For this workaround to work, add these lines to your .htaccess file:
049 * RewriteCond %{HTTP:Authorization} ^(.+)$
050 * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
051 *
052 * A sample .htaccess file:
053 * RewriteEngine On
054 * RewriteCond %{HTTP:Authorization} ^(.+)$
055 * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
056 * RewriteCond %{REQUEST_FILENAME} !-f
057 * RewriteRule ^(.*)$ app.php [QSA,L]
058 */
059
060 $authorizationHeader = null;
061 if (isset($this->parameters['HTTP_AUTHORIZATION'])) {
062 $authorizationHeader = $this->parameters['HTTP_AUTHORIZATION'];
063 } elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) {
064 $authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION'];
065 }
066
067 if (null !== $authorizationHeader) {
068 if (0 === stripos($authorizationHeader, 'basic ')) {
069 // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic
070 $exploded = explode(':', base64_decode(substr($authorizationHeader, 6)), 2);
071 if (count($exploded) == 2) {
072 list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded;
073 }
074 } elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader, 'digest '))) {
075 // In some circumstances PHP_AUTH_DIGEST needs to be set
076 $headers['PHP_AUTH_DIGEST'] = $authorizationHeader;
077 $this->parameters['PHP_AUTH_DIGEST'] = $authorizationHeader;
078 } elseif (0 === stripos($authorizationHeader, 'bearer ')) {
079 /*
080 * XXX: Since there is no PHP_AUTH_BEARER in PHP predefined variables,
081 * I'll just set $headers['AUTHORIZATION'] here.
082 * http://php.net/manual/en/reserved.variables.server.php
083 */
084 $headers['AUTHORIZATION'] = $authorizationHeader;
085 }
086 }
087 }
088
089 if (isset($headers['AUTHORIZATION'])) {
090 return $headers;
091 }
092
093 // PHP_AUTH_USER/PHP_AUTH_PW
094 if (isset($headers['PHP_AUTH_USER'])) {
095 $headers['AUTHORIZATION'] = 'Basic '.base64_encode($headers['PHP_AUTH_USER'].':'.$headers['PHP_AUTH_PW']);
096 } elseif (isset($headers['PHP_AUTH_DIGEST'])) {
097 $headers['AUTHORIZATION'] = $headers['PHP_AUTH_DIGEST'];
098 }
099
100 return $headers;
101 }
102 }
103