X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=index.php;h=c8d4fbee9b0f30a6e44325b2a6508cef02a377f8;hb=1f9a9c69bc3f5d7b33f4f73da3252ec07b5f3a87;hp=0aceeda55a8174d2e6425ba656e554ab96fb3655;hpb=b1a68e15b760aa2e588680c9e8c7526a7a6d1d13;p=quix0rs-gnu-social.git diff --git a/index.php b/index.php index 0aceeda55a..c8d4fbee9b 100644 --- a/index.php +++ b/index.php @@ -37,6 +37,9 @@ * @license GNU Affero General Public License http://www.gnu.org/licenses/ */ +$_startTime = microtime(true); +$_perfCounters = array(); + define('INSTALLDIR', dirname(__FILE__)); define('STATUSNET', true); define('LACONICA', true); // compatibility @@ -204,7 +207,7 @@ function checkMirror($action_obj, $args) function isLoginAction($action) { - static $loginActions = array('login', 'recoverpassword', 'api', 'doc', 'register', 'publicxrds', 'otp', 'opensearch', 'rsd'); + static $loginActions = array('login', 'recoverpassword', 'api', 'doc', 'register', 'publicxrds', 'otp', 'opensearch', 'rsd', 'hostmeta'); $login = null; @@ -219,18 +222,18 @@ function main() { // fake HTTP redirects using lighttpd's 404 redirects if (strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') !== false) { - $_lighty_url = $base_url.$_SERVER['REQUEST_URI']; + $_lighty_url = $_SERVER['REQUEST_URI']; $_lighty_url = @parse_url($_lighty_url); if ($_lighty_url['path'] != '/index.php' && $_lighty_url['path'] != '/') { $_lighty_path = preg_replace('/^'.preg_quote(common_config('site', 'path')).'\//', '', substr($_lighty_url['path'], 1)); $_SERVER['QUERY_STRING'] = 'p='.$_lighty_path; - if ($_lighty_url['query']) { + if (isset($_lighty_url['query']) && $_lighty_url['query'] != '') { $_SERVER['QUERY_STRING'] .= '&'.$_lighty_url['query']; - } - parse_str($_lighty_url['query'], $_lighty_query); - foreach ($_lighty_query as $key => $val) { - $_GET[$key] = $_REQUEST[$key] = $val; + parse_str($_lighty_url['query'], $_lighty_query); + foreach ($_lighty_query as $key => $val) { + $_GET[$key] = $_REQUEST[$key] = $val; + } } $_GET['p'] = $_REQUEST['p'] = $_lighty_path; } @@ -283,6 +286,14 @@ function main() return; } + $site_ssl = common_config('site', 'ssl'); + + // If the request is HTTP and it should be HTTPS... + if ($site_ssl != 'never' && !StatusNet::isHTTPS() && common_is_sensitive($args['action'])) { + common_redirect(common_local_url($args['action'], $args)); + return; + } + $args = array_merge($args, $_REQUEST); Event::handle('ArgsInitialize', array(&$args));