update to laravel 9

This commit is contained in:
xiaomlove
2022-03-31 22:22:04 +08:00
parent 09350c06e2
commit 5f6b3ceb53
30 changed files with 3420 additions and 2517 deletions

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.6.5');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-03-30');
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.0');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-03-31');
defined('IN_TRACKER') || define('IN_TRACKER', true);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
@@ -15,30 +15,3 @@ if (!defined('RUNNING_IN_OCTANE')) {
define('RUNNING_IN_OCTANE', false);
}
}
//defined('CURRENT_SCRIPT') || define('CURRENT_SCRIPT', strstr(basename($_SERVER['SCRIPT_FILENAME']), '.', true));
//defined('IS_ANNOUNCE') || define('IS_ANNOUNCE', CURRENT_SCRIPT == 'announce');
//
//defined('PLATFORM_ADMIN') || define('PLATFORM_ADMIN', 'admin');
//defined('PLATFORM_USER') || define('PLATFORM_USER', 'user');
//defined('PLATFORMS') || define('PLATFORMS', [PLATFORM_ADMIN, PLATFORM_USER]);
//defined('CURRENT_PLATFORM') || define('CURRENT_PLATFORM', $_SERVER['HTTP_PLATFORM'] ?? '');
//defined('IS_PLATFORM_ADMIN') || define('IS_PLATFORM_ADMIN', CURRENT_PLATFORM == PLATFORM_ADMIN);
//defined('IS_PLATFORM_USER') || define('IS_PLATFORM_USER', CURRENT_PLATFORM == PLATFORM_USER);
//
//
////define the REQUEST_ID
//if (!defined('REQUEST_ID')) {
// if (!empty($_SERVER['HTTP_X_REQUEST_ID'])) {
// $requestId = $_SERVER['HTTP_X_REQUEST_ID'];
// } elseif (!empty($_SERVER['REQUEST_ID'])) {
// $requestId = $_SERVER['REQUEST_ID'];
// } else {
// $prefix = ($_SERVER['SCRIPT_FILENAME'] ?? '') . implode('', $_SERVER['argv'] ?? []);
// $prefix = substr(md5($prefix), 0, 4);
// // 4 + 23 = 27 characters, after replace '.', 26
// $requestId = str_replace('.', '', uniqid($prefix, true));
// $requestId .= bin2hex(random_bytes(3));
// }
// define('REQUEST_ID', $requestId);
//}

View File

@@ -1413,44 +1413,17 @@ function sent_mail($to,$fromname,$fromemail,$subject,$body,$type = "confirmation
*/
/**
* use swiftmailer instead
* use Symfony Mailer instead
*
* @since 1.6
* @since 1.7
* @author xiaomlove<1939737565@qq.com>
*/
$setting = get_setting('smtp');
// Create the Transport
$encryption = null;
if (isset($setting['encryption']) && in_array($setting['encryption'], ['ssl', 'tls'])) {
$encryption = $setting['encryption'];
}
$transport = (new Swift_SmtpTransport($setting['smtpaddress'], $setting['smtpport'], $encryption))
->setUsername($setting['accountname'])
->setPassword($setting['accountpassword'])
;
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
// Create a message
$message = (new Swift_Message($subject))
->setFrom($fromemail, $fromname)
->setTo([$to])
->setBody($body, 'text/html')
;
// Send the message
try {
$result = $mailer->send($message);
if ($result == 0) {
stderr($lang_functions['std_error'], $lang_functions['text_unable_to_send_mail']);
}
} catch (\Exception $e) {
do_log("send email fail: " . $e->getMessage() . ", trace: " . $e->getTraceAsString());
$toolRep = new \App\Repositories\ToolRepository();
$sendResult = $toolRep->sendMail($to, $subject, $body);
if ($sendResult === false) {
stderr($lang_functions['std_error'], $lang_functions['text_unable_to_send_mail']);
}
}
if ($showmsg) {
if ($type == "confirmation")