diff --git a/plugins/yetiforce/yetiforce.php b/plugins/yetiforce/yetiforce.php index 2bdcf3e1..f0ac3301 100644 --- a/plugins/yetiforce/yetiforce.php +++ b/plugins/yetiforce/yetiforce.php @@ -95,94 +95,94 @@ public function init() $this->include_stylesheet('../../../../../libraries/@fortawesome/fontawesome-free/css/all.css'); $currentPath = getcwd(); chdir($this->rc->config->get('root_directory')); - $this->loadCurrentUser(); - - $this->rc->load_language(null, [ - 'LBL_FILE_FROM_CRM' => \App\Language::translate('LBL_FILE_FROM_CRM', 'OSSMail', false, false), - 'LBL_MAIL_TEMPLATES' => \App\Language::translate('LBL_MAIL_TEMPLATES', 'OSSMail', false, false), - 'LBL_TEMPLATES' => \App\Language::translate('LBL_TEMPLATES', 'OSSMail', false, false), - 'BTN_BLACK_LIST' => \App\Language::translate('LBL_BLACK_LIST', 'OSSMail', false, false), - 'LBL_BLACK_LIST_DESC' => \App\Language::translate('LBL_BLACK_LIST_DESC', 'OSSMail', false, false), - 'BTN_WHITE_LIST' => \App\Language::translate('LBL_WHITE_LIST', 'OSSMail', false, false), - 'LBL_WHITE_LIST_DESC' => \App\Language::translate('LBL_WHITE_LIST_DESC', 'OSSMail', false, false), - 'LBL_ALERT_NEUTRAL_LIST' => \App\Language::translate('LBL_ALERT_NEUTRAL_LIST', 'OSSMail', false, false), - 'LBL_ALERT_BLACK_LIST' => \App\Language::translate('LBL_BLACK_LIST_ALERT', 'OSSMail', false, false), - 'LBL_ALERT_WHITE_LIST' => \App\Language::translate('LBL_WHITE_LIST_ALERT', 'OSSMail', false, false), - 'LBL_ALERT_FAKE_MAIL' => \App\Language::translate('LBL_ALERT_FAKE_MAIL', 'OSSMail'), - 'BTN_ANALYSIS_DETAILS' => \App\Language::translate('BTN_ANALYSIS_DETAILS', 'OSSMail', false, false), - 'LBL_ALERT_FAKE_SENDER' => \App\Language::translate('LBL_ALERT_FAKE_SENDER', 'OSSMail'), - ]); - - if ('preview' === $this->rc->action || 'show' === $this->rc->action || '' == $this->rc->action) { - $this->include_script('preview.js'); - $this->include_stylesheet('preview.css'); - - $this->add_hook('template_object_messageattachments', [$this, 'appendIcsPreview']); - if (\App\Config::component('Mail', 'rcDetailCheckRbl', false)) { - $this->add_hook('template_object_messagesummary', [$this, 'messageSummary']); - } - $this->add_hook('message_load', [$this, 'message_load']); - - $this->add_button([ - 'command' => 'plugin.yetiforce.addSenderToList', - 'type' => 'link', - 'prop' => 1, - 'class' => 'button yfi-fa-check-circle disabled js-white-list-btn text-success', - 'classact' => 'button yfi-fa-check-circle text-success', - 'classsel' => 'button yfi-fa-check-circle pressed text-success', - 'title' => 'LBL_WHITE_LIST_DESC', - 'label' => 'BTN_WHITE_LIST', - 'innerclass' => 'inner', - ], 'toolbar'); - $this->add_button([ - 'command' => 'plugin.yetiforce.addSenderToList', - 'type' => 'link', - 'prop' => 0, - 'class' => 'button yfi-fa-ban disabled text-danger', - 'classact' => 'button yfi-fa-ban text-danger', - 'classsel' => 'button yfi-fa-ban pressed text-danger', - 'title' => 'LBL_BLACK_LIST_DESC', - 'label' => 'BTN_BLACK_LIST', - 'innerclass' => 'inner', - ], 'toolbar'); - $this->add_button([ - 'command' => 'plugin.yetiforce.loadMailAnalysis', - 'type' => 'link', - 'class' => 'button yfi-fa-book-reader disabled text-info', - 'classact' => 'button yfi-fa-book-reader text-info', - 'classsel' => 'button yfi-fa-book-reader pressed text-info', - 'title' => 'BTN_ANALYSIS_DETAILS', - 'label' => 'BTN_ANALYSIS_DETAILS', - 'innerclass' => 'inner', - ], 'toolbar'); - } elseif ('compose' === $this->rc->action) { - $this->include_script('compose.js'); - $composeAddressModules = []; - foreach (\App\Config::component('Mail', 'RC_COMPOSE_ADDRESS_MODULES') as $moduleName) { - if (\App\Privilege::isPermitted($moduleName)) { - $composeAddressModules[$moduleName] = \App\Language::translate($moduleName, $moduleName); + if ($this->loadCurrentUser()) { + $this->rc->load_language(null, [ + 'LBL_FILE_FROM_CRM' => \App\Language::translate('LBL_FILE_FROM_CRM', 'OSSMail', false, false), + 'LBL_MAIL_TEMPLATES' => \App\Language::translate('LBL_MAIL_TEMPLATES', 'OSSMail', false, false), + 'LBL_TEMPLATES' => \App\Language::translate('LBL_TEMPLATES', 'OSSMail', false, false), + 'BTN_BLACK_LIST' => \App\Language::translate('LBL_BLACK_LIST', 'OSSMail', false, false), + 'LBL_BLACK_LIST_DESC' => \App\Language::translate('LBL_BLACK_LIST_DESC', 'OSSMail', false, false), + 'BTN_WHITE_LIST' => \App\Language::translate('LBL_WHITE_LIST', 'OSSMail', false, false), + 'LBL_WHITE_LIST_DESC' => \App\Language::translate('LBL_WHITE_LIST_DESC', 'OSSMail', false, false), + 'LBL_ALERT_NEUTRAL_LIST' => \App\Language::translate('LBL_ALERT_NEUTRAL_LIST', 'OSSMail', false, false), + 'LBL_ALERT_BLACK_LIST' => \App\Language::translate('LBL_BLACK_LIST_ALERT', 'OSSMail', false, false), + 'LBL_ALERT_WHITE_LIST' => \App\Language::translate('LBL_WHITE_LIST_ALERT', 'OSSMail', false, false), + 'LBL_ALERT_FAKE_MAIL' => \App\Language::translate('LBL_ALERT_FAKE_MAIL', 'OSSMail'), + 'BTN_ANALYSIS_DETAILS' => \App\Language::translate('BTN_ANALYSIS_DETAILS', 'OSSMail', false, false), + 'LBL_ALERT_FAKE_SENDER' => \App\Language::translate('LBL_ALERT_FAKE_SENDER', 'OSSMail'), + ]); + + if ('preview' === $this->rc->action || 'show' === $this->rc->action || '' == $this->rc->action) { + $this->include_script('preview.js'); + $this->include_stylesheet('preview.css'); + + $this->add_hook('template_object_messageattachments', [$this, 'appendIcsPreview']); + if (\App\Config::component('Mail', 'rcDetailCheckRbl', false)) { + $this->add_hook('template_object_messagesummary', [$this, 'messageSummary']); } - } - $this->viewData['compose']['composeAddressModules'] = $composeAddressModules; - $this->rc->output->set_env('yf_isPermittedMailTemplates', \App\Privilege::isPermitted('EmailTemplates')); + $this->add_hook('message_load', [$this, 'message_load']); + + $this->add_button([ + 'command' => 'plugin.yetiforce.addSenderToList', + 'type' => 'link', + 'prop' => 1, + 'class' => 'button yfi-fa-check-circle disabled js-white-list-btn text-success', + 'classact' => 'button yfi-fa-check-circle text-success', + 'classsel' => 'button yfi-fa-check-circle pressed text-success', + 'title' => 'LBL_WHITE_LIST_DESC', + 'label' => 'BTN_WHITE_LIST', + 'innerclass' => 'inner', + ], 'toolbar'); + $this->add_button([ + 'command' => 'plugin.yetiforce.addSenderToList', + 'type' => 'link', + 'prop' => 0, + 'class' => 'button yfi-fa-ban disabled text-danger', + 'classact' => 'button yfi-fa-ban text-danger', + 'classsel' => 'button yfi-fa-ban pressed text-danger', + 'title' => 'LBL_BLACK_LIST_DESC', + 'label' => 'BTN_BLACK_LIST', + 'innerclass' => 'inner', + ], 'toolbar'); + $this->add_button([ + 'command' => 'plugin.yetiforce.loadMailAnalysis', + 'type' => 'link', + 'class' => 'button yfi-fa-book-reader disabled text-info', + 'classact' => 'button yfi-fa-book-reader text-info', + 'classsel' => 'button yfi-fa-book-reader pressed text-info', + 'title' => 'BTN_ANALYSIS_DETAILS', + 'label' => 'BTN_ANALYSIS_DETAILS', + 'innerclass' => 'inner', + ], 'toolbar'); + } elseif ('compose' === $this->rc->action) { + $this->include_script('compose.js'); + $composeAddressModules = []; + foreach (\App\Config::component('Mail', 'RC_COMPOSE_ADDRESS_MODULES') as $moduleName) { + if (\App\Privilege::isPermitted($moduleName)) { + $composeAddressModules[$moduleName] = \App\Language::translate($moduleName, $moduleName); + } + } + $this->viewData['compose']['composeAddressModules'] = $composeAddressModules; + $this->rc->output->set_env('yf_isPermittedMailTemplates', \App\Privilege::isPermitted('EmailTemplates')); - $this->rc->output->add_handler('yetiforce.adressbutton', [$this, 'adressButton']); - $this->add_hook('identity_select', [$this, 'identity_select']); - $this->add_hook('render_page', [$this, 'loadSignature']); + $this->rc->output->add_handler('yetiforce.adressbutton', [$this, 'adressButton']); + $this->add_hook('identity_select', [$this, 'identity_select']); + $this->add_hook('render_page', [$this, 'loadSignature']); - $this->add_hook('message_compose_body', [$this, 'message_compose_body']); - $this->add_hook('message_compose', [$this, 'message_compose']); + $this->add_hook('message_compose_body', [$this, 'message_compose_body']); + $this->add_hook('message_compose', [$this, 'message_compose']); - if ($id = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC)) { - $id = App\Purifier::purifyByType($id, 'Alnum'); - if (isset($_SESSION['compose_data_' . $id]['param']['crmmodule'])) { - $this->rc->output->set_env('yf_crmModule', $_SESSION['compose_data_' . $id]['param']['crmmodule']); - } - if (isset($_SESSION['compose_data_' . $id]['param']['crmrecord'])) { - $this->rc->output->set_env('yf_crmRecord', $_SESSION['compose_data_' . $id]['param']['crmrecord']); - } - if (isset($_SESSION['compose_data_' . $id]['param']['crmview'])) { - $this->rc->output->set_env('yf_crmView', $_SESSION['compose_data_' . $id]['param']['crmview']); + if ($id = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC)) { + $id = App\Purifier::purifyByType($id, 'Alnum'); + if (isset($_SESSION['compose_data_' . $id]['param']['crmmodule'])) { + $this->rc->output->set_env('yf_crmModule', $_SESSION['compose_data_' . $id]['param']['crmmodule']); + } + if (isset($_SESSION['compose_data_' . $id]['param']['crmrecord'])) { + $this->rc->output->set_env('yf_crmRecord', $_SESSION['compose_data_' . $id]['param']['crmrecord']); + } + if (isset($_SESSION['compose_data_' . $id]['param']['crmview'])) { + $this->rc->output->set_env('yf_crmView', $_SESSION['compose_data_' . $id]['param']['crmview']); + } } } } @@ -433,12 +433,12 @@ public function message_compose(array $args): array if (!empty($params['recordNumber']) && !empty($params['crmmodule'])) { $currentPath = getcwd(); chdir($this->rc->config->get('root_directory')); - $this->loadCurrentUser(); - - $subjectNumber = \App\Mail\RecordFinder::getRecordNumberFromString($subject, $params['crmmodule']); - $recordNumber = \App\Mail\RecordFinder::getRecordNumberFromString("[{$params['recordNumber']}]", $params['crmmodule']); - if (false === $subject || (false !== $subject && $subjectNumber !== $recordNumber)) { - $subject = "[{$params['recordNumber']}] $subject"; + if ($this->loadCurrentUser()) { + $subjectNumber = \App\Mail\RecordFinder::getRecordNumberFromString($subject, $params['crmmodule']); + $recordNumber = \App\Mail\RecordFinder::getRecordNumberFromString("[{$params['recordNumber']}]", $params['crmmodule']); + if (false === $subject || (false !== $subject && $subjectNumber !== $recordNumber)) { + $subject = "[{$params['recordNumber']}] $subject"; + } } chdir($currentPath); } @@ -790,8 +790,9 @@ protected function parseVariables(string $text): string { $currentPath = getcwd(); chdir($this->rc->config->get('root_directory')); - $this->loadCurrentUser(); - $text = \App\TextParser::getInstance()->setContent($text)->parse()->getContent(); + if ($this->loadCurrentUser()) { + $text = \App\TextParser::getInstance()->setContent($text)->parse()->getContent(); + } chdir($currentPath); return $text; } @@ -806,6 +807,9 @@ protected function loadCurrentUser(): bool if (isset($this->currentUser)) { return true; } + if (empty($_SESSION['crm']['id'])) { + return false; + } require 'include/main/WebUI.php'; $this->currentUser = \App\User::getUserModel($_SESSION['crm']['id']); App\User::setCurrentUserId($_SESSION['crm']['id']); @@ -850,9 +854,8 @@ public function getContentEmailTemplate(): void $templateId = App\Purifier::purifyByType(rcube_utils::get_input_value('id', rcube_utils::INPUT_GPC), 'Integer'); $currentPath = getcwd(); chdir($this->rc->config->get('root_directory')); - $this->loadCurrentUser(); $mail = []; - if (\App\Privilege::isPermitted('EmailTemplates', 'DetailView', $templateId)) { + if ($this->loadCurrentUser() && \App\Privilege::isPermitted('EmailTemplates', 'DetailView', $templateId)) { $mail = \App\Mail::getTemplate($templateId); if ($recordId = rcube_utils::get_input_value('record_id', rcube_utils::INPUT_GPC)) { $textParser = \App\TextParser::getInstanceById( @@ -888,109 +891,110 @@ public function appendIcsPreview(array $args): array { $currentPath = getcwd(); chdir($this->rc->config->get('root_directory')); - $this->loadCurrentUser(); - $showPart = $ics = $counterBtn = $counterList = []; - foreach ($this->icsParts as $icsPart) { - $icsContent = $this->message->get_part_content($icsPart['part'], null, true); - $calendar = \App\Integrations\Dav\Calendar::loadFromContent($icsContent); - foreach ($calendar->getRecordInstance() as $key => $recordModel) { - if (!isset($ics[$key])) { - $ics[$key] = [$recordModel, $icsPart]; - if (isset($counterBtn[$icsPart['part']])) { - ++$counterBtn[$icsPart['part']]; - } else { - $counterBtn[$icsPart['part']] = 1; + if ($this->loadCurrentUser()) { + $showPart = $ics = $counterBtn = $counterList = []; + foreach ($this->icsParts as $icsPart) { + $icsContent = $this->message->get_part_content($icsPart['part'], null, true); + $calendar = \App\Integrations\Dav\Calendar::loadFromContent($icsContent); + foreach ($calendar->getRecordInstance() as $key => $recordModel) { + if (!isset($ics[$key])) { + $ics[$key] = [$recordModel, $icsPart]; + if (isset($counterBtn[$icsPart['part']])) { + ++$counterBtn[$icsPart['part']]; + } else { + $counterBtn[$icsPart['part']] = 1; + } } } } - } - $translationMod = 'Calendar'; - $showMore = false; - foreach ($ics as $data) { - $evTemplate = '
'; - [$record, $icsPart] = $data; - $dateStart = $fields = $fieldsDescription = ''; - if (!$record->isEmpty('date_start')) { - $dateStart = $record->getDisplayValue('date_start'); - $dateStartLabel = \App\Language::translate('LBL_START'); - $fields .= "
$dateStartLabel: $dateStart
"; - } - if (!$record->isEmpty('due_date')) { - $dueDate = $record->getDisplayValue('due_date'); - $dueDateLabel = \App\Language::translate('LBL_END'); - $fields .= "
$dueDateLabel: $dueDate
"; - } - if ($location = $record->getDisplayValue('location', false, false, 100)) { - $locationLabel = \App\Language::translate('Location', $translationMod); - $fields .= "
$locationLabel: $location
"; - } - if ($status = $record->getDisplayValue('activitystatus')) { - $statusLabel = \App\Language::translate('LBL_STATUS', $translationMod); - $fields .= "
$statusLabel: $status
"; - } - if ($type = $record->getDisplayValue('activitytype')) { - $typeLabel = \App\Language::translate('Activity Type', $translationMod); - $fields .= "
$typeLabel: $type
"; - } - if ($location = $record->getDisplayValue('meeting_url', false, false, 40)) { - $locationLabel = \App\Language::translate('FL_MEETING_URL', $translationMod); - $fields .= "
$locationLabel: $location
"; - } - if ($allday = $record->getDisplayValue('allday')) { - $alldayLabel = \App\Language::translate('All day', $translationMod); - $fields .= "
$alldayLabel: $allday
"; - } - if ($visibility = $record->getDisplayValue('visibility')) { - $visibilityLabel = \App\Language::translate('Visibility', $translationMod); - $fields .= "
$visibilityLabel: $visibility
"; - } - if ($priority = $record->getDisplayValue('taskpriority')) { - $label = \App\Language::translate('Priority', $translationMod); - $fields .= "
$label: $priority
"; - } - if ($description = $record->getDisplayValue('description', false, false, 50)) { - $descriptionLabel = \App\Language::translate('Description', $translationMod); - $fieldsDescription .= "
$descriptionLabel: $description
"; - } - $evTemplate .= "
-
-

{$record->getDisplayValue('subject')} | $dateStart

- -
-
-
- $fields - $fieldsDescription + $translationMod = 'Calendar'; + $showMore = false; + foreach ($ics as $data) { + $evTemplate = '
'; + [$record, $icsPart] = $data; + $dateStart = $fields = $fieldsDescription = ''; + if (!$record->isEmpty('date_start')) { + $dateStart = $record->getDisplayValue('date_start'); + $dateStartLabel = \App\Language::translate('LBL_START'); + $fields .= "
$dateStartLabel: $dateStart
"; + } + if (!$record->isEmpty('due_date')) { + $dueDate = $record->getDisplayValue('due_date'); + $dueDateLabel = \App\Language::translate('LBL_END'); + $fields .= "
$dueDateLabel: $dueDate
"; + } + if ($location = $record->getDisplayValue('location', false, false, 100)) { + $locationLabel = \App\Language::translate('Location', $translationMod); + $fields .= "
$locationLabel: $location
"; + } + if ($status = $record->getDisplayValue('activitystatus')) { + $statusLabel = \App\Language::translate('LBL_STATUS', $translationMod); + $fields .= "
$statusLabel: $status
"; + } + if ($type = $record->getDisplayValue('activitytype')) { + $typeLabel = \App\Language::translate('Activity Type', $translationMod); + $fields .= "
$typeLabel: $type
"; + } + if ($location = $record->getDisplayValue('meeting_url', false, false, 40)) { + $locationLabel = \App\Language::translate('FL_MEETING_URL', $translationMod); + $fields .= "
$locationLabel: $location
"; + } + if ($allday = $record->getDisplayValue('allday')) { + $alldayLabel = \App\Language::translate('All day', $translationMod); + $fields .= "
$alldayLabel: $allday
"; + } + if ($visibility = $record->getDisplayValue('visibility')) { + $visibilityLabel = \App\Language::translate('Visibility', $translationMod); + $fields .= "
$visibilityLabel: $visibility
"; + } + if ($priority = $record->getDisplayValue('taskpriority')) { + $label = \App\Language::translate('Priority', $translationMod); + $fields .= "
$label: $priority
"; + } + if ($description = $record->getDisplayValue('description', false, false, 50)) { + $descriptionLabel = \App\Language::translate('Description', $translationMod); + $fieldsDescription .= "
$descriptionLabel: $description
"; + } + $evTemplate .= "
+
+

{$record->getDisplayValue('subject')} | $dateStart

+
-
-
"; - $evTemplate .= '
'; - if (!isset($showPart[$icsPart['part']]) && \App\Privilege::isPermitted('Calendar', 'CreateView')) { - $showPart[$icsPart['part']] = $icsPart['part']; - $title = \App\Language::translate('LBL_ADD_TO_MY_CALENDAR', 'OSSMail'); - $counterText = empty($counterBtn[$icsPart['part']]) ? '' : ($counterBtn[$icsPart['part']] > 1 ? " ({$counterBtn[$icsPart['part']]})" : ''); - $btn = html::a([ - 'href' => '#', - 'class' => 'button btn btn-sm btn-light', - 'onclick' => "return rcmail.command('yetiforce.importICS',{$icsPart['part']},'{$icsPart['type']}')", - 'title' => $title, - ], html::span(null, "{$title}{$counterText}")); - $evTemplate = str_replace('', "{$btn}", $evTemplate); - $args['content'] .= $evTemplate; - } elseif ($counterList[$icsPart['part']] < 4) { - $args['content'] .= $evTemplate; - } else { - $showMore = true; +
+
+ $fields + $fieldsDescription +
+
+
"; + $evTemplate .= '
'; + if (!isset($showPart[$icsPart['part']]) && \App\Privilege::isPermitted('Calendar', 'CreateView')) { + $showPart[$icsPart['part']] = $icsPart['part']; + $title = \App\Language::translate('LBL_ADD_TO_MY_CALENDAR', 'OSSMail'); + $counterText = empty($counterBtn[$icsPart['part']]) ? '' : ($counterBtn[$icsPart['part']] > 1 ? " ({$counterBtn[$icsPart['part']]})" : ''); + $btn = html::a([ + 'href' => '#', + 'class' => 'button btn btn-sm btn-light', + 'onclick' => "return rcmail.command('yetiforce.importICS',{$icsPart['part']},'{$icsPart['type']}')", + 'title' => $title, + ], html::span(null, "{$title}{$counterText}")); + $evTemplate = str_replace('', "{$btn}", $evTemplate); + $args['content'] .= $evTemplate; + } elseif ($counterList[$icsPart['part']] < 4) { + $args['content'] .= $evTemplate; + } else { + $showMore = true; + } + if (isset($counterList[$icsPart['part']])) { + ++$counterList[$icsPart['part']]; + } else { + $counterList[$icsPart['part']] = 1; + } } - if (isset($counterList[$icsPart['part']])) { - ++$counterList[$icsPart['part']]; - } else { - $counterList[$icsPart['part']] = 1; + if ($showMore) { + $args['content'] .= html::div(null, '...'); } } - if ($showMore) { - $args['content'] .= html::div(null, '...'); - } chdir($currentPath); return $args; } @@ -1003,8 +1007,7 @@ public function appendIcsPreview(array $args): array public function importIcs(): void { chdir($this->rc->config->get('root_directory')); - $this->loadCurrentUser(); - if (\App\Privilege::isPermitted('Calendar', 'CreateView')) { + if ($this->loadCurrentUser() && \App\Privilege::isPermitted('Calendar', 'CreateView')) { $mailId = (int) rcube_utils::get_input_value('_mailId', rcube_utils::INPUT_GPC); $uid = App\Purifier::purifyByType(rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GPC), 'Alnum'); $mbox = App\Purifier::purifyByType(rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC), 'Alnum'); @@ -1093,8 +1096,7 @@ public function messages_list(array $p): array { $currentPath = getcwd(); chdir($this->rc->config->get('root_directory')); - $this->loadCurrentUser(); - if (!\App\Config::component('Mail', 'rcListCheckRbl', false)) { + if (!$this->loadCurrentUser() || !\App\Config::component('Mail', 'rcListCheckRbl', false)) { chdir($currentPath); return $p; } @@ -1173,8 +1175,7 @@ public function message_objects(array $p): array { $currentPath = getcwd(); chdir($this->rc->config->get('root_directory')); - $this->loadCurrentUser(); - if (!\App\Config::component('Mail', 'rcDetailCheckRbl', false)) { + if (!$this->loadCurrentUser() || !\App\Config::component('Mail', 'rcDetailCheckRbl', false)) { chdir($currentPath); return $p; } @@ -1308,16 +1309,15 @@ public function message_before_send(array $args): array { $currentPath = getcwd(); chdir($this->rc->config->get('root_directory')); - $this->loadCurrentUser(); - - $eventHandler = new \App\EventHandler(); - $eventHandler->setModuleName('OSSMail'); - $eventHandler->setParams([ - 'composeData' => $_SESSION['compose_data_' . rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC)] ?? [], - 'mailData' => $args, - ]); - $eventHandler->trigger('OSSMailBeforeSend'); - + if ($this->loadCurrentUser()) { + $eventHandler = new \App\EventHandler(); + $eventHandler->setModuleName('OSSMail'); + $eventHandler->setParams([ + 'composeData' => $_SESSION['compose_data_' . rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC)] ?? [], + 'mailData' => $args, + ]); + $eventHandler->trigger('OSSMailBeforeSend'); + } chdir($currentPath); return $eventHandler->getParams()['mailData']; } diff --git a/version.php b/version.php index 49e7d2ba..e6f2aadb 100644 --- a/version.php +++ b/version.php @@ -1,6 +1,6 @@ '2022.02.02', - 'version' => '0.2.11', + 'patch' => '2022.02.17', + 'version' => '0.2.12', ];