fix nullsafe warning

This commit is contained in:
Jean-Christian Denis 2023-04-24 15:48:48 +02:00
parent 9c2f78d1d6
commit d97165e427
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -10,7 +10,7 @@
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) {
return null;
}
@ -22,7 +22,7 @@ $this->registerModule(
[
'requires' => [['core', '2.24']],
'permissions' => dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_USAGE,
dcCore::app()->auth::PERMISSION_USAGE,
]),
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
@ -37,8 +37,8 @@ if (!function_exists('\_mail')) {
$headers = is_array($headers) ? implode("\n\t", $headers) : (string) $headers;
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME);
$cur->log_table = basename(__DIR__);
$cur->log_msg = sprintf("%s\n-----\n To: %s\n Subject: %s\n-----\n Message:\n%s\n", $headers, $to, $subject, $message);
$cur->setField('log_table', basename(__DIR__));
$cur->setField('log_msg', sprintf("%s\n-----\n To: %s\n Subject: %s\n-----\n Message:\n%s\n", $headers, $to, $subject, $message));
dcCore::app()->log->addLog($cur);
return true;