From 7790f483f0f7f040364a396f64830ba9ca0d9164 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 31 Mar 2023 12:00:56 +0200 Subject: [PATCH] no need to create notification service a second time --- op/op.Ajax.php | 22 +--------------------- restapi/index.php | 22 ---------------------- webdav/index.php | 22 ---------------------- 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 9999186b8..d9dad164e 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -27,6 +27,7 @@ require_once("../inc/inc.ClassNotificationService.php"); require_once("../inc/inc.ClassEmailNotify.php"); require_once("../inc/inc.ClassUI.php"); require_once("../inc/inc.ClassController.php"); +require_once("../inc/inc.Notification.php"); require_once("../inc/inc.ClassSession.php"); require_once("../inc/inc.ClassPasswordStrength.php"); @@ -63,27 +64,6 @@ if (isset($_COOKIE["mydms_session"])) { $dms->setRootFolderID($user->getHomeFolder()); } - global $logger; - $notifier = new SeedDMS_NotificationService($logger, $settings); - if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { - if(method_exists($notificationObj, 'preAddService')) { - $notificationObj->preAddService($dms, $notifier); - } - } - } - - if($settings->_enableEmail) { - $notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword), 'email'); - } - - if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { - if(method_exists($notificationObj, 'postAddService')) { - $notificationObj->postAddService($dms, $notifier); - } - } - } include $settings->_rootDir . "languages/" . $resArr["language"] . "/lang.inc"; } else { $user = null; diff --git a/restapi/index.php b/restapi/index.php index 541d9bfcf..4ae5efece 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -15,28 +15,6 @@ require_once("../inc/inc.ClassEmailNotify.php"); require_once("../inc/inc.Notification.php"); require_once("../inc/inc.ClassController.php"); -$notifier = new SeedDMS_NotificationService($logger, $settings); - -if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { - if(method_exists($notificationObj, 'preAddService')) { - $notificationObj->preAddService($dms, $notifier); - } - } -} - -if($settings->_enableEmail) { - $notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword)); -} - -if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { - if(method_exists($notificationObj, 'postAddService')) { - $notificationObj->postAddService($dms, $notifier); - } - } -} - require "vendor/autoload.php"; use Psr\Container\ContainerInterface; diff --git a/webdav/index.php b/webdav/index.php index e148a8029..a70b701d4 100644 --- a/webdav/index.php +++ b/webdav/index.php @@ -15,28 +15,6 @@ require_once("../inc/inc.ClassEmailNotify.php"); require_once("../inc/inc.Notification.php"); require_once("../inc/inc.ClassController.php"); -$notifier = new SeedDMS_NotificationService($logger, $settings); - -if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { - if(method_exists($notificationObj, 'preAddService')) { - $notificationObj->preAddService($dms, $notifier); - } - } -} - -if($settings->_enableEmail) { - $notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword)); -} - -if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { - if(method_exists($notificationObj, 'postAddService')) { - $notificationObj->postAddService($dms, $notifier); - } - } -} - include("webdav.php"); $server = new HTTP_WebDAV_Server_SeedDMS(); $server->ServeRequest($dms, $settings, $logger, $notifier, $authenticator);