当前位置: 首页>>代码示例>>PHP>>正文


PHP DiscussHelper::getNotification方法代码示例

本文整理汇总了PHP中DiscussHelper::getNotification方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::getNotification方法的具体用法?PHP DiscussHelper::getNotification怎么用?PHP DiscussHelper::getNotification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DiscussHelper的用法示例。


在下文中一共展示了DiscussHelper::getNotification方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 function process()
 {
     $view = new EasyDiscussView();
     $date = DiscussHelper::getDate();
     $now = $date->toMySQL();
     $modelSubscribe = $view->getModel('Subscribe');
     $subscribers = $modelSubscribe->getSiteSubscribers($this->interval, $now);
     $total = count($subscribers);
     if (empty($total)) {
         return false;
     }
     foreach ($subscribers as $subscriber) {
         $notify = DiscussHelper::getNotification();
         $data = array();
         $rows = $modelSubscribe->getCreatedPostByInterval($subscriber->sent_out, $now);
         $posts = array();
         if ($rows) {
             foreach ($rows as $row) {
                 $row['categorylink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=categorie&layout=listings&category_id=' . $row['category_id'], false, true);
                 $row['link'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row['id'], false, true);
                 $row['userlink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=profile&id=' . $row['user_id'], false, true);
                 $category = DiscussHelper::getTable('Category');
                 $creator = DiscussHelper::getTable('Profile');
                 $category->load($row['category_id']);
                 $creator->load($row['user_id']);
                 $row['category'] = $category->getTitle();
                 $row['avatar'] = $creator->getAvatar();
                 $row['name'] = $creator->getName();
                 $row['date'] = DiscussDateHelper::toFormat($row['created'], '%b %e, %Y');
                 $row['message'] = DiscussHelper::parseContent($row['content']);
                 $posts[] = $row;
             }
         }
         $data['post'] = $posts;
         $data['total'] = count($data['post']);
         $data['unsubscribeLink'] = DiscussHelper::getUnsubscribeLink($subscriber, true, true);
         $subject = $date->toMySQL();
         switch (strtoupper($this->interval)) {
             case 'DAILY':
                 $subject = $date->toFormat('%F');
                 $data['interval'] = JText::_('today');
                 break;
             case 'WEEKLY':
                 $subject = $date->toFormat('%V');
                 $data['interval'] = JText::_('this week');
                 break;
             case 'MONTHLY':
                 $subject = $date->toFormat('%B');
                 $data['interval'] = JText::_('this month');
                 break;
         }
         if (!empty($data['post'])) {
             $notify->addQueue($subscriber->email, JText::sprintf('COM_EASYDISCUSS_YOUR_' . $this->interval . '_SUBSCRIPTION', $subject), '', 'email.subscription.site.interval.php', $data);
         }
         $subscribe = DiscussHelper::getTable('Subscribe');
         $subscribe->load($subscriber->id);
         $subscribe->sent_out = $now;
         $subscribe->store();
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:60,代码来源:subscription.php

示例2: ajaxSubmitEmail

 public function ajaxSubmitEmail($data)
 {
     $my = JFactory::getUser();
     $djax = new Disjax();
     $post = DiscussStringHelper::ajaxPostToArray($data);
     if ($my->id == 0) {
         $djax->alert(JText::_('COM_EASYDISCUSS_YOU_DO_NOT_HAVE_PERMISION_TO_SUBMIT_REPORT'), JText::_('ERROR'), '450', 'auto');
         $djax->send();
         return;
     }
     // Load language files from front end.
     JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT);
     if (empty($post['post_id'])) {
         $djax->alert(JText::_('COM_EASYDISCUSS_INVALID_POST_ID'), JText::_('ERROR'), '450', 'auto');
         $djax->send();
         return;
     }
     $postId = (int) $post['post_id'];
     $emailContent = $post['content'];
     // Prepare email data
     $postTbl = JTable::getInstance('posts', 'Discuss');
     $postTbl->load($postId);
     $moderator = DiscussHelper::getTable('Profile');
     $moderator->load($my->id);
     $creator = JFactory::getUser($postTbl->user_id);
     $date = DiscussHelper::getDate($postTbl->created);
     $emailData = array();
     $emailData['postAuthor'] = $moderator->getName();
     $emailData['postAuthorAvatar'] = $moderator->getAvatar();
     $emailData['postDate'] = $date->toFormat();
     $emailData['postLink'] = JURI::root() . 'index.php?option=com_easydiscuss&view=post&id=' . $postTbl->id;
     $emailData['postTitle'] = $postTbl->title;
     $emailData['messages'] = $emailContent;
     if (!empty($postTbl->parent_id)) {
         $parentTbl = JTable::getInstance('posts', 'Discuss');
         $parentTbl->load($postTbl->parent_id);
         $emailData['postTitle'] = $parentTbl->title;
         $emailData['postLink'] = JURI::root() . 'index.php?option=com_easydiscuss&view=post&id=' . $parentTbl->id;
     }
     $noti = DiscussHelper::getNotification();
     $noti->addQueue($creator->email, JText::sprintf('COM_EASYDISCUSS_REQUIRED_YOUR_ATTENTION', $emailData['postTitle']), '', 'email.report.attention.php', $emailData);
     $djax->assign('report-entry-msg-' . $postId, JText::_('COM_EASYDISCUSS_EMAIL_SENT_TO_AUTHOR'));
     $djax->script('admin.reports.revertEmailForm("' . $postId . '");');
     $djax->send();
     return;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:46,代码来源:view.ajax.php

示例3: sendNotification

 /**
  * $post - post jtable object
  * $parent - post's parent id.
  * $isNew - indicate this is a new post or not.
  */
 public static function sendNotification($post, $parent = 0, $isNew, $postOwner, $prevPostStatus)
 {
     JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT);
     $config = DiscussHelper::getConfig();
     $notify = DiscussHelper::getNotification();
     $emailPostTitle = $post->title;
     $modelSubscribe = self::getModel('Subscribe');
     //get all admin emails
     $adminEmails = array();
     $ownerEmails = array();
     $newPostOwnerEmails = array();
     $postSubscriberEmails = array();
     $participantEmails = array();
     $catSubscriberEmails = array();
     if (empty($parent)) {
         // only new post we notify admin.
         if ($config->get('notify_admin')) {
             $admins = $notify->getAdminEmails();
             if (!empty($admins)) {
                 foreach ($admins as $admin) {
                     $adminEmails[] = $admin->email;
                 }
             }
         }
         // notify post owner too when moderate is on
         if (!empty($postOwner)) {
             $postUser = JFactory::getUser($postOwner);
             $newPostOwnerEmails[] = $postUser->email;
         } else {
             $newPostOwnerEmails[] = $post->poster_email;
         }
     } else {
         // if this is a new reply, notify post owner.
         $parentTable = DiscussHelper::getTable('Post');
         $parentTable->load($parent);
         $emailPostTitle = $parentTable->title;
         $oriPostAuthor = $parentTable->user_id;
         if (!$parentTable->user_id) {
             $ownerEmails[] = $parentTable->poster_email;
         } else {
             $oriPostUser = JFactory::getUser($oriPostAuthor);
             $ownerEmails[] = $oriPostUser->email;
         }
     }
     $emailSubject = empty($parent) ? JText::sprintf('COM_EASYDISCUSS_NEW_POST_ADDED', $post->id, $emailPostTitle) : JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent, $emailPostTitle);
     $emailTemplate = empty($parent) ? 'email.subscription.site.new.php' : 'email.post.reply.new.php';
     //get all site's subscribers email that want to receive notification immediately
     $subscriberEmails = array();
     $subscribers = array();
     // @rule: Specify the default name and avatar
     $authorName = $post->poster_name;
     $authorAvatar = DISCUSS_JURIROOT . '/media/com_easydiscuss/images/default.png';
     // @rule: Only process author items that belongs to a valid user.
     if (!empty($postOwner)) {
         $profile = DiscussHelper::getTable('Profile');
         $profile->load($postOwner);
         $authorName = $profile->getName();
         $authorAvatar = $profile->getAvatar();
     }
     if ($config->get('main_sitesubscription') && ($isNew || $prevPostStatus == DISCUSS_ID_PENDING)) {
         //$modelSubscribe		= self::getModel( 'Subscribe' );
         $subscribers = $modelSubscribe->getSiteSubscribers('instant', '', $post->category_id);
         $postSubscribers = $modelSubscribe->getPostSubscribers($post->parent_id);
         // This was added because the user allow site wide notification (as in all subscribers should get notified) but category subscribers did not get it.
         $catSubscribers = $modelSubscribe->getCategorySubscribers($post->id);
         if (!empty($subscribers)) {
             foreach ($subscribers as $subscriber) {
                 $subscriberEmails[] = $subscriber->email;
             }
         }
         if (!empty($postSubscribers)) {
             foreach ($postSubscribers as $postSubscriber) {
                 $postSubscriberEmails[] = $postSubscriber->email;
             }
         }
         if (!empty($catSubscribers)) {
             foreach ($catSubscribers as $catSubscriber) {
                 $catSubscriberEmails[] = $catSubscriber->email;
             }
         }
     }
     // Notify Participants if this is a reply
     if (!empty($parent) && $config->get('notify_participants') && ($isNew || $prevPostStatus == DISCUSS_ID_PENDING)) {
         $participantEmails = DiscussHelper::getHelper('Mailer')->_getParticipants($post->parent_id);
         $participantEmails = array_unique($participantEmails);
         // merge into owneremails. dirty hacks.
         if (count($participantEmails) > 0) {
             $newPostOwnerEmails = array_merge($newPostOwnerEmails, $participantEmails);
         }
     }
     if (!empty($adminEmails) || !empty($subscriberEmails) || !empty($newPostOwnerEmails) || !empty($postSubscriberEmails) || $config->get('notify_all')) {
         $emails = array_unique(array_merge($adminEmails, $subscriberEmails, $newPostOwnerEmails, $postSubscriberEmails, $catSubscriberEmails));
         // prepare email content and information.
         $emailData = array();
         $emailData['postTitle'] = $emailPostTitle;
//.........这里部分代码省略.........
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:helper.php

示例4: like

 /**
  * Processes ajax request when a user likes an item.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function like()
 {
     $my = JFactory::getUser();
     $ajax = DiscussHelper::getHelper('ajax');
     $config = DiscussHelper::getConfig();
     // Get the post.
     $postId = JRequest::getInt('postid');
     $post = DiscussHelper::getTable('Post');
     $post->load($postId);
     // Determine if the likes are enabled or not.
     if ($post->isReply() && !$config->get('main_likes_replies') || $post->isQuestion() && !$config->get('main_likes_discussions')) {
         return $ajax->reject();
     }
     // Do not allow non logged in users to like an item.
     if (!$my->id) {
         return $ajax->reject();
     }
     // Determine if the current user request is to like the post item or unlike.
     $isLike = !$post->isLikedBy($my->id);
     if ($isLike) {
         DiscussHelper::getHelper('Likes')->addLikes($post->id, 'post', $my->id);
     } else {
         // If this is an unlike request, we need to remove it.
         DiscussHelper::getHelper('Likes')->removeLikes($post->id, $my->id);
     }
     // Get the main question if this is a reply.
     if ($post->isReply()) {
         $question = DiscussHelper::getTable('Post');
         $question->load($post->parent_id);
     } else {
         $question = $post;
     }
     // Add JomSocial activity item if the post for the main discussion item if it has been liked.
     if ($post->published && $isLike) {
         // EasySocial instegrations
         DiscussHelper::getHelper('EasySocial')->notify('new.likes', $post, $question);
         DiscussHelper::getHelper('jomsocial')->addActivityLikes($post, $question);
         DiscussHelper::getHelper('easysocial')->likesStream($post, $question);
     }
     // Add a badge record for the user when they like a discussion
     // The record should only be added when the user liked another user's post.
     if ($post->isQuestion() && $isLike && $my->id != $post->user_id) {
         // Add logging for user.
         DiscussHelper::getHelper('History')->log('easydiscuss.like.discussion', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_LIKE_DISCUSSION', $question->title), $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.like.discussion', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.like.discussion', $my->id);
         // Assign badge for EasySocial
         DiscussHelper::getHelper('EasySocial')->assignBadge('like.question', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_LIKE_DISCUSSION', $question->title));
     }
     // Add a badge record for the user when they like a discussion
     // The record should only be added when the user liked another user's post.
     if ($post->isReply() && $isLike && $my->id != $post->user_id) {
         // Add logging for user.
         DiscussHelper::getHelper('History')->log('easydiscuss.like.reply', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_LIKE_REPLY', $post->title), $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.like.reply', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.like.reply', $my->id);
     }
     // Remove history when a user unlikes a discussion.
     if ($post->isQuestion() && !$isLike && $my->id != $post->user_id) {
         // Remove unlike
         DiscussHelper::getHelper('History')->removeLog('easydiscuss.like.discussion', $my->id, $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.unlike.discussion', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.unlike.discussion', $my->id);
     }
     // Remove history when a user unlikes a reply.
     if ($post->isReply() && !$isLike && $my->id != $post->user_id) {
         // Remove unlike
         DiscussHelper::getHelper('History')->removeLog('easydiscuss.like.reply', $my->id, $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.unlike.reply', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.unlike.reply', $my->id);
     }
     // Add notifications to the post owner.
     if ($post->user_id != $my->id) {
         $notification = DiscussHelper::getTable('Notifications');
         $text = $post->isQuestion() ? 'COM_EASYDISCUSS_LIKE_DISCUSSION_NOTIFICATION_TITLE' : 'COM_EASYDISCUSS_LIKE_REPLY_NOTIFICATION_TITLE';
         $title = $question->title;
         $likeType = $post->isQuestion() ? DISCUSS_NOTIFICATIONS_LIKES_DISCUSSION : DISCUSS_NOTIFICATIONS_LIKES_REPLIES;
         $notification->bind(array('title' => JText::sprintf($text, $title), 'cid' => $question->id, 'type' => $likeType, 'target' => $post->user_id, 'author' => $my->id, 'permalink' => 'index.php?option=com_easydiscuss&view=post&id=' . $question->id));
         $notification->store();
     }
     // Only send notification email if the post owner is a registered user.
     // And, it would not send email if the user that is liking on his own item.
     if ($post->user_id && $my->id != $post->user_id && $isLike && $config->get('notify_owner_like')) {
         // Send email to post / reply author that someone liked their post.
         $notify = DiscussHelper::getNotification();
         $profile = DiscussHelper::getTable('Profile');
         $profile->load($my->id);
         $emailSubject = JText::sprintf('COM_EASYDISCUSS_USER_LIKED_YOUR_POST', $profile->getName());
         $emailTemplate = 'email.like.post.php';
         $emailData = array();
         $emailData['authorName'] = $profile->getName();
         $emailData['authorAvatar'] = $profile->getAvatar();
//.........这里部分代码省略.........
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:view.ajax.php

示例5: notify

 /**
  * Notify the user when a new conversation is started or replied.
  *
  * @since	3.0
  * @access	public
  * @param	DiscussConversationMessage	The message object that is formatted
  *
  */
 public function notify(DiscussConversationMessage $message)
 {
     $author = DiscussHelper::getTable('Profile');
     $author->load($message->created_by);
     $model = DiscussHelper::getModel('Conversation');
     $result = $model->getParticipants($this->id, $message->created_by);
     $recipient = DiscussHelper::getTable('Profile');
     $recipient->load($result[0]);
     $emailData = array();
     $emailData['conversationLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=conversation&layout=read&id=' . $this->id, false, true);
     $emailData['authorName'] = $author->getName();
     $emailData['authorAvatar'] = $author->getAvatar();
     $emailData['content'] = $message->message;
     $subject = JText::sprintf('COM_EASYDISCUSS_CONVERSATION_EMAIL_SUBJECT', $author->getName());
     $notification = DiscussHelper::getNotification();
     $notification->addQueue($recipient->user->email, $subject, '', 'email.conversation.reply.php', $emailData);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:25,代码来源:conversation.php

示例6: ajaxSubmitReply


//.........这里部分代码省略.........
     $table->isVoted = 0;
     $table->total_vote_cnt = 0;
     $table->likesAuthor = '';
     $table->minimize = 0;
     if ($config->get('main_content_trigger_replies')) {
         $tempContent = $table->content;
         $table->content = str_replace('@', '@', $tempContent);
         // process content plugins
         DiscussEventsHelper::importPlugin('content');
         DiscussEventsHelper::onContentPrepare('reply', $table);
         $table->event = new stdClass();
         $results = DiscussEventsHelper::onContentBeforeDisplay('reply', $table);
         $table->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = DiscussEventsHelper::onContentAfterDisplay('reply', $table);
         $table->event->afterDisplayContent = trim(implode("\n", $results));
     }
     $tpl = new DiscussThemes();
     $category = DiscussHelper::getTable('Category');
     $category->load($question->category_id);
     $table->access = $table->getAccess($category);
     // Since the reply dont have any comments yet.
     $table->comments = array();
     $tpl->set('category', $category);
     $tpl->set('post', $table);
     $tpl->set('question', $parent);
     $tpl->set('isMine', DiscussHelper::isMine($parent->user_id));
     $tpl->set('isAdmin', DiscussHelper::isSiteAdmin());
     $tpl->set('isMainLocked', $isMainLocked);
     $recaptcha = '';
     $enableRecaptcha = $config->get('antispam_recaptcha', 0);
     $publicKey = $config->get('antispam_recaptcha_public');
     $html = $table->published == DISCUSS_ID_PENDING ? $tpl->fetch('post.reply.item.moderation.php') : $tpl->fetch('post.reply.item.php');
     //send notification to all comment's subscribers that want to receive notification immediately
     $notify = DiscussHelper::getNotification();
     $excludeEmails = array();
     $attachments = $table->getAttachments();
     $emailData['attachments'] = $attachments;
     $emailData['postTitle'] = $parent->title;
     $emailData['comment'] = DiscussHelper::parseContent($table->content);
     $emailData['commentAuthor'] = $my->id ? $creator->getName() : $table->poster_name;
     $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $parent->id, false, true);
     $emailContent = $table->content;
     $isEditing = $isNew == true ? false : true;
     $emailContent = DiscussHelper::bbcodeHtmlSwitcher($table, 'reply', $isEditing);
     $emailContent = $question->trimEmail($emailContent);
     $emailData['replyContent'] = $emailContent;
     $emailData['replyAuthor'] = $my->id ? $creator->getName() : $table->poster_name;
     $emailData['replyAuthorAvatar'] = $creator->getAvatar();
     $emailData['post_id'] = $parent->id;
     $emailData['cat_id'] = $parent->category_id;
     $subscriberEmails = array();
     if (($config->get('main_sitesubscription') || $config->get('main_postsubscription')) && $config->get('notify_subscriber') && $table->published == DISCUSS_ID_PUBLISHED) {
         $emailData['emailTemplate'] = 'email.subscription.reply.new.php';
         $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
         $posterEmail = $post['poster_email'] ? $post['poster_email'] : $my->email;
         // Get the emails of user who subscribe to this post only
         // This does not send to subscribers whom subscribe to site and category
         $subcribersEmails = DiscussHelper::getHelper('Mailer')->notifyThreadSubscribers($emailData, array($posterEmail, $my->email));
         $excludeEmails[] = $posterEmail;
         $excludeEmails = array_merge($excludeEmails, $subcribersEmails);
         $excludeEmails = array_unique($excludeEmails);
     }
     //notify post owner.
     $postOwnerId = $parent->user_id;
     $postOwner = JFactory::getUser($postOwnerId);
     $ownerEmail = $postOwner->email;
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:67,代码来源:view.ajax.php

示例7: replyNotifyUsers

 public function replyNotifyUsers($reply, $user, $senderName)
 {
     //send notification to all comment's subscribers that want to receive notification immediately
     $notify = DiscussHelper::getNotification();
     $emailData = array();
     $config = DiscussHelper::getConfig();
     $parent = DiscussHelper::getTable('Post');
     $parent->load($reply->parent_id);
     if ($reply->get('user_type') == DISCUSS_POSTER_GUEST) {
         $emailData['postAuthor'] = $senderName;
         $emailData['commentAuthor'] = $senderName;
         $emailData['replyAuthorAvatar'] = '';
     } else {
         $profile = DiscussHelper::getTable('Profile');
         $profile->load($user->id);
         $emailData['replyAuthor'] = $profile->getName();
         $emailData['commentAuthor'] = $profile->getName();
         $emailData['replyAuthorAvatar'] = $profile->getAvatar();
     }
     $emailContent = $reply->content;
     if ($reply->content_type != 'html') {
         // the content is bbcode. we need to parse it.
         $emailContent = EasyDiscussParser::bbcode($emailContent);
         $emailContent = EasyDiscussParser::removeBrTag($emailContent);
     }
     // If reply is html type we need to strip off html codes.
     if ($reply->content_type == 'html') {
         $emailContent = strip_tags($emailContent);
     }
     $emailContent = $parent->trimEmail($emailContent);
     $emailData['postTitle'] = $parent->title;
     $emailData['comment'] = $reply->content;
     $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $parent->id, false, true);
     $emailData['replyContent'] = $reply->content;
     $attachments = $reply->getAttachments();
     $emailData['attachments'] = $attachments;
     $excludeEmails = array();
     $subscriberEmails = array();
     if (($config->get('main_sitesubscription') || $config->get('main_postsubscription')) && $config->get('notify_subscriber') && $reply->published == DISCUSS_ID_PUBLISHED) {
         $emailData['emailTemplate'] = 'email.subscription.reply.new.php';
         $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
         $emailData['post_id'] = $parent->id;
         $emailData['cat_id'] = $parent->category_id;
         //$subcribersEmails = DiscussHelper::getHelper( 'Mailer' )->notifyThreadSubscribers( $emailData );
         //$excludeEmails		= array_merge( $excludeEmails, $subcribersEmails);
         // Notify all subscriber about new replies
         DiscussHelper::getHelper('Mailer')->notifySubscribers($emailData, $excludeEmails);
     }
     //notify post owner.
     $postOwnerId = $parent->user_id;
     $postOwner = JFactory::getUser($postOwnerId);
     $ownerEmail = $postOwner->email;
     if ($parent->user_type != 'member') {
         $ownerEmail = $parent->poster_email;
     }
     if ($config->get('notify_owner') && $reply->published == DISCUSS_ID_PUBLISHED && $postOwnerId != $user->id && !in_array($ownerEmail, $subscriberEmails) && !empty($ownerEmail)) {
         $emailData['owner_email'] = $ownerEmail;
         $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
         $emailData['emailTemplate'] = 'email.post.reply.new.php';
         DiscussHelper::getHelper('Mailer')->notifyThreadOwner($emailData);
         $excludeEmails[] = $ownerEmail;
     }
     // Notify Participants
     if ($config->get('notify_participants') && $table->published == DISCUSS_ID_PUBLISHED) {
         $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
         $emailData['emailTemplate'] = 'email.post.reply.new.php';
         DiscussHelper::getHelper('Mailer')->notifyThreadParticipants($emailData, $excludeEmails);
     }
     //if reply under moderation, send owner a notification.
     if ($reply->published == DISCUSS_ID_PENDING) {
         // Generate hashkeys to map this current request
         $hashkey = DiscussHelper::getTable('Hashkeys');
         $hashkey->uid = $reply->id;
         $hashkey->type = DISCUSS_REPLY_TYPE;
         $hashkey->store();
         $approveURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=approvePost&key=' . $hashkey->key);
         $rejectURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=rejectPost&key=' . $hashkey->key);
         $emailData['moderation'] = '<div style="display:inline-block;width:100%;padding:20px;border-top:1px solid #ccc;padding:20px 0 10px;margin-top:20px;line-height:19px;color:#555;font-family:\'Lucida Grande\',Tahoma,Arial;font-size:12px;text-align:left">';
         $emailData['moderation'] .= '<a href="' . $approveURL . '" style="display:inline-block;padding:5px 15px;background:#fc0;border:1px solid #caa200;border-bottom-color:#977900;color:#534200;text-shadow:0 1px 0 #ffe684;font-weight:bold;box-shadow:inset 0 1px 0 #ffe064;-moz-box-shadow:inset 0 1px 0 #ffe064;-webkit-box-shadow:inset 0 1px 0 #ffe064;border-radius:2px;moz-border-radius:2px;-webkit-border-radius:2px;text-decoration:none!important">' . JText::_('COM_EASYDISCUSS_EMAIL_APPROVE_REPLY') . '</a>';
         $emailData['moderation'] .= ' ' . JText::_('COM_EASYDISCUSS_OR') . ' <a href="' . $rejectURL . '" style="color:#477fda">' . JText::_('COM_EASYDISCUSS_REJECT') . '</a>';
         $emailData['moderation'] .= '</div>';
         $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_MODERATE', $parent->title);
         $emailData['emailTemplate'] = 'email.post.reply.moderation.php';
         DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array(), $config->get('notify_admin'), $config->get('notify_moderator'));
     } elseif ($table->published == DISCUSS_ID_PUBLISHED) {
         $emailData['emailTemplate'] = 'email.post.reply.new.php';
         $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
         $emailData['post_id'] = $parent->id;
         DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array(), $config->get('notify_admin_onreply'), $config->get('notify_moderator_onreply'));
     }
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:91,代码来源:mailqueue.php

