diff --git a/system/MySQL/20230420.php b/system/MySQL/20230420.php
new file mode 100644
index 0000000..b3b1011
--- /dev/null
+++ b/system/MySQL/20230420.php
@@ -0,0 +1,23 @@
+'theme']);
+foreach ($datas as $data) {
+ $name = $data['k'];
+ unset($data['id']);
+ if($name == 'default'){
+ $data['t'] = 'theme_transit';
+ insert_db('user_config',$data);
+ }
+ if($name == 'WebStack-Hugo'){
+ $data['t'] = 'theme_transit';
+ insert_db('user_config',$data);
+ }
+ $data['t'] = 'theme_home';
+ insert_db('user_config',$data);
+}
+
+insert_db('updatadb_logs',['file_name'=>$file_name,'update_time'=>time(),'status'=>'TRUE','extra'=>'']);
+delete_db('user_config',['t'=>'theme']);
\ No newline at end of file
diff --git a/system/MySQL/install.sql b/system/MySQL/install.sql
index 315f728..02f2b77 100644
--- a/system/MySQL/install.sql
+++ b/system/MySQL/install.sql
@@ -42,7 +42,8 @@ CREATE TABLE IF NOT EXISTS `updatadb_logs` (
UNIQUE KEY `file_name` (`file_name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
-INSERT INTO "updatadb_logs" ("id", "file_name", "update_time", "status", "extra") VALUES ('1', '20230417.php', '1681719049', 'TRUE', '');
+INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230417.php', '1681719049', 'TRUE', '');
+INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230420.php', '1681977368', 'TRUE', '');
-- 创建用户表
DROP TABLE IF EXISTS `global_user`;
diff --git a/system/SQLite/20230420.php b/system/SQLite/20230420.php
new file mode 100644
index 0000000..b3b1011
--- /dev/null
+++ b/system/SQLite/20230420.php
@@ -0,0 +1,23 @@
+'theme']);
+foreach ($datas as $data) {
+ $name = $data['k'];
+ unset($data['id']);
+ if($name == 'default'){
+ $data['t'] = 'theme_transit';
+ insert_db('user_config',$data);
+ }
+ if($name == 'WebStack-Hugo'){
+ $data['t'] = 'theme_transit';
+ insert_db('user_config',$data);
+ }
+ $data['t'] = 'theme_home';
+ insert_db('user_config',$data);
+}
+
+insert_db('updatadb_logs',['file_name'=>$file_name,'update_time'=>time(),'status'=>'TRUE','extra'=>'']);
+delete_db('user_config',['t'=>'theme']);
\ No newline at end of file
diff --git a/system/SQLite/install.sql b/system/SQLite/install.sql
index eb03f60..b47c73c 100644
--- a/system/SQLite/install.sql
+++ b/system/SQLite/install.sql
@@ -35,7 +35,8 @@ CREATE TABLE IF NOT EXISTS "updatadb_logs" (
"extra" TEXT(512) NOT NULL DEFAULT "",
CONSTRAINT "file_name" UNIQUE ("file_name" ASC)
);
-INSERT INTO "updatadb_logs" ("id", "file_name", "update_time", "status", "extra") VALUES ('1', '20230417.php', '1681719049', 'TRUE', '');
+INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230417.php', '1681719049', 'TRUE', '');
+INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230420.php', '1681977368', 'TRUE', '');
-- 创建用户表
CREATE TABLE IF NOT EXISTS "global_user" (
diff --git a/system/admin.php b/system/admin.php
index 253b781..abc30b7 100644
--- a/system/admin.php
+++ b/system/admin.php
@@ -53,32 +53,8 @@ if ($page == 'home') {
array_push($day_data[0]['data'],get_db('user_count','v',['uid'=>UID,'k'=>$date,'t'=>'index_Ymd'])??0);
array_push($day_data[1]['data'],get_db('user_count','v',['uid'=>UID,'k'=>$date,'t'=>'click_Ymd'])??0);
}
- //var_dump(json_encode($day),$day_data);
}
-//调试
-if( $page == 'test' ) {
- $dirs = get_dir_list(DIR.'/templates/home');
- //var_dump($dirs);
- foreach ($dirs as $dir) {
- $path = DIR.'/templates/home/'.$dir; //目录完整路径
- //没有信息文件则跳过
- if(!is_file($path.'/info.json') ) {continue;}
- //读取主题信息
- $themes[$dir]['info'] = json_decode(@file_get_contents($path.'/info.json'),true);
- //是否支持配置
- $themes[$dir]['info']['config'] = is_file($path.'/config.php') ? '1':'0';
- //预览图优先顺序:png>jpg>info>default
- if(is_file($dirs.'/screenshot.png')){
- $themes[$dir]['info']['screenshot'] = "./templates/home/".$dir."/screenshot.png";
- }elseif(is_file($dirs.'/screenshot.jpg')){
- $themes[$dir]['info']['screenshot'] = "./templates/home/".$dir."/screenshot.jpg";
- }elseif(empty($themes[$dir]['info']['screenshot'])){
- $themes[$dir]['info']['screenshot'] = "./templates/admin/static/42ed3ef2c4a50f6d.png";
- }
- //var_dump($themes);
- }
-}
//载入主题配置
if($page == 'config_home'){
$theme = $_GET['theme'];
@@ -92,7 +68,10 @@ if($page == 'config_home'){
$theme_config = empty($theme_config['config']) ? []:$theme_config['config'];
//读取用户主题配置
- $theme_config_db = get_db('user_config','v',['t'=>'theme','k'=>$theme,'uid'=>UID]);
+ if(!in_array($_GET['fn'],['home','login','register','transit'])){
+ msg(-1,"参数错误");
+ }
+ $theme_config_db = get_db('user_config','v',['t'=>'theme_'.$_GET['fn'],'k'=>$theme,'uid'=>UID]);
$theme_config_db = unserialize($theme_config_db);
//如果不为空则合并数据
@@ -103,7 +82,6 @@ if($page == 'config_home'){
if(empty($theme_config)){
exit("
获取主题配置失败
");
}
- //var_dump($theme_config);
require $config_path;
exit;
}
@@ -129,7 +107,6 @@ if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit'
}elseif(empty($themes[$dir]['info']['screenshot'])){
$themes[$dir]['info']['screenshot'] = "./templates/admin/static/42ed3ef2c4a50f6d.png";
}
- //var_dump($themes);
}
//获取当前主题
@@ -191,7 +168,6 @@ if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit'
define('referrer',$data['referrer']);
}
}
- //var_dump($themes);exit;
}
@@ -230,7 +206,6 @@ if ($page == 'menu') {
array_push($menu,$extend);
}
-
//如果是管理员则追加菜单
if($USER_DB['UserGroup'] == 'root'){
array_push($menu,
@@ -251,7 +226,6 @@ if ($page == 'menu') {
exit(json_encode($init));
}
-
//不带参数是载入框架
if(empty($page)){
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
@@ -271,7 +245,6 @@ if(!empty($page)){
}
}
-
//加载静态库
function load_static($type){
if($type == 'css'){
diff --git a/system/api.php b/system/api.php
index cb0836c..74cf698 100644
--- a/system/api.php
+++ b/system/api.php
@@ -1231,10 +1231,22 @@ function write_theme(){
if(empty($_POST)){
msg(-1,"POST请求数据不能为空!");
}
- write_user_config($_GET['t'],$_POST,'theme','主题配置');
+ //20230420,修复同名窜数据的问题!由于保存主题不提交模板类型,只能从来路中提取
+ parse_str(parse_url($_SERVER['HTTP_REFERER'])['query'],$GET);
+ if(empty($GET['fn']) && empty($_GET['template_type']) ){
+ msg(-1,"获取模板类型错误");
+ }
+ $fn = empty($GET['fn']) ? $_GET['template_type'] : $GET['fn'];
+ if(!in_array($fn,['home','login','register','transit'])){
+ msg(-1,"参数错误");
+ }
+ //0420 END
+ write_user_config($_GET['t'],$_POST,'theme_' . $fn,'主题配置');
msg(1,"保存成功!");
}
}
+
+
//读登录信息
function read_login_info(){
$page = empty(intval($_REQUEST['page'])) ? 1 : intval($_REQUEST['page']);
diff --git a/system/api_root.php b/system/api_root.php
index 92ec343..d9d5ec1 100644
--- a/system/api_root.php
+++ b/system/api_root.php
@@ -42,9 +42,9 @@ function other_upsys(){
if($_POST['i'] == 2){
if(!is_subscribe('bool')){
msg(-1,'未检测到有效授权,请
- 购买授权
+ 购买授权
或
- 手动更新');
+ 手动更新');
}
//设置执行最长时间,0为无限制。单位秒!
set_time_limit(5*60);
diff --git a/system/click.php b/system/click.php
index a403ed7..57a683a 100644
--- a/system/click.php
+++ b/system/click.php
@@ -113,7 +113,7 @@ update_db("user_links", ["click[+]"=>1],['uid'=>UID,'lid'=>$id]);
//读取用户主题配置
-$theme_config_db = unserialize(get_db('user_config','v',['t'=>'theme','k'=>$s_templates['transit'],'uid'=>UID]));
+$theme_config_db = unserialize(get_db('user_config','v',['t'=>'theme_transit','k'=>$s_templates['transit'],'uid'=>UID]));
//读取默认主题配置
$theme_info = json_decode(@file_get_contents($dir_path.'/info.json'),true);
diff --git a/system/index.php b/system/index.php
index fd5025d..93e8812 100644
--- a/system/index.php
+++ b/system/index.php
@@ -43,7 +43,7 @@ $support_category_svg = $theme_info['support']['category_svg']??0; //0.不支持
//主题配置(默认)
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
//主题配置(用户)
-$theme_config_db = get_db('user_config','v',['t'=>'theme','k'=>$theme,'uid'=>UID]);
+$theme_config_db = get_db('user_config','v',['t'=>'theme_home','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);
@@ -132,10 +132,11 @@ function get_links($fid) {
$where['LIMIT'] = $site['new_link'];
}
$where['ORDER']['lid'] = 'DESC';
- //输出上限&不在子页面&例外主题
- }elseif($site['max_link'] > 0 && empty(Get('oc')) && !$site['ex_theme']){
+ //输出上限&不在子页面&例外主题&书签分享
+ }elseif($site['max_link'] > 0 && empty(Get('oc')) && !$site['ex_theme'] && empty($_GET['share'])){
$count = count_db('user_links',$where);
$where['LIMIT'] = $site['max_link'];
+ $max_link = true;
}
$links = select_db('user_links',['lid(id)','fid','property','title','url(real_url)','url_standby','description','icon','click','pid'],$where);
foreach ($links as $key => $link) {
@@ -172,7 +173,7 @@ function get_links($fid) {
//获取图标链接
$links[$key]['ico'] = $lock ? $GLOBALS['libs'].'/Other/lock.svg' : geticourl($site['link_icon'],$link);
}
- if($site['max_link'] > 0 && $count > $site['max_link'] && empty(Get('oc')) && !$site['ex_theme']){
+ if($max_link && $count > $site['max_link']){
$oc_url = "./index.php?u={$u}&oc={$fid}" . (empty($_GET['theme']) ? '':"&theme={$_GET['theme']}");
array_push($links,['id'=>0,'title'=>'查看全部','url'=>$oc_url,'real_url'=>$oc_url,'description'=>'该分类共有'.$count.'条数据','ico'=>'./favicon.ico']);
}
diff --git a/system/public.php b/system/public.php
index cbac419..ccd3ee9 100644
--- a/system/public.php
+++ b/system/public.php
@@ -155,8 +155,7 @@ function get_db($table,$columns,$where,$rp = []){
//写全局配置(存在则更新,不存在则创建)
function write_global_config($key,$value,$d){
- $re = get_db('global_config','k',['k'=>$key]);
- if(empty($re)){
+ if(!has_db('global_config',['k'=>$key])){
insert_db("global_config", ["k" => $key,"v" => $value,"d" => $d]);
}else{
update_db("global_config", ["v" => $value],['k'=>$key]);
@@ -165,17 +164,16 @@ function write_global_config($key,$value,$d){
//写用户配置(存在则更新,不存在则创建)
function write_user_config($key,$value,$t,$d){
- $re = get_db('user_config','k',['uid'=>UID,'k'=>$key]);
- if(empty($re)){
+ if(!has_db('user_config',['uid'=>UID,'k'=>$key,'t'=>$t])){
insert_db("user_config", ['uid'=>UID,"k"=>$key,"v"=>$value,"t"=>$t,"d"=>$d]);
}else{
- update_db("user_config", ["v"=>$value],['uid'=>UID,'k'=>$key]);
+ update_db("user_config", ["v"=>$value],['uid'=>UID,'k'=>$key,'t'=>$t]);
}
}
+//写用户统计
function write_user_count($key,$t){
- $re = get_db('user_count','k',['uid'=>UID,'t'=>$t,'k'=>$key]);
- if(empty($re)){
+ if(!has_db('user_count',['uid'=>UID,'t'=>$t,'k'=>$key])){
insert_db("user_count", ['uid'=>UID,"k"=>$key,"v"=>1,'t'=>$t]);
}else{
update_db("user_count", ["v[+]"=>1],['uid'=>UID,'t'=>$t,'k'=>$key]);
diff --git a/system/version.txt b/system/version.txt
index ed6c473..e7fbcc0 100644
--- a/system/version.txt
+++ b/system/version.txt
@@ -1 +1 @@
-v2.0.13-20230418
\ No newline at end of file
+v2.0.14-20230420
\ No newline at end of file
diff --git a/templates/admin/page/root/vip.php b/templates/admin/page/root/vip.php
index 9068c0e..5f6b482 100644
--- a/templates/admin/page/root/vip.php
+++ b/templates/admin/page/root/vip.php
@@ -51,7 +51,6 @@ $HTTP_HOST = preg_replace('/:\d+$/','',$_SERVER['HTTP_HOST']); //去除端口号
-
1. 可使用一键更新功能
diff --git a/templates/admin/page/updatelog.php b/templates/admin/page/updatelog.php
index 241d022..9b17583 100644
--- a/templates/admin/page/updatelog.php
+++ b/templates/admin/page/updatelog.php
@@ -2,6 +2,16 @@
+
+
+
+
v2.0.14-20230420
+
+ - 修复书签分享和输出上限冲突的问题
+ - [数据库更新]修复不同类型的模板目录名相同时存在窜数据的问题
+
+
+