- Timestamp:
- May 3, 2019 2:43:15 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r671 r676 479 479 */ 480 480 481 $safe_http_host = preg_replace('/[^a-z\d.:-]/', '', getenv('HTTP_HOST')); 481 // To get a safe hostname, remove host port and invalid hostname characters. 482 $safe_http_host = preg_replace('/[^a-z\d.:-]/', '', strtok(getenv('HTTP_HOST'), ':')); 482 483 if ('' != $safe_http_host && '' == $this->getParam('site_hostname')) { 483 484 $this->setParam(array('site_hostname' => $safe_http_host)); … … 487 488 // and is used whenever a URL need be used to the current site. 488 489 // Not available on CLI scripts obviously. 489 if ( $safe_http_host && '' == $this->getParam('site_url')) {490 if ('' != $safe_http_host && '' == $this->getParam('site_url')) { 490 491 $this->setParam(array('site_url' => sprintf('%s://%s', (getenv('HTTPS') ? 'https' : 'http'), $safe_http_host))); 491 492 }
Note: See TracChangeset
for help on using the changeset viewer.