mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 13:18:06 +00:00 
			
		
		
		
	better error checking, send notification mail via notification service
This commit is contained in:
		
							parent
							
								
									eacd59c2ef
								
							
						
					
					
						commit
						a9d912bce2
					
				|  | @ -81,8 +81,55 @@ if ($_GET["type"]=="document"){ | |||
| 	if ($document->getAccessMode($user) < M_READ)  | ||||
| 		UI::exitError(getMLText("my_account"),getMLText("error_occured")); | ||||
| 
 | ||||
| 	if ($_GET["action"]=="add") $document->addNotify($userid, true); | ||||
| 	else if ($_GET["action"]=="del") $document->removeNotify($userid, true); | ||||
| 	if ($_GET["action"]=="add") { | ||||
| 		$res = $document->addNotify($userid, true); | ||||
| 		switch ($res) { | ||||
| 			case -1: | ||||
| 				UI::exitError(getMLText("my_account"), getMLText("unknown_user")); | ||||
| 				break; | ||||
| 			case -2: | ||||
| 				UI::exitError(getMLText("my_account"), getMLText("access_denied")); | ||||
| 				break; | ||||
| 			case -3: | ||||
| 				UI::exitError(getMLText("my_account"), getMLText("already_subscribed")); | ||||
| 				break; | ||||
| 			case -4: | ||||
| 				UI::exitError(getMLText("my_account"), getMLText("internal_error")); | ||||
| 				break; | ||||
| 			case 0: | ||||
| 				$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_notify'))); | ||||
| 				// Email user / group, informing them of subscription.
 | ||||
| 				if ($notifier){ | ||||
| 					$obj = $dms->getUser($userid); | ||||
| 					$notifier->sendNewDocumentNotifyMail($document, $user, $obj); | ||||
| 				} | ||||
| 				break; | ||||
| 		} | ||||
| 	} elseif ($_GET["action"]=="del") { | ||||
| 		$res = $document->removeNotify($userid, true); | ||||
| 		switch ($res) { | ||||
| 			case -1: | ||||
| 				UI::exitError(getMLText("my_account"), getMLText("unknown_user")); | ||||
| 				break; | ||||
| 			case -2: | ||||
| 				UI::exitError(getMLText("my_account"), getMLText("access_denied")); | ||||
| 				break; | ||||
| 			case -3: | ||||
| 				UI::exitError(getMLText("my_account"), getMLText("not_subscribed")); | ||||
| 				break; | ||||
| 			case -4: | ||||
| 				UI::exitError(getMLText("my_account"), getMLText("internal_error")); | ||||
| 				break; | ||||
| 			case 0: | ||||
| 				$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_notify'))); | ||||
| 				// Email user / group, informing them of subscription change.
 | ||||
| 				if($notifier) { | ||||
| 					$obj = $dms->getUser($userid); | ||||
| 					$notifier->sendDeleteDocumentNotifyMail($document, $user, $obj); | ||||
| 				} | ||||
| 				break; | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| } else if ($_GET["type"]=="folder") { | ||||
| 
 | ||||
|  | @ -113,18 +160,7 @@ if ($_GET["type"]=="document"){ | |||
| 		if(0 == $folder->removeNotify($userid, true)) { | ||||
| 			if($notifier) { | ||||
| 				$obj = $dms->getUser($userid); | ||||
| 				// Email user / group, informing them of subscription.
 | ||||
| 				$subject = "notify_deleted_email_subject"; | ||||
| 				$message = "notify_deleted_email_body"; | ||||
| 				$params = array(); | ||||
| 				$params['name'] = $folder->getName(); | ||||
| 				$params['folder_path'] = $folder->getFolderPathPlain(); | ||||
| 				$params['username'] = $user->getFullName(); | ||||
| 				$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(); | ||||
| 				$params['sitename'] = $settings->_siteName; | ||||
| 				$params['http_root'] = $settings->_httpRoot; | ||||
| 
 | ||||
| 				$notifier->toIndividual($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); | ||||
| 				$notifier->sendDeleteFolderNotifyMail($folder, $user, $obj); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann