mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +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.ClassNotificationService.php");
|
||||
require_once("inc.ClassEmailNotify.php");
|
||||
require_once("inc.ClassSession.php");
|
||||
|
||||
|
@ -63,11 +64,9 @@ if($user->isAdmin()) {
|
|||
}
|
||||
}
|
||||
$dms->setUser($user);
|
||||
$notifier = new SeedDMS_NotificationService();
|
||||
if($settings->_enableEmail) {
|
||||
$notifier = new SeedDMS_EmailNotify();
|
||||
$notifier->setSender($user);
|
||||
} else {
|
||||
$notifier = null;
|
||||
$notifier->addService(new SeedDMS_EmailNotify($dms));
|
||||
}
|
||||
|
||||
/* 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@
|
||||
*/
|
||||
class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
||||
/* User sending the notification
|
||||
* Will only be used if the sender of one of the notify methods
|
||||
* is not set
|
||||
/**
|
||||
* Instanz of DMS
|
||||
*/
|
||||
protected $sender;
|
||||
protected $_dms;
|
||||
|
||||
function setSender($user) {
|
||||
$this->sender = $user;
|
||||
function __construct($dms) {
|
||||
$this->_dms = $dms;
|
||||
}
|
||||
|
||||
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.LogInit.php");
|
||||
include("../inc/inc.Utils.php");
|
||||
include("../inc/inc.ClassNotificationService.php");
|
||||
include("../inc/inc.ClassEmailNotify.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
|
@ -53,11 +54,9 @@ if (isset($_COOKIE["mydms_session"])) {
|
|||
$user = $dms->getUser($resArr["su"]);
|
||||
}
|
||||
}
|
||||
$notifier = new SeedDMS_NotificationService();
|
||||
if($settings->_enableEmail) {
|
||||
$notifier = new SeedDMS_EmailNotify();
|
||||
$notifier->setSender($user);
|
||||
} else {
|
||||
$notifier = null;
|
||||
$notifier->addService(new SeedDMS_EmailNotify($dms));
|
||||
}
|
||||
include $settings->_rootDir . "languages/" . $resArr["language"] . "/lang.inc";
|
||||
} else {
|
||||
|
|
|
@ -53,7 +53,7 @@ if (empty($email) || empty($login)) {
|
|||
$user = $dms->getUserByLogin($login, $email);
|
||||
if($user) {
|
||||
if($hash = $dms->createPasswordRequest($user)) {
|
||||
$emailobj = new SeedDMS_EmailNotify();
|
||||
$emailobj = new SeedDMS_EmailNotify($dms);
|
||||
$subject = "password_forgotten_email_subject";
|
||||
$message = "password_forgotten_email_body";
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user