Merge branch 'multi-server' into storageareas

This commit is contained in:
Isaac Connor 2016-01-04 14:09:41 -05:00
commit b9f17a18d6
2 changed files with 10 additions and 1 deletions

View File

@ -34,7 +34,11 @@ class Server {
} }
public function Url() { public function Url() {
if ( $this->Id() ) {
return ZM_BASE_PROTOCOL . '://'. $this->Hostname(); return ZM_BASE_PROTOCOL . '://'. $this->Hostname();
} else {
return '';
}
} }
public function Hostname() { public function Hostname() {
if ( isset( $this->{'Hostname'} ) and ( $this->{'Hostname'} != '' ) ) { if ( isset( $this->{'Hostname'} ) and ( $this->{'Hostname'} != '' ) ) {

View File

@ -99,6 +99,11 @@ function CORSHeaders() {
# The following is left for future reference/use. # The following is left for future reference/use.
$valid = false; $valid = false;
$servers = dbFetchAll( 'SELECT * FROM Servers' );
if ( sizeof($servers) <= 1 ) {
# Only need CORSHeaders in the event that there are multiple servers in use.
return;
}
foreach( dbFetchAll( 'SELECT * FROM Servers' ) as $row ) { foreach( dbFetchAll( 'SELECT * FROM Servers' ) as $row ) {
$Server = new Server( $row ); $Server = new Server( $row );
if ( $_SERVER['HTTP_ORIGIN'] == $Server->Url() ) { if ( $_SERVER['HTTP_ORIGIN'] == $Server->Url() ) {