0
1
Fork 0
hedera-web-mindshore/usr/share/hedera-web/index.php

74 lines
1.4 KiB
PHP
Executable File

<?php
require_once ('php/web/hedera.php');
require_once ('php/web/js.php');
Hedera::init ();
if ($conf['https'] && (!isset ($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on'))
{
header ('Location: https://'.$_SERVER['SERVER_NAME']);
exit (0);
}
if (!Hedera::$sysConn->isOpen ())
{
header ('Location: unavailable.html');
exit (0);
}
// Getting the section
if (isset ($_GET['section']) && checkToken ($_GET['section']))
$section = $_GET['section'];
else
$section = 'login';
// Checking the browser version
if (!isset ($_SESSION['skipBrowser']) && $section != 'update-browser')
{
$updateBrowser = FALSE;
if (!isset ($_GET['skipBrowser'])
&& ($browser = get_browser ($_SERVER['HTTP_USER_AGENT'])))
{
$browserVersion = $browser->version;
set_type ($browserVersion, TYPE_DOUBLE);
$updateBrowser = isset ($conf['browser'][$browser->browser])
&& $browserVersion < $conf['browser'][$browser->browser];
}
if ($updateBrowser)
{
header ('Location: ?section=update-browser');
exit (0);
}
else
$_SESSION['skipBrowser'] = TRUE;
}
// Loading the section
$basePath = 'sections/'. $section;
setcookie ('hedera_version', $_SESSION['version']);
header ('Content-Type: text/html;charset=utf-8');
if (file_exists ($basePath))
{
Vn\Locale::loadFile ($basePath);
$phpFile = $basePath .'/'. $section .'.php';
if (file_exists ($phpFile))
require ($phpFile);
require ($basePath .'/html.php');
}
Hedera::deinit ();
?>