示例8: save


//.........这里部分代码省略.........
     $durationObj->daydiff = 0;
     $durationObj->timediff = '00:00:01';
     $comment->duration = DiscussHelper::getDurationString($durationObj);
     // Set the comment creator.
     $comment->creator = $profile;
     // Try to detect if the comment is posted to the main question or a reply.
     $liveNotificationText = '';
     if ($post->parent_id) {
         $question = DiscussHelper::getTable('Post');
         $question->load($post->parent_id);
         $liveNotificationText = 'COM_EASYDISCUSS_COMMENT_REPLY_NOTIFICATION_TITLE';
     } else {
         $question = DiscussHelper::getTable('Post');
         $question->load($id);
         $liveNotificationText = 'COM_EASYDISCUSS_COMMENT_QUESTION_NOTIFICATION_TITLE';
     }
     // Create notification item in EasySocial
     DiscussHelper::getHelper('EasySocial')->notify('new.comment', $post, $question, $comment);
     if ($comment->published && !$question->private) {
         // AUP integrations
         DiscussHelper::getHelper('Aup')->assign(DISCUSS_POINTS_NEW_COMMENT, $comment->user_id, '');
         // jomsocial activity stream
         DiscussHelper::getHelper('jomsocial')->addActivityComment($post, $question);
         DiscussHelper::getHelper('easysocial')->commentDiscussionStream($comment, $post, $question);
     }
     // Add notification to the post owner.
     if ($post->user_id != $my->id && $comment->published && $config->get('main_notifications_comments')) {
         $notification = DiscussHelper::getTable('Notifications');
         $notification->bind(array('title' => JText::sprintf($liveNotificationText, $question->title), 'cid' => $question->id, 'type' => DISCUSS_NOTIFICATIONS_COMMENT, 'target' => $post->user_id, 'author' => $my->id, 'permalink' => 'index.php?option=com_easydiscuss&view=post&id=' . $question->id));
         $notification->store();
     }
     // Try to assign badge and points to the current user.
     // Only assign points and badge when they are commenting a post that are not posted by them
     //	if( $my->id != $post->user_id )
     //	{
     // Add logging for user.
     DiscussHelper::getHelper('History')->log('easydiscuss.new.comment', $my->id, JText::_('COM_EASYDISCUSS_BADGES_HISTORY_NEW_COMMENT'), $post->id);
     // Assign badge for EasySocial
     DiscussHelper::getHelper('EasySocial')->assignBadge('create.comment', $my->id, JText::_('COM_EASYDISCUSS_BADGES_HISTORY_NEW_COMMENT'));
     DiscussHelper::getHelper('Badges')->assign('easydiscuss.new.comment', $my->id);
     DiscussHelper::getHelper('Points')->assign('easydiscuss.new.comment', $my->id, $comment);
     //	}
     // Apply badword filtering for the comment.
     $comment->comment = DiscussHelper::wordFilter($comment->comment);
     $emailData = array();
     $emailData['commentContent'] = $comment->comment;
     $emailData['commentAuthor'] = $profile->getName();
     $emailData['commentAuthorAvatar'] = $profile->getAvatar();
     $emailData['postTitle'] = $question->title;
     $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $question->id, false, true);
     $emails = array();
     // Send email to the post owner only if the commenter is not the post owner.
     if ($post->user_id != 0 && $post->id != $my->id) {
         $user = JFactory::getUser($post->user_id);
         $emails[] = $user->email;
     }
     // Retrieve the list of user emails from the list of comments made on the post.
     $existingComments = $post->getComments();
     if ($existingComments) {
         foreach ($existingComments as $existingComment) {
             // Only add the email when the user id is not the current logged in user who is posting the comment.
             // It should not send email to the post owner as well since the post owner will already get a notification.
             if ($existingComment->user_id != 0 && $existingComment->user_id != $my->id && $existingComment->user_id != $post->user_id) {
                 $user = JFactory::getUser($existingComment->user_id);
                 $emails[] = $user->email;
             }
         }
     }
     // Ensure the emails are all unique.
     $emails = array_unique($emails);
     // Only send email when email is not empty.
     if (!empty($emails)) {
         $notify = DiscussHelper::getNotification();
         $notify->addQueue($emails, JText::sprintf('COM_EASYDISCUSS_EMAIL_TITLE_NEW_COMMENT', JString::substr($question->content, 0, 15)) . '...', '', 'email.post.comment.new.php', $emailData);
     }
     //revert the comment form
     // $ajax->script('discuss.comment.cancel()');
     // Process comment triggers.
     if ($config->get('main_content_trigger_comments')) {
         $comment->content = $comment->comment;
         // process content plugins
         DiscussEventsHelper::importPlugin('content');
         DiscussEventsHelper::onContentPrepare('comment', $comment);
         $comment->event = new stdClass();
         $results = DiscussEventsHelper::onContentBeforeDisplay('comment', $comment);
         $comment->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = DiscussEventsHelper::onContentAfterDisplay('comment', $comment);
         $comment->event->afterDisplayContent = trim(implode("\n", $results));
         $comment->comment = $comment->content;
     }
     // Get the parent post post id
     $postId = $post->parent_id ? $post->parent_id : $post->id;
     // Get the result of the posted comment.
     $theme = new DiscussThemes();
     $theme->set('comment', $comment);
     $theme->set('postId', $postId);
     $output = $theme->fetch('post.reply.comment.item.php');
     $ajax->resolve($output);
     return $ajax->send();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:view.ajax.php

