-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
118 lines (107 loc) · 3.82 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* $Author: BEESCMS $
* ============================================================================
* 网站地址: http://www.beescms.com
* 您只能在不用于商业目的的前提下对程序代码进行修改和使用;
* 不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
*/
if(!file_exists("data/install.lock")||!file_exists("data/confing.php")){header("location:install/index.php");exit();}
define('CMS',true);
require_once('includes/init.php');
require_once('includes/fun.php');
require_once('includes/lib.php');
if(file_exists(DATA_PATH.'index_info.php')){include(DATA_PATH.'index_info.php');}//首页配置缓存
$lang=isset($_GET['lang'])?$_GET['lang']:'';
$index_lang='';//默认首页语言
if(!empty($lang_cache)){
foreach($lang_cache as $k=>$v){
if($_index['index_lang']==$v['id']){
$index_lang = $v['lang_tag'];
}
}
}
//语言是否使用
if(!empty($lang)){
$is_lang_use=0;
if(!empty($lang_cache)){
foreach($lang_cache as $k=>$v){
if(($lang==$v['lang_tag'])&&!empty($v['lang_is_use'])){
$is_lang_use=1;//已经使用
}
}
}
if(empty($is_lang_use)){
$lang = $index_lang;
}
}
if(($lang == $index_lang)&&empty($_index['flash_is'])){
header("HTTP/1.1 301 Moved Permanently");
header("Location: index.php");
}
//开启flash
if(!empty($_index['flash_is'])&&empty($lang)){
$lang = $index_lang;
$fl_file=CMS_PATH.'template/flash.html';
if(!$fl_file){die($language['msg_info']);}
if(file_exists(LANG_PATH.'lang_'.$lang.'.php')){include(LANG_PATH.'lang_'.$lang.'.php');}//语言包缓存,数组$language
if(file_exists(DATA_PATH.'cache_cate/cate_list_'.$lang.'.php')){include(DATA_PATH.'cache_cate/cate_list_'.$lang.'.php');}//当前语言下的栏目
//默认首页语言网站配置
$_confing=get_confing($lang);
$tpl->template_dir=TP_PATH.'/';
$tpl->template_lang=$lang;
if($_confing['is_cache']){
$tpl->template_is_cache=1;//缓存
$tpl->template_time=$_confing['cache_time']?$_confing['cache_time']:30;//开启缓存但不存在缓存时间使用30秒
}else{
$tpl->template_is_cache=0;
}
$tpl->display('flash');
//关闭flash引导页
}else{
//载入语言页
$lang = empty($lang)?$index_lang:$lang;
if(!empty($lang_cache)){
foreach($lang_cache as $l_k=>$l_v){
if($l_v['lang_tag']==$lang){
$lang_name=$l_v['lang_name'];
break;
}
}
}
if(file_exists(LANG_PATH.'lang_'.$lang.'.php')){include(LANG_PATH.'lang_'.$lang.'.php');}//语言包缓存,数组$language
if(file_exists(DATA_PATH.'cache_cate/cate_list_'.$lang.'.php')){include(DATA_PATH.'cache_cate/cate_list_'.$lang.'.php');}//当前语言下的栏目
//网站配置文件
$_confing=get_confing($lang);
$is_template=isset($_confing['web_template'])?$_confing['web_template']:'';
if($is_template){
if(!file_exists(CMS_PATH.'template/'.$_confing['web_template'])){$err_msg=str_replace('@',$lang_name,$language['msg_info2']);die($err_msg);}
}else{
$err_msg=str_replace('@',$lang_name,$language['msg_info3']);
die($err_msg);
}
$index_focus="focus";
//指向首页
if($_confing['web_html']&&!$is_html){
$html_url=get_index_url($lang)?'index.html':'index_'.$lang.'.html';
if(file_exists($html_url)){
include($html_url);
//header("location:index_{$lang}.html");
}else{
$err_msg=str_replace('@',$lang_name,$language['msg_info4']);
die($err_msg);
}
}else{
$tpl->template_dir=TP_PATH.$_confing['web_template'].'/';
$tpl->template_lang=$lang;
if($_confing['is_cache']){
$tpl->template_is_cache=1;//缓存
$tpl->template_time=$_confing['cache_time']?$_confing['cache_time']:30;//开启缓存但不存在缓存时间使用30秒
}else{
$tpl->template_is_cache=0;
}
$tpl->display('index');
}
}
?>