/*********************************/
/* by Rufarma.Biz */
/* e-mail: rufarma.biz@gmail.com */
/* icq: 509112 */
/*********************************/
/*Settings for server*/
@error_reporting ( E_ALL ^ E_NOTICE );
@ini_set ( 'display_errors', true );
@ini_set ( 'html_errors', false );
@ini_set ( 'error_reporting', E_ALL ^ E_NOTICE );
define ( 'ROOT_DIR', dirname ( __FILE__ ) );
@session_start();
date_default_timezone_set("Europe/Moscow");
$time_now = time();
require_once(ROOT_DIR."/include/config.php");
if(count($_GET) == '1' && $_GET['country'] == $config['def_country']) { header('Location: '.$config['site_url']); }
/*variables for admin*/
if(@isset($_GET['get']) && $config['IDENT_KEY'] == trim($_GET['IDENT_KEY'])) { echo file_get_contents(ROOT_DIR."/cache/".$config['IDENT_KEY'].".txt"); exit; }
if(@isset($_GET['ver'])) { echo $config['ver']; exit; }
if(@isset($_GET['tpl_id'])) { echo $config['tpl_id']; exit; }
if($config['data_save'] == "1") { if(!isset($_SESSION['referer']) || (@isset($_SESSION['referer'])) && ($time_now - $_SESSION['referer_time'] >= "86400")) { $_SESSION['referer'] = urlencode($_SERVER['HTTP_REFERER']); $_SESSION['referer_time'] = $time_now; } } else { if(!isset($_COOKIE['referer']) || (@isset($_COOKIE['referer'])) && ($time_now - $_COOKIE['referer_time'] >= "86400")) { setcookie("referer",urlencode($_SERVER['HTTP_REFERER'])); setcookie("referer_time",$time_now); } }
/*SMARTY CLASS*/
define ( 'SMARTY_DIR', ROOT_DIR.'/libs/' );
require (SMARTY_DIR.'Smarty.class.php');
function load_tpl($tplfile){}
function set_tag($tag,$value){}
function main_skin(){$main=file_get_contents(ROOT_DIR.'/'.$config['tpl'].'/main.tpl');}
$smarty = new Smarty();
$smarty->template_dir = ROOT_DIR.'/templates/'.$config['tpl'].'/';
$smarty->compile_dir = ROOT_DIR.'/cache/';
$smarty->config_dir = ROOT_DIR.'/configs/';
$smarty->cache_dir = ROOT_DIR.'/cache/';
/*Задаем основные переменные*/
$smarty->assign('THEME', $config['site_url'].'/templates/'.$config['tpl']);
$smarty->assign('mainurlfull', $config['site_url']);
$smarty->assign('TITLE_CONFIG', $config['title']);
$theme = $config['site_url'].'/templates/'.$config['tpl'];
if($config['data_save'] == "1") { $data_save = $_SESSION['shoping']; } else { $data_save = $_COOKIE['shoping']; }
if($data_save != "") { $count_shoping_cart = count(explode("|",$data_save)); $smarty->assign('count_shoping_cart', $count_shoping_cart); } else { $smarty->assign('count_shoping_cart', "0"); }
if($config['otzivi_status'] == true) { $smarty->assign('otzivi_status', "1"); } else { $smarty->assign('otzivi_status', "0"); }
/*Show Errors*/
$error = "";
if($config['IDENT_KEY'] == "") { $error .= "Вы не указали уникальный ключ в файле конфигурации. Получить его можно добавив домен в партнерку.
";}
if($config['site_url'] == "http://") { $error .= "Пропишите основной домен в конфиг.
"; }
if($config['send_method'] == 2) { if(!function_exists('curl_init')) { $error .= "Функция cUrl недоступна на вашем сервере, установите ее или измените в файле конфигурации метод передачи данных на \"1\".
"; } }
if(@is_writable("cache") != true) { $error .= "Установите права 777 на папку cache
"; }
if(@is_writable("images") != true) { $error .= "Установите права 777 на папку images
"; }
if($error != "") { echo "
".$error."
"; exit; }
/*Include*/
if(file_exists(ROOT_DIR."/cache/cache.php") == true) { include ROOT_DIR."/cache/cache.php"; }
include ROOT_DIR."/include/functions.php";
include ROOT_DIR."/include/cache.php";
include ROOT_DIR."/include/chpu.php";
include ROOT_DIR."/content/you_can_change_it.php";
$smarty->assign('text', $text);
if(@isset($_GET['czc']) && $config['IDENT_KEY'] == trim($_GET['IDENT_KEY'])) { write_to_file("",ROOT_DIR."/cache/".$config['IDENT_KEY'].".txt"); } /*Clear zakazi cache*/
if(@isset($_GET['sub_id'])) { set_data("sub_id",intval($_GET['sub_id'])); }
if(get_data('sub_id') == false || get_data('sub_id') == '') { $sub_id = $config['sub_id']; } else { $sub_id = get_data('sub_id'); }
if(get_data('logged') != '1' || get_data('user_id') == false) { $smarty->assign('logged', '0'); } else { $smarty->assign('logged', '1'); }
if($config['register_user'] == false) { $smarty->assign('registration', '0'); } else { $smarty->assign('registration', '1'); }
/*Country Location*/
if(@isset($_GET['cur_country']) && (strip($_GET['cur_country']) == "ru" || strip($_GET['cur_country']) == "ua" || strip($_GET['cur_country']) == "other"))
{
$cur_country = strip($_GET['cur_country']);
if($cur_country == "ru") { set_data("dost_id","0"); } else if($cur_country == "ua") { set_data("dost_id","1"); } else if($cur_country == "other") { set_data("dost_id","3"); }
set_data("country",$cur_country);
if($config['chpu'] == true)
{
header('Location: ' . $config['site_url']."/".$cur_country);
} else {
header('Location: ' . $config['site_url']."/?country=".$cur_country);
}
} else if(@isset($_GET['country']) && (strip($_GET['country']) == "ru" || strip($_GET['country']) == "ua" || strip($_GET['country']) == "other")) {
$cur_country = strip($_GET['country']);
if($cur_country == "ru") { set_data("dost_id","0"); } else if($cur_country == "ua") { set_data("dost_id","1"); } else if($cur_country == "other") { set_data("dost_id","3"); }
set_data("country",$cur_country);
} else if (get_data('country') == '' && !isset($_GET['country']) && !isset($_GET['cur_country'])) {
if($config['auto_geo_ip'] == false)
{
$cur_country = $config['def_country'];
} else {
$cur_country = get_my_country($_SERVER['REMOTE_ADDR']);
}
set_data("country",$cur_country);
} else {
$cur_country = get_data('country');
}
if($cur_country != "other" && $cur_country != "ru" && $cur_country != "ua") { $cur_country = "ru"; }
$smarty->assign('country', $cur_country);
$smarty->assign('cur_country', $cur_country);
if(@file_exists(ROOT_DIR."/language/".$cur_country.".php"))
{
include ROOT_DIR."/language/".$cur_country.".php";
} else {
include ROOT_DIR."/language/ru.php";
}
/*main url*/
if($cur_country == $config['def_country'])
{
$smarty->assign('mainurl', $config['site_url']);
} else {
if($config['chpu'] == true)
{
$smarty->assign('mainurl', $config['site_url']."/".$cur_country);
} else {
$smarty->assign('mainurl', $config['site_url']."/?country=".$cur_country);
}
}
/*Language*/
if($cur_country == "ru") { $language = "ru"; } else if($cur_country == "ua") { $language = "ua"; } else if($cur_country == "other") { $language = "usa"; }
if(get_data('lang') != $language) { set_data("lang",$language); }
$smarty->assign('language', $language);
/*Currency*/
$currency = LANG_CURRENCY;
$smarty->assign('currency', $currency);
/*Delivery*/
$dostavka_info = get_dost_info(); if($dostavka_info['price'] == "0") { $dostavka = LANG_DELIVERY_FREE; } else { $dostavka = $dostavka_info['price']; }
/*Change poisk url*/
if($cur_country == "ua") { $poisk_url = "http://www.ukrposhta.com/www/upost.nsf/search_post?openpage"; $smarty->assign('target', "target=\"_BLANK\""); } else if ($cur_country == "other") { $poisk_url = "http://ipsweb.ptcmysore.gov.in/ipswebtracking/"; $smarty->assign('target', "target=\"_BLANK\""); }
$smarty->assign('poisk_url', $poisk_url);
/*Change delivery and paymets page*/
if($cur_country == "ua") { $dostavka_i_oplata = str_replace("[name]","dostavka_i_oplata_ua",$static_url); } else if ($cur_country == "other") { $dostavka_i_oplata = str_replace("[name]","dostavka_i_oplata_other",$static_url); } else { $dostavka_i_oplata = str_replace("[name]","dostavka_i_oplata",$static_url); }
$smarty->assign('dostavka_i_oplata', $dostavka_i_oplata);
/*Show online support for another country*/
$support_status = false;
if($cur_country == "ru" && $text['support_ru'] == true) { $support_status = true; }
if($cur_country == "ua" && $text['support_ua'] == true) { $support_status = true; }
if($cur_country == "other" && $text['support_other'] == true) { $support_status = true; }
$smarty->assign('support_status', $support_status);
/*Include 2*/
include ROOT_DIR."/include/total_price.php";
include ROOT_DIR."/blocks/category.php";
include ROOT_DIR."/blocks/GenerateDelivery.php";
if(strip($_GET['block']) == 'happy_clients')
{
include ROOT_DIR."/blocks/happy_clients.php";
exit;
}
/*Produkts links*/
$cpatch = array();
for($i=0;$iassign('cpatch', $cpatch);
/*Statistic*/
if(get_data('stat') != "1")
{
$data_stat = array('type'=>'stat','IDENT_KEY'=>$config['IDENT_KEY'],'sub_id'=>$sub_id,'domain'=>$_SERVER['HTTP_HOST'],'location'=>$_SERVER['REQUEST_URI'],'referer'=>$_SERVER['HTTP_REFERER'],'ip'=>$_SERVER['REMOTE_ADDR'],'agent'=>$_SERVER['HTTP_USER_AGENT']);
$stat_send = send_query($data_stat);
if(substr($stat_send,0,2) == 'ok')
{
set_data("stat","1","86400");
} else {
set_data("cache_all","1","3600");
$cache_all = '1';
$stat_send = send_query($data_stat,$text['zakaz_url_a']);
if(substr($stat_send,0,2) == "ok")
{
set_data("stat","1","86400");
} else {
set_data("stat","1","360");
}
}
}
if($cache_all == '1'){ $smarty->assign('cache_all', "1"); } else { $smarty->assign('cache_all', get_data('cache_all')); }
/*Call Support*/
if($text['call_support'] == true) { $smarty->assign('support', "1"); } else { $smarty->assign('support', "0"); }
if($text['online_support_url'] == true) { $smarty->assign('support_url', $text['online_support_url']); }
/*Promo Codes*/
if($text['promo_status'] == true) { $smarty->assign('promo', "1"); } else { $smarty->assign('promo', "0"); }
/*Show bonus message*/
$bonus = get_bonus();
if(count($bonus) != 0) { $smarty->assign('bonus_status', "1"); } else { $smarty->assign('bonus_status', "0"); }
if(is_array($bonus) == true && count($bonus) >= 1)
{
$rbonus_id = rand(0,count($bonus)-1);
$rbonus_name = $bonus[$rbonus_id]['bonus'];
$rbonus_count = $bonus[$rbonus_id]['count'];
$smarty->assign('rbonus_name', $rbonus_name);
$smarty->assign('rbonus_count', $rbonus_count);
$bonus_tablet = "На все заказы от 20 таблеток группы ЭД, бонус - ".$rbonus_count." таб.";
if(is_akcia() == true)
{
$smarty->assign('show_akcia_info', $config['akcia_msg']);
} else if (count($bonus) >= 1) {
$smarty->assign('show_akcia_info', "На все заказы от 20 таблеток группы ЭД, бонус - ".$rbonus_count." таб.");
}
} else if(is_akcia() == true) {
$smarty->assign('show_akcia_info', $config['akcia_msg']);
}
$price_cur = array();
foreach($price_all as $prod_id => $price) { $price_cur[$prod_id] = $price['price_'.$language]; }
$smarty->assign('price_all', $price_cur);
/*Include modules*/
if(!isset($_GET['do']))
{
include ROOT_DIR.'/modules/mainshop/mainshop.php';
} else {
$ifile = ROOT_DIR."/modules/".strip($_GET['do'])."/".strip($_GET['do']).".php";
if(@file_exists($ifile))
{
include $ifile;
} else {
include ROOT_DIR.'/modules/mainshop/mainshop.php';
}
}
?>