- Timestamp:
- May 14, 2019 2:17:07 AM (5 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r676 r679 78 78 'site_name' => null, 79 79 'site_email' => '', // Set to no-reply@HTTP_HOST if not set here. 80 'site_hostname' => '', // The hostname of this application (if not set, use a cleaned HTTP_HOST environment variable). 80 'site_hostname' => '', // The hostname of this application (if not set, derived from HTTP_HOST). 81 'site_port' => '', // The hostname of this application (if not set, derived from HTTP_HOST). 81 82 'site_url' => '', // URL to the root of the site (created during App->start()). 82 83 'page_url' => '', // URL to the current page (created during App->start()). … … 146 147 'db_pass' => null, 147 148 148 // And for CLI scripts, which should include a JSON file at this specified locationin the include path.149 // CLI scripts will need this JSON file in the include path. 149 150 'db_auth_file' => 'db_auth.json', 150 151 … … 479 480 */ 480 481 481 // To get a safe hostname, remove hostport and invalid hostname characters.482 // To get a safe hostname, remove port and invalid hostname characters. 482 483 $safe_http_host = preg_replace('/[^a-z\d.:-]/', '', strtok(getenv('HTTP_HOST'), ':')); 484 // If strtok() matched a ':' in the previous line, the rest of the string contains the port number (or FALSE) 485 $safe_http_port = preg_replace('/[^0-9]/', '', strtok('')); 483 486 if ('' != $safe_http_host && '' == $this->getParam('site_hostname')) { 484 487 $this->setParam(array('site_hostname' => $safe_http_host)); 488 } 489 if ('' != $safe_http_port && '' == $this->getParam('site_port')) { 490 $this->setParam(array('site_port' => $safe_http_port)); 485 491 } 486 492 … … 489 495 // Not available on CLI scripts obviously. 490 496 if ('' != $safe_http_host && '' == $this->getParam('site_url')) { 491 $this->setParam(array('site_url' => sprintf('%s://%s ', (getenv('HTTPS') ? 'https' : 'http'), $safe_http_host)));497 $this->setParam(array('site_url' => sprintf('%s://%s%s', (getenv('HTTPS') ? 'https' : 'http'), $safe_http_host, (preg_match('/^(|80|443)$/', $safe_http_port) ? '' : ':' . $safe_http_port)))); 492 498 } 493 499 … … 495 501 // Also not available on CLI scripts obviously. 496 502 if ('' != $safe_http_host) { 497 $this->setParam(array('page_url' => sprintf('%s ://%s%s', (getenv('HTTPS') ? 'https' : 'http'), $safe_http_host, getenv('REQUEST_URI'))));503 $this->setParam(array('page_url' => sprintf('%s%s', $this->getParam('site_url'), getenv('REQUEST_URI')))); 498 504 } 499 505 … … 1396 1402 1397 1403 if (preg_match('!^/!', $url)) { 1398 // If relative URL is given, prepend correct local hostname. 1399 $scheme = getenv('HTTPS') ? 'https' : 'http'; 1400 $host = $this->getParam('site_hostname'); 1401 $url = sprintf('%s://%s%s', $scheme, $host, $url); 1404 // If relative URL is given, prepend site_url, which contains: scheme://hostname[:port] 1405 $url = sprintf('%s%s', $this->getParam('site_url'), $url); 1402 1406 } 1403 1407 … … 1705 1709 1706 1710 /* 1707 * Set timezone used internally by PHP. 1711 * Set timezone used internally by PHP. See full list at https://www.php.net/manual/en/timezones.php 1708 1712 * 1709 1713 * @access public -
trunk/lib/DB.inc.php
r665 r679 339 339 $debugqry = preg_replace("/\n[\t ]+/", "\n", $query); 340 340 if ($this->getParam('db_always_debug') || $debug) { 341 echo "<!-- ----------------- Query $this->_query_count ---------------------\n$debugqry\n-->\n"; 341 if ($debug > 1) { 342 dump($debugqry, true, SC_DUMP_PRINT_R, __FILE__, __LINE__); 343 } else { 344 echo "<!-- ----------------- Query $this->_query_count ---------------------\n$debugqry\n-->\n"; 345 } 342 346 } 343 347 -
trunk/lib/Utilities.inc.php
r672 r679 1452 1452 $ch = curl_init($url); 1453 1453 curl_setopt($ch, CURLOPT_TIMEOUT, 5); 1454 curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); 1454 1455 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 1455 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);1456 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 1456 1457 curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"); 1457 1458 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Don't pass through data to the browser.
Note: See TracChangeset
for help on using the changeset viewer.