= 2 && ($value[0] === '"' || $value[0] === "'") && substr($value, -1) === $value[0]) $value = substr($value, 1, -1); $values[$name] = $value; } } } return array_key_exists($key, $values) ? $values[$key] : $default; } /* * Send a plain HTTP request to the same page over HTTPS, and stop. The * host comes from SITE_URL, because the browser controls the Host header. * Without SITE_URL, the page refuses plain HTTP. */ function require_https() { if (isset($_SERVER['HTTPS'])) return; $site = parse_url((string)config('SITE_URL', '')); if (empty($site['host'])) { http_response_code(403); echo "This page needs HTTPS.\n"; } else { $port = isset($site['port']) ? ':' . $site['port'] : ''; header('Location: https://' . $site['host'] . $port . $_SERVER['REQUEST_URI']); } exit; } // Always log PHP errors; show them only if DISPLAY_ERRORS is set (for development) ini_set('log_errors', '1'); ini_set('display_errors', (string)config('DISPLAY_ERRORS', '0')); ?>