check('RUN_SINGLE_WEBSITE')){ $dsession->add('RUN_SINGLE_WEBSITE',RUN_SINGLE_WEBSITE); } if(!isset($dsession)) exit('Not Init Session'); /**Start: Domain to ID**/ $tmpDomain=explode('.',$estoreDomain); if(count($tmpDomain)>=1){$mDomain=$tmpDomain[0];} if(!$dsession->check('CURRENT_ESTORE_DOMAIN') || strcmp($dsession->get('CURRENT_ESTORE_DOMAIN'),$mDomain)!=0){ if($estoreDomain){ $cacheDomain=DIR_CACHE_TEMPLATE.'domains/'.$estoreDomain.'.php'; $db_reconnect=true; $forSubDomain=false; if(is_file($cacheDomain)){ include($cacheDomain); if((isset($domainCheck) && $domainCheck && in_array($estoreDomainNoPort,explode(';',str_replace(' ','',$domainCheck['private_domain'])))) || (isset($domainCheck) && $domainCheck && $forSubDomain)){ $db_reconnect=false; } } if($db_reconnect){ if(ID_TO_WEBSITE_RUN){ $domainCheck=$main_tool->get_rows('select id_estore_account,id_account,private_domain,id_partner_root from '.TABLE_PREFIX."estore_account where id_estore_account=".ID_TO_WEBSITE_RUN); if($domainCheck){ $forSubDomain=true; }else{ $domainCheck=$main_tool->get_rows('select id_estore_account,id_account,private_domain,id_partner_root from '.TABLE_PREFIX."estore_account where (private_domain='{$estoreDomainNoPort}' or private_domain like '%;{$estoreDomainNoPort}' or private_domain like '{$estoreDomainNoPort};%' or private_domain like '%;{$estoreDomainNoPort};%')"); } }else{ $domainCheck=$main_tool->get_rows('select id_estore_account,id_account,private_domain,id_partner_root from '.TABLE_PREFIX."estore_account where (private_domain='{$estoreDomainNoPort}' or private_domain like '%;{$estoreDomainNoPort}' or private_domain like '{$estoreDomainNoPort};%' or private_domain like '%;{$estoreDomainNoPort};%')"); } if(!$domainCheck){ $subdomain=explode('.',$estoreDomainNoPort); if(is_array($subdomain) && count($subdomain) >= 2 && preg_match("/^web\d+$/",$subdomain[0])){/*webID*/ $idSearch=intval(str_replace('web','',$subdomain[0])); if($idSearch){ $domainCheck=$main_tool->get_rows('select id_estore_account,id_account,private_domain,id_partner_root from '.TABLE_PREFIX."estore_account where id_estore_account={$idSearch}"); } }elseif(is_array($subdomain) && count($subdomain) >= 2){/*Local domain*/ $domainCheck=$main_tool->get_rows('select id_estore_account,id_account,private_domain,id_partner_root from '.TABLE_PREFIX."estore_account where local_domain='{$subdomain[0]}'"); } if($domainCheck && is_array($domainCheck) && count($domainCheck) > 0){ $forSubDomain=true; } } if((isset($domainCheck) && $domainCheck && in_array($estoreDomainNoPort,explode(';',str_replace(' ','',$domainCheck['private_domain'])))) || (isset($domainCheck) && $domainCheck && $forSubDomain)){ if(!is_dir(DIR_CACHE_TEMPLATE.'domains')){ @mkdir(DIR_CACHE_TEMPLATE.'domains',0777,true); @chown(DIR_CACHE_TEMPLATE.'domains',CHOWN_DTOOL); copy(BASE_DIR_WEBSITE.'ewebsitesub/index.htm',DIR_CACHE_TEMPLATE.'domains/index.htm'); } save_dbcache($cacheDomain,'$domainCheck='.var_export($domainCheck,true));/*First cache domain*/ } } if((isset($domainCheck) && $domainCheck && in_array($estoreDomainNoPort,explode(';',str_replace(' ','',$domainCheck['private_domain'])))) || (isset($domainCheck) && $domainCheck && $forSubDomain)){ $dsession->add('ESTORE_ID',intval($domainCheck['id_account'])); $_GET['idstore']=intval($domainCheck['id_estore_account']); $dsession->add('SUB_ESTORE_ID',intval($domainCheck['id_estore_account'])); $dsession->add('CURRENT_WEBSITE_ID',intval($_GET['idstore'])); $dsession->add('CURRENT_ACCOUNT_ROOT',intval($domainCheck['id_partner_root'])==0?ID_ACCOUNT_ROOT:intval($domainCheck['id_partner_root'])); $dsession->add('FULL_DOMAIN_NAME',$estoreDomain); } } } $domainEstore=check_domain(str_replace('www.','',$_SERVER['HTTP_HOST'])); if($domainEstore){ $dsession->add('ESTORE_WEBSITE_REFERER',$domainEstore); } /**End: Domain to ID**/ $REPLACE_ESTORE_ID=1; if((isset($_GET['idstore']) && check_valid_int($_GET['idstore']) && $_GET['idstore']>0 ) || isset($_GET['review']) || isset($_GET['css']) || (strcmp($dsession->get('CURRENT_PROTOCAL'),CURRENT_DOMAIN_PROTOCOL) != 0)){ if(!$dsession->check('SUB_ESTORE_ID') && !$dsession->check('CURRENT_E_WEBSITE_CSS')){ if(isset($_GET['idstore'])){ $dsession->add('SUB_ESTORE_ID',intval($_GET['idstore'])); $main_tool->sub_estore_id=intval($_GET['idstore']); } $dsession->add('CURRENT_E_WEBSITE_CSS','style/dt017/style1/'); } $idAccount=isset($_GET['idstore'])?intval($_GET['idstore']):intval($dsession->get('SUB_ESTORE_ID')); if(!$dsession->check('SUB_ESTORE_INFO') || isset($_GET['css']) || isset($_GET['idstore'])){ $configTemplate=DIR_CACHE_TEMPLATE.'estore_'.$idAccount.'/'.name_dbcache($estoreDomain,$idAccount).'.config_template.php'; if(is_file($configTemplate)){ include($configTemplate); }else{ $estore_info=$main_tool->get_rows('select * from '.TABLE_PREFIX.'estore_account where id_estore_account='.$dsession->get('SUB_ESTORE_ID')); } if(isset($estore_info) && $estore_info && is_array($estore_info)){ unset($estore_info['password_raw']); unset($estore_info['password']); $dsession->add('SUB_ESTORE_INFO',$estore_info); if(!isset($ctemplate) || !$ctemplate){ $ctemplate=$main_tool->get_rows('select path_template,path_template_css,extra_template_css from '.TABLE_PREFIX.'estore_sub_templates where id_sub_templates='.$estore_info['id_sub_templates']); } if($ctemplate && is_array($ctemplate)){ if(isset($_GET['css']) || ($estore_info['ext_extra_templates'] && strlen($estore_info['ext_extra_templates'])>0)){ if($estore_info['ext_extra_templates'] && strlen($estore_info['ext_extra_templates'])>0){ $_GET['css']=strval($estore_info['ext_extra_templates']); } $webcss=$ctemplate['path_template'].(isset($_GET['css'])?'/'.strval($_GET['css']):''); }else{ $webcss=$ctemplate['path_template'].($ctemplate['path_template_css']?'/'.$ctemplate['path_template_css']:''); } $dsession->add('CURRENT_E_WEBSITE_CSS','style/'.$webcss.'/'); $dsession->add('EWEBSITE_TEMPLATE_CONFIG',array($dsession->get('SUB_ESTORE_ID')=>$ctemplate)); $dsession->remove('MY_BACKGROUND_EXTRA'); if(!is_dir(DIR_CACHE_TEMPLATE.'estore_'.$idAccount)){ @mkdir(DIR_CACHE_TEMPLATE.'estore_'.$idAccount,0777,true); @chown(DIR_CACHE_TEMPLATE.'estore_'.$idAccount,CHOWN_DTOOL); copy(BASE_DIR_WEBSITE.'ewebsitesub/index.htm',DIR_CACHE_TEMPLATE.'estore_'.$idAccount.'/index.htm'); }/*First cache template*/ save_dbcache($configTemplate,'$estore_info='.var_export($estore_info,true).";\n\$ctemplate=".var_export($ctemplate,true)); } } } $dsession->add('CURRENT_E_WEBSITE_TEMPLATE',''); $dsession->add('CURRENT_E_WEBSITE_INTERFACE',''); $main_tool->add_defined('DIR_MAIN_E_WEBSITE',ABSOLUTE_DIR_WEBSITE.'templates/'.$main_tool->CURRENT_TEMPLATES.'ewebsite/'); $main_tool->add_defined('DIR_URL_E_WEBSITE', ABSOLUTE_URL_WEBSITE.'templates/'.$main_tool->CURRENT_TEMPLATES.'ewebsite/'); $dsession->add('DIR_MAIN_E_WEBSITE',ABSOLUTE_DIR_WEBSITE.'templates/'.$main_tool->CURRENT_TEMPLATES.'ewebsite/'); $dsession->add('D_TOOL',serialize($main_tool)); if(USE_PHPMEMCACHE && class_exists('Memcache') && isset($memcache) && is_object($memcache)){ $memcache->set('MEMCACHE_DTOOL'.session_id(),$main_tool,0,EXPIRE_MEMCACHE); } $dsession->add('CSS_E_WEBSITE_TEMPLATE','manager/'); }else{ if(!$dsession->check('SUB_ESTORE_ID')){ $mLink=$main_tool->URL2SEOCATE(''); } } function get_partner_info($m_domain,$domain_estore){ $m_domain=str_replace(array('www.','http://','https://'),'',$m_domain); $tmpPartner=explode('.',$m_domain); if($tmpPartner && is_array($tmpPartner)){ foreach($tmpPartner as $mPartner){ if(is_file(BASE_DIR_WEBSITE.'partner/'.$mPartner.'.php')){ return $mPartner.'.php'; } } } return false; } if($dsession->check('DIR_MAIN_E_WEBSITE') && $dsession->check('SUB_ESTORE_ID') && is_file($dsession->get('DIR_MAIN_E_WEBSITE').'manager/system/config.php')){ include($dsession->get('DIR_MAIN_E_WEBSITE').'manager/system/config.php'); }else{ $tmpPartner=false; if(!$tmpPartner=get_partner_info($domainEstore,isset($domain_estore)?$domain_estore:false)){ $tmpPartner=get_partner_info($runWithDomain,isset($domain_estore)?$domain_estore:false); } if($tmpPartner){ include(BASE_DIR_WEBSITE.'partner/'.$tmpPartner); }else{ $partner=array(); $partner['PARTNER_COMPANY']=$partner['PARTNER_ALIAS']='MẠNG TRUYỀN THÔNG THƯƠNG HIỆU ONLINE'; $partner['PARTNER_ADDRESS']='VPGD: Số 54, Đường 26, P.Hiệp Bình Chánh, Q.Thủ Đức, Tp.HCM'; /*$partner['PARTNER_PHONE']='(08) 66.719.113 - (08) 66.749.113';*/ $partner['PARTNER_HOTLINE']='0908.622.880 (Mr. Dũng)'; $partner['PARTNER_EMAIL_LINK']='info@thuonghieuonline.vn'; $partner['PARTNER_FULL_WEBSITE_LINK']='www.ThuonghieuOnline.vn'; } $msgAlert=' Thong bao - Dynamic Tool

Tên miền '.$estoreDomain.' chưa được cấu hình

Vui lòng liên hệ với nhà cung cấp dịch vụ của bạn



'; $msgAlert.='
{DTOOL.PARTNER_ALIAS}
Hotline: {DTOOL.PARTNER_HOTLINE} - Email: {DTOOL.PARTNER_EMAIL_LINK}
'; foreach($partner as $m_key => $m_value){ $msgAlert=str_replace('{DTOOL.'.$m_key.'}',$m_value,$msgAlert); } exit($msgAlert); } if(!$dsession->check('FIRST_COUNTER') && $dtool->first_count_visitor){ include(DIR_SYSTEM_INCLUDE.'counter_sub_estore.php'); $dsession->add('FIRST_COUNTER',true); } $REPLACE_URL_RELATIVE=0; defined('TOOL_NAME') or die('Permission denied'); define('IS_ESTORE',(in_array($dsession->get('ESTORE_INFO','id_groups'),$GLOBALS['ID_GROUPS_WEBSITE']))?FALSE:TRUE); $KEY_WEBSITE_URL=$dsession->get('CURRENT_ESTORE_DOMAIN'); /*$dtool->assign('DTOOL.ROOT_PAGES_LOCAL',$dtool->URL2SEO('','cua-hang',$KEY_WEBSITE_URL));*/ $dtool->listen_data($dsession); $langAccept=array(); if($dsession->check('ID_LANGUAGE_PERMISSION')){ $langAccept=$dsession->get('ID_LANGUAGE_PERMISSION'); if(intval($dtool->get_user_info($dsession,'status_multiple_language'))!=1){ $langAccept=array(); } } if(intval($dtool->get_user_info($dsession,'status_multiple_language'))==1 && count($langAccept)>1){ if(!$dsession->get('PRE_WEBSITE_INIT')){ $dsession->add('PRE_WEBSITE_INIT',TRUE); $allLang=$dtool->list_language['all']; $dsession->add('PRE_WEBSITE',strval(trim($allLang[intval($dtool->current_language)]['sort_name'],'/'))); } if(isset($_GET['idxlang'],$dtool->list_language['all'])){ $allLang=$dtool->list_language['all']; if(isset($allLang[intval($_GET['idxlang'])])){ $dsession->add('PRE_WEBSITE',strval(trim($allLang[intval($_GET['idxlang'])]['sort_name'],'/'))); } } $dtool->URL_SEO_PREFIX=$dsession->get('PRE_WEBSITE'); }else{ $dtool->URL_SEO_PREFIX=''; } $dtool->current_id_estore=$estoreDomain; $idSubAccount=$dsession->get('SUB_ESTORE_ID'); $dtool->where_global='status=1 and id_language='.$dtool->current_language.' and id_account='.$idSubAccount; $dtool->where_account='status=1 and id_account='.$idSubAccount; $dtool->where_account_only='id_account='.$idSubAccount; $dtool->where_account_mem='id_account_root='.$idSubAccount; if(!isset($dtool->where_account_sub)){ $dtool->where_account_sub='id_account_sub='.$idSubAccount; $dtool->where_account_sub_language=$dtool->where_account_sub.' and (FIND_IN_SET(0,ext_show_on_language)>0 or FIND_IN_SET('.$dtool->current_language.',ext_show_on_language)>0)'; } $dtool->assign('current_domain',$domainEstore); $default_force_ispc_pages=array('zaloapi'); if(isset($_GET[$dtool->key_page]) && (isset($_GET[$dtool->key_special]) || isset($_GET['ponce']) || in_array($_GET[$dtool->key_page],$default_force_ispc_pages))){ include($dtool->get_url_pages($dtool->current_page)); }else{ $dtool->default_page='tpl_e_website'; include($dtool->get_url_pages($dtool->default_page)); } session_write_close(); ?>