mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 05:11:27 +00:00 
			
		
		
		
	add notification service
This commit is contained in:
		
							parent
							
								
									6bd7ed5ee2
								
							
						
					
					
						commit
						acdfa6f8c4
					
				|  | @ -13,6 +13,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| require_once("inc.Utils.php"); | require_once("inc.Utils.php"); | ||||||
|  | require_once("inc.ClassNotificationService.php"); | ||||||
| require_once("inc.ClassEmailNotify.php"); | require_once("inc.ClassEmailNotify.php"); | ||||||
| require_once("inc.ClassSession.php"); | require_once("inc.ClassSession.php"); | ||||||
| 
 | 
 | ||||||
|  | @ -63,11 +64,9 @@ if($user->isAdmin()) { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| $dms->setUser($user); | $dms->setUser($user); | ||||||
|  | $notifier = new SeedDMS_NotificationService(); | ||||||
| if($settings->_enableEmail) { | if($settings->_enableEmail) { | ||||||
| 	$notifier = new SeedDMS_EmailNotify(); | 	$notifier->addService(new SeedDMS_EmailNotify($dms)); | ||||||
| 	$notifier->setSender($user); |  | ||||||
| } else { |  | ||||||
| 	$notifier = null; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Include the language file as specified in the session. If that is not | /* Include the language file as specified in the session. If that is not | ||||||
|  |  | ||||||
|  | @ -30,14 +30,13 @@ require_once("inc.ClassNotify.php"); | ||||||
|  * @version    Release: @package_version@ |  * @version    Release: @package_version@ | ||||||
|  */ |  */ | ||||||
| class SeedDMS_EmailNotify extends SeedDMS_Notify { | class SeedDMS_EmailNotify extends SeedDMS_Notify { | ||||||
| 	/* User sending the notification | 	/** | ||||||
| 	 * Will only be used if the sender of one of the notify methods | 	 * Instanz of DMS | ||||||
| 	 * is not set |  | ||||||
| 	 */ | 	 */ | ||||||
| 	protected $sender; | 	protected $_dms; | ||||||
| 
 | 
 | ||||||
| 	function setSender($user) { | 	function __construct($dms) { | ||||||
| 		$this->sender = $user; | 		$this->_dms = $dms; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	function toIndividual($sender, $recipient, $subject, $message, $params=array()) { /* {{{ */ | 	function toIndividual($sender, $recipient, $subject, $message, $params=array()) { /* {{{ */ | ||||||
|  |  | ||||||
							
								
								
									
										56
									
								
								inc/inc.ClassNotificationService.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								inc/inc.ClassNotificationService.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,56 @@ | ||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Implementation of notification service | ||||||
|  |  * | ||||||
|  |  * @category   DMS | ||||||
|  |  * @package    SeedDMS | ||||||
|  |  * @license    GPL 2 | ||||||
|  |  * @version    @version@ | ||||||
|  |  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||||
|  |  * @copyright  Copyright (C) 2016 Uwe Steinmann | ||||||
|  |  * @version    Release: @package_version@ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Implementation of notification service | ||||||
|  |  * | ||||||
|  |  * @category   DMS | ||||||
|  |  * @package    SeedDMS | ||||||
|  |  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||||
|  |  * @copyright  Copyright (C) 2016 Uwe Steinmann | ||||||
|  |  * @version    Release: @package_version@ | ||||||
|  |  */ | ||||||
|  | class SeedDMS_NotificationService { | ||||||
|  | 	/** | ||||||
|  | 	 * List of services for sending notification | ||||||
|  | 	 */ | ||||||
|  | 	protected $services; | ||||||
|  | 
 | ||||||
|  | 	public function __construct() { | ||||||
|  | 		$this->services = array(); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public function addService($service) { | ||||||
|  | 		$this->services[] = $service; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public function toIndividual($sender, $recipient, $subject, $message, $params=array()) { | ||||||
|  | 		foreach($this->services as $service) { | ||||||
|  | 			$service->toIndividual($sender, $recipient, $subject, $message, $params); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public function toGroup($sender, $groupRecipient, $subject, $message, $params=array()) { | ||||||
|  | 		foreach($this->services as $service) { | ||||||
|  | 			$service->toGroup($sender, $groupRecipient, $subject, $message, $params); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public function toList($sender, $recipients, $subject, $message, $params=array()) { | ||||||
|  | 		foreach($this->services as $service) { | ||||||
|  | 			$service->toList($sender, $recipients, $subject, $message, $params); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @ -19,6 +19,7 @@ | ||||||
| include("../inc/inc.Settings.php"); | include("../inc/inc.Settings.php"); | ||||||
| include("../inc/inc.LogInit.php"); | include("../inc/inc.LogInit.php"); | ||||||
| include("../inc/inc.Utils.php"); | include("../inc/inc.Utils.php"); | ||||||
|  | include("../inc/inc.ClassNotificationService.php"); | ||||||
| include("../inc/inc.ClassEmailNotify.php"); | include("../inc/inc.ClassEmailNotify.php"); | ||||||
| include("../inc/inc.DBInit.php"); | include("../inc/inc.DBInit.php"); | ||||||
| include("../inc/inc.Language.php"); | include("../inc/inc.Language.php"); | ||||||
|  | @ -53,11 +54,9 @@ if (isset($_COOKIE["mydms_session"])) { | ||||||
| 			$user = $dms->getUser($resArr["su"]); | 			$user = $dms->getUser($resArr["su"]); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	$notifier = new SeedDMS_NotificationService(); | ||||||
| 	if($settings->_enableEmail) { | 	if($settings->_enableEmail) { | ||||||
| 		$notifier = new SeedDMS_EmailNotify(); | 		$notifier->addService(new SeedDMS_EmailNotify($dms)); | ||||||
| 		$notifier->setSender($user); |  | ||||||
| 	} else { |  | ||||||
| 		$notifier = null; |  | ||||||
| 	} | 	} | ||||||
| 	include $settings->_rootDir . "languages/" . $resArr["language"] . "/lang.inc"; | 	include $settings->_rootDir . "languages/" . $resArr["language"] . "/lang.inc"; | ||||||
| } else { | } else { | ||||||
|  |  | ||||||
|  | @ -53,7 +53,7 @@ if (empty($email) || empty($login)) { | ||||||
| $user = $dms->getUserByLogin($login, $email); | $user = $dms->getUserByLogin($login, $email); | ||||||
| if($user) { | if($user) { | ||||||
| 	if($hash = $dms->createPasswordRequest($user)) { | 	if($hash = $dms->createPasswordRequest($user)) { | ||||||
| 		$emailobj = new SeedDMS_EmailNotify(); | 		$emailobj = new SeedDMS_EmailNotify($dms); | ||||||
| 		$subject = "password_forgotten_email_subject"; | 		$subject = "password_forgotten_email_subject"; | ||||||
| 		$message = "password_forgotten_email_body"; | 		$message = "password_forgotten_email_body"; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann