修复登场错误锁定次数

This commit is contained in:
taoser 2024-04-01 10:08:12 +08:00
parent d82f29fbe5
commit d9bd397475
33 changed files with 301 additions and 325 deletions

View File

@ -202,16 +202,15 @@ abstract class BaseController
protected function getArticleAllpic($str)
{
//正则匹配<img src="http://img.com" />
$pattern = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
$pattern = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png|\.jpeg]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern,$str,$matchContent);
if(isset($matchContent[1])){
$img = $matchContent[1];
$imgArr = $matchContent[1];
}else{
$temp = "./images/no-image.jpg";//在相应位置放置一张命名为no-image的jpg图片
}
return $img;
return $imgArr;
}
//下载远程图片
@ -234,9 +233,9 @@ abstract class BaseController
{
$filename = pathinfo($url, PATHINFO_BASENAME);
//$dirname = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_DIRNAME);
$dirname = date('Ymd',time());
//路径
$path = 'storage/download/article_pic/' . $dirname . '/';
$path = 'storage/download/article_pic/' . date('Ymd',time()) . '/';
//绝对文件夹
$fileDir = public_path() . $path;
//文件绝对路径
@ -271,7 +270,7 @@ abstract class BaseController
if(count($images)) {
foreach($images as $image){
//1.带http地址的图片2.非本站的网络图片 3.非带有?号等参数的图片
if((stripos($image,'http') !== false) && (stripos($image, Request::domain()) === false) && (stripos($image, '?') === false)) {
if((stripos($image,'http') !== false) && (stripos($image, Request::domain()) == false) && (stripos($image, '?') == false)) {
// 如果图片中没有带参数或者加密可下载
//下载远程图片(可下载)
$newImageUrl = $this->downloadImage($image);

View File

@ -21,6 +21,7 @@ use app\admin\model\Cunsult;
use think\facade\Config;
use taoler\com\Api;
use app\common\lib\facade\HttpHelper;
use app\common\model\Comment;
class Index extends AdminController
{
@ -61,15 +62,28 @@ class Index extends AdminController
public function console2()
{
// 评论、帖子状态
$comm = Db::name('comment')->field('id')->where(['delete_time'=>0,'status'=>0])->select();
$comm = Db::name('comment')->field('id,content,create_time')->where(['delete_time'=>0,'status'=>0])->select();
$forum = Db::name('article')->field('id')->where(['delete_time'=>0,'status'=>0])->select();
$user = Db::name('user')->field('id')->where(['delete_time'=>0,'status'=>0])->select();
// 回复评论
$comments = Comment::field('id,article_id,content,create_time,delete_time')->where(['delete_time'=>0])->order('create_time desc')->limit(10)->select();
$commData = [];
foreach($comments as $v) {
$commData[] = [
'id' => $v->id,
'content' => strip_tags($v['content']),
'create_time' => $v['create_time'],
'url' => $this->getArticleUrl($v['article_id'], 'index', $v->article->cate->ename)
];
}
View::assign([
'pendComms' => count($comm),
'pendForums' => count($forum),
'pendUser' => count($user),
'comments' => $commData,
]);
return View::fetch('console2');
}

View File

@ -87,7 +87,7 @@ class Forum extends AdminController
$where[] = ['title', 'like', '%'.$data['title'].'%'];
}
$list = $this->model->getList($where, input('limit'), input('page'));
$list = $this->model->getAllStatusList($where, input('limit'), input('page'));
$res = [];
if($list['total']){
foreach($list['data'] as $v) {

View File

@ -19,7 +19,6 @@ use app\common\lib\Uploads;
use app\common\validate\User as userValidate;
use think\exception\ValidateException;
class User extends AdminController
{
@ -205,4 +204,12 @@ class User extends AdminController
return true;
}
//登录用过户中心
public function goUserHome() {
$id = (int)input('id');
$user_home_url = $this->getUserHome($id);
return redirect($user_home_url);
}
}

View File

@ -113,7 +113,7 @@
show: true,
indent: 15,
strict: false,
expandedKeys: true
expandedKeys: false
},
tips: '请选择'
});
@ -203,6 +203,8 @@
});
</script>
{// 编辑器}
{:hook('ueditor')}
{:hook('taonyeditor')}
{// 百度标题词条}
{:hook('seoBaiduTitle')}

View File

@ -154,7 +154,7 @@
show: true,
indent: 15,
strict: false,
expandedKeys: true
expandedKeys: false
},
tips: '请选择'
});
@ -222,6 +222,8 @@
});
</script>
{// 编辑器}
{:hook('ueditor')}
{:hook('taonyeditor')}
{// 百度标题词条}
{:hook('seoBaiduTitle')}

View File

@ -114,12 +114,6 @@
var toast = layui.toast;
var xmSelect = layui.xmSelect;
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
var taonystatus = "{:hook('taonystatus')}";
// 编辑器插件启用状态
var isShow = taonystatus ? false : true;
let cols = [
[
{type: 'checkbox'}
@ -246,10 +240,7 @@
});
window.add = function() {
if(isShow) {
toast.info({title: '信息',message: '编辑器插件未开启或未安装',position: 'topRight'});
return false;
}
layer.open({
type: 2,
title: '新增',
@ -260,10 +251,6 @@
}
window.edit = function(obj) {
if(isShow) {
toast.info({title: '信息',message: '编辑器插件未开启或未安装',position: 'topRight'});
return false;
}
layer.open({
type: 2,
title: '修改',
@ -273,12 +260,6 @@
});
}
// $(document).on('focusin', function(e) {
// if ($(e.target).closest(".tox-tinymce, .tox-tinymce-aux, .moxman-window, .tam-assetmanager-root").length) {
// e.stopImmediatePropagation();
// }
// });
window.remove = function(obj) {
layer.confirm('确定要删除?', {

View File

@ -338,7 +338,6 @@
$('.UI').append(v);
count.up("value1", {
time: 4000,
num: {:hook('seoBaiduTongji',['name'=>'tpv']) ?: 0},
@ -610,20 +609,21 @@
$.get("{:url('system.upgrade/check')}",function (data){
if (data.code === 1) {
//可升级
layer.confirm('发现新版本V' + data.data.version + ',确定升级?',{icon: 3, title:'系统检测'}, function(index){
layer.confirm('发现新版本V' + data.data.version + ',确定升级?',{icon: 3, title:'系统检测'}, function(){
var loadIndex = layer.load(0);
//更新
$.get("{:url('system.upgrade/upload')}",function (res){
layer.close(loadIndex)
if (res.code === 0) {
layer.close(index);
toast.info({title:"通知消息", message: res.msg ,position: 'topRight'})
} else {
layer.close(index);
toast.error({title:"服务器错误", message:res.msg})
}
return false;
});
//关闭load加载层
});
}
});
});

View File

@ -129,14 +129,14 @@
</div>
</div>
</div>
<div class="layui-card">
<!-- <div class="layui-card">
<div class="layui-card-header">
使用记录
</div>
<div class="layui-card-body">
<table id="role-table" lay-filter="role-table"></table>
</div>
</div>
</div> -->
</div>
</div>
</div>
@ -145,81 +145,13 @@
<div class="layui-card-header">留言板</div>
<div class="layui-card-body">
<ul class="pear-card-status">
{volist name="comments" id="vo"}
<li>
<p>要不要作为我的家人,搬来我家。</p>
<span>12月25日 19:92</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
<li>
<p>快乐的时候不敢尽兴,频繁警戒自己保持清醒。</p>
<span>4月30日 22:43</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
<li>
<p>夏天真的来了,尽管它还有些犹豫。</p>
<span>4月30日 22:43</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
<li>
<p>看似不可达到的高度,只要坚持不懈就可能到达。</p>
<span>4月30日 22:43</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
<li>
<p>当浑浊变成了一种常态,那么清白就成了一种罪过。</p>
<span>4月30日 22:43</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
<li>
<p>那是一种内在的东西,他们到达不了,也无法触及!</p>
<span>5月12日 01:25</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
</li>
<li>
<p>希望是一个好东西,也许是最好的,好东西是不会消亡的!</p>
<span>6月11日 15:33</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
<li>
<p>一切都在不可避免的走向庸俗。</p>
<span>2月09日 13:40</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
<li>
<p>路上没有灯火的时候,就点亮自己的头颅。</p>
<span>3月11日 12:30</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
<li>
<p>我们应该不虚度一生,应该能够说:"我已经做了我能做的事。"</p>
<span>4月30日 22:43</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
</li>
<li>
<p>接近,是我对一切的态度,是我对一切态度的距离</p>
<span>6月11日 15:33</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
<li>
<p>没有锚的船当然也可以航行,只是紧张充满你的一生。</p>
<span>2月09日 13:40</span>
<a href="javascript:;" data-id="1"
class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
<p>{$vo.content|raw}</p>
<span>{$vo.create_time}</span>
<a href="{$vo.url}" data-id="{$vo.id}" target="_blank" class="pear-btn pear-btn-primary pear-btn-xs pear-reply">回复</a>
</li>
{/volist}
</ul>
</div>
</div>

View File

@ -29,21 +29,16 @@
归档
</div>
<div class="layui-card-body">
<ul class="list">
<!-- <ul class="list">
<li class="list-item"><span class="title">优化代码格式</span><span class="footer">2020-06-04 11:28</span></li>
<li class="list-item"><span class="title">新增消息组件</span><span class="footer">2020-06-01 04:23</span></li>
<li class="list-item"><span class="title">移动端兼容</span><span class="footer">2020-05-22 21:38</span></li>
<li class="list-item"><span class="title">系统布局优化</span><span class="footer">2020-05-15 14:26</span></li>
<li class="list-item"><span class="title">兼容多系统菜单模式</span><span class="footer">2020-05-13 16:32</span></li>
<li class="list-item"><span class="title">兼容多标签页切换</span><span class="footer">2019-12-9 14:58</span></li>
<li class="list-item"><span class="title">扩展下拉组件</span><span class="footer">2019-12-7 9:06</span></li>
<li class="list-item"><span class="title">扩展卡片样式</span><span class="footer">2019-12-1 10:26</span></li>
</ul>
</ul> -->
</div>
</div>
</div>
<div class="layui-col-md9">
<div class="layui-card">
<!-- <div class="layui-card">
<div class="layui-card-header">
我的文章
</div>
@ -51,6 +46,7 @@
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="layui-row layui-col-space10" style="margin: 15px;">
<div class="layui-col-md1">
<img src="/static/admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
@ -63,83 +59,13 @@
<div class="comment">2020-06-12 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 评论 5 点赞 12 转发 4</div>
</div>
</div>
<div class="layui-row layui-col-space10" style="margin: 15px;">
<div class="layui-col-md1">
<img src="/static/admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
</div>
<div class="layui-col-md11" style="height: 80px;">
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习</div>
<div class="content">
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处在于理解了Git的精髓。”来一句我们程序员们接地气的话分享是一种快乐~
</div>
<div class="comment">2020-06-12 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 评论 5 点赞 12 转发 4</div>
</div>
</div>
<div class="layui-row layui-col-space10" style="margin: 15px;">
<div class="layui-col-md1">
<img src="/static/admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
</div>
<div class="layui-col-md11" style="height: 80px;">
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习</div>
<div class="content">
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处在于理解了Git的精髓。”来一句我们程序员们接地气的话分享是一种快乐~
</div>
<div class="comment">2020-06-12 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 评论 5 点赞 12 转发 4</div>
</div>
</div>
<div class="layui-row layui-col-space10" style="margin: 15px;">
<div class="layui-col-md1">
<img src="/static/admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
</div>
<div class="layui-col-md11" style="height: 80px;">
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习</div>
<div class="content">
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处在于理解了Git的精髓。”来一句我们程序员们接地气的话分享是一种快乐~
</div>
<div class="comment">2020-06-12 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 评论 5 点赞 12 转发 4</div>
</div>
</div>
<div class="layui-row layui-col-space10" style="margin: 15px;">
<div class="layui-col-md1">
<img src="/static/admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
</div>
<div class="layui-col-md11" style="height: 80px;">
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习</div>
<div class="content">
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处在于理解了Git的精髓。”来一句我们程序员们接地气的话分享是一种快乐~
</div>
<div class="comment">2020-06-12 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 评论 5 点赞 12 转发 4</div>
</div>
</div>
<div class="layui-row layui-col-space10" style="margin: 15px;">
<div class="layui-col-md1">
<img src="/static/admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
</div>
<div class="layui-col-md11" style="height: 80px;">
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习</div>
<div class="content">
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处在于理解了Git的精髓。”来一句我们程序员们接地气的话分享是一种快乐~
</div>
<div class="comment">2020-06-12 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 评论 5 点赞 12 转发 4</div>
</div>
</div>
<div class="layui-row layui-col-space10" style="margin: 15px;">
<div class="layui-col-md1">
<img src="/static/admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
</div>
<div class="layui-col-md11" style="height: 80px;">
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习</div>
<div class="content">
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处在于理解了Git的精髓。”来一句我们程序员们接地气的话分享是一种快乐~
</div>
<div class="comment">2020-06-12 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 评论 5 点赞 12 转发 4</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> -->
</div>
</div>
<script src="/static/component/layui/layui.js"></script>

View File

@ -82,6 +82,9 @@
<script type="text/html" id="imgTpl">
<img src= {{=d.avatar}} style="width: 30px; height: 30px;" />
</script>
<script type="text/html" id="adminTpl">
<a href="{:url('user.user/goUserHome')}?id={{ d.id }}" target="_blank">{{- d.username }}</a>
</script>
<script type="text/html" id="user-bar">
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></button>
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
@ -151,7 +154,8 @@
title: '用户',
field: 'username',
align: 'center',
width: 100
width: 100,
templet: '#adminTpl'
},
{
title: '昵称',

View File

@ -18,6 +18,8 @@ use think\facade\Db;
use taoser\think\Auth;
use taoler\com\Files;
use think\facade\Lang;
use think\facade\Cookie;
use think\facade\Config;
/**
* 控制器基础类
@ -165,6 +167,31 @@ class AdminController extends \app\BaseController
$articleUrl = (string) url('article_detail', ['id' => (int) $aid, 'ename'=> $ename]);
}
return $this->appConver($appName, $articleUrl);
}
//后台管理用户的路由转换为前台用户中心的路由
//直接登录用户中心
protected function getUserHome($uid) {
$user = Db::name('user')->field('id,name')->find($uid);
$salt = Config::get('taoler.salt');
$auth = md5($user['name'].$salt).":".$user['id'];
Cookie::set('auth',$auth,604800);
$url = (string) url('user/index');
return $this->appConver('index', $url);
}
/**
* APP应用转换,在后台admin应用转换为在其它app应用的路径
* /admin/user/info转换为 /index/user/info
* @param string $appName 要转换为哪个应用
* @param string $url 路由地址
* @return string
*/
public function appConver(string $appName, string $url) :string
{
// 判断应用是否绑定域名
$app_bind = array_search($appName, config('app.domain_bind'));
// 判断应用是否域名映射
@ -179,43 +206,40 @@ class AdminController extends \app\BaseController
if($bind_admin) {
// 1.应用绑定了域名
if($app_bind) {
return $this->getDomain() . $articleUrl;
return $this->getDomain() . $url;
}
// 2.应用进行了映射
if($app_map){
return $this->getDomain() . '/' . $appName . $articleUrl;
return $this->getDomain() . '/' . $appName . $url;
}
// 3.应用未绑定域名也未进行映射
return $this->getDomain() . '/' . $appName . $articleUrl;
return $this->getDomain() . '/' . $appName . $url;
}
//2.admin进行了映射
if($map_admin) {
// 1.应用绑定了域名
if($app_bind) {
return $this->getDomain() . str_replace($map_admin, '', $articleUrl);;
return $this->getDomain() . str_replace($map_admin, '', $url);;
}
// 2.应用进行了映射
if($app_map){
return $this->getDomain() . str_replace($map_admin, $app_map, $articleUrl);
return $this->getDomain() . str_replace($map_admin, $app_map, $url);
}
// 3.应用未绑定域名也未进行映射
return $this->getDomain() . str_replace($map_admin, $appName, $articleUrl);
return $this->getDomain() . str_replace($map_admin, $appName, $url);
}
//3.admin未绑定域名也未映射
// 1.应用绑定了域名
if($app_bind) {
return $this->getDomain() . $articleUrl;
return $this->getDomain() . $url;
}
// 2.应用进行了映射
if($app_map){
return $this->getDomain() . str_replace('admin', $app_map, $articleUrl);
return $this->getDomain() . str_replace('admin', $app_map, $url);
}
return str_replace('admin', $appName, $articleUrl);
return str_replace('admin', $appName, $url);
}
}

View File

@ -401,6 +401,26 @@ class Article extends Model
])->toArray();
}
// 获取admin应用所有帖子状态内容
public function getAllStatusList(array $where, int $limit, int $page)
{
return $this::field('id,user_id,cate_id,title,content,is_top,is_hot,is_reply,status,update_time,read_type,art_pass')
->with([
'user' => function($query){
$query->field('id,name,user_img');
},
'cate' => function($query){
$query->field('id,ename,catename');
}
])
->where($where)
->order('create_time', 'desc')
->paginate([
'list_rows' => $limit,
'page' => $page
])->toArray();
}
// 获取url
public function getUrlAttr($value,$data)
{

View File

@ -127,6 +127,7 @@ class User extends Model
$salt = substr(md5($data['create_time']),-6);
$data['password'] = substr_replace(md5($data['password']),$salt,0,6);
$data['status'] = Config::get('taoler.config.regist_check');
$data['nickname'] = $data['name'];
$msg = $data['status'] ? '注册成功请登录' : '注册成功,请等待审核';
$result = $this->save($data);
if ($result) {

View File

@ -33,52 +33,36 @@ class UserLogin
$url = 'http://ip-api.com/json/' . $ip . '?lang=zh-CN&fields=57361';
$city = 'earth';
// 登录日志
Log::channel('login')->info('login:{user} {ip}',['user'=>$u->name,'ip'=>$ip]);
//日志
if($type == 'log'){
//$name = $user->user['name'];
try{
$ipInfo = HttpHelper::get($url)->toJson();
if($ipInfo->status == 'success')
{
if($ipInfo->status == 'success') {
$city = $ipInfo->city;
}
} catch (\Exception $e) {
// echo $e->getMessage();
}
//国内查询,接口已失效
// $url = 'http://freeapi.ipip.net/' . $ip;
// $ipJson = Api::urlGetRespond($url);
// $respond = $ipJson->getData();
// if($respond['code'] == 0){
// //字符串数组["中国","北京","北京"]
// $data = $respond['data'];
// //正则去掉[''],保留字符串
// $str = preg_replace('/(\"|\[|\])/','',$data);
// //地址数组
// $arr = explode(',', $str);
// $city = 'earth';
// if($arr[0] !== '本机地址') {
// $city = $arr[2];
// }
// }
}
if($type == 'logError'){
$u->allowField(['login_error_num','login_error_time'])->save(['login_error_num'=>$u->login_error_num + 1,'login_error_time'=>time()]);
}
$u->allowField(['city','last_login_ip','last_login_time','login_error_num'])->save(
[
$data = [
'city' => $city,
'last_login_ip' => $ip,
'last_login_time' => time(),
'login_error_num' => 0
]
);
Log::channel('login')->info('login:{user} {ip}',['user'=>$u->name,'ip'=>$ip]);
];
} catch (\Exception $e) {
// echo $e->getMessage();
}
}
// 登录失败 失败次数加1
if($type == 'logError') {
$data = [
'login_error_num' => $u->login_error_num + 1,
'login_error_time' => time()
];
}
$u->allowField(['city','last_login_ip','last_login_time','login_error_num'])->save($data);
}
}

View File

@ -25,7 +25,6 @@ class Auth
} else {
return json(['code' => -1, 'msg' => 'no auth']);
}
//登陆前获取加密的Cookie
return $next($request);
}

36
composer.lock generated
View File

@ -379,16 +379,16 @@
},
{
"name": "firebase/php-jwt",
"version": "v6.8.1",
"version": "v6.9.0",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26"
"reference": "f03270e63eaccf3019ef0f32849c497385774e11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/5dbc8959427416b8ee09a100d7a8588c00fb2e26",
"reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/f03270e63eaccf3019ef0f32849c497385774e11",
"reference": "f03270e63eaccf3019ef0f32849c497385774e11",
"shasum": ""
},
"require": {
@ -436,9 +436,9 @@
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v6.8.1"
"source": "https://github.com/firebase/php-jwt/tree/v6.9.0"
},
"time": "2023-07-14T18:33:00+00:00"
"time": "2023-10-05T00:24:42+00:00"
},
{
"name": "guzzlehttp/guzzle",
@ -1013,16 +1013,16 @@
},
{
"name": "league/mime-type-detection",
"version": "1.13.0",
"version": "1.14.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/mime-type-detection.git",
"reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96"
"reference": "b6a5854368533df0295c5761a0253656a2e52d9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/a6dfb1194a2946fcdc1f38219445234f65b35c96",
"reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96",
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b6a5854368533df0295c5761a0253656a2e52d9e",
"reference": "b6a5854368533df0295c5761a0253656a2e52d9e",
"shasum": ""
},
"require": {
@ -1053,7 +1053,7 @@
"description": "Mime-type detection for Flysystem",
"support": {
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.13.0"
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.14.0"
},
"funding": [
{
@ -1065,7 +1065,7 @@
"type": "tidelift"
}
],
"time": "2023-08-05T12:09:49+00:00"
"time": "2023-10-17T14:13:20+00:00"
},
{
"name": "liliuwei/thinkphp-social",
@ -1610,16 +1610,16 @@
},
{
"name": "psr/http-client",
"version": "1.0.2",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31"
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31",
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": ""
},
"require": {
@ -1656,9 +1656,9 @@
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client/tree/1.0.2"
"source": "https://github.com/php-fig/http-client"
},
"time": "2023-04-10T20:12:12+00:00"
"time": "2023-09-23T14:17:50+00:00"
},
{
"name": "psr/http-message",

View File

@ -16,7 +16,7 @@ return [
// 应用名,此项不可更改
'appname' => 'TaoLer',
// 版本配置
'version' => '2.3.12',
'version' => '2.4.0',
// 加盐
'salt' => 'taoler',
// 数据库备份目录

View File

@ -397,17 +397,17 @@
},
{
"name": "firebase/php-jwt",
"version": "v6.8.1",
"version_normalized": "6.8.1.0",
"version": "v6.9.0",
"version_normalized": "6.9.0.0",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26"
"reference": "f03270e63eaccf3019ef0f32849c497385774e11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/5dbc8959427416b8ee09a100d7a8588c00fb2e26",
"reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/f03270e63eaccf3019ef0f32849c497385774e11",
"reference": "f03270e63eaccf3019ef0f32849c497385774e11",
"shasum": ""
},
"require": {
@ -425,7 +425,7 @@
"ext-sodium": "Support EdDSA (Ed25519) signatures",
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
},
"time": "2023-07-14T18:33:00+00:00",
"time": "2023-10-05T00:24:42+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -457,7 +457,7 @@
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v6.8.1"
"source": "https://github.com/firebase/php-jwt/tree/v6.9.0"
},
"install-path": "../firebase/php-jwt"
},
@ -1076,17 +1076,17 @@
},
{
"name": "league/mime-type-detection",
"version": "1.13.0",
"version_normalized": "1.13.0.0",
"version": "1.14.0",
"version_normalized": "1.14.0.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/mime-type-detection.git",
"reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96"
"reference": "b6a5854368533df0295c5761a0253656a2e52d9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/a6dfb1194a2946fcdc1f38219445234f65b35c96",
"reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96",
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b6a5854368533df0295c5761a0253656a2e52d9e",
"reference": "b6a5854368533df0295c5761a0253656a2e52d9e",
"shasum": ""
},
"require": {
@ -1098,7 +1098,7 @@
"phpstan/phpstan": "^0.12.68",
"phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0"
},
"time": "2023-08-05T12:09:49+00:00",
"time": "2023-10-17T14:13:20+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1119,7 +1119,7 @@
"description": "Mime-type detection for Flysystem",
"support": {
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.13.0"
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.14.0"
},
"funding": [
{
@ -1718,24 +1718,24 @@
},
{
"name": "psr/http-client",
"version": "1.0.2",
"version_normalized": "1.0.2.0",
"version": "1.0.3",
"version_normalized": "1.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31"
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31",
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0 || ^2.0"
},
"time": "2023-04-10T20:12:12+00:00",
"time": "2023-09-23T14:17:50+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -1767,7 +1767,7 @@
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client/tree/1.0.2"
"source": "https://github.com/php-fig/http-client"
},
"install-path": "../psr/http-client"
},

