Repository navigation
Expand file tree
/
Copy pathbootstrap.php
More file actions
92 lines (92 loc) · 3.09 KB
/
Copy pathbootstrap.php
File metadata and controls
92 lines (92 loc) · 3.09 KB
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
<?php
/**
* --------------------------------------------------------
* | █ █ ▀▀█▀▀ |
* | █▄▄▄█ █ |
* | |
* | Author: Huang Hui |
* | Repository 1: https://gitee.com/usualtool |
* | Repository 2: https://github.com/usualtool |
* | Applicable to Apache 2.0 protocol. |
* --------------------------------------------------------
*/
ini_set('display_errors','Off');
ini_set('log_errors','On');
ini_set('error_log',__DIR__.'/log/php_errors.log');
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED);
/**
* 系统级全局路径
*/
defined('UTF_ROOT') or define('UTF_ROOT',__DIR__);
defined('APP_ROOT') or define('APP_ROOT',__DIR__.'/app');
defined('OPEN_ROOT') or define('OPEN_ROOT',__DIR__.'/open');
/**
* 加载类库
*/
session_start();
require UTF_ROOT.'/autoload.php';
use usualtool\Lib\Inc;
use usualtool\Lib\Temp;
use usualtool\Lib\Route;
/**
* 读取配置
*/
$config=Inc::GetConfig();
/**
* 公共模块/模板配置
*/
define('PUB_PATH', APP_ROOT.'/modules/'.$config["DEFAULT_MOD"]);
define('PUB_TEMP', PUB_PATH.'/skin');
/**
* 识别入口/路由
*/
if(pathinfo($_SERVER['SCRIPT_NAME'] ?? '',PATHINFO_FILENAME)=='plugin') return;
foreach(Route::Analy(Inc::CurPageUrl()) as $k=>$v) $_GET[$k]=$v;
/**
* 模块/控制/依赖
*/
$m=Inc::SqlCheck($_GET["m"] ?? $config["DEFAULT_MOD"]);
$p=Inc::SqlCheck(str_replace(".php","",$_GET["p"] ?? $config["DEFAULT_PAGE"]));
$_modpath_=APP_ROOT."/modules/".$m;
Inc::HasComposer($_modpath_);
/**
* 入口节点/模板预设
*/
$_deve_=(($_GET["_control_"] ?? "")=="admin");
$_form_=$_deve_ ? "admin" : "front";
$_work_=APP_ROOT."/template/".($_deve_ ? $config["TEMPADMIN"] : $config["TEMPFRONT"]);
$_node_=(($_deve_ && $config["TEMPADMIN"]!="0") || (!$_deve_ && $config["TEMPFRONT"]!="0")) ? $_work_ : $_modpath_;
$_skin_=$_node_.($_node_===$_work_ ? "/skin/".$m : "/skin");
$_cache_=($_node_===$_work_ ? $_skin_ : $_node_)."/cache";
/**
* 本地化语言
*/
$_lang_=!empty($_COOKIE["lang"]) ? Inc::SqlCheck($_COOKIE["lang"]) : $config["LANG"];
if(!isset($_COOKIE["lang"])){
setcookie("lang",$_lang_);
$_COOKIE["lang"]=$_lang_;
}
/**
* 启动引擎/全局预设
*/
$app=new Temp($config["TEMPCACHE"],$_skin_."/".$_form_,$_cache_."/".$_form_);
$app->Runin(
array(
"appname",//应用名称
"appurl",//应用地址
"module",//当前模块
"page",//当前页/方法
"lang",//本地化语言列表
"thelang",//当前语言
"pubtemp",//模块化公共模板路径
"template"//工程化模板路径
),array(
$config["APPNAME"],
$config["APPURL"],
$m,
$p,
explode(",",$config["LANG_OPTION"]),
$config["LANG"],
PUB_TEMP."/".$_form_,
$_work_."/skin/".$config["DEFAULT_MOD"]."/".$_form_
));