<?php if (!defined('VB_ENTRY')) die('Access denied.'); abstract class vB_Notification_Content extends vB_Notification { protected static $updateEvents = array( 'read_topic', 'read_channel', 'soft_deleted_node', 'physically_deleted_node', 'deleted_user', ); const TYPENAME = 'Content'; protected function validateAndCleanNotificationData($notificationData) { $newData = parent::validateAndCleanNotificationData($notificationData); unset($notificationData); if (!isset($newData['sentbynodeid'])) { throw new Exception("Missing Notification Data: sentbynodeid"); } $nodeid = $newData['sentbynodeid']; $node = vB_Library::instance('node')->getNode($nodeid, false, true); if (!isset($node['nodeid'])) { throw new Exception("Invalid Notification Data: sentbynodeid"); } if (!($node['showpublished'] AND $node['showapproved'])) { throw new Exception("Invalid Notification Data: showpublished or showapproved"); } $this->validateSourceContentType($node['contenttypeid']); $this->validateSourceChannelType($node['channeltype']); $newData['sentbynodeid'] = (int) $node['nodeid']; if (!isset($node['userid'])) { throw new Exception("Invalid Notification Data: sentbynodeid"); } $newData['sender'] = (int) $node['userid']; return $newData; } protected function overwriteRule() { return 'if_read'; } protected static function defineUnique($notificationData, $skipValidation) { return array(); } public static function generateNotificationQueueKey($notificationData) { return "_" . $notificationData['recipient'] . vB_Notification::DELIM . "Content"; } } 