Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/site/PhabricatorPlatformSite.php
<?php | <?php | ||||
final class PhabricatorPlatformSite extends PhabricatorSite { | final class PhabricatorPlatformSite extends PhabricatorSite { | ||||
public function getDescription() { | public function getDescription() { | ||||
return pht('Serves the core platform and applications.'); | return pht('Serves the core platform and applications.'); | ||||
} | } | ||||
public function getPriority() { | public function getPriority() { | ||||
return 1000; | return 1000; | ||||
} | } | ||||
public function newSiteForRequest(AphrontRequest $request) { | public function newSiteForRequest(AphrontRequest $request) { | ||||
$uris = array(); | $uris = array(); | ||||
$uris[] = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); | $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); | ||||
$uris[] = $base_uri; | |||||
$uris[] = PhabricatorEnv::getEnvConfig('phabricator.production-uri'); | $uris[] = PhabricatorEnv::getEnvConfig('phabricator.production-uri'); | ||||
$allowed = PhabricatorEnv::getEnvConfig('phabricator.allowed-uris'); | $allowed = PhabricatorEnv::getEnvConfig('phabricator.allowed-uris'); | ||||
if ($allowed) { | if ($allowed) { | ||||
foreach ($allowed as $uri) { | foreach ($allowed as $uri) { | ||||
$uris[] = $uri; | $uris[] = $uri; | ||||
} | } | ||||
} | } | ||||
$host = $request->getHost(); | $host = $request->getHost(); | ||||
if ($this->isHostMatch($host, $uris)) { | if ($this->isHostMatch($host, $uris) || !$base_uri) { | ||||
return new PhabricatorPlatformSite(); | return new PhabricatorPlatformSite(); | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
} | } |