make sure list of notified users is unique (Closes #415)

This commit is contained in:
Uwe Steinmann 2018-10-02 18:18:24 +02:00
parent 7baf46a067
commit 166168e769
8 changed files with 29 additions and 24 deletions

View File

@ -258,7 +258,7 @@ $docsource = 'upload';
if($settings->_dropFolderDir) {
if(isset($_POST["dropfolderfileform1"]) && $_POST["dropfolderfileform1"]) {
$fullfile = $settings->_dropFolderDir.'/'.$user->getLogin().'/'.$_POST["dropfolderfileform1"];
$fullfile = $settings->_dropFolderDir.'/'.$user->getLogin().'/'.$folder->getID().'/'.$_POST["dropfolderfileform1"];
if(file_exists($fullfile)) {
$docsource = 'dropfolder';
/* Check if a local file is uploaded as well */
@ -390,8 +390,8 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
$fnl = $folder->getNotifyList();
$dnl = $document->getNotifyList();
$nl = array(
'users'=>array_merge($dnl['users'], $fnl['users']),
'groups'=>array_merge($dnl['groups'], $fnl['groups'])
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
);
$subject = "new_document_email_subject";

View File

@ -111,7 +111,12 @@ if(!$subFolder = $controller->run()) {
} else {
// Send notification to subscribers.
if($notifier) {
$notifyList = $folder->getNotifyList();
$fnl = $folder->getNotifyList();
$snl = $subFolder->getNotifyList();
$nl = array(
'users'=>array_unique(array_merge($snl['users'], $fnl['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($snl['groups'], $fnl['groups']), SORT_REGULAR)
);
$subject = "new_subfolder_email_subject";
$message = "new_subfolder_email_body";
@ -124,8 +129,8 @@ if(!$subFolder = $controller->run()) {
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$subFolder->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $notifyList["users"], $subject, $message, $params);
foreach ($notifyList["groups"] as $grp) {
$notifier->toList($user, $nl["users"], $subject, $message, $params);
foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params);
}
}

View File

@ -350,8 +350,8 @@ switch($command) {
$fnl = $folder->getNotifyList();
$pnl = $parent->getNotifyList();
$nl = array(
'users'=>array_merge($fnl['users'], $pnl['users']),
'groups'=>array_merge($fnl['groups'], $pnl['groups'])
'users'=>array_unique(array_merge($fnl['users'], $pnl['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($fnl['groups'], $pnl['groups']), SORT_REGULAR)
);
$foldername = $folder->getName();
if($folder->remove()) {
@ -403,8 +403,8 @@ switch($command) {
$dnl = $document->getNotifyList();
$fnl = $folder->getNotifyList();
$nl = array(
'users'=>array_merge($dnl['users'], $fnl['users']),
'groups'=>array_merge($dnl['groups'], $fnl['groups'])
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
);
$docname = $document->getName();
if($document->remove()) {
@ -685,8 +685,8 @@ switch($command) {
$fnl = $folder->getNotifyList();
$dnl = $document->getNotifyList();
$nl = array(
'users'=>array_merge($dnl['users'], $fnl['users']),
'groups'=>array_merge($dnl['groups'], $fnl['groups'])
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
);
$subject = "new_document_email_subject";

View File

@ -60,8 +60,8 @@ foreach($clipboard['docs'] as $documentid) {
$nl2 = $document->getNotifyList();
$nl3 = $targetFolder->getNotifyList();
$nl = array(
'users'=>array_merge($nl1['users'], $nl2['users'], $nl3['users']),
'groups'=>array_merge($nl1['groups'], $nl2['groups'], $nl3['groups'])
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
);
$subject = "document_moved_email_subject";
$message = "document_moved_email_body";
@ -107,8 +107,8 @@ foreach($clipboard['folders'] as $folderid) {
$nl2 = $folder->getNotifyList();
$nl3 = $targetFolder->getNotifyList();
$nl = array(
'users'=>array_merge($nl1['users'], $nl2['users'], $nl3['users']),
'groups'=>array_merge($nl1['groups'], $nl2['groups'], $nl3['groups'])
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
);
$subject = "folder_moved_email_subject";
$message = "folder_moved_email_body";

View File

@ -70,8 +70,8 @@ if ($targetid != $oldFolder->getID()) {
$nl2 = $document->getNotifyList();
$nl3 = $targetFolder->getNotifyList();
$nl = array(
'users'=>array_merge($nl1['users'], $nl2['users'], $nl3['users']),
'groups'=>array_merge($nl1['groups'], $nl2['groups'], $nl3['groups'])
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
);
$subject = "document_moved_email_subject";
$message = "document_moved_email_body";

View File

@ -68,8 +68,8 @@ if ($folder->setParent($targetFolder)) {
$nl2 = $folder->getNotifyList();
$nl3 = $targetFolder->getNotifyList();
$nl = array(
'users'=>array_merge($nl1['users'], $nl2['users'], $nl3['users']),
'groups'=>array_merge($nl1['groups'], $nl2['groups'], $nl3['groups'])
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
);
$subject = "folder_moved_email_subject";
$message = "folder_moved_email_body";

View File

@ -81,8 +81,8 @@ $previewer->deleteDocumentPreviews($document);
$dnl = $document->getNotifyList();
$fnl = $folder->getNotifyList();
$nl = array(
'users'=>array_merge($dnl['users'], $fnl['users']),
'groups'=>array_merge($dnl['groups'], $fnl['groups'])
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
);
$docname = $document->getName();

View File

@ -79,8 +79,8 @@ $foldername = $folder->getName();
$fnl = $folder->getNotifyList();
$pnl = $parent->getNotifyList();
$nl = array(
'users'=>array_merge($fnl['users'], $pnl['users']),
'groups'=>array_merge($fnl['groups'], $pnl['groups'])
'users'=>array_unique(array_merge($fnl['users'], $pnl['users']), SORT_REGULAR),
'groups'=>array_unique(array_merge($fnl['groups'], $pnl['groups']), SORT_REGULAR)
);
$controller->setParam('folder', $folder);