Browse Source

Merge pull request #145 from helloxz/dev

0.9.30
main 0.9.30
xiaoz 2 years ago committed by GitHub
parent
commit
0ee87acb2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      README.md
  2. 48
      class/Api.php
  3. 2
      controller/admin.php
  4. 8
      controller/api.php
  5. 56
      controller/index.php
  6. 17
      data/update.log
  7. 13
      functions/helper.php
  8. 1
      static/layui-2.6.8/css/layui.css
  9. 0
      static/layui-2.6.8/css/modules/code.css
  10. 0
      static/layui-2.6.8/css/modules/laydate/default/laydate.css
  11. 0
      static/layui-2.6.8/css/modules/layer/default/icon-ext.png
  12. 0
      static/layui-2.6.8/css/modules/layer/default/icon.png
  13. 0
      static/layui-2.6.8/css/modules/layer/default/layer.css
  14. 0
      static/layui-2.6.8/css/modules/layer/default/loading-0.gif
  15. 0
      static/layui-2.6.8/css/modules/layer/default/loading-1.gif
  16. 0
      static/layui-2.6.8/css/modules/layer/default/loading-2.gif
  17. BIN
      static/layui-2.6.8/font/iconfont.eot
  18. 554
      static/layui-2.6.8/font/iconfont.svg
  19. BIN
      static/layui-2.6.8/font/iconfont.ttf
  20. BIN
      static/layui-2.6.8/font/iconfont.woff
  21. BIN
      static/layui-2.6.8/font/iconfont.woff2
  22. 5
      static/layui-2.6.8/layui.js
  23. 2
      static/layui/css/layui.css
  24. BIN
      static/layui/font/iconfont.eot
  25. 529
      static/layui/font/iconfont.svg
  26. BIN
      static/layui/font/iconfont.ttf
  27. BIN
      static/layui/font/iconfont.woff
  28. BIN
      static/layui/font/iconfont.woff2
  29. 6
      static/layui/layui.js
  30. 140
      templates/admin/edit_category_new.php
  31. 2
      templates/admin/footer.php
  32. 5
      templates/admin/header.php
  33. 10
      templates/admin/index.php
  34. 52
      templates/admin/link_list.php
  35. 17
      templates/admin/s_header.php
  36. 3
      templates/admin/setting/share.php
  37. 8
      templates/admin/setting/site.php
  38. 4
      templates/admin/setting/subscribe.php
  39. 48
      templates/admin/static/embed.js
  40. 14
      templates/default/index.php
  41. 6
      templates/default/info.json
  42. 5
      templates/default/static/style.css
  43. 2
      version.txt

11
README.md