示例9: submit


//.........这里部分代码省略.........
                 $pollItemsOri = JRequest::getVar('pollitemsOri');
                 // Store the polls now.
                 $post->bindPolls($isNew, $pollItems, $removePolls, $multiplePolls, $pollQuestion, $pollItemsOri);
             }
         }
     }
     // Bind file attachments
     if ($acl->allowed('add_attachment') && $config->get('attachment_questions')) {
         $post->bindAttachments();
     }
     // Detect if the current post should be moderated or not.
     $isModerate = $post->published == DISCUSS_ID_PENDING ? true : false;
     // Process auto posting for posts that are really published and is in a public category.
     if ($post->published == DISCUSS_ID_PUBLISHED && $category->canPublicAccess()) {
         $post->autopost();
     }
     // Detect known names in the post.
     $names = DiscussHelper::getHelper('String')->detectNames($post->content);
     if ($names) {
         foreach ($names as $name) {
             $name = JString::str_ireplace('@', '', $name);
             $id = DiscussHelper::getUserId($name);
             if (!$id || $id == $post->get('user_id')) {
                 continue;
             }
             $notification = DiscussHelper::getTable('Notifications');
             $notification->bind(array('title' => JText::sprintf('COM_EASYDISCUSS_MENTIONED_QUESTION_NOTIFICATION_TITLE', $post->get('title')), 'cid' => $post->get('id'), 'type' => DISCUSS_NOTIFICATIONS_MENTIONED, 'target' => $id, 'author' => $post->get('user_id'), 'permalink' => 'index.php?option=com_easydiscuss&view=post&id=' . $post->get('id')));
             $notification->store();
         }
     }
     if (($isNew || $prevPostStatus == DISCUSS_ID_PENDING) && $post->published == DISCUSS_ID_PUBLISHED) {
         $post->ping();
     }
     $notify = DiscussHelper::getNotification();
     // badwords filtering for email data.
     $post->title = DiscussHelper::wordFilter($post->title);
     $post->content = DiscussHelper::wordFilter($post->content);
     if ($acl->allowed('add_tag', '0')) {
         //@task: Save tags
         $postTagModel = $this->getModel('PostsTags');
         $tags = JRequest::getVar('tags', '', 'POST');
         if (!empty($tags)) {
             $tagModel = $this->getModel('Tags');
             foreach ($tags as $tag) {
                 if (!empty($tag)) {
                     $tagTable = DiscussHelper::getTable('Tags');
                     //@task: Only add tags if it doesn't exist.
                     if (!$tagTable->exists($tag)) {
                         $tagTable->set('title', JString::trim($tag));
                         $tagTable->set('alias', DiscussHelper::getAlias($tag, 'tag'));
                         $tagTable->set('created', DiscussHelper::getDate()->toMySQL());
                         $tagTable->set('published', 1);
                         $tagTable->set('user_id', $my->id);
                         $tagTable->store();
                     } else {
                         $tagTable->load($tag, true);
                     }
                     $postTagInfo = array();
                     //@task: Store in the post tag
                     $postTagTable = DiscussHelper::getTable('PostsTags');
                     $postTagInfo['post_id'] = $post->id;
                     $postTagInfo['tag_id'] = $tagTable->id;
                     $postTagTable->bind($postTagInfo);
                     $postTagTable->store();
                 }
             }
开发者ID:pguilford,项目名称:vcomcc,代码行数:67,代码来源:posts.php


注:本文中的DiscussHelper::getNotification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。