98 lines
2.8 KiB
PHP
98 lines
2.8 KiB
PHP
<?php
|
|
|
|
use KupShop\KupShopBundle\Context\CurrencyContext;
|
|
use KupShop\KupShopBundle\Context\UserContext;
|
|
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
|
|
|
|
header('Cache-Control: no-cache');
|
|
header('Pragma: no-cache');
|
|
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
|
|
|
|
// //////////////////// SOUBOR COMMON.PHP
|
|
|
|
// zacit pocitat cas provadeni skriptu
|
|
setStartTime();
|
|
|
|
// ################################################################
|
|
// SESSION
|
|
// ################################################################
|
|
|
|
$session = ServiceContainer::getService('session');
|
|
$session->start();
|
|
|
|
// ################################################################
|
|
// ERROR REPORTING
|
|
// ################################################################
|
|
|
|
set_error_handler('error_handler');
|
|
|
|
// ################################################################
|
|
// URCENI, KTERE STRANKY JSOU VOLNE PRISTUPNE
|
|
// ################################################################
|
|
|
|
if (!isset($_GET['s'])) {
|
|
$_GET['s'] = null;
|
|
}
|
|
|
|
// ################################################################
|
|
|
|
// jestlize se jedna o verejnou stranku, nevyzadovat zalogovanisada
|
|
if (!isset($publicArea)) {
|
|
$legacyAdminCredentials = ServiceContainer::getService(\KupShop\AdminBundle\Util\LegacyAdminCredentials::class);
|
|
$legacyAdminCredentials->setAdminGlobalVars(function () {
|
|
redirect('index.php?error=4&url='.urlencode($_SERVER['REQUEST_URI']));
|
|
});
|
|
|
|
if (isSuperuser()) {
|
|
ini_set('display_errors', '1');
|
|
}
|
|
}
|
|
|
|
// ################################################################
|
|
// SMARTY TEMPLATES
|
|
// ################################################################
|
|
|
|
$ctrl = [];
|
|
$ctrl['admin'] = true;
|
|
$ctrl['logged'] = false;
|
|
$ctrl['currUrl'] = [
|
|
'Abs' => $cfg['Addr']['full'].$_SERVER['REQUEST_URI'],
|
|
'Rel' => $_SERVER['REQUEST_URI'],
|
|
];
|
|
|
|
$userContext = ServiceContainer::getService(UserContext::class);
|
|
$userContext->forceEmpty();
|
|
|
|
$txt_str = [];
|
|
|
|
// ################################################################
|
|
// VOLBA JAZYKA
|
|
// ################################################################
|
|
|
|
loadLanguage('base');
|
|
|
|
// ################################################################
|
|
// ZISKANI NASTAVENI Z DATABAZE
|
|
// ################################################################
|
|
|
|
$dbcfg = Settings::getDefault();
|
|
|
|
// prevedeni aktivnich modulu pro SMARTY
|
|
$cfg['module'] = [];
|
|
foreach ($cfg['Modules'] as $index => $module) {
|
|
if (is_numeric($index)) {
|
|
$cfg['module'][$module] = true;
|
|
} else {
|
|
$cfg['module'][$index] = true;
|
|
}
|
|
}
|
|
|
|
if (findModule('currencies')) {
|
|
$currencyContext = ServiceContainer::getService(CurrencyContext::class);
|
|
$currencyContext->activate($currencyContext->getDefaultId());
|
|
|
|
if (empty($ctrl['currency'])) {
|
|
$ctrl['currency'] = $dbcfg['currency'];
|
|
}
|
|
}
|