@ -49,11 +49,11 @@ OneNav是一款开源免费的书签(导航)管理程序,使用使用PHP +
```bash ```bash
docker run -itd --name="onenav" -p 80:80 \ docker run -itd --name="onenav" -p 80:80 \
-v /data/onenav:/data/wwwroot/default/data \ -v /data/onenav:/data/wwwroot/default/data \
helloz/onenav:0.9.25 helloz/onenav:0.9.30
``` ```
* 第一个`80`是自定义访问端口,可以自行修改,第二个`80`是容器端口,请勿修改 * 第一个`80`是自定义访问端口,可以自行修改,第二个`80`是容器端口,请勿修改
* `/data/onenav`:本机挂载目录,用于持久存储Onenav数据 * `/data/onenav`:本机挂载目录,用于持久存储Onenav数据
* `0.9.25`:改成OneNav最新版本号,可以通过[releases](https://github.com/helloxz/onenav/releases)查看最新版本号 * `0.9.30`:改成OneNav最新版本号,可以通过[releases](https://github.com/helloxz/onenav/releases)查看最新版本号
> 更多说明,请参考帮助文档:https://dwz.ovh/onenav > 更多说明,请参考帮助文档:https://dwz.ovh/onenav
@ -71,12 +71,9 @@ ___
* 纽及书签:[http://www.1006788.com/](http://www.1006788.com/) * 纽及书签:[http://www.1006788.com/](http://www.1006788.com/)
* DiscoveryNav:[https://nav.miooku.com/](https://nav.miooku.com/) * DiscoveryNav:[https://nav.miooku.com/](https://nav.miooku.com/)
## 联系我 ## OneNav交流群
* Blog:https://www.xiaoz.me/ * [https://dwz.ovh/qxsul](https://dwz.ovh/qxsul)
* QQ:446199062
* QQ群:932795364
* 社区支持:[https://dwz.ovh/vd0bw](https://dwz.ovh/vd0bw)
## 鸣谢 ## 鸣谢

48
class/Api.php

@ -705,6 +705,54 @@ class Api {
} }
} }
/**
* name:单行链接修改
*/
public function edit_link_row(){
//验证授权
$this->auth($token);
// 获取POST请求中的JSON数据
$json_data = file_get_contents('php://input');
// 解析JSON数据为PHP对象
$obj = json_decode($json_data);
$id = intval($obj->id);
$fid = intval($obj->fid);
//查询ID是否存在
$count = $this->db->count('on_links',[ 'id' => $id]);
//如果id不存在
if( (empty($id)) || ($count == false) ) {
$this->err_msg(-1012,'link id not exists!');
}
// 拼接需要更新的数据
$data = [
'title' => trim($obj->title),
'weight' => intval($obj->weight)
];
//插入数据库
$re = $this->db->update('on_links',$data,[ 'id' => $id]);
//返回影响行数
$row = $re->rowCount();
//如果为真
if( $row ){
$id = $this->db->id();
$data = [
'code' => 0,
'msg' => 'successful'
];
exit(json_encode($data));
}
//如果插入失败
else{
$this->err_msg(-1011,'The URL already exists!');
}
}
/** /**
* 删除链接 * 删除链接
*/ */

2
controller/admin.php

@ -30,7 +30,7 @@ if( $page == 'index' ) {
} }
//如果页面是修改edit_category //如果页面是修改edit_category
if ( $page == 'edit_category' ) { if ( ($page == 'edit_category') || ($page == 'edit_category_new') ) {
//获取id //获取id
$id = intval($_GET['id']); $id = intval($_GET['id']);
//查询单条分类信息 //查询单条分类信息

8
controller/api.php

@ -314,6 +314,8 @@ function set_site($api) {
$data['custom_footer'] = $_POST['custom_footer']; $data['custom_footer'] = $_POST['custom_footer'];
//获取链接模式 //获取链接模式
$data['link_model'] = $_POST['link_model']; $data['link_model'] = $_POST['link_model'];
// 获取链接数量
$data['link_num'] = $_POST['link_num'];
//序列化存储 //序列化存储
$value = serialize($data); $value = serialize($data);
@ -640,3 +642,9 @@ function del_link_icon() {
global $api; global $api;
$api->del_link_icon(); $api->del_link_icon();
} }
// 修改单行链接
function edit_link_row(){
global $api;
$api->edit_link_row();
}

56
controller/index.php

@ -2,6 +2,13 @@
/** /**
* 首页模板入口 * 首页模板入口
*/ */
//获取当前站点信息
$site = $db->get('on_options','value',[ 'key' => "s_site" ]);
$site = unserialize($site);
// 获取链接数量
$link_num = empty( $site['link_num'] ) ? 20 : intval($site['link_num']);
//如果已经登录,获取所有分类和链接 //如果已经登录,获取所有分类和链接
// 载入辅助函数 // 载入辅助函数
require('functions/helper.php'); require('functions/helper.php');
@ -50,6 +57,20 @@ if( is_login() ){
]); ]);
return $links; return $links;
} }
//根据category id查询有限链接
function get_limit_links($fid) {
global $db;
global $link_num;
$fid = intval($fid);
$links = $db->select('on_links','*',[
'fid' => $fid,
'ORDER' => ["weight" => "DESC"],
'LIMIT' => $link_num
]);
return $links;
}
//右键菜单标识 //右键菜单标识
$onenav['right_menu'] = 'admin_menu();'; $onenav['right_menu'] = 'admin_menu();';
} }
@ -94,6 +115,7 @@ else{
//根据category id查询链接 //根据category id查询链接
function get_links($fid) { function get_links($fid) {
global $db; global $db;
global $link_num;
$fid = intval($fid); $fid = intval($fid);
$links = $db->select('on_links','*',[ $links = $db->select('on_links','*',[
'fid' => $fid, 'fid' => $fid,
@ -102,10 +124,40 @@ else{
]); ]);
return $links; return $links;
} }
//根据category id查询有限链接
function get_limit_links($fid) {
global $db;
$fid = intval($fid);
$links = $db->select('on_links','*',[
'fid' => $fid,
'property' => 0,
'ORDER' => ["weight" => "DESC"],
'LIMIT' => $link_num
]);
return $links;
}
//右键菜单标识 //右键菜单标识
$onenav['right_menu'] = 'user_menu();'; $onenav['right_menu'] = 'user_menu();';
} }
// 新增一个可变函数,来根据不同的情况使用不同的方法查询分类下的链接
$get_links = 'get_limit_links';
//获取分类ID
$cid = @$_GET['cid'];
// 如果存在分类ID,则只查询这个分类
if ( !empty($cid) ) {
foreach ($categorys as $key => $tmp) {
if( $tmp['id'] == $cid ) {
$empty_cat[0] = $tmp;
break;
}
}
$get_links = 'get_links';
unset($categorys);
$categorys[0] = $empty_cat[0];
}
//获取版本号 //获取版本号
function get_version(){ function get_version(){
if( file_exists('version.txt') ) { if( file_exists('version.txt') ) {
@ -166,9 +218,7 @@ if( !empty($theme) ) {
exit("<h1>主题参数错误!</h1>"); exit("<h1>主题参数错误!</h1>");
} }
} }
//获取当前站点信息
$site = $db->get('on_options','value',[ 'key' => "s_site" ]);
$site = unserialize($site);
//获取主题配置信息 //获取主题配置信息
if( file_exists("templates/".$template."/config.json") ) { if( file_exists("templates/".$template."/config.json") ) {

17
data/update.log

@ -188,3 +188,20 @@ CREATE INDEX on_options_key_IDX ON on_options ("key");
3. 修复通过分类筛选链接自定义图标不显示问题 3. 修复通过分类筛选链接自定义图标不显示问题
4. 修复未登录情况下,API不显示链接列表的BUG 4. 修复未登录情况下,API不显示链接列表的BUG
5. heimdall主题新增页脚部分 5. heimdall主题新增页脚部分
20230425
1. 链接ico图标由favicon.rss.ink 替换为 favicon.png.pub
2. 新增baisuNew主题
3. 升级LayUI到 2.8.x(BUG待进一步测试)
20230506
1. 链接列表可以快速修改标题和权重
2. 订阅成功后刷新当前订阅页面
3. 编辑分类改为当前页iframe方式
4. default/baisuNew/baisuTwo/5iux/webstack主题完成 0.9.30 适配改造,优化了链接显示数量
5. 订阅页面检测域名方式优化,去除了带端口号的情况
20230507
1. 修复平板电脑登录时循环重定向的BUG
2. 优化了后台页面,去除了顶部重复按钮,添加了加群按钮
3. 后台左侧导航栏,点击后高亮显示

13
functions/helper.php

@ -105,7 +105,7 @@ function jump_mobile() {
$ua = $_SERVER['HTTP_USER_AGENT']; $ua = $_SERVER['HTTP_USER_AGENT'];
if( stristr($ua,'iphone') || stristr($ua,'android') ) { if( stristr($ua,'iphone') || stristr($ua,'android') ) {
header("Location: /index.php?c=admin"); header("Location: /index.php?c=mobile#/");
exit; exit;
} }
} }
@ -175,3 +175,14 @@ function get_all_themes() {
$tpls = array_unique($tpls); $tpls = array_unique($tpls);
return $tpls; return $tpls;
} }
// 获取HOST,需要去除端口号
function get_host(){
$host = $_SERVER['HTTP_HOST'];
$parsed_host = parse_url($host);
//var_dump($parsed_host);
if (isset($parsed_host['port']) && $parsed_host['port'] != 80 && $parsed_host['port'] != 443) {
$host = $parsed_host['host'];
}
return $host;
}

1
static/layui-2.6.8/css/layui.css

File diff suppressed because one or more lines are too long

0
static/layui/css/modules/code.css → static/layui-2.6.8/css/modules/code.css

0
static/layui/css/modules/laydate/default/laydate.css → static/layui-2.6.8/css/modules/laydate/default/laydate.css

0
static/layui/css/modules/layer/default/icon-ext.png → static/layui-2.6.8/css/modules/layer/default/icon-ext.png

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

0
static/layui/css/modules/layer/default/icon.png → static/layui-2.6.8/css/modules/layer/default/icon.png

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
static/layui/css/modules/layer/default/layer.css → static/layui-2.6.8/css/modules/layer/default/layer.css

0
static/layui/css/modules/layer/default/loading-0.gif → static/layui-2.6.8/css/modules/layer/default/loading-0.gif

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

0
static/layui/css/modules/layer/default/loading-1.gif → static/layui-2.6.8/css/modules/layer/default/loading-1.gif

Before

Width:  |  Height:  |  Size: 701 B

After

Width:  |  Height:  |  Size: 701 B

0
static/layui/css/modules/layer/default/loading-2.gif → static/layui-2.6.8/css/modules/layer/default/loading-2.gif

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/layui-2.6.8/font/iconfont.eot

Binary file not shown.

554
static/layui-2.6.8/font/iconfont.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 299 KiB

BIN
static/layui-2.6.8/font/iconfont.ttf

Binary file not shown.

BIN
static/layui-2.6.8/font/iconfont.woff

Binary file not shown.

BIN
static/layui-2.6.8/font/iconfont.woff2

Binary file not shown.

5
static/layui-2.6.8/layui.js vendored

File diff suppressed because one or more lines are too long

2
static/layui/css/layui.css

File diff suppressed because one or more lines are too long

BIN
static/layui/font/iconfont.eot

Binary file not shown.

529
static/layui/font/iconfont.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 299 KiB

After

Width:  |  Height:  |  Size: 321 KiB

BIN
static/layui/font/iconfont.ttf

Binary file not shown.

BIN
static/layui/font/iconfont.woff

Binary file not shown.

BIN
static/layui/font/iconfont.woff2

Binary file not shown.

6
static/layui/layui.js vendored

File diff suppressed because one or more lines are too long

140
templates/admin/edit_category_new.php

@ -0,0 +1,140 @@
<?php include_once('s_header.php'); ?>
<div class="layui-container">
<!-- 内容主体区域 -->
<div class="layui-row">
<!-- 说明提示框 -->
<div class="layui-col-lg12">
<div class="setting-msg" style = "margin-top:2em;">
<p>1. 关于字体图标的说明请参考帮助文档:<a href="https://dwz.ovh/7nr1f" target = "_blank" title = "字体图标使用说明">https://dwz.ovh/7nr1f</a></p>
<p>2. 权重越大,排序越靠前</p>
</div>
</div>
<!-- 说明提示框END -->
<div class="layui-col-lg12">
<form class="layui-form layui-form-pane">
<div class="layui-form-item" style = "display:none;">
<label class="layui-form-label">分类ID</label>
<div class="layui-input-block">
<input type="text" name="id" required lay-verify="required" value = '<?php echo $id; ?>' placeholder="请输入分类名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">分类名称</label>
<div class="layui-input-block">
<input type="text" name="name" required lay-verify="required" value = '<?php echo $category_one['name']; ?>' placeholder="请输入分类名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">父级分类</label>
<div class="layui-input-block">
<select name="fid" lay-verify="">
<!-- 显示上级分类,如果没有,则显示空 -->
<?php if( empty( $category_one['fname'] ) ){
?>
<!-- 如果上级分类名称为空 -->
<option value="0"></option>
<?php }else{ ?>
<option value="<?php echo $category_one['fid']; ?>"><?php echo $category_one['fname']; ?></option>
<option value="0"></option>
<?php } ?>
<!-- 显示上级分类END -->
<!-- 遍历所有分类,但不显示对应的父级 -->
<?php foreach ($categorys as $key => $category) {
if ( $category['id'] == $category_one['fid'] ) {
continue;
}
//如果分类ID的父级ID不能是自己
if( $category['id'] == $id ) {
continue;
}
?>
<option value="<?php echo $category['id']; ?>"><?php echo $category['name']; ?></option>
<?php } ?>
<!-- 遍历所有分类END -->
</select>
</div>
</div>
<!-- <div class="layui-form-item">
<label class="layui-form-label">字体图标</label>
<div class="layui-input-block">
<input type="text" name="font_icon" value = '<?php echo $category_one['font_icon']; ?>' placeholder="请输入字体图标,如:fa fa-bookmark-o" autocomplete="off" class="layui-input">
</div>
</div> -->
<div class="layui-form-item">
<label for="" class="layui-form-label">字体图标:</label>
<div class="layui-input-inline" style = "width:240px;">
<input name="font_icon" type="text" id="iconHhys2" value="<?php echo $category_one['font_icon']; ?>" lay-filter="iconHhys2" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
图标对照表可参考:<a rel = "nofollow" target = "_blank" href="https://fontawesome.dashgame.com/">FontAwesome4</a>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权重</label>
<div class="layui-input-block">
<input type="number" name="weight" min = "0" max = "999" value = "<?php echo $category_one['weight']; ?>" required lay-verify="required|number" placeholder="权重越高,排名越靠前,范围为0-999" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">是否私有</label>
<div class="layui-input-inline" style = "width:240px;">
<input type="checkbox" name="property" value = "1" lay-skin="switch" <?php echo $category_one['checked']; ?> lay-text="是|否">
</div>
<div class="layui-form-mid layui-word-aux">私有分类下的链接需要登录后才能查看。</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">描述(选填)</label>
<div class="layui-input-block">
<textarea name="description" placeholder="请输入内容" class="layui-textarea"><?php echo $category_one['description']; ?></textarea>
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn" lay-submit lay-filter="edit_category">更新</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
</div>
</div>
<!-- 内容主题区域END -->
</div>
<script>
//参考:https://gitee.com/luckygyl/iconFonts
layui.use(['iconHhysFa'], function(){
var iconHhysFa = layui.iconHhysFa;
iconHhysFa.render({
// 选择器,推荐使用input
elem: '#iconHhys2',
// 数据类型:fontClass/awesome,推荐使用fontClass
type: 'awesome',
// 是否开启搜索:true/false
search: true,
// fa 图标接口
url: './static/font-awesome/4.7.0/less/variables.less',
// 是否开启分页
page: true,
// 每页显示数量,默认12
limit: 30,
// 点击回调
value:'<?php echo str_replace("fa ","",$category_one["font_icon"]); ?>', //自定义默认图标
click: function(data) {
console.log(data);
},
// 渲染成功后的回调
success: function(d) {
console.log(d);
}
});
})
</script>

2
templates/admin/footer.php

@ -1,6 +1,6 @@
<div class="layui-footer"> <div class="layui-footer">
<!-- 底部固定区域 --> <!-- 底部固定区域 -->
© Copyright 2022.Powered by <a href="https://github.com/helloxz/onenav" rel = "nofollow" target="_blank">OneNav</a>. © Copyright 2023.Powered by <a href="https://www.onenav.top/" rel = "nofollow" target="_blank">OneNav</a>.
</div> </div>
</div> </div>
</body> </body>

5
templates/admin/header.php

@ -22,10 +22,11 @@
<!-- 头部区域(可配合layui已有的水平导航) --> <!-- 头部区域(可配合layui已有的水平导航) -->
<ul class="layui-nav layui-layout-left"> <ul class="layui-nav layui-layout-left">
<li class="layui-nav-item"><a href="/"><i class="layui-icon layui-icon-home"></i> 前台首页</a></li> <li class="layui-nav-item"><a href="/"><i class="layui-icon layui-icon-home"></i> 前台首页</a></li>
<li class="layui-nav-item"><a href="/index.php?c=admin&page=category_list"><i class="layui-icon layui-icon-list"></i> 分类列表</a></li> <!-- <li class="layui-nav-item"><a href="/index.php?c=admin&page=category_list"><i class="layui-icon layui-icon-list"></i> 分类列表</a></li>
<li class="layui-nav-item"><a href="/index.php?c=admin&page=add_category"><i class="layui-icon layui-icon-add-circle-fine"></i> 添加分类</a></li> <li class="layui-nav-item"><a href="/index.php?c=admin&page=add_category"><i class="layui-icon layui-icon-add-circle-fine"></i> 添加分类</a></li>
<li class="layui-nav-item"><a href="/index.php?c=admin&page=link_list"><i class="layui-icon layui-icon-link"></i> 我的链接</a></li> <li class="layui-nav-item"><a href="/index.php?c=admin&page=link_list"><i class="layui-icon layui-icon-link"></i> 我的链接</a></li>
<li class="layui-nav-item"><a href="/index.php?c=admin&page=add_link"><i class="layui-icon layui-icon-add-circle-fine"></i> 添加链接</a></li> <li class="layui-nav-item"><a href="/index.php?c=admin&page=add_link"><i class="layui-icon layui-icon-add-circle-fine"></i> 添加链接</a></li> -->
<li class="layui-nav-item"><a title = "加入OneNav交流群" target = "_blank" href="https://dwz.ovh/qxsul"><i class="layui-icon layui-icon-group"></i> 交流群</a></li>
</ul> </ul>
<ul class="layui-nav layui-layout-right"> <ul class="layui-nav layui-layout-right">

10
templates/admin/index.php

@ -19,10 +19,7 @@
</div> </div>
</div> </div>
<div class="layui-col-lg4"> <div class="layui-col-lg4">
<div class = "admin-msg">QQ群1:147687134</div> <div class = "admin-msg">交流群:<a target = "_blank" rel = "nofollow" href="https://dwz.ovh/qxsul" title = "点此加入OneNav交流群">https://dwz.ovh/qxsul</a></div>
</div>
<div class="layui-col-lg4">
<div class = "admin-msg">QQ群2:932795364</div>
</div> </div>
<div class="layui-col-lg4"> <div class="layui-col-lg4">
<div class = "admin-msg">社区支持:<a href="https://dwz.ovh/vd0bw" rel = "nofollow" target="_blank" title="访问下问社区">https://dwz.ovh/vd0bw</a></div> <div class = "admin-msg">社区支持:<a href="https://dwz.ovh/vd0bw" rel = "nofollow" target="_blank" title="访问下问社区">https://dwz.ovh/vd0bw</a></div>
@ -34,10 +31,7 @@
<div class = "admin-msg">帮助文档:<a href="https://dwz.ovh/onenav" rel = "nofollow" target="_blank">https://dwz.ovh/onenav</a></div> <div class = "admin-msg">帮助文档:<a href="https://dwz.ovh/onenav" rel = "nofollow" target="_blank">https://dwz.ovh/onenav</a></div>
</div> </div>
<div class="layui-col-lg4"> <div class="layui-col-lg4">
<div class = "admin-msg">QQ:446199062</div> <div class = "admin-msg">作者博客: <a href="https://www.xiaoz.me/" rel = "nofollow" target="_blank">https://www.xiaoz.me/</a></div>
</div>
<div class="layui-col-lg4">
<div class = "admin-msg">Blog: <a href="https://www.xiaoz.me/" rel = "nofollow" target="_blank">https://www.xiaoz.me/</a></div>
</div> </div>
<div class="layui-col-lg4"> <div class="layui-col-lg4">
<div class = "admin-msg">捐赠地址: <a href="https://dwz.ovh/donation" rel = "nofollow" target="_blank">https://dwz.ovh/donation</a></div> <div class = "admin-msg">捐赠地址: <a href="https://dwz.ovh/donation" rel = "nofollow" target="_blank">https://dwz.ovh/donation</a></div>

52
templates/admin/link_list.php

@ -47,10 +47,60 @@
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" onclick = "">删除</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" onclick = "">删除</a>
</script> </script>
<!-- 表单下面的按钮 --> <!-- 表单下面的按钮 -->
<button class="layui-btn layui-btn-sm" lay-submit onclick = "export_link()">导出所有链接</button> <button style="margin-top:16px;" class="layui-btn layui-btn-sm" lay-submit onclick = "export_link()">导出所有链接</button>
<!-- 表单下面的按钮END --> <!-- 表单下面的按钮END -->
</div> </div>
<!-- 内容主题区域END --> <!-- 内容主题区域END -->
</div> </div>
<script>
layui.use(['table'], function(){
var table = layui.table;
// 编辑单行
table.on('edit(mylink)',function(obj){
var field = obj.field; // 得到字段
var value = obj.value; // 得到修改后的值
var data = obj.data; // 得到所在行所有键值
// 获取到权重并判断是否合法
let weight = data.weight;
if( /^[-+]?\d*\.?\d+$/.test(weight) == false ) {
layer.msg("权重必须为数字!",{icon:5});
return obj.reedit();
}
// 获取到标题并判断是否合法
let title = data.title.trim();
if( title.length == 0 ) {
layer.msg("标题不能为空!",{icon:5});
return obj.reedit();
}
// 请求后端API
$.ajax({
url: '/index.php?c=api&method=edit_link_row',
type: 'POST',
data: JSON.stringify(data),
contentType: 'application/json',
dataType: 'json',
success: function(response) {
// 请求成功后执行的代码
if( response.code == 0 ) {
layer.msg("已修改!",{icon:1});
}
else{
layer.msg(response.msg,{icon:5});
}
},
error: function(xhr, status, error) {
// 请求出错时执行的代码
console.log(error);
layer.msg("修改失败!",{icon:5});
}
});
})
});
</script>
<?php include_once('footer.php'); ?> <?php include_once('footer.php'); ?>

17
templates/admin/s_header.php

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="renderer" content="webkit"/>
<meta name="force-rendering" content="webkit"/>
<title>OneNav后台管理</title>
<link rel='stylesheet' href='static/layui/css/layui.css'>
<link rel='stylesheet' href='templates/admin/static/style.css?v=<?php echo $version; ?>'>
<link rel="stylesheet" href="static/font-awesome/4.7.0/css/font-awesome.css">
<script src = 'static/js/jquery.min.js'></script>
<script src = 'static/layui/layui.js'></script>
<script src="static/js/md5.min.js"></script>
<script src = "static/js/clipBoard.min.js"></script>
<script src="templates/admin/static/embed.js?v=<?php echo $version; ?>"></script>
</head>

3
templates/admin/setting/share.php

@ -61,6 +61,7 @@
<!-- 创建分享END --> <!-- 创建分享END -->
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<div style="margin-top:18px;"></div>
<!-- 数据表格 --> <!-- 数据表格 -->
<table class="layui-hide" id="mytable" lay-filter="mytable"></table> <table class="layui-hide" id="mytable" lay-filter="mytable"></table>
<!-- 数据表格END --> <!-- 数据表格END -->
@ -77,6 +78,8 @@
</div> </div>
</script> </script>
<!-- 头部工具栏END --> <!-- 头部工具栏END -->
<div style="margin-bottom:18px;"></div>
</div> </div>
</div> </div>
</div> </div>

8
templates/admin/setting/site.php

@ -59,6 +59,14 @@
<div class="layui-form-mid layui-word-aux">开启直链模式后将直接打开目标地址,不二次跳转,仅部分主题支持!</div> <div class="layui-form-mid layui-word-aux">开启直链模式后将直接打开目标地址,不二次跳转,仅部分主题支持!</div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">链接数量</label>
<div class="layui-input-inline">
<input type="number" name="link_num" value = "<?php echo $site['link_num']; ?>" autocomplete="off" placeholder="分类需要展示的链接数量" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">指的是首页单个分类下需要展示的链接数量,默认20,值越低,性能越好</div>
</div>
<div class="layui-form-item layui-form-text"> <div class="layui-form-item layui-form-text">
<label class="layui-form-label">网站描述</label> <label class="layui-form-label">网站描述</label>
<div class="layui-input-block"> <div class="layui-input-block">

4
templates/admin/setting/subscribe.php

@ -19,9 +19,9 @@
</ol> </ol>
</div> </div>
<div class="setting-msg"> <div class="setting-msg">
<p>1. 系统检测到您的域名为<strong style="color:#31BDEC;"><code><?php echo $_SERVER['HTTP_HOST']; ?></code></strong>,购买订阅时请填写此域名!</p> <p>1. 系统检测到您的域名为<strong style="color:#31BDEC;"><code><?php echo get_host(); ?></code></strong>,购买订阅时请填写此域名!</p>
<p>2. 若域名填写错误或更换域名,请前往<a title = "修改OneNav订阅域名" href="https://www.onenav.top/msub.html" target="_blank">https://www.onenav.top/msub.html</a>修改订阅!</p> <p>2. 若域名填写错误或更换域名,请前往<a title = "修改OneNav订阅域名" href="https://www.onenav.top/msub.html" target="_blank">https://www.onenav.top/msub.html</a>修改订阅!</p>
<p>3. Docker用户或IP访问的用户,请参考<a href="https://dwz.ovh/cve3d" target="_blank">没有域名购买订阅</a></p> <!-- <p>3. Docker用户或IP访问的用户,请参考<a href="https://dwz.ovh/cve3d" target="_blank">没有域名购买订阅</a></p> -->
</div> </div>
</div> </div>
<!-- 说明提示框END --> <!-- 说明提示框END -->

48
templates/admin/static/embed.js

@ -150,13 +150,23 @@ layui.use(['element','table','layer','form','upload','iconHhysFa'], function(){
layer.close(index); layer.close(index);
}); });
} else if(obj.event === 'edit'){ } else if(obj.event === 'edit'){
window.location.href = '/index.php?c=admin&page=edit_category&id=' + obj.data.id; // 这是原来老的逻辑,跳转到新的页面进行编辑,不太友好
// window.location.href = '/index.php?c=admin&page=edit_category&id=' + obj.data.id;
// 新的逻辑改为当前页面iframe编辑
layer.open({
type: 2,
title: '编辑分类',
shadeClose: true,
maxmin: true, //开启最大化最小化按钮
area: ['900px', '660px'],
content: '/index.php?c=admin&page=edit_category_new&id=' + obj.data.id
});
} }
}); });
//渲染链接列表 //渲染链接列表
table.render({ table.render({
elem: '#link_list' elem: '#link_list'
,height: 520 ,height: 530
,url: 'index.php?c=api&method=link_list' //数据接口 ,url: 'index.php?c=api&method=link_list' //数据接口
,method: 'post' ,method: 'post'
,page: true //开启分页 ,page: true //开启分页
@ -182,7 +192,7 @@ layui.use(['element','table','layer','form','upload','iconHhysFa'], function(){
var url = '<a target = "_blank" href = "' + d.url + '" title = "' + d.url + '">' + d.url + '</a>'; var url = '<a target = "_blank" href = "' + d.url + '" title = "' + d.url + '">' + d.url + '</a>';
return url; return url;
}} }}
,{field: 'title', title: '链接标题', width:140} ,{field: 'title', title: '链接标题', width:140,edit: 'text'}
,{field: 'add_time', title: '添加时间', width:148, sort: true,templet:function(d){ ,{field: 'add_time', title: '添加时间', width:148, sort: true,templet:function(d){
var add_time = timestampToTime(d.add_time); var add_time = timestampToTime(d.add_time);
return add_time; return add_time;
@ -197,7 +207,7 @@ layui.use(['element','table','layer','form','upload','iconHhysFa'], function(){
} }
}} }}
,{field: 'weight', title: '权重', width: 75,sort:true} ,{field: 'weight', title: '权重', width: 75,sort:true,edit: 'text'}
,{field: 'property', title: '私有', width: 80, sort: true,templet: function(d){ ,{field: 'property', title: '私有', width: 80, sort: true,templet: function(d){
if(d.property == 1) { if(d.property == 1) {
return '<button type="button" class="layui-btn layui-btn-xs">是</button>'; return '<button type="button" class="layui-btn layui-btn-xs">是</button>';
@ -500,7 +510,7 @@ layui.use(['element','table','layer','form','upload','iconHhysFa'], function(){
var url = '<a target = "_blank" href = "' + d.url + '" title = "' + d.url + '">' + d.url + '</a>'; var url = '<a target = "_blank" href = "' + d.url + '" title = "' + d.url + '">' + d.url + '</a>';
return url; return url;
}} }}
,{field: 'title', title: '链接标题', width:140} ,{field: 'title', title: '链接标题', width:140,edit: 'text'}
,{field: 'add_time', title: '添加时间', width:148, sort: true,templet:function(d){ ,{field: 'add_time', title: '添加时间', width:148, sort: true,templet:function(d){
var add_time = timestampToTime(d.add_time); var add_time = timestampToTime(d.add_time);
return add_time; return add_time;
@ -515,7 +525,7 @@ layui.use(['element','table','layer','form','upload','iconHhysFa'], function(){
} }
}} }}
,{field: 'weight', title: '权重', width: 75,sort:true} ,{field: 'weight', title: '权重', width: 75,sort:true,edit: 'text'}
,{field: 'property', title: '私有', width: 80, sort: true,templet: function(d){ ,{field: 'property', title: '私有', width: 80, sort: true,templet: function(d){
if(d.property == 1) { if(d.property == 1) {
return '<button type="button" class="layui-btn layui-btn-xs">是</button>'; return '<button type="button" class="layui-btn layui-btn-xs">是</button>';
@ -565,6 +575,9 @@ layui.use(['element','table','layer','form','upload','iconHhysFa'], function(){
if(data.code == 0) { if(data.code == 0) {
layer.closeAll('loading'); layer.closeAll('loading');
layer.msg(data.data, {icon: 1}); layer.msg(data.data, {icon: 1});
setTimeout(() => {
location.reload();
}, 2000);
} }
else{ else{
layer.closeAll('loading'); layer.closeAll('loading');
@ -1138,3 +1151,26 @@ function del_link_icon(){
} }
}); });
} }
$(document).ready(function() {
// 获取当前页面的 URL
var currentUrl = window.location.href;
// 遍历导航栏菜单的子菜单项
$('.layui-nav-child dd a').each(function() {
var $this = $(this);
var linkUrl = $this.attr('href');
// 如果子菜单项的链接与当前页面的 URL 匹配,则为该子菜单项添加 'layui-this' 类
if (currentUrl.indexOf(linkUrl) !== -1) {
// 移除其他菜单项的 'layui-this' 类
$('.layui-nav-child dd').removeClass('layui-this');
// 为匹配的子菜单项添加 'layui-this' 类
$this.parent().addClass('layui-this');
// 结束遍历
return false;
}
});
});

14
templates/default/index.php

@ -179,7 +179,7 @@
<!-- 遍历分类目录 --> <!-- 遍历分类目录 -->
<?php foreach ( $categorys as $category ) { <?php foreach ( $categorys as $category ) {
$fid = $category['id']; $fid = $category['id'];
$links = get_links($fid); $links = $get_links($fid);
$font_icon = empty($category['font_icon']) ? '' : "<i class='{$category['font_icon']}'></i> "; $font_icon = empty($category['font_icon']) ? '' : "<i class='{$category['font_icon']}'></i> ";
//如果分类是私有的 //如果分类是私有的
if( $category['property'] == 1 ) { if( $category['property'] == 1 ) {
@ -192,7 +192,11 @@
<div id = "category-<?php echo $category['id']; ?>" class = "mdui-col-xs-12 mdui-typo-title cat-title"> <div id = "category-<?php echo $category['id']; ?>" class = "mdui-col-xs-12 mdui-typo-title cat-title">
<?php echo $font_icon; ?> <?php echo $font_icon; ?>
<?php echo htmlspecialchars_decode($category['name']); ?> <?php echo $property; ?> <?php echo htmlspecialchars_decode($category['name']); ?> <?php echo $property; ?>
<span class = "mdui-typo-caption"><?php echo $category['description']; ?></span> <?php if(empty($cid)) { ?>
<span class="more-link">
<a href="/index.php?cid=<?php echo $category['id']; ?>" title = "点此查看此分类下的全部链接">>></a>
</span>
<?php } ?>
</div> </div>
<!-- 遍历链接 --> <!-- 遍历链接 -->
<?php <?php
@ -227,7 +231,7 @@
<div class="mdui-card-primary-title link-title"> <div class="mdui-card-primary-title link-title">
<!-- 网站图标显示方式 --> <!-- 网站图标显示方式 -->
<?php if( $theme_config->favicon == "online") { ?> <?php if( $theme_config->favicon == "online") { ?>
<img src="https://favicon.rss.ink/v1/<?php echo base64($link['url']); ?>" alt="HUAN" width="16" height="16"> <img src="https://favicon.png.pub/v1/<?php echo base64($link['url']); ?>" alt="HUAN" width="16" height="16">
<?php }else{ ?> <?php }else{ ?>
<img src="/index.php?c=ico&text=<?php echo $link['title']; ?>" alt="" width="16" height="16" /> <img src="/index.php?c=ico&text=<?php echo $link['title']; ?>" alt="" width="16" height="16" />
<?php } ?> <?php } ?>
@ -248,13 +252,13 @@
</div> </div>
<div class="mdui-divider"></div> <div class="mdui-divider" style = "margin-top:2em;"></div>
<!--正文内容部分END--> <!--正文内容部分END-->
<!-- footer部分 --> <!-- footer部分 -->
<!-- 未经作者授权,请勿去掉版权,否则可能影响作者更新代码的积极性或直接放弃维护此项目。 --> <!-- 未经作者授权,请勿去掉版权,否则可能影响作者更新代码的积极性或直接放弃维护此项目。 -->
<footer> <footer>
<?php if(empty( $site['custom_footer']) ){ ?> <?php if(empty( $site['custom_footer']) ){ ?>
© 2022 Powered by <a target = "_blank" href="https://github.com/helloxz/onenav" title = "简约导航/书签管理器" rel = "nofollow">OneNav</a>.The author is <a href="https://www.xiaoz.me/" target="_blank" title = "小z博客">xiaoz.me</a> © 2023 Powered by <a target = "_blank" href="https://github.com/helloxz/onenav" title = "简约导航/书签管理器" rel = "nofollow">OneNav</a>.The author is <a href="https://www.xiaoz.me/" target="_blank" title = "小z博客">xiaoz.me</a>
<?php }else{ <?php }else{
echo $site['custom_footer']; echo $site['custom_footer'];
} ?> } ?>

6
templates/default/info.json

@ -3,13 +3,13 @@
"description": "OneNav默认主题", "description": "OneNav默认主题",
"homepage": "https:\/\/www.xiaoz.me", "homepage": "https:\/\/www.xiaoz.me",
"help_url":"https://dwz.ovh/gnae4", "help_url":"https://dwz.ovh/gnae4",
"version": "0.9.26", "version": "0.9.29",
"update": "2022\/11\/16", "update": "2023\/05\/06",
"author": "xiaoz<xiaoz93@outlook.com>", "author": "xiaoz<xiaoz93@outlook.com>",
"screenshot": "https:\/\/img.rss.ink\/imgs\/2022\/03\/42ed3ef2c4a50f6d.png", "screenshot": "https:\/\/img.rss.ink\/imgs\/2022\/03\/42ed3ef2c4a50f6d.png",
"demo":"", "demo":"",
"require":{ "require":{
"min":"0.9.20", "min":"0.9.30",
"max":"" "max":""
}, },
"config": { "config": {

5
templates/default/static/style.css

@ -168,3 +168,8 @@ footer a{
#qrcode img{ #qrcode img{
max-width: 200px; max-width: 200px;
} }
.more-link a{
color:#31bdec;
text-decoration: none;
}

2
version.txt

@ -1 +1 @@
v0.9.29-20221223 v0.9.30-20230508
Loading…
Cancel
Save