mirror of
https://github.com/tznb1/TwoNav.git
synced 2025-08-10 08:51:49 +00:00
v2.0.10-20230413
This commit is contained in:
@@ -846,6 +846,9 @@ function write_site_setting(){
|
||||
'link_model'=>['v'=>['direct','Privacy','Privacy_js','Privacy_meta','301','302','Transition'],'msg'=>'链接模式参数错误'],
|
||||
'link_icon'=>['int'=>true,'min'=>0,'max'=>6,'msg'=>'链接图标参数错误'],
|
||||
'site_icon'=>['empty'=>true],
|
||||
'top_link'=>['int'=>true,'min'=>0,'max'=>20,'msg'=>'热门链接参数错误'],
|
||||
'new_link'=>['int'=>true,'min'=>0,'max'=>20,'msg'=>'最新链接参数错误'],
|
||||
'max_link'=>['int'=>true,'min'=>0,'max'=>100,'msg'=>'输出上限参数错误'],
|
||||
'custom_header'=>['empty'=>true],
|
||||
'custom_footer'=>['empty'=>true]
|
||||
];
|
||||
@@ -865,6 +868,7 @@ function write_site_setting(){
|
||||
//留空时尝试删除图标
|
||||
if(empty($s_site['site_icon']) && !empty($site['site_icon_file']) && is_file($site['site_icon_file'])){
|
||||
@unlink($site['site_icon_file']);
|
||||
$s_site['site_icon_file'] = '';
|
||||
}
|
||||
update_db("user_config",["v"=>$s_site],["k"=>'s_site',"uid"=>UID],[1,'保存成功']);
|
||||
}
|
||||
|
||||
@@ -422,6 +422,9 @@ function write_regcode(){
|
||||
}elseif($_GET['type'] == 'set'){
|
||||
write_global_config('reg_tips',$_POST['content'],'注册提示');
|
||||
msg(1,'保存成功');
|
||||
}elseif($_GET['type'] == 'del'){
|
||||
delete_db("regcode_list",[ "id" => json_decode($_POST['id'])]);
|
||||
msg(1,'删除成功');
|
||||
}
|
||||
|
||||
msg(-1,'无效的请求类型');
|
||||
|
||||
@@ -50,7 +50,7 @@ $theme_config_db = unserialize($theme_config_db);
|
||||
$theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_config,$theme_config_db);
|
||||
//主题版本(调试时追加时间戳)
|
||||
$theme_ver = !Debug?$theme_info['version']:$theme_info['version'].'.'.time();
|
||||
|
||||
$site['ex_theme'] = in_array($theme,['snail-nav','heimdall']); //例外主题,不支持热门网址/最新网址/输出上限
|
||||
//分类查找条件
|
||||
$categorys = []; //声明一个空数组
|
||||
$content = ['cid(id)','name','property','font_icon','icon','description'];//需要的内容
|
||||
@@ -92,7 +92,7 @@ function get_category_sub($id) {
|
||||
|
||||
//根据分类id查找链接
|
||||
function get_links($fid) {
|
||||
global $site,$fid_s,$share,$data;
|
||||
global $site,$fid_s,$share,$data,$u;
|
||||
$where = [];
|
||||
$where = ["uid"=> UID];
|
||||
$where['fid'] = intval($fid);
|
||||
@@ -111,8 +111,24 @@ function get_links($fid) {
|
||||
$where['lid'] = $data;
|
||||
unset($where['fid']);
|
||||
}
|
||||
|
||||
if($fid == 'top_link'){
|
||||
unset($where['fid']);
|
||||
unset($where['ORDER']);
|
||||
$where['ORDER']['click'] = 'DESC';
|
||||
$where['ORDER']['lid'] = 'DESC';
|
||||
$where['LIMIT'] = $site['top_link'];
|
||||
}elseif($fid == 'new_link'){
|
||||
unset($where['fid']);
|
||||
unset($where['ORDER']);
|
||||
$where['ORDER']['add_time'] = 'DESC';
|
||||
$where['ORDER']['lid'] = 'DESC';
|
||||
$where['LIMIT'] = $site['new_link'];
|
||||
}elseif($site['max_link'] > 0 && empty(Get('oc')) && !$site['ex_theme']){
|
||||
$count = count_db('user_links',$where);
|
||||
$where['LIMIT'] = $site['max_link'];
|
||||
}
|
||||
$links = select_db('user_links',['lid(id)','fid','property','title','url(real_url)','url_standby','description','icon','click','pid'],$where);
|
||||
//var_dump($fid_s);exit;
|
||||
foreach ($links as $key => $link) {
|
||||
$click = false; $lock = false;
|
||||
|
||||
@@ -147,6 +163,11 @@ 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']){
|
||||
$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']);
|
||||
}
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
@@ -204,6 +225,27 @@ if($category_parent == []){
|
||||
$categorys = array_merge ($categorys,$category_subitem);
|
||||
}
|
||||
}
|
||||
|
||||
if(empty(Get('oc'))){
|
||||
//热门链接
|
||||
if($site['top_link'] > 0 && !$site['ex_theme']){
|
||||
$top_link = ['name' => "热门网址","font_icon" =>"fa fa-bookmark-o" , "id" => 'top_link' ,"description" => ""];
|
||||
array_unshift($category_parent,$top_link);
|
||||
array_unshift($categorys,$top_link);
|
||||
}
|
||||
//最新链接
|
||||
if($site['new_link'] > 0 && !$site['ex_theme']){
|
||||
$new_link = ['name' => "最新网址","font_icon" =>"fa fa-bookmark-o" , "id" => 'new_link' ,"description" => ""];
|
||||
array_unshift($category_parent,$new_link);
|
||||
array_unshift($categorys,$new_link);
|
||||
}
|
||||
}elseif(!$site['ex_theme']){
|
||||
unset($where['fid']);
|
||||
$where['cid'] = Get('oc');
|
||||
$categorys = select_db('user_categorys',$content,$where);
|
||||
$category_parent = $categorys;
|
||||
}
|
||||
|
||||
//访问统计
|
||||
write_user_count(date('Ym'),'index_Ym');
|
||||
write_user_count(date('Ymd'),'index_Ymd');
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.0.09-20230410
|
||||
v2.0.10-20230413
|
||||
@@ -67,6 +67,42 @@
|
||||
<div class="layui-form-mid layui-word-aux">所有API接口均由其他大佬提供!若有异常请尝试更换接口!</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">热门网址</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="top_link">
|
||||
<option value="0" selected>不显示</option>
|
||||
<option value="5" >显示5条</option>
|
||||
<option value="10" >显示10条</option>
|
||||
<option value="15" >显示15条</option>
|
||||
<option value="20" >显示20条</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">在主页显示热门网址(点击排行)</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">最新网址</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="new_link">
|
||||
<option value="0" selected>不显示</option>
|
||||
<option value="5" >显示5条</option>
|
||||
<option value="10" >显示10条</option>
|
||||
<option value="15" >显示15条</option>
|
||||
<option value="20" >显示20条</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">在主页显示最新的网址(创建时间)</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">输出上限</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="max_link" class="layui-input" value="0" placeholder="输入范围: 0-100" lay-verify="required">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">限制每个分类下显示多少链接,0表示不限制</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">站点图标</label>
|
||||
<div class="layui-input-block">
|
||||
@@ -97,14 +133,18 @@
|
||||
<?php } ?>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn layui-btn-primary layui-border-black" id="help" sort_id="7968924">帮助</button>
|
||||
<?php if($global_config['Default_User'] != U ){ ?>
|
||||
<button class="layui-btn layui-btn-primary layui-border-black" id="sdhp" data=>设为默认主页</button>
|
||||
<?php } ?>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src = "<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src = "./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
|
||||
<script src="<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src="<?php echo $libs;?>/jquery/jQueryCookie.js"></script>
|
||||
<script src="./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
|
||||
<?php load_static('js.layui');?>
|
||||
<script>
|
||||
layui.use(['jquery','form','upload'], function () {
|
||||
@@ -136,6 +176,18 @@ layui.use(['jquery','form','upload'], function () {
|
||||
layer.msg("权限不足", {icon: 2});
|
||||
});
|
||||
|
||||
$("#sdhp").text( getCookie("Default_User") == u ? '取消默认主页' : '设为默认主页')
|
||||
$('#sdhp').click(function () {
|
||||
if(getCookie("Default_User") == u){
|
||||
$.removeCookie("Default_User");
|
||||
$("#sdhp").text('设为默认主页')
|
||||
}else{
|
||||
$.cookie("Default_User",u);
|
||||
$("#sdhp").text('取消默认主页')
|
||||
}
|
||||
layer.msg("设置成功", {icon: 1});
|
||||
return false;
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(save)', function (data) {
|
||||
$.post('./index.php?c=api&method=write_site_setting&u='+u,data.field,function(data,status){
|
||||
|
||||
@@ -250,11 +250,12 @@ require 'header.php';
|
||||
<?php }?>
|
||||
<tr>
|
||||
<td>用户交流</td>
|
||||
<td>QQ群:695720839</td>
|
||||
<td><a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=LaIzFK2hfTYBZGR0cKvW3xZL6aNgcSXH&jump_from=webapi&authKey=LHh1NtAiGdK0wNyoZiHWrzAZTWWq26YgAwX0Ak7rBWchh6Y5ocUX/0cCXLMXvq/k" title="TwoNav - 技术交流">QQ群:695720839</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>技术支持</td>
|
||||
<td>QQ:271152681</td>
|
||||
<td><a target="_blank" href="tencent://message/?uin=271152681">QQ:271152681</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>专属地址</td>
|
||||
|
||||
@@ -16,6 +16,7 @@ $user_groups = select_db('user_group',['id','code','name'],'');
|
||||
<script type="text/html" id="toolbar">
|
||||
<div class="layui-btn-group" >
|
||||
<button class="layui-btn layui-btn-sm" lay-event="generate">生成注册码</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="refresh">刷新</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="set">设置</button>
|
||||
</div>
|
||||
@@ -81,7 +82,8 @@ layui.use(['table','layer','form'], function(){
|
||||
|
||||
|
||||
var cols=[[ //表头
|
||||
{field:'id',title:'id',width:80,sort:true}
|
||||
{type:'checkbox'}
|
||||
,{field:'id',title:'id',width:80,sort:true}
|
||||
,{field:'regcode',title:'注册码',width:120,sort:true}
|
||||
,{field:'UserGroupName',title:'用户组',width:120,sort:true}
|
||||
,{field:'url',title:'注册链接',minWidth:400,sort:true,templet:function(d){
|
||||
@@ -152,6 +154,25 @@ layui.use(['table','layer','form'], function(){
|
||||
content: $('.Set')
|
||||
});
|
||||
break;
|
||||
case 'del':
|
||||
if( checkStatus.data.length == 0 && ['LAYTABLE_COLS','LAYTABLE_EXPORT','LAYTABLE_PRINT'].indexOf(obj.event) == -1 ) {
|
||||
layer.msg('未选中任何数据!');
|
||||
return;
|
||||
}
|
||||
layer.confirm('确认删除?',{icon: 3, title:'温馨提示'}, function(index){
|
||||
tableIds = checkStatus.data.map(function (value) {return value.id;});
|
||||
tableIds = JSON.stringify(tableIds);
|
||||
$.post(get_api('write_regcode','del') ,{"id":tableIds},function(data,status){
|
||||
if(data.code == 1){
|
||||
table.reload('table');
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
};
|
||||
});
|
||||
//自定义表单验证
|
||||
|
||||
@@ -2,6 +2,18 @@
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main" style=" margin-left: 20px;">
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h4 class="layui-timeline-title">v2.0.10-20230413</h4>
|
||||
<ul>
|
||||
<li>支持删除注册管理生成的注册码</li>
|
||||
<li>站点设置增加设为默认用户按钮(储存在浏览器Cookie,不影响其他用户)</li>
|
||||
<li>站点设置增加热门链接/最新链接/输出上限</li>
|
||||
<li>主页支持传参来浏览指定分类(配合站点设置>输出上限使用)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
|
||||
Reference in New Issue
Block a user