diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Framework.php b/CoreVersions/0.2.0/Frameworks/Flake/Framework.php index 7401a31..488c3d0 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Framework.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Framework.php @@ -108,6 +108,10 @@ class Framework extends \Flake\Core\Framework { # Define path to Baïkal SQLite file define("PROJECT_SQLITE_FILE", PROJECT_PATH_SPECIFIC . "db/.ht.db.sqlite"); + # Activate Flake class loader + require_once(FLAKE_PATH_ROOT . 'Core/ClassLoader.php'); + \Flake\Core\ClassLoader::register(); + # Asserting DB file exists if(!file_exists(PROJECT_SQLITE_FILE)) { die("

DB file does not exist. To create it, please copy 'Core/Resources/db.empty.sqlite' to 'Specific/db/.ht.db.sqlite'

"); @@ -129,19 +133,15 @@ class Framework extends \Flake\Core\Framework { $sScript = substr($_SERVER["SCRIPT_FILENAME"], strlen($_SERVER["DOCUMENT_ROOT"])); $sDirName = self::appendSlash(dirname($sScript)); $sBaseUrl = self::appendSlash(substr($sDirName, 0, -1 * strlen(PROJECT_CONTEXT_BASEURI))); - $aParts = explode("/", $_SERVER["SERVER_PROTOCOL"]); - $sProtocol = strtolower(array_shift($aParts)); + $sProtocol = \Flake\Util\Tools::getCurrentProtocol(); define("PROJECT_BASEURI", $sBaseUrl); define("PROJECT_URI", $sProtocol . "://" . self::rmEndSlash($_SERVER["HTTP_HOST"]) . $sBaseUrl); - unset($sScript); unset($sDirName); unset($sBaseUrl); unset($sProtocol); unset($aParts); + unset($sScript); unset($sDirName); unset($sBaseUrl); unset($sProtocol); ################################################################################################# require_once(FLAKE_PATH_ROOT . 'Util/Twig/lib/Twig/Autoloader.php'); \Twig_Autoloader::register(); - - require_once(FLAKE_PATH_ROOT . 'Core/ClassLoader.php'); - \Flake\Core\ClassLoader::register(); # Include Flake Framework config require_once(FLAKE_PATH_ROOT . "config.php"); diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Util/Tools.php b/CoreVersions/0.2.0/Frameworks/Flake/Util/Tools.php index fb43ec5..f187b29 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Util/Tools.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Util/Tools.php @@ -44,6 +44,14 @@ class Tools extends \Flake\Core\FLObject { return $sUrl; } + public static function getCurrentProtocol() { + if((!empty($GLOBALS["_SERVER"]["HTTPS"]) && $GLOBALS["_SERVER"]['HTTPS'] !== 'off') || intval($_SERVER['SERVER_PORT']) === 443) { + return "https"; + } + + return "http"; + } + public static function getUrlTokens() { $sUrl = self::stripBeginSlash(self::getCurrentUrl());