- Fixed port redirection for URL behind proxy

This commit is contained in:
Dave M. 2023-04-28 19:57:52 +00:00
parent 2fe97c60ed
commit f9c955a82a
2 changed files with 15 additions and 13 deletions

View File

@ -62,13 +62,13 @@ class SectionToken implements ControlStructure {
$order = $options['order'] ?? "count(\$___class__template->sectionList[$name]['$action'])";
return "<?php \$___class__template->sectionList[$name] ??= [ 'prepend' => [], 'append' => [], 'default' => [] ];".
return "<?php \$___class__template->sectionList[$name] ??= [ 'prepend' => [], 'append' => [], 'default' => [] ];" .
"\$___class__template->sectionList[$name]['$action'][] = [
'order' => $order,
'callback' => function() use (\$picea, \$___class__template, \$___global_variables, \$___variables, \$__event) {".
"extract(\$___global_variables); extract(\$___variables, \EXTR_OVERWRITE);
\$___class__template->sectionStack[] = $name;
\$__event->eventExecute(\Picea\Event\Builder\ClassTemplateRenderSection::class, $name);?>";
'callback' => function() use (\$picea, \$___class__template, \$___global_variables, \$___variables, \$__event) {" .
"extract(\$___global_variables); extract(\$___variables, \EXTR_OVERWRITE);" .
"\$___class__template->sectionStack[] = $name;" .
"\$__event->eventExecute(\Picea\Event\Builder\ClassTemplateRenderSection::class, $name);?>";
}
protected function printEndSection($context) : string
@ -76,13 +76,10 @@ class SectionToken implements ControlStructure {
$section = array_pop($context->sections);
$build = $context->extendFrom ? "!empty(\$___class__template->sectionStack) && \$___class__template->renderSection({$section['name']}, false);" : "\$___class__template->renderSection({$section['name']}, false);";
return <<<PHP
<?php
\$__event->eventExecute(\Picea\Event\Builder\ClassTemplateRenderSectionDone::class, {$section['name']});
array_pop(\$___class__template->sectionStack); }];
$build
?>
PHP;
return "<?php \$__event->eventExecute(\Picea\Event\Builder\ClassTemplateRenderSectionDone::class, {$section['name']});" .
"array_pop(\$___class__template->sectionStack); }];" .
$build .
"?>";
}
}

View File

@ -195,7 +195,12 @@ PATTERN;
protected function domain() : string
{
$port = $this->isDefaultPort() ? "" : ":" . $_SERVER['SERVER_PORT'];
if ( ! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) || ! empty($_SERVER['HTTP_X_FORWARDED_SSL']) ) {
$port = "";
}
else {
$port = $this->isDefaultPort() ? "" : ":" . $_SERVER['SERVER_PORT'];
}
return strtolower($this->appUrl ? $this->appUrl . $port : $_SERVER['HTTP_HOST']);
}