Browse Source

Merge pull request #198 from helloxz/dev

0.9.36
main
xiaoz 21 hours ago committed by GitHub
parent
commit
1cf21c33ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 0
      README_EN.md
  2. 0
      auto_install.json
  3. 150
      class/Api.php
  4. 18
      controller/api.php
  5. 0
      controller/bing.php
  6. 0
      controller/ico.php
  7. 0
      controller/init.php
  8. 0
      controller/mobile.php
  9. 0
      controller/universal.php
  10. 12
      data/update.log
  11. 0
      db/index.html
  12. BIN
      db/onenav.simple.db3
  13. 0
      db/sql/20220308.sql
  14. 0
      db/sql/20220311.sql
  15. 0
      db/sql/20220413.sql
  16. 0
      db/sql/20220414.sql
  17. 0
      db/sql/20220419.sql
  18. 0
      db/sql/20221114.sql
  19. 0
      db/sql/20221129.sql
  20. 0
      db/sql/on_db_logs.sql
  21. 0
      nginx.rewrite
  22. 0
      static/bootstrap4/css/bootstrap-grid.css
  23. 0
      static/bootstrap4/css/bootstrap-grid.css.map
  24. 0
      static/bootstrap4/css/bootstrap-grid.min.css
  25. 0
      static/bootstrap4/css/bootstrap-grid.min.css.map
  26. 0
      static/bootstrap4/css/bootstrap-reboot.css
  27. 0
      static/bootstrap4/css/bootstrap-reboot.css.map
  28. 0
      static/bootstrap4/css/bootstrap-reboot.min.css
  29. 0
      static/bootstrap4/css/bootstrap-reboot.min.css.map
  30. 0
      static/bootstrap4/css/bootstrap.css
  31. 0
      static/bootstrap4/css/bootstrap.css.map
  32. 0
      static/bootstrap4/css/bootstrap.min.css
  33. 0
      static/bootstrap4/css/bootstrap.min.css.map
  34. 0
      static/bootstrap4/js/bootstrap.bundle.js
  35. 0
      static/bootstrap4/js/bootstrap.bundle.js.map
  36. 0
      static/bootstrap4/js/bootstrap.bundle.min.js
  37. 0
      static/bootstrap4/js/bootstrap.bundle.min.js.map
  38. 0
      static/bootstrap4/js/bootstrap.js
  39. 0
      static/bootstrap4/js/bootstrap.js.map
  40. 0
      static/bootstrap4/js/bootstrap.min.js
  41. 0
      static/bootstrap4/js/bootstrap.min.js.map
  42. 0
      static/font-awesome/4.7.0/HELP-US-OUT.txt
  43. 0
      static/font-awesome/4.7.0/css/font-awesome.css
  44. 0
      static/font-awesome/4.7.0/css/font-awesome.min.css
  45. 0
      static/font-awesome/4.7.0/fonts/FontAwesome.otf
  46. 0
      static/font-awesome/4.7.0/fonts/fontawesome-webfont.eot
  47. 0
      static/font-awesome/4.7.0/fonts/fontawesome-webfont.svg
  48. 0
      static/font-awesome/4.7.0/fonts/fontawesome-webfont.ttf
  49. 0
      static/font-awesome/4.7.0/fonts/fontawesome-webfont.woff
  50. 0
      static/font-awesome/4.7.0/fonts/fontawesome-webfont.woff2
  51. 0
      static/font-awesome/4.7.0/less/animated.less
  52. 0
      static/font-awesome/4.7.0/less/bordered-pulled.less
  53. 0
      static/font-awesome/4.7.0/less/core.less
  54. 0
      static/font-awesome/4.7.0/less/fixed-width.less
  55. 0
      static/font-awesome/4.7.0/less/font-awesome.less
  56. 0
      static/font-awesome/4.7.0/less/icons.less
  57. 0
      static/font-awesome/4.7.0/less/larger.less
  58. 0
      static/font-awesome/4.7.0/less/list.less
  59. 0
      static/font-awesome/4.7.0/less/mixins.less
  60. 0
      static/font-awesome/4.7.0/less/path.less
  61. 0
      static/font-awesome/4.7.0/less/rotated-flipped.less
  62. 0
      static/font-awesome/4.7.0/less/screen-reader.less
  63. 0
      static/font-awesome/4.7.0/less/stacked.less
  64. 0
      static/font-awesome/4.7.0/less/variables.less
  65. 0
      static/font-awesome/4.7.0/scss/_animated.scss
  66. 0
      static/font-awesome/4.7.0/scss/_bordered-pulled.scss
  67. 0
      static/font-awesome/4.7.0/scss/_core.scss
  68. 0
      static/font-awesome/4.7.0/scss/_fixed-width.scss
  69. 0
      static/font-awesome/4.7.0/scss/_icons.scss
  70. 0
      static/font-awesome/4.7.0/scss/_larger.scss
  71. 0
      static/font-awesome/4.7.0/scss/_list.scss
  72. 0
      static/font-awesome/4.7.0/scss/_mixins.scss
  73. 0
      static/font-awesome/4.7.0/scss/_path.scss
  74. 0
      static/font-awesome/4.7.0/scss/_rotated-flipped.scss
  75. 0
      static/font-awesome/4.7.0/scss/_screen-reader.scss
  76. 0
      static/font-awesome/4.7.0/scss/_stacked.scss
  77. 0
      static/font-awesome/4.7.0/scss/_variables.scss
  78. 0
      static/font-awesome/4.7.0/scss/font-awesome.scss
  79. 0
      static/images/avatar.jpg
  80. 0
      static/images/default.png
  81. 0
      static/images/error.png
  82. 0
      static/images/share_tit_bg_5855301.png
  83. 0
      static/images/white64.png
  84. 0
      static/jQuery-contextMenu/font/context-menu-icons.eot
  85. 0
      static/jQuery-contextMenu/font/context-menu-icons.ttf
  86. 0
      static/jQuery-contextMenu/font/context-menu-icons.woff
  87. 0
      static/jQuery-contextMenu/font/context-menu-icons.woff2
  88. 0
      static/jQuery-contextMenu/jquery.contextMenu.css
  89. 0
      static/jQuery-contextMenu/jquery.contextMenu.js
  90. 0
      static/jQuery-contextMenu/jquery.contextMenu.min.css
  91. 0
      static/jQuery-contextMenu/jquery.contextMenu.min.css.map
  92. 0
      static/jQuery-contextMenu/jquery.contextMenu.min.js
  93. 0
      static/jQuery-contextMenu/jquery.contextMenu.min.js.map
  94. 0
      static/jQuery-contextMenu/jquery.ui.position.js
  95. 0
      static/jQuery-contextMenu/jquery.ui.position.min.js
  96. 0
      static/js/clipBoard.min.js
  97. 0
      static/js/holmes.js
  98. 0
      static/js/jquery.min.js
  99. 0
      static/js/md5.min.js
  100. 0
      static/js/qrcode.min.js
  101. Some files were not shown because too many files have changed in this diff Show More

