- Fixed port redirection for URL behind proxy
This commit is contained in:
		
							parent
							
								
									2fe97c60ed
								
							
						
					
					
						commit
						f9c955a82a
					
				| @ -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 . | ||||
|                 "?>"; | ||||
| 
 | ||||
|     } | ||||
| } | ||||
| @ -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']); | ||||
|     } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user