mirror of
https://github.com/tznb1/TwoNav.git
synced 2025-08-10 08:51:49 +00:00
v2.0.16-20230425
This commit is contained in:
@@ -21,8 +21,8 @@ if($_GET['type'] == 'create' ){
|
||||
msg(-1,'导出失败');
|
||||
}
|
||||
}
|
||||
$_SESSION['download'][$key] = $tempnam;
|
||||
msgA(['code'=>1,'msg'=>'success','key'=>$key,'name'=>$tempnam]);
|
||||
$_SESSION['download']["$key"] = $tempnam;
|
||||
msgA(['code'=>1,'msg'=>'success','key'=>$key]);
|
||||
}else{
|
||||
msg(-1,'密码错误');
|
||||
}
|
||||
@@ -30,7 +30,7 @@ if($_GET['type'] == 'create' ){
|
||||
|
||||
//验证Key
|
||||
if(!is_file($_SESSION['download'][$_GET['key']])){
|
||||
exit("Key错误,请在后台重新导出!");
|
||||
exit("Key错误,请在后台重新导出!".$_SESSION['download']["{$_GET['key']}"]);
|
||||
}else{
|
||||
if($_GET['type'] == 'html' ){
|
||||
header("Cache-Control: public");
|
||||
@@ -59,7 +59,8 @@ if(!is_file($_SESSION['download'][$_GET['key']])){
|
||||
//生成数据
|
||||
function create_data(){
|
||||
if($_POST['type'] == 'html' ){
|
||||
$tempnam = tempnam(null,'export_html_');
|
||||
$key = md5(uniqid().Get_Rand_Str(8));
|
||||
$tempnam = DIR ."/data/temp/export_html_{$key}.html";
|
||||
$file = fopen($tempnam, "w") or msg(-1,'载入临时文件失败');
|
||||
fwrite($file,base64_decode("PCFET0NUWVBFIE5FVFNDQVBFLUJvb2ttYXJrLWZpbGUtMT4NCjwhLS0gVGhpcyBpcyBhbiBhdXRvbWF0aWNhbGx5IGdlbmVyYXRlZCBmaWxlLg0KICAgICBJdCB3aWxsIGJlIHJlYWQgYW5kIG92ZXJ3cml0dGVuLg0KICAgICBETyBOT1QgRURJVCEgLS0+DQo8TUVUQSBIVFRQLUVRVUlWPSJDb250ZW50LVR5cGUiIENPTlRFTlQ9InRleHQvaHRtbDsgY2hhcnNldD1VVEYtOCI+DQo8VElUTEU+T25lTmF2IEV4dGVuZCBCb29rbWFya3M8L1RJVExFPg0KPEgxPk9uZU5hdiBFeHRlbmQgQm9va21hcmtzPC9IMT4NCjxETD48cD4NCg=="));
|
||||
fwrite($file,' <DT><H3 ADD_DATE="1677783783" LAST_MODIFIED="1677783783" PERSONAL_TOOLBAR_FOLDER="true">书签栏</H3>'."\n");
|
||||
@@ -94,7 +95,8 @@ function create_data(){
|
||||
}
|
||||
|
||||
if($_POST['type'] == 'db3'){
|
||||
$tempnam = tempnam(null,'export_db3_');
|
||||
$key = md5(uniqid().Get_Rand_Str(8));
|
||||
$tempnam = DIR ."/data/temp/export_db3_{$key}.db3";
|
||||
try { //初始化数据库
|
||||
class MyDB extends SQLite3 {function __construct() {} }
|
||||
$MyDB = new MyDB();
|
||||
|
||||
@@ -68,7 +68,7 @@ if($page == 'config_home'){
|
||||
$theme_config = empty($theme_config['config']) ? []:$theme_config['config'];
|
||||
|
||||
//读取用户主题配置
|
||||
if(!in_array($_GET['fn'],['home','login','register','transit'])){
|
||||
if(!in_array($_GET['fn'],['home','login','register','transit','guide'])){
|
||||
msg(-1,"参数错误");
|
||||
}
|
||||
$theme_config_db = get_db('user_config','v',['t'=>'theme_'.$_GET['fn'],'k'=>$theme,'uid'=>UID]);
|
||||
@@ -79,7 +79,7 @@ if($page == 'config_home'){
|
||||
$theme_config = array_merge ($theme_config,$theme_config_db);
|
||||
}
|
||||
//配置为空
|
||||
if(empty($theme_config)){
|
||||
if(empty($theme_config) || !check_purview('theme_in',1) || !check_purview('theme_set',1)){
|
||||
exit("<h3>获取主题配置失败</h3>");
|
||||
}
|
||||
require $config_path;
|
||||
@@ -87,7 +87,11 @@ if($page == 'config_home'){
|
||||
}
|
||||
|
||||
//主题设置页面
|
||||
if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit' || $page == 'theme_register') {
|
||||
if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit' || $page == 'theme_register' || $page == 'theme_guide') {
|
||||
if(!check_purview('theme_in',1)){
|
||||
require(DIR.'/templates/admin/page/404.php');
|
||||
exit;
|
||||
}
|
||||
$fn = str_replace('theme_','',$page);
|
||||
$dirs = get_dir_list(DIR.'/templates/'.$fn);
|
||||
|
||||
|
||||
@@ -1104,7 +1104,7 @@ function other_testing_link(){
|
||||
//主题下载/更新/删除
|
||||
function write_theme(){
|
||||
global $global_config;
|
||||
$fn = $_POST['fn'];if($_GET['type'] != 'config' && !in_array($fn,['home','login','transit','register'])){msg(-1,'fn参数错误');}
|
||||
$fn = $_POST['fn'];if($_GET['type'] != 'config' && !in_array($fn,['home','login','transit','register','guide'])){msg(-1,'fn参数错误');}
|
||||
if($_GET['type'] == 'download'){
|
||||
is_root();
|
||||
if($global_config['offline']){msg(-1,"离线模式禁止下载主题!");} //离线模式
|
||||
@@ -1191,13 +1191,16 @@ function write_theme(){
|
||||
$type = $_POST['type'];
|
||||
$name = $_POST['name'];
|
||||
//如果是注册模板则必须是root权限
|
||||
if($fn == 'register'){is_root();}
|
||||
if($fn == 'register' || $fn == 'guide'){is_root();}
|
||||
//相关检测
|
||||
if ( !preg_match("/^[a-zA-Z0-9_-]{1,64}$/",$name) ) {
|
||||
msg(-1,"主题名称不合法!");
|
||||
}elseif(!is_dir(DIR."/templates/$fn/".$name)){
|
||||
msg(-1,'主题不存在');
|
||||
}elseif(!check_purview('theme_in',1)){
|
||||
msg(-1,'无权限');
|
||||
}
|
||||
|
||||
//读取用户模板配置
|
||||
require DIR."/system/templates.php";
|
||||
//判断设置的类型
|
||||
@@ -1219,6 +1222,9 @@ function write_theme(){
|
||||
}elseif($fn == 'register'){
|
||||
$global_templates['register'] = $name;
|
||||
update_db('global_config',['v'=>$global_templates],['k'=>'s_templates'],[1,'注册模板设置成功']);
|
||||
}elseif($fn == 'guide'){
|
||||
$global_templates['guide'] = $name;
|
||||
update_db('global_config',['v'=>$global_templates],['k'=>'s_templates'],[1,'引导页模板设置成功']);
|
||||
}
|
||||
//更新数据
|
||||
update_db('user_config',['v'=>$s_templates],['uid'=>UID,'k'=>'s_templates'],[1,'设置成功']);
|
||||
@@ -1237,7 +1243,7 @@ function write_theme(){
|
||||
msg(-1,"获取模板类型错误");
|
||||
}
|
||||
$fn = empty($GET['fn']) ? $_GET['template_type'] : $GET['fn'];
|
||||
if(!in_array($fn,['home','login','register','transit'])){
|
||||
if(!in_array($fn,['home','login','register','transit','guide'])){
|
||||
msg(-1,"参数错误");
|
||||
}
|
||||
//0420 END
|
||||
|
||||
@@ -500,6 +500,7 @@ function write_sys_settings(){
|
||||
'Maintenance'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'维护模式参数错误'],
|
||||
'Sub_domain'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'二级域名参数错误'],
|
||||
'Privacy'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'强制私有参数错误'],
|
||||
'default_page'=>['int'=>true,'min'=>0,'max'=>2,'msg'=>'默认页面参数错误'],
|
||||
'copyright'=>['empty'=>true],
|
||||
'global_header'=>['empty'=>true],
|
||||
'global_footer'=>['empty'=>true],
|
||||
|
||||
@@ -5,7 +5,7 @@ define('is_login',is_login());
|
||||
//判断用户组,是否允许未登录时访问主页
|
||||
if(!is_login && ($global_config['Privacy'] == 1 || !check_purview('Common_home',1))){
|
||||
header("HTTP/1.1 302 Moved Permanently");
|
||||
header("Location: ./?c=admin");
|
||||
header("Location: ./?c=admin&u=".U);
|
||||
exit;
|
||||
}
|
||||
//载入站点设置
|
||||
@@ -15,11 +15,32 @@ $site['Title'] = $site['title'].(empty($site['subtitle'])?'':' - '.$site['subt
|
||||
$copyright = empty($global_config['copyright'])?'<a target="_blank" href="https://gitee.com/tznb/TwoNav">Copyright © TwoNav</a>':$global_config['copyright'];
|
||||
$ICP = empty($global_config['ICP'])?'':'<a target="_blank" href="https://beian.miit.gov.cn">'.$global_config['ICP'].'</a>';
|
||||
$favicon = ( !empty($site['site_icon_file'])) ? $site['site_icon'] : './favicon.ico';
|
||||
|
||||
//读取默认模板信息
|
||||
require DIR ."/system/templates.php";
|
||||
//引导页
|
||||
if(!empty($global_config['default_page']) && $global_config['default_page'] == 2){
|
||||
if(empty(Get('u')) && empty($_COOKIE['Default_User'])){
|
||||
$theme = $global_templates['guide'];
|
||||
$dir_path = DIR.'/templates/guide/'.$global_templates['guide'];
|
||||
$index_path = $dir_path.'/index.php';
|
||||
if(!is_file($index_path)){
|
||||
$dir_path= DIR.'/templates/guide/default';
|
||||
$index_path = $dir_path.'/index.php';
|
||||
}
|
||||
$theme_dir = str_replace(DIR.'/templates/guide',"./templates/guide",$dir_path);
|
||||
$theme_info = json_decode(@file_get_contents($dir_path.'/info.json'),true);
|
||||
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
|
||||
$theme_config_db = get_db('user_config','v',['t'=>'theme_guide','k'=>$theme,'uid'=>UID]);
|
||||
$theme_config_db = unserialize($theme_config_db);
|
||||
$theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_config,$theme_config_db);
|
||||
require($index_path);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
//参数指定主题优先
|
||||
$theme = trim(@$_GET['theme']);
|
||||
if ( !empty ($theme) ){
|
||||
if ( !empty ($theme) && check_purview('theme_in',1)){
|
||||
$dir_path = DIR.'/templates/home/'.$theme;
|
||||
$index_path = $dir_path.'/index.php';
|
||||
}else{
|
||||
|
||||
@@ -48,6 +48,10 @@ if(Get_MD5_Password($Password,$USER_DB["RegTime"]) === $USER_DB["Password"]){
|
||||
}else{
|
||||
$url = preg_match('/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i',$_SERVER['HTTP_USER_AGENT']) ? "./?c=index&u={$USER_DB['User']}" : "./?c=admin&u={$USER_DB['User']}";
|
||||
}
|
||||
//默认页面
|
||||
if(!empty($global_config['default_page'])){
|
||||
setcookie('Default_User', $User, strtotime("+360 day"),"/",'',false,false);
|
||||
}
|
||||
msgA(['code'=>1,'msg'=>'登录成功','url'=>$url]);
|
||||
}else{
|
||||
update_db("user_log", ["description" => "请求登录>账户或密码错误"], ["id"=>$log_id]);
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.0.15-20230422
|
||||
v2.0.16-20230425
|
||||
Reference in New Issue
Block a user