diff --git a/README.md b/README.md index 6c41316c055bfd01b3e53e3f241122c2a835e01f..2a032b93b4d8b3d2b70d816ff64b42f1a37ce966 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -ThinkCMF 6.0.8 开发版 +ThinkCMF 6.0.8 让你更自由地飞 =============== -**`6.0.8`正在紧张开发中,请不要用于正式环境!实际项目请下载最新正式版`6.0.7`** +欢迎入坑,有问题请及时提交issue! ### 主要特性 @@ -95,6 +95,9 @@ enjoy your cmf~! https://gitee.com/thinkcmf/docker ### 升级指导 +#### 6.0.7升级到6.0.8 +1. `composer update` + #### 6.0.6升级到6.0.7 1. `composer update` @@ -121,8 +124,21 @@ https://gitee.com/thinkcmf/docker 5. `composer update` ### 更新日志 -#### 6.0.8 coding~ -* ... +#### 6.0.8 +* 更新TP到`6.0.14` +* 增加应用轻量级命令行第三方库支持 +* 增加注册登录和验证码界面第三方验证码支持 +* 增加后台管理员个人邮件功能 +* 优化上传对话框逻辑 +* 优化钩子管理界面 +* 优化后台管理员添加编辑逻辑增加安全性 +* 优化缓存清理 +* 优化路由识别 +* 优化系统文件加载 +* 修复后台部分URL刷新不加载 +* 修复幻灯片页面管理报错 +* 补全缺失语言包 + #### 6.0.7 * 升级到`tp6.0.13` diff --git a/composer.lock b/composer.lock index 1935985874eb66f011515cb3dfeb132618ab9ab5..a5144dfc34010d1dc62d603513fbec6a27fec2ca 100644 --- a/composer.lock +++ b/composer.lock @@ -415,16 +415,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.6.5", + "version": "v6.7.1", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "8b6386d7417526d1ea4da9edb70b8352f7543627" + "reference": "49cd7ea3d2563f028d7811f06864a53b1f15ff55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/8b6386d7417526d1ea4da9edb70b8352f7543627", - "reference": "8b6386d7417526d1ea4da9edb70b8352f7543627", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/49cd7ea3d2563f028d7811f06864a53b1f15ff55", + "reference": "49cd7ea3d2563f028d7811f06864a53b1f15ff55", "shasum": "" }, "require": { @@ -434,17 +434,19 @@ "php": ">=5.5.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "doctrine/annotations": "^1.2", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "doctrine/annotations": "^1.2.6 || ^1.13.3", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.6.2", - "yoast/phpunit-polyfills": "^1.0.0" + "squizlabs/php_codesniffer": "^3.7.1", + "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "ext-openssl": "Needed for secure SMTP sending and DKIM signing", + "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", @@ -481,7 +483,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.5" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.7.1" }, "funding": [ { @@ -489,7 +491,7 @@ "type": "github" } ], - "time": "2022-10-07T12:23:10+00:00" + "time": "2022-12-08T13:30:06+00:00" }, { "name": "psr/cache", @@ -1217,16 +1219,16 @@ }, { "name": "topthink/think-orm", - "version": "v2.0.55", + "version": "v2.0.58", "source": { "type": "git", "url": "https://github.com/top-think/think-orm.git", - "reference": "e1974a4c3b1b4c5b808fcc0863fc254e711dee13" + "reference": "fae96ca60891ae82df5d8050af959711354898a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-orm/zipball/e1974a4c3b1b4c5b808fcc0863fc254e711dee13", - "reference": "e1974a4c3b1b4c5b808fcc0863fc254e711dee13", + "url": "https://api.github.com/repos/top-think/think-orm/zipball/fae96ca60891ae82df5d8050af959711354898a5", + "reference": "fae96ca60891ae82df5d8050af959711354898a5", "shasum": "" }, "require": { @@ -1266,9 +1268,9 @@ ], "support": { "issues": "https://github.com/top-think/think-orm/issues", - "source": "https://github.com/top-think/think-orm/tree/v2.0.55" + "source": "https://github.com/top-think/think-orm/tree/v2.0.58" }, - "time": "2022-09-27T14:18:43+00:00" + "time": "2023-02-11T10:07:03+00:00" }, { "name": "xia/migration", @@ -1322,21 +1324,21 @@ "packages-dev": [ { "name": "topthink/think-trace", - "version": "v1.5", + "version": "v1.6", "source": { "type": "git", "url": "https://github.com/top-think/think-trace.git", - "reference": "55027fd79abb744f32a3be8d9e1ccf873a3ca9b7" + "reference": "136cd5d97e8bdb780e4b5c1637c588ed7ca3e142" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-trace/zipball/55027fd79abb744f32a3be8d9e1ccf873a3ca9b7", - "reference": "55027fd79abb744f32a3be8d9e1ccf873a3ca9b7", + "url": "https://api.github.com/repos/top-think/think-trace/zipball/136cd5d97e8bdb780e4b5c1637c588ed7ca3e142", + "reference": "136cd5d97e8bdb780e4b5c1637c588ed7ca3e142", "shasum": "" }, "require": { "php": ">=7.1.0", - "topthink/framework": "^6.0" + "topthink/framework": "^6.0|^8.0" }, "type": "library", "extra": { @@ -1367,9 +1369,9 @@ "description": "thinkphp debug trace", "support": { "issues": "https://github.com/top-think/think-trace/issues", - "source": "https://github.com/top-think/think-trace/tree/v1.5" + "source": "https://github.com/top-think/think-trace/tree/v1.6" }, - "time": "2022-10-26T07:56:45+00:00" + "time": "2023-02-07T08:36:32+00:00" } ], "aliases": [], diff --git a/public/static/js/admin.js b/public/static/js/admin.js index 0d13ae3de98e2babe723d33d0098f735d4bdc21c..aa23f8aee12bd9d92f54f5fe5bec52261bea6876 100644 --- a/public/static/js/admin.js +++ b/public/static/js/admin.js @@ -786,6 +786,28 @@ } //地址联动end + Wind.css('artDialog'); + Wind.use('artDialog', 'noty', function () { + $('body').on('click', '.js-click2call-btn', function (e) { + e.preventDefault(); + var $_this = this, + $this = $($_this), + title = $this.data('title'); + title = title ? title:'点击下面链接,直接拨打电话'; + art.dialog({ + title: title, + icon: 'question', + content: $this.next('.js-click2call-mobiles').html(), + follow: $_this, + close: function () { + $_this.focus(); //关闭时让触发弹窗的元素获取焦点 + return true; + }, + cancelVal: '关闭', + cancel: true + }); + }); + }); })(); @@ -1148,7 +1170,7 @@ function openIframeLayer(url, title, options) { anim: -1, shade: [0.001, '#000000'], shadeClose: true, - area: GV.IS_MOBILE ? ['100%', '100%'] : ['95%', '90%'], + area: GV.IS_MOBILE ? ['100%', '100%'] : ['95%', '95%'], offset: GV.IS_MOBILE ? ['0px', '0px'] : 'auto', move: false, content: url, diff --git a/public/themes/admin_simpleboot3/admin/hook/index.html b/public/themes/admin_simpleboot3/admin/hook/index.html index 0012aa95f87a2a71e5f449a9cc897dec5cc2de2d..96e67e91bfe3731ca9f2b1ac7ae1ddb3aa595c51 100644 --- a/public/themes/admin_simpleboot3/admin/hook/index.html +++ b/public/themes/admin_simpleboot3/admin/hook/index.html @@ -13,7 +13,6 @@ - @@ -23,8 +22,7 @@ - - +
ID {:lang('NAME')} {:lang('Type')} {:lang('Description')}
{$vo.id}{$vo.name}:{$vo.hook}{$vo.name}:{$vo.hook} {$types[$vo.type]} {$vo.description} diff --git a/public/themes/admin_simpleboot3/admin/index/index.html b/public/themes/admin_simpleboot3/admin/index/index.html index ff7554e2d3ce73664e4f8ce2d442a882a5405996..616c06fcfa5ba003174af0b7c81fa2274aef7bcd 100644 --- a/public/themes/admin_simpleboot3/admin/index/index.html +++ b/public/themes/admin_simpleboot3/admin/index/index.html @@ -366,6 +366,7 @@ //去掉/ 去掉_ 全部小写。 urlTmp = urlTmp.replace(/[\\/|_|]/g,""); urlTmp = urlTmp.replace(".html",""); + urlTmp = urlTmp.toLowerCase(); var menu = menus[urlTmp]; if (menu){ openapp(url,menu.id+menu.app,menu.name,true); diff --git a/public/themes/admin_simpleboot3/admin/recycle_bin/index.html b/public/themes/admin_simpleboot3/admin/recycle_bin/index.html index d476d942017d27355e2161657dda06b84ad02139..95c7aa15dd030d45b07f5056d0338dcba1960b4d 100644 --- a/public/themes/admin_simpleboot3/admin/recycle_bin/index.html +++ b/public/themes/admin_simpleboot3/admin/recycle_bin/index.html @@ -5,7 +5,7 @@ -
+
$status = [lang('HIDDEN'), lang('DISPLAY')]; - $target = ['_blank'=>'新窗口', '_self'=>'当前窗口', '_parent'=>'父窗口', '_top'=>'主窗口']; + $target = [''=>'','_blank'=>'新窗口', '_self'=>'当前窗口', '_parent'=>'父窗口', '_top'=>'主窗口']; diff --git a/public/themes/admin_simpleboot3/admin/user/email_setting.html b/public/themes/admin_simpleboot3/admin/user/email_setting.html new file mode 100755 index 0000000000000000000000000000000000000000..4e1fd45cd1ec13d5188a031f8bd6308016c75026 --- /dev/null +++ b/public/themes/admin_simpleboot3/admin/user/email_setting.html @@ -0,0 +1,107 @@ + + + +
+ + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+
+ + 测试邮件 +
+
+ +
+ + + + + + + + diff --git a/public/themes/admin_simpleboot3/admin/user/email_setting_test.html b/public/themes/admin_simpleboot3/admin/user/email_setting_test.html new file mode 100755 index 0000000000000000000000000000000000000000..7b62d9ecf4c25cbe095f3205b0d5bb4b7d94d767 --- /dev/null +++ b/public/themes/admin_simpleboot3/admin/user/email_setting_test.html @@ -0,0 +1,33 @@ + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+ + + diff --git a/public/themes/admin_simpleboot3/manifest.json b/public/themes/admin_simpleboot3/manifest.json new file mode 100755 index 0000000000000000000000000000000000000000..dd9cb6aa51ea8e496c5c04c1da97c756dd87daa0 --- /dev/null +++ b/public/themes/admin_simpleboot3/manifest.json @@ -0,0 +1,9 @@ +{ + "name": "admin_simpleboot3", + "version": "6.0.5", + "demo_url": "http://demo.thinkcmf.com", + "author": "ThinkCMF", + "author_url": "http://www.thinkcmf.com", + "keywords": "ThinkCMF默认后台模板", + "description": "ThinkCMF默认后台模板" +} diff --git a/public/themes/admin_simpleboot3/public/base.html b/public/themes/admin_simpleboot3/public/base.html new file mode 100755 index 0000000000000000000000000000000000000000..176c08b5a3e70e025682c79f7d7ac4d1a6dc46bb --- /dev/null +++ b/public/themes/admin_simpleboot3/public/base.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/public/themes/admin_simpleboot3/user/admin_user_action/sync.html b/public/themes/admin_simpleboot3/user/admin_user_action/sync.html index 4becbc1ad9e8d8106614260a4028436716b8368d..b3f804390d8847eca02292309b13dd3180ef3126 100644 --- a/public/themes/admin_simpleboot3/user/admin_user_action/sync.html +++ b/public/themes/admin_simpleboot3/user/admin_user_action/sync.html @@ -10,7 +10,7 @@
- {:lang('Success')}! + {:lang('SYNC_SUCCESS')}!
{:lang('CLOSE')} diff --git a/public/themes/admin_simpleboot3/user/webuploader.html b/public/themes/admin_simpleboot3/user/webuploader.html index f90d1ff3b5933ac18f97a4dbe9cb0866ef737d66..a72f415423daf3990cf9926780203a7b0e1e82db 100644 --- a/public/themes/admin_simpleboot3/user/webuploader.html +++ b/public/themes/admin_simpleboot3/user/webuploader.html @@ -11,7 +11,7 @@ margin-bottom: 0; } - #uploader .statusBar{ + #uploader .statusBar { padding: 0 15px; } @@ -19,11 +19,15 @@ line-height: 1.2 !important; vertical-align: middle; } + + #info { + margin-top: 5px; + } -
+
-
+
@@ -47,6 +51,7 @@

或将文件拖到这里,单次最多可选{$max_files}个文件

+

如果开启云存储后,大文件请在云存储里上传