0
README_EN.md

0
auto_install.json

150
class/Api.php

@ -921,42 +921,63 @@ class Api { @@ -921,42 +921,63 @@ class Api {
public function category_list($page,$limit){
$token = @$_POST['token'];
$offset = ($page - 1) * $limit;
/**
* name:如果成功登录,则查询所有
*
*/
//如果使用cookie登录成功,或者token不为空,则使用token进行验证
if( $this->is_login() || ( !empty($token) && $this->auth($token) ) ){
$sql = "SELECT *,(SELECT name FROM on_categorys WHERE id = a.fid LIMIT 1) AS fname,(SELECT COUNT(id) FROM on_links WHERE fid = a.id) AS link_num FROM on_categorys as a ORDER BY weight DESC,id DESC LIMIT {$limit} OFFSET {$offset}";
//统计总数
$count = $this->db->count('on_categorys','*');
}
//如果存在token,则验证
else if( !empty($token) ) {
// 验证登录或 token
if ($this->is_login() || (!empty($token) && $this->auth($token))) {
$sql = "SELECT *,(SELECT name FROM on_categorys WHERE id = a.fid LIMIT 1) AS fname,(SELECT COUNT(id) FROM on_links WHERE fid = a.id) AS link_num FROM on_categorys as a ORDER BY fid ASC, weight DESC, id ASC";
$count = $this->db->count('on_categorys', '*');
} elseif (!empty($token)) {
$this->auth($token);
//查询所有分类
$sql = "SELECT *,(SELECT name FROM on_categorys WHERE id = a.fid LIMIT 1) AS fname,(SELECT COUNT(id) FROM on_links WHERE fid = a.id) AS link_num FROM on_categorys as a ORDER BY weight DESC,id DESC LIMIT {$limit} OFFSET {$offset}";
//统计总数
$count = $this->db->count('on_categorys','*');
$sql = "SELECT *,(SELECT name FROM on_categorys WHERE id = a.fid LIMIT 1) AS fname,(SELECT COUNT(id) FROM on_links WHERE fid = a.id) AS link_num FROM on_categorys as a ORDER BY fid ASC, weight DESC, id ASC";
$count = $this->db->count('on_categorys', '*');
} else {
$sql = "SELECT *,(SELECT name FROM on_categorys WHERE id = a.fid LIMIT 1) AS fname,(SELECT COUNT(id) FROM on_links WHERE fid = a.id) AS link_num FROM on_categorys as a WHERE property = 0 ORDER BY fid ASC, weight DESC, id ASC";
$count = $this->db->count('on_categorys', '*', ['property' => 0]);
}
else{
$sql = "SELECT *,(SELECT name FROM on_categorys WHERE id = a.fid LIMIT 1) AS fname,(SELECT COUNT(id) FROM on_links WHERE fid = a.id) AS link_num FROM on_categorys as a WHERE property = 0 ORDER BY weight DESC,id DESC LIMIT {$limit} OFFSET {$offset}";
//统计总数
$count = $this->db->count('on_categorys','*',[
"property" => 0
]);
$all_categories = $this->db->query($sql)->fetchAll();
// 构建排序规则
$sorted_categories = [];
$categories_by_fid = [];
foreach ($all_categories as $category) {
if ($category['fid'] == 0) {
// 父级分类
$sorted_categories[] = $category;
} else {
// 子分类,按 fid 分组
$categories_by_fid[$category['fid']][] = $category;
}
}
//原生查询
$datas = $this->db->query($sql)->fetchAll();
$datas = [
'code' => 0,
'msg' => '',
'count' => $count,
'data' => $datas
// 对每个子分类组按 weight 排序
foreach ($categories_by_fid as &$sub_categories) {
usort($sub_categories, function ($a, $b) {
return $b['weight'] <=> $a['weight'];
});
}
// 将子分类插入到对应父级分类后
$final_sorted_categories = [];
foreach ($sorted_categories as $parent_category) {
$final_sorted_categories[] = $parent_category;
if (isset($categories_by_fid[$parent_category['id']])) {
$final_sorted_categories = array_merge($final_sorted_categories, $categories_by_fid[$parent_category['id']]);
}
}
// 截取分页数据
$paged_data = array_slice($final_sorted_categories, $offset, $limit);
$result = [
'code' => 0,
'msg' => '',
'count' => $count,
'data' => $paged_data,
];
exit(json_encode($datas));
exit(json_encode($result));
}
/**
* 生成
@ -1469,7 +1490,7 @@ class Api { @@ -1469,7 +1490,7 @@ class Api {
$this->return_json(-2000,'',"主题名称不合法!");
}
//如果是默认主题,则不允许删除
if( ($name === 'default') || ($name === 'admin') ) {
if( ($name === 'default') || ($name === 'admin') || ($name === 'default2') ) {
$this->return_json(-2000,'',"默认主题不允许删除!");
}
//查询当前使用中的主题
@ -1815,6 +1836,7 @@ class Api { @@ -1815,6 +1836,7 @@ class Api {
$subscribe = unserialize($subscribe);
//api请求地址
$api_url = API_URL."/v1/check_subscribe.php?order_id=".$subscribe['order_id']."&email=".$subscribe['email']."&domain=".$domain;
// echo $api_url;
try {
#GET HTTPS
$curl = curl_init($api_url);
@ -2521,6 +2543,70 @@ class Api { @@ -2521,6 +2543,70 @@ class Api {
exit( json_encode($datas) );
}
/**
* 批量更新链接排序
*
*/
public function update_link_order(){
//验证授权
$this->auth($token);
// 获取分类ID
$cid = intval($this->getData("category_id"));
// 获取json对象数据
// 获取前端传递的原始 JSON 数据
$rawData = file_get_contents('php://input');
// 将 JSON 数据转换为 PHP 关联数组
$jsonData = json_decode($rawData, true);
// 检查解析是否成功
if (json_last_error() !== JSON_ERROR_NONE) {
$this->return_json(-2000,'','JSON解析失败!');
}
// 批量更新on_links表的weight字段
foreach ($jsonData as $key => $value) {
$this->db->update('on_links', [
'weight' => $value['weight']
], [
'fid' => $cid,
'id' => intval($value['id'])
]);
}
// 返回成功
$this->return_json(200,'','success');
}
/**
* name:获取订阅信息
*/
public function get_subscribe() {
//验证授权
$this->auth($token);
//获取当前站点信息
$subscribe = $this->db->get('on_options','value',[ 'key' => "s_subscribe" ]);
$subscribe = unserialize($subscribe);
$this->return_json(200,$subscribe,'success');
}
/**
* 验证订阅是否有效
*/
public function get_subscribe_status(){
// var_dump($_SERVER['HTTP_HOST']);
//验证授权
$this->auth($token);
// 获取订阅结果
$result = $this->is_subscribe();
if( $result === TRUE ) {
$this->return_json(200,'Active','success');
}
else{
$this->return_json(-2000,'','failure');
}
}
}

18
controller/api.php

@ -668,3 +668,21 @@ function upload_backup(){ @@ -668,3 +668,21 @@ function upload_backup(){
global $api;
$api->general_upload('data/backup/',['db3']);
}
// 批量更新排序
function update_link_order(){
global $api;
$api->update_link_order();
}
// 获取订阅信息
function get_subscribe(){
global $api;
$api->get_subscribe();
}
// 获取订阅状态
function get_subscribe_status(){
global $api;
$api->get_subscribe_status();
}

0
controller/bing.php

0
controller/ico.php

0
controller/init.php

0
controller/mobile.php

0
controller/universal.php

12
data/update.log

@ -1,3 +1,15 @@ @@ -1,3 +1,15 @@
2024.11.27
1. 修改默认主题为`default2`
2. 后端禁止删除默认主题:default2
3. 新增API接口查询订阅是否有效:get_subscribe_status
4. 新增API接口查询订阅订单号:get_subscribe
5. 修改默认数据库中一些失效链接
2024.11.25
1. 分类排序优化,父分类后面紧跟子分类
2. 新增批量排序接口:update_link_order
___
20200409
1. 新增快捷键支持
2. 后台增加自定义js功能

0
db/index.html

BIN
db/onenav.simple.db3

Binary file not shown.

0
db/sql/20220308.sql

0
db/sql/20220311.sql

0
db/sql/20220413.sql

0
db/sql/20220414.sql

0
db/sql/20220419.sql

0
db/sql/20221114.sql

0
db/sql/20221129.sql

0
db/sql/on_db_logs.sql

0
nginx.rewrite

0
static/bootstrap4/css/bootstrap-grid.css vendored

0
static/bootstrap4/css/bootstrap-grid.css.map

0
static/bootstrap4/css/bootstrap-grid.min.css vendored

0
static/bootstrap4/css/bootstrap-grid.min.css.map

0
static/bootstrap4/css/bootstrap-reboot.css vendored

0
static/bootstrap4/css/bootstrap-reboot.css.map

0
static/bootstrap4/css/bootstrap-reboot.min.css vendored

0
static/bootstrap4/css/bootstrap-reboot.min.css.map

0
static/bootstrap4/css/bootstrap.css vendored

0
static/bootstrap4/css/bootstrap.css.map

0
static/bootstrap4/css/bootstrap.min.css vendored

0
static/bootstrap4/css/bootstrap.min.css.map

0
static/bootstrap4/js/bootstrap.bundle.js

0
static/bootstrap4/js/bootstrap.bundle.js.map

0
static/bootstrap4/js/bootstrap.bundle.min.js vendored

0
static/bootstrap4/js/bootstrap.bundle.min.js.map

0
static/bootstrap4/js/bootstrap.js vendored

0
static/bootstrap4/js/bootstrap.js.map

0
static/bootstrap4/js/bootstrap.min.js vendored

0
static/bootstrap4/js/bootstrap.min.js.map

0
static/font-awesome/4.7.0/HELP-US-OUT.txt

0
static/font-awesome/4.7.0/css/font-awesome.css vendored

0
static/font-awesome/4.7.0/css/font-awesome.min.css vendored

0
static/font-awesome/4.7.0/fonts/FontAwesome.otf

0
static/font-awesome/4.7.0/fonts/fontawesome-webfont.eot

0
static/font-awesome/4.7.0/fonts/fontawesome-webfont.svg

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

0
static/font-awesome/4.7.0/fonts/fontawesome-webfont.ttf

0
static/font-awesome/4.7.0/fonts/fontawesome-webfont.woff

0
static/font-awesome/4.7.0/fonts/fontawesome-webfont.woff2

0
static/font-awesome/4.7.0/less/animated.less vendored

0
static/font-awesome/4.7.0/less/bordered-pulled.less vendored

0
static/font-awesome/4.7.0/less/core.less vendored

0
static/font-awesome/4.7.0/less/fixed-width.less vendored

0
static/font-awesome/4.7.0/less/font-awesome.less vendored

0
static/font-awesome/4.7.0/less/icons.less vendored

0
static/font-awesome/4.7.0/less/larger.less vendored

0
static/font-awesome/4.7.0/less/list.less vendored

0
static/font-awesome/4.7.0/less/mixins.less vendored

0
static/font-awesome/4.7.0/less/path.less vendored

0
static/font-awesome/4.7.0/less/rotated-flipped.less vendored

0
static/font-awesome/4.7.0/less/screen-reader.less vendored

0
static/font-awesome/4.7.0/less/stacked.less vendored

0
static/font-awesome/4.7.0/less/variables.less vendored

0
static/font-awesome/4.7.0/scss/_animated.scss vendored

0
static/font-awesome/4.7.0/scss/_bordered-pulled.scss vendored

0
static/font-awesome/4.7.0/scss/_core.scss vendored

0
static/font-awesome/4.7.0/scss/_fixed-width.scss vendored

0
static/font-awesome/4.7.0/scss/_icons.scss vendored

0
static/font-awesome/4.7.0/scss/_larger.scss vendored

0
static/font-awesome/4.7.0/scss/_list.scss vendored

0
static/font-awesome/4.7.0/scss/_mixins.scss vendored

0
static/font-awesome/4.7.0/scss/_path.scss vendored

0
static/font-awesome/4.7.0/scss/_rotated-flipped.scss vendored

0
static/font-awesome/4.7.0/scss/_screen-reader.scss vendored

0
static/font-awesome/4.7.0/scss/_stacked.scss vendored

0
static/font-awesome/4.7.0/scss/_variables.scss vendored

0
static/font-awesome/4.7.0/scss/font-awesome.scss vendored

0
static/images/avatar.jpg

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

0
static/images/default.png

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
static/images/error.png

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

0
static/images/share_tit_bg_5855301.png

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

0
static/images/white64.png

Before

Width:  |  Height:  |  Size: 119 B

After

Width:  |  Height:  |  Size: 119 B

0
static/jQuery-contextMenu/font/context-menu-icons.eot

0
static/jQuery-contextMenu/font/context-menu-icons.ttf

0
static/jQuery-contextMenu/font/context-menu-icons.woff

0
static/jQuery-contextMenu/font/context-menu-icons.woff2

0
static/jQuery-contextMenu/jquery.contextMenu.css

0
static/jQuery-contextMenu/jquery.contextMenu.js

0
static/jQuery-contextMenu/jquery.contextMenu.min.css vendored

0
static/jQuery-contextMenu/jquery.contextMenu.min.css.map

0
static/jQuery-contextMenu/jquery.contextMenu.min.js vendored

0
static/jQuery-contextMenu/jquery.contextMenu.min.js.map

0
static/jQuery-contextMenu/jquery.ui.position.js vendored

0
static/jQuery-contextMenu/jquery.ui.position.min.js vendored

0
static/js/clipBoard.min.js vendored

0
static/js/holmes.js

0
static/js/jquery.min.js vendored

0
static/js/md5.min.js vendored

0
static/js/qrcode.min.js vendored

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save