Browse Source

Merge pull request #71 from helloxz/dev

0.9.20
pull/90/head 0.9.20
xiaoz 3 years ago committed by GitHub
parent
commit
b6aa843715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 107
      class/Api.php
  2. 31
      controller/admin.php
  3. 36
      controller/api.php
  4. 101
      controller/ico.php
  5. 28
      controller/index.php
  6. 7
      data/update.log
  7. 3
      templates/admin/click.php
  8. 26
      templates/admin/link_list.php
  9. 10
      templates/admin/setting/theme.php
  10. 83
      templates/admin/setting/theme_config.php
  11. 1
      templates/admin/setting/theme_detail.php
  12. 97
      templates/admin/static/embed.js
  13. 13
      templates/baisuTwo/index.php
  14. 10
      templates/baisuTwo/info.json
  15. 2
      templates/baisuTwo/js/admin.js
  16. 38
      templates/default/index.php
  17. 20
      templates/default/info.json
  18. 4
      templates/default/static/style.css
  19. 2
      version.txt

107
class/Api.php

@ -214,6 +214,38 @@ class Api {
$this->err_msg(-1011,'The URL already exists!'); $this->err_msg(-1011,'The URL already exists!');
} }
} }
/**
* 批量修改链接分类
*/
public function batch_modify_category($data) {
$this->auth($token);
//获取链接ID,是一个数组
$id = implode(',',$data['id']);
//获取分类ID
$fid = $data['fid'];
//查询分类ID是否存在
$count = $this->db->count('on_categorys',[ 'id' => $fid]);
//如果分类ID不存在
if( empty($fid) || empty($count) ) {
$this->err_msg(-2000,'分类ID不存在!');
}
else{
$sql = "UPDATE on_links SET fid='$fid' WHERE id IN ($id)";
$re = $this->db->query($sql);
if( $re ) {
$id = $this->db->id();
$data = [
'code' => 0,
'msg' => "success"
];
exit(json_encode($data));
}
else{
$this->err_msg(-2000,'更新失败!');
}
}
}
/** /**
* 批量导入链接 * 批量导入链接
*/ */
@ -909,6 +941,81 @@ class Api {
$this->err_msg(-2000,$e->getMessage()); $this->err_msg(-2000,$e->getMessage());
} }
} }
/**
* 保存主题参数
*/
public function save_theme_config($data) {
$this->auth($token);
//获取主题名称
$name = $data['name'];
//获取config参数,是一个对象
$config = $data['config'];
//获取主题配置文件config.json
if ( is_dir("templates/".$name) ) {
$config_file = "templates/".$name."/config.json";
}
else{
$config_file = "data/templates/".$name."/config.json";
}
$config_content = json_encode($config,JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
//写入配置
try {
$re = @file_put_contents($config_file,$config_content);
$this->return_json(0,"success");
} catch (\Throwable $th) {
$this->err_msg(-2000,"写入配置失败!");
}
}
/**
* 获取主题参数
*/
public function get_theme_config() {
$template = $this->db->get("on_options","value",[
"key" => "theme"
]);
//获取主题配置信息
//获取主题配置
if( file_exists("templates/".$template."/config.json") ) {
$config_file = "templates/".$template."/config.json";
}
else if( file_exists("data/templates/".$template."/config.json") ) {
$config_file = "data/templates/".$template."/config.json";
}
else if( file_exists("templates/".$template."/info.json") ) {
$config_file = "templates/".$template."/info.json";
}
else {
$config_file = "data/templates/".$template."/info.json";
}
//读取主题配置
$config_content = @file_get_contents($config_file);
//如果是info.json,则特殊处理下
if ( strstr($config_file,"info.json") ) {
$config_content = json_decode($config_content);
$theme_config = $config_content->config;
}
else{
$theme_config = $config_content;
$theme_config = json_decode($theme_config);
}
$this->return_json(200,$theme_config,"");
}
/**
* 通用json消息返回
*/
public function return_json($code,$data,$msg = "") {
$return = [
"code" => intval($code),
"data" => $data,
"msg" => $msg
];
exit(json_encode($return));
}
/** /**
* 更新option * 更新option
*/ */

31
controller/admin.php

@ -43,6 +43,31 @@ if ( $page == 'edit_category' ) {
} }
} }
//如果是主题设置页面
if ( $page == "setting/theme_config" ){
//获取主题名称
$name = trim($_GET['name']);
//获取主题目录
if ( is_dir("templates/".$name) ) {
$theme_dir = "templates/".$name;
}
else{
$theme_dir = "data/templates/".$name;
}
//读取主题配置
$config_content = @file_get_contents("templates/".$name."/info.json");
if( !$config_content ) {
$config_content = @file_get_contents("data/templates/".$name."/info.json");
}
$configs = json_decode($config_content);
$configs = $configs->config;
//获取当前的配置参数
$current_configs = file_get_contents($theme_dir."/config.json");
$current_configs = json_decode($current_configs);
//var_dump($current_configs);
}
//添加分类页面 //添加分类页面
if ( $page == 'add_category' ) { if ( $page == 'add_category' ) {
//查询父级分类 //查询父级分类
@ -80,6 +105,12 @@ if ($page == 'edit_link') {
} }
} }
//链接列表页面
if ( $page == "link_list" ) {
//查询所有分类信息,用于分类框选择
$categorys = $db->select('on_categorys','*',[ 'ORDER' => ['weigth' => 'DESC'] ]);
}
//如果页面是添加链接页面 //如果页面是添加链接页面
if ( ($page == 'add_link') || ($page == 'add_link_tpl') || ($page == 'add_quick_tpl') ) { if ( ($page == 'add_link') || ($page == 'add_link_tpl') || ($page == 'add_quick_tpl') ) {
//查询所有分类信息 //查询所有分类信息

36
controller/api.php

@ -145,8 +145,8 @@ function category_list($api){
* 查询链接列表 * 查询链接列表
*/ */
function link_list($api){ function link_list($api){
$page = empty(intval($_GET['page'])) ? 1 : intval($_GET['page']); $page = empty(intval($_REQUEST['page'])) ? 1 : intval($_REQUEST['page']);
$limit = empty(intval($_GET['limit'])) ? 10 : intval($_GET['limit']); $limit = empty(intval($_REQUEST['limit'])) ? 10 : intval($_REQUEST['limit']);
//获取token //获取token
$token = $_POST['token']; $token = $_POST['token'];
//获取分类ID //获取分类ID
@ -323,3 +323,35 @@ function get_latest_version() {
} }
exit(json_encode($data)); exit(json_encode($data));
} }
//批量修改链接分类
function batch_modify_category($api) {
//获取id列表
$id = $_POST['id'];
//获取分类ID
$fid = intval($_POST['fid']);
$data = [
'id' => $id,
'fid' => $fid
];
$api->batch_modify_category($data);
}
//保存主题参数设置
function save_theme_config($api) {
//获取所有POST数组,并组合为对象
$post_data = $_POST;
//数组转对象
foreach ($post_data as $key => $value) {
$data['config']->$key = $value;
}
$data['name'] = $post_data['name'];
unset($data['config']->name);
$api->save_theme_config($data);
}
//获取主题配置信息
function get_theme_config($api) {
$api->get_theme_config();
}

101
controller/ico.php

@ -0,0 +1,101 @@
<?php
/**
* 首字母头像
* @param $text
* @return string
* 原作者:http://t.zoukankan.com/ccw869476711-p-13596791.html
*/
function letter_avatar($text)
{
$total = unpack('L', hash('adler32', $text, true))[1];
$hue = $total % 360;
list($r, $g, $b) = hsv2rgb($hue / 360, 0.3, 0.9);
$bg = "rgb({$r},{$g},{$b})";
$color = "#ffffff";
$first = mb_strtoupper(mb_substr($text, 0, 1));
$src = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="100" width="100"><rect fill="' . $bg . '" x="0" y="0" width="100" height="100"></rect><text x="50" y="50" font-size="50" text-copy="fast" fill="' . $color . '" text-anchor="middle" text-rights="admin" alignment-baseline="central">' . $first . '</text></svg>';
//$value = 'data:image/svg+xml;base64,' . $src;
$value = $src;
return $value;
}
function hsv2rgb($h, $s, $v)
{
$r = $g = $b = 0;
$i = floor($h * 6);
$f = $h * 6 - $i;
$p = $v * (1 - $s);
$q = $v * (1 - $f * $s);
$t = $v * (1 - (1 - $f) * $s);
switch ($i % 6) {
case 0:
$r = $v;
$g = $t;
$b = $p;
break;
case 1:
$r = $q;
$g = $v;
$b = $p;
break;
case 2:
$r = $p;
$g = $v;
$b = $t;
break;
case 3:
$r = $p;
$g = $q;
$b = $v;
break;
case 4:
$r = $t;
$g = $p;
$b = $v;
break;
case 5:
$r = $v;
$g = $p;
$b = $q;
break;
}
return [
floor($r * 255),
floor($g * 255),
floor($b * 255)
];
}
/**
* 输出svg图像
*/
function output_ico() {
//获取文字
$text = @trim($_GET['text']);
$text = empty($text) ? '空' : $text;
//获取当前主机名
$host = $_SERVER['HTTP_HOST'];
//获取reffrer
$referer = $_SERVER['HTTP_REFERER'];
//如果referer和主机名不匹配,则禁止调用
if ( ( !empty($referer) ) && ( !strstr($referer,$host) ) ) {
exit('调用失败');
}
else{
header('Cache-Control: max-age=604800');
header('Content-Type:image/svg+xml');
echo letter_avatar($text);
}
}
//调用ico输出函数
output_ico();

28
controller/index.php

@ -162,6 +162,34 @@ $template = $db->get("on_options","value",[
$site = $db->get('on_options','value',[ 'key' => "s_site" ]); $site = $db->get('on_options','value',[ 'key' => "s_site" ]);
$site = unserialize($site); $site = unserialize($site);
//获取主题配置信息
//获取主题配置
if( file_exists("templates/".$template."/config.json") ) {
$config_file = "templates/".$template."/config.json";
}
else if( file_exists("data/templates/".$template."/config.json") ) {
$config_file = "data/templates/".$template."/config.json";
}
else if( file_exists("templates/".$template."/info.json") ) {
$config_file = "templates/".$template."/info.json";
}
else {
$config_file = "data/templates/".$template."/info.json";
}
//读取主题配置
$config_content = @file_get_contents($config_file);
//如果是info.json,则特殊处理下
if ( strstr($config_file,"info.json") ) {
$config_content = json_decode($config_content);
$theme_config = $config_content->config;
}
else{
$config_content = $config_content;
$theme_config = json_decode($config_content);
}
//判断文件夹是否存在 //判断文件夹是否存在
if( is_dir('templates/'.$template) ){ if( is_dir('templates/'.$template) ){
$tpl_dir = 'templates/'; $tpl_dir = 'templates/';

7
data/update.log

@ -97,3 +97,10 @@ CREATE INDEX on_options_key_IDX ON on_options ("key");
1. 默认主题新增夜间模式切换 1. 默认主题新增夜间模式切换
2. 修复修改分类无法更新的BUG 2. 修复修改分类无法更新的BUG
3. 优化后台底部窗口遮挡问题 3. 优化后台底部窗口遮挡问题
20220429
1. 后台新增批量修改链接所属分类
2. 后台新增根据分类查询链接
3. 离线站点图标(使用标题第一个字符)
4. 修复baisu主题修改二级分类导致分类变一级的问题
5. 新增主题自定义参数设置

3
templates/admin/click.php

@ -25,8 +25,6 @@
$admin_stay_time = $transition_page['admin_stay_time']; $admin_stay_time = $transition_page['admin_stay_time'];
if ($is_login) { if ($is_login) {
//header("Refresh:1;url=".$link['url']);
header("Refresh:$admin_stay_time;url=".$link['url']); header("Refresh:$admin_stay_time;url=".$link['url']);
} }
else{ else{
@ -103,6 +101,5 @@
</div> </div>
</div> </div>
</div> </div>
<?php g_extend_js(); ?>
</body> </body>
</html> </html>

26
templates/admin/link_list.php

@ -4,12 +4,36 @@
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body place-holder"> <div class="layui-row content-body place-holder">
<!-- 表单上面的按钮 -->
<div class="lay-col-lg12">
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<div class="layui-inline">
<div class="layui-input-inline">
<select name="fid" lay-verify="" lay-search id = "fid">
<option value="">请选择一个分类</option>
<?php foreach( $categorys AS $category ){ ?>
<option value="<?php echo $category['id'] ?>"><?php echo $category['name']; ?></option>
<?php } ?>
</select>
</div>
<div class="layui-input-inline" style="width: 100px;">
<button class="layui-btn" lay-submit lay-filter="screen_link">查询此分类下的链接</button>
</div>
</div>
</div>
</div>
</form>
<!-- 表单上面的按钮END -->
<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" lay-data="{id: 'mylink_reload'}"></table>
<!-- 开启表格头部工具栏 --> <!-- 开启表格头部工具栏 -->
<script type="text/html" id="linktool"> <script type="text/html" id="linktool">
<div class="layui-btn-container"> <div class="layui-btn-container">
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="getCheckData">删除选中</button> <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="getCheckData">删除选中</button>
<button class="layui-btn layui-btn-sm" lay-event="readmoredata">批量修改分类</button>
<!-- <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button> <!-- <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button> --> <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button> -->
</div> </div>

10
templates/admin/setting/theme.php

@ -28,6 +28,7 @@
<div class="layui-btn-group"> <div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" onclick = "set_theme('<?php echo $key; ?>')">使用</button> <button type="button" class="layui-btn layui-btn-sm" onclick = "set_theme('<?php echo $key; ?>')">使用</button>
<button type="button" class="layui-btn layui-btn-sm" onclick = "theme_detail('<?php echo $key; ?>')">详情</button> <button type="button" class="layui-btn layui-btn-sm" onclick = "theme_detail('<?php echo $key; ?>')">详情</button>
<button type="button" class="layui-btn layui-btn-sm" onclick = "theme_config('<?php echo $key; ?>')">参数设置</button>
<?php if( $current_them == $key ) { ?> <?php if( $current_them == $key ) { ?>
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger">当前主题</button> <button type="button" class="layui-btn layui-btn-sm layui-btn-danger">当前主题</button>
<?php } ?> <?php } ?>
@ -54,6 +55,15 @@ function theme_detail(name){
content:'/index.php?c=admin&page=setting/theme_detail&name=' + name content:'/index.php?c=admin&page=setting/theme_detail&name=' + name
}); });
} }
//主题参数设置
function theme_config(name){
layer.open({
title: "设置主题【" + name + "】参数:",
type:2,
area: ['620px', '560px'],
content:'/index.php?c=admin&page=setting/theme_config&name=' + name
});
}
function set_theme(name) { function set_theme(name) {
$.post("/index.php?c=api&method=set_theme",{key:"theme",value:name},function(data,status){ $.post("/index.php?c=api&method=set_theme",{key:"theme",value:name},function(data,status){

83
templates/admin/setting/theme_config.php

@ -0,0 +1,83 @@
<!-- 主题详情页面 -->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>OneNav后台管理</title>
<link rel='stylesheet' href='static/layui/css/layui.css'>
<link rel='stylesheet' href='templates/admin/static/style.css?v=v0.9.17-20220314'>
</head>
<body class="layui-fluid">
<div class="layui-row" style = "margin-top:1em;">
<!-- 说明提示框 -->
<div class="layui-col-lg12">
<div class="setting-msg">
主题自定义参数设置,请参考:<a href="https://dwz.ovh/gnae4" target = "_blank" title = "主题参数设置说明">https://dwz.ovh/gnae4</a>,如果您不清楚,请勿修改。
</div>
</div>
<!-- 说明提示框END -->
<div class="layui-col-sm10 layui-col-sm-offset1">
<form class="layui-form layui-form-pane">
<div class="layui-form-item">
<label class="layui-form-label" style = "width:35%;">主题名称</label>
<div class="layui-input-inline" style = "width:63%;">
<input type="text" name="name" required lay-verify="required" value = "<?php echo $name; ?>" readonly="readonly" class="layui-input">
</div>
</div>
<!-- 遍历配置选项 -->
<?php foreach ($configs as $key => $config) {
//如果config.json获取到的数据是空的,则读取info.json
$value = empty( $current_configs->$key ) ? $config : $current_configs->$key;
?>
<div class="layui-form-item">
<label class="layui-form-label" style = "width:35%;"><?php echo $key; ?></label>
<div class="layui-input-inline" style = "width:63%;">
<input type="text" name="<?php echo $key; ?>" value = "<?php echo $value; ?>" class="layui-input">
</div>
</div>
<?php } ?>
<!-- 遍历配置选项END -->
<div class="layui-form-item">
<button class="layui-btn" lay-submit lay-filter="save_theme_config">保存</button>
</div>
</form>
</div>
</div>
<script src="static/js/jquery.min.js"></script>
<script src="static/layui/layui.js"></script>
<script>
layui.use(['layer','form'], function(){
var layer = layui.layer;
var form = layui.form;
form.on('submit(save_theme_config)', function(data){
console.log(data.field);
$.post("/index.php?c=api&method=save_theme_config",data.field,function(data,status){
if( data.data == 'success') {
layer.msg("设置已更新!",{icon:1});
}
else{
layer.msg(data.err_msg,{icon:5});
}
});
return false;
});
});
function set_theme(name) {
$.post("/index.php?c=api&method=set_theme",{key:"theme",value:name},function(data,status){
if( data.code == 0 ) {
layer.msg(data.data, {icon: 1});
setTimeout(() => {
location.reload();
}, 2000);
}
else{
layer.msg(data.err_msg, {icon: 5});
}
});
}
</script>
</body>
</html>

1
templates/admin/setting/theme_detail.php

@ -21,6 +21,7 @@
<p>版本:<?php echo $theme->version; ?></p> <p>版本:<?php echo $theme->version; ?></p>
<p>更新时间:<?php echo $theme->update; ?></p> <p>更新时间:<?php echo $theme->update; ?></p>
<p>作者:<?php echo $theme->author; ?></p> <p>作者:<?php echo $theme->author; ?></p>
<p>使用说明:<a style = "color:#01AAED;" href="<?php echo $theme->help_url; ?>" target="_blank" rel = "nofollow"><?php echo $theme->help_url; ?></a></p>
<p>主页:<a style = "color:#01AAED;" href="<?php echo $theme->homepage; ?>" target="_blank" rel = "nofollow"><?php echo $theme->homepage; ?></a></p> <p>主页:<a style = "color:#01AAED;" href="<?php echo $theme->homepage; ?>" target="_blank" rel = "nofollow"><?php echo $theme->homepage; ?></a></p>
</div> </div>
</div> </div>

97
templates/admin/static/embed.js

@ -71,6 +71,7 @@ layui.use(['element','table','layer','form','upload'], function(){
elem: '#link_list' elem: '#link_list'
,height: 520 ,height: 520
,url: 'index.php?c=api&method=link_list' //数据接口 ,url: 'index.php?c=api&method=link_list' //数据接口
,method: 'post'
,page: true //开启分页 ,page: true //开启分页
,toolbar: '#linktool' ,toolbar: '#linktool'
,cols: [[ //表头 ,cols: [[ //表头
@ -156,9 +157,41 @@ layui.use(['element','table','layer','form','upload'], function(){
//刷新当前页面 //刷新当前页面
//window.location.reload(); //window.location.reload();
break; break;
case 'getCheckLength': case 'readmoredata':
var data = checkStatus.data; var data = checkStatus.data;
layer.msg('选中了:'+ data.length + ' 个'); fidtext = $("#fid option:selected").text();
fid = $("#fid").val();
fid = parseInt(fid);
if( data.length == 0 ) {
layer.msg('未选中任何数据!');
return false;
}
if ( isNaN(fid) === true ){
layer.msg('请先选择分类!',{icon:5});
}
else{
layer.confirm('确认将选中链接的分类修改为【' + fidtext + '】?',{icon: 3, title:'温馨提示!'}, function(index){
id = [];
for(let i = 0;i < data.length;i++) {
id.push(data[i].id);
}
$.post("/index.php?c=api&method=batch_modify_category",{id:id,fid:fid},function(data,status){
if (data.msg === "success") {
layer.msg("修改成功!",{icon:1});
setTimeout(() => {
window.location.reload();
}, 2000);
}
else{
layer.msg(data.err_msg,{icon:5});
}
});
});
}
//console.log(data);
break; break;
case 'isAll': case 'isAll':
layer.msg(checkStatus.isAll ? '全选': '未全选'); layer.msg(checkStatus.isAll ? '全选': '未全选');
@ -260,6 +293,66 @@ layui.use(['element','table','layer','form','upload'], function(){
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。 return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
}); });
//筛选链接
form.on('submit(screen_link)', function(data){
fid = data.field.fid;
if( fid == "" ) {
layer.msg("请先选择分类!",{icon:5});
return false;
}
//表格重载
var tableIns = table.render({
elem: '#link_list'
,height: 520
,url: 'index.php?c=api&method=link_list' //数据接口
,method: 'post'
,page: true //开启分页
,toolbar: '#linktool'
,where:{
category_id:fid
}
,cols: [[ //表头
{type:'checkbox'} //开启复选框
,{field: 'id', title: 'ID', width:80, sort: true}
// ,{field: 'fid', title: '分类ID',sort:true, width:90}
,{field: 'category_name', title: '所属分类',sort:true,width:120}
,{field: 'url', title: 'URL',width:140,templet:function(d){
var url = '<a target = "_blank" href = "' + d.url + '" title = "' + d.url + '">' + d.url + '</a>';
return url;
}}
,{field: 'title', title: '链接标题', width:140}
,{field: 'add_time', title: '添加时间', width:148, sort: true,templet:function(d){
var add_time = timestampToTime(d.add_time);
return add_time;
}}
,{field: 'up_time', title: '修改时间', width:148,sort:true,templet:function(d){
if(d.up_time == null){
return '';
}
else{
var up_time = timestampToTime(d.up_time);
return up_time;
}
}}
,{field: 'weight', title: '权重', width: 75,sort:true}
,{field: 'property', title: '私有', width: 80, sort: true,templet: function(d){
if(d.property == 1) {
return '<button type="button" class="layui-btn layui-btn-xs">是</button>';
}
else {
return '<button type="button" class="layui-btn layui-btn-xs layui-btn-danger">否</button>';
}
}}
,{field: 'click', title: '点击数',width:90,sort:true}
,{fixed: 'right', title:'操作', toolbar: '#link_operate'}
]]
});
//console.log(data.field) //当前容器的全部表单字段,名值对形式:{name: value}
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
//保存站点设置 //保存站点设置
form.on('submit(set_site)', function(data){ form.on('submit(set_site)', function(data){
$.post('/index.php?c=api&method=set_site',data.field,function(data,status){ $.post('/index.php?c=api&method=set_site',data.field,function(data,status){

13
templates/baisuTwo/index.php

@ -18,6 +18,15 @@
<link rel="stylesheet" href="static/font-awesome/4.7.0/css/font-awesome.css"> <link rel="stylesheet" href="static/font-awesome/4.7.0/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="static/layui/css/layui.css" /> <link rel="stylesheet" type="text/css" href="static/layui/css/layui.css" />
<?php echo $site['custom_header']; ?> <?php echo $site['custom_header']; ?>
<style>
<?php if( $theme_config->link_description == "hide" ) { ?>
/*链接描述是否显示*/
.site-main .site-list .list .desc {
/*none:不显示,block:显示*/
display: none;
}
<?php } ?>
</style>
</head> </head>
<body> <body>
@ -419,6 +428,10 @@
私有: 私有:
<input type="checkbox" lay-skin="switch" lay-text="是|否" name="property" value="1"> <input type="checkbox" lay-skin="switch" lay-text="是|否" name="property" value="1">
</div> </div>
<div class="li" style = "display:none;">
<span>fid:</span>
<input type="text" class="num" name="fid" min="0" max="999" required lay-verify="required|number" autocomplete="off">
</div>
</div> </div>
<div class="list"> <div class="list">
<textarea name="description" id="description" placeholder="请输入分类描述(选填)"></textarea> <textarea name="description" id="description" placeholder="请输入分类描述(选填)"></textarea>

10
templates/baisuTwo/info.json

@ -2,8 +2,12 @@
"name":"百素主题2", "name":"百素主题2",
"description":"适用于OneNav的百素主题2", "description":"适用于OneNav的百素主题2",
"homepage":"https://gitee.com/baisucode/baisu-two", "homepage":"https://gitee.com/baisucode/baisu-two",
"version":"1.0.1", "version":"1.0.2",
"update":"2022/04/22", "update":"2022/04/29",
"author":"baisu", "author":"baisu",
"screenshot":"https://img.rss.ink/imgs/2022/03/cba9f1946776a8f0.png" "help_url":"https://dwz.ovh/gnae4",
"screenshot":"https://img.rss.ink/imgs/2022/03/cba9f1946776a8f0.png",
"config": {
"link_description":"hide"
}
} }

2
templates/baisuTwo/js/admin.js

@ -203,6 +203,7 @@ layui.use(['dropdown', 'layer', 'form'], function() {
"description": data.data.description, "description": data.data.description,
"weight": data.data.weight, "weight": data.data.weight,
"property": property, "property": property,
"fid":parseInt(data.data.fid)
}); });
} else { } else {
//获取信息失败 //获取信息失败
@ -287,6 +288,7 @@ function editFID(data) {
name: data.name, name: data.name,
font_icon: data.font_icon, font_icon: data.font_icon,
weight: data.weight, weight: data.weight,
fid:data.fid,
property: data.property, property: data.property,
description: data.description, description: data.description,
}, function(data, status) { }, function(data, status) {

38
templates/default/index.php

@ -14,6 +14,16 @@
<link rel="stylesheet" href="templates/<?php echo $template; ?>/static/style.css?v=<?php echo $version; ?>"> <link rel="stylesheet" href="templates/<?php echo $template; ?>/static/style.css?v=<?php echo $version; ?>">
<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']; ?>
<style>
<?php if( $theme_config->link_description == "hide" ) { ?>
.link-content{
display:none;
}
.link-line{
height:56px;
}
<?php } ?>
</style>
</head> </head>
<?php <?php
// 根据cookie来设置mdui主题 // 根据cookie来设置mdui主题
@ -32,19 +42,10 @@
<!-- <button class="mdui-btn" mdui-drawer="{target: '#drawer'}"><i class="mdui-icon material-icons">home</i></button> --> <!-- <button class="mdui-btn" mdui-drawer="{target: '#drawer'}"><i class="mdui-icon material-icons">home</i></button> -->
<span class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white" mdui-drawer="{target: '#drawer', swipe: true}"><i class="mdui-icon material-icons">menu</i></span> <span class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white" mdui-drawer="{target: '#drawer', swipe: true}"><i class="mdui-icon material-icons">menu</i></span>
<!-- <a href="javascript:;" class="mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">home</i></a> --> <!-- <a href="javascript:;" class="mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">home</i></a> -->
<a href="/" class = "mdui-typo-headline" title = "<?php echo $site['description'] ?>"><span class="mdui-typo-title"><?php echo $site['title']; ?></span></a> <a href="/" class = "mdui-typo-headline" title = "<?php echo $site['description'] ?>"><span class="mdui-typo-title default-title"><h1><?php echo $site['title']; ?></h1></span></a>
<div class="mdui-toolbar-spacer"></div> <div class="mdui-toolbar-spacer"></div>
<!-- 搜索框 -->
<!-- <div class="mdui-col-lg-3">
<div class="mdui-textfield mdui-textfield-expandable mdui-float-right">
<button class="mdui-textfield-icon mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">search</i></button>
<input class="mdui-textfield-input search" type="text" placeholder="Search"/>
<button class="mdui-textfield-close mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">close</i></button>
</div>
</div> -->
<!-- 搜索框END -->
<!-- 新版搜索框 --> <!-- 新版搜索框 -->
<div class="mdui-col-md-4 mdui-col-xs-6"> <div class="mdui-col-md-3 mdui-col-xs-6">
<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" />
@ -168,13 +169,13 @@
<!--左侧抽屉导航END--> <!--左侧抽屉导航END-->
<!--正文内容部分--> <!--正文内容部分-->
<div class="mdui-container"> <div class="<?php echo ( $theme_config->full_width_mode == "off") ? "mdui-container" : "mdui-container-fluid"; ?>">
<!-- 搜索框 --> <!-- 搜索框 -->
<!-- <div class="mdui-row"> <!-- <div class="mdui-row">
<div class="mdui-col-xs-12"> <div class="mdui-col-xs-12" style = "z-index:99999;">
<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" type="text" /> <input class="mdui-textfield-input search" type="text" />
</div> </div>
</div> </div>
</div> --> </div> -->
@ -207,7 +208,7 @@
//var_dump($link); //var_dump($link);
?> ?>
<a href="/index.php?c=click&id=<?php echo $link['id']; ?>" target="_blank" title = "<?php echo $link['description']; ?>"> <a href="/index.php?c=click&id=<?php echo $link['id']; ?>" target="_blank" title = "<?php echo $link['description']; ?>">
<div class="mdui-col-lg-3 mdui-col-md-4 mdui-col-xs-12 link-space" id = "id_<?php echo $link['id']; ?>" link-title = "<?php echo $link['title']; ?>" link-url = "<?php echo $link['url']; ?>"> <div class="mdui-col-lg-2 mdui-col-md-3 mdui-col-sm-4 mdui-col-xs-6 link-space" id = "id_<?php echo $link['id']; ?>" link-title = "<?php echo $link['title']; ?>" link-url = "<?php echo $link['url']; ?>">
<!--定义一个卡片--> <!--定义一个卡片-->
<div class="mdui-card link-line mdui-hoverable"> <div class="mdui-card link-line mdui-hoverable">
<!-- 如果是私有链接,则显示角标 --> <!-- 如果是私有链接,则显示角标 -->
@ -219,7 +220,12 @@
<!-- 角标END --> <!-- 角标END -->
<div class="mdui-card-primary" style = "padding-top:16px;"> <div class="mdui-card-primary" style = "padding-top:16px;">
<div class="mdui-card-primary-title link-title"> <div class="mdui-card-primary-title link-title">
<img src="https://favicon.rss.ink/v1/<?php echo base64($link['url']); ?>" alt="HUAN" width="16" height="16"> <!-- 网站图标显示方式 -->
<?php if( $theme_config->favicon == "online") { ?>
<img src="https://favicon.rss.ink/v1/<?php echo base64($link['url']); ?>" alt="HUAN" width="16" height="16">
<?php }else{ ?>
<img src="/index.php?c=ico&text=<?php echo $link['title']; ?>" alt="" width="16" height="16" />
<?php } ?>
<span class="link_title"><?php echo $link['title']; ?></span> <span class="link_title"><?php echo $link['title']; ?></span>
</div> </div>
</div> </div>

20
templates/default/info.json

@ -1,9 +1,15 @@
{ {
"name":"OneNav默认主题", "name": "OneNav默认主题",
"description":"OneNav默认主题", "description": "OneNav默认主题",
"homepage":"https://www.xiaoz.me", "homepage": "https:\/\/www.xiaoz.me",
"version":"0.9.19", "help_url":"https://dwz.ovh/gnae4",
"update":"2022/04/22", "version": "0.9.20",
"author":"xiaoz<xiaoz93@outlook.com>", "update": "2022\/04\/29",
"screenshot":"https://img.rss.ink/imgs/2022/03/42ed3ef2c4a50f6d.png" "author": "xiaoz<xiaoz93@outlook.com>",
"screenshot": "https:\/\/img.rss.ink\/imgs\/2022\/03\/42ed3ef2c4a50f6d.png",
"config": {
"full_width_mode":"off",
"link_description":"show",
"favicon": "online"
}
} }

4
templates/default/static/style.css

@ -66,8 +66,12 @@ line-height:15px;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
} }
.default-title h1{
font-size: 1.2em;
}
.category-name{ .category-name{
padding-left:8px; padding-left:8px;
font-weight: bold;
} }
.category-name i { .category-name i {
padding-right:12px; padding-right:12px;

2
version.txt

@ -1 +1 @@
v0.9.19-20220424 v0.9.20-20220429
Loading…
Cancel
Save