-
请输入网络地址 -
- - +
+
+ +
+ + +
@@ -93,24 +101,24 @@ var idPre = 'id' + new Date().getTime(); if (jQuery("#wrapper").is(":hidden")) { - var file = new Object(); - file.id = idPre + '1'; - file.filepath = jQuery("#info").val(); + var file = new Object(); + file.id = idPre + '1'; + file.filepath = jQuery("#info").val(); file.preview_url = file.filepath; - file.url = file.filepath; - file.name = "";//jQuery(".filelist li .title").eq(i).html(); + file.url = file.filepath; + file.name = "";//jQuery(".filelist li .title").eq(i).html(); files.push(file); } else { var number = jQuery(".filelist li").size(); for (var i = 0; i < number; i++) { - var file = new Object(); - var $file = jQuery(".filelist li").eq(i); - file.id = idPre + i; - file.filepath = $file.data("filepath"); + var file = new Object(); + var $file = jQuery(".filelist li").eq(i); + file.id = idPre + i; + file.filepath = $file.data("filepath"); file.preview_url = $file.data("preview_url");//httpUrl+file.filepath; - file.url = $file.data("url"); - file.name = $file.data("name"); + file.url = $file.data("url"); + file.name = $file.data("name"); if (file.url == undefined) { continue; } else { @@ -123,7 +131,7 @@ return files; } - var multi = {$multi};//是否允许同时选多个文件 + var multi = {$multi};//是否允许同时选多个文件 var maxFiles = {$max_files};//允许上传多少文件 var fileErrorMsg = {}; @@ -132,34 +140,34 @@ (function ($) { // 当domReady的时候开始初始化 $(function () { - var $wrap = $('#uploader'), + var $wrap = $('#uploader'), // 图片容器 - $queue = $('
    ').appendTo($wrap.find('.queueList')), + $queue = $('
      ').appendTo($wrap.find('.queueList')), // 状态栏,包括进度和控制按钮 - $statusBar = $wrap.find('.statusBar'), + $statusBar = $wrap.find('.statusBar'), // 文件总体选择信息。 - $info = $statusBar.find('.info'), + $info = $statusBar.find('.info'), // 上传按钮 - $upload = $wrap.find('.uploadBtn').hide(), + $upload = $wrap.find('.uploadBtn').hide(), // 没选择文件之前的内容。 - $placeHolder = $wrap.find('.placeholder'), - $progress = $statusBar.find('.progress').hide(), + $placeHolder = $wrap.find('.placeholder'), + $progress = $statusBar.find('.progress').hide(), // 添加的文件数量 - fileCount = 0, + fileCount = 0, // 添加的文件总大小 - fileSize = 0, + fileSize = 0, // 优化retina, 在retina下这个值是2 - ratio = window.devicePixelRatio || 1, + ratio = window.devicePixelRatio || 1, // 缩略图大小 - thumbnailWidth = 110 * ratio, - thumbnailHeight = 110 * ratio, + thumbnailWidth = 110 * ratio, + thumbnailHeight = 110 * ratio, // 可能有pedding, ready, uploading, confirm, done. - state = 'pedding', + state = 'pedding', // 所有文件的进度信息,key为file id - percentages = {}, + percentages = {}, // 判断浏览器是否支持图片的base64 - isSupportBase64 = (function () { - var data = new Image(); + isSupportBase64 = (function () { + var data = new Image(); var support = true; data.onload = data.onerror = function () { if (this.width != 1 || this.height != 1) { @@ -170,7 +178,7 @@ return support; })(), // 检测是否已经安装flash,检测flash的版本 - flashVersion = (function () { + flashVersion = (function () { var version; try { version = navigator.plugins['Shockwave Flash']; @@ -193,7 +201,7 @@ 'MozTransition' in s || 'msTransition' in s || 'OTransition' in s; - s = null; + s = null; return r; })(), @@ -222,7 +230,7 @@ delete window['expressinstallcallback']; }; - var swf = './expressInstall.swf'; + var swf = './expressInstall.swf'; // insert flash object var html = '' + - '

      ' + file.name + '

      ' + - '

      ' + - '

      ' + - ''), + var $li = $('
    • ' + + '

      ' + file.name + '

      ' + + '

      ' + + '

      ' + + '
    • '), - $btns = $('
      ' + + $btns = $('
      ' + '删除' + '向右旋转' + '向左旋转
      ').appendTo($li), - $prgress = $li.find('p.progress span'), - $wrap = $li.find('p.imgWrap'), - $info = $('

      '), + $prgress = $li.find('p.progress span'), + $wrap = $li.find('p.imgWrap'), + $info = $('

      '), showError = function (code) { switch (code) { @@ -389,7 +397,7 @@ }, thumbnailWidth, thumbnailHeight); percentages[file.id] = [file.size, 0]; - file.rotation = 0; + file.rotation = 0; } file.on('statuschange', function (cur, prev) { @@ -489,8 +497,8 @@ function updateTotalProgress() { var loaded = 0, - total = 0, - spans = $progress.children(), + total = 0, + spans = $progress.children(), percent; $.each(percentages, function (k, v) { @@ -604,7 +612,7 @@ } uploader.onUploadProgress = function (file, percentage) { - var $li = $('#' + file.id), + var $li = $('#' + file.id), $percent = $li.find('.progress span'); $percent.css('width', percentage * 100 + '%'); diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index f7f1dad61b7b51587d3b4949188e6dcd3d81a50a..263fcca5b38f954e02ef7a0814255b1ab848c454 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -430,17 +430,17 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.6.5", - "version_normalized": "6.6.5.0", + "version": "v6.7.1", + "version_normalized": "6.7.1.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "8b6386d7417526d1ea4da9edb70b8352f7543627" + "reference": "49cd7ea3d2563f028d7811f06864a53b1f15ff55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/8b6386d7417526d1ea4da9edb70b8352f7543627", - "reference": "8b6386d7417526d1ea4da9edb70b8352f7543627", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/49cd7ea3d2563f028d7811f06864a53b1f15ff55", + "reference": "49cd7ea3d2563f028d7811f06864a53b1f15ff55", "shasum": "" }, "require": { @@ -450,24 +450,26 @@ "php": ">=5.5.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "doctrine/annotations": "^1.2", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "doctrine/annotations": "^1.2.6 || ^1.13.3", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.6.2", - "yoast/phpunit-polyfills": "^1.0.0" + "squizlabs/php_codesniffer": "^3.7.1", + "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "ext-openssl": "Needed for secure SMTP sending and DKIM signing", + "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" }, - "time": "2022-10-07T12:23:10+00:00", + "time": "2022-12-08T13:30:06+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -499,7 +501,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.5" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.7.1" }, "funding": [ { @@ -1280,17 +1282,17 @@ }, { "name": "topthink/think-orm", - "version": "v2.0.55", - "version_normalized": "2.0.55.0", + "version": "v2.0.58", + "version_normalized": "2.0.58.0", "source": { "type": "git", "url": "https://github.com/top-think/think-orm.git", - "reference": "e1974a4c3b1b4c5b808fcc0863fc254e711dee13" + "reference": "fae96ca60891ae82df5d8050af959711354898a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-orm/zipball/e1974a4c3b1b4c5b808fcc0863fc254e711dee13", - "reference": "e1974a4c3b1b4c5b808fcc0863fc254e711dee13", + "url": "https://api.github.com/repos/top-think/think-orm/zipball/fae96ca60891ae82df5d8050af959711354898a5", + "reference": "fae96ca60891ae82df5d8050af959711354898a5", "shasum": "" }, "require": { @@ -1304,7 +1306,7 @@ "require-dev": { "phpunit/phpunit": "^7|^8|^9.5" }, - "time": "2022-09-27T14:18:43+00:00", + "time": "2023-02-11T10:07:03+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1332,30 +1334,30 @@ ], "support": { "issues": "https://github.com/top-think/think-orm/issues", - "source": "https://github.com/top-think/think-orm/tree/v2.0.55" + "source": "https://github.com/top-think/think-orm/tree/v2.0.58" }, "install-path": "../topthink/think-orm" }, { "name": "topthink/think-trace", - "version": "v1.5", - "version_normalized": "1.5.0.0", + "version": "v1.6", + "version_normalized": "1.6.0.0", "source": { "type": "git", "url": "https://github.com/top-think/think-trace.git", - "reference": "55027fd79abb744f32a3be8d9e1ccf873a3ca9b7" + "reference": "136cd5d97e8bdb780e4b5c1637c588ed7ca3e142" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-trace/zipball/55027fd79abb744f32a3be8d9e1ccf873a3ca9b7", - "reference": "55027fd79abb744f32a3be8d9e1ccf873a3ca9b7", + "url": "https://api.github.com/repos/top-think/think-trace/zipball/136cd5d97e8bdb780e4b5c1637c588ed7ca3e142", + "reference": "136cd5d97e8bdb780e4b5c1637c588ed7ca3e142", "shasum": "" }, "require": { "php": ">=7.1.0", - "topthink/framework": "^6.0" + "topthink/framework": "^6.0|^8.0" }, - "time": "2022-10-26T07:56:45+00:00", + "time": "2023-02-07T08:36:32+00:00", "type": "library", "extra": { "think": { @@ -1386,7 +1388,7 @@ "description": "thinkphp debug trace", "support": { "issues": "https://github.com/top-think/think-trace/issues", - "source": "https://github.com/top-think/think-trace/tree/v1.5" + "source": "https://github.com/top-think/think-trace/tree/v1.6" }, "install-path": "../topthink/think-trace" }, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 17711ac847d2d313937a815b8e5dc347c60db365..6e8c6efcd85c79e6d539b3369c84c49e1ed64077 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -80,12 +80,12 @@ ), ), 'phpmailer/phpmailer' => array( - 'pretty_version' => 'v6.6.5', - 'version' => '6.6.5.0', + 'pretty_version' => 'v6.7.1', + 'version' => '6.7.1.0', 'type' => 'library', 'install_path' => __DIR__ . '/../phpmailer/phpmailer', 'aliases' => array(), - 'reference' => '8b6386d7417526d1ea4da9edb70b8352f7543627', + 'reference' => '49cd7ea3d2563f028d7811f06864a53b1f15ff55', 'dev_requirement' => false, ), 'psr/cache' => array( @@ -233,21 +233,21 @@ 'dev_requirement' => false, ), 'topthink/think-orm' => array( - 'pretty_version' => 'v2.0.55', - 'version' => '2.0.55.0', + 'pretty_version' => 'v2.0.58', + 'version' => '2.0.58.0', 'type' => 'library', 'install_path' => __DIR__ . '/../topthink/think-orm', 'aliases' => array(), - 'reference' => 'e1974a4c3b1b4c5b808fcc0863fc254e711dee13', + 'reference' => 'fae96ca60891ae82df5d8050af959711354898a5', 'dev_requirement' => false, ), 'topthink/think-trace' => array( - 'pretty_version' => 'v1.5', - 'version' => '1.5.0.0', + 'pretty_version' => 'v1.6', + 'version' => '1.6.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../topthink/think-trace', 'aliases' => array(), - 'reference' => '55027fd79abb744f32a3be8d9e1ccf873a3ca9b7', + 'reference' => '136cd5d97e8bdb780e4b5c1637c588ed7ca3e142', 'dev_requirement' => true, ), 'xia/migration' => array( diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/ContentEditable.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/ContentEditable.php new file mode 100644 index 0000000000000000000000000000000000000000..5b03d3e3785908a5f2c3f2dfe303b429b222dafe --- /dev/null +++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/ContentEditable.php @@ -0,0 +1,16 @@ +get('HTML.Trusted')) { + $allowed = array('', 'true', 'false'); + } + + $enum = new HTMLPurifier_AttrDef_Enum($allowed); + + return $enum->validate($string, $config, $context); + } +} diff --git a/vendor/phpmailer/phpmailer/README.md b/vendor/phpmailer/phpmailer/README.md index 56f971a499845b1458dbed758063af22484caa32..3bba8262cadf0964cfbbefc756c9dd51343bd82e 100644 --- a/vendor/phpmailer/phpmailer/README.md +++ b/vendor/phpmailer/phpmailer/README.md @@ -16,7 +16,7 @@ - Probably the world's most popular code for sending email from PHP! - Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more - Integrated SMTP support – send without a local mail server -- Send emails with multiple To, CC, BCC and Reply-to addresses +- Send emails with multiple To, CC, BCC, and Reply-to addresses - Multipart/alternative emails for mail clients that do not read HTML email - Add attachments, including inline - Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings @@ -25,7 +25,7 @@ - Protects against header injection attacks - Error messages in over 50 languages! - DKIM and S/MIME signing support -- Compatible with PHP 5.5 and later, including PHP 8.1 +- Compatible with PHP 5.5 and later, including PHP 8.2 - Namespaced to prevent name clashes - Much more! @@ -38,7 +38,7 @@ The PHP `mail()` function usually sends via a local mail server, typically front *Please* don't be tempted to do it yourself – if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own. Try [SwiftMailer](https://swiftmailer.symfony.com/) -, [Laminas/Mail](https://docs.laminas.dev/laminas-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail) etc. +, [Laminas/Mail](https://docs.laminas.dev/laminas-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail), etc. ## License This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read [LICENSE](https://github.com/PHPMailer/PHPMailer/blob/master/LICENSE) for information on the software availability and distribution. @@ -47,7 +47,7 @@ This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lg PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file: ```json -"phpmailer/phpmailer": "^6.5" +"phpmailer/phpmailer": "^6.7.1" ``` or run @@ -136,14 +136,14 @@ try { } ``` -You'll find plenty to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder, which covers many common scenarios including sending through gmail, building contact forms, sending to mailing lists, and more. +You'll find plenty to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder, which covers many common scenarios including sending through Gmail, building contact forms, sending to mailing lists, and more. If you are re-using the instance (e.g. when sending to a mailing list), you may need to clear the recipient list to avoid sending duplicate messages. See [the mailing list example](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) for further guidance. That's it. You should now be ready to use PHPMailer! ## Localization -PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: +PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder, you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: ```php //To load the French version @@ -178,9 +178,9 @@ Please disclose any vulnerabilities found responsibly – report security issues See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY.md) and [PHPMailer's security advisories on GitHub](https://github.com/PHPMailer/PHPMailer/security). ## Contributing -Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). +Please submit bug reports, suggestions, and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). -We're particularly interested in fixing edge-cases, expanding test coverage and updating translations. +We're particularly interested in fixing edge cases, expanding test coverage, and updating translations. If you found a mistake in the docs, or want to add something, go ahead and amend the wiki – anyone can edit it. @@ -204,7 +204,7 @@ Donations are very welcome, whether in beer 🍺, T-shirts 👕, or cold, hard c Available as part of the Tidelift Subscription. The maintainers of PHPMailer and thousands of other packages are working with Tidelift to deliver commercial -support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and +support and maintenance for the open-source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-phpmailer-phpmailer?utm_source=packagist-phpmailer-phpmailer&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) @@ -222,9 +222,9 @@ See [changelog](changelog.md). ### What's changed since moving from SourceForge? - Official successor to the SourceForge and Google Code projects. - Test suite. -- Continuous integration with Github Actions. +- Continuous integration with GitHub Actions. - Composer support. - Public development. - Additional languages and language strings. - CRAM-MD5 authentication support. -- Preserves full repo history of authors, commits and branches from the original SourceForge project. +- Preserves full repo history of authors, commits, and branches from the original SourceForge project. diff --git a/vendor/phpmailer/phpmailer/VERSION b/vendor/phpmailer/phpmailer/VERSION index 653877f1f9b29317ce7b4675f1d01a8e396da5ff..06a765991fe83fbf79efa286e97b9fdb4b901ef6 100644 --- a/vendor/phpmailer/phpmailer/VERSION +++ b/vendor/phpmailer/phpmailer/VERSION @@ -1 +1 @@ -6.6.5 \ No newline at end of file +6.7.1 diff --git a/vendor/phpmailer/phpmailer/composer.json b/vendor/phpmailer/phpmailer/composer.json index 9275fab481bd0695ffed56f792bd01f1fbac3a1e..37e3d6e7044835f401d41362cba7d1de0d7da33f 100644 --- a/vendor/phpmailer/phpmailer/composer.json +++ b/vendor/phpmailer/phpmailer/composer.json @@ -37,17 +37,19 @@ "ext-hash": "*" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "doctrine/annotations": "^1.2", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "doctrine/annotations": "^1.2.6 || ^1.13.3", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.6.2", - "yoast/phpunit-polyfills": "^1.0.0" + "squizlabs/php_codesniffer": "^3.7.1", + "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "ext-openssl": "Needed for secure SMTP sending and DKIM signing", + "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", diff --git a/vendor/phpmailer/phpmailer/get_oauth_token.php b/vendor/phpmailer/phpmailer/get_oauth_token.php index ba66f6cae946cf7e96462d9e4debdc40fe7722a5..cda0445c6bb0a35125f56107a806a4f2dacb8938 100644 --- a/vendor/phpmailer/phpmailer/get_oauth_token.php +++ b/vendor/phpmailer/phpmailer/get_oauth_token.php @@ -44,6 +44,8 @@ use League\OAuth2\Client\Provider\Google; use Hayageek\OAuth2\Client\Provider\Yahoo; //@see https://github.com/stevenmaguire/oauth2-microsoft use Stevenmaguire\OAuth2\Client\Provider\Microsoft; +//@see https://github.com/greew/oauth2-azure-provider +use Greew\OAuth2\Client\Provider\Azure; if (!isset($_GET['code']) && !isset($_POST['provider'])) { ?> @@ -57,11 +59,14 @@ if (!isset($_GET['code']) && !isset($_POST['provider'])) {

      + +

      Enter id and secret

      These details are obtained by setting up an app in your provider's developer console.

      ClientId:

      ClientSecret:

      +

      TenantID (only relevant for Azure):

      @@ -77,18 +82,22 @@ session_start(); $providerName = ''; $clientId = ''; $clientSecret = ''; +$tenantId = ''; if (array_key_exists('provider', $_POST)) { $providerName = $_POST['provider']; $clientId = $_POST['clientId']; $clientSecret = $_POST['clientSecret']; + $tenantId = $_POST['tenantId']; $_SESSION['provider'] = $providerName; $_SESSION['clientId'] = $clientId; $_SESSION['clientSecret'] = $clientSecret; + $_SESSION['tenantId'] = $tenantId; } elseif (array_key_exists('provider', $_SESSION)) { $providerName = $_SESSION['provider']; $clientId = $_SESSION['clientId']; $clientSecret = $_SESSION['clientSecret']; + $tenantId = $_SESSION['tenantId']; } //If you don't want to use the built-in form, set your client id and secret here @@ -130,6 +139,17 @@ switch ($providerName) { ] ]; break; + case 'Azure': + $params['tenantId'] = $tenantId; + + $provider = new Azure($params); + $options = [ + 'scope' => [ + 'https://outlook.office.com/SMTP.Send', + 'offline_access' + ] + ]; + break; } if (null === $provider) { diff --git a/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php b/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php index 6ba74627309f2d24ea432debf5f5930e29034270..6992041873a8f4288dbc11fbe2d794bd3bdaa764 100644 --- a/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php +++ b/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php @@ -4,6 +4,7 @@ * Spanish PHPMailer language file: refer to English translation for definitive list * @package PHPMailer * @author Matt Sturdy + * @author Crystopher Glodzienski Cardoso */ $PHPMAILER_LANG['authenticate'] = 'Error SMTP: Imposible autentificar.'; @@ -25,3 +26,6 @@ $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falló.'; $PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; $PHPMAILER_LANG['variable_set'] = 'No se pudo configurar la variable: '; $PHPMAILER_LANG['extension_missing'] = 'Extensión faltante: '; +$PHPMAILER_LANG['smtp_code'] = 'Código del servidor SMTP: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Información adicional del servidor SMTP: '; +$PHPMAILER_LANG['invalid_header'] = 'Nombre o valor de encabezado no válido'; diff --git a/vendor/phpmailer/phpmailer/src/PHPMailer.php b/vendor/phpmailer/phpmailer/src/PHPMailer.php index 7e6c88ff14ebee36c0f418669233c38a447a537b..e14cdbf57b31f2f6d7e2ae67cdccbadc25330341 100644 --- a/vendor/phpmailer/phpmailer/src/PHPMailer.php +++ b/vendor/phpmailer/phpmailer/src/PHPMailer.php @@ -750,7 +750,7 @@ class PHPMailer * * @var string */ - const VERSION = '6.6.5'; + const VERSION = '6.7.1'; /** * Error severity: message only, continue processing. @@ -858,7 +858,7 @@ class PHPMailer private function mailPassthru($to, $subject, $body, $header, $params) { //Check overloading of mail function to avoid double-encoding - if (ini_get('mbstring.func_overload') & 1) { + if ((int)ini_get('mbstring.func_overload') & 1) { $subject = $this->secureHeader($subject); } else { $subject = $this->encodeHeader($this->secureHeader($subject)); @@ -1124,6 +1124,22 @@ class PHPMailer return call_user_func_array([$this, 'addAnAddress'], $params); } + /** + * Set the boundaries to use for delimiting MIME parts. + * If you override this, ensure you set all 3 boundaries to unique values. + * The default boundaries include a "=_" sequence which cannot occur in quoted-printable bodies, + * as suggested by https://www.rfc-editor.org/rfc/rfc2045#section-6.7 + * + * @return void + */ + public function setBoundaries() + { + $this->uniqueid = $this->generateId(); + $this->boundary[1] = 'b1=_' . $this->uniqueid; + $this->boundary[2] = 'b2=_' . $this->uniqueid; + $this->boundary[3] = 'b3=_' . $this->uniqueid; + } + /** * Add an address to one of the recipient arrays or to the ReplyTo array. * Addresses that have been added already return false, but do not throw exceptions. @@ -1671,11 +1687,11 @@ class PHPMailer return $this->mailSend($this->MIMEHeader, $this->MIMEBody); } } catch (Exception $exc) { + $this->setError($exc->getMessage()); + $this->edebug($exc->getMessage()); if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true && $this->smtp->connected()) { $this->smtp->reset(); } - $this->setError($exc->getMessage()); - $this->edebug($exc->getMessage()); if ($this->exceptions) { throw $exc; } @@ -2794,10 +2810,7 @@ class PHPMailer { $body = ''; //Create unique IDs and preset boundaries - $this->uniqueid = $this->generateId(); - $this->boundary[1] = 'b1_' . $this->uniqueid; - $this->boundary[2] = 'b2_' . $this->uniqueid; - $this->boundary[3] = 'b3_' . $this->uniqueid; + $this->setBoundaries(); if ($this->sign_key_file) { $body .= $this->getMailMIME() . static::$LE; @@ -2833,7 +2846,7 @@ class PHPMailer $altBodyEncoding = static::ENCODING_QUOTED_PRINTABLE; } //Use this as a preamble in all multipart message types - $mimepre = 'This is a multi-part message in MIME format.' . static::$LE . static::$LE; + $mimepre = ''; switch ($this->message_type) { case 'inline': $body .= $mimepre; @@ -3069,6 +3082,18 @@ class PHPMailer return $body; } + /** + * Get the boundaries that this message will use + * @return array + */ + public function getBoundaries() + { + if (empty($this->boundary)) { + $this->setBoundaries(); + } + return $this->boundary; + } + /** * Return the start of a message boundary. * @@ -4186,6 +4211,7 @@ class PHPMailer * @param string $name Custom header name * @param string|null $value Header value * + * @return bool True if a header was set successfully * @throws Exception */ public function addCustomHeader($name, $value = null) @@ -4635,17 +4661,29 @@ class PHPMailer } /** - * Remove trailing breaks from a string. + * Remove trailing whitespace from a string. * * @param string $text * - * @return string The text to remove breaks from + * @return string The text to remove whitespace from */ public static function stripTrailingWSP($text) { return rtrim($text, " \r\n\t"); } + /** + * Strip trailing line breaks from a string. + * + * @param string $text + * + * @return string The text to remove breaks from + */ + public static function stripTrailingBreaks($text) + { + return rtrim($text, "\r\n"); + } + /** * Return the current line break format string. * @@ -4809,7 +4847,7 @@ class PHPMailer $body = static::normalizeBreaks($body, self::CRLF); //Reduce multiple trailing line breaks to a single one - return static::stripTrailingWSP($body) . self::CRLF; + return static::stripTrailingBreaks($body) . self::CRLF; } /** diff --git a/vendor/phpmailer/phpmailer/src/POP3.php b/vendor/phpmailer/phpmailer/src/POP3.php index a3c9f4532d1a7f6646d676be0cd044a3f4768863..4ae52fb191ed500f46bbcebcb62ca41afc026a4b 100644 --- a/vendor/phpmailer/phpmailer/src/POP3.php +++ b/vendor/phpmailer/phpmailer/src/POP3.php @@ -46,7 +46,7 @@ class POP3 * * @var string */ - const VERSION = '6.6.5'; + const VERSION = '6.7.1'; /** * Default POP3 port number. @@ -337,7 +337,12 @@ class POP3 */ public function disconnect() { - $this->sendString('QUIT'); + // If could not connect at all, no need to disconnect + if ($this->pop_conn === false) { + return; + } + + $this->sendString('QUIT' . static::LE); // RFC 1939 shows POP3 server sending a +OK response to the QUIT command. // Try to get it. Ignore any failures here. diff --git a/vendor/phpmailer/phpmailer/src/SMTP.php b/vendor/phpmailer/phpmailer/src/SMTP.php index 312f753cea64cb8fd1f68725806b2112030c8bf0..95b0d0bb4e3a169ede406a05d9382bb68d2d4b8f 100644 --- a/vendor/phpmailer/phpmailer/src/SMTP.php +++ b/vendor/phpmailer/phpmailer/src/SMTP.php @@ -35,7 +35,7 @@ class SMTP * * @var string */ - const VERSION = '6.6.5'; + const VERSION = '6.7.1'; /** * SMTP line break constant. diff --git a/vendor/services.php b/vendor/services.php index 377b4dde4d17847e6e1587b6d53ca219638202ef..6c02dee17a35ba3639a9818156135583144a3fbb 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'app\\admin\\AppStoreService', diff --git a/vendor/thinkcmf/cmf-app/README.md b/vendor/thinkcmf/cmf-app/README.md index fed342b3a0df88df1268f4b4c8c2a0a39516b774..7ec1b3917a261c75543b2f452a42276f6a9907b1 100644 --- a/vendor/thinkcmf/cmf-app/README.md +++ b/vendor/thinkcmf/cmf-app/README.md @@ -1,6 +1,13 @@ # ThinkCMF核心应用 ## 更新日志 +### v6.0.15 +* 修复幻灯片xxs 漏洞 +* 增加管理员添加编辑安全性 +* 增加管理员管理个人邮箱设置 +* 补全缺失语言包 +* 增加注册登录和验证码界面第三方验证码支持 + ### v6.0.14 * 优化插件设置更新 diff --git a/vendor/thinkcmf/cmf-app/src/admin/controller/IndexController.php b/vendor/thinkcmf/cmf-app/src/admin/controller/IndexController.php index 1d1a932aa42f172e65ed077ef7c8941ea1abe2cc..e334f57cd5683f6f483bb23543caf4b581f61f32 100644 --- a/vendor/thinkcmf/cmf-app/src/admin/controller/IndexController.php +++ b/vendor/thinkcmf/cmf-app/src/admin/controller/IndexController.php @@ -21,7 +21,11 @@ class IndexController extends AdminBaseController public function initialize() { $adminSettings = cmf_get_option('admin_settings'); - if (empty($adminSettings['admin_password']) || $this->request->pathinfo() == $adminSettings['admin_password']) { + + if ( + empty($adminSettings['admin_password']) + || ($adminSettings['admin_password'] == str_replace('.html', '', $this->request->pathinfo())) + ) { $adminId = cmf_get_current_admin_id(); if (empty($adminId)) { session("__LOGIN_BY_CMF_ADMIN_PW__", 1);//设置后台登录加密码 diff --git a/vendor/thinkcmf/cmf-app/src/admin/controller/RbacController.php b/vendor/thinkcmf/cmf-app/src/admin/controller/RbacController.php index a76f5c4d3bc65a069d78acf25f830ec64faaf385..79b23f8bed91f4e0d5808092c2af005a53ffbc66 100644 --- a/vendor/thinkcmf/cmf-app/src/admin/controller/RbacController.php +++ b/vendor/thinkcmf/cmf-app/src/admin/controller/RbacController.php @@ -270,7 +270,7 @@ class RbacController extends AdminBaseController } $str = "
      - + "; $tree->init($result); diff --git a/vendor/thinkcmf/cmf-app/src/admin/controller/UserController.php b/vendor/thinkcmf/cmf-app/src/admin/controller/UserController.php index 5d7eb8c418c1337eecbcb2e5edff7aaf16261f1c..bf531c98112a06e0690be75f82aef334adf27884 100644 --- a/vendor/thinkcmf/cmf-app/src/admin/controller/UserController.php +++ b/vendor/thinkcmf/cmf-app/src/admin/controller/UserController.php @@ -14,8 +14,10 @@ use app\admin\logic\UserLogic; use app\admin\model\RoleModel; use app\admin\model\RoleUserModel; use app\admin\model\UserModel; +use app\admin\service\EmailService; use cmf\controller\AdminBaseController; use think\db\Query; +use think\Validate; /** * Class UserController @@ -397,4 +399,104 @@ class UserController extends AdminBaseController } } } + + /** + * 我的邮箱设置 + * @adminMenu( + * 'name' => '我的邮箱设置', + * 'parent' => 'admin/Setting/default', + * 'display'=> true, + * 'hasView'=> true, + * 'order' => 10000, + * 'icon' => 'email', + * 'remark' => '我的邮箱设置', + * 'param' => '' + * ) + */ + public function emailSetting() + { + $adminId = cmf_get_current_admin_id(); + $emailSetting = cmf_get_option('admin_smtp_setting_' . $adminId); + + $this->assign($emailSetting); + + return $this->fetch(); + } + + /** + * 我的邮箱设置提交保存 + * @adminMenu( + * 'name' => '我的邮箱设置提交保存', + * 'parent' => 'emailSetting', + * 'display'=> false, + * 'hasView'=> false, + * 'order' => 10000, + * 'icon' => '', + * 'remark' => '我的邮箱设置提交保存', + * 'param' => '' + * ) + */ + public function emailSettingPost() + { + if ($this->request->isPost()) { + $post = array_map('trim', $this->request->param()); + + if (in_array('', $post) && !empty($post['smtpsecure'])) { + $this->error("不能留空!"); + } + + $adminId = cmf_get_current_admin_id(); + cmf_set_option('admin_smtp_setting_' . $adminId, $post); + + $this->success(lang('EDIT_SUCCESS')); + } + } + + /** + * 我的邮箱设置测试 + * @adminMenu( + * 'name' => '我的邮箱设置测试', + * 'parent' => 'admin/Setting/default', + * 'display'=> false, + * 'hasView'=> true, + * 'order' => 10000, + * 'icon' => 'email', + * 'remark' => '我的邮箱设置测试', + * 'param' => '' + * ) + */ + public function emailSettingTest() + { + if ($this->request->isPost()) { + + $validate = new Validate(); + $validate->rule([ + 'to' => 'require|email', + 'subject' => 'require', + 'content' => 'require', + ]); + $validate->message([ + 'to.require' => '收件箱不能为空!', + 'to.email' => '收件箱格式不正确!', + 'subject.require' => '标题不能为空!', + 'content.require' => '内容不能为空!', + ]); + + $data = $this->request->param(); + if (!$validate->check($data)) { + $this->error($validate->getError()); + } + + $result = EmailService::send($data['to'], $data['subject'], $data['content']); + if ($result && empty($result['error'])) { + $this->success('发送成功!'); + } else { + $this->error('发送失败:' . $result['message']); + } + + } else { + return $this->fetch(); + } + } + } diff --git a/vendor/thinkcmf/cmf-app/src/admin/service/EmailService.php b/vendor/thinkcmf/cmf-app/src/admin/service/EmailService.php new file mode 100644 index 0000000000000000000000000000000000000000..3d8f3243908ba647b5ff905bcf6cb24a003793e3 --- /dev/null +++ b/vendor/thinkcmf/cmf-app/src/admin/service/EmailService.php @@ -0,0 +1,75 @@ + +// +---------------------------------------------------------------------- +namespace app\admin\service; + +use app\admin\model\LinkModel; +use app\admin\model\SlideItemModel; +use app\admin\model\SlideModel; + +class EmailService +{ + public static function send($address, $subject, $message, $attachments = []) + { + $adminId = cmf_get_current_admin_id(); + $smtpSetting = cmf_get_option('admin_smtp_setting_' . $adminId); + if (empty($smtpSetting)) { + return ["error" => 1, "message" => '没有邮箱配置!']; + } + + $mail = new \PHPMailer\PHPMailer\PHPMailer(); + // 设置PHPMailer使用SMTP服务器发送Email + $mail->IsSMTP(); + $mail->IsHTML(true); + //$mail->SMTPDebug = 3; + // 设置邮件的字符编码,若不指定,则为'UTF-8' + $mail->CharSet = 'UTF-8'; + // 添加收件人地址,可以多次使用来添加多个收件人 + $mail->AddAddress($address); + // 设置邮件正文 + $mail->Body = $message . htmlspecialchars_decode($smtpSetting['signature']); + // 设置邮件头的From字段。 + $mail->From = $smtpSetting['from']; + // 设置发件人名字 + $mail->FromName = $smtpSetting['from_name']; + // 设置邮件标题 + $mail->Subject = $subject; + + if (!empty($attachments)) { + foreach ($attachments as $name => $attachment) { + $mail->addAttachment($attachment, $name); + } + } + + // 设置SMTP服务器。 + $mail->Host = $smtpSetting['host']; + //by Rainfer + // 设置SMTPSecure。 + $Secure = $smtpSetting['smtp_secure']; + $mail->SMTPSecure = empty($Secure) ? '' : $Secure; + // 设置SMTP服务器端口。 + $port = $smtpSetting['port']; + $mail->Port = empty($port) ? "25" : $port; + // 设置为"需要验证" + $mail->SMTPAuth = true; + $mail->SMTPAutoTLS = false; + $mail->Timeout = 10; + // 设置用户名和密码。 + $mail->Username = $smtpSetting['username']; + $mail->Password = $smtpSetting['password']; + // 发送邮件。 + if (!$mail->Send()) { + $mailError = $mail->ErrorInfo; + return ["error" => 1, "message" => $mailError]; + } else { + return ["error" => 0, "message" => "success"]; + } + } +} diff --git a/vendor/thinkcmf/cmf-app/src/admin/service/impl/AdminMenuServiceImpl.php b/vendor/thinkcmf/cmf-app/src/admin/service/impl/AdminMenuServiceImpl.php index 14ba2edc2de069eba651eceff5ae8425c94d5ff0..a5fe4c271aef2a445b19ec4a652aa1e70a9886a1 100644 --- a/vendor/thinkcmf/cmf-app/src/admin/service/impl/AdminMenuServiceImpl.php +++ b/vendor/thinkcmf/cmf-app/src/admin/service/impl/AdminMenuServiceImpl.php @@ -17,6 +17,8 @@ use app\admin\service\AdminMenuService; class AdminMenuServiceImpl implements AdminMenuService { + private $model; + public function __construct(AdminMenuModel $model) { $this->model = $model; diff --git a/vendor/thinkcmf/cmf-app/src/user/controller/LoginController.php b/vendor/thinkcmf/cmf-app/src/user/controller/LoginController.php index cf4e2ddcb75f65af22e005dca9598024250a93a7..990d4d8a7e3adc116a9d39a79f67cf6ff058ed3a 100644 --- a/vendor/thinkcmf/cmf-app/src/user/controller/LoginController.php +++ b/vendor/thinkcmf/cmf-app/src/user/controller/LoginController.php @@ -122,7 +122,7 @@ class LoginController extends HomeBaseController if ($this->request->isPost()) { $validate = new \think\Validate(); $validate->rule([ - 'captcha' => 'require', + //'captcha' => 'require', 'verification_code' => 'require', 'password' => 'require|min:6|max:32', ]); @@ -139,16 +139,28 @@ class LoginController extends HomeBaseController $this->error($validate->getError()); } - $captchaId = empty($data['_captcha_id']) ? '' : $data['_captcha_id']; - if (!cmf_captcha_check($data['captcha'], $captchaId)) { - $this->error('验证码错误'); - } + $result = hook_one("check_third_party_captcha"); - $errMsg = cmf_check_verification_code($data['username'], $data['verification_code']); - if (!empty($errMsg)) { - $this->error($errMsg); + if ($result) { + if (is_string($result)) { + $this->error($result); + } + } else { + if(empty($data['captcha'])){ + $this->error('验证码不能为空!'); + } + $captchaId = empty($data['_captcha_id']) ? '' : $data['_captcha_id']; + if (!cmf_captcha_check($data['captcha'], $captchaId)) { + $this->error('验证码错误'); + } + + $errMsg = cmf_check_verification_code($data['username'], $data['verification_code']); + if (!empty($errMsg)) { + $this->error($errMsg); + } } + $userModel = new UserModel(); if (Validate::is($data['username'], 'email')) { diff --git a/vendor/thinkcmf/cmf-app/src/user/controller/RegisterController.php b/vendor/thinkcmf/cmf-app/src/user/controller/RegisterController.php index cd560a4ba811e2ae8f17387ba17c8b445a0f72ab..3673d023b6c7e7000f21fcb3e20797b770c5491c 100644 --- a/vendor/thinkcmf/cmf-app/src/user/controller/RegisterController.php +++ b/vendor/thinkcmf/cmf-app/src/user/controller/RegisterController.php @@ -44,7 +44,7 @@ class RegisterController extends HomeBaseController { if ($this->request->isPost()) { $rules = [ - 'captcha' => 'require', +// 'captcha' => 'require', 'code' => 'require', 'password' => 'require|min:6|max:32', @@ -70,10 +70,32 @@ class RegisterController extends HomeBaseController if (!$validate->check($data)) { $this->error($validate->getError()); } - // 手机或短信验证码 - $errMsg = cmf_check_verification_code($data['username'], $data['code']); - if (!empty($errMsg)) { - $this->error($errMsg); + + + if (!$isOpenRegistration) { + + $result = hook_one("check_third_party_captcha"); + + if ($result) { + if (is_string($result)) { + $this->error($result); + } + } else { + if(empty($data['captcha'])){ + $this->error('验证码不能为空!'); + } + $captchaId = empty($data['_captcha_id']) ? '' : $data['_captcha_id']; + + if (!cmf_captcha_check($data['captcha'], $captchaId)) { + $this->error('验证码错误'); + } + } + + $errMsg = cmf_check_verification_code($data['username'], $data['code']); + if (!empty($errMsg)) { + $this->error($errMsg); + } + } $register = new UserModel(); diff --git a/vendor/thinkcmf/cmf-app/src/user/controller/VerificationCodeController.php b/vendor/thinkcmf/cmf-app/src/user/controller/VerificationCodeController.php index 07b8866ba32cbd42066fcddbc8b0ec5b5915ddef..aaa33eda95f04747a98257cf8496c4c0dcd26f36 100644 --- a/vendor/thinkcmf/cmf-app/src/user/controller/VerificationCodeController.php +++ b/vendor/thinkcmf/cmf-app/src/user/controller/VerificationCodeController.php @@ -23,7 +23,7 @@ class VerificationCodeController extends HomeBaseController $validate = new \think\Validate(); $validate->rule([ 'username' => 'require', - 'captcha' => 'require', +// 'captcha' => 'require', ]); $validate->message([ 'username.require' => '请输入手机号或邮箱!', @@ -35,18 +35,29 @@ class VerificationCodeController extends HomeBaseController $this->error($validate->getError()); } - $captchaId = empty($data['captcha_id']) ? '' : $data['captcha_id']; - if (!cmf_captcha_check($data['captcha'], $captchaId, false)) { - $this->error('图片验证码错误!'); - } + $result = hook_one("check_third_party_captcha"); - $registerCaptcha = session('register_captcha'); + if ($result) { + if (is_string($result)) { + $this->error($result); + } + } else { + if (empty($data['captcha'])) { + $this->error('图片验证码不能为空!'); + } + $captchaId = empty($data['captcha_id']) ? '' : $data['captcha_id']; + if (!cmf_captcha_check($data['captcha'], $captchaId, false)) { + $this->error('图片验证码错误!'); + } + + $registerCaptcha = session('register_captcha'); - session('register_captcha', $data['captcha']); + session('register_captcha', $data['captcha']); - if ($registerCaptcha == $data['captcha']) { - cmf_captcha_check($data['captcha'], $captchaId, true); - $this->error('请输入新图片验证码!'); + if ($registerCaptcha == $data['captcha']) { + cmf_captcha_check($data['captcha'], $captchaId, true); + $this->error('请输入新图片验证码!'); + } } $accountType = ''; diff --git a/vendor/thinkcmf/cmf-app/src/user/hooks.php b/vendor/thinkcmf/cmf-app/src/user/hooks.php index 7f3deb674c3014c1b58542904fc2294cf2778d82..1d1c5895724af9b099e13f011c7ce87757f5a5e2 100644 --- a/vendor/thinkcmf/cmf-app/src/user/hooks.php +++ b/vendor/thinkcmf/cmf-app/src/user/hooks.php @@ -33,4 +33,10 @@ return [ "description" => "用户管理第三方用户列表界面", //钩子描述 "once" => 1 // 是否只执行一次 ], + 'check_third_party_captcha' => [ + "type" => 2,//钩子类型(默认为应用钩子;2:应用钩子;3:模板钩子;4:后台模板钩子) + "name" => '第三方验证码检测', // 钩子名称 + "description" => "第三方验证码检测", //钩子描述 + "once" => 1 // 是否只执行一次 + ], ]; diff --git a/vendor/thinkcmf/cmf-app/src/user/lang/en-us.php b/vendor/thinkcmf/cmf-app/src/user/lang/en-us.php index eb779482c2a5d60fb7884681370cf84c3f231d1e..7dbb21e2c4abe13aa760e00a83c7976794123bc8 100644 --- a/vendor/thinkcmf/cmf-app/src/user/lang/en-us.php +++ b/vendor/thinkcmf/cmf-app/src/user/lang/en-us.php @@ -36,6 +36,7 @@ return [ 'CAPTCHA_REQUIRED' => '验证码不能为空!', 'USERNAME_OR_EMAIL' => '用户名或邮箱', 'LOGIN_SUCCESS' => 'Login success!', + 'SYNC_SUCCESS' => 'Sync success!', 'PASSWORD_NOT_RIGHT' => 'Your password is wrong!', 'CAPTCHA_NOT_RIGHT' => 'CAPTCHA is wrong!', 'USERNAME_NOT_EXIST' => '用户名不存在!', diff --git a/vendor/thinkcmf/cmf-app/src/user/lang/en-us/admin_menu.php b/vendor/thinkcmf/cmf-app/src/user/lang/en-us/admin_menu.php index c916760766152f1d5871a4fa2fd40b2bac594358..275b288ca3ef31f6ec039ec8ab1b3170b5a2af34 100644 --- a/vendor/thinkcmf/cmf-app/src/user/lang/en-us/admin_menu.php +++ b/vendor/thinkcmf/cmf-app/src/user/lang/en-us/admin_menu.php @@ -18,4 +18,6 @@ return [ 'USER_OAUTHADMIN_INDEX' => 'Third Party Users', 'USER_INDEXADMIN_DEFAULT' => 'Users', 'USER_ADMINASSET_INDEX' => 'Assets', + 'USER_ADMINUSERACTION_INDEX' => 'User Operation Management', + 'USER_ADMINUSERACTION_SYNC' => 'User Action Synchronization' ]; diff --git a/vendor/thinkcmf/cmf-app/src/user/lang/zh-cn.php b/vendor/thinkcmf/cmf-app/src/user/lang/zh-cn.php index 4e36966eb08fcd2cf44794d12dd37bfb29f2dcd0..d729d9ce28a2ef52d434a186c7caa9b1168e82ce 100644 --- a/vendor/thinkcmf/cmf-app/src/user/lang/zh-cn.php +++ b/vendor/thinkcmf/cmf-app/src/user/lang/zh-cn.php @@ -36,6 +36,7 @@ return [ 'CAPTCHA_REQUIRED' => '验证码不能为空!', 'USERNAME_OR_EMAIL' => '用户名或邮箱', 'LOGIN_SUCCESS' => '登录成功!', + 'SYNC_SUCCESS' => '同步成功!', 'PASSWORD_NOT_RIGHT' => '密码错误!', 'CAPTCHA_NOT_RIGHT' => '验证码错误!', 'USERNAME_NOT_EXIST' => '用户名不存在!', @@ -64,6 +65,6 @@ return [ 'User ID' => '用户ID', 'UPLOAD_TYPE_SETTING_ERROR' => '上传文件类型配置错误!', 'Collection succeeded' => '收藏成功!', - 'No such user found'=>'查无此人!' + 'No such user found' => '查无此人!' ]; diff --git a/vendor/thinkcmf/cmf-app/src/user/lang/zh-cn/admin_menu.php b/vendor/thinkcmf/cmf-app/src/user/lang/zh-cn/admin_menu.php index 5b0513c39dc74ca842287329309c3f0ff59ee516..66982eecc153602381ca1eb4640b9984f350bcaf 100644 --- a/vendor/thinkcmf/cmf-app/src/user/lang/zh-cn/admin_menu.php +++ b/vendor/thinkcmf/cmf-app/src/user/lang/zh-cn/admin_menu.php @@ -18,4 +18,6 @@ return [ 'USER_OAUTHADMIN_INDEX' => '第三方用户', 'USER_INDEXADMIN_DEFAULT' => '用户管理', 'USER_ADMINASSET_INDEX' => '资源管理', + 'USER_ADMINUSERACTION_INDEX' => '用户操作管理', + 'USER_ADMINUSERACTION_SYNC' => '用户操作同步' ]; diff --git a/vendor/thinkcmf/cmf/README.md b/vendor/thinkcmf/cmf/README.md index 6432939b3b0bb22029d02a67f0aa2acd007fa1ce..840e3e4e0d937373259f91224b2964d6828c28c3 100644 --- a/vendor/thinkcmf/cmf/README.md +++ b/vendor/thinkcmf/cmf/README.md @@ -1,6 +1,13 @@ # ThinkCMF核心包 ## 更新日志 +### v6.0.18 +* 更新TP到`6.0.14` +* 修复API上传 +* 增加应用轻量级命令行第三方库支持 +* 优化路由识别 +* 优化系统文件加载 + ### v6.0.17 * 替换`phpquery`包 diff --git a/vendor/thinkcmf/cmf/src/common.php b/vendor/thinkcmf/cmf/src/common.php index 8431a49faf9297da684b6a73d10655d7add0bb7c..9c1acc3622623ee6fab26a26f7f5028f34005534 100644 --- a/vendor/thinkcmf/cmf/src/common.php +++ b/vendor/thinkcmf/cmf/src/common.php @@ -14,6 +14,7 @@ use think\facade\Env; use dir\Dir; use think\facade\Route; use cmf\lib\Storage; +use think\facade\Cache; // 应用公共文件 @@ -392,6 +393,8 @@ function cmf_clear_cache() foreach ($dirs as $dir) { $dirTool->delDir($dir); } + + Cache::clear(); } /** diff --git a/vendor/thinkcmf/cmf/src/console/command/Cli.php b/vendor/thinkcmf/cmf/src/console/command/Cli.php index 97c6c57200a1a51ea314c542da3a471259ac8e01..71f50cfc069b2f06f280cf8959c7a35d9bc43dc3 100644 --- a/vendor/thinkcmf/cmf/src/console/command/Cli.php +++ b/vendor/thinkcmf/cmf/src/console/command/Cli.php @@ -96,9 +96,15 @@ EOT; if ($countUrl == 3) { $controller = cmf_parse_name($urlArr[1], 1); $action = $urlArr[2]; - $class = "app\\{$urlArr[0]}\\cli\\{$controller}Cli"; + $appName = $urlArr[0]; + $class = "app\\{$appName}\\cli\\{$controller}Cli"; if (class_exists($class)) { + // 加载应用第三方库 + $appAutoLoadFile = $this->app->getAppPath() . $appName . '/vendor/autoload.php'; + if (file_exists($appAutoLoadFile)) { + require_once $appAutoLoadFile; + } if (method_exists($class, $action)) { $object = new $class(); if ($isHelp) { diff --git a/vendor/thinkcmf/cmf/src/controller/AdminBaseController.php b/vendor/thinkcmf/cmf/src/controller/AdminBaseController.php index 969b5389fe0fa9ca88db644895825c3c45576c7d..57d0e38595f18fcb2762c3295b68cfcb2ed075cb 100755 --- a/vendor/thinkcmf/cmf/src/controller/AdminBaseController.php +++ b/vendor/thinkcmf/cmf/src/controller/AdminBaseController.php @@ -119,7 +119,7 @@ class AdminBaseController extends BaseController $cmfAdminThemePath = config('template.cmf_admin_theme_path'); $cmfAdminDefaultTheme = cmf_get_current_admin_theme(); - $themePath = "{$cmfAdminThemePath}{$cmfAdminDefaultTheme}/"; + $themePath = WEB_ROOT . "{$cmfAdminThemePath}{$cmfAdminDefaultTheme}/"; // 基础视图目录 $app = isset($app) ? $app : $this->app->http->getName(); diff --git a/vendor/thinkcmf/cmf/src/listener/InitHookListener.php b/vendor/thinkcmf/cmf/src/listener/InitHookListener.php index eea08d55f62f11dfdf26cbc0bd4bac3a9b997c9b..01f0c10a4ba677699122c46188330e1b8576e487 100755 --- a/vendor/thinkcmf/cmf/src/listener/InitHookListener.php +++ b/vendor/thinkcmf/cmf/src/listener/InitHookListener.php @@ -19,7 +19,7 @@ use think\facade\Route; class InitHookListener { - + private $app; // 行为扩展的执行入口必须是run public function handle($param) { diff --git a/vendor/thinkcmf/cmf/src/listener/ModuleInitListener.php b/vendor/thinkcmf/cmf/src/listener/ModuleInitListener.php index e94661b3af5a045cc82250bd0d01d3a5e2d53225..6308c9ea981b994a99014217303b35be3eba8611 100644 --- a/vendor/thinkcmf/cmf/src/listener/ModuleInitListener.php +++ b/vendor/thinkcmf/cmf/src/listener/ModuleInitListener.php @@ -19,13 +19,19 @@ use think\facade\Route; class ModuleInitListener { + private $app; // 行为扩展的执行入口必须是run public function handle($param) { /**--start InitAppHookListener--------------------------------------*/ $this->app = app(); $appName = $this->app->http->getName(); - $langSet = $this->app->lang->getLangSet(); + + if (!is_dir($this->app->getAppPath() . $appName) && !is_dir(root_path() . "vendor/thinkcmf/cmf-app/src/{$appName}")) { + return; + } + + $langSet = $this->app->lang->getLangSet(); // 加载核心应用语言包 $this->app->lang->load([ diff --git a/vendor/thinkcmf/cmf/think/Http.php b/vendor/thinkcmf/cmf/think/Http.php index 886f1864f2fa0d13cc210ccbad89643c8f32af97..51e6676aead645e3eaca4a06414f846b1d8b581f 100644 --- a/vendor/thinkcmf/cmf/think/Http.php +++ b/vendor/thinkcmf/cmf/think/Http.php @@ -223,7 +223,7 @@ class Http protected function loadMiddleware(): void { if (is_file($this->app->getBasePath() . 'middleware.php')) { - $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php'); + $this->app->middleware->import(include_once $this->app->getBasePath() . 'middleware.php'); } $appRootNamespace = $this->app->getRootNamespace(); @@ -231,7 +231,7 @@ class Http $vendorMiddlewareFile = "{$rootPath}vendor/thinkcmf/cmf-{$appRootNamespace}/src/middleware.php"; if (is_file($vendorMiddlewareFile)) { - $this->app->middleware->import(include $vendorMiddlewareFile); + $this->app->middleware->import(include_once $vendorMiddlewareFile); } } @@ -252,7 +252,7 @@ class Http if (is_dir($routePath)) { $files = glob($routePath . '*.php'); foreach ($files as $file) { - include $file; + include_once $file; } } @@ -262,7 +262,7 @@ class Http if (is_dir($routePath)) { $files = glob($routePath . '*.php'); foreach ($files as $file) { - include $file; + include_once $file; } } } diff --git a/vendor/thinkcmf/cmf/think/route/dispatch/Controller.php b/vendor/thinkcmf/cmf/think/route/dispatch/Controller.php index 25edc6ac26916c1e6a2b62da0d022b574a2e1fbc..3cabaee7aa113185935af212fe45f930a9671549 100644 --- a/vendor/thinkcmf/cmf/think/route/dispatch/Controller.php +++ b/vendor/thinkcmf/cmf/think/route/dispatch/Controller.php @@ -49,7 +49,15 @@ class Controller extends Dispatch } // 获取应用名 - $appName = $result[0] ?: config('app.default_app'); + if (empty($result[0])) { + $appName = config('app.default_app'); + } else { + if ($result[0] == 'index.php') { + $appName = config('app.default_app'); + } else { + $appName = $result[0]; + } + } // 获取控制器名 $controller = strip_tags($result[1] ?: $this->rule->config('default_controller')); diff --git a/vendor/topthink/think-orm/src/DbManager.php b/vendor/topthink/think-orm/src/DbManager.php index f223cd2ccdedda2646e8cc3c122e6a6c6c9183e4..1c1314e88b1ee82f3d15fb659225abcc8e536132 100644 --- a/vendor/topthink/think-orm/src/DbManager.php +++ b/vendor/topthink/think-orm/src/DbManager.php @@ -340,6 +340,16 @@ class DbManager { return $this->listen; } + + /** + * 获取所有连接实列 + * @access public + * @return array + */ + public function getInstance(): array + { + return $this->instance; + } /** * 注册回调方法 diff --git a/vendor/topthink/think-orm/src/Paginator.php b/vendor/topthink/think-orm/src/Paginator.php index 2f755ef43ce9426d6ee3bc11f1ce1213816fb834..eace6ba8a46634edd0ba27892f29930dff70c373 100644 --- a/vendor/topthink/think-orm/src/Paginator.php +++ b/vendor/topthink/think-orm/src/Paginator.php @@ -377,6 +377,19 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J return $this->items; } + /** + * 设置数据集 + * + * @param Collection $items + * @return $this + */ + public function setCollection(Collection $items) + { + $this->items = $items; + + return $this; + } + public function isEmpty(): bool { return $this->items->isEmpty(); diff --git a/vendor/topthink/think-orm/src/db/Builder.php b/vendor/topthink/think-orm/src/db/Builder.php index 938ed4db3b2710881a5edf4e1f0a1f49cafcce93..fa85117fe8a36b8975fd09d2302a9470aa97b2d3 100644 --- a/vendor/topthink/think-orm/src/db/Builder.php +++ b/vendor/topthink/think-orm/src/db/Builder.php @@ -158,7 +158,8 @@ abstract class Builder if (false !== strpos($key, '->')) { [$key, $name] = explode('->', $key, 2); $item = $this->parseKey($query, $key); - $result[$item] = 'json_set(' . $item . ', \'$.' . $name . '\', ' . $this->parseDataBind($query, $key . '->' . $name, $val, $bind) . ')'; + + $result[$item . '->' . $name] = 'json_set(' . $item . ', \'$.' . $name . '\', ' . $this->parseDataBind($query, $key . '->' . $name, $val, $bind) . ')'; } elseif (false === strpos($key, '.') && !in_array($key, $fields, true)) { if ($options['strict']) { throw new Exception('fields not exists:[' . $key . ']'); @@ -176,7 +177,7 @@ abstract class Builder } } elseif (is_scalar($val)) { // 过滤非标量数据 - $result[$item] = $this->parseDataBind($query, $key, $val, $bind); + $result[$item] = !$query->isAutoBind() ? $val : $this->parseDataBind($query, $key, $val, $bind); } } @@ -761,18 +762,23 @@ abstract class Builder if (count($value) === 0) { return 'IN' == $exp ? '0 = 1' : '1 = 1'; } - $array = []; - foreach ($value as $v) { - $name = $query->bindValue($v, $bindType); - $array[] = ':' . $name; + if ($query->isAutoBind()) { + $array = []; + foreach ($value as $v) { + $name = $query->bindValue($v, $bindType); + $array[] = ':' . $name; + } + } else { + $array = $value; } if (count($array) == 1) { return $key . ('IN' == $exp ? ' = ' : ' <> ') . $array[0]; - } else { - $value = implode(',', $array); } + + $value = implode(',', $array); + } return $key . ' ' . $exp . ' (' . $value . ')'; @@ -1139,7 +1145,8 @@ abstract class Builder $this->parseComment($query, $options['comment']), $this->parseForce($query, $options['force']), ], - $this->selectSql); + $this->selectSql + ); } /** @@ -1171,7 +1178,8 @@ abstract class Builder implode(' , ', $values), $this->parseComment($query, $options['comment']), ], - $this->insertSql); + $this->insertSql + ); } /** @@ -1222,7 +1230,8 @@ abstract class Builder implode(' UNION ALL ', $values), $this->parseComment($query, $options['comment']), ], - $this->insertAllSql); + $this->insertAllSql + ); } /** @@ -1276,7 +1285,8 @@ abstract class Builder $this->parseLock($query, $options['lock']), $this->parseComment($query, $options['comment']), ], - $this->updateSql); + $this->updateSql + ); } /** @@ -1302,6 +1312,7 @@ abstract class Builder $this->parseLock($query, $options['lock']), $this->parseComment($query, $options['comment']), ], - $this->deleteSql); + $this->deleteSql + ); } } diff --git a/vendor/topthink/think-orm/src/db/Connection.php b/vendor/topthink/think-orm/src/db/Connection.php index aa86ba8e591d06207d9b9b1f1313338aad60e7c9..015cf441afa3ae37ad9e74eb6d9923f8628cf184 100644 --- a/vendor/topthink/think-orm/src/db/Connection.php +++ b/vendor/topthink/think-orm/src/db/Connection.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- -declare (strict_types = 1); +declare(strict_types=1); namespace think\db; diff --git a/vendor/topthink/think-orm/src/db/PDOConnection.php b/vendor/topthink/think-orm/src/db/PDOConnection.php index 1748d2085648dda4e6592b468834324d97954c46..275504088acde253d8ca7efe33c5cf72a204e74d 100644 --- a/vendor/topthink/think-orm/src/db/PDOConnection.php +++ b/vendor/topthink/think-orm/src/db/PDOConnection.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- -declare (strict_types = 1); +declare(strict_types=1); namespace think\db; @@ -81,6 +81,8 @@ abstract class PDOConnection extends Connection 'break_reconnect' => false, // 断线标识字符串 'break_match_str' => [], + // 自动参数绑定 + 'auto_param_bind' => true, ]; /** @@ -1185,13 +1187,13 @@ abstract class PDOConnection extends Connection $key = null; } - if (\is_string($column)) { - $column = \trim($column); + if (is_string($column)) { + $column = trim($column); if ('*' !== $column) { - $column = \array_map('\trim', \explode(',', $column)); + $column = array_map('trim', explode(',', $column)); } - } elseif (\is_array($column)) { - if (\in_array('*', $column)) { + } elseif (is_array($column)) { + if (in_array('*', $column)) { $column = '*'; } } else { @@ -1199,7 +1201,7 @@ abstract class PDOConnection extends Connection } $field = $column; - if ('*' !== $column && $key && !\in_array($key, $column)) { + if ('*' !== $column && $key && !in_array($key, $column)) { $field[] = $key; } @@ -1234,19 +1236,23 @@ abstract class PDOConnection extends Connection if (empty($resultSet)) { $result = []; - } elseif ('*' !== $column && \count($column) === 1) { - $column = \array_shift($column); - if (\strpos($column, ' ')) { - $column = \substr(\strrchr(\trim($column), ' '), 1); + } elseif ('*' !== $column && count($column) === 1) { + $column = array_shift($column); + if (strpos($column, ' ')) { + $column = substr(strrchr(trim($column), ' '), 1); } - if (\strpos($column, '.')) { - [$alias, $column] = \explode('.', $column); + if (strpos($column, '.')) { + [$alias, $column] = explode('.', $column); } - $result = \array_column($resultSet, $column, $key); + if (strpos($column, '->')) { + $column = $this->builder->parseKey($query, $column); + } + + $result = array_column($resultSet, $column, $key); } elseif ($key) { - $result = \array_column($resultSet, null, $key); + $result = array_column($resultSet, null, $key); } else { $result = $resultSet; } @@ -1281,8 +1287,8 @@ abstract class PDOConnection extends Connection // 判断占位符 $sql = is_numeric($key) ? - substr_replace($sql, $value, strpos($sql, '?'), 1) : - substr_replace($sql, $value, strpos($sql, ':' . $key), strlen(':' . $key)); + substr_replace($sql, $value, strpos($sql, '?'), 1) : + substr_replace($sql, $value, strpos($sql, ':' . $key), strlen(':' . $key)); } return rtrim($sql); @@ -1758,6 +1764,17 @@ abstract class PDOConnection extends Connection return $this->connect($dbConfig, $r, $r == $m ? false : $dbMaster); } + /** + * 获取数据库的唯一标识 + * @access public + * @param string $suffix 标识后缀 + * @return string + */ + public function getUniqueXid(string $suffix = ''): string + { + return $this->config['hostname'] . '_' . $this->config['database'] . $suffix; + } + /** * 执行数据库Xa事务 * @access public @@ -1783,7 +1800,7 @@ abstract class PDOConnection extends Connection $dbs[$key] = $db; } - $db->startTransXa($xid); + $db->startTransXa($db->getUniqueXid('_' . $xid) ); } try { @@ -1793,17 +1810,17 @@ abstract class PDOConnection extends Connection } foreach ($dbs as $db) { - $db->prepareXa($xid); + $db->prepareXa($db->getUniqueXid('_' . $xid)); } foreach ($dbs as $db) { - $db->commitXa($xid); + $db->commitXa($db->getUniqueXid('_' . $xid) ); } return $result; } catch (\Exception | \Throwable $e) { foreach ($dbs as $db) { - $db->rollbackXa($xid); + $db->rollbackXa($db->getUniqueXid('_' . $xid) ); } throw $e; } @@ -1816,7 +1833,8 @@ abstract class PDOConnection extends Connection * @return void */ public function startTransXa(string $xid): void - {} + { + } /** * 预编译XA事务 @@ -1825,7 +1843,8 @@ abstract class PDOConnection extends Connection * @return void */ public function prepareXa(string $xid): void - {} + { + } /** * 提交XA事务 @@ -1834,7 +1853,8 @@ abstract class PDOConnection extends Connection * @return void */ public function commitXa(string $xid): void - {} + { + } /** * 回滚XA事务 @@ -1843,5 +1863,6 @@ abstract class PDOConnection extends Connection * @return void */ public function rollbackXa(string $xid): void - {} + { + } } diff --git a/vendor/topthink/think-orm/src/db/Query.php b/vendor/topthink/think-orm/src/db/Query.php index aa961239bccf8bbe16151bdf8b6fa2382cc882b6..35e66bcb5ae94c37d64bca7b20d4a679236193c3 100644 --- a/vendor/topthink/think-orm/src/db/Query.php +++ b/vendor/topthink/think-orm/src/db/Query.php @@ -13,7 +13,6 @@ declare (strict_types = 1); namespace think\db; use PDOStatement; -use think\helper\Str; /** * PDO数据查询类 diff --git a/vendor/topthink/think-orm/src/db/builder/Mysql.php b/vendor/topthink/think-orm/src/db/builder/Mysql.php index 136b0dee042a2ea2c47e2ec237f2c05492e1125d..d70fb90c4719f41688d9d9ffe7a9ddecb90105f1 100644 --- a/vendor/topthink/think-orm/src/db/builder/Mysql.php +++ b/vendor/topthink/think-orm/src/db/builder/Mysql.php @@ -101,7 +101,8 @@ class Mysql extends Builder $this->parseComment($query, $options['comment']), $this->parseForce($query, $options['force']), ], - $this->selectSql); + $this->selectSql + ); } /** @@ -136,7 +137,8 @@ class Mysql extends Builder $this->parseDuplicate($query, $options['duplicate']), $this->parseComment($query, $options['comment']), ], - $this->insertSql); + $this->insertSql + ); } /** @@ -190,7 +192,8 @@ class Mysql extends Builder $this->parseDuplicate($query, $options['duplicate']), $this->parseComment($query, $options['comment']), ], - $this->insertAllSql); + $this->insertAllSql + ); } /** @@ -208,9 +211,10 @@ class Mysql extends Builder if (empty($data)) { return ''; } + $set = []; foreach ($data as $key => $val) { - $set[] = $key . ' = ' . $val; + $set[] = (strpos($key, '->') ? strstr($key, '->', true) : $key) . ' = ' . $val; } return str_replace( @@ -227,7 +231,8 @@ class Mysql extends Builder $this->parseLock($query, $options['lock']), $this->parseComment($query, $options['comment']), ], - $this->updateSql); + $this->updateSql + ); } /** @@ -254,7 +259,8 @@ class Mysql extends Builder $this->parseLock($query, $options['lock']), $this->parseComment($query, $options['comment']), ], - $this->deleteSql); + $this->deleteSql + ); } /** diff --git a/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php b/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php index c33d1ed2fbe7cbb2cff6965d3a5a584fbb417b5c..28289497b659feb51511c5d3abb94f6dae58fdb2 100644 --- a/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php +++ b/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php @@ -13,7 +13,6 @@ declare (strict_types = 1); namespace think\db\concern; use think\db\Raw; -use think\helper\Str; /** * JOIN和VIEW查询 diff --git a/vendor/topthink/think-orm/src/db/concern/ParamsBind.php b/vendor/topthink/think-orm/src/db/concern/ParamsBind.php index 296e2212dd1134fd8ea39d2b1e525afb99900771..88293fa86db3722e5c5345c59d7f0c149f8b0738 100644 --- a/vendor/topthink/think-orm/src/db/concern/ParamsBind.php +++ b/vendor/topthink/think-orm/src/db/concern/ParamsBind.php @@ -64,6 +64,33 @@ trait ParamsBind return isset($this->bind[$key]); } + /** + * 设置自动参数绑定 + * @access public + * @param bool $bind 是否自动参数绑定 + * @return $this + */ + public function autoBind(bool $bind) + { + $this->options['auto_bind'] = $bind; + return $this; + } + + /** + * 检测是否开启自动参数绑定 + * @access public + * @return bool + */ + public function isAutoBind(): bool + { + $autoBind = $this->getConfig('auto_param_bind'); + if (null !== $this->getOptions('auto_bind')) { + $autoBind = $this->getOptions('auto_bind'); + } + + return (bool) $autoBind; + } + /** * 参数绑定 * @access public diff --git a/vendor/topthink/think-orm/src/db/connector/Sqlsrv.php b/vendor/topthink/think-orm/src/db/connector/Sqlsrv.php index aee3343c93614db26623f340e4a1fd6bfd032a5f..835605d2ea284aefd6229dbf79402edc19a9aeb3 100644 --- a/vendor/topthink/think-orm/src/db/connector/Sqlsrv.php +++ b/vendor/topthink/think-orm/src/db/connector/Sqlsrv.php @@ -60,7 +60,7 @@ class Sqlsrv extends PDOConnection public function getFields(string $tableName): array { [$tableName] = explode(' ', $tableName); - strpos($tableName,'.') && $tableName = substr($tableName,strpos($tableName,'.') + 1); + strpos($tableName, '.') && $tableName = substr($tableName, strpos($tableName, '.') + 1); $sql = "SELECT column_name, data_type, column_default, is_nullable FROM information_schema.tables AS t JOIN information_schema.columns AS c diff --git a/vendor/topthink/think-orm/src/model/Relation.php b/vendor/topthink/think-orm/src/model/Relation.php index 3aa22be0a82c37f3d246131c14b1bba2ae986f3f..7bb6d9ff65e7a0a45b97673bfedb30555461c0a8 100644 --- a/vendor/topthink/think-orm/src/model/Relation.php +++ b/vendor/topthink/think-orm/src/model/Relation.php @@ -67,12 +67,6 @@ abstract class Relation */ protected $selfRelation = false; - /** - * 关联数据数量限制 - * @var int - */ - protected $withLimit; - /** * 关联数据字段限制 * @var array @@ -200,18 +194,6 @@ abstract class Relation } } - /** - * 限制关联数据的数量 - * @access public - * @param int $limit 关联数量限制 - * @return $this - */ - public function withLimit(int $limit) - { - $this->withLimit = $limit; - return $this; - } - /** * 限制关联数据的字段 * @access public @@ -244,6 +226,18 @@ abstract class Relation return $this; } + /** + * 限制关联数据的数量 + * @access public + * @param int $limit 关联数量限制 + * @return $this + */ + public function withLimit(int $limit) + { + $this->query->limit($limit); + return $this; + } + /** * 设置关联数据不存在的时候默认值 * @access public @@ -281,14 +275,15 @@ abstract class Relation * @access protected * @return mixed */ - protected function getClosureType(Closure $closure) + protected function getClosureType(Closure $closure, $query = null) { $reflect = new ReflectionFunction($closure); $params = $reflect->getParameters(); if (!empty($params)) { - $type = $params[0]->getType(); - return is_null($type) || Relation::class == $type->getName() ? $this : $this->query; + $type = $params[0]->getType(); + $query = $query ?: $this->query; + return is_null($type) || Relation::class == $type->getName() ? $this : $query; } return $this; diff --git a/vendor/topthink/think-orm/src/model/concern/Attribute.php b/vendor/topthink/think-orm/src/model/concern/Attribute.php index b14d25a898ec6acd1fa3014224eff977035ce9dd..4359a4c38a9b86c7a94c7235e301ea5977be527c 100644 --- a/vendor/topthink/think-orm/src/model/concern/Attribute.php +++ b/vendor/topthink/think-orm/src/model/concern/Attribute.php @@ -15,7 +15,6 @@ namespace think\model\concern; use InvalidArgumentException; use think\db\Raw; use think\helper\Str; -use think\Model; use think\model\Relation; /** @@ -383,6 +382,8 @@ trait Attribute } elseif (isset($this->type[$name])) { // 类型转换 $value = $this->writeTransform($value, $this->type[$name]); + } elseif ($this->isRelationAttr($name)) { + $this->relation[$name] = $value; } elseif ((array_key_exists($name, $this->origin) || empty($this->origin)) && is_object($value) && method_exists($value, '__toString')) { // 对象类型 $value = $value->__toString(); @@ -446,6 +447,7 @@ trait Attribute break; case 'array': $value = (array) $value; + // no break case 'json': $option = !empty($param) ? (int) $param : JSON_UNESCAPED_UNICODE; $value = json_encode($value, $option); diff --git a/vendor/topthink/think-orm/src/model/concern/Conversion.php b/vendor/topthink/think-orm/src/model/concern/Conversion.php index b584ba91ae3de5574dffad135d415171b9a2b79f..72bf4942731399047493480a258037521b913765 100644 --- a/vendor/topthink/think-orm/src/model/concern/Conversion.php +++ b/vendor/topthink/think-orm/src/model/concern/Conversion.php @@ -241,7 +241,7 @@ trait Conversion if (isset($this->visible[$key]) && is_array($this->visible[$key])) { $val->visible($this->visible[$key]); } elseif (isset($this->hidden[$key]) && is_array($this->hidden[$key])) { - $val->hidden($this->hidden[$key]); + $val->hidden($this->hidden[$key], true); } // 关联模型对象 if (!isset($this->hidden[$key]) || true !== $this->hidden[$key]) { diff --git a/vendor/topthink/think-orm/src/model/concern/RelationShip.php b/vendor/topthink/think-orm/src/model/concern/RelationShip.php index 8faadf4768e9ab81bcb48e1b6af46d248874f800..8e0d498e64fc419a236c3e77874f96cf9b47aa3b 100644 --- a/vendor/topthink/think-orm/src/model/concern/RelationShip.php +++ b/vendor/topthink/think-orm/src/model/concern/RelationShip.php @@ -346,7 +346,7 @@ trait RelationShip */ public function bindAttr(string $relation, array $attrs = []) { - $relation = $this->getRelation($relation); + $relation = $this->getRelation($relation, true); foreach ($attrs as $key => $attr) { $key = is_numeric($key) ? $attr : $key; diff --git a/vendor/topthink/think-orm/src/model/concern/TimeStamp.php b/vendor/topthink/think-orm/src/model/concern/TimeStamp.php index 2492e0661d56bded1ff7db3e9e692cfe68b284ab..9440c3e6b6897606f2eed65ce204a1059780be9d 100644 --- a/vendor/topthink/think-orm/src/model/concern/TimeStamp.php +++ b/vendor/topthink/think-orm/src/model/concern/TimeStamp.php @@ -179,7 +179,7 @@ trait TimeStamp protected function formatDateTime($format, $time = 'now', bool $timestamp = false) { if (empty($time)) { - return; + return $time; } if (false === $format) { diff --git a/vendor/topthink/think-orm/src/model/relation/BelongsTo.php b/vendor/topthink/think-orm/src/model/relation/BelongsTo.php index 741a2e8d4874a82c43810713943f698a88f0a91a..dfac2547d4c3a098a181cd442784cec2c513d3f0 100644 --- a/vendor/topthink/think-orm/src/model/relation/BelongsTo.php +++ b/vendor/topthink/think-orm/src/model/relation/BelongsTo.php @@ -14,7 +14,6 @@ namespace think\model\relation; use Closure; use think\db\BaseQuery as Query; -use think\helper\Str; use think\Model; /** diff --git a/vendor/topthink/think-orm/src/model/relation/BelongsToMany.php b/vendor/topthink/think-orm/src/model/relation/BelongsToMany.php index 6049f0125c2996104b66beff36a54b13342bef1d..8c74f34d31cc68950324a49a0f9eca4831aa1dc1 100644 --- a/vendor/topthink/think-orm/src/model/relation/BelongsToMany.php +++ b/vendor/topthink/think-orm/src/model/relation/BelongsToMany.php @@ -346,6 +346,11 @@ class BelongsToMany extends Relation $closure($this->getClosureType($closure)); } + $withLimit = $this->query->getOptions('limit'); + if ($withLimit) { + $this->query->removeOption('limit'); + } + // 预载入关联查询 支持嵌套预载入 $list = $this->belongsToManyQuery($this->foreignKey, $this->localKey, $where) ->with($subRelation) @@ -353,12 +358,12 @@ class BelongsToMany extends Relation ->select(); // 组装模型数据 - $data = []; + $data = []; foreach ($list as $set) { $pivot = $this->matchPivot($set); $key = $pivot[$this->localKey]; - if ($this->withLimit && isset($data[$key]) && count($data[$key]) >= $this->withLimit) { + if ($withLimit && isset($data[$key]) && count($data[$key]) >= $withLimit) { continue; } @@ -389,10 +394,6 @@ class BelongsToMany extends Relation $fields = $this->getQueryFields($tableName); - if ($this->withLimit) { - $this->query->limit($this->withLimit); - } - $this->query ->field($fields) ->tableField(true, $table, 'pivot', 'pivot__') diff --git a/vendor/topthink/think-orm/src/model/relation/HasMany.php b/vendor/topthink/think-orm/src/model/relation/HasMany.php index 77d9e4d5eb99e565ddaa05ee6257c3a99c499de7..46249555e9f4ba67fc9b6b0854893b70acac835f 100644 --- a/vendor/topthink/think-orm/src/model/relation/HasMany.php +++ b/vendor/topthink/think-orm/src/model/relation/HasMany.php @@ -15,7 +15,6 @@ namespace think\model\relation; use Closure; use think\Collection; use think\db\BaseQuery as Query; -use think\helper\Str; use think\Model; use think\model\Relation; @@ -58,10 +57,6 @@ class HasMany extends Relation $closure($this->getClosureType($closure)); } - if ($this->withLimit) { - $this->query->limit($this->withLimit); - } - return $this->query ->where($this->foreignKey, $this->parent->{$this->localKey}) ->relation($subRelation) @@ -210,6 +205,11 @@ class HasMany extends Relation $this->query->withoutField($this->withoutField); } + $withLimit = $this->query->getOptions('limit'); + if ($withLimit) { + $this->query->removeOption('limit'); + } + $list = $this->query ->where($where) ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) @@ -217,12 +217,12 @@ class HasMany extends Relation ->select(); // 组装模型数据 - $data = []; - + $data = []; + foreach ($list as $set) { $key = $set->$foreignKey; - if ($this->withLimit && isset($data[$key]) && count($data[$key]) >= $this->withLimit) { + if ($withLimit && isset($data[$key]) && count($data[$key]) >= $withLimit) { continue; } @@ -241,6 +241,10 @@ class HasMany extends Relation */ public function save($data, bool $replace = true) { + if ($data instanceof Model) { + $data = $data->getData(); + } + $model = $this->make(); return $model->replace($replace)->save($data) ? $model : false; diff --git a/vendor/topthink/think-orm/src/model/relation/HasManyThrough.php b/vendor/topthink/think-orm/src/model/relation/HasManyThrough.php index fc620264b58a682e0f79e81d0ed32af25ad52e82..4f143993a59c86f0df0d293fb4c609376dcc5cf6 100644 --- a/vendor/topthink/think-orm/src/model/relation/HasManyThrough.php +++ b/vendor/topthink/think-orm/src/model/relation/HasManyThrough.php @@ -79,10 +79,6 @@ class HasManyThrough extends Relation $this->baseQuery(); - if ($this->withLimit) { - $this->query->limit($this->withLimit); - } - return $this->query->relation($subRelation) ->select() ->setParent(clone $this->parent); @@ -264,19 +260,24 @@ class HasManyThrough extends Relation $throughKey = Str::snake(class_basename($this->model)) . "." . $this->throughKey; } + $withLimit = $this->query->getOptions('limit'); + if ($withLimit) { + $this->query->removeOption('limit'); + } + $list = $this->query ->where($throughKey, 'in', $keys) ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) ->select(); // 组装模型数据 - $data = []; - $keys = $throughList->column($this->foreignKey, $this->throughPk); + $data = []; + $keys = $throughList->column($this->foreignKey, $this->throughPk); foreach ($list as $set) { $key = $keys[$set->{$this->throughKey}]; - if ($this->withLimit && isset($data[$key]) && count($data[$key]) >= $this->withLimit) { + if ($withLimit && isset($data[$key]) && count($data[$key]) >= $withLimit) { continue; } diff --git a/vendor/topthink/think-orm/src/model/relation/HasOne.php b/vendor/topthink/think-orm/src/model/relation/HasOne.php index 5e5e50112782f45e657c59510978cb665951f6b7..b941f6ecf30e4ee48cd1dc90ef1ee9d291ed796d 100644 --- a/vendor/topthink/think-orm/src/model/relation/HasOne.php +++ b/vendor/topthink/think-orm/src/model/relation/HasOne.php @@ -14,7 +14,6 @@ namespace think\model\relation; use Closure; use think\db\BaseQuery as Query; -use think\helper\Str; use think\Model; /** diff --git a/vendor/topthink/think-orm/src/model/relation/HasOneThrough.php b/vendor/topthink/think-orm/src/model/relation/HasOneThrough.php index 0278533eedcffad3eb8778018759fb76f6944d0a..2734c13a0e203f22c44c945cec08236497e3363a 100644 --- a/vendor/topthink/think-orm/src/model/relation/HasOneThrough.php +++ b/vendor/topthink/think-orm/src/model/relation/HasOneThrough.php @@ -12,7 +12,6 @@ namespace think\model\relation; use Closure; -use think\helper\Str; use think\Model; /** diff --git a/vendor/topthink/think-orm/src/model/relation/MorphMany.php b/vendor/topthink/think-orm/src/model/relation/MorphMany.php index 39209ae68adc0fe88d91d3b571fa410a0579eb71..ed0dd40aacd80c27a2b6cd4b3ce635625cc65e8b 100644 --- a/vendor/topthink/think-orm/src/model/relation/MorphMany.php +++ b/vendor/topthink/think-orm/src/model/relation/MorphMany.php @@ -15,7 +15,6 @@ use Closure; use think\Collection; use think\db\BaseQuery as Query; use think\db\exception\DbException as Exception; -use think\helper\Str; use think\Model; use think\model\Relation; @@ -77,10 +76,6 @@ class MorphMany extends Relation $this->baseQuery(); - if ($this->withLimit) { - $this->query->limit($this->withLimit); - } - return $this->query->relation($subRelation) ->select() ->setParent(clone $this->parent); @@ -258,6 +253,11 @@ class MorphMany extends Relation $closure($this->getClosureType($closure)); } + $withLimit = $this->query->getOptions('limit'); + if ($withLimit) { + $this->query->removeOption('limit'); + } + $list = $this->query ->where($where) ->with($subRelation) @@ -266,11 +266,11 @@ class MorphMany extends Relation $morphKey = $this->morphKey; // 组装模型数据 - $data = []; + $data = []; foreach ($list as $set) { $key = $set->$morphKey; - if ($this->withLimit && isset($data[$key]) && count($data[$key]) >= $this->withLimit) { + if ($withLimit && isset($data[$key]) && count($data[$key]) >= $withLimit) { continue; } @@ -289,6 +289,10 @@ class MorphMany extends Relation */ public function save($data, bool $replace = true) { + if ($data instanceof Model) { + $data = $data->getData(); + } + $model = $this->make(); return $model->replace($replace)->save($data) ? $model : false; diff --git a/vendor/topthink/think-orm/src/model/relation/MorphOne.php b/vendor/topthink/think-orm/src/model/relation/MorphOne.php index 788dd295556c8cad1aff0a5460f8cdf5a2ad7fe1..d63966ff0594de509a16a9639a0a328e93446259 100644 --- a/vendor/topthink/think-orm/src/model/relation/MorphOne.php +++ b/vendor/topthink/think-orm/src/model/relation/MorphOne.php @@ -14,7 +14,6 @@ namespace think\model\relation; use Closure; use think\db\BaseQuery as Query; use think\db\exception\DbException as Exception; -use think\helper\Str; use think\Model; use think\model\Relation; @@ -260,6 +259,10 @@ class MorphOne extends Relation */ public function save($data, bool $replace = true) { + if ($data instanceof Model) { + $data = $data->getData(); + } + $model = $this->make(); return $model->replace($replace)->save($data) ? $model : false; } diff --git a/vendor/topthink/think-orm/src/model/relation/MorphTo.php b/vendor/topthink/think-orm/src/model/relation/MorphTo.php index 74b16c2775daac090effe4c365274cdf465fb29c..d24c08262d9292b08ec969220bd881aafe25850a 100644 --- a/vendor/topthink/think-orm/src/model/relation/MorphTo.php +++ b/vendor/topthink/think-orm/src/model/relation/MorphTo.php @@ -144,8 +144,9 @@ class MorphTo extends Relation foreach ($types as $type) { if ($type) { $query->whereExists(function (Query $query) use ($type, $where, $alias) { + $class = $this->parseModel($type); /** @var Model $model */ - $model = new ($this->parseModel($type)); + $model = new $class(); $table = $model->getTable(); $query @@ -309,11 +310,11 @@ class MorphTo extends Relation protected function eagerlyMorphToOne(string $model, string $relation, Model $result, array $subRelation = [], array $cache = []): void { // 预载入关联查询 支持嵌套预载入 - $pk = $this->parent->{$this->morphKey}; + $pk = $this->parent->{$this->morphKey}; $data = null; - if(\class_exists($model)){ + if (\class_exists($model)) { $data = (new $model)->with($subRelation) ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) ->find($pk); diff --git a/vendor/topthink/think-orm/src/model/relation/MorphToMany.php b/vendor/topthink/think-orm/src/model/relation/MorphToMany.php index c566488749cd18534509d25ee1993c6b2bca9d7e..c9d8583d883da1e48e0fc19efc8ddb71b74176c4 100644 --- a/vendor/topthink/think-orm/src/model/relation/MorphToMany.php +++ b/vendor/topthink/think-orm/src/model/relation/MorphToMany.php @@ -216,12 +216,7 @@ class MorphToMany extends BelongsToMany } $fields = $this->getQueryFields($tableName); - - if ($this->withLimit) { - $this->query->limit($this->withLimit); - } - - $query = $this->query + $query = $this->query ->field($fields) ->tableField(true, $table, 'pivot', 'pivot__'); @@ -249,6 +244,11 @@ class MorphToMany extends BelongsToMany $closure($this->getClosureType($closure)); } + $withLimit = $this->query->getOptions('limit'); + if ($withLimit) { + $this->query->removeOption('limit'); + } + // 预载入关联查询 支持嵌套预载入 $list = $this->belongsToManyQuery($this->foreignKey, $this->localKey, $where) ->with($subRelation) @@ -256,7 +256,7 @@ class MorphToMany extends BelongsToMany ->select(); // 组装模型数据 - $data = []; + $data = []; foreach ($list as $set) { $pivot = []; foreach ($set->getData() as $key => $val) { @@ -271,7 +271,7 @@ class MorphToMany extends BelongsToMany $key = $pivot[$this->localKey]; - if ($this->withLimit && isset($data[$key]) && count($data[$key]) >= $this->withLimit) { + if ($withLimit && isset($data[$key]) && count($data[$key]) >= $withLimit) { continue; } @@ -300,10 +300,10 @@ class MorphToMany extends BelongsToMany $model = new $this->model; $id = $model->insertGetId($data); } - } else if (is_numeric($data) || is_string($data)) { + } elseif (is_numeric($data) || is_string($data)) { // 根据关联表主键直接写入中间表 $id = $data; - } else if ($data instanceof Model) { + } elseif ($data instanceof Model) { // 根据关联表主键直接写入中间表 $id = $data->getKey(); } @@ -371,10 +371,10 @@ class MorphToMany extends BelongsToMany { if (is_array($data)) { $id = $data; - } else if (is_numeric($data) || is_string($data)) { + } elseif (is_numeric($data) || is_string($data)) { // 根据关联表主键直接写入中间表 $id = $data; - } else if ($data instanceof Model) { + } elseif ($data instanceof Model) { // 根据关联表主键直接写入中间表 $id = $data->getKey(); } @@ -441,7 +441,7 @@ class MorphToMany extends BelongsToMany if (!in_array($id, $current)) { $this->attach($id, $attributes); $changes['attached'][] = $id; - } else if (count($attributes) > 0 && $this->attach($id, $attributes)) { + } elseif (count($attributes) > 0 && $this->attach($id, $attributes)) { $changes['updated'][] = $id; } } @@ -481,7 +481,7 @@ class MorphToMany extends BelongsToMany { if (is_array($map)) { static::$morphMap = $merge && static::$morphMap - ? $map + static::$morphMap : $map; + ? $map + static::$morphMap : $map; } return static::$morphMap; diff --git a/vendor/topthink/think-orm/src/model/relation/OneToOne.php b/vendor/topthink/think-orm/src/model/relation/OneToOne.php index ba51753d43da9abd5d504ddf74af32d546f09356..d62692aae271f3cd22635aa532af122c5fb7ce3c 100644 --- a/vendor/topthink/think-orm/src/model/relation/OneToOne.php +++ b/vendor/topthink/think-orm/src/model/relation/OneToOne.php @@ -91,14 +91,28 @@ abstract class OneToOne extends Relation $query->via($joinAlias); if ($this instanceof BelongsTo) { - $joinOn = $name . '.' . $this->foreignKey . '=' . $joinAlias . '.' . $this->localKey; + + $foreignKeyExp = $this->foreignKey; + + if (strpos($foreignKeyExp, '.') === false) { + $foreignKeyExp = $name . '.' . $this->foreignKey; + } + + $joinOn = $foreignKeyExp . '=' . $joinAlias . '.' . $this->localKey; } else { - $joinOn = $name . '.' . $this->localKey . '=' . $joinAlias . '.' . $this->foreignKey; + + $foreignKeyExp = $this->foreignKey; + + if (strpos($foreignKeyExp, '.') === false) { + $foreignKeyExp = $joinAlias . '.' . $this->foreignKey; + } + + $joinOn = $name . '.' . $this->localKey . '=' . $foreignKeyExp; } if ($closure) { // 执行闭包查询 - $closure($this->getClosureType($closure)); + $closure($this->getClosureType($closure, $query)); // 使用withField指定获取关联的字段 if ($this->withField) { @@ -187,6 +201,10 @@ abstract class OneToOne extends Relation */ public function save($data, bool $replace = true) { + if ($data instanceof Model) { + $data = $data->getData(); + } + $model = $this->make(); return $model->replace($replace)->save($data) ? $model : false; @@ -209,7 +227,6 @@ abstract class OneToOne extends Relation return new $this->model($data); } - /** * 绑定关联表的属性到父模型属性 * @access public diff --git a/vendor/topthink/think-orm/stubs/load_stubs.php b/vendor/topthink/think-orm/stubs/load_stubs.php index 5854cda569c4356b0c64058a3d331aed7ea08ce5..734507eb14066b47f09bdd9d62debda4414e330b 100644 --- a/vendor/topthink/think-orm/stubs/load_stubs.php +++ b/vendor/topthink/think-orm/stubs/load_stubs.php @@ -6,4 +6,4 @@ if (!\class_exists('think\Exception')) { if (!\class_exists('think\Facade')) { require __DIR__ . '/Facade.php'; -} \ No newline at end of file +} diff --git a/vendor/topthink/think-trace/composer.json b/vendor/topthink/think-trace/composer.json index 172a2d3c6586df9ef5d64014a025b1d509f394f6..e6cd16b1657e380d6024628b6c1b16bf11579fff 100644 --- a/vendor/topthink/think-trace/composer.json +++ b/vendor/topthink/think-trace/composer.json @@ -10,7 +10,7 @@ ], "require": { "php": ">=7.1.0", - "topthink/framework": "^6.0" + "topthink/framework": "^6.0|^8.0" }, "autoload": { "psr-4": { diff --git a/version b/version index 089b1e69f990cf36187840276781c3f456f9f840..4b786f5755cfff8ae335e4adc5e9ce33360ecf86 100644 --- a/version +++ b/version @@ -1 +1 @@ -6.0.7 +6.0.8
      \$spacer \$name\$spacer \$name \$app/\$controller/\$action