Browse Source

20220424

pull/61/head
xiaoz 3 years ago
parent
commit
1ed42f8bad
  1. 7
      class/Api.php
  2. 7
      data/update.log
  3. 2
      templates/admin/add_category.php
  4. 2
      templates/admin/add_link.php
  5. 2
      templates/admin/add_link_tpl.php
  6. 2
      templates/admin/add_quick_tpl.php
  7. 2
      templates/admin/category_list.php
  8. 2
      templates/admin/edit_category.php
  9. 2
      templates/admin/edit_link.php
  10. 2
      templates/admin/imp_link.php
  11. 2
      templates/admin/index.php
  12. 2
      templates/admin/link_list.php
  13. 2
      templates/admin/setting/api.php
  14. 2
      templates/admin/setting/site.php
  15. 2
      templates/admin/setting/theme.php
  16. 2
      templates/admin/setting/transition_page.php
  17. 4
      templates/admin/static/style.css
  18. 23
      templates/default/index.php
  19. 30
      templates/default/static/embed.js
  20. 8
      templates/default/static/style.css

7
class/Api.php

@ -54,6 +54,7 @@ class Api {
*/ */
public function edit_category($token,$id,$name,$property = 0,$weight = 0,$description = '',$font_icon = '',$fid = 0){ public function edit_category($token,$id,$name,$property = 0,$weight = 0,$description = '',$font_icon = '',$fid = 0){
$this->auth($token); $this->auth($token);
$fid = intval($fid);
//如果id为空 //如果id为空
if( empty($id) ){ if( empty($id) ){
$this->err_msg(-1003,'The category ID cannot be empty!'); $this->err_msg(-1003,'The category ID cannot be empty!');
@ -69,7 +70,8 @@ class Api {
$count = $this->db->count("on_categorys", [ $count = $this->db->count("on_categorys", [
"fid" => $id "fid" => $id
]); ]);
if( $count > 0 ) { //改分类下的子分类数量大于0,并且将父级ID修改为其它分类
if( ( $count > 0 ) && ( $fid !== 0 ) ) {
$this->err_msg(-2000,'修改失败,该分类下已存在子分类!'); $this->err_msg(-2000,'修改失败,该分类下已存在子分类!');
} }
$data = [ $data = [
@ -681,6 +683,9 @@ class Api {
if( !preg_match($pattern,$url) ){ if( !preg_match($pattern,$url) ){
$this->err_msg(-1010,'只支持识别http/https协议的链接!'); $this->err_msg(-1010,'只支持识别http/https协议的链接!');
} }
else if( !filter_var($url, FILTER_VALIDATE_URL) ) {
$this->err_msg(-2000,'只支持识别http/https协议的链接!');
}
//获取网站标题 //获取网站标题
$c = curl_init(); $c = curl_init();
curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_URL, $url);

7
data/update.log

@ -91,4 +91,9 @@ CREATE INDEX on_options_key_IDX ON on_options ("key");
1. 新增环境检测 1. 新增环境检测
2. 新增用户初始化设置界面 2. 新增用户初始化设置界面
3. 新增版本更新检查 3. 新增版本更新检查
4. 修复未登录情况下不显示分类的BUG 4. 修复未登录情况下不显示分类的BUG
20220424
1. 默认主题新增夜间模式切换
2. 修复修改分类无法更新的BUG
3. 优化后台底部窗口遮挡问题

2
templates/admin/add_category.php

@ -3,7 +3,7 @@
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<!-- 说明提示框 --> <!-- 说明提示框 -->
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<div class="setting-msg"> <div class="setting-msg">

2
templates/admin/add_link.php

@ -3,7 +3,7 @@
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<form class="layui-form layui-form-pane"> <form class="layui-form layui-form-pane">
<div class="layui-form-item"> <div class="layui-form-item">

2
templates/admin/add_link_tpl.php

@ -17,7 +17,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">URL</label> <label class="layui-form-label">URL</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="url" id = "url" name="url" required lay-verify="required|url" placeholder="请输入有效链接" autocomplete="off" class="layui-input"> <input type="url" id = "url" name="url" required lay-verify="required" placeholder="请输入有效链接" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">

2
templates/admin/add_quick_tpl.php

@ -20,7 +20,7 @@
</div> </div>
<form class="layui-form"> <form class="layui-form">
<div class="list"> <div class="list">
<input type="text" name="url" id="url" required lay-verify="required|url" placeholder="URL" autocomplete="off"> <input type="text" name="url" id="url" required lay-verify="required" placeholder="URL" autocomplete="off">
</div> </div>
<div class="list"> <div class="list">
<input type="text" name="title" id="title" required lay-verify="required" placeholder="标题" autocomplete="off"> <input type="text" name="title" id="title" required lay-verify="required" placeholder="标题" autocomplete="off">

2
templates/admin/category_list.php

@ -3,7 +3,7 @@
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<table id="category_list" lay-filter="mycategory"></table> <table id="category_list" lay-filter="mycategory"></table>
</div> </div>

2
templates/admin/edit_category.php

@ -3,7 +3,7 @@
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<!-- 说明提示框 --> <!-- 说明提示框 -->
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<div class="setting-msg"> <div class="setting-msg">

2
templates/admin/edit_link.php

@ -3,7 +3,7 @@
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<form class="layui-form"> <form class="layui-form">
<div class="layui-form-item" style = "display:none;"> <div class="layui-form-item" style = "display:none;">

2
templates/admin/imp_link.php

@ -3,7 +3,7 @@
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<div class="layui-col-lg6 layui-col-md-offset3"> <div class="layui-col-lg6 layui-col-md-offset3">
<div class="setting-msg">仅支持 <em>.html</em> 格式导入,使用前请参考<a href="https://dwz.ovh/ij3mq" target="_blank" rel = "nofollow">帮助文档</a></div> <div class="setting-msg">仅支持 <em>.html</em> 格式导入,使用前请参考<a href="https://dwz.ovh/ij3mq" target="_blank" rel = "nofollow">帮助文档</a></div>
<!-- 上传 --> <!-- 上传 -->

2
templates/admin/index.php

@ -2,7 +2,7 @@
<?php include_once('left.php'); ?> <?php include_once('left.php'); ?>
<div class="layui-body"> <div class="layui-body place-holder">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div style="padding: 15px;"> <div style="padding: 15px;">
<div class="layui-container" style = "margin-top:2em;"> <div class="layui-container" style = "margin-top:2em;">

2
templates/admin/link_list.php

@ -3,7 +3,7 @@
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<table id="link_list" lay-filter="mylink"></table> <table id="link_list" lay-filter="mylink"></table>
<!-- 开启表格头部工具栏 --> <!-- 开启表格头部工具栏 -->

2
templates/admin/setting/api.php

@ -4,7 +4,7 @@
<?php include_once(dirname(__DIR__).'/left.php'); ?> <?php include_once(dirname(__DIR__).'/left.php'); ?>
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<!-- 说明提示框 --> <!-- 说明提示框 -->
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<div class="setting-msg"> <div class="setting-msg">

2
templates/admin/setting/site.php

@ -4,7 +4,7 @@
<?php include_once(dirname(__DIR__).'/left.php'); ?> <?php include_once(dirname(__DIR__).'/left.php'); ?>
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body" style="padding-bottom: 3em;"> <div class="layui-row content-body place-holder" style="padding-bottom: 3em;">
<!-- 说明提示框 --> <!-- 说明提示框 -->
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<div class="setting-msg"> <div class="setting-msg">

2
templates/admin/setting/theme.php

@ -3,7 +3,7 @@
<?php include_once(dirname(__DIR__).'/left.php'); ?> <?php include_once(dirname(__DIR__).'/left.php'); ?>
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<!-- 说明提示框 --> <!-- 说明提示框 -->
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<div class="setting-msg"> <div class="setting-msg">

2
templates/admin/setting/transition_page.php

@ -4,7 +4,7 @@
<?php include_once(dirname(__DIR__).'/left.php'); ?> <?php include_once(dirname(__DIR__).'/left.php'); ?>
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body"> <div class="layui-row content-body place-holder">
<!-- 说明提示框 --> <!-- 说明提示框 -->
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<div class="setting-msg"> <div class="setting-msg">

4
templates/admin/static/style.css

@ -102,4 +102,8 @@
} }
.setting-msg a{ .setting-msg a{
color:#01AAED; color:#01AAED;
}
/* 占位用 */
.place-holder{
padding-bottom: 3em;
} }

23
templates/default/index.php

@ -15,7 +15,17 @@
<script src = 'static/mdui/js/mdui.min.js'></script> <script src = 'static/mdui/js/mdui.min.js'></script>
<?php echo $site['custom_header']; ?> <?php echo $site['custom_header']; ?>
</head> </head>
<body class = "mdui-drawer-body-left mdui-appbar-with-toolbar mdui-theme-primary-indigo mdui-theme-accent-pink mdui-loaded"> <?php
// 根据cookie来设置mdui主题
$md_theme = $_COOKIE['docs-theme-layout'];
if( empty($md_theme) || ( $md_theme == "light" ) ) {
$md_theme = "";
}
else{
$md_theme = "mdui-theme-layout-dark";
}
?>
<body class = "mdui-drawer-body-left mdui-appbar-with-toolbar <?php echo $md_theme ?> mdui-theme-primary-indigo mdui-theme-accent-pink mdui-loaded">
<!--导航工具--> <!--导航工具-->
<header class = "mdui-appbar mdui-appbar-fixed"> <header class = "mdui-appbar mdui-appbar-fixed">
<div class="mdui-toolbar mdui-color-theme"> <div class="mdui-toolbar mdui-color-theme">
@ -38,6 +48,7 @@
<div class="mdui-textfield mdui-textfield-floating-label"> <div class="mdui-textfield mdui-textfield-floating-label">
<!-- <label class="mdui-textfield-label">输入书签关键词进行搜索</label> --> <!-- <label class="mdui-textfield-label">输入书签关键词进行搜索</label> -->
<input class="mdui-textfield-input search" style = "color:#FFFFFF;" placeholder="输入书签关键词进行搜索" type="text" /> <input class="mdui-textfield-input search" style = "color:#FFFFFF;" placeholder="输入书签关键词进行搜索" type="text" />
<i class="mdui-icon material-icons" style = "position:absolute;right:2px;">search</i>
</div> </div>
</div> </div>
<!-- 新版搜索框END --> <!-- 新版搜索框END -->
@ -121,6 +132,9 @@
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
<!-- 华丽的分割线 -->
<div class="mdui-divider"></div>
<!-- 华丽的分割线END -->
<a href="https://www.xiaoz.me/" target="_blank" title="小z博客"> <a href="https://www.xiaoz.me/" target="_blank" title="小z博客">
<li class="mdui-list-item mdui-ripple"> <li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content category-name"><i class="fa fa-user-circle"></i> About</div> <div class="mdui-list-item-content category-name"><i class="fa fa-user-circle"></i> About</div>
@ -142,6 +156,13 @@
</li> </li>
</a> </a>
<?php } ?> <?php } ?>
<!-- 切换主题 -->
<a href="javascript:;" onclick = "change_theme()" title="点击可切换主题风格">
<li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content category-name"><i class="fa fa-adjust"></i> 切换风格</div>
</li>
</a>
<!-- 切换主题END -->
</ul> </ul>
</div> </div>
<!--左侧抽屉导航END--> <!--左侧抽屉导航END-->

30
templates/default/static/embed.js

@ -249,4 +249,32 @@ function on_search(){
//链接跳转 //链接跳转
function goto(url) { function goto(url) {
window.location.href = url; window.location.href = url;
} }
function getCookie(cname)
{
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++)
{
var c = ca[i].trim();
if (c.indexOf(name)==0) return c.substring(name.length,c.length);
}
return "";
}
//切换mdui的主题
function change_theme() {
var d = new Date();
d.setTime(d.getTime()+(30*24*60*60*1000));
var expires = "expires="+d.toGMTString();
if( ( getCookie("docs-theme-layout") == "" ) || ( getCookie("docs-theme-layout") == "light" ) ) {
var docs_theme_layout = "dark";
}
else{
var docs_theme_layout = "light";
}
document.cookie = "docs-theme-layout=" + docs_theme_layout + "; " + expires + " path=/";
window.location.href = "/";
}

8
templates/default/static/style.css

@ -11,7 +11,7 @@ body{
} }
.link-line { .link-line {
font-size: 16px; font-size: 16px;
border-bottom: 1px solid #dddddd; /* border-bottom: 1px solid #dddddd; */
height:120px; height:120px;
position:relative; position:relative;
overflow: hidden; overflow: hidden;
@ -47,6 +47,7 @@ body{
} }
.link-space{ .link-space{
margin-top:16px; margin-top:16px;
z-index:999;
} }
.link-title{ .link-title{
/*color:rgb(0,0,0);*/ /*color:rgb(0,0,0);*/
@ -156,6 +157,7 @@ footer a{
padding-right:5px; padding-right:5px;
} }
#drawer{ #drawer{
background-color: #FEFEFE; /* background-color: #FEFEFE; */
box-shadow:1px 0 5px 0 #eeeeee; /* box-shadow:1px 0 5px 0 #eeeeee; */
border-right: 0.5px solid rgba(0, 0, 0, 0.12);
} }
Loading…
Cancel
Save