forked from verdnatura/hedera-web
55 lines
1.1 KiB
PHP
Executable File
55 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
require_once ('php/web/hedera.php');
|
|
require_once ('php/web/json.php');
|
|
|
|
Hedera::init ();
|
|
JsonLib::init ();
|
|
|
|
if (Hedera::login ())
|
|
{
|
|
// Checking the client version
|
|
|
|
if (isset ($_COOKIE['hedera_version']))
|
|
{
|
|
$clientVersion = $_COOKIE['hedera_version'];
|
|
set_type ($clientVersion, TYPE_DOUBLE);
|
|
|
|
if ($clientVersion < $_SESSION['version'])
|
|
{
|
|
$row = Hedera::$sysConn->getRow ('SELECT critical, changelog FROM version LIMIT 1');
|
|
|
|
if (!$row || $row['critical'])
|
|
Error::trigger ('Version', 'criticalVersion', $row['changelog']);
|
|
else
|
|
Error::trigger ('Version', 'newVersion', $row['changelog']);
|
|
}
|
|
}
|
|
|
|
// Getting the action
|
|
|
|
$action = NULL;
|
|
|
|
if (isset ($_REQUEST['action']))
|
|
$action = $_REQUEST['action'];
|
|
|
|
if ($action && checkToken ($action))
|
|
{
|
|
$actionFile = 'ajax/'. $action .'.php';
|
|
|
|
if (file_exists ($actionFile))
|
|
{
|
|
Vn\Locale::loadFile ('ajax/'. $action);
|
|
require_once ($actionFile);
|
|
actionActivate (Hedera::$conn);
|
|
}
|
|
else
|
|
Error::trigger ('Ajax', 'invalidAction', s('InvalidAction'));
|
|
}
|
|
}
|
|
|
|
JsonLib::sendReply ();
|
|
Hedera::deinit ();
|
|
|
|
?>
|