<?php
session_start();

global $__vendor;
$__vendor = require __DIR__."/_app/vendor/autoload.php";

use core\application;
use core\response;

if(!response::isProduction()) {
	$reqiureSSL = false;

	if(isset($_SERVER["REQUEST_URI"]) && ($_SERVER["REQUEST_URI"] == "/" || $_SERVER["REQUEST_URI"] == "/logowanie" || strpos($_SERVER["REQUEST_URI"], "/nowe-haslo/") !== false)) {
		$reqiureSSL = true;
	}

	if(!$reqiureSSL && response::isSSL()) {
		header("HTTP/1.1 301 Moved Permanently");
		header("Location: http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
		exit();
	} else if($reqiureSSL && !response::isSSL()) {
		header("HTTP/1.1 301 Moved Permanently");
		header("Location: https://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
		exit();
	}
}

new application();
?>