Skip to content

Commit

Permalink
Update SubsiteFluentDirectorInjector.php
Browse files Browse the repository at this point in the history
  • Loading branch information
chromos33 authored Dec 9, 2020
1 parent 66a31a6 commit e263906
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Extensions/SubsiteFluentDirectorInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

class FluentDirectorExtensionInjector extends FluentDirectorExtension
{
public function AdminAddressInSERVER()
{
return (array_key_exists("REQUEST_URI",$_SERVER) && strpos($_SERVER["REQUEST_URI"],"admin/pages") !== false ) || (array_key_exists("REDIRECT_URL",$_SERVER) && strpos($_SERVER["REDIRECT_URL"],"admin/pages") !== false );
}
public function updateRules(&$rules)
{
$originalRules = $rules;
Expand All @@ -34,7 +38,7 @@ public function updateRules(&$rules)
Injector::inst()->create(InitStateMiddleware::class)->process($request, function () {
});
$defaultLocale = null;
if(class_exists("\SilverStripe\Subsites\Model\SubsiteDomain") && array_key_exists("HTTP_HOST",$_SERVER))
if(class_exists("\SilverStripe\Subsites\Model\SubsiteDomain") && array_key_exists("HTTP_HOST",$_SERVER) && !$this->AdminAddressInSERVER())
{
try{
$host = Convert::raw2sql($_SERVER["HTTP_HOST"]);
Expand Down

0 comments on commit e263906

Please sign in to comment.