86 lines
4.2 KiB
PHP
86 lines
4.2 KiB
PHP
<?php
|
|
namespace start;
|
|
|
|
// $start_site = microtime( true );
|
|
header('Content-type: text/html');
|
|
header("Cache-Control: public");
|
|
header("Expires: " . date("r", time() + 86400));
|
|
ini_set('display_errors', 0);
|
|
ini_set('memory_limit', '16M');
|
|
require_once 'redirect.php';
|
|
require_once 'api/php/db.php';
|
|
require_once 'api/php/json.php';
|
|
require_once 'api/php/core.php';
|
|
//require_once 'api/php/clean.php';
|
|
require_once 'set/' . $_SERVER['SERVER_NAME'] . '.php';
|
|
#if (file_exists('set/install/install_' . $db['type'] . '.php'))require_once 'set/install/install_' . $db['type'] . '.php';
|
|
/* ----------------------------------------------------------------------
|
|
09.12.2022
|
|
Выбираем модуль по умолчанию
|
|
---------------------------------------------------------------------- */
|
|
$authModule = \core::getSettings('default_mod_auth');
|
|
$mod = ($authModule ? $authModule : \core::getSettings('default_mod'));
|
|
define('MOD', (@$_GET['mod'] ? $_GET['mod'] : $mod));
|
|
//Инсталлятор модулей
|
|
if (file_exists('set/install/' . MOD . '_' . $db['type'] . '.php'))
|
|
require_once 'set/install/' . MOD . '_' . $db['type'] . '.php';
|
|
|
|
/* ----------------------------------------------------------------------
|
|
09.12.2022
|
|
Определяем город
|
|
---------------------------------------------------------------------- */
|
|
if (!@$_SESSION['city'])
|
|
\core::geo();
|
|
require_once 'set/int.php';
|
|
/* ----------------------------------------------------------------------
|
|
09.12.2022
|
|
Авторизация по куки
|
|
---------------------------------------------------------------------- */
|
|
if (!@$_SESSION['user_id'])
|
|
\core::loginCookies();
|
|
/* ----------------------------------------------------------------------
|
|
17.12.2022
|
|
Берем данные корзины
|
|
---------------------------------------------------------------------- */
|
|
$cart = \core::getCart();
|
|
//print_r($cart);
|
|
$smarty->assign('cart', $cart['cart']);
|
|
$smarty->assign('cart_summ', $cart['summ']);
|
|
|
|
/* ----------------------------------------------------------------------
|
|
25.22.2023
|
|
Получаем корневые товары интернет-магазина
|
|
---------------------------------------------------------------------- */
|
|
if ($_SERVER['SERVER_NAME'] == 'tk-ligat.ru')
|
|
$smarty->assign('menu_internet_magazin', \DB::getAll("SELECT * FROM `tovar_category` WHERE `category`=0 AND `status`=1 ORDER BY `title`"));
|
|
if ($_SERVER['SERVER_NAME'] == 'v.yurecnt.ru')
|
|
$smarty->assign('menu_internet_magazin', \DB::getAll("SELECT * FROM `tovar_category` WHERE `category`=1 AND `status`=1"));
|
|
|
|
/* ----------------------------------------------------------------------
|
|
26.02.2023
|
|
Получаем количество товара в корзине
|
|
---------------------------------------------------------------------- */
|
|
|
|
$smarty->assign('kolvo_tovar_in_cart', \DB::getAll("SELECT COUNT(*) FROM `cart` WHERE `user_id`=? AND `order` IS NULL", \core::checkMe())[0]['COUNT(*)']);
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
09.12.2022
|
|
Выбираем шаблон модуля
|
|
---------------------------------------------------------------------- */
|
|
if (file_exists('skin/' . $_SERVER['SERVER_NAME'] . '/inc/mod/' . MOD . '/index.html'))
|
|
$smarty->display('skin/' . $_SERVER['SERVER_NAME'] . '/inc/mod/' . MOD . '/index.html', @$_GET['id']);
|
|
else
|
|
$smarty->display('api/modules/' . MOD . '/index.html', @$_GET['id']);
|
|
//$user_id = ( $_SESSION['user_id'] ? $_SESSION['user_id'] : session_id() );
|
|
// $time_site = round( microtime(true) - $start_site, 5 );
|
|
// \DB::add( "INSERT INTO `site_speed` ( `t`, `mod`, `mod_id`, `speed`, `user_id` ) VALUES ( ?, ?, ?, ?, ? )", array( time(), MOD, $_GET['id'], $time_site, $user_id ) );
|
|
|
|
//echo $_SERVER['REQUEST_URI'];
|
|
if ($_GET['mod'] == 'tovar_show' || $_GET['mod'] == 'tovar_cat' || $_GET['mod'] == 'cat' || $_GET['mod'] == 'page') {
|
|
$sm_id = \DB::getValue("SELECT `id` FROM `sitemap` WHERE `link`=?", $_SERVER['REQUEST_URI']);
|
|
if (!$sm_id)
|
|
\DB::add("INSERT INTO `sitemap` (`link`, `t`, `status`) VALUES (?, ?, 1)", array($_SERVER['REQUEST_URI'], time()));
|
|
}
|
|
?>
|