View File

@ -3,7 +3,7 @@
'name' => 'taoser/taoler',
'pretty_version' => '2.3.10.x-dev',
'version' => '2.3.10.9999999-dev',
'reference' => 'c237566bcd13c4e1ed7fff650c97d64a9fa2c9d8',
'reference' => 'bb3b4af586dd839d0b6330e097914b95aeaf10b5',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -65,9 +65,9 @@
'dev_requirement' => false,
),
'firebase/php-jwt' => array(
'pretty_version' => 'v6.8.1',
'version' => '6.8.1.0',
'reference' => '5dbc8959427416b8ee09a100d7a8588c00fb2e26',
'pretty_version' => 'v6.9.0',
'version' => '6.9.0.0',
'reference' => 'f03270e63eaccf3019ef0f32849c497385774e11',
'type' => 'library',
'install_path' => __DIR__ . '/../firebase/php-jwt',
'aliases' => array(),
@ -146,9 +146,9 @@
'dev_requirement' => false,
),
'league/mime-type-detection' => array(
'pretty_version' => '1.13.0',
'version' => '1.13.0.0',
'reference' => 'a6dfb1194a2946fcdc1f38219445234f65b35c96',
'pretty_version' => '1.14.0',
'version' => '1.14.0.0',
'reference' => 'b6a5854368533df0295c5761a0253656a2e52d9e',
'type' => 'library',
'install_path' => __DIR__ . '/../league/mime-type-detection',
'aliases' => array(),
@ -248,9 +248,9 @@
'dev_requirement' => false,
),
'psr/http-client' => array(
'pretty_version' => '1.0.2',
'version' => '1.0.2.0',
'reference' => '0955afe48220520692d2d09f7ab7e0f93ffd6a31',
'pretty_version' => '1.0.3',
'version' => '1.0.3.0',
'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-client',
'aliases' => array(),
@ -358,7 +358,7 @@
'taoser/taoler' => array(
'pretty_version' => '2.3.10.x-dev',
'version' => '2.3.10.9999999-dev',
'reference' => 'c237566bcd13c4e1ed7fff650c97d64a9fa2c9d8',
'reference' => 'bb3b4af586dd839d0b6330e097914b95aeaf10b5',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),

View File

@ -1,5 +1,12 @@
# Changelog
## [6.9.0](https://github.com/firebase/php-jwt/compare/v6.8.1...v6.9.0) (2023-10-04)
### Features
* add payload to jwt exception ([#521](https://github.com/firebase/php-jwt/issues/521)) ([175edf9](https://github.com/firebase/php-jwt/commit/175edf958bb61922ec135b2333acf5622f2238a2))
## [6.8.1](https://github.com/firebase/php-jwt/compare/v6.8.0...v6.8.1) (2023-07-14)

View File

@ -2,6 +2,17 @@
namespace Firebase\JWT;
class BeforeValidException extends \UnexpectedValueException
class BeforeValidException extends \UnexpectedValueException implements JWTExceptionWithPayloadInterface
{
private object $payload;
public function setPayload(object $payload): void
{
$this->payload = $payload;
}
public function getPayload(): object
{
return $this->payload;
}
}

View File

@ -2,6 +2,17 @@
namespace Firebase\JWT;
class ExpiredException extends \UnexpectedValueException
class ExpiredException extends \UnexpectedValueException implements JWTExceptionWithPayloadInterface
{
private object $payload;
public function setPayload(object $payload): void
{
$this->payload = $payload;
}
public function getPayload(): object
{
return $this->payload;
}
}

View File

@ -153,23 +153,29 @@ class JWT
// Check the nbf if it is defined. This is the time that the
// token can actually be used. If it's not yet that time, abort.
if (isset($payload->nbf) && floor($payload->nbf) > ($timestamp + static::$leeway)) {
throw new BeforeValidException(
$ex = new BeforeValidException(
'Cannot handle token with nbf prior to ' . \date(DateTime::ISO8601, (int) $payload->nbf)
);
$ex->setPayload($payload);
throw $ex;
}
// Check that this token has been created before 'now'. This prevents
// using tokens that have been created for later use (and haven't
// correctly used the nbf claim).
if (!isset($payload->nbf) && isset($payload->iat) && floor($payload->iat) > ($timestamp + static::$leeway)) {
throw new BeforeValidException(
$ex = new BeforeValidException(
'Cannot handle token with iat prior to ' . \date(DateTime::ISO8601, (int) $payload->iat)
);
$ex->setPayload($payload);
throw $ex;
}
// Check if this token has expired.
if (isset($payload->exp) && ($timestamp - static::$leeway) >= $payload->exp) {
throw new ExpiredException('Expired token');
$ex = new ExpiredException('Expired token');
$ex->setPayload($payload);
throw $ex;
}
return $payload;

View File

@ -0,0 +1,20 @@
<?php
namespace Firebase\JWT;
interface JWTExceptionWithPayloadInterface
{
/**
* Get the payload that caused this exception.
*
* @return object
*/
public function getPayload(): object;
/**
* Get the payload that caused this exception.
*
* @param object $payload
* @return void
*/
public function setPayload(object $payload): void;
}

View File

@ -1,18 +1,24 @@
# Changelog
## 1.13.0 - 2022-08-05
### Added
- A reverse lookup mechanism to fetch one or all extensions for a given mimetype
## 1.12.0 - 2022-08-03
## 1.14.0 - 2022-10-17
### Updated
- Updated lookup
## 1.11.0 - 2022-04-17
## 1.13.0 - 2023-08-05
### Added
- A reverse lookup mechanism to fetch one or all extensions for a given mimetype
## 1.12.0 - 2023-08-03
### Updated
- Updated lookup
## 1.11.0 - 2023-04-17
### Updated

View File

@ -239,6 +239,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap, Extensi
'drle' => 'image/dicom-rle',
'dsc' => 'text/prs.lines.tag',
'dssc' => 'application/dssc+der',
'dst' => 'application/octet-stream',
'dtb' => 'application/x-dtbook+xml',
'dtd' => 'application/xml-dtd',
'dts' => 'audio/vnd.dts',
@ -644,6 +645,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap, Extensi
'nbp' => 'application/vnd.wolfram.player',
'nc' => 'application/x-netcdf',
'ncx' => 'application/x-dtbncx+xml',
'ndjson' => 'application/x-ndjson',
'nfo' => 'text/x-nfo',
'ngdat' => 'application/vnd.nokia.n-gage.data',
'nitf' => 'application/vnd.nitf',
@ -790,8 +792,10 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap, Extensi
'pti' => 'image/prs.pti',
'ptid' => 'application/vnd.pvi.ptid1',
'pub' => 'application/x-mspublisher',
'pv' => 'application/octet-stream',
'pvb' => 'application/vnd.3gpp.pic-bw-var',
'pwn' => 'application/vnd.3m.post-it-notes',
'pxf' => 'application/octet-stream',
'pya' => 'audio/vnd.ms-playready.media.pya',
'pyo' => 'model/vnd.pytha.pyox',
'pyox' => 'model/vnd.pytha.pyox',
@ -1335,7 +1339,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap, Extensi
'application/n-quads' => ['nq'],
'application/n-triples' => ['nt'],
'application/node' => ['cjs'],
'application/octet-stream' => ['bin', 'dms', 'lrf', 'mar', 'so', 'dist', 'distz', 'pkg', 'bpk', 'dump', 'elc', 'deploy', 'exe', 'dll', 'deb', 'dmg', 'iso', 'img', 'msi', 'msp', 'msm', 'buffer', 'phar', 'lha', 'lzh', 'class', 'sea', 'dmn', 'bpmn', 'kdb', 'sst', 'csr'],
'application/octet-stream' => ['bin', 'dms', 'lrf', 'mar', 'so', 'dist', 'distz', 'pkg', 'bpk', 'dump', 'elc', 'deploy', 'exe', 'dll', 'deb', 'dmg', 'iso', 'img', 'msi', 'msp', 'msm', 'buffer', 'phar', 'lha', 'lzh', 'class', 'sea', 'dmn', 'bpmn', 'kdb', 'sst', 'csr', 'dst', 'pv', 'pxf'],
'application/oda' => ['oda'],
'application/oebps-package+xml' => ['opf'],
'application/ogg' => ['ogx'],
@ -2269,6 +2273,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap, Extensi
'text/x-scriptzsh' => ['zsh'],
'application/cdr' => ['cdr'],
'application/STEP' => ['step', 'stp'],
'application/x-ndjson' => ['ndjson'],
];
public function lookupMimeType(string $extension): ?string

View File

@ -2,6 +2,14 @@
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 1.0.3
Add `source` link in composer.json. No code changes.
## 1.0.2
Allow PSR-7 (psr/http-message) 2.0. No code changes.
## 1.0.1
Allow installation with PHP 8. No code changes.

View File

@ -10,6 +10,9 @@
"homepage": "https://www.php-fig.org/"
}
],
"support": {
"source": "https://github.com/php-fig/http-client"
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0 || ^2.0"

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2023-09-23 10:28:39
// This file is automatically generated at:2023-10-24 23:07:16
declare (strict_types = 1);
return array (
0 => 'taoser\\addons\\Service',

View File

@ -163,7 +163,7 @@
show: true,
indent: 15,
strict: false,
expandedKeys: true
expandedKeys: false
},
tips: '请选择'
});

View File

@ -37,14 +37,14 @@
<div class="meta d-flex align-items-center text-xs text-muted">
<div>
<div class="d-inline-block" itemprop="author" itemscope="" itemtype="">
Posted by <a href="{$Request.domain}" target="_blank" class="text-muted" itemprop="url">
<span itemprop="name">{article:auther}</span></a>
<a href="{article:cate name='link'}" target="_blank" class="text-muted" rel="category">{article:cate name="catename"}</a><time class="d-inline-block" datetime="{$article.create_time|date='Y-m-d h:m:s'}" itemprop="datePublished">{article:time}</time>
<a href="{$Request.domain}" target="_blank" class="text-muted" itemprop="url"><span itemprop="name">{article:auther}</span></a>
<a href="{article:cate name='link'}" target="_blank" class="text-muted" rel="category">{article:cate name="name"}</a>
<time class="d-inline-block" datetime="{$article.create_time|date='Y-m-d h:m:s'}" itemprop="datePublished">{article:time}</time>
</div>
</div>
<div class="ml-auto text-sm yincang">
<span class="mx-1">
<small>阅读 {article:pv /} 次</small>
<small>阅读 {article:pv /} 次</small>
</span>
</div>
</div>

View File

@ -20,7 +20,11 @@
<div class="layui-col-md3">
<label class="layui-form-label">{:lang('special column')}</label>
<div class="layui-input-block">
{if ($user.auth == 1)}
<div id="CateId" class="xm-select-demo"></div>
{else /}
<input type="text" class="layui-input" disabled value="{$article.cate.catename}">
{/if}
</div>
</div>
<div class="layui-col-md8">
@ -163,7 +167,7 @@
show: true,
indent: 15,
strict: false,
expandedKeys: true
expandedKeys: false
},
tips: '请选择'
});