From: Marcel Werk Date: Mon, 9 Dec 2013 20:17:43 +0000 (+0100) Subject: Fixed unsubscribe X-Git-Tag: 2.0.0~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9b43da4b44ede419716d0f92757da90d5375fdcb;p=GitHub%2FWoltLab%2FWCF.git Fixed unsubscribe --- diff --git a/wcfsetup/install/files/lib/action/NotificationDisableAction.class.php b/wcfsetup/install/files/lib/action/NotificationDisableAction.class.php index 75325129c5..4c2bc11778 100644 --- a/wcfsetup/install/files/lib/action/NotificationDisableAction.class.php +++ b/wcfsetup/install/files/lib/action/NotificationDisableAction.class.php @@ -1,6 +1,5 @@ eventID = intval($_REQUEST['eventID']); - $this->event = new UserNotificationEvent($this->eventID); - if (!$this->event->eventID) { - throw new IllegalLinkException(); + if (isset($_REQUEST['eventID'])) { + $this->eventID = intval($_REQUEST['eventID']); + + $this->event = new UserNotificationEvent($this->eventID); + if (!$this->event->eventID) { + throw new IllegalLinkException(); + } } if (isset($_REQUEST['userID'])) $this->userID = intval($_REQUEST['userID']); @@ -80,20 +82,29 @@ class NotificationDisableAction extends AbstractAction { public function execute() { parent::execute(); - // get object type - $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.notification.notificationType', 'com.woltlab.wcf.notification.notificationType.mail'); + if ($this->event !== null) { + $sql = "UPDATE wcf".WCF_N."_user_notification_event_to_user + SET mailNotificationType = ? + WHERE userID = ? + AND eventID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array( + 'none', + $this->userID, + $this->eventID + )); + } + else { + $sql = "UPDATE wcf".WCF_N."_user_notification_event_to_user + SET mailNotificationType = ? + WHERE userID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array( + 'none', + $this->userID + )); + } - // delete notification setting - $sql = "DELETE FROM wcf".WCF_N."_user_notification_event_notification_type - WHERE userID = ? - AND eventID = ? - AND notificationTypeID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( - $this->userID, - $this->eventID, - $objectType->objectTypeID - )); $this->executed(); // redirect to url