From 82e832143290e63f1a663ad6cdc5b0bbe3f1aed9 Mon Sep 17 00:00:00 2001 From: "MI15\\Win" <10359480+tznb@user.noreply.gitee.com> Date: Sat, 24 Jun 2023 13:58:46 +0800 Subject: [PATCH] v2.0.28-20230624 --- system/api.php | 24 +++++++--- system/expand/apply.php | 12 ++--- system/public.php | 2 +- system/version.txt | 2 +- templates/admin/js/category.js | 9 ++++ templates/admin/js/link.js | 2 +- templates/admin/js/link_list.js | 41 ++++++++++++----- templates/admin/page/SiteSetting.php | 24 +++------- templates/admin/page/expand/apply-admin.php | 12 ++++- templates/admin/page/expand/apply-user.php | 50 +++++++++++---------- templates/admin/page/link_list.php | 2 +- templates/admin/page/updatelog.php | 16 +++++++ 12 files changed, 125 insertions(+), 71 deletions(-) diff --git a/system/api.php b/system/api.php index 7975c76..8445c09 100644 --- a/system/api.php +++ b/system/api.php @@ -306,7 +306,7 @@ function read_link_list(){ $list = unserialize($list); msgA(['code'=>1,'msg'=>'获取成功','count'=>count($list),'data'=>$list]); } - + $field = ['lid','fid','pid(pwd_id)','status','property','title','url','url_standby','weight','description','icon','click','add_time','up_time']; $query = $_POST['query']; $fid = intval(@$_POST['fid']); //获取分类ID $page = empty(intval($_REQUEST['page'])) ? 1 : intval($_REQUEST['page']); @@ -334,14 +334,20 @@ function read_link_list(){ //统计条数 $count = count_db('user_links',$where); - //权重排序(数字小的排前面) - $where['ORDER']['weight'] = 'ASC'; - $where['ORDER']['lid'] = 'ASC'; + //前端指定排序方式,过滤字段名和方式 + if(!empty($_POST['order']) && !empty($_POST['field']) && in_array($_POST['field'],$field) && in_array($_POST['order'],['ASC','DESC'])){ + $where['ORDER'][$_POST['field']] = $_POST['order']; + }else{ + //默认排序方式 权重排序(数字小的排前面) + $where['ORDER']['weight'] = 'ASC'; + $where['ORDER']['lid'] = 'ASC'; + } + //分页 $where['LIMIT'] = [$offset,$limit]; //查询 - $datas = select_db('user_links',['lid','fid','pid(pwd_id)','status','property','title','url','url_standby','weight','description','icon','click','add_time','up_time'],$where); + $datas = select_db('user_links',$field,$where); msgA(['code'=>1,'msg'=>'获取成功','count'=>$count,'data'=>$datas]); } @@ -821,6 +827,10 @@ function write_apply(){ $s['apply'] = intval($_POST['apply']); // 功能选项0.关闭 1.需要审核 2.无需审核 $s['Notice'] = $_POST['Notice']??''; // 公告 $s['submit_limit'] = intval($_POST['submit_limit']); //提交限制 + $s['iconurl'] = $_POST['iconurl']; + $s['description'] = $_POST['description']; + $s['email'] = $_POST['email']; + if($s['apply'] < 0 || $s['apply'] > 2 ){ msg(-1,'参数错误!'); }elseif(strlen($s['Notice']) > 512){ @@ -966,8 +976,8 @@ function write_site_setting(){ 'main_link_priority'=>['int'=>true,'min'=>0,'max'=>3,'msg'=>'主链优先参数错误'], 'link_icon'=>['int'=>true,'min'=>0,'max'=>30,'msg'=>'链接图标参数错误'], 'site_icon'=>['empty'=>true], - 'top_link'=>['int'=>true,'min'=>0,'max'=>20,'msg'=>'热门链接参数错误'], - 'new_link'=>['int'=>true,'min'=>0,'max'=>20,'msg'=>'最新链接参数错误'], + 'top_link'=>['int'=>true,'min'=>0,'max'=>100,'msg'=>'热门链接参数错误'], + 'new_link'=>['int'=>true,'min'=>0,'max'=>100,'msg'=>'最新链接参数错误'], 'max_link'=>['int'=>true,'min'=>0,'max'=>100,'msg'=>'输出上限参数错误'], 'custom_header'=>['empty'=>true], 'custom_footer'=>['empty'=>true] diff --git a/system/expand/apply.php b/system/expand/apply.php index 7e43d6e..0dd3bbb 100644 --- a/system/expand/apply.php +++ b/system/expand/apply.php @@ -44,22 +44,22 @@ foreach($_POST as $key =>$value){ $title = $_POST['title']; $url = $_POST['url']; -$iconurl = $_POST['iconurl']; -$description = $_POST['description']; +$iconurl = $_POST['iconurl'] ?? ''; +$description = $_POST['description'] ?? ''; $category_id = intval ($_POST['category_id']); -$email = $_POST['email']; +$email = $_POST['email'] ?? ''; $user_ip = Get_IP(); if( !filter_var($url, FILTER_VALIDATE_URL) ) { msg(-1,'URL无效!'); -}elseif( !empty($iconurl) && !filter_var($iconurl, FILTER_VALIDATE_URL) ){ +}elseif(!empty($apply['iconurl']) && !filter_var($iconurl, FILTER_VALIDATE_URL) ){ msg(-1,'网站图标无效!'); -}elseif(!preg_match('/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/',$email)){ +}elseif(!empty($apply['email']) && !preg_match('/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/',$email)){ msg(-1,'联系邮箱无效!'); }elseif(!isset($_POST['category_id'])){ msg(-1,'分类ID不能为空!'); }elseif(!isset($_POST['title'])){ msg(-1,'网站标题不能为空!'); -}elseif(!isset($_POST['description'])){ +}elseif(!empty($apply['description']) && empty($_POST['description'])){ msg(-1,'网站描述不能为空!'); } //获取和检查分类信息 diff --git a/system/public.php b/system/public.php index 644c799..29f5911 100644 --- a/system/public.php +++ b/system/public.php @@ -234,7 +234,7 @@ function echo_pwds(){ } //检查链接 function check_link($fid,$title,$url,$url_standby_s=''){ - $pattern = "/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|sftp:\/\/|magnet:?|ed2k:\/\/|thunder:\/\/|tcp:\/\/|udp:\/\/|rtsp:\/\/).+/"; + $pattern = "/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|sftp:\/\/|magnet:?|ed2k:\/\/|thunder:\/\/|tcp:\/\/|udp:\/\/|rtsp:\/\/|wsa:\/\/|vmrc:\/\/).+/"; $length_limit = unserialize(get_db("global_config","v",["k"=>"length_limit"])); if (empty($fid)) msg(-1,'分类id(fid)不能为空'); if (empty($title)) msg(-1,'名称不能为空'); diff --git a/system/version.txt b/system/version.txt index c702375..a9f7daf 100644 --- a/system/version.txt +++ b/system/version.txt @@ -1 +1 @@ -v2.0.27-20230618 \ No newline at end of file +v2.0.28-20230624 \ No newline at end of file diff --git a/templates/admin/js/category.js b/templates/admin/js/category.js index 3f56c5c..8bcbbda 100644 --- a/templates/admin/js/category.js +++ b/templates/admin/js/category.js @@ -82,6 +82,15 @@ } limit = false; //取消修改限制 layer.closeAll('loading'); //关闭加载层 + //加载加密分组数据 + $.post(get_api('read_pwd_group_list'),{'page':'1','limit':'9999'},function(data,status){ + if(data.code == 1){ + pwds = []; + for(var i =0;i ' + categorys[d.fid].name; @@ -36,24 +37,38 @@ layui.use(['form','table','dropdown','miniTab'], function () { return 'Null'; } }} - ,{field: 'title', title: '链接标题', width:200, edit: 'text'} + ,{field: 'icon', title: '图标', width:60, templet:function(d){ + if(d.icon == null || d.icon == ""){ + return ''; + }else{ + if(d.icon.substr(0,5) =='data:') { + img_src = d.icon; + }else if(d.icon.substr(0,4) == ''; + } + }} + ,{field: 'title', title: '链接标题',sort:true, width:200, edit: 'text'} ,{ title:'操作', toolbar: '#tablebar',width:110} ,{field:'pwd_id',title:'密码',width:70,templet: function(d){ - return d.pwd_id>0?'查看':''; - }} + return d.pwd_id>0?'查看':''; + }} ,{field: 'property', title: '私有', width: 100, sort: true,templet: function(d){ return ""; }} ,{field: 'status', title: '状态', width: 100, sort: true,templet: function(d){ return ""; }} - ,{field: 'url', title: 'URL',templet:function(d){ - return '' + d.url + ''; + ,{field: 'url',sort:true, title: 'URL',templet:function(d){ + return '' + d.url + ''; }} ,{field: 'click', title: '点击数',width:90,sort:true} ,{field: 'add_time', title: '添加时间', width:160, sort: true,templet:function(d){ - var add_time = timestampToTime(d.add_time); - return add_time; + var add_time = timestampToTime(d.add_time); + return add_time; }} ,{field: 'up_time', title: '修改时间', width:160,sort:true,templet:function(d){ return d.up_time == null ?'':timestampToTime(d.up_time); @@ -122,6 +137,12 @@ layui.use(['form','table','dropdown','miniTab'], function () { }); } }); + // 监听表格排序事件 + table.on('sort(table)', function(obj) { + field = obj.field; // 排序字段 + order = obj.type == null ? '' : obj.type.toUpperCase(); // 排序方式asc,desc转为大写,null则默认排序 + link_search(); + }); }; function link_search(){ @@ -136,7 +157,7 @@ layui.use(['form','table','dropdown','miniTab'], function () { pageName: 'page' //页码的参数名称 ,limitName: 'limit' //每页数据量的参数名 } - ,where: {query:keyword,fid:fid,property:property,status:status} + ,where: {query:keyword,fid:fid,property:property,status:status,field:field,order:order} ,page: {curr: 1} }); } diff --git a/templates/admin/page/SiteSetting.php b/templates/admin/page/SiteSetting.php index 3057d86..0c0e914 100644 --- a/templates/admin/page/SiteSetting.php +++ b/templates/admin/page/SiteSetting.php @@ -84,31 +84,19 @@
- +
- +
-
在主页显示热门网址(点击排行)
+
在主页显示最新的网址(创建时间)
- +
- +
-
在主页显示最新的网址(创建时间)
+
在主页显示热门网址(点击排行)
diff --git a/templates/admin/page/expand/apply-admin.php b/templates/admin/page/expand/apply-admin.php index 39c0d39..c8947fe 100644 --- a/templates/admin/page/expand/apply-admin.php +++ b/templates/admin/page/expand/apply-admin.php @@ -50,7 +50,15 @@ $title='收录管理';$awesome=true; require dirname(__DIR__).'/header.php';
单位:次,指最近24小时内可以提交多少次(为了防止恶意提交,删除记录可以恢复次数)
- +
+ +
+ + + +
+
+
部分主题没有收录入口,请自行添加到链接或者底部等你认为合适的地方!前往申请收录
@@ -348,7 +356,7 @@ table.on('toolbar(apply_list)', function(obj){ var data = checkStatus.data; switch(obj.event){ case 'conf': - if(document.body.clientWidth < 768){area = ['100%' , '100%'];}else{area = ['768px' , '500px'];} + if(document.body.clientWidth < 768){area = ['100%' , '100%'];}else{area = ['768px' , '520px'];} layer.open({ type: 1, scrollbar: false, diff --git a/templates/admin/page/expand/apply-user.php b/templates/admin/page/expand/apply-user.php index c00984b..3936e3f 100644 --- a/templates/admin/page/expand/apply-user.php +++ b/templates/admin/page/expand/apply-user.php @@ -15,6 +15,7 @@ body{background-color:rgba(0, 0, 51, 0.8);} .title{max-width: 400px;height: auto;margin-left: auto;margin-right: auto;margin-top:5em;} .title h1{color:#FFFFFF;text-align: center;} + .required {color: red;margin-left: 5px;float: right;} @@ -29,32 +30,21 @@
-
- -
- -
+
+ +
+
-
- -
- -
+
+
+ +
+
+
+
- -
- -
-
-
- -
- -
-
-
- +
+
+ +
+ +
+
+
+ +
+ +
+
- +
diff --git a/templates/admin/page/link_list.php b/templates/admin/page/link_list.php index e6994fa..04a27dd 100644 --- a/templates/admin/page/link_list.php +++ b/templates/admin/page/link_list.php @@ -48,7 +48,7 @@ -
+
diff --git a/templates/admin/page/updatelog.php b/templates/admin/page/updatelog.php index 9f7b19f..9f0c0be 100644 --- a/templates/admin/page/updatelog.php +++ b/templates/admin/page/updatelog.php @@ -2,6 +2,22 @@
+
  • + +
    +

    v2.0.28-20230624

    +
      +
    • [优化] 收录管理允许用户自行设置必填项
    • +
    • [优化] 可添加的链接类型新增wsa和vmrc
    • +
    • [优化] 站点设置中热门网址和最新网址由下拉选项改为直接输入,范围:0-100
    • +
    • [修复] 分类列表无法查看加密分类的bug
    • +
    • [模板] 主页模板 WebStack-Hugo, 修复开启拖拽排序造成悬停提示失效的bug,禁止拖拽查看全部
    • +
    • [模板] 过度模板可能无法设置的bug
    • +
    • [新增] 链接列表添加图标显示 (仅显示自定义图标,未定义时显示ie图标)
    • +
    • [优化] 链接列表排序由前端当前页排序改为后端全局排序
    • +
    +
    +