SEO,域名绑定等
This commit is contained in:
parent
9a3faa0bd3
commit
97f2b926ac
@ -3,8 +3,8 @@
|
|||||||
> TaoLer是一个简单迅捷的轻论坛系统,适用于个人或组织区域型信息交流发布平台。
|
> TaoLer是一个简单迅捷的轻论坛系统,适用于个人或组织区域型信息交流发布平台。
|
||||||
|
|
||||||
* 官网:https://www.aieok.com
|
* 官网:https://www.aieok.com
|
||||||
* 版本:TaoLer 1.9.0
|
* 版本:TaoLer 1.9.1
|
||||||
* 日期:2022.3.16
|
* 日期:2022.4.16
|
||||||
|
|
||||||
webman版新架构已适配90%
|
webman版新架构已适配90%
|
||||||
|
|
||||||
@ -125,7 +125,7 @@
|
|||||||
|
|
||||||
参考官网分享文章
|
参考官网分享文章
|
||||||
|
|
||||||
aieok.com (http://wiki.aieok.com:888)
|
aieok.com (http://wiki.aieok.com)
|
||||||
|
|
||||||
#### 参与贡献
|
#### 参与贡献
|
||||||
|
|
||||||
|
@ -77,7 +77,16 @@ class Forum extends AdminController
|
|||||||
$res['msg'] = '';
|
$res['msg'] = '';
|
||||||
$res['count'] = $count;
|
$res['count'] = $count;
|
||||||
foreach($forumList as $k=>$v){
|
foreach($forumList as $k=>$v){
|
||||||
$res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'title'=>htmlspecialchars($v['title']),'content'=>htmlspecialchars($v['content']),'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'reply'=>$v['is_reply'],'check'=>$v['status']];
|
$indexUrl = $this->getIndexUrl();
|
||||||
|
$artUrl = (string) url('detail_id', ['id' => $v['aid']]);
|
||||||
|
if(empty(config('app.domain_bind'))) {
|
||||||
|
// 未绑定域名
|
||||||
|
$url = $indexUrl . str_replace('admin','index',$artUrl);
|
||||||
|
} else {
|
||||||
|
// 单独绑定域名
|
||||||
|
$url = $indexUrl . $artUrl;
|
||||||
|
}
|
||||||
|
$res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'title'=>htmlspecialchars($v['title']),'url'=>$url,'content'=>htmlspecialchars($v['content']),'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'reply'=>$v['is_reply'],'check'=>$v['status']];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
|
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
|
||||||
|
268
app/admin/controller/Seo.php
Normal file
268
app/admin/controller/Seo.php
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @Author: TaoLer <alipey_tao@qq.com>
|
||||||
|
* @Date: 2022-04-13 09:54:31
|
||||||
|
* @LastEditTime: 2022-04-17 16:55:13
|
||||||
|
* @LastEditors: TaoLer
|
||||||
|
* @Description: 搜索引擎SEO优化设置
|
||||||
|
* @FilePath: \TaoLer\app\admin\controller\Seo.php
|
||||||
|
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\common\controller\AdminController;
|
||||||
|
use think\facade\View;
|
||||||
|
use think\facade\Request;
|
||||||
|
use think\facade\Db;
|
||||||
|
use app\common\lib\SetArr;
|
||||||
|
|
||||||
|
class Seo extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if(is_file($rob = public_path().'robots.txt')){
|
||||||
|
$robots = file_get_contents($rob);
|
||||||
|
} else {
|
||||||
|
$robots = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
View::assign('robots',$robots);
|
||||||
|
return View::fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function push()
|
||||||
|
{
|
||||||
|
if(empty(config('taoler.baidu.push_api'))) return json(['code'=>-1,'msg'=>'请先配置接口push_api']);
|
||||||
|
$urls = [];
|
||||||
|
$artAllId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->column('id');
|
||||||
|
foreach($artAllId as $aid) {
|
||||||
|
$urls[] = $this->getRouteUrl($aid);
|
||||||
|
}
|
||||||
|
$api = config('taoler.baidu.push_api');
|
||||||
|
$ch = curl_init();
|
||||||
|
$options = array(
|
||||||
|
CURLOPT_URL => $api,
|
||||||
|
CURLOPT_POST => true,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_POSTFIELDS => implode("\n", $urls),
|
||||||
|
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
|
||||||
|
);
|
||||||
|
curl_setopt_array($ch, $options);
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
if($result == false) {
|
||||||
|
return json(['code'=>-1,'msg'=>'接口失败']);
|
||||||
|
}
|
||||||
|
$res = stripos($result,'error');
|
||||||
|
$data = json_decode($result);
|
||||||
|
if($res !== false) {
|
||||||
|
return json(['code'=>-1,'msg'=>$data->message]);
|
||||||
|
};
|
||||||
|
return json(['code'=>0,'msg'=>'成功推送'.$data->success.'条,今天剩余'.$data->remain]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function config()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
$baidu = [];
|
||||||
|
$data = Request::only(['client_id','client_secret','push_api']);
|
||||||
|
foreach($data as $k => $v) {
|
||||||
|
if($v !== ''){
|
||||||
|
if($k == 'push_api') {
|
||||||
|
$baidu[$k] = "'$v'";
|
||||||
|
} else {
|
||||||
|
$baidu[$k] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$res = (new SetArr('taoler'))::edit([
|
||||||
|
'baidu' => $baidu,
|
||||||
|
]);
|
||||||
|
if($res == true){
|
||||||
|
return json(['code'=>0,'msg'=>'设置成功']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百度谷歌sitemap生成xml文件
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function map()
|
||||||
|
{
|
||||||
|
$data = Request::only(['map_num','map_time','map_level']);
|
||||||
|
// 写文件字符串
|
||||||
|
$str = '';
|
||||||
|
// 标记第一次调用写ID
|
||||||
|
$flag= true;
|
||||||
|
// 写ID
|
||||||
|
$w_id = '';
|
||||||
|
// 新文件编号
|
||||||
|
$i = 1;
|
||||||
|
// 获取public下所有xml文件
|
||||||
|
$newFile = $this->getXmlFile(public_path());
|
||||||
|
// 没有xml文件时,不存在重写
|
||||||
|
if(empty($newFile)) {
|
||||||
|
$rewrite = false;
|
||||||
|
} else {
|
||||||
|
$xmlFile = end($newFile);
|
||||||
|
$strFile = file_get_contents(public_path().$xmlFile);
|
||||||
|
$num = substr_count($strFile, '<url>');
|
||||||
|
// 是否有需要追加在文件,判断最新文件是否未写满
|
||||||
|
$rewrite = $num < $data['map_num'] ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($rewrite){
|
||||||
|
// 需要追加的数量
|
||||||
|
$limit = (int) $data['map_num'] - $num;
|
||||||
|
$name = pathinfo($xmlFile,PATHINFO_FILENAME);
|
||||||
|
$arr = explode('_', $name);
|
||||||
|
// 检验当天,避免重复生成
|
||||||
|
if($arr[0] == date('Y-d-m'))
|
||||||
|
{
|
||||||
|
$i = $arr[1] + 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$limit = (int) $data['map_num'];
|
||||||
|
}
|
||||||
|
// 最新ID
|
||||||
|
$maxId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->max('id');
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$wr_id = $flag ? config('taoler.sitemap.write_id') : $w_id;
|
||||||
|
$artAllId = Db::name('article')
|
||||||
|
->where(['delete_time'=>0,'status'=>1])
|
||||||
|
->where('id', '>', (int) $wr_id)
|
||||||
|
->order('id','asc')->limit($limit)->column('update_time','id');
|
||||||
|
if(empty($artAllId)) {
|
||||||
|
return json(['code'=>-1,'msg'=>'本次无需生成']);
|
||||||
|
} else {
|
||||||
|
// 本次最新文件ID
|
||||||
|
$last_id = array_key_last($artAllId);
|
||||||
|
// 循环拼接文件字符串
|
||||||
|
foreach($artAllId as $aid => $uptime) {
|
||||||
|
// url生成
|
||||||
|
$url = $this->getRouteUrl($aid);
|
||||||
|
$time = date('Y-m-d', $uptime);
|
||||||
|
// 组装字符串
|
||||||
|
$str .= <<<STR
|
||||||
|
<url>
|
||||||
|
<loc>$url</loc>
|
||||||
|
<lastmod>$time</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>\n
|
||||||
|
STR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 写文件
|
||||||
|
if($rewrite){
|
||||||
|
// 写入旧xml文件
|
||||||
|
$reps = $str.'</urlset>';
|
||||||
|
$xml = preg_replace('/<\/urlset>/', $reps, $strFile);
|
||||||
|
$res = file_put_contents(public_path().$xmlFile, $xml);
|
||||||
|
if($res == false){
|
||||||
|
return json(['code'=>-1,'msg'=>$xmlFile.'写入失败']);
|
||||||
|
}
|
||||||
|
$limit = $data['map_num'];
|
||||||
|
$rewrite = false;
|
||||||
|
} else {
|
||||||
|
// 生成新xml
|
||||||
|
$xml = <<<XML
|
||||||
|
<?xml version="1.0" encoding="utf-8"?> <!-- XML文件需以utf-8编码-->
|
||||||
|
<urlset>\n$str</urlset>
|
||||||
|
XML;
|
||||||
|
$res = file_put_contents(public_path().date('Y-m-d').'_'.$i.'.xml', $xml);
|
||||||
|
if($res == false){
|
||||||
|
return json(['code'=>-1,'msg'=>date('Y-m-d').'_'.$i.'.xml写入失败']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 重置标记内容
|
||||||
|
$str = '';
|
||||||
|
$i++;
|
||||||
|
$w_id = $last_id;
|
||||||
|
$flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while($last_id < (int) $maxId);
|
||||||
|
// 写配置,标记最后写入ID
|
||||||
|
$res = (new SetArr('taoler'))::edit([
|
||||||
|
'sitemap' => [
|
||||||
|
'map_num' => $data['map_num'],
|
||||||
|
'write_id' => $last_id,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
if($res == false){
|
||||||
|
return json(['code'=>-1,'msg'=>'写xml配置失败']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json(['code'=>0,'msg'=>'生成xml成功']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回public目录下xml名称数组
|
||||||
|
*
|
||||||
|
* @param string $dir
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getXmlFile(string $dir) : array
|
||||||
|
{
|
||||||
|
$arr = [];
|
||||||
|
$files = array_diff(scandir($dir), array('.', '..'));
|
||||||
|
foreach ($files as $file) {
|
||||||
|
if(is_file("$dir/$file") && !is_link($dir) && (pathinfo("$dir/$file", PATHINFO_EXTENSION)) == 'xml')
|
||||||
|
{
|
||||||
|
$arr[] = "$file";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成robots
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function robots()
|
||||||
|
{
|
||||||
|
if(Request::isPost()){
|
||||||
|
$txt = input('robots');
|
||||||
|
$xmlArr = $this->getXmlFile(public_path());
|
||||||
|
foreach($xmlArr as $v) {
|
||||||
|
$res = stripos($txt, $v);
|
||||||
|
if($res == false){
|
||||||
|
$map = $this->getIndexUrl().'/'.$v;
|
||||||
|
$txt .= "\nsitemap:".$map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$res = file_put_contents(public_path().'robots.txt',$txt);
|
||||||
|
if($res == false){
|
||||||
|
return json(['code'=>-1,'msg'=>$v.'写入失败']);
|
||||||
|
}
|
||||||
|
return json(['code'=>0,'msg'=>'设置成功']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文章链接地址
|
||||||
|
*
|
||||||
|
* @param integer $aid
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getRouteUrl(int $aid) : string
|
||||||
|
{
|
||||||
|
$indexUrl = $this->getIndexUrl();
|
||||||
|
$artUrl = (string) url('detail_id', ['id' => $aid]);
|
||||||
|
if(empty(config('app.domain_bind'))) {
|
||||||
|
// 未绑定域名
|
||||||
|
$url = $indexUrl . str_replace('admin','index',$artUrl);
|
||||||
|
} else {
|
||||||
|
// 单独绑定域名
|
||||||
|
$url = $indexUrl . $artUrl;
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,7 +2,6 @@
|
|||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\common\controller\AdminController;
|
use app\common\controller\AdminController;
|
||||||
use think\exception\ValidateException;
|
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@ -11,8 +10,10 @@ use think\facade\Config;
|
|||||||
use app\admin\model\System;
|
use app\admin\model\System;
|
||||||
use app\admin\model\MailServer;
|
use app\admin\model\MailServer;
|
||||||
use taoler\com\Files;
|
use taoler\com\Files;
|
||||||
use taoler\com\Api;
|
|
||||||
use app\common\lib\SetConf;
|
use app\common\lib\SetConf;
|
||||||
|
use app\common\lib\SetArr;
|
||||||
|
use think\facade\Session;
|
||||||
|
use think\facade\Cookie;
|
||||||
|
|
||||||
class Set extends AdminController
|
class Set extends AdminController
|
||||||
{
|
{
|
||||||
@ -28,6 +29,20 @@ class Set extends AdminController
|
|||||||
$template = Files::getDirName('../view');
|
$template = Files::getDirName('../view');
|
||||||
$email = Db::name('admin')->where('id',1)->value('email');
|
$email = Db::name('admin')->where('id',1)->value('email');
|
||||||
View::assign(['sysInfo'=>$this->sysInfo,'mailserver'=>$mailserver,'template'=>$template,'email'=>$email]);
|
View::assign(['sysInfo'=>$this->sysInfo,'mailserver'=>$mailserver,'template'=>$template,'email'=>$email]);
|
||||||
|
if(!empty(config('app.domain_bind'))){
|
||||||
|
$data = array_flip(config('app.domain_bind'));
|
||||||
|
$domain_bind = [
|
||||||
|
'index' => isset($data['index']) ? $data['index'] : '',
|
||||||
|
'admin' => isset($data['admin']) ? $data['admin'] : '',
|
||||||
|
];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$domain_bind = [
|
||||||
|
'index' => '',
|
||||||
|
'admin' => '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
View::assign($domain_bind);
|
||||||
return View::fetch('set/system/website');
|
return View::fetch('set/system/website');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +61,44 @@ class Set extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 域名绑定
|
||||||
|
public function setDomain()
|
||||||
|
{
|
||||||
|
if(Request::isPost()){
|
||||||
|
//$data = Request::only(['index','admin']);
|
||||||
|
$data = Request::param();
|
||||||
|
//dump($data);
|
||||||
|
if($data['domain_check'] == 'on') {
|
||||||
|
unset($data['domain_check']);
|
||||||
|
$data = array_flip($data);
|
||||||
|
if(empty(config('app.domain_bind'))){
|
||||||
|
// 写入token
|
||||||
|
$res = (new SetArr('app'))::add([
|
||||||
|
'domain_bind'=> $data,
|
||||||
|
]);
|
||||||
|
}else{
|
||||||
|
// 编辑
|
||||||
|
$res = (new SetArr('app'))::edit([
|
||||||
|
'domain_bind'=> $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
//清空缓存
|
||||||
|
Cookie::delete('adminAuth');
|
||||||
|
Session::clear();
|
||||||
|
} else {
|
||||||
|
$res = (new SetArr('app'))::delete([
|
||||||
|
'domain_bind'=> config('app.domain_bind'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if($res == true){
|
||||||
|
return json(['code'=>0,'msg'=>'成功']);
|
||||||
|
} else{
|
||||||
|
return json(['code'=>-1,'msg'=>'失败']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//综合设置
|
//综合设置
|
||||||
public function server()
|
public function server()
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@ use think\facade\Config;
|
|||||||
use think\facade\Log;
|
use think\facade\Log;
|
||||||
use app\common\lib\ZipFile;
|
use app\common\lib\ZipFile;
|
||||||
use app\common\lib\SetConf;
|
use app\common\lib\SetConf;
|
||||||
|
use app\common\lib\SetArr;
|
||||||
use app\common\lib\SqlFile;
|
use app\common\lib\SqlFile;
|
||||||
use app\common\lib\Zip;
|
use app\common\lib\Zip;
|
||||||
|
|
||||||
|
@ -12,4 +12,5 @@ use think\facade\Route;
|
|||||||
//Route::get('jie/:id','index/article/detail');
|
//Route::get('jie/:id','index/article/detail');
|
||||||
|
|
||||||
Route::get('captcha/[:config]','\\think\\captcha\\CaptchaController@index');
|
Route::get('captcha/[:config]','\\think\\captcha\\CaptchaController@index');
|
||||||
Route::get('jie/:id', 'article/detail');
|
//Route::get('jie/:id', '\app\index\controller\Article@detail')->name('detail_id');
|
||||||
|
Route::get('jie/:id', 'index/Article/detail')->name('detail_id');
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
<img style="display: inline-block; width: 50%; height: 100%;" src= "{{ d.avatar }}">
|
<img style="display: inline-block; width: 50%; height: 100%;" src= "{{ d.avatar }}">
|
||||||
</script>
|
</script>
|
||||||
<script type="text/html" id="title">
|
<script type="text/html" id="title">
|
||||||
<a href="{$domain}/jie/{{d.id}}.html" target="_blank">{{d.title}}</a>
|
<a href="{{ d.url }}" target="_blank">{{d.title}}</a>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/html" id="buttonTpl">
|
<script type="text/html" id="buttonTpl">
|
||||||
{{# if(d.top == 1){ }}
|
{{# if(d.top == 1){ }}
|
||||||
|
204
app/admin/view/seo/index.html
Normal file
204
app/admin/view/seo/index.html
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
{extend name="public/base" /}
|
||||||
|
|
||||||
|
{block name="body"}
|
||||||
|
<div class="layui-fluid" id="component-tabs">
|
||||||
|
<div class="layui-row">
|
||||||
|
<div class="layui-col-md12">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body">
|
||||||
|
|
||||||
|
<div class="layui-tab layui-tab-card" lay-filter="seo-tabs-brief">
|
||||||
|
<ul class="layui-tab-title">
|
||||||
|
<li class="layui-this" lay-id="push">百度推送</li>
|
||||||
|
<li lay-id="map">站点地图</li>
|
||||||
|
<li lay-id="robots">robots</li>
|
||||||
|
<li lay-id="config">* 接口配置</li>
|
||||||
|
</ul>
|
||||||
|
<div class="layui-tab-content">
|
||||||
|
<div class="layui-tab-item layui-show">
|
||||||
|
<div class="layui-form" wid100 lay-filter="push">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">链接提交</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
{if condition="checkRuleButton('Seo/push')"}
|
||||||
|
<button class="layui-btn" lay-submit lay-filter="search_push">提交推送</button>
|
||||||
|
{else /}
|
||||||
|
<button class="layui-btn layui-btn-disabled">提交推送</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-tab-item">
|
||||||
|
<div class="layui-form" wid100 lay-filter="map">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">限定数量</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="map_num" value="{:config('taoler.sitemap.map_num')}" placeholder="推荐5000" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">单个map文件xml数量</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">更新频率</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="map_time" value="" placeholder="daily" class="layui-input">
|
||||||
|
</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="text" name="map_level" value="" placeholder="默认0.5" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">0.0-1.0之间</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<button class="layui-btn" lay-submit lay-filter="map_xml">生成</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="layui-tab-item">
|
||||||
|
<div class="layui-form" wid100 lay-filter="robots">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">内容</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<textarea type="text" name="robots" placeholder="请正确填写robots内容" class="layui-textarea" style="height: 500px;">{$robots}</textarea>
|
||||||
|
<div class="layui-form-mid layui-word-aux">会自动写入sitemap的链接</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<button class="layui-btn" lay-submit lay-filter="robots_submit">生成</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-tab-item">
|
||||||
|
<div class="layui-form" wid100 lay-filter="config">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">key</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="client_id" value="{:config('taoler.baidu.client_id')}" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">百度分词API Key</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">secret</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="client_secret" value="{:config('taoler.baidu.client_secret')}" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">百度分词Secret Key</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">收录token</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="push_api" value="{:config('taoler.baidu.push_api')}" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">百度准入密钥</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<button class="layui-btn" lay-submit lay-filter="baidu_config">确认保存</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="js"}
|
||||||
|
<script>
|
||||||
|
var setWebSite ="{:url('Set/website')}";
|
||||||
|
var setEmail ="{:url('Set/email')}";
|
||||||
|
layui.config({
|
||||||
|
base: '/static/admin/' //静态资源所在路径
|
||||||
|
}).extend({
|
||||||
|
index: 'lib/index' //主入口模块
|
||||||
|
}).use(['index'], function(){
|
||||||
|
var $ = layui.$
|
||||||
|
,form = layui.form
|
||||||
|
var element =layui.element ;
|
||||||
|
|
||||||
|
// baidu push
|
||||||
|
form.on('submit(search_push)', function(data){
|
||||||
|
//var field = data.field;
|
||||||
|
$.post("{:url('seo/push')}",function(res){
|
||||||
|
if(res.code == 0){
|
||||||
|
layer.msg(res.msg,{icon:6,tiye:2000
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
//网站配置
|
||||||
|
form.on('submit(baidu_config)', function(data){
|
||||||
|
var field = data.field;
|
||||||
|
$.post("{:url('seo/config')}",field,function(res){
|
||||||
|
if(res.code == 0){
|
||||||
|
layer.msg(res.msg,{icon:6,tiye:2000
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// map
|
||||||
|
form.on('submit(map_xml)', function(data){
|
||||||
|
var field = data.field;
|
||||||
|
$.post("{:url('seo/map')}",field,function(res){
|
||||||
|
if(res.code == 0){
|
||||||
|
layer.msg(res.msg,{icon:6,tiye:2000
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// map
|
||||||
|
form.on('submit(robots_submit)', function(data){
|
||||||
|
var field = data.field;
|
||||||
|
$.post("{:url('seo/robots')}",field,function(res){
|
||||||
|
if(res.code == 0){
|
||||||
|
layer.msg(res.msg,{icon:6,tiye:2000
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//显示当前tab
|
||||||
|
if(location.hash){
|
||||||
|
element.tabChange('seo-tabs-brief', location.hash.replace(/^#/, ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
element.on('tab(seo-tabs-brief)', function(){
|
||||||
|
var othis = $(this), layid = othis.attr('lay-id');
|
||||||
|
if(layid){
|
||||||
|
location.hash = layid;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
@ -12,10 +12,11 @@
|
|||||||
<li class="layui-this" lay-id="website">网站设置</li>
|
<li class="layui-this" lay-id="website">网站设置</li>
|
||||||
<li lay-id="email">邮箱服务</li>
|
<li lay-id="email">邮箱服务</li>
|
||||||
<li lay-id="config">服务配置</li>
|
<li lay-id="config">服务配置</li>
|
||||||
|
<li lay-id="domain">域名绑定</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="layui-tab-content">
|
<div class="layui-tab-content">
|
||||||
<div class="layui-tab-item layui-show">
|
<div class="layui-tab-item layui-show">
|
||||||
<div class="layui-form" wid100 lay-filter="">
|
<div class="layui-form" wid100 lay-filter="website">
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">网站名称</label>
|
<label class="layui-form-label">网站名称</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
@ -128,7 +129,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-tab-item">
|
<div class="layui-tab-item">
|
||||||
<div class="layui-form" wid100 lay-filter="">
|
<div class="layui-form" wid100 lay-filter="emai">
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">SMTP服务器</label>
|
<label class="layui-form-label">SMTP服务器</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
@ -260,6 +261,46 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-tab-item">
|
||||||
|
<div class="layui-form" wid100 lay-filter="domain">
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">多域名开关</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="checkbox" name="domain_check" lay-skin="switch" lay-filter="domain_check" lay-text="开启|关闭" {if empty(config('app.domain_bind')) == false} checked {/if}>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="set_domain" class="{if empty(config('app.domain_bind')) == true} layui-hide {/if}">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">Index前端</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="index" {if(!empty(config('app.domain_bind'))) } value="{$index}" {/if} class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">如:www.aieok.com</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">Admin后端</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="admin" {if(!empty(config('app.domain_bind'))) } value="{$admin}" {/if} class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">如:admin.aieok.com</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
{if condition="checkRuleButton('admin/Set/email')"}
|
||||||
|
<button class="layui-btn" lay-submit lay-filter="set_system_domain">确认保存</button>
|
||||||
|
{else /}<button class="layui-btn layui-btn-disabled">确认保存</button>{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -345,6 +386,43 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//网站配置
|
||||||
|
form.on('submit(set_system_domain)', function(data){
|
||||||
|
var field = data.field;
|
||||||
|
$.post("{:url('admin/set/setDomain')}",field,function(res){
|
||||||
|
if(res.code == 0){
|
||||||
|
layer.msg(res.msg,{icon:6,tiye:2000
|
||||||
|
}, function(){
|
||||||
|
parent.location.href = '/';
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
form.on('switch(domain_check)', function(data){
|
||||||
|
var data = data.elem;
|
||||||
|
status = data.checked ? 'on' : 'off';
|
||||||
|
if(status == 'on'){
|
||||||
|
$('#set_domain').removeClass('layui-hide');
|
||||||
|
} else {
|
||||||
|
$('#set_domain').addClass('layui-hide');
|
||||||
|
$.post("{:url('admin/set/setDomain')}",{"domain_check":status},function(res){
|
||||||
|
if(res.code == 0){
|
||||||
|
layer.msg(res.msg,{icon:6,tiye:2000
|
||||||
|
}, function(){
|
||||||
|
parent.location.href = '/';
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
});
|
||||||
//显示当前tab
|
//显示当前tab
|
||||||
if(location.hash){
|
if(location.hash){
|
||||||
element.tabChange('website-tabs-brief', location.hash.replace(/^#/, ''));
|
element.tabChange('website-tabs-brief', location.hash.replace(/^#/, ''));
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
<option {if condition="$slider.slid_type eq 7"} selected {/if} value="7">7详情赞助</option>
|
<option {if condition="$slider.slid_type eq 7"} selected {/if} value="7">7详情赞助</option>
|
||||||
<option {if condition="$slider.slid_type eq 8"} selected {/if} value="8">8温馨通道</option>
|
<option {if condition="$slider.slid_type eq 8"} selected {/if} value="8">8温馨通道</option>
|
||||||
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="9">9友情链接</option>
|
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="9">9友情链接</option>
|
||||||
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="10">10头部菜单</option>
|
<option {if condition="$slider.slid_type eq 10"} selected {/if} value="10">10头部菜单</option>
|
||||||
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="11">11页脚链接</option>
|
<option {if condition="$slider.slid_type eq 11"} selected {/if} value="11">11页脚链接</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -91,7 +91,11 @@ function getCateDesc($ename)
|
|||||||
//过滤文章摘要
|
//过滤文章摘要
|
||||||
function getArtContent($content)
|
function getArtContent($content)
|
||||||
{
|
{
|
||||||
return mb_substr(strip_tags($content),0,50).'...';
|
// 过滤音视频图片
|
||||||
|
$content = preg_replace('/[(img)|(audio)|(video)]+(\(\S+\))?\[\S+\]/','',$content);
|
||||||
|
$content = preg_replace('/\s*/','',$content);
|
||||||
|
$content = preg_replace('/\[[^\]]+\]/','',$content);
|
||||||
|
return mb_substr(strip_tags($content),0,150).'...';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@ declare (strict_types = 1);
|
|||||||
|
|
||||||
namespace app\common\controller;
|
namespace app\common\controller;
|
||||||
|
|
||||||
use think\Controller;
|
|
||||||
use think\App;
|
|
||||||
use think\facade\Session;
|
use think\facade\Session;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@ -37,14 +35,24 @@ class AdminController extends \app\BaseController
|
|||||||
protected function getMenu()
|
protected function getMenu()
|
||||||
{
|
{
|
||||||
$menu = [];
|
$menu = [];
|
||||||
$admin_id = Session::get('admin_id');
|
$admin_id = $this->aid;
|
||||||
$auth = new Auth();
|
$auth = new Auth();
|
||||||
|
|
||||||
$auth_rule_list = Db::name('auth_rule')->where(['status'=> 1,'ishidden'=>1])->order(['sort' => 'asc'])->select();
|
$auth_rule_list = Db::name('auth_rule')->where('delete_time',0)->where(['status'=> 1,'ishidden'=>1])->order(['sort' => 'asc'])->select();
|
||||||
//var_export($auth_rule_list);
|
//var_export($auth_rule_list);
|
||||||
|
|
||||||
foreach ($auth_rule_list as $value) {
|
foreach ($auth_rule_list as $value) {
|
||||||
if ($auth->check($value['name'], $admin_id) || $admin_id == 1) {
|
if ($auth->check($value['name'], $admin_id) || $admin_id == 1) {
|
||||||
|
// 查询是否设置映射
|
||||||
|
// $map = array_search('admin',config('app.app_map'));
|
||||||
|
// //dump($map,$value);
|
||||||
|
// //stripos($value);
|
||||||
|
// if($map){
|
||||||
|
// $menu[] = strtr($value,'admin',$map);
|
||||||
|
// } else {
|
||||||
|
// $menu[] = $value;
|
||||||
|
// }
|
||||||
|
//dump($menu);
|
||||||
$menu[] = $value;
|
$menu[] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,7 +67,7 @@ class AdminController extends \app\BaseController
|
|||||||
protected function getMenus($type)
|
protected function getMenus($type)
|
||||||
{
|
{
|
||||||
$menu = [];
|
$menu = [];
|
||||||
$auth_rule_list = Db::name('auth_rule')->where(['status'=> 1])->where('type',$type)->order(['sort' => 'ASC', 'id' => 'ASC'])->select();
|
$auth_rule_list = Db::name('auth_rule')->where('delete_time',0)->where(['status'=> 1])->where('type',$type)->order(['sort' => 'ASC', 'id' => 'ASC'])->select();
|
||||||
//var_export($auth_rule_list);
|
//var_export($auth_rule_list);
|
||||||
|
|
||||||
foreach ($auth_rule_list as $value) {
|
foreach ($auth_rule_list as $value) {
|
||||||
@ -109,6 +117,7 @@ class AdminController extends \app\BaseController
|
|||||||
$syscy = $sys['clevel'] ? Lang::get('Authorized') : Lang::get('Free version');
|
$syscy = $sys['clevel'] ? Lang::get('Authorized') : Lang::get('Free version');
|
||||||
$runTime = $this->getRunTime();
|
$runTime = $this->getRunTime();
|
||||||
View::assign(['domain'=>$domain,'insurl'=>$sys['domain'],'syscy'=>$syscy,'clevel'=>$sys['clevel'],'runTime'=>$runTime]);
|
View::assign(['domain'=>$domain,'insurl'=>$sys['domain'],'syscy'=>$syscy,'clevel'=>$sys['clevel'],'runTime'=>$runTime]);
|
||||||
|
return $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRunTime()
|
protected function getRunTime()
|
||||||
|
@ -54,7 +54,7 @@ class BaseController extends BaseCtrl
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// 显示导航
|
// 显示导航
|
||||||
protected function showNav()
|
protected function showNav()
|
||||||
{
|
{
|
||||||
//1.查询分类表获取所有分类
|
//1.查询分类表获取所有分类
|
||||||
|
952
app/common/lib/SetArr.php
Normal file
952
app/common/lib/SetArr.php
Normal file
@ -0,0 +1,952 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @Author: TaoLer <alipey_tao@qq.com>
|
||||||
|
* @Date: 2022-04-10 14:13:41
|
||||||
|
* @LastEditTime: 2022-04-16 11:30:02
|
||||||
|
* @LastEditors: TaoLer
|
||||||
|
* @Description: 搜索引擎SEO优化设置
|
||||||
|
* @FilePath: \TaoLer\app\common\lib\SetArr.php
|
||||||
|
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
|
||||||
|
*/
|
||||||
|
namespace app\common\lib;
|
||||||
|
|
||||||
|
|
||||||
|
class SetArr
|
||||||
|
{
|
||||||
|
protected static string $str = '';
|
||||||
|
protected static string $configName = '';
|
||||||
|
protected static string $configFile = '';
|
||||||
|
|
||||||
|
function __construct(string $configName)
|
||||||
|
{
|
||||||
|
self::$configName = $configName;
|
||||||
|
self::$configFile = app()->getConfigPath() . $configName . '.php';
|
||||||
|
self::$str = file_get_contents(self::$configFile); //加载配置文件
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配置
|
||||||
|
* @param string $file
|
||||||
|
* @param array $data
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
function setConfig(string $file,array $data=[])
|
||||||
|
{
|
||||||
|
if (is_array($data)){
|
||||||
|
$fileurl = app()->getConfigPath() . $file.".php";
|
||||||
|
$string = file_get_contents($fileurl); //加载配置文件
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if(is_array($value)){//二维数组
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
if(is_int($v)){//数字类型
|
||||||
|
$pats = '/\'' . $k . '\'(.*?),/';
|
||||||
|
$reps = "'". $k. "'". " => " . $v .",";
|
||||||
|
//halt($reps);
|
||||||
|
}else{//字符类型
|
||||||
|
$pats = '/\'' . $k . '\'(.*?)\',/';
|
||||||
|
$reps = "'". $k. "'". " => " . "'".$v ."',";
|
||||||
|
}
|
||||||
|
|
||||||
|
$string = preg_replace($pats, $reps, $string); // 正则查找然后替换
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{//一维数组
|
||||||
|
|
||||||
|
if(is_int($value)){//数字类型
|
||||||
|
$pats = '/\'' . $key . '\'(.*?),/';
|
||||||
|
$reps = "'". $key. "'". " => " . "".$value .",";
|
||||||
|
}else{//字符类型
|
||||||
|
$pats = '/\'' . $key . '\'(.*?)\',/';
|
||||||
|
$reps = "'". $key. "'". " => " . "'".$value ."',";
|
||||||
|
}
|
||||||
|
|
||||||
|
$string = preg_replace($pats, $reps, $string); // 正则查找然后替换
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
file_put_contents($fileurl, $string); // 写入配置文件
|
||||||
|
}
|
||||||
|
catch (\Exception $e) {
|
||||||
|
// 这是进行异常捕获
|
||||||
|
//$e->getMessage();
|
||||||
|
return json(['code'=>-1,'msg'=> $file . '无写入权限']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json(['code'=>0,'msg'=>'配置修改成功']);
|
||||||
|
}else{
|
||||||
|
return json(['code'=>-1,'msg'=>'配置项错误!']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配置项,支持三级数组配置
|
||||||
|
*
|
||||||
|
* @param array $arr
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function add(array $arr) :bool
|
||||||
|
{
|
||||||
|
//dump(self::$str);
|
||||||
|
//正则];数组结尾
|
||||||
|
$end = '/\];/';
|
||||||
|
//一级配置,内容追加到return [一级配置,之后
|
||||||
|
$start = self::getArrSonCount(config(self::$configName)) ? '/return\s*\[[^\[|\]]*,\r?\n/' : '/return\s*\[\r?\n?/';
|
||||||
|
if(is_array($arr)) {
|
||||||
|
foreach ($arr as $k => $v)
|
||||||
|
{
|
||||||
|
if(!is_array($v)) {
|
||||||
|
preg_match($start,self::$str,$arrstart);
|
||||||
|
if(is_int($k)) {
|
||||||
|
// 数值数组
|
||||||
|
if(is_string($v)){
|
||||||
|
|
||||||
|
// 类、函数、注释,原样写入
|
||||||
|
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||||
|
$reps = $arrstart[0]. "\t'". $v ."',\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrstart[0]. "\t". $v .",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($v)) {
|
||||||
|
$reps = ($v == true) ? $arrstart[0]."\ttrue,\n" : $arrstart[0]."\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrstart[0]."\t".$v . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 键值关联数组
|
||||||
|
//判断是否存在KEY
|
||||||
|
if (array_key_exists($k,config(self::$configName))) {
|
||||||
|
echo $k.'不能添加已存在的配置项';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($v)){
|
||||||
|
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||||
|
$reps = $arrstart[0]."\t'" . $k . "' => '" . $v ."',\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrstart[0]."\t'" . $k . "' => " . $v .",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($v)) {
|
||||||
|
$reps = ($v == true) ? $arrstart[0]."\t'" . $k . "' => true,\n" : $arrstart[0]."\t'" . $k . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrstart[0]."\t'" . $k . "' => " . $v .",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$str = preg_replace($start, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// $v是数组,存在多级配置
|
||||||
|
|
||||||
|
// $k不存在,新增二级配置数组, 数组插入];之前
|
||||||
|
if (!array_key_exists($k,config(self::$configName))) {
|
||||||
|
// 拼接数组内元素
|
||||||
|
$sonArr = '';
|
||||||
|
foreach($v as $kk => $vv) {
|
||||||
|
// 1.$vv不是数组,新增配置只有二级元素
|
||||||
|
if(!is_array($vv)) {
|
||||||
|
if(!is_int($kk)) {
|
||||||
|
// 键值对数组
|
||||||
|
if(is_int($vv)) {
|
||||||
|
$sonArr .= "\t\t'". $kk. "' => " . $vv . ",\n";
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArr .= ($vv == true) ? "\t\t'" . $kk . "' => true,\n" : "\t\t'" . $kk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$sonArr .= "\t\t'". $kk. "' => '" . $vv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArr .= "\t\t'". $kk. "' => " . $vv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 数值数组
|
||||||
|
if(is_string($vv)) {
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$sonArr .= "\t\t'" . $vv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArr .= "\t\t" . $vv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArr .= ($vv == true) ? "\t\ttrue,\n" :"\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArr .= "\t\t" . $vv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 2.$vv是数组,新增中包含三级、四级子数组
|
||||||
|
$sonArrson = '';
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
// $vvv不是数组,三级非数组
|
||||||
|
if(!is_array($vvv)){
|
||||||
|
if(!is_int($kkk)) {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
$sonArrson .= ($vvv == true) ? "\t\t\t'". $kkk. "' => true,\n" : "\t\t\t'". $kkk. "' =>false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$sonArrson .= "\t\t\t'" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
$sonArrson .= ($vvv == true) ? "\t\t\ttrue,\n" : "\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//$vvv是数组,但不支持子数组
|
||||||
|
$sonArrsonArr = '';
|
||||||
|
foreach($vvv as $kkkk =>$vvvv) {
|
||||||
|
if(is_array($vvvv)) {
|
||||||
|
echo $kkkk."不支持四级数组\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_int($kkkk)) {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => '" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'". $kkkk . "' => true,\n" : "\t\t\t\t'". $kkkk. "' =>false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => [\n".$sonArrsonArr."\t\t\t],\n";
|
||||||
|
//echo "不支持".$kkkk."是数组";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sonArr .= "\t\t'". $kk. "' => [\n".$sonArrson."\t\t],\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$reps = "\t'". $k. "' => [\n".$sonArr."\t],\n];";
|
||||||
|
self::$str = preg_replace($end, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// $k已存在,二级配置是数组,需要添加二级或三数组元素
|
||||||
|
|
||||||
|
// 把$v的子元素追加在匹配$k => [之后
|
||||||
|
// //匹配$k => [
|
||||||
|
// $kpats = '/\''.$k.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
// preg_match($kpats,self::$str,$arrk);
|
||||||
|
// 新增二级配置
|
||||||
|
|
||||||
|
// 往数组中追加子元素
|
||||||
|
foreach ($v as $kk => $vv) {
|
||||||
|
// 1. $vv不是数组
|
||||||
|
if(!is_array($vv)) {
|
||||||
|
// 新建二级配置
|
||||||
|
|
||||||
|
//匹配$k => [ ***,
|
||||||
|
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[]*,[^\]]/';
|
||||||
|
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
// 添加一维数组,数组中有元素匹配到最后一个数组,没有数组,匹配到数组开头[
|
||||||
|
$kpats = self::getArrSonCount(config(self::$configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
preg_match($kpats,self::$str,$arrk);
|
||||||
|
//halt($arrk);
|
||||||
|
if(!is_int($kk)) {
|
||||||
|
if(array_key_exists($kk,config(self::$configName.'.'.$k))) {
|
||||||
|
echo $kk.'不能添加已存在的配置项kk';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($vv)) {
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$reps = $arrk[0]."\t\t'". $kk. "' => '" . $vv . "',\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrk[0]."\t\t'". $kk. "' => " . $vv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
//布尔
|
||||||
|
$reps = ($vv == true) ? $arrk[0]."\t\t'" . $kk . "' => true,\n" : $arrk[0]."\t\t'" . $kk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrk[0]."\t\t'". $kk. "' => " . $vv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vv)) {
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$reps = $arrk[0] ."\t\t'" . $vv . "',\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrk[0] ."\t\t" . $vv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
$reps = ($vv == true) ? $arrk[0] . "\t\ttrue,\n" : $arrk[0] . "\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrk[0]."\t\t". $vv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$str = preg_replace($kpats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 2. $vv是数组
|
||||||
|
|
||||||
|
// 匹配到数组内部的后面
|
||||||
|
$sonArrnum = self::getArrSonNum(config(self::$configName.'.'.$k));
|
||||||
|
if($sonArrnum > 0) {
|
||||||
|
// 数组存在子数组,匹配到最后一个数组],\n后面
|
||||||
|
$kpats = '/\''.$k.'\'([^\]]*\]){'.$sonArrnum.'},\r?\n/';
|
||||||
|
} else {
|
||||||
|
// 没有子数组
|
||||||
|
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
$kpats = self::getArrSonCount(config(self::$configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
}
|
||||||
|
preg_match($kpats,self::$str,$arrk);
|
||||||
|
//dump($sonArrnum,$arrk);
|
||||||
|
// a.$vv数组不存在,新建数组及它的子数组$kkk
|
||||||
|
if(!array_key_exists($kk,config(self::$configName . '.' . $k))) {
|
||||||
|
|
||||||
|
$sonArrson = '';
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
// $vvv不是数组
|
||||||
|
if(!is_array($vvv)) {
|
||||||
|
if(!is_int($kkk)) {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArrson .= ($vvv == true) ? "\t\t\t'" . $kkk . "' => true,\n" : "\t\t\t'" . $kkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$sonArrson .= "\t\t\t'" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t".$vvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArrson .= ($vvv == true) ? "\t\t\ttrue,\n" : "\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// $vvv是数组
|
||||||
|
$sonArrsonArr = '';
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
if(!is_int($kkkk)) {
|
||||||
|
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
|
||||||
|
echo $kkkk."已存在?";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => '" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'" . $kkkk . "' => true,\n" : "\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sonArrson .= "\t\t\t'".$kkk."' => [\n" . $sonArrsonArr . "\t\t\t],\n";
|
||||||
|
//echo '不支持4级数组';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$reps = $arrk[0]."\t\t'". $kk. "' => [\n".$sonArrson."\t\t],\n";
|
||||||
|
self::$str = preg_replace($kpats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// b.$vv数组已存在
|
||||||
|
// 匹配包含$k $kk=>[
|
||||||
|
// $kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[^\[]*\[\r?\n/';
|
||||||
|
// preg_match($kkpats,self::$str,$arrkk);
|
||||||
|
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
//halt(123,$arrkk[0]);
|
||||||
|
// $vvv不是数组,追加$kkk
|
||||||
|
if(!is_array($vvv)) {
|
||||||
|
// 匹配包含$k $kk=>[ ***,
|
||||||
|
//$kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[^\[]*\[\r?\n/';
|
||||||
|
//$kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'\s*=>\s*\[[^\[|\]]*,/';
|
||||||
|
$kkpats = self::getArrSonCount(config(self::$configName.'.'.$k.'.'.$kk)) ? '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kk.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
preg_match($kkpats,self::$str,$arrkk);
|
||||||
|
//halt($arrkk);
|
||||||
|
if(!is_int($kkk)) {
|
||||||
|
//判断第三级key是否存在
|
||||||
|
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||||
|
echo $kkk.'不能添加已存在的配置项kkk';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
$repsk = ($vvv == true) ? $arrkk[0]."\t\t\t'" . $kkk . "' => true,\n" : $arrkk[0]."\t\t\t'" . $kkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t'" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
$repsk = ($vvv == true) ? $arrkk[0]."\t\t\ttrue,\n" : $arrkk[0]."\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$str = preg_replace($kkpats,$repsk, self::$str);
|
||||||
|
} else {
|
||||||
|
// $vvv是数组,a.数组存在,b.数组不存在
|
||||||
|
|
||||||
|
//a. $kkk数组存在
|
||||||
|
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||||
|
//匹配包含$k $kk $kkk 到]的内容
|
||||||
|
//$sonPats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[\s\S]*?(?:'.$kkk.')\' [^\]]*/';
|
||||||
|
//[\s\S]*?(?:'.$kkk.')\'(.*),/
|
||||||
|
|
||||||
|
// $k3pats = '/\'' . $kk k. '\'[\s\S]*?(?:'.$kkk.')\'\s*=>\s*\[\r?\n/';
|
||||||
|
// 正则到数组内的元素,不包含子数组
|
||||||
|
//$k3pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
$k3pats = self::getArrSonCount(config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk)) ? '/\''.$kkk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kkk.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
preg_match($k3pats,self::$str,$arrk3);
|
||||||
|
//halt($arrk3);
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
preg_match($k3pats,self::$str,$arrk3);
|
||||||
|
if(!is_int($kkkk)) {
|
||||||
|
// 多维数组
|
||||||
|
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
|
||||||
|
echo $kkkk."已存在k4";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => '" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonReps = ($vvvv == true) ? $arrk3[0]."\t\t\t\t'" . $kkkk . "' => true,\n" : $arrk3[0]."\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 数值数组
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t'" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonReps = ($vvvv == true) ? $arrk3[0]."\t\t\t\ttrue,\n" : $arrk3[0]."\t\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$str = preg_replace($k3pats,$sonReps, self::$str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// b. $kkk不存在
|
||||||
|
|
||||||
|
// 匹配到数组内部的后面k
|
||||||
|
$sonArrnum = self::getArrSonNum(config(self::$configName.'.'.$k.'.'.$kk));
|
||||||
|
if($sonArrnum > 0) {
|
||||||
|
// 数组存在子数组,匹配到最后一个数组],\n后面
|
||||||
|
$kkpats = '/\''.$kk.'\'([^\]]*\]){'.$sonArrnum.'},\r?\n/';
|
||||||
|
} else {
|
||||||
|
// 没有子数组k
|
||||||
|
//$kkpats = '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
$kkpats = self::getArrSonCount(config(self::$configName.'.'.$k.'.'.$kk)) ? '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kk.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
}
|
||||||
|
preg_match($kkpats,self::$str,$arrkk);
|
||||||
|
//halt($arrkk);
|
||||||
|
$sonArrsonArr = '';
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
if(is_array($vvvv)) {
|
||||||
|
echo '不支持四级数组';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!is_int($kkkk)) {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => '" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'" . $kkkk . "' => true,\n" : "\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$reps = $arrkk[0]."\t\t\t'".$kkk."' => [\n" . $sonArrsonArr . "\t\t\t],\n";
|
||||||
|
self::$str = preg_replace($kkpats,$reps, self::$str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//写入配置
|
||||||
|
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑配置数组表
|
||||||
|
* 一位数组修改请用delete和add组合
|
||||||
|
* 仅支持键值对的数组修改
|
||||||
|
*
|
||||||
|
* @param array $arr
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function edit($arr) :bool
|
||||||
|
{
|
||||||
|
|
||||||
|
// 只能修改有键值对的数组
|
||||||
|
if(!is_array($arr)) return false;
|
||||||
|
|
||||||
|
foreach($arr as $k => $v) {
|
||||||
|
// key不存在
|
||||||
|
if(!array_key_exists($k,config(self::$configName))) {
|
||||||
|
echo $k.'不存在 ';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 一级数组修改
|
||||||
|
if(!is_array($v)) {
|
||||||
|
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arr);
|
||||||
|
//halt($arr);
|
||||||
|
if(is_string($v)){
|
||||||
|
// 字符串
|
||||||
|
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||||
|
$repk = "'". $k . "' => '" . $v . "',";
|
||||||
|
} else {
|
||||||
|
$repk = "'". $k . "' => " . $v . ",";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($v)) {
|
||||||
|
//布尔
|
||||||
|
$repk = ($v == true) ? "'" . $k . "' => true," : "'" . $k . "' => false,";
|
||||||
|
} else {
|
||||||
|
// 数字
|
||||||
|
$repk = "'". $k . "' => " . $v .",";
|
||||||
|
}
|
||||||
|
$patk = '/\'' . $k . '\'(.*),/';
|
||||||
|
$reps = preg_replace($patk, $repk, $arr[0]);
|
||||||
|
// 正则查找然后替换
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 正则二级配置
|
||||||
|
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,/';
|
||||||
|
// 二级和三级
|
||||||
|
foreach($v as $kk => $vv) {
|
||||||
|
if(!array_key_exists($kk, config(self::$configName.'.'.$k))) {
|
||||||
|
echo $kk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//二级配置
|
||||||
|
if(!is_array($vv)) {
|
||||||
|
if(is_string($vv)){
|
||||||
|
// 字符串
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$repkk = "'". $kk . "' => '" . $vv . "',";
|
||||||
|
} else {
|
||||||
|
$repkk = "'". $kk . "' => " . $vv . ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
//布尔
|
||||||
|
$repkk = ($vv == true) ? "'" . $kk . "' => true," : "'" . $kk . "' => false,";
|
||||||
|
} else {
|
||||||
|
// 数字
|
||||||
|
$repkk = "'". $kk . "' => " . $vv .",";
|
||||||
|
}
|
||||||
|
preg_match($pats,self::$str,$arrk);
|
||||||
|
// 正则需要替换的部分
|
||||||
|
$patkk = '/\'' . $kk . '\'(.*?),/';
|
||||||
|
$reps = preg_replace($patkk, $repkk, $arrk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 三级配置
|
||||||
|
// 正则二级下的三级配置
|
||||||
|
//$pats = '/\'' . $kkk . '\'[\s\S]*?(?:'.$kkk.')\'(.*),/';
|
||||||
|
$pats = '/\'' . $kk . '\'\s*=>\s*\[[^\[|\]]*,/';
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
if(!array_key_exists($kkk, config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||||
|
echo $kkk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!is_array($vvv)) {
|
||||||
|
// 类型判断
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$arrReps = "'" . $kkk . "' => '" . $vvv . "',";
|
||||||
|
} else {
|
||||||
|
$arrReps = "'" . $kkk . "' => " . $vvv . ",";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
//布尔
|
||||||
|
$arrReps = ($vvv == true) ? "'" . $kkk . "' => true," : "'" . $kkk . "' => false,";
|
||||||
|
} else {
|
||||||
|
$arrReps = "'" . $kkk . "' => " . $vvv . ",";
|
||||||
|
}
|
||||||
|
preg_match($pats,self::$str,$arrkk);
|
||||||
|
// 正则需要替换的部分
|
||||||
|
$arrPats = '/\'' . $kkk . '\'(.*),/';
|
||||||
|
$reps = preg_replace($arrPats, $arrReps, $arrkk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 四级配置
|
||||||
|
// 正则$kkk
|
||||||
|
//$pats = '/\'' . $kk . '\'[\s\S]*?(?:'.$kkk.')\'[\s\S]*?(?:'.$kkkk.')\'(.*),/';
|
||||||
|
$pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,/';
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
if(!array_key_exists($kkkk, config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))){
|
||||||
|
echo $kkk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 类型判断
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false) {
|
||||||
|
$repskkkk = "'" . $kkkk . "' => '" . $vvvv . "',";
|
||||||
|
} else {
|
||||||
|
$repskkkk = "'" . $kkkk . "' => " . $vvvv . ",";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
//布尔
|
||||||
|
$repskkkk = ($vvvv == true) ? "'" . $kkkk . "' => true," : "'" . $kkkk . "' => false,";
|
||||||
|
} else {
|
||||||
|
$repskkkk = "'" . $kkkk . "' => " . $vvvv . ",";
|
||||||
|
}
|
||||||
|
preg_match($pats,self::$str,$arrkkk);
|
||||||
|
$patskkkk = '/\'' . $kkkk . '\'(.*),/';
|
||||||
|
$reps = preg_replace($patskkkk, $repskkkk, $arrkkk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//写入配置
|
||||||
|
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配置数组表
|
||||||
|
* 不支持一次性删除整个数组
|
||||||
|
* 子元素被删除会清理空数组
|
||||||
|
*
|
||||||
|
* @param array $arr
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function delete($arr) :bool
|
||||||
|
{
|
||||||
|
// 只能修改有键值对的数组
|
||||||
|
if(!is_array($arr)) return false;
|
||||||
|
|
||||||
|
foreach($arr as $k => $v) {
|
||||||
|
// 一级数组修改
|
||||||
|
if(!is_array($v)) {
|
||||||
|
// 正则开头到,不包含子数组
|
||||||
|
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arr);
|
||||||
|
if(!isset($arr[0])) {
|
||||||
|
echo '有误,删除项可能并不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_int($k)) {
|
||||||
|
// 一维数组正则
|
||||||
|
$patk = self::getPats($v);
|
||||||
|
} else {
|
||||||
|
// key不存在
|
||||||
|
if(!array_key_exists($k,config(self::$configName))) {
|
||||||
|
echo $k.'不存在 ';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$patk = '/[^\n]*\'' . $v . '\'(.*?)\r?\n/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正则查找然后替换
|
||||||
|
$reps = preg_replace($patk, '', $arr[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// 二级和三级
|
||||||
|
foreach($v as $kk => $vv) {
|
||||||
|
//二级配置
|
||||||
|
if(!is_array($vv)) {
|
||||||
|
// 正则二级配置
|
||||||
|
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arrk);
|
||||||
|
if(!isset($arrk[0])) {
|
||||||
|
echo $k.'有误,可能并不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_int($kk)) {
|
||||||
|
$patkk = self::getPats($vv);
|
||||||
|
} else {
|
||||||
|
// key不存在
|
||||||
|
if(!array_key_exists($kk,config(self::$configName.'.'.$k))) {
|
||||||
|
echo $kk.'不存在 ';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 正则需要替换的部分
|
||||||
|
$patkk = '/[^\n]*\'' . $kk . '\'(.*?),\r?\n/';
|
||||||
|
}
|
||||||
|
$reps = preg_replace($patkk, '', $arrk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 三级配置
|
||||||
|
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
if(!is_array($vvv)) {
|
||||||
|
// 正则二级下的三级配置
|
||||||
|
$pats = '/\'' . $kk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arrkk);
|
||||||
|
if(!isset($arrkkk[0])) {
|
||||||
|
echo $kk.'有误,可能并不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_int($kkk)) {
|
||||||
|
$patkkk = self::getPats($vvv);
|
||||||
|
} else {
|
||||||
|
if(!array_key_exists($kkk, config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||||
|
echo $kkk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$patkkk = '/[^\n]*\'' . $kkk . '\'(.*),\r?\n/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正则需要替换的部分
|
||||||
|
$reps = preg_replace($patkkk, '', $arrkk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 四级配置
|
||||||
|
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
if(!is_array($vvvv)) {
|
||||||
|
// 正则$kkk
|
||||||
|
$pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arrkkk);
|
||||||
|
if(!isset($arrkkk[0])) {
|
||||||
|
echo $kkk.'有误,可能并不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_int($kkkk)) {
|
||||||
|
$patskkkk = self::getPats($vvvv);
|
||||||
|
} else {
|
||||||
|
if(!array_key_exists($kkkk, config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))){
|
||||||
|
echo $kkkk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$patskkkk = '/[^\n]*\'' . $kkkk . '\'(.*),\r?\n/';
|
||||||
|
}
|
||||||
|
|
||||||
|
$reps = preg_replace($patskkkk, '', $arrkkk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
echo '不支持更多的层级数组';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 匹配空数组
|
||||||
|
* 'key' => [
|
||||||
|
* ],
|
||||||
|
*/
|
||||||
|
$nullArray = '/[^\n]*\'\w+\'\s*=>\s*\[\s*\]{1}\S*\,?\r?\n/m';
|
||||||
|
//preg_match($nullArray,self::$str,$arr);
|
||||||
|
self::$str = preg_replace($nullArray, '', self::$str);
|
||||||
|
|
||||||
|
}
|
||||||
|
//写入配置
|
||||||
|
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数组中子元素为数组的个数
|
||||||
|
*
|
||||||
|
* @param [type] $arr
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public static function getArrSonNum($arr) :int
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
foreach ($arr as $val) {
|
||||||
|
if(is_array($val)){
|
||||||
|
$i++;
|
||||||
|
foreach($val as $vv){
|
||||||
|
if(is_array($vv)){
|
||||||
|
$i++;
|
||||||
|
self::getArrSonNum($vv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取一维数组在正则公式
|
||||||
|
*
|
||||||
|
* @param [type] $v
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getPats($v) :string
|
||||||
|
{
|
||||||
|
if(is_bool($v)){
|
||||||
|
//布尔
|
||||||
|
$pats = $v ? '/[^\n]*true,\r?\n/' : '/[^\n]*false,\r?\n/';
|
||||||
|
} else {
|
||||||
|
// 字符串包含\
|
||||||
|
if(stripos($v,"\\") !== false) {
|
||||||
|
$v = str_replace("\\", "\\\\", $v);
|
||||||
|
}
|
||||||
|
// 字符串包含/
|
||||||
|
if(stripos($v,'/') !== false) {
|
||||||
|
$v = str_replace('/', '\/', $v);
|
||||||
|
}
|
||||||
|
if(stripos($v,'(') !== false) {
|
||||||
|
$v = str_replace('(', "\(", $v);
|
||||||
|
}
|
||||||
|
if(stripos($v,')') !== false) {
|
||||||
|
$v = str_replace(')', "\)", $v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(stripos($v,":") !== false) {
|
||||||
|
// $v = str_replace(":", "\:", $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
// if(stripos($v,'.') !== false) {
|
||||||
|
// $v = str_replace('.', '\.', $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
// if(stripos($v,"'") !== false) {
|
||||||
|
// $v = str_replace('\'', "\'", $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
|
||||||
|
// if(stripos($v,'-') !== false) {
|
||||||
|
// $v = str_replace('-', "\-", $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
// if(stripos($v,'>') !== false) {
|
||||||
|
// $v = str_replace('>', "\>", $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
$pats = '/[^\n]*' . $v . '(.*?)\r?\n/';
|
||||||
|
}
|
||||||
|
return $pats;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数组内数值数组的个数
|
||||||
|
* 排除数组中元素为数组的元素
|
||||||
|
*
|
||||||
|
* @param array $array
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function getArrSonCount(array $array) :bool
|
||||||
|
{
|
||||||
|
// 数组元素数量
|
||||||
|
$count = count($array);
|
||||||
|
// 子数组个数
|
||||||
|
$i = 0;
|
||||||
|
foreach ($array as $val) {
|
||||||
|
if(is_array($val)) {
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 数值数组的数量
|
||||||
|
$count = $count - $i;
|
||||||
|
if($count > 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* @Author: TaoLer <alipey_tao@qq.com>
|
||||||
|
* @Date: 2021-12-25 15:07:37
|
||||||
|
* @LastEditTime: 2022-04-16 09:43:05
|
||||||
|
* @LastEditors: TaoLer
|
||||||
|
* @Description: 搜索引擎SEO优化设置
|
||||||
|
* @FilePath: \TaoLer\app\common\lib\Zip.php
|
||||||
|
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
|
||||||
|
*/
|
||||||
namespace app\common\lib;
|
namespace app\common\lib;
|
||||||
|
|
||||||
class Zip
|
class Zip
|
||||||
@ -17,7 +26,7 @@ class Zip
|
|||||||
|
|
||||||
//压缩文件
|
//压缩文件
|
||||||
$zip = new \ZipArchive();
|
$zip = new \ZipArchive();
|
||||||
$zip->open($filePath, ZipArchive::CREATE);
|
$zip->open($filePath, \ZipArchive::CREATE);
|
||||||
foreach ($files as $key => $file) {
|
foreach ($files as $key => $file) {
|
||||||
//检查文件是否存在
|
//检查文件是否存在
|
||||||
if (!file_exists($file)) {
|
if (!file_exists($file)) {
|
||||||
|
@ -173,7 +173,7 @@ class Article extends Model
|
|||||||
$article = Cache::get('article_'.$id);
|
$article = Cache::get('article_'.$id);
|
||||||
if(!$article){
|
if(!$article){
|
||||||
//查询文章
|
//查询文章
|
||||||
$article = $this::field('id,title,content,status,cate_id,user_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,tags,title_color,create_time')->where('status',1)->with([
|
$article = $this::field('id,title,content,status,cate_id,user_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,tags,description,title_color,create_time')->where('status',1)->with([
|
||||||
'cate' => function($query){
|
'cate' => function($query){
|
||||||
$query->where('delete_time',0)->field('id,catename,ename');
|
$query->where('delete_time',0)->field('id,catename,ename');
|
||||||
},
|
},
|
||||||
|
@ -14,6 +14,8 @@ use think\exception\ValidateException;
|
|||||||
use taoler\com\Message;
|
use taoler\com\Message;
|
||||||
use app\common\lib\Msgres;
|
use app\common\lib\Msgres;
|
||||||
use app\common\lib\Uploads;
|
use app\common\lib\Uploads;
|
||||||
|
use app\common\lib\SetArr;
|
||||||
|
use taoler\com\Api;
|
||||||
|
|
||||||
class Article extends BaseController
|
class Article extends BaseController
|
||||||
{
|
{
|
||||||
@ -154,24 +156,25 @@ class Article extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
|
//dump(empty(config('taoler.baidu.client_id')));
|
||||||
if (Request::isAjax()) {
|
if (Request::isAjax()) {
|
||||||
$data = Request::only(['cate_id', 'title', 'title_color', 'user_id', 'content', 'upzip', 'tags', 'captcha']);
|
$data = Request::only(['cate_id', 'title', 'title_color', 'user_id', 'content', 'upzip', 'tags', 'description', 'captcha']);
|
||||||
|
|
||||||
// 验证码
|
// 验证码
|
||||||
if(Config::get('taoler.config.post_captcha') == 1)
|
if(Config::get('taoler.config.post_captcha') == 1)
|
||||||
{
|
{
|
||||||
if(!captcha_check($data['captcha'])){ // 验证失败
|
if(!captcha_check($data['captcha'])){
|
||||||
return json(['code'=>-1,'msg'=> '验证码失败']);
|
return json(['code'=>-1,'msg'=> '验证码失败']);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$validate = new \app\common\validate\Article; //调用验证器
|
// 调用验证器
|
||||||
$result = $validate->scene('Artadd')->check($data); //进行数据验证
|
$validate = new \app\common\validate\Article;
|
||||||
|
$result = $validate->scene('Artadd')->check($data);
|
||||||
if (true !== $result) {
|
if (true !== $result) {
|
||||||
return Msgres::error($validate->getError());
|
return Msgres::error($validate->getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取内容图片音视频标识
|
// 获取内容图片音视频标识
|
||||||
$iva= $this->hasIva($data['content']);
|
$iva= $this->hasIva($data['content']);
|
||||||
$data = array_merge($data,$iva);
|
$data = array_merge($data,$iva);
|
||||||
|
|
||||||
@ -184,7 +187,7 @@ class Article extends BaseController
|
|||||||
}else{
|
}else{
|
||||||
$link = (string)url('index/');
|
$link = (string)url('index/');
|
||||||
}
|
}
|
||||||
//清除文章tag缓存
|
// 清除文章tag缓存
|
||||||
Cache::tag('tagArtDetail')->clear();
|
Cache::tag('tagArtDetail')->clear();
|
||||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。');
|
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。');
|
||||||
$res = Msgres::success($result['msg'], $link);
|
$res = Msgres::success($result['msg'], $link);
|
||||||
@ -208,20 +211,19 @@ class Article extends BaseController
|
|||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$article = ArticleModel::find($id);
|
$article = ArticleModel::find($id);
|
||||||
//编辑
|
|
||||||
if(Request::isAjax()){
|
|
||||||
$data = Request::only(['id','cate_id','title','title_color','user_id','content','upzip','tags','captcha']);
|
|
||||||
|
|
||||||
|
if(Request::isAjax()){
|
||||||
|
$data = Request::only(['id','cate_id','title','title_color','user_id','content','upzip','tags','description','captcha']);
|
||||||
// 验证码
|
// 验证码
|
||||||
if(Config::get('taoler.config.post_captcha') == 1)
|
if(Config::get('taoler.config.post_captcha') == 1)
|
||||||
{
|
{
|
||||||
if(!captcha_check($data['captcha'])){ // 验证失败
|
if(!captcha_check($data['captcha'])){
|
||||||
return json(['code'=>-1,'msg'=> '验证码失败']);
|
return json(['code'=>-1,'msg'=> '验证码失败']);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
//调用验证器
|
||||||
$validate = new \app\common\validate\Article(); //调用验证器
|
$validate = new \app\common\validate\Article();
|
||||||
$res = $validate->scene('Artadd')->check($data); //进行数据验证
|
$res = $validate->scene('Artadd')->check($data);
|
||||||
|
|
||||||
if(true !== $res){
|
if(true !== $res){
|
||||||
return Msgres::error($validate->getError());
|
return Msgres::error($validate->getError());
|
||||||
@ -242,11 +244,11 @@ class Article extends BaseController
|
|||||||
return $editRes;
|
return $editRes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//查询标签
|
// 查询标签
|
||||||
$tag = $article->tags;
|
$tag = $article->tags;
|
||||||
$attr = explode(',',$tag);
|
$attr = explode(',',$tag);
|
||||||
$tags = [];
|
$tags = [];
|
||||||
foreach($attr as $key=>$v){
|
foreach($attr as $key => $v){
|
||||||
if ($v !='') {
|
if ($v !='') {
|
||||||
$tags[] = $v;
|
$tags[] = $v;
|
||||||
}
|
}
|
||||||
@ -256,7 +258,11 @@ class Article extends BaseController
|
|||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除帖子
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$article = ArticleModel::find(input('id'));
|
$article = ArticleModel::find(input('id'));
|
||||||
@ -269,6 +275,11 @@ class Article extends BaseController
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传接口
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function uploads()
|
public function uploads()
|
||||||
{
|
{
|
||||||
$type = Request::param('type');
|
$type = Request::param('type');
|
||||||
@ -293,7 +304,12 @@ class Article extends BaseController
|
|||||||
return $upRes;
|
return $upRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//附件下载
|
/**
|
||||||
|
* 附件下载
|
||||||
|
*
|
||||||
|
* @param [type] $id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function download($id)
|
public function download($id)
|
||||||
{
|
{
|
||||||
$zipdir = Db::name('article')->where('id',$id)->value('upzip');
|
$zipdir = Db::name('article')->where('id',$id)->value('upzip');
|
||||||
@ -304,20 +320,121 @@ class Article extends BaseController
|
|||||||
return download($zip,'my');
|
return download($zip,'my');
|
||||||
}
|
}
|
||||||
|
|
||||||
//添加tag
|
/**
|
||||||
|
* 获取描述,过滤html
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getDescription()
|
||||||
|
{
|
||||||
|
$data = Request::only(['content']);
|
||||||
|
$description = getArtContent($data['content']);
|
||||||
|
return json(['code'=>0,'data'=>$description]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关键词
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function tags()
|
public function tags()
|
||||||
{
|
{
|
||||||
$data = Request::only(['tags']);
|
$data = Request::only(['tags','flag']);
|
||||||
$att = explode(',',$data['tags']);
|
|
||||||
$tags = [];
|
$tags = [];
|
||||||
|
|
||||||
|
if($data['flag'] == 'on') {
|
||||||
|
// 百度分词自动生成关键词
|
||||||
|
if(!empty(config('taoler.baidu.client_id')) == true) {
|
||||||
|
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
|
||||||
|
|
||||||
|
//headers数组内的格式
|
||||||
|
$headers = array();
|
||||||
|
$headers[] = "Content-Type:application/json";
|
||||||
|
$body = array(
|
||||||
|
"text" => $data['tags']
|
||||||
|
);
|
||||||
|
$postBody = json_encode($body);
|
||||||
|
$curl = curl_init();
|
||||||
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($curl, CURLOPT_POST, true);
|
||||||
|
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);//设置请求头
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postBody);//设置请求体
|
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');//使用一个自定义的请求信息来代替"GET"或"HEAD"作为HTTP请求。(这个加不加没啥影响)
|
||||||
|
$datas = curl_exec($curl);
|
||||||
|
if($datas == false) {
|
||||||
|
echo '接口无法链接';
|
||||||
|
} else {
|
||||||
|
$res = stripos($datas,'error_code');
|
||||||
|
// 接收返回的数据
|
||||||
|
$dataItem = json_decode($datas);
|
||||||
|
if($res == false) {
|
||||||
|
// 数据正常
|
||||||
|
$items = $dataItem->items;
|
||||||
|
foreach($items as $item) {
|
||||||
|
if($item->pos == 'n' && !in_array($item->item,$tags)){
|
||||||
|
$tags[] = $item->item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 接口正常但获取数据失败,可能参数错误,重新获取token
|
||||||
|
$url = 'https://aip.baidubce.com/oauth/2.0/token';
|
||||||
|
$post_data['grant_type'] = config('taoler.baidu.grant_type');;
|
||||||
|
$post_data['client_id'] = config('taoler.baidu.client_id');
|
||||||
|
$post_data['client_secret'] = config('taoler.baidu.client_secret');
|
||||||
|
|
||||||
|
$o = "";
|
||||||
|
foreach ( $post_data as $k => $v )
|
||||||
|
{
|
||||||
|
$o.= "$k=" . urlencode( $v ). "&" ;
|
||||||
|
}
|
||||||
|
$post_data = substr($o,0,-1);
|
||||||
|
$res = $this->request_post($url, $post_data);
|
||||||
|
// 写入token
|
||||||
|
(new SetArr('taoler'))::edit([
|
||||||
|
'baidu'=> [
|
||||||
|
'access_token' => json_decode($res)->access_token,
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
echo 'api接口数据错误,重新自动尝试链接';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 手动添加关键词
|
||||||
|
// 中文一个或者多个空格转换为英文空格
|
||||||
|
$str = preg_replace('/\s+/',' ',$data['tags']);
|
||||||
|
$att = explode(' ', $str);
|
||||||
foreach($att as $v){
|
foreach($att as $v){
|
||||||
if ($v !='') {
|
if ($v !='') {
|
||||||
$tags[] = $v;
|
$tags[] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return json(['code'=>0,'data'=>$tags]);
|
return json(['code'=>0,'data'=>$tags]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// api_post接口
|
||||||
|
function request_post($url = '', $param = '')
|
||||||
|
{
|
||||||
|
if (empty($url) || empty($param)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$postUrl = $url;
|
||||||
|
$curlPost = $param;
|
||||||
|
$curl = curl_init();//初始化curl
|
||||||
|
curl_setopt($curl, CURLOPT_URL,$postUrl);//抓取指定网页
|
||||||
|
curl_setopt($curl, CURLOPT_HEADER, 0);//设置header
|
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
|
||||||
|
curl_setopt($curl, CURLOPT_POST, 1);//post提交方式
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
|
||||||
|
$data = curl_exec($curl);//运行curl
|
||||||
|
curl_close($curl);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
//文章置顶,状态
|
//文章置顶,状态
|
||||||
public function jieset(){
|
public function jieset(){
|
||||||
$data = Request::param();
|
$data = Request::param();
|
||||||
@ -372,7 +489,12 @@ class Article extends BaseController
|
|||||||
return json($res);
|
return json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
//内容中是否有图片视频音频插入
|
/**
|
||||||
|
* 内容中是否有图片视频音频插入
|
||||||
|
*
|
||||||
|
* @param [type] $content
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function hasIva($content)
|
public function hasIva($content)
|
||||||
{
|
{
|
||||||
//判断是否插入图片
|
//判断是否插入图片
|
||||||
|
@ -9,7 +9,6 @@ use think\facade\Db;
|
|||||||
use app\facade\Article;
|
use app\facade\Article;
|
||||||
use app\common\model\Slider;
|
use app\common\model\Slider;
|
||||||
use app\common\lib\Msgres;
|
use app\common\lib\Msgres;
|
||||||
use app\common\lib\SetConf;
|
|
||||||
|
|
||||||
class Index extends BaseController
|
class Index extends BaseController
|
||||||
{
|
{
|
||||||
@ -24,13 +23,13 @@ class Index extends BaseController
|
|||||||
{
|
{
|
||||||
$types = input('type');
|
$types = input('type');
|
||||||
|
|
||||||
//幻灯
|
|
||||||
$slider = new Slider();
|
$slider = new Slider();
|
||||||
|
//幻灯
|
||||||
$sliders = $slider->getSliderList(1);
|
$sliders = $slider->getSliderList(1);
|
||||||
//置顶文章
|
//置顶文章
|
||||||
$artTop = Article::getArtTop(5);
|
$artTop = Article::getArtTop(5);
|
||||||
//首页文章列表,显示20个
|
//首页文章列表,显示20个
|
||||||
$artList = Article::getArtList(20);
|
$artList = Article::getArtList(22);
|
||||||
//热议文章
|
//热议文章
|
||||||
$artHot = Article::getArtHot(10);
|
$artHot = Article::getArtHot(10);
|
||||||
//温馨通道
|
//温馨通道
|
||||||
|
@ -18,6 +18,7 @@ Route::group(function () {
|
|||||||
Route::get('column/<ename>/<type>$', 'article/cate')->name('cate_type');
|
Route::get('column/<ename>/<type>$', 'article/cate')->name('cate_type');
|
||||||
Route::rule('column/<ename>/<type>/<page>', 'article/cate')->name('cate_page');
|
Route::rule('column/<ename>/<type>/<page>', 'article/cate')->name('cate_page');
|
||||||
Route::rule('add','Article/add');
|
Route::rule('add','Article/add');
|
||||||
|
Route::rule('tags','Article/tags')->allowCrossDomain();
|
||||||
Route::rule('edit/[:id]','Article/edit');
|
Route::rule('edit/[:id]','Article/edit');
|
||||||
//Route::rule('del/:id','article/delete');
|
//Route::rule('del/:id','article/delete');
|
||||||
})->pattern([
|
})->pattern([
|
||||||
|
@ -65,6 +65,7 @@ CREATE TABLE `tao_article` (
|
|||||||
`upzip` varchar(70) DEFAULT NULL COMMENT '文章附件',
|
`upzip` varchar(70) DEFAULT NULL COMMENT '文章附件',
|
||||||
`downloads` int(5) NOT NULL DEFAULT '0' COMMENT '下载量',
|
`downloads` int(5) NOT NULL DEFAULT '0' COMMENT '下载量',
|
||||||
`tags` varchar(255) DEFAULT NULL COMMENT 'tag',
|
`tags` varchar(255) DEFAULT NULL COMMENT 'tag',
|
||||||
|
`description` text NOT NULL COMMENT 'seo描述',
|
||||||
`read_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '阅读权限0开放1回复可读2密码可读3私密',
|
`read_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '阅读权限0开放1回复可读2密码可读3私密',
|
||||||
`art_pass` varchar(6) DEFAULT NULL COMMENT '文章加密密码',
|
`art_pass` varchar(6) DEFAULT NULL COMMENT '文章加密密码',
|
||||||
`title_color` varchar(10) DEFAULT NULL COMMENT '标题颜色',
|
`title_color` varchar(10) DEFAULT NULL COMMENT '标题颜色',
|
||||||
@ -182,88 +183,89 @@ INSERT INTO `tao_auth_rule` VALUES ('2', 'set', '设置', '', '1', '1', '0', '0'
|
|||||||
INSERT INTO `tao_auth_rule` VALUES ('3', 'administrator', '账户', '', '1', '1', '0', '0', 'layui-icon-username', '1', '7', '', '0', '1635757594', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('3', 'administrator', '账户', '', '1', '1', '0', '0', 'layui-icon-username', '1', '7', '', '0', '1635757594', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('4', 'app', '应用', '', '1', '1', '0', '0', 'layui-icon-app', '1', '4', '', '0', '1635757536', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('4', 'app', '应用', '', '1', '1', '0', '0', 'layui-icon-app', '1', '4', '', '0', '1635757536', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('5', 'article', '内容', '', '1', '1', '0', '0', 'layui-icon-read', '1', '1', '', '0', '1635757294', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('5', 'article', '内容', '', '1', '1', '0', '0', 'layui-icon-read', '1', '1', '', '0', '1635757294', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('6', 'admin/User/list', '用户管理', '', '1', '1', '1', '1', '', '1', '1', '', '0', '1578901015', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('6', 'User/list', '用户管理', '', '1', '1', '1', '1', '', '1', '1', '', '0', '1578901015', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('7', 'admin/Admin/index', '管理员', '', '1', '1', '1', '1', '', '1', '6', '', '0', '1578901133', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('7', 'Admin/index', '管理员', '', '1', '1', '1', '1', '', '1', '6', '', '0', '1578901133', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('8', 'admin/AuthGroup/list', '角色管理', '', '1', '1', '1', '1', '', '1', '11', '', '0', '1578901282', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('8', 'AuthGroup/list', '角色管理', '', '1', '1', '1', '1', '', '1', '11', '', '0', '1578901282', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('9', 'admin/AuthRule/index', '权限菜单', '', '1', '1', '2', '1', '', '1', '16', '', '0', '1611998671', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('9', 'AuthRule/index', '权限菜单', '', '1', '1', '2', '1', '', '1', '16', '', '0', '1611998671', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('10', 'admin/Set/index', '网站设置', '', '1', '1', '2', '1', '', '1', '1', '', '0', '0', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('10', 'Set/index', '网站设置', '', '1', '1', '2', '1', '', '1', '1', '', '0', '0', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('11', 'admin/Set/server', '综合服务', '', '1', '1', '2', '1', '', '1', '3', '', '0', '0', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('11', 'Set/server', '综合服务', '', '1', '1', '2', '1', '', '1', '3', '', '0', '0', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('12', 'admin/Admin/info', '基本资料', '', '1', '1', '3', '1', '', '1', '50', '', '0', '1578980034', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('12', 'Admin/info', '基本资料', '', '1', '1', '3', '1', '', '1', '50', '', '0', '1578980034', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('13', 'admin/Admin/repass', '修改密码', '', '1', '1', '3', '1', '', '1', '51', '', '0', '1578980034', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('13', 'Admin/repass', '修改密码', '', '1', '1', '3', '1', '', '1', '51', '', '0', '1578980034', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('15', 'admin/Forum/list', '帖子管理', '', '1', '1', '5', '1', '', '1', '1', '', '0', '1578902605', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('15', 'Forum/list', '帖子管理', '', '1', '1', '5', '1', '', '1', '1', '', '0', '1578902605', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('16', 'admin/Forum/tags', '分类管理', '', '1', '1', '5', '1', '', '1', '11', '', '0', '1578904950', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('16', 'Forum/tags', '分类管理', '', '1', '1', '5', '1', '', '1', '11', '', '0', '1578904950', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('17', 'admin/Forum/replys', '评论管理', '', '1', '1', '5', '1', '', '1', '7', '', '0', '1578904590', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('17', 'Forum/replys', '评论管理', '', '1', '1', '5', '1', '', '1', '7', '', '0', '1578904590', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('18', 'admin/Slider/index', '链接投放', '', '1', '1', '93', '1', '', '1', '4', '', '0', '1611999603', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('18', 'Slider/index', '链接投放', '', '1', '1', '93', '1', '', '1', '4', '', '0', '1611999603', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('19', 'admin/Upgrade/index', '系统升级', '', '1', '1', '2', '1', '', '1', '8', '', '0', '0', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('19', 'Upgrade/index', '系统升级', '', '1', '1', '2', '1', '', '1', '8', '', '0', '0', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('21', 'admin/Forum/listform', '编辑帖子', '', '1', '1', '15', '2', '', '0', '2', '', '0', '1611997428', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('21', 'Forum/listform', '编辑帖子', '', '1', '1', '15', '2', '', '0', '2', '', '0', '1611997428', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('22', 'admin/Forum/listdel', '删除帖子', '', '1', '1', '15', '2', '', '0', '3', '', '0', '1611997448', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('22', 'Forum/listdel', '删除帖子', '', '1', '1', '15', '2', '', '0', '3', '', '0', '1611997448', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('23', 'admin/Forum/check', '审核帖子', '', '1', '1', '15', '2', '', '0', '6', '', '0', '1611997474', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('23', 'Forum/check', '审核帖子', '', '1', '1', '15', '2', '', '0', '6', '', '0', '1611997474', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('24', 'admin/Forum/addtags', '添加分类', '', '1', '1', '16', '2', '', '0', '12', '', '0', '1611997513', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('24', 'Forum/addtags', '添加分类', '', '1', '1', '16', '2', '', '0', '12', '', '0', '1611997513', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('25', 'admin/Forum/tagsform', '编辑分类', '', '1', '1', '16', '2', '', '0', '14', '', '0', '1611997535', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('25', 'Forum/tagsform', '编辑分类', '', '1', '1', '16', '2', '', '0', '14', '', '0', '1611997535', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('26', 'admin/Forum/tagsdelete', '删除分类', '', '1', '1', '16', '2', '', '0', '13', '', '0', '1611997523', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('26', 'Forum/tagsdelete', '删除分类', '', '1', '1', '16', '2', '', '0', '13', '', '0', '1611997523', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('27', 'admin/Forum/replysform', '编辑评论', '', '1', '1', '17', '2', '', '0', '8', '', '0', '1611997484', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('27', 'Forum/replysform', '编辑评论', '', '1', '1', '17', '2', '', '0', '8', '', '0', '1611997484', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('28', 'admin/Forum/redel', '删除评论', '', '1', '1', '17', '2', '', '0', '9', '', '0', '1611997494', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('28', 'Forum/redel', '删除评论', '', '1', '1', '17', '2', '', '0', '9', '', '0', '1611997494', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('35', 'admin/User/userForm', '添加用户', '', '1', '1', '6', '2', '', '0', '2', '', '0', '1611997673', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('35', 'User/userForm', '添加用户', '', '1', '1', '6', '2', '', '0', '2', '', '0', '1611997673', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('36', 'admin/User/userEdit', '编辑用户', '', '1', '1', '6', '2', '', '0', '3', '', '0', '1611997690', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('36', 'User/userEdit', '编辑用户', '', '1', '1', '6', '2', '', '0', '3', '', '0', '1611997690', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('37', 'admin/User/delete', '删除用户', '', '1', '1', '6', '2', '', '0', '4', '', '0', '1611997701', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('37', 'User/delete', '删除用户', '', '1', '1', '6', '2', '', '0', '4', '', '0', '1611997701', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('38', 'admin/User/check', '审核用户', '', '1', '1', '6', '2', '', '0', '5', '', '0', '1611997713', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('38', 'User/check', '审核用户', '', '1', '1', '6', '2', '', '0', '5', '', '0', '1611997713', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('39', 'admin/Admin/add', '添加管理员', '', '1', '1', '7', '2', '', '0', '7', '', '0', '1611997732', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('39', 'Admin/add', '添加管理员', '', '1', '1', '7', '2', '', '0', '7', '', '0', '1611997732', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('40', 'admin/Admin/edit', '编辑管理员', '', '1', '1', '7', '2', '', '0', '8', '', '0', '1611997747', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('40', 'Admin/edit', '编辑管理员', '', '1', '1', '7', '2', '', '0', '8', '', '0', '1611997747', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('41', 'admin/Admin/delete', '删除管理员', '', '1', '1', '7', '2', '', '0', '9', '', '0', '1611997760', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('41', 'Admin/delete', '删除管理员', '', '1', '1', '7', '2', '', '0', '9', '', '0', '1611997760', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('42', 'admin/Admin/check', '审核管理员', '', '1', '1', '7', '2', '', '0', '10', '', '0', '1611997772', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('42', 'Admin/check', '审核管理员', '', '1', '1', '7', '2', '', '0', '10', '', '0', '1611997772', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('43', 'admin/AuthGroup/roleAdd', '添加角色', '', '1', '1', '8', '2', '', '0', '12', '', '0', '1611997790', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('43', 'AuthGroup/roleAdd', '添加角色', '', '1', '1', '8', '2', '', '0', '12', '', '0', '1611997790', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('44', 'admin/AuthGroup/roleEdit', '编辑角色', '', '1', '1', '8', '2', '', '0', '13', '', '0', '1611997805', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('44', 'AuthGroup/roleEdit', '编辑角色', '', '1', '1', '8', '2', '', '0', '13', '', '0', '1611997805', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('45', 'admin/AuthGroup/roledel', '删除角色', '', '1', '1', '8', '2', '', '0', '14', '', '0', '1611997820', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('45', 'AuthGroup/roledel', '删除角色', '', '1', '1', '8', '2', '', '0', '14', '', '0', '1611997820', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('46', 'admin/AuthRule/add', '添加权限', '', '1', '1', '9', '2', '', '0', '21', '', '0', '1611997901', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('46', 'AuthRule/add', '添加权限', '', '1', '1', '9', '2', '', '0', '21', '', '0', '1611997901', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('47', 'admin/AuthRule/edit', '编辑权限', '', '1', '1', '9', '2', '', '0', '17', '', '0', '1611997849', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('47', 'AuthRule/edit', '编辑权限', '', '1', '1', '9', '2', '', '0', '17', '', '0', '1611997849', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('48', 'admin/AuthRule/delete', '删除权限', '', '1', '1', '9', '2', '', '0', '18', '', '0', '1611997869', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('48', 'AuthRule/delete', '删除权限', '', '1', '1', '9', '2', '', '0', '18', '', '0', '1611997869', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('49', 'admin/AuthRule/check', '审核权限', '', '1', '1', '9', '2', '', '0', '19', '', '0', '1611997884', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('49', 'AuthRule/check', '审核权限', '', '1', '1', '9', '2', '', '0', '19', '', '0', '1611997884', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('50', 'admin/AuthRule/menushow', '菜单权限', '', '1', '1', '9', '2', '', '0', '20', '', '0', '1611997929', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('50', 'AuthRule/menushow', '菜单权限', '', '1', '1', '9', '2', '', '0', '20', '', '0', '1611997929', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('51', 'admin/Set/upload', '上传logo', '', '1', '1', '10', '2', '', '0', '2', '', '0', '1611998097', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('51', 'Set/upload', '上传logo', '', '1', '1', '10', '2', '', '0', '2', '', '0', '1611998097', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('52', 'admin/Slider/add', '添加链接', '', '1', '1', '18', '2', '', '0', '5', '', '0', '1611998128', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('52', 'Slider/add', '添加链接', '', '1', '1', '18', '2', '', '0', '5', '', '0', '1611998128', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('53', 'admin/Slider/edit', '编辑链接', '', '1', '1', '18', '2', '', '0', '14', '', '0', '1611998263', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('53', 'Slider/edit', '编辑链接', '', '1', '1', '18', '2', '', '0', '14', '', '0', '1611998263', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('54', 'admin/Slider/delete', '删除链接', '', '1', '1', '18', '2', '', '0', '6', '', '0', '1611998141', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('54', 'Slider/delete', '删除链接', '', '1', '1', '18', '2', '', '0', '6', '', '0', '1611998141', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('55', 'admin/Slider/uploadimg', '上传链接图片', '', '1', '1', '18', '2', '', '0', '7', '', '0', '1611998156', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('55', 'Slider/uploadimg', '上传链接图片', '', '1', '1', '18', '2', '', '0', '7', '', '0', '1611998156', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('56', 'admin/Upgrade/key', '设置key', '', '1', '1', '19', '2', '', '0', '9', '', '0', '1611998178', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('56', 'Upgrade/key', '设置key', '', '1', '1', '19', '2', '', '0', '9', '', '0', '1611998178', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('57', 'admin/Upgrade/keyedit', '修改key', '', '1', '1', '19', '2', '', '0', '10', '', '0', '1611998192', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('57', 'Upgrade/keyedit', '修改key', '', '1', '1', '19', '2', '', '0', '10', '', '0', '1611998192', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('58', 'admin/Upgrade/check', '升级检测', '', '1', '1', '19', '2', '', '0', '11', '', '0', '1611998214', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('58', 'Upgrade/check', '升级检测', '', '1', '1', '19', '2', '', '0', '11', '', '0', '1611998214', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('59', 'admin/Upgrade/upload', '自动升级', '', '1', '1', '19', '2', '', '0', '12', '', '0', '1611998230', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('59', 'Upgrade/upload', '自动升级', '', '1', '1', '19', '2', '', '0', '12', '', '0', '1611998230', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('60', 'admin/Upgrade/uploadzip', '上传升级包', '', '1', '1', '19', '2', '', '0', '13', '', '0', '1611998245', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('60', 'Upgrade/uploadzip', '上传升级包', '', '1', '1', '19', '2', '', '0', '13', '', '0', '1611998245', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('62', 'admin/Forum/top', '置顶帖子', '', '1', '1', '15', '2', '', '0', '4', '', '0', '1611997455', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('62', 'Forum/top', '置顶帖子', '', '1', '1', '15', '2', '', '0', '4', '', '0', '1611997455', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('63', 'admin/Forum/hot', '加精帖子', '', '1', '1', '15', '2', '', '0', '5', '', '0', '1611997465', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('63', 'Forum/hot', '加精帖子', '', '1', '1', '15', '2', '', '0', '5', '', '0', '1611997465', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('64', 'admin/Froum/recheck', '审核评论', '', '1', '1', '17', '2', '', '0', '10', '', '0', '1611997503', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('64', 'Froum/recheck', '审核评论', '', '1', '1', '17', '2', '', '0', '10', '', '0', '1611997503', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('65', 'admin/User/uploadImg', '上传用户头像', '', '1', '1', '6', '2', '', '0', '0', '', '0', '1611997661', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('65', 'User/uploadImg', '上传用户头像', '', '1', '1', '6', '2', '', '0', '0', '', '0', '1611997661', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('66', 'admin/AuthGroup/check', '审核角色', '', '1', '1', '8', '2', '', '0', '15', '', '0', '1611997835', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('66', 'AuthGroup/check', '审核角色', '', '1', '1', '8', '2', '', '0', '15', '', '0', '1611997835', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('67', 'admin/Sign/signRule', '签到规则', '', '1', '1', '11', '2', '', '0', '15', '', '1585547595', '1611998427', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('67', 'Sign/signRule', '签到规则', '', '1', '1', '11', '2', '', '0', '15', '', '1585547595', '1611998427', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('68', 'admin/Sign/add', '添加签到', '', '1', '1', '11', '2', '', '0', '16', '', '1585547705', '1611998444', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('68', 'Sign/add', '添加签到', '', '1', '1', '11', '2', '', '0', '16', '', '1585547705', '1611998444', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('69', 'admin/Sign/signEdit', '编辑签到', '', '1', '1', '11', '2', '', '0', '17', '', '1585547774', '1611998457', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('69', 'Sign/signEdit', '编辑签到', '', '1', '1', '11', '2', '', '0', '17', '', '1585547774', '1611998457', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('70', 'admin/Sign/delete', '删除签到', '', '1', '1', '11', '2', '', '0', '18', '', '1585547817', '1611998470', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('70', 'Sign/delete', '删除签到', '', '1', '1', '11', '2', '', '0', '18', '', '1585547817', '1611998470', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('71', 'admin/Vip/vipRule', '用户等级', '', '1', '1', '11', '2', '', '0', '19', '', '1585547921', '1611998481', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('71', 'Vip/vipRule', '用户等级', '', '1', '1', '11', '2', '', '0', '19', '', '1585547921', '1611998481', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('72', 'admin/Vip/add', '添加vip等级', '', '1', '1', '11', '2', '', '0', '20', '', '1585547981', '1611998492', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('72', 'Vip/add', '添加vip等级', '', '1', '1', '11', '2', '', '0', '20', '', '1585547981', '1611998492', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('73', 'admin/Vip/vipEdit', '编辑vip等级', '', '1', '1', '11', '2', '', '0', '21', '', '1585548029', '1611998556', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('73', 'Vip/vipEdit', '编辑vip等级', '', '1', '1', '11', '2', '', '0', '21', '', '1585548029', '1611998556', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('74', 'admin/Vip/delete', '删除vip等级', '', '1', '1', '11', '2', '', '0', '22', '', '1585548077', '1611998503', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('74', 'Vip/delete', '删除vip等级', '', '1', '1', '11', '2', '', '0', '22', '', '1585548077', '1611998503', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('75', 'admin/Set/email', '邮箱设置', '', '1', '1', '10', '2', '', '0', '23', '', '1585548143', '1611998372', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('75', 'Set/email', '邮箱设置', '', '1', '1', '10', '2', '', '0', '23', '', '1585548143', '1611998372', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('76', 'admin/Notice/index', '发布通知', '', '1', '1', '4', '1', '', '1', '10', '', '1585618141', '0', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('76', 'Notice/index', '发布通知', '', '1', '1', '4', '1', '', '1', '10', '', '1585618141', '0', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('77', 'admin/Notice/add', '添加通知', '', '1', '1', '76', '2', '', '0', '11', '', '1585663336', '1611997580', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('77', 'Notice/add', '添加通知', '', '1', '1', '76', '2', '', '0', '11', '', '1585663336', '1611997580', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('78', 'admin/Notice/edit', '编辑通知', '', '1', '1', '76', '2', '', '0', '12', '', '1585663366', '1611997590', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('78', 'Notice/edit', '编辑通知', '', '1', '1', '76', '2', '', '0', '12', '', '1585663366', '1611997590', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('79', 'admin/Notice/delete', '删除通知', '', '1', '1', '76', '2', '', '0', '13', '', '1585663412', '1611997601', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('79', 'Notice/delete', '删除通知', '', '1', '1', '76', '2', '', '0', '13', '', '1585663412', '1611997601', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('83', 'admin/AuthAccess/index', '管理员权限', '', '1', '1', '1', '1', '', '1', '22', '', '1585794015', '0', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('83', 'AuthAccess/index', '管理员权限', '', '1', '1', '1', '1', '', '1', '22', '', '1585794015', '0', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('84', 'admin/AuthAccess/add', '添加管理员权限', '', '1', '1', '83', '2', '', '0', '23', '', '1585806544', '1611998012', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('84', 'AuthAccess/add', '添加管理员权限', '', '1', '1', '83', '2', '', '0', '23', '', '1585806544', '1611998012', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('85', 'admin/AuthAccess/edit', '编辑管理员权限', '', '1', '1', '83', '2', '', '0', '24', '', '1585806592', '1611998030', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('85', 'AuthAccess/edit', '编辑管理员权限', '', '1', '1', '83', '2', '', '0', '24', '', '1585806592', '1611998030', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('86', 'admin/AuthAccess/delete', '删除管理员权限', '', '1', '1', '83', '2', '', '0', '25', '', '1585806620', '1611998046', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('86', 'AuthAccess/delete', '删除管理员权限', '', '1', '1', '83', '2', '', '0', '25', '', '1585806620', '1611998046', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('87', 'admin/AuthAccess/check', '审核管理员权限', '', '1', '1', '83', '2', '', '0', '26', '', '1585806653', '1611998060', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('87', 'AuthAccess/check', '审核管理员权限', '', '1', '1', '83', '2', '', '0', '26', '', '1585806653', '1611998060', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('88', 'admin/Set/website', '网站信息保存', '', '1', '1', '10', '2', '', '0', '24', '', '1585819936', '1611998395', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('88', 'Set/website', '网站信息保存', '', '1', '1', '10', '2', '', '0', '24', '', '1585819936', '1611998395', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('89', 'admin/User/auth', '设置超级用户', '', '1', '1', '6', '2', '', '0', '22', '', '1578984801', '1611997990', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('89', 'User/auth', '设置超级用户', '', '1', '1', '6', '2', '', '0', '22', '', '1578984801', '1611997990', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('90', 'admin/Forum/tagshot', '开启热点', '', '1', '1', '16', '2', '', '0', '15', '', '1585841826', '1611997546', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('90', 'Forum/tagshot', '开启热点', '', '1', '1', '16', '2', '', '0', '15', '', '1585841826', '1611997546', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('91', 'admin/Admin/infoSet', '资料设置', '', '1', '1', '12', '2', '', '0', '62', '', '1586245669', '1611998517', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('91', 'Admin/infoSet', '资料设置', '', '1', '1', '12', '2', '', '0', '62', '', '1586245669', '1611998517', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('92', 'admin/Admin/repassSet', '密码设置', '', '1', '1', '13', '2', '', '0', '64', '', '1586245727', '1611998534', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('92', 'Admin/repassSet', '密码设置', '', '1', '1', '13', '2', '', '0', '64', '', '1586245727', '1611998534', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('93', 'servers', '服务', '', '1', '1', '0', '0', 'layui-icon-cols', '1', '3', '', '1611286515', '1635757525', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('93', 'servers', '服务', '', '1', '1', '0', '0', 'layui-icon-cols', '1', '3', '', '1611286515', '1635757525', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('94', 'admin/Database/index', '数据备份', '', '1', '1', '93', '1', '', '1', '9', '', '1611897141', '1611902589', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('94', 'Database/index', '数据备份', '', '1', '1', '93', '1', '', '1', '9', '', '1611897141', '1611902589', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('95', 'admin/Database/backup', '进行备份', '', '1', '1', '94', '2', '', '0', '10', '', '1611897285', '1611902610', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('95', 'Database/backup', '进行备份', '', '1', '1', '94', '2', '', '0', '10', '', '1611897285', '1611902610', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('96', 'admin/Database/delete', '备份删除', '', '1', '1', '94', '2', '', '0', '0', '', '1611902429', '0', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('96', 'Database/delete', '备份删除', '', '1', '1', '94', '2', '', '0', '0', '', '1611902429', '0', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('97', 'addons', '插件', '', '1', '1', '0', '0', 'layui-icon-flag', '1', '2', '', '1635757328', '1635757632', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('97', 'addons', '插件', '', '1', '1', '0', '0', 'layui-icon-flag', '1', '2', '', '1635757328', '1635757632', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('98', 'admin/Addons/index', '插件市场', '', '1', '1', '97', '1', '', '1', '0', '', '1635757426', '0', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('98', 'Addons/index', '插件市场', '', '1', '1', '97', '1', '', '1', '0', '', '1635757426', '0', '0');
|
||||||
INSERT INTO `tao_auth_rule` VALUES ('99', 'admin/Addons/addonsList', '插件列表', '', '1', '1', '98', '2', '', '-1', '0', '', '1638775199', '0', '0');
|
INSERT INTO `tao_auth_rule` VALUES ('99', 'Addons/addonsList', '插件列表', '', '1', '1', '98', '2', '', '-1', '0', '', '1638775199', '0', '0');
|
||||||
|
INSERT INTO `tao_auth_rule` VALUES ('111','Seo/index','SEO','1','1','0','0','layui-icon-component','1','7','','1649829142','0','0');
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for tao_cate
|
-- Table structure for tao_cate
|
||||||
@ -481,7 +483,7 @@ CREATE TABLE `tao_system` (
|
|||||||
`is_comment` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开启评论1开启0关闭',
|
`is_comment` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开启评论1开启0关闭',
|
||||||
`is_reg` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开放注册1开启0禁止',
|
`is_reg` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开放注册1开启0禁止',
|
||||||
`icp` varchar(50) NOT NULL DEFAULT '' COMMENT '备案',
|
`icp` varchar(50) NOT NULL DEFAULT '' COMMENT '备案',
|
||||||
`showlist` varchar(255) NOT NULL COMMENT '统计代码',
|
`showlist` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '统计代码',
|
||||||
`blackname` varchar(255) NOT NULL COMMENT '注册黑名单',
|
`blackname` varchar(255) NOT NULL COMMENT '注册黑名单',
|
||||||
`sys_version_num` varchar(5) NOT NULL COMMENT '系统版本',
|
`sys_version_num` varchar(5) NOT NULL COMMENT '系统版本',
|
||||||
`key` varchar(60) DEFAULT NULL COMMENT 'key',
|
`key` varchar(60) DEFAULT NULL COMMENT 'key',
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
"lotofbadcode/phpspirit_databackup": "^1.1",
|
"lotofbadcode/phpspirit_databackup": "^1.1",
|
||||||
"wamkj/thinkphp6.0-databackup": "^1.0",
|
"wamkj/thinkphp6.0-databackup": "^1.0",
|
||||||
"taoser/think-addons": "^1.0",
|
"taoser/think-addons": "^1.0",
|
||||||
"liliuwei/thinkphp-social": "^1.3"
|
"liliuwei/thinkphp-social": "^1.3",
|
||||||
|
"taoser/think-setarr": "^0.0.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/var-dumper": "^4.2",
|
"symfony/var-dumper": "^4.2",
|
||||||
|
66
composer.lock
generated
66
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "9a2defc1ce427f4ab5f63c13400425c3",
|
"content-hash": "52d2121e202720cc23a0528605fafe09",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "firebase/php-jwt",
|
"name": "firebase/php-jwt",
|
||||||
@ -210,16 +210,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/mime-type-detection",
|
"name": "league/mime-type-detection",
|
||||||
"version": "1.9.0",
|
"version": "1.10.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/mime-type-detection.git",
|
"url": "https://github.com/thephpleague/mime-type-detection.git",
|
||||||
"reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69"
|
"reference": "3e4a35d756eedc67096f30240a68a3149120dae7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/aa70e813a6ad3d1558fc927863d47309b4c23e69",
|
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3e4a35d756eedc67096f30240a68a3149120dae7",
|
||||||
"reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69",
|
"reference": "3e4a35d756eedc67096f30240a68a3149120dae7",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -250,7 +250,7 @@
|
|||||||
"description": "Mime-type detection for Flysystem",
|
"description": "Mime-type detection for Flysystem",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
|
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
|
||||||
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.9.0"
|
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.10.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -262,7 +262,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-11-21T11:48:40+00:00"
|
"time": "2022-04-11T12:49:04+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "liliuwei/thinkphp-social",
|
"name": "liliuwei/thinkphp-social",
|
||||||
@ -821,6 +821,46 @@
|
|||||||
},
|
},
|
||||||
"time": "2020-02-11T06:16:10+00:00"
|
"time": "2020-02-11T06:16:10+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "taoser/think-setarr",
|
||||||
|
"version": "v0.0.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/taoser/think-setarr.git",
|
||||||
|
"reference": "6651c31ef42417a6294ef08e6fb970917b7e7f86"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/taoser/think-setarr/zipball/6651c31ef42417a6294ef08e6fb970917b7e7f86",
|
||||||
|
"reference": "6651c31ef42417a6294ef08e6fb970917b7e7f86",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.2.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"taoser\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"mit"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Taoser",
|
||||||
|
"email": "changlin_zhao@qq.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "php confing",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/taoser/think-setarr/issues",
|
||||||
|
"source": "https://github.com/taoser/think-setarr/tree/v0.0.3"
|
||||||
|
},
|
||||||
|
"time": "2022-04-16T23:08:43+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "topthink/framework",
|
"name": "topthink/framework",
|
||||||
"version": "v6.0.12",
|
"version": "v6.0.12",
|
||||||
@ -890,16 +930,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "topthink/think-captcha",
|
"name": "topthink/think-captcha",
|
||||||
"version": "v3.0.4",
|
"version": "v3.0.6",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/top-think/think-captcha.git",
|
"url": "https://github.com/top-think/think-captcha.git",
|
||||||
"reference": "db5be361d3cd664d236fb95d5dffe93a117283ad"
|
"reference": "3b60feb4d484381ff7ddda4af7582a6b9be5dacf"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/db5be361d3cd664d236fb95d5dffe93a117283ad",
|
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/3b60feb4d484381ff7ddda4af7582a6b9be5dacf",
|
||||||
"reference": "db5be361d3cd664d236fb95d5dffe93a117283ad",
|
"reference": "3b60feb4d484381ff7ddda4af7582a6b9be5dacf",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -937,9 +977,9 @@
|
|||||||
"description": "captcha package for thinkphp",
|
"description": "captcha package for thinkphp",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/top-think/think-captcha/issues",
|
"issues": "https://github.com/top-think/think-captcha/issues",
|
||||||
"source": "https://github.com/top-think/think-captcha/tree/v3.0.4"
|
"source": "https://github.com/top-think/think-captcha/tree/v3.0.6"
|
||||||
},
|
},
|
||||||
"time": "2022-01-07T06:34:19+00:00"
|
"time": "2022-03-18T09:11:51+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "topthink/think-helper",
|
"name": "topthink/think-helper",
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* @Author: TaoLer <alipey_tao@qq.com>
|
||||||
|
* @Date: 2021-12-06 16:04:50
|
||||||
|
* @LastEditTime: 2022-04-17 16:49:19
|
||||||
|
* @LastEditors: TaoLer
|
||||||
|
* @Description: 搜索引擎SEO优化设置
|
||||||
|
* @FilePath: \TaoLer\config\app.php
|
||||||
|
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
|
||||||
|
*/
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | 应用设置
|
// | 应用设置
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
@ -18,15 +27,19 @@ return [
|
|||||||
'default_timezone' => 'Asia/Shanghai',
|
'default_timezone' => 'Asia/Shanghai',
|
||||||
|
|
||||||
// 应用映射(自动多应用模式有效)
|
// 应用映射(自动多应用模式有效)
|
||||||
'app_map' => [],
|
'app_map' => [
|
||||||
|
//'bbs' => 'index',
|
||||||
|
//'*' => 'home',
|
||||||
|
//'admin' => 'admin',
|
||||||
|
],
|
||||||
// 域名绑定(自动多应用模式有效)
|
// 域名绑定(自动多应用模式有效)
|
||||||
'domain_bind' => [
|
'domain_bind' => [
|
||||||
//'bbs' => 'index',
|
//'bbs' => 'index',
|
||||||
//'adm' => 'admin',
|
//'adm' => 'admin',
|
||||||
|
//'www'=>'home',
|
||||||
//'api' => 'api'
|
//'api' => 'api'
|
||||||
],
|
],
|
||||||
// 禁止URL访问的应用列表(自动多应用模式有效)
|
// 禁止URL访问的应用列表(自动多应用模式有效)
|
||||||
'deny_app_list' => [],
|
|
||||||
|
|
||||||
// 异常页面的模板文件
|
// 异常页面的模板文件
|
||||||
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||||
@ -40,5 +53,5 @@ return [
|
|||||||
'http_exception_template' => [
|
'http_exception_template' => [
|
||||||
404 => \think\facade\App::getAppPath() . '404.html',
|
404 => \think\facade\App::getAppPath() . '404.html',
|
||||||
500 => \think\facade\App::getAppPath() . '404.html',
|
500 => \think\facade\App::getAppPath() . '404.html',
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
|
@ -1,28 +1,55 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* @Author: TaoLer <alipey_tao@qq.com>
|
||||||
|
* @Date: 2021-12-06 16:04:50
|
||||||
|
* @LastEditTime: 2022-04-17 16:54:16
|
||||||
|
* @LastEditors: TaoLer
|
||||||
|
* @Description: 搜索引擎SEO优化设置
|
||||||
|
* @FilePath: \TaoLer\config\taoler.php
|
||||||
|
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
|
||||||
|
*/
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | 网站公共配置
|
// | 网站公共配置
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
return [
|
return [
|
||||||
//应用名,此项不可更改
|
// 应用名,此项不可更改
|
||||||
'appname' => 'TaoLer',
|
'appname' => 'TaoLer',
|
||||||
//版本配置
|
// 版本配置
|
||||||
'version' => '1.9.0',
|
'version' => '1.9.1',
|
||||||
//加盐
|
// 加盐
|
||||||
'salt' => 'taoler',
|
'salt' => 'taoler',
|
||||||
//数据库备份目录
|
// 数据库备份目录
|
||||||
'databasebackdir' => app()->getRootPath() .'data/',
|
'databasebackdir' => app()->getRootPath() .'data/',
|
||||||
//配置
|
// 配置
|
||||||
'config' =>[
|
'config' =>[
|
||||||
'email_notice' => 0,
|
'email_notice' => 0,
|
||||||
'cate_show' => 0,
|
'cate_show' => 1,
|
||||||
'area_show' => 0,
|
'area_show' => 1,
|
||||||
'regist_check' => 0,
|
'regist_check' => 0,
|
||||||
'posts_check' => 0,
|
'posts_check' => 0,
|
||||||
'commnets_check' => 0,
|
'commnets_check' => 0,
|
||||||
'login_captcha' => 0,
|
'login_captcha' => 0,
|
||||||
'post_captcha' => 0,
|
'post_captcha' => 0,
|
||||||
|
],
|
||||||
|
|
||||||
|
// 百度标签分词
|
||||||
|
'baidu' => [
|
||||||
|
'grant_type' => '',
|
||||||
|
'client_id' => '',
|
||||||
|
'client_secret' => '',
|
||||||
|
'access_token' => '',
|
||||||
|
'push_api' => '',
|
||||||
|
],
|
||||||
|
|
||||||
|
// sitemap
|
||||||
|
'sitemap' => [
|
||||||
|
'map_num' => '1000',
|
||||||
|
'map_time' => 'daily',
|
||||||
|
'map_level' => '0.5',
|
||||||
|
'write_id' => 0,
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
];
|
];
|
21
public/2022-04-16_1.xml
Normal file
21
public/2022-04-16_1.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?> <!-- XML文件需以utf-8编码-->
|
||||||
|
<urlset>
|
||||||
|
<url>
|
||||||
|
<loc>http://www.test.com/index/jie/7.html</loc>
|
||||||
|
<lastmod>2022-01-01</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>http://www.test.com/index/jie/8.html</loc>
|
||||||
|
<lastmod>2022-01-01</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>http://www.test.com/index/jie/9.html</loc>
|
||||||
|
<lastmod>2022-04-12</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
</urlset>
|
21
public/2022-04-16_2.xml
Normal file
21
public/2022-04-16_2.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?> <!-- XML文件需以utf-8编码-->
|
||||||
|
<urlset>
|
||||||
|
<url>
|
||||||
|
<loc>http://www.test.com/index/jie/10.html</loc>
|
||||||
|
<lastmod>2022-04-15</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>http://www.test.com/index/jie/11.html</loc>
|
||||||
|
<lastmod>2022-04-12</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>http://www.test.com/index/jie/12.html</loc>
|
||||||
|
<lastmod>2022-04-12</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
</urlset>
|
10
public/robots.txt
Normal file
10
public/robots.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
User-agent: *
|
||||||
|
|
||||||
|
Disallow: /admin/
|
||||||
|
Disallow: /index/user/
|
||||||
|
Disallow: /index/api/
|
||||||
|
Disallow: /index/login.html
|
||||||
|
Disallow: /index/reg.html
|
||||||
|
Disallow: /*?*
|
||||||
|
sitemap:http://www.test.com/2022-04-16_1.xml
|
||||||
|
sitemap:http://www.test.com/2022-04-16_2.xml
|
@ -482,10 +482,8 @@ body .layui-edit-face .layui-layer-content{padding:0; background-color:#fff; co
|
|||||||
/*详情页-问答*/
|
/*详情页-问答*/
|
||||||
.user-questions{position:relative; margin: 5px 0 15px;}
|
.user-questions{position:relative; margin: 5px 0 15px;}
|
||||||
.user-questions .user-avatar img{width: 25px; height: 25px; margin-top: 10; border-radius: 100%;}
|
.user-questions .user-avatar img{width: 25px; height: 25px; margin-top: 10; border-radius: 100%;}
|
||||||
.user-questions .user-questions-right{position:absolute; right:0px; display: inline-block; font-size: 14px; padding-left: 5px;}
|
|
||||||
.user-questions .user-questions-right i{padding: 0 3px 0 15px; font-size: 22px; color: #999;}
|
|
||||||
|
|
||||||
.detail-body-wenda{margin: 10px 0 5px; line-height: 26px; font-size: 16px; color: #999; word-wrap: break-word;}
|
.detail-body-wenda{margin: 10px 0 5px; line-height: 26px; font-size: 16px; color: rgb(82, 80, 80); word-wrap: break-word;}
|
||||||
.detail-body-wenda p{margin-bottom:15px;}
|
.detail-body-wenda p{margin-bottom:15px;}
|
||||||
.detail-body-wenda img{max-width: 100%; cursor: pointer;}
|
.detail-body-wenda img{max-width: 100%; cursor: pointer;}
|
||||||
.detail-body-wenda .layui-btn{margin: 0 10px 10px 0;}
|
.detail-body-wenda .layui-btn{margin: 0 10px 10px 0;}
|
||||||
|
@ -116,7 +116,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
|
|||||||
var str = window.getSelection().toString();
|
var str = window.getSelection().toString();
|
||||||
if(!str == ''){
|
if(!str == ''){
|
||||||
//var strB = '<b>'+ str + '</b>';
|
//var strB = '<b>'+ str + '</b>';
|
||||||
layui.focusInsert(editor[0], '[strong] '+ str + '[/strong]');
|
layui.focusInsert(editor[0], '[strong]'+ str + '[/strong]');
|
||||||
//console.log(str);
|
//console.log(str);
|
||||||
// console.log(strB);
|
// console.log(strB);
|
||||||
}
|
}
|
||||||
@ -583,7 +583,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
|
|||||||
|
|
||||||
//转义加粗
|
//转义加粗
|
||||||
.replace(/\[strong\]([\s\S]*)\[\/strong\]\n*/g, function(str){
|
.replace(/\[strong\]([\s\S]*)\[\/strong\]\n*/g, function(str){
|
||||||
return str.replace(/\[strong\]\n*/g, '<b>')
|
return str.replace(/\[strong\]\n*/g,'<b>')
|
||||||
.replace(/\n*\[\/strong\]\n*/g, '</b>');
|
.replace(/\n*\[\/strong\]\n*/g, '</b>');
|
||||||
})
|
})
|
||||||
|
|
||||||
|
4
vendor/composer/autoload_psr4.php
vendored
4
vendor/composer/autoload_psr4.php
vendored
@ -12,9 +12,9 @@ return array(
|
|||||||
'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
|
'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
|
||||||
'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'),
|
'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'),
|
||||||
'think\\app\\' => array($vendorDir . '/topthink/think-multi-app/src'),
|
'think\\app\\' => array($vendorDir . '/topthink/think-multi-app/src'),
|
||||||
'think\\' => array($vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-template/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/framework/src/think'),
|
'think\\' => array($vendorDir . '/topthink/framework/src/think', $vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/think-template/src'),
|
||||||
'taoser\\think\\' => array($vendorDir . '/taoser/think-auth/src'),
|
'taoser\\think\\' => array($vendorDir . '/taoser/think-auth/src'),
|
||||||
'taoser\\' => array($vendorDir . '/taoser/think-addons/src'),
|
'taoser\\' => array($vendorDir . '/taoser/think-addons/src', $vendorDir . '/taoser/think-setarr/src'),
|
||||||
'phpspirit\\databackup\\' => array($vendorDir . '/lotofbadcode/phpspirit_databackup/src'),
|
'phpspirit\\databackup\\' => array($vendorDir . '/lotofbadcode/phpspirit_databackup/src'),
|
||||||
'liliuwei\\social\\' => array($vendorDir . '/liliuwei/thinkphp-social/src'),
|
'liliuwei\\social\\' => array($vendorDir . '/liliuwei/thinkphp-social/src'),
|
||||||
'app\\' => array($baseDir . '/app'),
|
'app\\' => array($baseDir . '/app'),
|
||||||
|
1
vendor/composer/autoload_static.php
vendored
1
vendor/composer/autoload_static.php
vendored
@ -113,6 +113,7 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
|
|||||||
'taoser\\' =>
|
'taoser\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/taoser/think-addons/src',
|
0 => __DIR__ . '/..' . '/taoser/think-addons/src',
|
||||||
|
1 => __DIR__ . '/..' . '/taoser/think-setarr/src',
|
||||||
),
|
),
|
||||||
'phpspirit\\databackup\\' =>
|
'phpspirit\\databackup\\' =>
|
||||||
array (
|
array (
|
||||||
|
95
vendor/composer/installed.json
vendored
95
vendor/composer/installed.json
vendored
@ -227,24 +227,18 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/mime-type-detection",
|
"name": "league/mime-type-detection",
|
||||||
"version": "1.9.0",
|
"version": "1.10.0",
|
||||||
"version_normalized": "1.9.0.0",
|
"version_normalized": "1.10.0.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/mime-type-detection.git",
|
"url": "https://github.com/thephpleague/mime-type-detection.git",
|
||||||
"reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69"
|
"reference": "3e4a35d756eedc67096f30240a68a3149120dae7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/aa70e813a6ad3d1558fc927863d47309b4c23e69",
|
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3e4a35d756eedc67096f30240a68a3149120dae7",
|
||||||
"reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69",
|
"reference": "3e4a35d756eedc67096f30240a68a3149120dae7",
|
||||||
"shasum": "",
|
"shasum": ""
|
||||||
"mirrors": [
|
|
||||||
{
|
|
||||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
|
||||||
"preferred": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"ext-fileinfo": "*",
|
"ext-fileinfo": "*",
|
||||||
@ -255,7 +249,7 @@
|
|||||||
"phpstan/phpstan": "^0.12.68",
|
"phpstan/phpstan": "^0.12.68",
|
||||||
"phpunit/phpunit": "^8.5.8 || ^9.3"
|
"phpunit/phpunit": "^8.5.8 || ^9.3"
|
||||||
},
|
},
|
||||||
"time": "2021-11-21T11:48:40+00:00",
|
"time": "2022-04-11T12:49:04+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -276,7 +270,7 @@
|
|||||||
"description": "Mime-type detection for Flysystem",
|
"description": "Mime-type detection for Flysystem",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
|
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
|
||||||
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.9.0"
|
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.10.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -1264,6 +1258,49 @@
|
|||||||
],
|
],
|
||||||
"install-path": "../taoser/think-auth"
|
"install-path": "../taoser/think-auth"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "taoser/think-setarr",
|
||||||
|
"version": "v0.0.3",
|
||||||
|
"version_normalized": "0.0.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/taoser/think-setarr.git",
|
||||||
|
"reference": "6651c31ef42417a6294ef08e6fb970917b7e7f86"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/taoser/think-setarr/zipball/6651c31ef42417a6294ef08e6fb970917b7e7f86",
|
||||||
|
"reference": "6651c31ef42417a6294ef08e6fb970917b7e7f86",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.2.0"
|
||||||
|
},
|
||||||
|
"time": "2022-04-16T23:08:43+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"taoser\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"mit"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Taoser",
|
||||||
|
"email": "changlin_zhao@qq.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "php confing",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/taoser/think-setarr/issues",
|
||||||
|
"source": "https://github.com/taoser/think-setarr/tree/v0.0.3"
|
||||||
|
},
|
||||||
|
"install-path": "../taoser/think-setarr"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "topthink/framework",
|
"name": "topthink/framework",
|
||||||
"version": "v6.0.12",
|
"version": "v6.0.12",
|
||||||
@ -1342,29 +1379,23 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "topthink/think-captcha",
|
"name": "topthink/think-captcha",
|
||||||
"version": "v3.0.4",
|
"version": "v3.0.6",
|
||||||
"version_normalized": "3.0.4.0",
|
"version_normalized": "3.0.6.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/top-think/think-captcha.git",
|
"url": "https://github.com/top-think/think-captcha.git",
|
||||||
"reference": "db5be361d3cd664d236fb95d5dffe93a117283ad"
|
"reference": "3b60feb4d484381ff7ddda4af7582a6b9be5dacf"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/db5be361d3cd664d236fb95d5dffe93a117283ad",
|
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/3b60feb4d484381ff7ddda4af7582a6b9be5dacf",
|
||||||
"reference": "db5be361d3cd664d236fb95d5dffe93a117283ad",
|
"reference": "3b60feb4d484381ff7ddda4af7582a6b9be5dacf",
|
||||||
"shasum": "",
|
"shasum": ""
|
||||||
"mirrors": [
|
|
||||||
{
|
|
||||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
|
||||||
"preferred": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"topthink/framework": "^6.0.0"
|
"topthink/framework": "^6.0.0"
|
||||||
},
|
},
|
||||||
"time": "2022-01-07T06:34:19+00:00",
|
"time": "2022-03-18T09:11:51+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"think": {
|
"think": {
|
||||||
@ -1378,12 +1409,12 @@
|
|||||||
},
|
},
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
|
||||||
"think\\captcha\\": "src/"
|
|
||||||
},
|
|
||||||
"files": [
|
"files": [
|
||||||
"src/helper.php"
|
"src/helper.php"
|
||||||
]
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"think\\captcha\\": "src/"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -1398,7 +1429,7 @@
|
|||||||
"description": "captcha package for thinkphp",
|
"description": "captcha package for thinkphp",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/top-think/think-captcha/issues",
|
"issues": "https://github.com/top-think/think-captcha/issues",
|
||||||
"source": "https://github.com/top-think/think-captcha/tree/v3.0.4"
|
"source": "https://github.com/top-think/think-captcha/tree/v3.0.6"
|
||||||
},
|
},
|
||||||
"install-path": "../topthink/think-captcha"
|
"install-path": "../topthink/think-captcha"
|
||||||
},
|
},
|
||||||
|
25
vendor/composer/installed.php
vendored
25
vendor/composer/installed.php
vendored
@ -5,7 +5,7 @@
|
|||||||
'type' => 'project',
|
'type' => 'project',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'reference' => 'c22383e6432ee0dc4992378dbd006d79492737b3',
|
'reference' => 'f8f39741994332a33848a2cf4f58ade195aea126',
|
||||||
'name' => 'taoser/taoler',
|
'name' => 'taoser/taoler',
|
||||||
'dev' => true,
|
'dev' => true,
|
||||||
),
|
),
|
||||||
@ -38,12 +38,12 @@
|
|||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'league/mime-type-detection' => array(
|
'league/mime-type-detection' => array(
|
||||||
'pretty_version' => '1.9.0',
|
'pretty_version' => '1.10.0',
|
||||||
'version' => '1.9.0.0',
|
'version' => '1.10.0.0',
|
||||||
'type' => 'library',
|
'type' => 'library',
|
||||||
'install_path' => __DIR__ . '/../league/mime-type-detection',
|
'install_path' => __DIR__ . '/../league/mime-type-detection',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'reference' => 'aa70e813a6ad3d1558fc927863d47309b4c23e69',
|
'reference' => '3e4a35d756eedc67096f30240a68a3149120dae7',
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'liliuwei/thinkphp-social' => array(
|
'liliuwei/thinkphp-social' => array(
|
||||||
@ -160,7 +160,7 @@
|
|||||||
'type' => 'project',
|
'type' => 'project',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'reference' => 'c22383e6432ee0dc4992378dbd006d79492737b3',
|
'reference' => 'f8f39741994332a33848a2cf4f58ade195aea126',
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'taoser/think-addons' => array(
|
'taoser/think-addons' => array(
|
||||||
@ -181,6 +181,15 @@
|
|||||||
'reference' => '19bb04e4fb957a95ff3fdc142939922c19167b43',
|
'reference' => '19bb04e4fb957a95ff3fdc142939922c19167b43',
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
|
'taoser/think-setarr' => array(
|
||||||
|
'pretty_version' => 'v0.0.3',
|
||||||
|
'version' => '0.0.3.0',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../taoser/think-setarr',
|
||||||
|
'aliases' => array(),
|
||||||
|
'reference' => '6651c31ef42417a6294ef08e6fb970917b7e7f86',
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
'topthink/framework' => array(
|
'topthink/framework' => array(
|
||||||
'pretty_version' => 'v6.0.12',
|
'pretty_version' => 'v6.0.12',
|
||||||
'version' => '6.0.12.0',
|
'version' => '6.0.12.0',
|
||||||
@ -191,12 +200,12 @@
|
|||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'topthink/think-captcha' => array(
|
'topthink/think-captcha' => array(
|
||||||
'pretty_version' => 'v3.0.4',
|
'pretty_version' => 'v3.0.6',
|
||||||
'version' => '3.0.4.0',
|
'version' => '3.0.6.0',
|
||||||
'type' => 'library',
|
'type' => 'library',
|
||||||
'install_path' => __DIR__ . '/../topthink/think-captcha',
|
'install_path' => __DIR__ . '/../topthink/think-captcha',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'reference' => 'db5be361d3cd664d236fb95d5dffe93a117283ad',
|
'reference' => '3b60feb4d484381ff7ddda4af7582a6b9be5dacf',
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'topthink/think-helper' => array(
|
'topthink/think-helper' => array(
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.10.0 - 2022-04-11
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Added Flysystem v1 inconclusive mime-types and made it configurable as a constructor parameter.
|
||||||
|
|
||||||
## 1.9.0 - 2021-11-21
|
## 1.9.0 - 2021-11-21
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
|
|
||||||
- Updated lookup
|
- Updated lookup
|
||||||
|
|
||||||
- ## 1.8.0 - 2021-09-25
|
## 1.8.0 - 2021-09-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
2
vendor/league/mime-type-detection/LICENSE
vendored
2
vendor/league/mime-type-detection/LICENSE
vendored
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2013-2020 Frank de Jonge
|
Copyright (c) 2013-2022 Frank de Jonge
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -11,7 +11,13 @@ use finfo;
|
|||||||
|
|
||||||
class FinfoMimeTypeDetector implements MimeTypeDetector
|
class FinfoMimeTypeDetector implements MimeTypeDetector
|
||||||
{
|
{
|
||||||
private const INCONCLUSIVE_MIME_TYPES = ['application/x-empty', 'text/plain', 'text/x-asm'];
|
private const INCONCLUSIVE_MIME_TYPES = [
|
||||||
|
'application/x-empty',
|
||||||
|
'text/plain',
|
||||||
|
'text/x-asm',
|
||||||
|
'application/octet-stream',
|
||||||
|
'inode/x-empty',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var finfo
|
* @var finfo
|
||||||
@ -28,14 +34,21 @@ class FinfoMimeTypeDetector implements MimeTypeDetector
|
|||||||
*/
|
*/
|
||||||
private $bufferSampleSize;
|
private $bufferSampleSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string>
|
||||||
|
*/
|
||||||
|
private $inconclusiveMimetypes;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $magicFile = '',
|
string $magicFile = '',
|
||||||
ExtensionToMimeTypeMap $extensionMap = null,
|
ExtensionToMimeTypeMap $extensionMap = null,
|
||||||
?int $bufferSampleSize = null
|
?int $bufferSampleSize = null,
|
||||||
|
array $inconclusiveMimetypes = self::INCONCLUSIVE_MIME_TYPES
|
||||||
) {
|
) {
|
||||||
$this->finfo = new finfo(FILEINFO_MIME_TYPE, $magicFile);
|
$this->finfo = new finfo(FILEINFO_MIME_TYPE, $magicFile);
|
||||||
$this->extensionMap = $extensionMap ?: new GeneratedExtensionToMimeTypeMap();
|
$this->extensionMap = $extensionMap ?: new GeneratedExtensionToMimeTypeMap();
|
||||||
$this->bufferSampleSize = $bufferSampleSize;
|
$this->bufferSampleSize = $bufferSampleSize;
|
||||||
|
$this->inconclusiveMimetypes = $inconclusiveMimetypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function detectMimeType(string $path, $contents): ?string
|
public function detectMimeType(string $path, $contents): ?string
|
||||||
@ -44,7 +57,7 @@ class FinfoMimeTypeDetector implements MimeTypeDetector
|
|||||||
? (@$this->finfo->buffer($this->takeSample($contents)) ?: null)
|
? (@$this->finfo->buffer($this->takeSample($contents)) ?: null)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
if ($mimeType !== null && ! in_array($mimeType, self::INCONCLUSIVE_MIME_TYPES)) {
|
if ($mimeType !== null && ! in_array($mimeType, $this->inconclusiveMimetypes)) {
|
||||||
return $mimeType;
|
return $mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,8 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
|||||||
'atomsvc' => 'application/atomsvc+xml',
|
'atomsvc' => 'application/atomsvc+xml',
|
||||||
'atx' => 'application/vnd.antix.game-component',
|
'atx' => 'application/vnd.antix.game-component',
|
||||||
'au' => 'audio/x-au',
|
'au' => 'audio/x-au',
|
||||||
|
'avci' => 'image/avci',
|
||||||
|
'avcs' => 'image/avcs',
|
||||||
'avi' => 'video/x-msvideo',
|
'avi' => 'video/x-msvideo',
|
||||||
'avif' => 'image/avif',
|
'avif' => 'image/avif',
|
||||||
'aw' => 'application/applixware',
|
'aw' => 'application/applixware',
|
||||||
@ -160,6 +162,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
|||||||
'com' => 'application/x-msdownload',
|
'com' => 'application/x-msdownload',
|
||||||
'conf' => 'text/plain',
|
'conf' => 'text/plain',
|
||||||
'cpio' => 'application/x-cpio',
|
'cpio' => 'application/x-cpio',
|
||||||
|
'cpl' => 'application/cpl+xml',
|
||||||
'cpp' => 'text/x-c',
|
'cpp' => 'text/x-c',
|
||||||
'cpt' => 'application/mac-compactpro',
|
'cpt' => 'application/mac-compactpro',
|
||||||
'crd' => 'application/x-mscardfile',
|
'crd' => 'application/x-mscardfile',
|
||||||
@ -583,6 +586,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
|||||||
'mpd' => 'application/dash+xml',
|
'mpd' => 'application/dash+xml',
|
||||||
'mpe' => 'video/mpeg',
|
'mpe' => 'video/mpeg',
|
||||||
'mpeg' => 'video/mpeg',
|
'mpeg' => 'video/mpeg',
|
||||||
|
'mpf' => 'application/media-policy-dataset+xml',
|
||||||
'mpg' => 'video/mpeg',
|
'mpg' => 'video/mpeg',
|
||||||
'mpg4' => 'video/mp4',
|
'mpg4' => 'video/mp4',
|
||||||
'mpga' => 'audio/mpeg',
|
'mpga' => 'audio/mpeg',
|
||||||
@ -760,7 +764,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
|||||||
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
|
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
|
||||||
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||||
'pqa' => 'application/vnd.palm',
|
'pqa' => 'application/vnd.palm',
|
||||||
'prc' => 'application/x-pilot',
|
'prc' => 'model/prc',
|
||||||
'pre' => 'application/vnd.lotus-freelance',
|
'pre' => 'application/vnd.lotus-freelance',
|
||||||
'prf' => 'application/pics-rules',
|
'prf' => 'application/pics-rules',
|
||||||
'provx' => 'application/provenance+xml',
|
'provx' => 'application/provenance+xml',
|
||||||
@ -1000,6 +1004,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
|||||||
'txd' => 'application/vnd.genomatix.tuxedo',
|
'txd' => 'application/vnd.genomatix.tuxedo',
|
||||||
'txf' => 'application/vnd.mobius.txf',
|
'txf' => 'application/vnd.mobius.txf',
|
||||||
'txt' => 'text/plain',
|
'txt' => 'text/plain',
|
||||||
|
'u3d' => 'model/u3d',
|
||||||
'u8dsn' => 'message/global-delivery-status',
|
'u8dsn' => 'message/global-delivery-status',
|
||||||
'u8hdr' => 'message/global-headers',
|
'u8hdr' => 'message/global-headers',
|
||||||
'u8mdn' => 'message/global-disposition-notification',
|
'u8mdn' => 'message/global-disposition-notification',
|
||||||
@ -1096,6 +1101,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
|||||||
'webp' => 'image/webp',
|
'webp' => 'image/webp',
|
||||||
'wg' => 'application/vnd.pmi.widget',
|
'wg' => 'application/vnd.pmi.widget',
|
||||||
'wgt' => 'application/widget',
|
'wgt' => 'application/widget',
|
||||||
|
'wif' => 'application/watcherinfo+xml',
|
||||||
'wks' => 'application/vnd.ms-works',
|
'wks' => 'application/vnd.ms-works',
|
||||||
'wm' => 'video/x-ms-wm',
|
'wm' => 'video/x-ms-wm',
|
||||||
'wma' => 'audio/x-ms-wma',
|
'wma' => 'audio/x-ms-wma',
|
||||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// This file is automatically generated at:2022-03-16 18:40:36
|
// This file is automatically generated at:2022-04-17 07:13:49
|
||||||
declare (strict_types = 1);
|
declare (strict_types = 1);
|
||||||
return array (
|
return array (
|
||||||
0 => 'taoser\\addons\\Service',
|
0 => 'taoser\\addons\\Service',
|
||||||
|
1
vendor/taoser/think-setarr/.gitignore
vendored
Normal file
1
vendor/taoser/think-setarr/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.idea
|
21
vendor/taoser/think-setarr/LICENSE
vendored
Normal file
21
vendor/taoser/think-setarr/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 taoser
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
221
vendor/taoser/think-setarr/README.md
vendored
Normal file
221
vendor/taoser/think-setarr/README.md
vendored
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
## 简介
|
||||||
|
插件化开发,安装插件时很多情况需要修改配置文件,通过正则能完美解决修改配置影响备注信息的问题。
|
||||||
|
`taoser/think-setarr`通过配置数组,即可非常简便的修改、添加、删除配置文件中的数据,使得插件化开发更加统一和灵活的对配置文件的操作。
|
||||||
|
|
||||||
|
>配置文件数组遵守的规则为:
|
||||||
|
1. 一个数组中,无论它有多少个元素及是否包含子数组,它的索引数组(一维)在前,关联(多维)数组排序在后。
|
||||||
|
2. 数组每个元素后加`,`号,数组结尾`],`逗号,以方便需要插入新元素时识别。
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
```php
|
||||||
|
composer require taoser/think-setarr
|
||||||
|
```
|
||||||
|
|
||||||
|
## 使用
|
||||||
|
> 类引用变量`app`即为config/app.php文件
|
||||||
|
|
||||||
|
```html
|
||||||
|
use taoser\SetArr;
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
true,false,111,
|
||||||
|
'aaa'=>'bbb',
|
||||||
|
'ccc'=>[
|
||||||
|
true,
|
||||||
|
222,
|
||||||
|
"app()";
|
||||||
|
"//备注信息",
|
||||||
|
......
|
||||||
|
],
|
||||||
|
......
|
||||||
|
];
|
||||||
|
$result = SetArr::name('app')->add($data);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 添加数组节点
|
||||||
|
|
||||||
|
> 可以对配置文件数组中添加新的元素,添加规则:
|
||||||
|
1. 支持嵌套4级数组,最后一级数组元素只能是一维数组,
|
||||||
|
2. 只能给一维数组元素添加备注`“//备注”`,不能添加在关联数组的前面,
|
||||||
|
3. 函数,类,需要引号包裹`""`,
|
||||||
|
4. bool,数值,字符串非索引的元素的添加会重复添加,
|
||||||
|
5. 结果返回布尔值
|
||||||
|
|
||||||
|
```php
|
||||||
|
$add = [
|
||||||
|
1,true,false,
|
||||||
|
"//支持备注的添加",
|
||||||
|
"base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||||
|
'a' => 1,
|
||||||
|
'b' => 'b',
|
||||||
|
'c' => true,
|
||||||
|
'd' => false,
|
||||||
|
'e' => "support\bootstrap\Session::class,",
|
||||||
|
"// 这里这一行添加备注是无效的,在子数组前写备注位置会不正确",
|
||||||
|
'f' => [
|
||||||
|
22,true,false,
|
||||||
|
'aa' => 11,
|
||||||
|
'bb' => 'bb',
|
||||||
|
'cc' => true,
|
||||||
|
'dd' => false,
|
||||||
|
"//支持备注的添加",
|
||||||
|
'ee' => "base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||||
|
'ff' => [
|
||||||
|
333,true,false,
|
||||||
|
'aaa' => 11,
|
||||||
|
'bbb' => 'bb',
|
||||||
|
'ccc' => true,
|
||||||
|
'ddd' => false,
|
||||||
|
'eee' => "support\bootstrap\Session::class,",
|
||||||
|
'fff' => [
|
||||||
|
"//支持备注的添加,最后一级数组只能是一维数组",
|
||||||
|
'aaaa' => 11,
|
||||||
|
'bbbb' => 'bb',
|
||||||
|
'cccc' => true,
|
||||||
|
'dddd' => false,
|
||||||
|
'eeee' => "support\bootstrap\Session::class,",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'gg' => [
|
||||||
|
1,true,false,
|
||||||
|
"base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||||
|
'aa' => 11,
|
||||||
|
'bb' => 'bb',
|
||||||
|
'cc' => true,
|
||||||
|
'dd' => false,
|
||||||
|
'ee' => "support\bootstrap\Session::class,",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'g' => [
|
||||||
|
1,true,false,
|
||||||
|
'ga' => 11,
|
||||||
|
'gb' => 'bb',
|
||||||
|
'gc' => true,
|
||||||
|
'gd' => false,
|
||||||
|
'ge' => "support\bootstrap\Session::class,",
|
||||||
|
'gf' => [
|
||||||
|
1,true,false,
|
||||||
|
"base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||||
|
'gaa' => 11,
|
||||||
|
'gbb' => 'bb',
|
||||||
|
'gcc' => true,
|
||||||
|
'gdd' => false,
|
||||||
|
'gee' => "support\bootstrap\Session::class,",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$conf = \taoser\SetArr::name('app')->add($data);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### 编辑数组节点
|
||||||
|
|
||||||
|
> 数组编辑,
|
||||||
|
1. 不能直接对非索引(下标0,1数值型索引)元素数组进行操作,
|
||||||
|
2. 索引数组的编辑需要先`delete`删除(如true,111,"app()","//备注"),再`add`添加value(如,false,12345,"support\bootstrap\Session::class,","备注2")。
|
||||||
|
|
||||||
|
```php
|
||||||
|
use taoser\SetArr;
|
||||||
|
|
||||||
|
$edit = [
|
||||||
|
'a' => 1,
|
||||||
|
'b' => 'b',
|
||||||
|
'c' => true,
|
||||||
|
'd' => false,
|
||||||
|
'e' => "support\bootstrap\Session::class,",
|
||||||
|
'f' => [
|
||||||
|
'aa' => 11,
|
||||||
|
'bb' => 'bb',
|
||||||
|
'cc' => true,
|
||||||
|
'dd' => false,
|
||||||
|
'ee' => "base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||||
|
'ff' => [
|
||||||
|
'aaa' => 11,
|
||||||
|
'bbb' => 'bb',
|
||||||
|
'ccc' => true,
|
||||||
|
'ddd' => false,
|
||||||
|
'eee' => "support\bootstrap\Session::class,",
|
||||||
|
'fff' => [
|
||||||
|
'aaaa' => 11,
|
||||||
|
'bbbb' => 'bb',
|
||||||
|
'cccc' => true,
|
||||||
|
'dddd' => false,
|
||||||
|
'eeee' => "support\bootstrap\Session::class,",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'gg' => [
|
||||||
|
1,true,false,
|
||||||
|
"base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||||
|
'aa' => 11,
|
||||||
|
'bb' => 'bb',
|
||||||
|
'cc' => true,
|
||||||
|
'dd' => false,
|
||||||
|
'ee' => "support\bootstrap\Session::class,",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'g' => [
|
||||||
|
'ga' => 11,
|
||||||
|
'gb' => 'bb',
|
||||||
|
'ge' => "support\bootstrap\Session::class,",
|
||||||
|
'gf' => [
|
||||||
|
'gaa' => 11,
|
||||||
|
'gbb' => 'bb',
|
||||||
|
'gcc' => true,
|
||||||
|
'gdd' => false,
|
||||||
|
'gee' => "support\bootstrap\Session::class,",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$conf = SetArr::name('app')->edit($edit);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### 删除数值
|
||||||
|
|
||||||
|
> 删除元素规则
|
||||||
|
1. “//备注”、bool、111、'abcd'等,给定value即会删除;
|
||||||
|
2. 关联数组需要给定key和value,value值为空,0,false,null均会删除。
|
||||||
|
3. 删除数据是一条一条删除的,不能只给一个数组的key
|
||||||
|
4. 一个数组删除后会空会把空数组删除
|
||||||
|
|
||||||
|
```php
|
||||||
|
use taoser\SetArr;
|
||||||
|
|
||||||
|
$del = [
|
||||||
|
true,false,111,'US-A',
|
||||||
|
"// 删除备注",
|
||||||
|
"base_path() . DIRECTORY_SEPARATOR . 'public',",
|
||||||
|
'a' => 0,
|
||||||
|
'b' => 0,
|
||||||
|
'c' => 0,
|
||||||
|
'd' => 0,
|
||||||
|
'e' => 0,
|
||||||
|
'f' => [
|
||||||
|
'aa' => '',
|
||||||
|
'bb' => '',
|
||||||
|
'cc' => '',
|
||||||
|
'dd' => '',
|
||||||
|
'ee' => ""
|
||||||
|
'ff' => [
|
||||||
|
'aaa' => false,
|
||||||
|
'bbb' => false,
|
||||||
|
'ccc' => false,
|
||||||
|
'ddd' => false,
|
||||||
|
'eee' => false,
|
||||||
|
'fff' => [
|
||||||
|
'aaaa' => null,
|
||||||
|
'bbbb' => null,
|
||||||
|
'cccc' => null,
|
||||||
|
'dddd' => null,
|
||||||
|
'eeee' => null,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$conf = SetArr::name('app')->delete($del);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
详细参考 [作者](http://wiki.aieok.com)
|
21
vendor/taoser/think-setarr/composer.json
vendored
Normal file
21
vendor/taoser/think-setarr/composer.json
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "taoser/think-setarr",
|
||||||
|
"description": "php confing",
|
||||||
|
"license": "mit",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Taoser",
|
||||||
|
"email": "changlin_zhao@qq.com",
|
||||||
|
"website": "www.aieok.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.2.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"taoser\\": "src/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
903
vendor/taoser/think-setarr/src/SetArr.php
vendored
Normal file
903
vendor/taoser/think-setarr/src/SetArr.php
vendored
Normal file
@ -0,0 +1,903 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @Author: TaoLer <alipey_tao@qq.com>
|
||||||
|
* @Date: 2022-04-14 16:05:35
|
||||||
|
* @LastEditTime: 2022-04-17 07:04:31
|
||||||
|
* @LastEditors: TaoLer
|
||||||
|
* @Description: 搜索引擎SEO优化设置
|
||||||
|
* @FilePath: \undefinede:\github\think-setarr\src\SetArr.php
|
||||||
|
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||||
|
*/
|
||||||
|
namespace taoser;
|
||||||
|
|
||||||
|
class SetArr
|
||||||
|
{
|
||||||
|
protected static string $str = '';
|
||||||
|
protected static string $configName = '';
|
||||||
|
protected static string $configFile = '';
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
//self::$configName = $configName;
|
||||||
|
// 配置文件路径
|
||||||
|
self::$configFile = app()->getConfigPath() . self::$configName . '.php';
|
||||||
|
// 加载配置文件
|
||||||
|
self::$str = file_get_contents(self::$configFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function name(string $configName)
|
||||||
|
{
|
||||||
|
self::$configName = $configName;
|
||||||
|
return new self;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配置项,支持三级数组配置
|
||||||
|
*
|
||||||
|
* @param array $arr
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function add(array $arr) :bool
|
||||||
|
{
|
||||||
|
//正则];数组结尾
|
||||||
|
$end = '/\];/';
|
||||||
|
//一级配置,内容追加到return [一级配置,之后
|
||||||
|
$start = self::getArrSonCount(config(self::$configName)) ? '/return\s*\[[^\[|\]]*,\r?\n/' : '/return\s*\[\r?\n?/';
|
||||||
|
if(is_array($arr)) {
|
||||||
|
foreach ($arr as $k => $v)
|
||||||
|
{
|
||||||
|
if(!is_array($v)) {
|
||||||
|
preg_match($start,self::$str,$arrstart);
|
||||||
|
if(is_int($k)) {
|
||||||
|
// 数值数组
|
||||||
|
if(is_string($v)){
|
||||||
|
|
||||||
|
// 类、函数、注释,原样写入
|
||||||
|
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||||
|
$reps = $arrstart[0]. "\t'". $v ."',\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrstart[0]. "\t". $v .",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($v)) {
|
||||||
|
$reps = ($v == true) ? $arrstart[0]."\ttrue,\n" : $arrstart[0]."\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrstart[0]."\t".$v . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 键值关联数组
|
||||||
|
//判断是否存在KEY
|
||||||
|
if (array_key_exists($k,config(self::$configName))) {
|
||||||
|
echo $k.'不能添加已存在的配置项';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($v)){
|
||||||
|
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||||
|
$reps = $arrstart[0]."\t'" . $k . "' => '" . $v ."',\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrstart[0]."\t'" . $k . "' => " . $v .",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($v)) {
|
||||||
|
$reps = ($v == true) ? $arrstart[0]."\t'" . $k . "' => true,\n" : $arrstart[0]."\t'" . $k . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrstart[0]."\t'" . $k . "' => " . $v .",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$str = preg_replace($start, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// $v是数组,存在多级配置
|
||||||
|
|
||||||
|
// $k不存在,新增二级配置数组, 数组插入];之前
|
||||||
|
if (!array_key_exists($k,config(self::$configName))) {
|
||||||
|
// 拼接数组内元素
|
||||||
|
$sonArr = '';
|
||||||
|
foreach($v as $kk => $vv) {
|
||||||
|
// 1.$vv不是数组,新增配置只有二级元素
|
||||||
|
if(!is_array($vv)) {
|
||||||
|
if(!is_int($kk)) {
|
||||||
|
// 键值对数组
|
||||||
|
if(is_int($vv)) {
|
||||||
|
$sonArr .= "\t\t'". $kk. "' => " . $vv . ",\n";
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArr .= ($vv == true) ? "\t\t'" . $kk . "' => true,\n" : "\t\t'" . $kk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$sonArr .= "\t\t'". $kk. "' => '" . $vv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArr .= "\t\t'". $kk. "' => " . $vv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 数值数组
|
||||||
|
if(is_string($vv)) {
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$sonArr .= "\t\t'" . $vv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArr .= "\t\t" . $vv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArr .= ($vv == true) ? "\t\ttrue,\n" :"\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArr .= "\t\t" . $vv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 2.$vv是数组,新增中包含三级、四级子数组
|
||||||
|
$sonArrson = '';
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
// $vvv不是数组,三级非数组
|
||||||
|
if(!is_array($vvv)){
|
||||||
|
if(!is_int($kkk)) {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
$sonArrson .= ($vvv == true) ? "\t\t\t'". $kkk. "' => true,\n" : "\t\t\t'". $kkk. "' =>false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$sonArrson .= "\t\t\t'" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
$sonArrson .= ($vvv == true) ? "\t\t\ttrue,\n" : "\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//$vvv是数组,但不支持子数组
|
||||||
|
$sonArrsonArr = '';
|
||||||
|
foreach($vvv as $kkkk =>$vvvv) {
|
||||||
|
if(is_array($vvvv)) {
|
||||||
|
echo $kkkk."不支持四级数组\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_int($kkkk)) {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => '" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'". $kkkk . "' => true,\n" : "\t\t\t\t'". $kkkk. "' =>false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => [\n".$sonArrsonArr."\t\t\t],\n";
|
||||||
|
//echo "不支持".$kkkk."是数组";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sonArr .= "\t\t'". $kk. "' => [\n".$sonArrson."\t\t],\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$reps = "\t'". $k. "' => [\n".$sonArr."\t],\n];";
|
||||||
|
self::$str = preg_replace($end, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// $k已存在,二级配置是数组,需要添加二级或三数组元素
|
||||||
|
|
||||||
|
// 把$v的子元素追加在匹配$k => [之后
|
||||||
|
// //匹配$k => [
|
||||||
|
// $kpats = '/\''.$k.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
// preg_match($kpats,self::$str,$arrk);
|
||||||
|
// 新增二级配置
|
||||||
|
|
||||||
|
// 往数组中追加子元素
|
||||||
|
foreach ($v as $kk => $vv) {
|
||||||
|
// 1. $vv不是数组
|
||||||
|
if(!is_array($vv)) {
|
||||||
|
// 新建二级配置
|
||||||
|
|
||||||
|
//匹配$k => [ ***,
|
||||||
|
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[]*,[^\]]/';
|
||||||
|
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
// 添加一维数组,数组中有元素匹配到最后一个数组,没有数组,匹配到数组开头[
|
||||||
|
$kpats = self::getArrSonCount(config(self::$configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
preg_match($kpats,self::$str,$arrk);
|
||||||
|
|
||||||
|
if(!is_int($kk)) {
|
||||||
|
if(array_key_exists($kk,config(self::$configName.'.'.$k))) {
|
||||||
|
echo $kk.'不能添加已存在的配置项kk';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($vv)) {
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$reps = $arrk[0]."\t\t'". $kk. "' => '" . $vv . "',\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrk[0]."\t\t'". $kk. "' => " . $vv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
//布尔
|
||||||
|
$reps = ($vv == true) ? $arrk[0]."\t\t'" . $kk . "' => true,\n" : $arrk[0]."\t\t'" . $kk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrk[0]."\t\t'". $kk. "' => " . $vv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vv)) {
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$reps = $arrk[0] ."\t\t'" . $vv . "',\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrk[0] ."\t\t" . $vv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
$reps = ($vv == true) ? $arrk[0] . "\t\ttrue,\n" : $arrk[0] . "\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$reps = $arrk[0]."\t\t". $vv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$str = preg_replace($kpats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 2. $vv是数组
|
||||||
|
|
||||||
|
// 匹配到数组内部的后面
|
||||||
|
$sonArrnum = self::getArrSonNum(config(self::$configName.'.'.$k));
|
||||||
|
if($sonArrnum > 0) {
|
||||||
|
// 数组存在子数组,匹配到最后一个数组],\n后面
|
||||||
|
$kpats = '/\''.$k.'\'([^\]]*\]){'.$sonArrnum.'},\r?\n/';
|
||||||
|
} else {
|
||||||
|
// 没有子数组
|
||||||
|
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
$kpats = self::getArrSonCount(config(self::$configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
}
|
||||||
|
preg_match($kpats,self::$str,$arrk);
|
||||||
|
|
||||||
|
// a.$vv数组不存在,新建数组及它的子数组$kkk
|
||||||
|
if(!array_key_exists($kk,config(self::$configName . '.' . $k))) {
|
||||||
|
|
||||||
|
$sonArrson = '';
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
// $vvv不是数组
|
||||||
|
if(!is_array($vvv)) {
|
||||||
|
if(!is_int($kkk)) {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArrson .= ($vvv == true) ? "\t\t\t'" . $kkk . "' => true,\n" : "\t\t\t'" . $kkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$sonArrson .= "\t\t\t'" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t".$vvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArrson .= ($vvv == true) ? "\t\t\ttrue,\n" : "\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// $vvv是数组
|
||||||
|
$sonArrsonArr = '';
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
if(!is_int($kkkk)) {
|
||||||
|
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
|
||||||
|
echo $kkkk."已存在?";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => '" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'" . $kkkk . "' => true,\n" : "\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
//布尔
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sonArrson .= "\t\t\t'".$kkk."' => [\n" . $sonArrsonArr . "\t\t\t],\n";
|
||||||
|
//echo '不支持4级数组';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$reps = $arrk[0]."\t\t'". $kk. "' => [\n".$sonArrson."\t\t],\n";
|
||||||
|
self::$str = preg_replace($kpats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// b.$vv数组已存在
|
||||||
|
// 匹配包含$k $kk=>[
|
||||||
|
// $kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[^\[]*\[\r?\n/';
|
||||||
|
// preg_match($kkpats,self::$str,$arrkk);
|
||||||
|
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
//halt(123,$arrkk[0]);
|
||||||
|
// $vvv不是数组,追加$kkk
|
||||||
|
if(!is_array($vvv)) {
|
||||||
|
// 匹配包含$k $kk=>[ ***,
|
||||||
|
//$kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[^\[]*\[\r?\n/';
|
||||||
|
//$kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'\s*=>\s*\[[^\[|\]]*,/';
|
||||||
|
$kkpats = self::getArrSonCount(config(self::$configName.'.'.$k.'.'.$kk)) ? '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kk.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
preg_match($kkpats,self::$str,$arrkk);
|
||||||
|
|
||||||
|
if(!is_int($kkk)) {
|
||||||
|
//判断第三级key是否存在
|
||||||
|
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||||
|
echo $kkk.'不能添加已存在的配置项kkk';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
$repsk = ($vvv == true) ? $arrkk[0]."\t\t\t'" . $kkk . "' => true,\n" : $arrkk[0]."\t\t\t'" . $kkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t'" . $vvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
$repsk = ($vvv == true) ? $arrkk[0]."\t\t\ttrue,\n" : $arrkk[0]."\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$repsk = $arrkk[0]."\t\t\t" . $vvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$str = preg_replace($kkpats,$repsk, self::$str);
|
||||||
|
} else {
|
||||||
|
// $vvv是数组,a.数组存在,b.数组不存在
|
||||||
|
|
||||||
|
//a. $kkk数组存在
|
||||||
|
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||||
|
//匹配包含$k $kk $kkk 到]的内容
|
||||||
|
//$sonPats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[\s\S]*?(?:'.$kkk.')\' [^\]]*/';
|
||||||
|
//[\s\S]*?(?:'.$kkk.')\'(.*),/
|
||||||
|
|
||||||
|
// $k3pats = '/\'' . $kk k. '\'[\s\S]*?(?:'.$kkk.')\'\s*=>\s*\[\r?\n/';
|
||||||
|
// 正则到数组内的元素,不包含子数组
|
||||||
|
//$k3pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
$k3pats = self::getArrSonCount(config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk)) ? '/\''.$kkk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kkk.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
preg_match($k3pats,self::$str,$arrk3);
|
||||||
|
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
preg_match($k3pats,self::$str,$arrk3);
|
||||||
|
if(!is_int($kkkk)) {
|
||||||
|
// 多维数组
|
||||||
|
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
|
||||||
|
echo $kkkk."已存在k4";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => '" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonReps = ($vvvv == true) ? $arrk3[0]."\t\t\t\t'" . $kkkk . "' => true,\n" : $arrk3[0]."\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 数值数组
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t'" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonReps = ($vvvv == true) ? $arrk3[0]."\t\t\t\ttrue,\n" : $arrk3[0]."\t\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonReps = $arrk3[0]."\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$str = preg_replace($k3pats,$sonReps, self::$str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// b. $kkk不存在
|
||||||
|
|
||||||
|
// 匹配到数组内部的后面k
|
||||||
|
$sonArrnum = self::getArrSonNum(config(self::$configName.'.'.$k.'.'.$kk));
|
||||||
|
if($sonArrnum > 0) {
|
||||||
|
// 数组存在子数组,匹配到最后一个数组],\n后面
|
||||||
|
$kkpats = '/\''.$kk.'\'([^\]]*\]){'.$sonArrnum.'},\r?\n/';
|
||||||
|
} else {
|
||||||
|
// 没有子数组k
|
||||||
|
//$kkpats = '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
$kkpats = self::getArrSonCount(config(self::$configName.'.'.$k.'.'.$kk)) ? '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kk.'\'\s*=>\s*\[\r?\n/';
|
||||||
|
}
|
||||||
|
preg_match($kkpats,self::$str,$arrkk);
|
||||||
|
|
||||||
|
$sonArrsonArr = '';
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
if(is_array($vvvv)) {
|
||||||
|
echo '不支持四级数组';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!is_int($kkkk)) {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => '" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'" . $kkkk . "' => true,\n" : "\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||||
|
} else {
|
||||||
|
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$reps = $arrkk[0]."\t\t\t'".$kkk."' => [\n" . $sonArrsonArr . "\t\t\t],\n";
|
||||||
|
self::$str = preg_replace($kkpats,$reps, self::$str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//写入配置
|
||||||
|
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑配置数组表
|
||||||
|
* 一位数组修改请用delete和add组合
|
||||||
|
* 仅支持键值对的数组修改
|
||||||
|
*
|
||||||
|
* @param array $arr
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function edit($arr) :bool
|
||||||
|
{
|
||||||
|
|
||||||
|
// 只能修改有键值对的数组
|
||||||
|
if(!is_array($arr)) return false;
|
||||||
|
|
||||||
|
foreach($arr as $k => $v) {
|
||||||
|
// key不存在
|
||||||
|
if(!array_key_exists($k,config(self::$configName))) {
|
||||||
|
echo $k.'不存在 ';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 一级数组修改
|
||||||
|
if(!is_array($v)) {
|
||||||
|
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arr);
|
||||||
|
//halt($arr);
|
||||||
|
if(is_string($v)){
|
||||||
|
// 字符串
|
||||||
|
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||||
|
$repk = "'". $k . "' => '" . $v . "',";
|
||||||
|
} else {
|
||||||
|
$repk = "'". $k . "' => " . $v . ",";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($v)) {
|
||||||
|
//布尔
|
||||||
|
$repk = ($v == true) ? "'" . $k . "' => true," : "'" . $k . "' => false,";
|
||||||
|
} else {
|
||||||
|
// 数字
|
||||||
|
$repk = "'". $k . "' => " . $v .",";
|
||||||
|
}
|
||||||
|
$patk = '/\'' . $k . '\'(.*),/';
|
||||||
|
$reps = preg_replace($patk, $repk, $arr[0]);
|
||||||
|
// 正则查找然后替换
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 正则二级配置
|
||||||
|
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,/';
|
||||||
|
// 二级和三级
|
||||||
|
foreach($v as $kk => $vv) {
|
||||||
|
if(!array_key_exists($kk, config(self::$configName.'.'.$k))) {
|
||||||
|
echo $kk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//二级配置
|
||||||
|
if(!is_array($vv)) {
|
||||||
|
if(is_string($vv)){
|
||||||
|
// 字符串
|
||||||
|
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||||
|
$repkk = "'". $kk . "' => '" . $vv . "',";
|
||||||
|
} else {
|
||||||
|
$repkk = "'". $kk . "' => " . $vv . ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif(is_bool($vv)) {
|
||||||
|
//布尔
|
||||||
|
$repkk = ($vv == true) ? "'" . $kk . "' => true," : "'" . $kk . "' => false,";
|
||||||
|
} else {
|
||||||
|
// 数字
|
||||||
|
$repkk = "'". $kk . "' => " . $vv .",";
|
||||||
|
}
|
||||||
|
preg_match($pats,self::$str,$arrk);
|
||||||
|
// 正则需要替换的部分
|
||||||
|
$patkk = '/\'' . $kk . '\'(.*?),/';
|
||||||
|
$reps = preg_replace($patkk, $repkk, $arrk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 三级配置
|
||||||
|
// 正则二级下的三级配置
|
||||||
|
//$pats = '/\'' . $kkk . '\'[\s\S]*?(?:'.$kkk.')\'(.*),/';
|
||||||
|
$pats = '/\'' . $kk . '\'\s*=>\s*\[[^\[|\]]*,/';
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
if(!array_key_exists($kkk, config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||||
|
echo $kkk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!is_array($vvv)) {
|
||||||
|
// 类型判断
|
||||||
|
if(is_string($vvv)) {
|
||||||
|
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||||
|
$arrReps = "'" . $kkk . "' => '" . $vvv . "',";
|
||||||
|
} else {
|
||||||
|
$arrReps = "'" . $kkk . "' => " . $vvv . ",";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvv)) {
|
||||||
|
//布尔
|
||||||
|
$arrReps = ($vvv == true) ? "'" . $kkk . "' => true," : "'" . $kkk . "' => false,";
|
||||||
|
} else {
|
||||||
|
$arrReps = "'" . $kkk . "' => " . $vvv . ",";
|
||||||
|
}
|
||||||
|
preg_match($pats,self::$str,$arrkk);
|
||||||
|
// 正则需要替换的部分
|
||||||
|
$arrPats = '/\'' . $kkk . '\'(.*),/';
|
||||||
|
$reps = preg_replace($arrPats, $arrReps, $arrkk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 四级配置
|
||||||
|
// 正则$kkk
|
||||||
|
//$pats = '/\'' . $kk . '\'[\s\S]*?(?:'.$kkk.')\'[\s\S]*?(?:'.$kkkk.')\'(.*),/';
|
||||||
|
$pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,/';
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
if(!array_key_exists($kkkk, config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))){
|
||||||
|
echo $kkk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 类型判断
|
||||||
|
if(is_string($vvvv)) {
|
||||||
|
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false) {
|
||||||
|
$repskkkk = "'" . $kkkk . "' => '" . $vvvv . "',";
|
||||||
|
} else {
|
||||||
|
$repskkkk = "'" . $kkkk . "' => " . $vvvv . ",";
|
||||||
|
}
|
||||||
|
} elseif(is_bool($vvvv)) {
|
||||||
|
//布尔
|
||||||
|
$repskkkk = ($vvvv == true) ? "'" . $kkkk . "' => true," : "'" . $kkkk . "' => false,";
|
||||||
|
} else {
|
||||||
|
$repskkkk = "'" . $kkkk . "' => " . $vvvv . ",";
|
||||||
|
}
|
||||||
|
preg_match($pats,self::$str,$arrkkk);
|
||||||
|
$patskkkk = '/\'' . $kkkk . '\'(.*),/';
|
||||||
|
$reps = preg_replace($patskkkk, $repskkkk, $arrkkk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//写入配置
|
||||||
|
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配置数组表
|
||||||
|
* 不支持一次性删除整个数组
|
||||||
|
* 子元素被删除会清理空数组
|
||||||
|
*
|
||||||
|
* @param array $arr
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function delete($arr) :bool
|
||||||
|
{
|
||||||
|
// 只能修改有键值对的数组
|
||||||
|
if(!is_array($arr)) return false;
|
||||||
|
|
||||||
|
foreach($arr as $k => $v) {
|
||||||
|
// 一级数组修改
|
||||||
|
if(!is_array($v)) {
|
||||||
|
// 正则开头到,不包含子数组
|
||||||
|
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arr);
|
||||||
|
if(!isset($arr[0])) {
|
||||||
|
echo '有误,删除项可能并不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_int($k)) {
|
||||||
|
// 一维数组正则
|
||||||
|
$patk = self::getPats($v);
|
||||||
|
} else {
|
||||||
|
// key不存在
|
||||||
|
if(!array_key_exists($k,config(self::$configName))) {
|
||||||
|
echo $k.'不存在 ';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$patk = '/[^\n]*\'' . $v . '\'(.*?)\r?\n/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正则查找然后替换
|
||||||
|
$reps = preg_replace($patk, '', $arr[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// 二级和三级
|
||||||
|
foreach($v as $kk => $vv) {
|
||||||
|
//二级配置
|
||||||
|
if(!is_array($vv)) {
|
||||||
|
// 正则二级配置
|
||||||
|
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arrk);
|
||||||
|
if(!isset($arrk[0])) {
|
||||||
|
echo $k.'有误,可能并不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_int($kk)) {
|
||||||
|
$patkk = self::getPats($vv);
|
||||||
|
} else {
|
||||||
|
// key不存在
|
||||||
|
if(!array_key_exists($kk,config(self::$configName.'.'.$k))) {
|
||||||
|
echo $kk.'不存在 ';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 正则需要替换的部分
|
||||||
|
$patkk = '/[^\n]*\'' . $kk . '\'(.*?),\r?\n/';
|
||||||
|
}
|
||||||
|
$reps = preg_replace($patkk, '', $arrk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 三级配置
|
||||||
|
|
||||||
|
foreach($vv as $kkk => $vvv) {
|
||||||
|
if(!is_array($vvv)) {
|
||||||
|
// 正则二级下的三级配置
|
||||||
|
$pats = '/\'' . $kk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arrkk);
|
||||||
|
if(!isset($arrkkk[0])) {
|
||||||
|
echo $kk.'有误,可能并不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_int($kkk)) {
|
||||||
|
$patkkk = self::getPats($vvv);
|
||||||
|
} else {
|
||||||
|
if(!array_key_exists($kkk, config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||||
|
echo $kkk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$patkkk = '/[^\n]*\'' . $kkk . '\'(.*),\r?\n/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正则需要替换的部分
|
||||||
|
$reps = preg_replace($patkkk, '', $arrkk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
// 四级配置
|
||||||
|
|
||||||
|
foreach($vvv as $kkkk => $vvvv) {
|
||||||
|
if(!is_array($vvvv)) {
|
||||||
|
// 正则$kkk
|
||||||
|
$pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||||
|
preg_match($pats,self::$str,$arrkkk);
|
||||||
|
if(!isset($arrkkk[0])) {
|
||||||
|
echo $kkk.'有误,可能并不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(is_int($kkkk)) {
|
||||||
|
$patskkkk = self::getPats($vvvv);
|
||||||
|
} else {
|
||||||
|
if(!array_key_exists($kkkk, config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))){
|
||||||
|
echo $kkkk.'不存在';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$patskkkk = '/[^\n]*\'' . $kkkk . '\'(.*),\r?\n/';
|
||||||
|
}
|
||||||
|
|
||||||
|
$reps = preg_replace($patskkkk, '', $arrkkk[0]);
|
||||||
|
self::$str = preg_replace($pats, $reps, self::$str);
|
||||||
|
} else {
|
||||||
|
echo '不支持更多的层级数组';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 匹配空数组
|
||||||
|
* 'key' => [
|
||||||
|
* ],
|
||||||
|
*/
|
||||||
|
$nullArray = '/[^\n]*\'\w+\'\s*=>\s*\[\s*\]{1}\S*\,?\r?\n/m';
|
||||||
|
//preg_match($nullArray,self::$str,$arr);
|
||||||
|
self::$str = preg_replace($nullArray, '', self::$str);
|
||||||
|
|
||||||
|
}
|
||||||
|
//写入配置
|
||||||
|
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数组中子元素为数组的个数
|
||||||
|
*
|
||||||
|
* @param [type] $arr
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public static function getArrSonNum($arr) :int
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
foreach ($arr as $val) {
|
||||||
|
if(is_array($val)){
|
||||||
|
$i++;
|
||||||
|
foreach($val as $vv){
|
||||||
|
if(is_array($vv)){
|
||||||
|
$i++;
|
||||||
|
self::getArrSonNum($vv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取一维数组在正则公式
|
||||||
|
*
|
||||||
|
* @param [type] $v
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getPats($v) :string
|
||||||
|
{
|
||||||
|
if(is_bool($v)){
|
||||||
|
//布尔
|
||||||
|
$pats = $v ? '/[^\n]*true,\r?\n/' : '/[^\n]*false,\r?\n/';
|
||||||
|
} else {
|
||||||
|
// 字符串包含\
|
||||||
|
if(stripos($v,"\\") !== false) {
|
||||||
|
$v = str_replace("\\", "\\\\", $v);
|
||||||
|
}
|
||||||
|
// 字符串包含/
|
||||||
|
if(stripos($v,'/') !== false) {
|
||||||
|
$v = str_replace('/', '\/', $v);
|
||||||
|
}
|
||||||
|
if(stripos($v,'(') !== false) {
|
||||||
|
$v = str_replace('(', "\(", $v);
|
||||||
|
}
|
||||||
|
if(stripos($v,')') !== false) {
|
||||||
|
$v = str_replace(')', "\)", $v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(stripos($v,":") !== false) {
|
||||||
|
// $v = str_replace(":", "\:", $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
// if(stripos($v,'.') !== false) {
|
||||||
|
// $v = str_replace('.', '\.', $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
// if(stripos($v,"'") !== false) {
|
||||||
|
// $v = str_replace('\'', "\'", $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
|
||||||
|
// if(stripos($v,'-') !== false) {
|
||||||
|
// $v = str_replace('-', "\-", $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
// if(stripos($v,'>') !== false) {
|
||||||
|
// $v = str_replace('>', "\>", $v);
|
||||||
|
// }
|
||||||
|
// dump($v);
|
||||||
|
$pats = '/[^\n]*' . $v . '(.*?)\r?\n/';
|
||||||
|
}
|
||||||
|
return $pats;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数组内数值数组的个数
|
||||||
|
* 排除数组中元素为数组的元素
|
||||||
|
*
|
||||||
|
* @param array $array
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function getArrSonCount(array $array) :bool
|
||||||
|
{
|
||||||
|
// 数组元素数量
|
||||||
|
$count = count($array);
|
||||||
|
// 子数组个数
|
||||||
|
$i = 0;
|
||||||
|
foreach ($array as $val) {
|
||||||
|
if(is_array($val)) {
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 数值数组的数量
|
||||||
|
$count = $count - $i;
|
||||||
|
if($count > 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
vendor/topthink/think-captcha/assets/zhttfs/1.otf
vendored
Normal file
BIN
vendor/topthink/think-captcha/assets/zhttfs/1.otf
vendored
Normal file
Binary file not shown.
@ -192,7 +192,7 @@ class Captcha
|
|||||||
$dir = dir($ttfPath);
|
$dir = dir($ttfPath);
|
||||||
$ttfs = [];
|
$ttfs = [];
|
||||||
while (false !== ($file = $dir->read())) {
|
while (false !== ($file = $dir->read())) {
|
||||||
if ('.' != $file[0] && substr($file, -4) == '.ttf') {
|
if (substr($file, -4) == '.ttf' || substr($file, -4) == '.otf') {
|
||||||
$ttfs[] = $file;
|
$ttfs[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ class Captcha
|
|||||||
|
|
||||||
foreach ($text as $index => $char) {
|
foreach ($text as $index => $char) {
|
||||||
|
|
||||||
$x = $this->fontSize * ($index + 1) * mt_rand(1.2, 1.6) * ($this->math ? 1 : 1.5);
|
$x = $this->fontSize * ($index + 1) * ($this->math ? 1 : 1.5);
|
||||||
$y = $this->fontSize + mt_rand(10, 20);
|
$y = $this->fontSize + mt_rand(10, 20);
|
||||||
$angle = $this->math ? 0 : mt_rand(-40, 40);
|
$angle = $this->math ? 0 : mt_rand(-40, 40);
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{extend name="public/base" /}
|
{extend name="public/base" /}
|
||||||
|
|
||||||
{block name="title"}发表帖子{/block}
|
{block name="title"}发表帖子{/block}
|
||||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||||
{block name="column"}{/block}
|
{block name="column"}{/block}
|
||||||
@ -82,12 +81,17 @@
|
|||||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>{:lang('uploads')}</button>
|
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>{:lang('uploads')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">{:lang('描述')}</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<textarea name="description" class="layui-textarea" placeholder="SEO描述"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<label class="layui-form-label">{:lang('add tags')}</label>
|
<label class="layui-form-label">{:lang('add tags')}</label>
|
||||||
<div class="layui-input-inline" style="width: 190px;">
|
<div class="layui-input-inline" style="width: 190px;">
|
||||||
<input type="text" class="layui-input" name="tags" placeholder="多个标签用,号隔开" title="添加标签"/>
|
<input type="text" class="layui-input" name="tags" value="" placeholder="多个用空格隔开" title="添加标签"/>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
||||||
</div>
|
</div>
|
||||||
@ -112,14 +116,15 @@
|
|||||||
<div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
|
<div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
|
||||||
</div>
|
</div>
|
||||||
</div-->
|
</div-->
|
||||||
|
|
||||||
{if config('taoler.config.post_captcha') == 1}
|
{if config('taoler.config.post_captcha') == 1}
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div class="layui-form-mid layui-word-aux" style="padding-top: 0px !important;">
|
||||||
<span style="color: #c00;"><img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></span>
|
<img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@ -137,14 +142,6 @@
|
|||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="script"}
|
{block name="script"}
|
||||||
<script>
|
|
||||||
//删除tag
|
|
||||||
$(document).ready(function(){
|
|
||||||
$('.layui-btn-container').on('click','button',function(){
|
|
||||||
$(this).remove();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['fly','form','colorpicker','upload','plyr'], function(){
|
layui.use(['fly','form','colorpicker','upload','plyr'], function(){
|
||||||
var $ = layui.jquery
|
var $ = layui.jquery
|
||||||
@ -154,13 +151,13 @@
|
|||||||
,upload = layui.upload
|
,upload = layui.upload
|
||||||
,plyr = layui.plyr;
|
,plyr = layui.plyr;
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
// 如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
$('.layui-textarea').each(function(){
|
$('.layui-textarea').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.html(fly.content(html));
|
othis.html(fly.content(html));
|
||||||
})
|
});
|
||||||
|
|
||||||
//预定义颜色项
|
// 预定义颜色项
|
||||||
colorpicker.render({
|
colorpicker.render({
|
||||||
elem: '#color'
|
elem: '#color'
|
||||||
,color: '#393d49'
|
,color: '#393d49'
|
||||||
@ -189,7 +186,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//发布文章
|
// 发布文章
|
||||||
form.on('submit(article-add)', function(data){
|
form.on('submit(article-add)', function(data){
|
||||||
var field = data.field;
|
var field = data.field;
|
||||||
var numArr = new Array();
|
var numArr = new Array();
|
||||||
@ -201,7 +198,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
url:"{:url('article/add')}",
|
url:"{:url('article/add')}",
|
||||||
data:{"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"captcha":field.captcha},
|
data:{"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"description":field.description,"captcha":field.captcha},
|
||||||
dataType:"json",
|
dataType:"json",
|
||||||
success:function (data){
|
success:function (data){
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
@ -218,41 +215,79 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
//添加tags
|
// 获取描述的内容
|
||||||
|
$("#L_content").bind('input propertychange', function(){
|
||||||
|
var content = $(this).val()
|
||||||
|
$.ajax({
|
||||||
|
type:"post",
|
||||||
|
url:"{:url('article/getDescription')}",
|
||||||
|
data:{"content":content},
|
||||||
|
daType:"json",
|
||||||
|
success:function (data){
|
||||||
|
if (data.code == 0) {
|
||||||
|
$('[name="description"]').val(data.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
|
// 手动添加tags
|
||||||
$('#article-tags-button').on('click',function(){
|
$('#article-tags-button').on('click',function(){
|
||||||
var tags = $("input[name='tags']").val();
|
var tags = $("input[name='tags']").val();
|
||||||
|
var flag = 'off';
|
||||||
|
getTags(tags,flag);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取tag的内容
|
||||||
|
var conf = "{:empty(config('taoler.baidu.client_id'))}";
|
||||||
|
if(conf !== '1'){
|
||||||
|
$("#L_title").on('blur', function(){
|
||||||
|
var title = $(this).val();
|
||||||
|
var flag = 'on';
|
||||||
|
// 清空上次生成的tag button
|
||||||
|
$('.layui-btn-container').children('button').each(function(){$(this).remove()});
|
||||||
|
getTags(title,flag);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加关键词button
|
||||||
|
function getTags(tags,flag)
|
||||||
|
{
|
||||||
if(tags == ''){
|
if(tags == ''){
|
||||||
layer.msg('不能为空');
|
layer.msg('tag不能为空');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//把得到的tags放进数组
|
//把得到的tags放进数组
|
||||||
var numArr = new Array();
|
var numArr = new Array();
|
||||||
$('.layui-btn-container').children('button').each(function(){
|
$('.layui-btn-container').children('button').each(function(){
|
||||||
numArr.push($(this).val());//添加至数组
|
numArr.push($(this).val());//添加至数组
|
||||||
});
|
});
|
||||||
|
|
||||||
for(var i=0; i<numArr.length; i++){
|
|
||||||
if(tags.indexOf(numArr[i])>=0){
|
|
||||||
layer.msg('不能重复添加'+numArr[i]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//console.log(tags);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
url:"{:url('article/tags')}",
|
url:"{:url('article/tags')}",
|
||||||
data:{"tags":tags},
|
data:{"tags":tags,"flag":flag},
|
||||||
daType:"json",
|
daType:"json",
|
||||||
success:function (data){
|
success:function (data){
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
for(var i=0; i<data.data.length; i++){
|
for(var i=0; i<data.data.length; i++){
|
||||||
$('.layui-btn-container').append('<button type="button" class="layui-btn" value='+data.data[i]+'>'+data.data[i]+'</button>');
|
if($.inArray(data.data[i],numArr) < 0){
|
||||||
|
$('.layui-btn-container').append('<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" value='+data.data[i]+'>'+data.data[i]+' x'+'</button>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$("input[name='tags']").val("");
|
$("input[name='tags']").val("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
// 删除tag
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('.layui-btn-container').on('click','button',function(){
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//加载播放器
|
//加载播放器
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{extend name="public/base" /}
|
{extend name="public/base" /}
|
||||||
|
|
||||||
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
||||||
{block name="keywords"}{$article.title},{$article.tags}{/block}
|
{block name="keywords"}{$article.tags}{/block}
|
||||||
{block name="description"}{$article.title},{:getArtContent($article.content)}{/block}
|
{block name="description"}{$article.title},{$article.description}{/block}
|
||||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||||
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
||||||
{block name="content"}
|
{block name="content"}
|
||||||
@ -11,8 +11,17 @@
|
|||||||
<div class="layui-col-md9 content detail">
|
<div class="layui-col-md9 content detail">
|
||||||
<div class="fly-panel detail-box">
|
<div class="fly-panel detail-box">
|
||||||
{//标题}
|
{//标题}
|
||||||
<div class="title layui-clear">
|
<div class="title layui-clear"><h1 style="color:{$article.title_color};">{$article.title}</h1></div>
|
||||||
<h1 style="color:{$article.title_color};">{$article.title}</h1>
|
<div class="detail_qrcode layui-hide-xs" onclick="PhoneDown();" id="mobile"></div>
|
||||||
|
|
||||||
|
{//图标}
|
||||||
|
<div class="user-questions">
|
||||||
|
<a class="user-avatar" href="{:url('user/home',['id'=>$article.user.id])}">
|
||||||
|
<img src="{$article.user.user_img}" alt="{$article.user.name}">
|
||||||
|
<cite>{$article.user.nickname ?: $article.user.name} / </cite>
|
||||||
|
</a>
|
||||||
|
<span class="user-post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
|
||||||
|
/ <i class="iconfont" title="{:lang('reply')}"></i> {$article.comments_count} / <i class="iconfont" title="浏览"></i> {$pv}
|
||||||
{if ($article.jie == 0)}
|
{if ($article.jie == 0)}
|
||||||
<span class="layui-btn layui-btn-xs" style="background-color: #FF5722;">{:lang('no finished')}</span>
|
<span class="layui-btn layui-btn-xs" style="background-color: #FF5722;">{:lang('no finished')}</span>
|
||||||
{else /}
|
{else /}
|
||||||
@ -20,23 +29,6 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
|
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail_qrcode layui-hide-xs" onclick="PhoneDown();" id="mobile"></div>
|
|
||||||
|
|
||||||
{//图标}
|
|
||||||
<div class="user-questions">
|
|
||||||
<a class="user-avatar" href="{:url('user/home',['id'=>$article.user.id])}">
|
|
||||||
<img src="{$article.user.user_img}" alt="{$article.user.name}">
|
|
||||||
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
|
||||||
</a>
|
|
||||||
<span class="user-post-time" data="{$article.create_time}" style="padding-top: 5px;">2019-12-01</span>
|
|
||||||
<span class="user-questions-right">
|
|
||||||
<i class="iconfont" title="{:lang('reply')}"></i>{$article.comments_count}<i class="iconfont" title="浏览"></i>{$pv}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{//问题内容}
|
|
||||||
<div>问题描述:</div>
|
|
||||||
<div class="detail-body-wenda photos" id="content">{$article.content}</div>
|
|
||||||
|
|
||||||
{//管理}
|
{//管理}
|
||||||
{if (($article.upzip !== '') || (session('user_id')==$article.user_id) OR ($user.auth ?? ''))}
|
{if (($article.upzip !== '') || (session('user_id')==$article.user_id) OR ($user.auth ?? ''))}
|
||||||
@ -47,8 +39,11 @@
|
|||||||
<div class="fly-admin-box" data-id="{$article.id}">
|
<div class="fly-admin-box" data-id="{$article.id}">
|
||||||
{if ($user.auth ?? '')}
|
{if ($user.auth ?? '')}
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="del"><i class="layui-icon layui-icon-delete"></i></span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="del"><i class="layui-icon layui-icon-delete"></i></span>
|
||||||
{if($article.is_top == 0)}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="1"><i class="layui-icon layui-icon-top"></i></span>
|
{if($article.is_top == 0)}
|
||||||
{else /}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>{/if}
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="1"><i class="layui-icon layui-icon-top"></i></span>
|
||||||
|
{else /}
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>
|
||||||
|
{/if}
|
||||||
{if($article.is_hot == 0)}
|
{if($article.is_hot == 0)}
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="1"><i class="layui-icon layui-icon-fire"></i></span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="1"><i class="layui-icon layui-icon-fire"></i></span>
|
||||||
{else /}
|
{else /}
|
||||||
@ -67,7 +62,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<hr class="layui-border-green">
|
||||||
|
|
||||||
|
{//问题内容}
|
||||||
|
<div style="margin-top: 15px; font-size: 18px; font-weight:bold; color: rgb(130, 125, 125);">问题描述:</div>
|
||||||
|
<hr>
|
||||||
|
<div class="detail-body-wenda photos" id="content">{$article.content}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{//评论区}
|
{//评论区}
|
||||||
{if condition="$article.is_reply == 1"}
|
{if condition="$article.is_reply == 1"}
|
||||||
<div class="layui-form layui-form-pane">
|
<div class="layui-form layui-form-pane">
|
||||||
@ -118,16 +121,19 @@
|
|||||||
<span type="edit">{:lang('edit')}</span>
|
<span type="edit">{:lang('edit')}</span>
|
||||||
<span type="del">{:lang('delete')}</span>
|
<span type="del">{:lang('delete')}</span>
|
||||||
{/if}
|
{/if}
|
||||||
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}<span class="jieda-accept" type="accept">{:lang('accept')}</span>{/if}
|
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}
|
||||||
|
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{/volist}
|
{/volist}
|
||||||
</ul>
|
</ul>
|
||||||
<div style="text-align: center" id="pages"></div>
|
<div style="text-align: center" id="pages"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
{// 右栏}
|
||||||
</div>
|
|
||||||
<div class="layui-col-md3">
|
<div class="layui-col-md3">
|
||||||
|
|
||||||
<div class="fly-panel">
|
<div class="fly-panel">
|
||||||
@ -149,7 +155,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="fly-panel-main">
|
<div class="fly-panel-main">
|
||||||
{volist name="ad_comm" id="vo"}
|
{volist name="ad_comm" id="vo"}
|
||||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
|
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color:{$vo.slid_color};">{$vo.slid_name}</a>
|
||||||
{/volist}
|
{/volist}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -168,8 +174,9 @@
|
|||||||
{/volist}
|
{/volist}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--底部栏-->
|
<!--底部栏-->
|
||||||
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
||||||
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -177,7 +184,6 @@
|
|||||||
{include file="public/menu" /}
|
{include file="public/menu" /}
|
||||||
{/block}
|
{/block}
|
||||||
{block name="script"}
|
{block name="script"}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var collectionFind = "{:url('Collection/find')}",
|
var collectionFind = "{:url('Collection/find')}",
|
||||||
collection = "{:url('collection/')}",
|
collection = "{:url('collection/')}",
|
||||||
@ -259,9 +265,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
|||||||
var index = layer.load(1);
|
var index = layer.load(1);
|
||||||
var filed = data.field;
|
var filed = data.field;
|
||||||
if (uid == -1) {
|
if (uid == -1) {
|
||||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
layer.msg('请先登陆',{icon:5,time:2000},function(){location.href = "{:url('login/index')}"});
|
||||||
location.href = "{:url('login/index')}";
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
@ -270,9 +274,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
success:function (data) {
|
success:function (data) {
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
layer.msg(data.msg,{icon:6,time:2000},function () {
|
layer.msg(data.msg,{icon:6,time:2000},function () {location.reload(true)});
|
||||||
location.reload(true);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
|
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
|
||||||
}
|
}
|
||||||
@ -333,9 +335,9 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
// 点击图片放大
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// 点击图片放大
|
||||||
$(function(){
|
$(function(){
|
||||||
$(".photos").on("click","img",function(){
|
$(".photos").on("click","img",function(){
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
|
<!--div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
|
||||||
<div class="layui-col-md3">
|
<div class="layui-col-md3">
|
||||||
<label class="layui-form-label">所属产品</label>
|
<label class="layui-form-label">所属产品</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
@ -69,10 +69,11 @@
|
|||||||
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本,如:IE 11" autocomplete="off" class="layui-input">
|
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本,如:IE 11" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div-->
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细描述" class="layui-textarea fly-editor" style="height: 260px;">{$article.content|raw|htmlspecialchars_decode}</textarea>
|
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea fly-editor" style="height: 260px;">{$article.content|raw|htmlspecialchars_decode}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
@ -99,12 +100,17 @@
|
|||||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>上传文件</button>
|
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>上传文件</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">{:lang('描述')}</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<textarea name="description" class="layui-textarea" placeholder="SEO描述">{$article.description}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<label class="layui-form-label">{:lang('add tags')}</label>
|
<label class="layui-form-label">{:lang('add tags')}</label>
|
||||||
<div class="layui-input-inline" style="width: 190px;">
|
<div class="layui-input-inline" style="width: 190px;">
|
||||||
<input type="text" class="layui-input" name="tags" placeholder="多个标签用,号隔开" title="添加标签"/>
|
<input type="text" class="layui-input" name="tags" placeholder="多个用空格隔开" title="添加标签"/>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
||||||
</div>
|
</div>
|
||||||
@ -112,7 +118,7 @@
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<div class="layui-btn-container">
|
<div class="layui-btn-container">
|
||||||
{volist name="tags" id="vo" }
|
{volist name="tags" id="vo" }
|
||||||
<button type="button" class="layui-btn" value="{$vo}">{$vo}</button>
|
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" value="{$vo}">{$vo} x</button>
|
||||||
{/volist}
|
{/volist}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -122,8 +128,8 @@
|
|||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-mid">
|
<div class="layui-form-mid layui-word-aux" style="padding-top: 0px !important;">
|
||||||
<span style="color: #c00;"><img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></span>
|
<img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@ -192,7 +198,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
url:"{:url('article/edit')}",
|
url:"{:url('article/edit')}",
|
||||||
data:{"id":field.id,"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"captcha":field.captcha},
|
data:{"id":field.id,"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"description":field.description,"captcha":field.captcha},
|
||||||
daType:"json",
|
daType:"json",
|
||||||
success:function (data){
|
success:function (data){
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
@ -208,49 +214,75 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
//添加tags
|
// 获取描述的内容
|
||||||
|
$("#L_content").bind('input propertychange', function(){
|
||||||
|
var content = $(this).val()
|
||||||
|
$.ajax({
|
||||||
|
type:"post",
|
||||||
|
url:"{:url('article/getDescription')}",
|
||||||
|
data:{"content":content},
|
||||||
|
daType:"json",
|
||||||
|
success:function (data){
|
||||||
|
if (data.code == 0) {
|
||||||
|
$('[name="description"]').val(data.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
|
// 手动添加tags
|
||||||
$('#article-tags-button').on('click',function(){
|
$('#article-tags-button').on('click',function(){
|
||||||
var tags = $("input[name='tags']").val();
|
var tags = $("input[name='tags']").val();
|
||||||
|
var flag = 'off';
|
||||||
|
getTags(tags,flag);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取tag的内容
|
||||||
|
var conf = "{:empty(config('taoler.baidu.client_id'))}";
|
||||||
|
if(conf !== '1'){
|
||||||
|
$("#L_title").on('blur', function(){
|
||||||
|
var title = $(this).val();
|
||||||
|
var flag = 'on';
|
||||||
|
// 清空上次生成的tag button
|
||||||
|
$('.layui-btn-container').children('button').each(function(){
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
getTags(title,flag);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 循环添加button
|
||||||
|
function getTags(tags,flag)
|
||||||
|
{
|
||||||
if(tags == ''){
|
if(tags == ''){
|
||||||
layer.msg('不能为空');
|
layer.msg('不能为空');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
//把得到的tags放进数组
|
||||||
var numArr = new Array();
|
var numArr = new Array();
|
||||||
$('.layui-btn-container').children('button').each(function(){
|
$('.layui-btn-container').children('button').each(function(){
|
||||||
numArr.push($(this).val());//添加至数组
|
numArr.push($(this).val());//添加至数组
|
||||||
});
|
});
|
||||||
for(var i=0; i<numArr.length; i++){
|
|
||||||
if(tags.indexOf(numArr[i])>=0){
|
|
||||||
layer.msg('不能重复添加'+numArr[i]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//保存tags
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
url:"{:url('article/tags')}",
|
url:"{:url('article/tags')}",
|
||||||
data:{"tags":tags},
|
data:{"tags":tags,"flag":flag},
|
||||||
daType:"json",
|
daType:"json",
|
||||||
success:function (data){
|
success:function (data){
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
for(var i=0; i<data.data.length; i++){
|
for(var i=0; i<data.data.length; i++){
|
||||||
$('.layui-btn-container').append('<button type="button" class="layui-btn" value='+data.data[i]+'>'+data.data[i]+'</button>');
|
if($.inArray(data.data[i],numArr) < 0){
|
||||||
|
$('.layui-btn-container').append('<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" value='+data.data[i]+'>'+data.data[i]+' x'+'</button>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$("input[name='tags']").val("");
|
$("input[name='tags']").val("");
|
||||||
} else {
|
}
|
||||||
layer.open({
|
|
||||||
title:'添加失败',
|
|
||||||
content:data.msg,
|
|
||||||
icon:5,
|
|
||||||
anim:6
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
|
|
||||||
//删除tag
|
//删除tag
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
104
view/taoler/index/article/news/cate.html
Normal file
104
view/taoler/index/article/news/cate.html
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
{extend name="public/base" /}
|
||||||
|
{block name="title"}{$Request.param.ename|getCateName}-{$sysInfo.webname}{/block}
|
||||||
|
{block name="keywords"}{$Request.param.ename|getCateName},{$sysInfo.webname}{/block}
|
||||||
|
{block name="description"}{$Request.param.ename|getCateDesc}{/block}
|
||||||
|
{block name="column"}{include file="/public/column" /}{/block}
|
||||||
|
|
||||||
|
{block name="content"}
|
||||||
|
<div class="layui-container">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
<div class="layui-col-md9">
|
||||||
|
<div class="fly-panel" style="margin-bottom: 0;">
|
||||||
|
<ul class="fly-list">
|
||||||
|
{volist name="artList['data']" id="art"}
|
||||||
|
<li>
|
||||||
|
<a href="{:url('user/home',['id'=>$art.user.id])}" class="fly-avatar">
|
||||||
|
<img src="{$art.user.user_img}" alt="{$art.user.name}">
|
||||||
|
</a>
|
||||||
|
<h2>
|
||||||
|
{if config('taoler.config.cate_show') == 1}<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>{/if}
|
||||||
|
<a href="{:url('article/detail',['id' => $art.id])}" style="color:{$art.title_color};">{$art.title}</a>
|
||||||
|
</h2>
|
||||||
|
<div class="fly-list-info">
|
||||||
|
<a href="{:url('user/home',['id'=>$art.user.id])}" link>
|
||||||
|
{if config('taoler.config.area_show') == 1}<span class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</span>{/if}
|
||||||
|
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||||
|
<i>{$art.create_time|date='Y-m-d'}</i>
|
||||||
|
</a>
|
||||||
|
<span>
|
||||||
|
{$art.has_img ?= ' <i class="layui-icon layui-icon-picture" style=" color: #5FB878;"></i>'}
|
||||||
|
{$art.has_video ?= ' <i class="layui-icon layui-icon-play" style="color: #FF5722;"></i>'}
|
||||||
|
{$art.has_audio ?= ' <i class="layui-icon layui-icon-speaker" style="color: #000000;"></i>'}
|
||||||
|
{$art.upzip ?= ' <i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i>'}
|
||||||
|
</span>
|
||||||
|
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览"></i> {$art.pv}</span>
|
||||||
|
<span class="fly-list-nums">
|
||||||
|
<i class="iconfont icon-pinglun1" title="回答"></i> {$art.comments_count}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="fly-list-badge">
|
||||||
|
{if ($art.is_hot == 1)}<i class="layui-icon layui-icon-fire layui-hide-md" style="font-size: 20px; color: #FF5722;"></i><span class="layui-badge layui-bg-red layui-hide-xs">{:lang('hot')}</span> {/if}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{/volist}
|
||||||
|
</ul>
|
||||||
|
<div style="text-align: center" id="pages"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-md3">
|
||||||
|
<div class="fly-panel">
|
||||||
|
<div class="fly-panel" style="padding: 5px 0; text-align: center;">
|
||||||
|
{volist name="ad_cateImg" id="vo"}
|
||||||
|
<a href="{$vo.slid_href}" target="_blank"><img src="{$vo.slid_img}" style="max-width: 100%;"></a>
|
||||||
|
{/volist}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<dl class="fly-panel fly-list-one layui-hide-xs">
|
||||||
|
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
|
||||||
|
{volist name="artHot" id="vo"}
|
||||||
|
<dd>
|
||||||
|
<a href="{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
|
||||||
|
<span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
|
||||||
|
</dd>
|
||||||
|
{/volist}
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<div class="fly-panel">
|
||||||
|
<div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
|
||||||
|
<a href="" class="fly-link fly-joinad ">{:lang('i want to join')}</a>
|
||||||
|
</div>
|
||||||
|
<div class="fly-panel-main">
|
||||||
|
{volist name="ad_comm" id="vo"}
|
||||||
|
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
|
||||||
|
{/volist}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{include file="public/menu" /}
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
<script>
|
||||||
|
layui.use(['laypage'], function(){
|
||||||
|
var laypage = layui.laypage;
|
||||||
|
|
||||||
|
//执行一个laypage实例
|
||||||
|
laypage.render({
|
||||||
|
elem: 'pages' //注意,这里的 test1 是 ID,不用加 # 号
|
||||||
|
,count: "{$artList['total']}" //数据总数,从服务端得到
|
||||||
|
,limit: "{$artList['per_page']}"
|
||||||
|
,curr : "{$artList['current_page']}"
|
||||||
|
|
||||||
|
//获取起始页
|
||||||
|
,jump: function(obj, first){
|
||||||
|
|
||||||
|
//首次不执行
|
||||||
|
if(!first){
|
||||||
|
window.location.href = '{$path}/'+obj.curr+'.html'; //跳转
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
323
view/taoler/index/article/news/detail.html
Normal file
323
view/taoler/index/article/news/detail.html
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
{extend name="public/base" /}
|
||||||
|
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
||||||
|
{block name="keywords"}{$article.tags}{/block}
|
||||||
|
{block name="description"}{$article.title},{$article.description}{/block}
|
||||||
|
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||||
|
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
||||||
|
{block name="content"}
|
||||||
|
<div class="layui-container">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
<div class="layui-col-md12 content detail">
|
||||||
|
<div class="fly-panel detail-box">
|
||||||
|
{//标题}
|
||||||
|
<h1 style="color:{$article.title_color};" align="center">{$article.title}</h1>
|
||||||
|
<div class="detail_qrcode layui-hide-xs" onclick="PhoneDown();" id="mobile"></div>
|
||||||
|
|
||||||
|
{//图标}
|
||||||
|
<div class="fly-detail-info">
|
||||||
|
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
|
||||||
|
<span class="fly-list-nums">
|
||||||
|
<a href="#comment"><i class="iconfont" title="{:lang('reply')}"></i>{$article.comments_count}</a><i class="iconfont" title="浏览"></i>{$pv}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{//作者}
|
||||||
|
<div class="detail-about">
|
||||||
|
<a class="fly-avatar" href="{:url('user/home',['id'=>$article.user.id])}">
|
||||||
|
<img src="{$article.user.user_img}" alt="{$article.user.name}">
|
||||||
|
<i class="iconfont icon-renzheng" title="认证信息"></i>
|
||||||
|
</a>
|
||||||
|
<div class="fly-detail-user">
|
||||||
|
<a href="{:url('user/home',['id'=>$article.user.id])}" class="fly-link">
|
||||||
|
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($article.user.area_id) ?: '无'}</i>{/if}
|
||||||
|
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
||||||
|
</a>
|
||||||
|
<span class="layui-btn layui-btn-xs guanzhu" >关注</span>
|
||||||
|
</div>
|
||||||
|
<div class="detail-hits">
|
||||||
|
<!--span style="padding-right: 10px; color: #FF7200">悬赏:60飞吻</span-->
|
||||||
|
<span class="post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
{// 内容}
|
||||||
|
<div class="detail-body photos" id="content">{$article.content}</div>
|
||||||
|
|
||||||
|
{//管理}
|
||||||
|
{if (($article.upzip !== '') || session('?user_name'))}
|
||||||
|
<div class="detail-assist">
|
||||||
|
{notempty name="$article.upzip"}
|
||||||
|
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
||||||
|
{/notempty}
|
||||||
|
<div class="fly-admin-box" data-id="{$article.id}">
|
||||||
|
{if ($user.auth ?? '')}
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="del"><i class="layui-icon layui-icon-delete"></i></span>
|
||||||
|
{if($article.is_top == 0)}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="1"><i class="layui-icon layui-icon-top"></i></span>
|
||||||
|
{else /}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>{/if}
|
||||||
|
{if($article.is_hot == 0)}
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="1"><i class="layui-icon layui-icon-fire"></i></span>
|
||||||
|
{else /}
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="0" style="background-color:#ccc;">{:lang('cancel hoting')}</span>
|
||||||
|
{/if}
|
||||||
|
{if($article.is_reply == 1)}
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="0"><i class="layui-icon layui-icon-face-cry"></i></span>
|
||||||
|
{else /}
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="1" style="background-color:#ccc;">{:lang('enable reply')}</span>
|
||||||
|
{/if}
|
||||||
|
<span id="color">{:lang('title color')}</span>
|
||||||
|
{/if}
|
||||||
|
{if(session('user_name')==$article.user.name || ($user.auth ?? ''))}
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="{:url('article/edit',['id'=>$article.id])}">{:lang('edit')}</a></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fly-panel detail-box" >
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--底部栏-->
|
||||||
|
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
||||||
|
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{include file="public/menu" /}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="script"}
|
||||||
|
<script>
|
||||||
|
var collectionFind = "{:url('Collection/find')}",
|
||||||
|
collection = "{:url('collection/')}",
|
||||||
|
articleJieset = "{:url('Article/jieset')}",
|
||||||
|
articleDelete = "{:url('Article/delete')}",
|
||||||
|
commentJiedaZan = "{:url('Comment/jiedaZan')}",
|
||||||
|
commentJiedaCai = "{:url('Comment/jiedaCai')}",
|
||||||
|
commentGetDa = "{:url('Comment/getDa')}",
|
||||||
|
commentUpdateDa = "{:url('Comment/updateDa')}",
|
||||||
|
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||||
|
langCollection = "{:lang('collection')}",
|
||||||
|
langCancelCollection = "{:lang('cancel collection')}";
|
||||||
|
|
||||||
|
layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||||
|
var $ = layui.jquery
|
||||||
|
,form = layui.form
|
||||||
|
,fly = layui.fly
|
||||||
|
,colorpicker = layui.colorpicker
|
||||||
|
,plyr = layui.plyr;
|
||||||
|
var laytpl = layui.laytpl;
|
||||||
|
var uid = layui.cache.user.uid;
|
||||||
|
var laypage = layui.laypage;
|
||||||
|
|
||||||
|
//tpl模板给发布时间赋值
|
||||||
|
$('div.detail-hits').children('span.post-time').each(function(){
|
||||||
|
var othis = $(this), html = othis.html();
|
||||||
|
var string = laytpl('{{ d.time }}').render({
|
||||||
|
//time: html
|
||||||
|
time: othis.attr('data')
|
||||||
|
});
|
||||||
|
var posttime = layui.util.timeAgo(string, 1);
|
||||||
|
|
||||||
|
othis.text(posttime);
|
||||||
|
//console.log(othis.attr('data'));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//预定义颜色项
|
||||||
|
colorpicker.render({
|
||||||
|
elem: '#color'
|
||||||
|
,color: '#393d49'
|
||||||
|
,predefine: true // 开启预定义颜色
|
||||||
|
,size: 'xs'
|
||||||
|
,done: function(color){
|
||||||
|
//改变标题颜色
|
||||||
|
$('h1').css("color", color);
|
||||||
|
var id = "{$article.id}";
|
||||||
|
$.ajax({
|
||||||
|
type:'post',
|
||||||
|
url:"{:url('Article/titleColor')}",
|
||||||
|
data:{id: id,title_color: color},
|
||||||
|
dataType:'json',
|
||||||
|
success:function(data){
|
||||||
|
if(data.code == 0){
|
||||||
|
layer.msg(data.msg,{icon:6,time:2000
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.open({content:data.msg,icon:5,adim:6});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//评论需要登陆
|
||||||
|
form.on('submit(user-comment)',function (data){
|
||||||
|
var index = layer.load(1);
|
||||||
|
var filed = data.field;
|
||||||
|
if (uid == -1) {
|
||||||
|
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
||||||
|
location.href = "{:url('login/index')}";
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "{:url('article/comment')}",
|
||||||
|
data: filed,
|
||||||
|
dataType: "json",
|
||||||
|
success:function (data) {
|
||||||
|
if (data.code == 0) {
|
||||||
|
layer.msg(data.msg,{icon:6,time:2000},function () {
|
||||||
|
location.reload(true);
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
//执行一个laypage实例
|
||||||
|
laypage.render({
|
||||||
|
elem: 'pages' //注意,这里的 test1 是 ID,不用加 # 号
|
||||||
|
,count: "{$article.comments_count}" //数据总数,从服务端得到
|
||||||
|
,limit: 10
|
||||||
|
,curr : {$page}
|
||||||
|
|
||||||
|
//获取起始页
|
||||||
|
,jump: function(obj, first){
|
||||||
|
//首次不执行
|
||||||
|
if(!first){
|
||||||
|
var page = obj.curr;
|
||||||
|
var url = "{:url('article/detail',['id'=>$article.id])}";
|
||||||
|
var id = "{$article.id}";
|
||||||
|
$.post("{:url('article/detail')}",{"id":id,"page":page},function(){
|
||||||
|
window.location.href = url + '?page=' + page + '#flyReply';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//下载
|
||||||
|
$('#zip-download').click(function (){
|
||||||
|
var id = "{$article.id}";
|
||||||
|
$.ajax({
|
||||||
|
type:"post",
|
||||||
|
url:"{:url('article/download')}",
|
||||||
|
data:{id:id},
|
||||||
|
success:function (data) {
|
||||||
|
location.href = "{:url('article/download',['id'=>$article.id])}";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
|
$('.detail-body').each(function(){
|
||||||
|
var othis = $(this), html = othis.html();
|
||||||
|
othis.html(fly.content(html));
|
||||||
|
});
|
||||||
|
//加载播放器
|
||||||
|
plyr.setup();
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// 点击图片放大
|
||||||
|
$(function(){
|
||||||
|
$(".photos").on("click","img",function(){
|
||||||
|
var _this = $(this);
|
||||||
|
console.log(_this);
|
||||||
|
imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function imgShow(outerdiv, innerdiv, bigimg, _this){
|
||||||
|
var src = _this.attr("src");
|
||||||
|
$(bigimg).attr("src", src);
|
||||||
|
|
||||||
|
$("<img/>").attr("src", src).on("load",function(){
|
||||||
|
var windowW = $(window).width();
|
||||||
|
var windowH = $(window).height();
|
||||||
|
var realWidth = this.width;
|
||||||
|
var realHeight = this.height;
|
||||||
|
var imgWidth, imgHeight;
|
||||||
|
var scale = 0.8;
|
||||||
|
if(realHeight>windowH*scale) {
|
||||||
|
//判断图片高度
|
||||||
|
imgHeight = windowH*scale;
|
||||||
|
imgWidth = imgHeight/realHeight*realWidth;
|
||||||
|
if(imgWidth>windowW*scale) {
|
||||||
|
//如宽度扔大于窗口宽度
|
||||||
|
imgWidth = windowW*scale;
|
||||||
|
}
|
||||||
|
} else if(realWidth>windowW*scale) {
|
||||||
|
|
||||||
|
imgWidth = windowW*scale;
|
||||||
|
imgHeight = imgWidth/realWidth*realHeight;
|
||||||
|
} else {
|
||||||
|
//如果图片真实高度和宽度都符合要求,高宽不变
|
||||||
|
imgWidth = realWidth;
|
||||||
|
imgHeight = realHeight;
|
||||||
|
}
|
||||||
|
$(bigimg).css("width",imgWidth);
|
||||||
|
var w = (windowW-imgWidth)/2;
|
||||||
|
var h = (windowH-imgHeight)/2;
|
||||||
|
$(innerdiv).css({"top":h, "left":w});
|
||||||
|
$(outerdiv).fadeIn("fast");
|
||||||
|
});
|
||||||
|
$(outerdiv).click(function(){
|
||||||
|
//再次点击淡出消失弹出层
|
||||||
|
$(this).fadeOut("fast");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
|
||||||
|
<div id="innerdiv" style="position:absolute;">
|
||||||
|
<img id="bigimg" style="border:5px solid #fff;" src="" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{:hook('markdownhook')}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//扫码阅读
|
||||||
|
$("#rdown").hover(function(){
|
||||||
|
$("#phonedl").show().stop();
|
||||||
|
},function(){
|
||||||
|
$("#phonedl").hide().stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#phonedl").hover(function(){
|
||||||
|
$("#phonedl").show().stop();
|
||||||
|
},function(){
|
||||||
|
$("#phonedl").hide().stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
function PhoneDown(){
|
||||||
|
layer.open({
|
||||||
|
title: "扫码查阅",
|
||||||
|
skin: 'layui-layer',
|
||||||
|
content: "<img src='/qrcode/?text={$Request.domain}{:url('article/detail',['id' => $article.id])}&size=230'>"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//推送百度收录服务
|
||||||
|
(function(){
|
||||||
|
var bp = document.createElement('script');
|
||||||
|
var curProtocol = window.location.protocol.split(':')[0];
|
||||||
|
if (curProtocol === 'https') {
|
||||||
|
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
|
||||||
|
}
|
||||||
|
var s = document.getElementsByTagName("script")[0];
|
||||||
|
s.parentNode.insertBefore(bp, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{/block}
|
@ -1,8 +1,8 @@
|
|||||||
{extend name="public/base" /}
|
{extend name="public/base" /}
|
||||||
|
|
||||||
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
||||||
{block name="keywords"}{$article.title},{$article.tags}{/block}
|
{block name="keywords"}{$article.tags}{/block}
|
||||||
{block name="description"}{$article.title},{:getArtContent($article.content)}{/block}
|
{block name="description"}{$article.title},{$article.description}{/block}
|
||||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||||
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
||||||
{block name="content"}
|
{block name="content"}
|
||||||
@ -40,9 +40,11 @@
|
|||||||
<!--span style="padding-right: 10px; color: #FF7200">悬赏:60飞吻</span-->
|
<!--span style="padding-right: 10px; color: #FF7200">悬赏:60飞吻</span-->
|
||||||
<span class="post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
|
<span class="post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
|
{// 内容}
|
||||||
<div class="detail-body photos" id="content">{$article.content}</div>
|
<div class="detail-body photos" id="content">{$article.content}</div>
|
||||||
|
|
||||||
{//管理}
|
{//管理}
|
||||||
{if (($article.upzip !== '') || session('?user_name'))}
|
{if (($article.upzip !== '') || session('?user_name'))}
|
||||||
<div class="detail-assist">
|
<div class="detail-assist">
|
||||||
@ -52,8 +54,11 @@
|
|||||||
<div class="fly-admin-box" data-id="{$article.id}">
|
<div class="fly-admin-box" data-id="{$article.id}">
|
||||||
{if ($user.auth ?? '')}
|
{if ($user.auth ?? '')}
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="del"><i class="layui-icon layui-icon-delete"></i></span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="del"><i class="layui-icon layui-icon-delete"></i></span>
|
||||||
{if($article.is_top == 0)}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="1"><i class="layui-icon layui-icon-top"></i></span>
|
{if($article.is_top == 0)}
|
||||||
{else /}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>{/if}
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="1"><i class="layui-icon layui-icon-top"></i></span>
|
||||||
|
{else /}
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>
|
||||||
|
{/if}
|
||||||
{if($article.is_hot == 0)}
|
{if($article.is_hot == 0)}
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="1"><i class="layui-icon layui-icon-fire"></i></span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="1"><i class="layui-icon layui-icon-fire"></i></span>
|
||||||
{else /}
|
{else /}
|
||||||
@ -73,6 +78,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="fly-panel detail-box" >
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
{//评论}
|
{//评论}
|
||||||
<div class="fly-panel detail-box" id="flyReply">
|
<div class="fly-panel detail-box" id="flyReply">
|
||||||
<span style="font-size:18px;">评论 {$article.comments_count}</span>
|
<span style="font-size:18px;">评论 {$article.comments_count}</span>
|
||||||
@ -106,7 +116,9 @@
|
|||||||
<span type="edit">{:lang('edit')}</span>
|
<span type="edit">{:lang('edit')}</span>
|
||||||
<span type="del">{:lang('delete')}</span>
|
<span type="del">{:lang('delete')}</span>
|
||||||
{/if}
|
{/if}
|
||||||
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}<span class="jieda-accept" type="accept">{:lang('accept')}</span>{/if}
|
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}
|
||||||
|
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -139,7 +151,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="fly-panel-main">
|
<div class="fly-panel-main">
|
||||||
{volist name="ad_comm" id="vo"}
|
{volist name="ad_comm" id="vo"}
|
||||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
|
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: {$vo.slid_color};">{$vo.slid_name}</a>
|
||||||
{/volist}
|
{/volist}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -159,7 +171,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--底部栏-->
|
<!--底部栏-->
|
||||||
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
||||||
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -198,12 +210,10 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
|||||||
time: othis.attr('data')
|
time: othis.attr('data')
|
||||||
});
|
});
|
||||||
var posttime = layui.util.timeAgo(string, 1);
|
var posttime = layui.util.timeAgo(string, 1);
|
||||||
|
|
||||||
othis.text(posttime);
|
othis.text(posttime);
|
||||||
//console.log(othis.attr('data'));
|
//console.log(othis.attr('data'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//预定义颜色项
|
//预定义颜色项
|
||||||
colorpicker.render({
|
colorpicker.render({
|
||||||
elem: '#color'
|
elem: '#color'
|
||||||
@ -236,9 +246,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
|||||||
var index = layer.load(1);
|
var index = layer.load(1);
|
||||||
var filed = data.field;
|
var filed = data.field;
|
||||||
if (uid == -1) {
|
if (uid == -1) {
|
||||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
layer.msg('请先登陆',{icon:5,time:2000},function(){location.href = "{:url('login/index')}"});
|
||||||
location.href = "{:url('login/index')}";
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
@ -304,9 +312,8 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
// 点击图片放大
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
// 点击图片放大
|
||||||
$(function(){
|
$(function(){
|
||||||
$(".photos").on("click","img",function(){
|
$(".photos").on("click","img",function(){
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
@ -314,6 +321,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
|||||||
imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
|
imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function imgShow(outerdiv, innerdiv, bigimg, _this){
|
function imgShow(outerdiv, innerdiv, bigimg, _this){
|
||||||
var src = _this.attr("src");
|
var src = _this.attr("src");
|
||||||
$(bigimg).attr("src", src);
|
$(bigimg).attr("src", src);
|
||||||
@ -353,13 +361,12 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
|||||||
$(this).fadeOut("fast");
|
$(this).fadeOut("fast");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
|
<div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
|
||||||
<div id="innerdiv" style="position:absolute;">
|
<div id="innerdiv" style="position:absolute;">
|
||||||
<img id="bigimg" style="border:5px solid #fff;" src="" />
|
<img id="bigimg" style="border:5px solid #fff;" src="" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{:hook('markdownhook')}
|
{:hook('markdownhook')}
|
||||||
|
|
||||||
@ -384,6 +391,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
|||||||
content: "<img src='/qrcode/?text={$Request.domain}{:url('article/detail',['id' => $article.id])}&size=230'>"
|
content: "<img src='/qrcode/?text={$Request.domain}{:url('article/detail',['id' => $article.id])}&size=230'>"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//推送百度收录服务
|
//推送百度收录服务
|
||||||
(function(){
|
(function(){
|
||||||
var bp = document.createElement('script');
|
var bp = document.createElement('script');
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="fly-panel-main" style="padding: 13px 15px;">
|
<div class="fly-panel-main" style="padding: 13px 15px;">
|
||||||
{volist name="ad_index" id="vo"}
|
{volist name="ad_index" id="vo"}
|
||||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
|
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: {$vo.slid_color};">{$vo.slid_name}</a>
|
||||||
{/volist}
|
{/volist}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -78,10 +78,8 @@
|
|||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-mid">
|
<div class="layui-form-mid layui-word-aux" style="padding-top: 0px !important;">
|
||||||
<span style="color: #c00;">
|
<img id="captcha" src="{:captcha_src()}?id=1" onclick="this.src='{:captcha_src()}?id=1'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" />
|
||||||
<div ><img id="captcha" src="{:captcha_src()}?id=1" onclick="this.src='{:captcha_src()}?id=1'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></div>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
|
@ -22,16 +22,14 @@
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label for="L_email" class="layui-form-label">{:lang('email')}</label>
|
<label for="L_email" class="layui-form-label">{:lang('email')}</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" id="L_email" name="email" required lay-verify="email" autocomplete="off" class="layui-input" placeholder="{:lang('email')}">
|
<input type="text" id="L_email" name="email" required lay-verify="email" autocomplete="off" class="layui-input" placeholder="{:lang('the only way to get back your password')}">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-mid layui-word-aux">{:lang('the only way to get back your password')}</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label for="L_pass" class="layui-form-label">{:lang('password')}</label>
|
<label for="L_pass" class="layui-form-label">{:lang('password')}</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('6-16 characters')}">
|
<input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('6-16 characters')}">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-mid layui-word-aux">{:lang('strong type encryption')}</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label for="L_repass" class="layui-form-label">{:lang('confirm password')}</label>
|
<label for="L_repass" class="layui-form-label">{:lang('confirm password')}</label>
|
||||||
@ -44,12 +42,8 @@
|
|||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div class="layui-form-mid layui-word-aux" style="padding-top: 0px !important;">
|
||||||
<span style="color: #c00;">
|
<img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" alt="captcha" />
|
||||||
<div>
|
|
||||||
<img id="captcha" src="{:captcha_src()}" style="float:left; cursor:pointer;" alt="captcha" />
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
@ -78,7 +72,9 @@ var layer = layui.layer;
|
|||||||
//注册
|
//注册
|
||||||
form.on('submit(user-register)', function(data){
|
form.on('submit(user-register)', function(data){
|
||||||
var field = data.field;
|
var field = data.field;
|
||||||
var loading = layer.load(2, {shade: [0.2, '#000']});
|
var loading = layer.load(2, {
|
||||||
|
shade: [0.2, '#000']
|
||||||
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:'post',
|
type:'post',
|
||||||
url:"{:url('Login/reg')}",
|
url:"{:url('Login/reg')}",
|
||||||
@ -100,5 +96,4 @@ var layer = layui.layer;
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{/block}
|
{/block}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<h2>
|
<h2>
|
||||||
{if config('taoler.config.cate_show') == 1}<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>{/if}
|
{if config('taoler.config.cate_show') == 1}<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>{/if}
|
||||||
<a href="{:url('article/detail',['id' => $art.id])}" style="color:'{$art.title_color}';">{$art.title}</a>
|
<a href="{:url('article/detail',['id' => $art.id])}" style="color:{$art.title_color};">{$art.title}</a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="fly-list-info">
|
<div class="fly-list-info">
|
||||||
<a href="{:url('user/home',['id'=>$art.user.id])}" link>
|
<a href="{:url('user/home',['id'=>$art.user.id])}" link>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<h2>
|
<h2>
|
||||||
{if config('taoler.config.cate_show') == 1}<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $top.cate.ename : $top.cate.catename}</a>{/if}
|
{if config('taoler.config.cate_show') == 1}<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $top.cate.ename : $top.cate.catename}</a>{/if}
|
||||||
<a href="{:url('article/detail',['id' => $top.id])}" style="color:'{$top.title_color}';">{$top.title}</a>
|
<a href="{:url('article/detail',['id' => $top.id])}" style="color:{$top.title_color};">{$top.title}</a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="fly-list-info">
|
<div class="fly-list-info">
|
||||||
<a href="{:url('user/home',['id'=>$top.user_id])}" link>
|
<a href="{:url('user/home',['id'=>$top.user_id])}" link>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user