function processCommentNotifications($mode, $link_id, $forum_id, $topic_id, $post_id) { // non-module integration returns false quickly if (!is_object($this->module)) { return false; } $not_module =& $this->module; $not_modid = $this->module->getVar('mid'); $not_catinfo =& notificationCommentCategoryInfo($not_modid); // module without 'comment' notification if (empty($not_catinfo)) { return false; } $not_category = $not_catinfo['name']; $not_itemid = $link_id; $not_event = 'comment'; // 'comment_submit'? $comment_tags = array('X_COMMENT_URL' => XOOPS_URL . '/modules/' . $this->d3forum_dirname . '/index.php?post_id=' . intval($post_id)); $users2notify = d3forum_get_users_can_read_forum($this->d3forum_dirname, $forum_id); if (empty($users2notify)) { $users2notify = array(0); } $not_handler =& D3NotificationHandler::getInstance(); $not_handler->triggerEvent($this->mydirname, $this->mytrustdirname, $not_category, $not_itemid, $not_event, $comment_tags, $users2notify); }
// increment post if (is_object(@$xoopsUser) && $mode != 'edit') { $xoopsUser->incrementPost(); } // set u2t_marked if ($uid && @$xoopsModuleConfig['allow_mark']) { $u2t_marked = empty($_POST['u2t_marked']) ? 0 : 1; $db->query("UPDATE " . $db->prefix($mydirname . "_users2topics") . " SET u2t_marked={$u2t_marked},u2t_time=UNIX_TIMESTAMP() WHERE uid={$uid} AND topic_id={$topic_id}"); if (!$db->getAffectedRows()) { $db->query("INSERT INTO " . $db->prefix($mydirname . "_users2topics") . " SET uid={$uid},topic_id={$topic_id},u2t_marked={$u2t_marked},u2t_time=UNIX_TIMESTAMP()"); } } // Define tags for notification message $tags = array('POSTER_UNAME' => $uid > 0 && !$hide_uid ? $xoopsUser->getVar('uname') : $guest_name, 'POST_TITLE' => $subject, 'POST_BODY' => $message, 'POST_BODY_NO_TAGS' => strip_tags($message), 'POST_URL' => XOOPS_URL . "/modules/{$mydirname}/index.php?post_id={$post_id}", 'TOPIC_TITLE' => empty($topic_row) ? $subject : $topic_row['topic_title'], 'TOPIC_URL' => XOOPS_URL . "/modules/{$mydirname}/index.php?topic_id={$topic_id}", 'FORUM_TITLE' => $forum_row['forum_title'], 'FORUM_URL' => XOOPS_URL . "/modules/{$mydirname}/index.php?forum_id={$forum_id}", 'CAT_TITLE' => $cat_row['cat_title'], 'CAT_URL' => XOOPS_URL . "/modules/{$mydirname}/index.php?cat_id={$cat_id}"); $notification_handler =& xoops_gethandler('notification'); $users2notify = d3forum_get_users_can_read_forum($mydirname, $forum_id, $cat_id); if (empty($users2notify)) { $users2notify = array(0); } if (!empty($need_notify)) { if ($mode == 'newtopic') { // Notify for newtopic d3forum_trigger_event($mydirname, 'global', 0, 'newtopic', $tags, $users2notify); d3forum_trigger_event($mydirname, 'category', $cat_id, 'newtopic', $tags, $users2notify); d3forum_trigger_event($mydirname, 'forum', $forum_id, 'newtopic', $tags, $users2notify); } // Notify for newpost d3forum_trigger_event($mydirname, 'global', 0, 'newpost', $tags, $users2notify); d3forum_trigger_event($mydirname, 'category', $cat_id, 'newpost', $tags, $users2notify); d3forum_trigger_event($mydirname, 'forum', $forum_id, 'newpost', $tags, $users2notify); d3forum_trigger_event($mydirname, 'topic', $topic_id, 'newpost', $tags, $users2notify);