core/index.php

83 lines
3.7 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 );
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 '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 ) );
/* ----------------------------------------------------------------------
12.12.2022
Подключаем инсталлятор
---------------------------------------------------------------------- */
//if ( file_exists ( 'api/modules/' . MOD .'/install_' . \DB::$type . '.php' ) ) require_once 'api/modules/' . MOD .'/install_' . \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();
$smarty -> assign( 'cart', $cart );
/* ----------------------------------------------------------------------
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 ) );
/*if ($_SERVER['SERVER_NAME']=='tk-ligat.ru'){
\DB::$type='mysql';
\DB::$dsn='mysql:dbname=tk-ligat;host=127.0.0.1';
\DB::$user='admin';
\DB::$pass='32143214';
\DB::set("CREATE TABLE `tovar` (
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`title` varchar(400) NULL,
`txt` longtext NULL,
`keywords` longtext NULL,
`artikul` varchar(10) NULL,
`description` longtext NULL,
`tovar_id_1c` varchar(50) NULL,
`tovar_cat_1c` varchar(50) NULL,
`status` int(1) NULL,
`category` int(10) NULL,
`countImg` int(10) NULL,
`partner` varchar(400) NULL,
`json` longtext NULL,
`brand_id` int(10) NULL,
`check_img` int(1) NULL,
`code` varchar(10) NULL
) ENGINE='InnoDB' COLLATE 'utf8_general_ci';");
}*/
?>