2022-12-11 13:55:49 +05:00
< ? php
namespace start ;
2023-01-25 14:20:32 +05:00
$start_site = microtime ( true );
header ( 'Content-type: text/html' );
header ( " Cache-Control: public " );
header ( " Expires: " . date ( " r " , time () + 86400 ) );
ini_set ( 'display_errors' , 0 );
2023-01-07 18:55:55 +05:00
require_once 'redirect.php' ;
2023-01-25 14:20:32 +05:00
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' ;
2023-04-09 19:52:26 +05:00
#if (file_exists('set/install/install_' . $db['type'] . '.php'))require_once 'set/install/install_' . $db['type'] . '.php';
2022-12-11 13:55:49 +05:00
/* ----------------------------------------------------------------------
09.12 . 2022
Выбираем модуль по умолчанию
---------------------------------------------------------------------- */
2022-12-17 18:15:09 +05:00
$authModule = \core :: getSettings ( 'default_mod_auth' );
$mod = ( $authModule ? $authModule : \core :: getSettings ( 'default_mod' ) );
2023-01-25 14:20:32 +05:00
define ( 'MOD' , ( @ $_GET [ 'mod' ] ? $_GET [ 'mod' ] : $mod ) );
2023-02-26 21:57:01 +05:00
//Инсталлятор модулей
if ( file_exists ( 'set/install/' . MOD . '_' . $db [ 'type' ] . '.php' )) require_once 'set/install/' . MOD . '_' . $db [ 'type' ] . '.php' ;
2022-12-11 15:29:37 +05:00
/* ----------------------------------------------------------------------
09.12 . 2022
Определяем город
---------------------------------------------------------------------- */
if ( !@ $_SESSION [ 'city' ] ) \core :: geo ();
2022-12-11 13:55:49 +05:00
require_once 'set/int.php' ;
/* ----------------------------------------------------------------------
09.12 . 2022
Авторизация по куки
---------------------------------------------------------------------- */
if ( !@ $_SESSION [ 'user_id' ] ) \core :: loginCookies ();
2022-12-24 21:12:23 +05:00
/* ----------------------------------------------------------------------
17.12 . 2022
Берем данные корзины
---------------------------------------------------------------------- */
2023-01-25 14:20:32 +05:00
$cart = \core :: getCart ();
2023-03-05 20:22:21 +05:00
//print_r($cart);
$smarty -> assign ( 'cart' , $cart [ 'cart' ] );
$smarty -> assign ( 'cart_summ' , $cart [ 'summ' ] );
2023-02-25 22:58:56 +05:00
/* ----------------------------------------------------------------------
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 " ) );
if ( $_SERVER [ 'SERVER_NAME' ] == 'v.yurecnt.ru' ) $smarty -> assign ( 'menu_internet_magazin' , \DB :: getAll ( " SELECT * FROM `tovar_category` WHERE `category`=1 AND `status`=1 " ) );
2023-02-26 21:57:01 +05:00
/* ----------------------------------------------------------------------
26.02 . 2023
Получаем количество товара в корзин
---------------------------------------------------------------------- */
2023-03-11 21:03:29 +05:00
$smarty -> assign ( 'kolvo_tovar_in_cart' , \DB :: getAll ( " SELECT COUNT(*) FROM `cart` WHERE `user_id`=? AND `order` IS NULL " , ( $_SESSION [ 'user_id' ]) ? $_SESSION [ 'user_id' ] : session_id () )[ 0 ][ 'COUNT(*)' ] );
2023-02-26 21:57:01 +05:00
2023-02-25 22:58:56 +05:00
2022-12-11 15:29:37 +05:00
/* ----------------------------------------------------------------------
09.12 . 2022
Выбираем шаблон модуля
---------------------------------------------------------------------- */
2022-12-17 18:15:09 +05:00
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' ] );
2022-12-11 13:55:49 +05:00
else
2022-12-17 18:15:09 +05:00
$smarty -> display ( 'api/modules/' . MOD . '/index.html' , @ $_GET [ 'id' ] );
2023-01-02 21:33:36 +05:00
2023-01-07 18:55:55 +05:00
$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 ) );
2022-12-11 13:55:49 +05:00
?>