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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Ssi.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\HttpKernel\HttpCache;
013
014 use Symfony\Component\HttpFoundation\Request;
015 use Symfony\Component\HttpFoundation\Response;
016
017 /**
018 * Ssi implements the SSI capabilities to Request and Response instances.
019 *
020 * @author Sebastian Krebs <krebs.seb@gmail.com>
021 */
022 class Ssi extends AbstractSurrogate
023 {
024 /**
025 * {@inheritdoc}
026 */
027 public function getName()
028 {
029 return 'ssi';
030 }
031
032 /**
033 * {@inheritdoc}
034 */
035 public function addSurrogateControl(Response $response)
036 {
037 if (false !== strpos($response->getContent(), '<!--#include')) {
038 $response->headers->set('Surrogate-Control', 'content="SSI/1.0"');
039 }
040 }
041
042 /**
043 * {@inheritdoc}
044 */
045 public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = '')
046 {
047 return sprintf('<!--#include virtual="%s" -->', $uri);
048 }
049
050 /**
051 * {@inheritdoc}
052 */
053 public function process(Request $request, Response $response)
054 {
055 $type = $response->headers->get('Content-Type');
056 if (empty($type)) {
057 $type = 'text/html';
058 }
059
060 $parts = explode(';', $type);
061 if (!\in_array($parts[0], $this->contentTypes)) {
062 return $response;
063 }
064
065 // we don't use a proper XML parser here as we can have SSI tags in a plain text response
066 $content = $response->getContent();
067
068 $chunks = preg_split('#<!--\#include\s+(.*?)\s*-->#', $content, -1, \PREG_SPLIT_DELIM_CAPTURE);
069 $chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]);
070
071 $i = 1;
072 while (isset($chunks[$i])) {
073 $options = [];
074 preg_match_all('/(virtual)="([^"]*?)"/', $chunks[$i], $matches, \PREG_SET_ORDER);
075 foreach ($matches as $set) {
076 $options[$set[1]] = $set[2];
077 }
078
079 if (!isset($options['virtual'])) {
080 throw new \RuntimeException('Unable to process an SSI tag without a "virtual" attribute.');
081 }
082
083 $chunks[$i] = sprintf('<?php echo $this->surrogate->handle($this, %s, \'\', false) ?>'."\n",
084 var_export($options['virtual'], true)
085 );
086 ++$i;
087 $chunks[$i] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[$i]);
088 ++$i;
089 }
090 $content = implode('', $chunks);
091
092 $response->setContent($content);
093 $response->headers->set('X-Body-Eval', 'SSI');
094
095 // remove SSI/1.0 from the Surrogate-Control header
096 $this->removeFromControl($response);
097
098 return $response;
099 }
100 }
101