public function sendModerationEmail() { // @rule: Send email to the team admin's. $team = EasyBlogHelper::getTable('TeamBlog'); $team->load($this->team_id); $notification = EasyBlogHelper::getHelper('Notification'); $emails = array(); $config = EasyBlogHelper::getConfig(); if ($config->get('custom_email_as_admin')) { $notification->getCustomEmails($emails); } else { $notification->getAdminEmails($emails); } $notification->getTeamAdminEmails($emails, $team->id); $user = EasyBlogHelper::getTable('Profile'); $user->load($this->user_id); $date = EasyBlogDateHelper::dateWithOffSet($this->created); if (count($emails) > 0) { $data = array('teamName' => $team->title, 'authorAvatar' => $user->getAvatar(), 'authorLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $user->id, false, true), 'authorName' => $user->getName(), 'requestDate' => EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'), 'reviewLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=dashboard&layout=teamblogs', false, true)); // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls. $sh404exists = EasyBlogRouter::isSh404Enabled(); if (JFactory::getApplication()->isAdmin() && $sh404exists) { $data['authorLink'] = JURI::root() . 'index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $user->id; $data['reviewLink'] = JURI::root() . 'index.php?option=com_easyblog&view=dashboard&layout=teamblogs'; } $emailTitle = JText::_('COM_EASYBLOG_TEAMBLOG_NEW_REQUEST'); $notification->send($emails, $emailTitle, 'email.teamblog.request', $data); } }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.tag', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); // Render modal JHTML::_('behavior.modal'); $tagId = JRequest::getVar('tagid', ''); $tag = EasyBlogHelper::getTable('Tag', 'Table'); $tag->load($tagId); $tag->title = JString::trim($tag->title); $tag->alias = JString::trim($tag->alias); $this->tag = $tag; // Set default values for new entries. if (empty($tag->created)) { $date = EasyBlogDateHelper::getDate(); $now = EasyBlogDateHelper::toFormat($date); $tag->created = $now; $tag->published = true; } $this->assignRef('my', $user); $this->assignRef('tag', $tag); parent::display($tpl); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.comment', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); //Load pane behavior jimport('joomla.html.pane'); $commentId = JRequest::getVar('commentid', ''); $comment = EasyBlogHelper::getTable('Comment', 'Table'); $comment->load($commentId); $this->comment = $comment; // Set default values for new entries. if (empty($comment->created)) { $date = EasyBlogDateHelper::getDate(); $now = EasyBlogDateHelper::toFormat($date); $comment->created = $now; $comment->published = true; } $this->assignRef('comment', $comment); parent::display($tpl); }
function updateDisplayDate($eleId, $dateString) { $ajax = new Ejax(); $config = EasyBlogHelper::getConfig(); $date = EasyBlogHelper::getDate($dateString); $now = EasyBlogDateHelper::toFormat($date, $config->get('layout_dateformat')); $ajax->assign('datetime_' . $eleId . ' .datetime_caption', $now); return $ajax->send(); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.category', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $config = EasyBlogHelper::getConfig(); $acl = EasyBlogACLHelper::getRuleSet(); //Load pane behavior jimport('joomla.html.pane'); $catId = JRequest::getVar('catid', ''); $cat = EasyBlogHelper::getTable('Category', 'Table'); $cat->load($catId); $this->cat = $cat; // Set default values for new entries. if (empty($cat->created)) { $date = EasyBlogDateHelper::getDate(); $now = EasyBlogDateHelper::toFormat($date); $cat->created = $now; $cat->published = true; } $catRuleItems = EasyBlogHelper::getTable('CategoryAclItem', 'Table'); $categoryRules = $catRuleItems->getAllRuleItems(); $assignedACL = $cat->getAssignedACL(); $parentList = EasyBlogHelper::populateCategories('', '', 'select', 'parent_id', $cat->parent_id, false, false, false, array($cat->id)); $editor = JFactory::getEditor($config->get('layout_editor')); $this->assignRef('editor', $editor); $this->assignRef('cat', $cat); $this->assignRef('config', $config); $this->assignRef('acl', $acl); $this->assignRef('parentList', $parentList); $this->assignRef('categoryRules', $categoryRules); $this->assignRef('assignedACL', $assignedACL); parent::display($tpl); }
public function notify(EasyBlogTableBlog $blog) { $config = EasyBlogHelper::getConfig(); // Send notification to site admins when a new blog post is reported $data = array(); $data['blogTitle'] = $blog->title; $data['blogLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true); // @rule: Send email notifications out to subscribers. $author = EasyBlogHelper::getTable('Profile'); $author->load($this->created_by); $data['reporterAvatar'] = $author->getAvatar(); $data['reporterName'] = $author->getName(); $data['reporterLink'] = $author->getProfileLink(); $data['reason'] = $this->reason; $date = EasyBlogDateHelper::dateWithOffSet($this->created); $data['reportDate'] = EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'); // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls. $sh404exists = EasyBlogRouter::isSh404Enabled(); if (JFactory::getApplication()->isAdmin() && $sh404exists) { $data['blogLink'] = JURI::root() . 'index.php?option=com_easyblog&view=entry&id=' . $blog->id; } $emailBlogTitle = JString::substr($blog->title, 0, $config->get('main_mailtitle_length')); $emailTitle = JText::sprintf('COM_EASYBLOG_EMAIL_TITLE_NEW_REPORT', $emailBlogTitle) . ' ...'; $notification = EasyBlogHelper::getHelper('Notification'); $emails = array(); // @rule: Fetch custom emails defined at the back end. if ($config->get('notification_blogadmin')) { if ($config->get('custom_email_as_admin')) { $notification->getCustomEmails($emails); } else { $notification->getAdminEmails($emails); } } if (!empty($emails)) { $notification->send($emails, $emailTitle, 'email.blog.report', $data); } }
?> </div> <?php } ?> --> <div class="comment-content"> <!-- <div class="comment-head prel"> <i class="comment-arrow pabs"></i> <span class="comment-name"><b><?php echo $my->displayName; ?> </b></span> <span class="comment-date"><?php echo EasyBlogDateHelper::toFormat(EasyBlogDateHelper::dateWithOffSet(), $config->get('layout_dateformat', '%A, %d %B %Y')); ?> </span> </div> --> <div class="comment-body prel"> <i class="comment-arrow pabs"></i> <?php // if($canRegister && $my->id == 0){ ?> <!--<div class="form-row mtm"> <label class="label"><?php echo JText::_('COM_EASYBLOG_FILL_IN_USERNAME_AND_FULLNAME_TO_REGISTER'); ?> </label>
echo JText::_('COM_EASYBLOG_BLOGS_BLOG_UNPUBLISHING_DATE_DESC'); ?> </div> <?php $notEmpty = true; if ($this->blog->publish_down == "0000-00-00 00:00:00" || empty($this->blog->publish_down)) { $newDate = EasyBlogDateHelper::getDate($this->blog->publish_down); $now = ''; $displaynow = ''; $nowReset = EasyBlogDateHelper::toFormat($newDate); $notEmpty = false; } else { $newDate = EasyBlogDateHelper::getDate($this->blog->publish_down); $now = EasyBlogDateHelper::toFormat($newDate); $nowReset = EasyBlogDateHelper::toFormat($newDate); $displaynow = EasyBlogDateHelper::toFormat($newDate, $this->config->get('layout_dateformat')); $notEmpty = true; } echo EasyBlogHelper::dateTimePicker('publish_down', $notEmpty ? $displaynow : JText::_('COM_EASYBLOG_NEVER'), $notEmpty ? $now : '', true); ?> <input type="hidden" name="publish_down_reset" id="publish_down_reset" value="<?php echo $nowReset; ?> "/> <input type="hidden" name="publish_down_ori" id="publish_down_ori" value="<?php echo $this->blog->publish_down; ?> "/> </div> </div> </li>
* See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); $url = rtrim(JURI::base(), '/'); ?> <h1><a href="<?php echo $url . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id); ?> "><?php echo $blog->title; ?> </a></h1> <?php $date = EasyBlogDateHelper::dateWithOffSet($blog->created); $postdate = EasyBlogDateHelper::toFormat($date, $config->get('layout_shortdateformat', '%b %d')); ?> <p class="meta-bottom"> <?php echo JText::_('COM_EASYBLOG_POSTED_ON'); ?> <?php echo $postdate; ?> , <?php echo JText::sprintf('COM_EASYBLOG_POSTED_BY_AUTHOR', $url . $blogger->getProfileLink(), $blogger->displayName); echo JText::_('COM_EASYBLOG_CATEGORY'); ?> <a href="<?php echo $url . EasyBlogRouter::_('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $blog->category_id);
</a> </td> <td align="center"> <span class="editlinktip hasTip"> <a href="<?php echo JRoute::_('index.php?option=com_easyblog&c=user&id=' . $row->created_by . '&task=edit'); ?> "><?php echo $user->name; ?> </a> </span> </td> <td align="center"> <?php echo EasyBlogDateHelper::toFormat($date); ?> </td> <td align="center"> <?php echo $row->id; ?> </td> </tr> <?php $k = 1 - $k; } ?> <?php
echo "row{$k}"; ?> "> <td valign="top" class="item-data"> <?php echo $entry->title; ?> </td> <td valign="top"> <?php echo $user->getName(); ?> </td> <td> <?php echo EasyBlogDateHelper::toFormat($created, $this->config->get('layout_dateformat', '%A, %d %B %Y')); ?> </td> <td style="text-align: center;"> <div class="item_actions" id="eblog-comment-toolbar<?php echo $entry->id; ?> "> <a href="<?php echo JRoute::_('index.php?option=com_easyblog&c=teamblogs&task=teamApproval&id=' . $entry->id . '&team=' . $entry->team_id . '&approve=1&' . EasyBlogHelper::getToken() . '=1'); ?> " class="text-green"><?php echo JText::_('COM_EASYBLOG_TEAMBLOGS_APPROVE_REQUEST'); ?> </a> | <a href="<?php
public function getDate($item) { $config = EasyBlogHelper::getConfig(); return EasyBlogDateHelper::toFormat(JFactory::getDate($item->created), $config->get('layout_dateformat', '%A, %d %B %Y')); }
// @rule: Process videos $row->intro = EasyBlogHelper::getHelper('Videos')->strip($row->intro); $row->content = EasyBlogHelper::getHelper('Videos')->strip($row->content); // @rule: Remove gallery codes $row->intro = EasyBlogHelper::getHelper('Gallery')->strip($row->intro); $row->content = EasyBlogHelper::getHelper('Gallery')->strip($row->content); // Process jomsocial albums $row->intro = EasyBlogHelper::getHelper('Album')->strip($row->intro); $row->content = EasyBlogHelper::getHelper('Album')->strip($row->content); //remove zemanta tags $row->intro = EasyBlogHelper::removeZemantaTags($row->intro); $row->content = EasyBlogHelper::removeZemantaTags($row->content); // Remove adsense codes require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'adsense.php'; $row->intro = EasyBlogGoogleAdsense::stripAdsenseCode($row->intro); $row->content = EasyBlogGoogleAdsense::stripAdsenseCode($row->content); JTable::addIncludePath(EBLOG_TABLES); $author = EasyBlogHelper::getTable('Profile', 'Table'); $author->load($row->created_by); $row->author = $author; $row->date = EasyBlogDateHelper::toFormat(EasyBlogHelper::getDate($row->created), $config->get('layout_dateformat', '%A, %d %B %Y')); $items[] = $row; } // If needed, shuffle the entries if ($params->get('autoshuffle')) { shuffle($items); } // Should we display the ratings. $disabled = $params->get('enableratings') ? false : true; $contentKey = $params->get('contentfrom', 'content'); require JModuleHelper::getLayoutPath('mod_showcase');
public function processEmails($isModerated = false, $blog) { $config = EasyBlogHelper::getConfig(); // @task: Fix contents of comments. $content = $this->comment; // $content = nl2br( $this->comment ); // $content = EasyBlogCommentHelper::parseBBCode( $content ); // Initialize what we need $commentAuthor = $this->name; $commentAuthorEmail = $this->email; $commentAuthorAvatar = JURI::root() . 'components/com_easyblog/assets/images/default_blogger.png'; $date = EasyBlogDateHelper::dateWithOffSet($this->created); $commentDate = EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'); $teamLink = ''; $emails = array(); if (isset($blog->team)) { $teamLink = '&team=' . $blog->team; } if ($this->created_by != 0) { $user = EasyBlogHelper::getTable('Profile'); $user->load($this->created_by); $commentAuthor = $user->getName(); $commentAuthorEmail = $user->user->email; $commentAuthorAvatar = $user->getAvatar(); } $blogAuthor = EasyBlogHelper::getTable('Profile'); $blogAuthor->load($blog->created_by); $data = array('blogTitle' => $blog->title, 'blogIntro' => $blog->intro, 'blogContent' => $blog->content, 'blogLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry' . $teamLink . '&id=' . $blog->id, false, true), 'commentTitle' => empty($comment->title) ? '-' : $comment->title, 'commentContent' => $content, 'commentAuthor' => $commentAuthor, 'commentAuthorAvatar' => $commentAuthorAvatar, 'commentDate' => $commentDate, 'commentLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry' . $teamLink . '&id=' . $blog->id, false, true) . '#comment-' . $this->id); $emails = array(); $notification = EasyBlogHelper::getHelper('Notification'); if ($isModerated) { $hashkey = EasyBlogHelper::getTable('HashKeys'); $hashkey->uid = $this->id; $hashkey->type = 'comments'; $hashkey->store(); $data['approveLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&controller=dashboard&task=approvecomment&key=' . $hashkey->key, false, true); $notification->getCustomEmails($emails); $notification->getAdminEmails($emails); $notification->send($emails, JText::_('COM_EASYBLOG_NEW_COMMENT_ADDED_MODERATED_TITLE'), 'email.comment.moderate', $data); return true; } if (!$isModerated) { if ($config->get('notification_commentadmin')) { if ($config->get('custom_email_as_admin')) { $notification->getCustomEmails($emails); } else { $notification->getAdminEmails($emails); } } // @rule: Send notification to blog authors. if ($config->get('notification_commentauthor')) { $obj = new stdClass(); $obj->unsubscribe = false; $obj->email = $blogAuthor->user->email; $emails[$blogAuthor->user->email] = $obj; } // @rule: Send notifications to blog subscribers if ($config->get('main_subscription') && $blog->subscription == '1' && $config->get('notification_commentsubscriber')) { $notification->getBlogSubscriberEmails($emails, $blog->id); } // @rule: Do not send to the person that commented on the blog post. unset($emails[$commentAuthorEmail]); // @rule: Send the emails now. if (!empty($emails)) { $emailTitle = JText::_('COM_EASYBLOG_NEW_COMMENT_ADDED'); if ($config->get('main_comment_email')) { $emailTitle = '[#' . $this->id . ']: ' . $emailTitle; } $notification->send($emails, $emailTitle, 'email.comment.new', $data); } return true; } }
private function sendNotificationsJomsocial($blog, $isNew, $uid, $source, $author) { JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); $config = EasyBlogHelper::getConfig(); // @rule: Send email notifications out to subscribers. $author = EasyBlogHelper::getTable('Profile'); $author->load($blog->created_by); $data['blogTitle'] = $blog->title; $data['blogAuthor'] = $author->getName(); $data['blogAuthorAvatar'] = $author->getAvatar(); $data['blogAuthorLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id, false, true); $data['blogAuthorEmail'] = $author->user->email; $data['blogIntro'] = $blog->intro; $data['blogContent'] = $blog->content; $data['blogLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true); $date = EasyBlogDateHelper::dateWithOffSet($blog->created); $data['blogDate'] = EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'); // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls. $sh404exists = EasyBlogRouter::isSh404Enabled(); if (JFactory::getApplication()->isAdmin() && $sh404exists) { $data['blogLink'] = JURI::root() . 'index.php?option=com_easyblog&view=entry&id=' . $blog->id; $data['blogAuthorLink'] = JURI::root() . 'index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id; } if (is_array($uid)) { $uid = $uid[0]; } JTable::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'tables'); $event = JTable::getInstance('Event', 'CTable'); $event->load($uid); $members = $event->getMembers(1, 99999); $emails = array(); $jsCoreFile = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php'; foreach ($members as $member) { $user = CFactory::getUser($member->id); // Do not send email to the author. if ($author->user->email != $user->email) { $obj = new stdClass(); $obj->email = $user->email; $emails[] = $obj; } } $notification = EasyBlogHelper::getHelper('Notification'); $emailBlogTitle = JString::substr($blog->title, 0, $config->get('main_mailtitle_length')); $emailTitle = JText::sprintf('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_ADDED_WITH_TITLE', $emailBlogTitle) . ' ...'; $notification->send($emails, $emailTitle, 'email.blog.new', $data); }
function formatDate($format, $dateString) { $date = EasyBlogDateHelper::dateWithOffSet($dateString); return EasyBlogDateHelper::toFormat($date, $format); }
<i class="comment-arrow pabs"></i> <span class="comment-author"> <?php $commentAuthor = $comment->created_by != 0 ? $comment->poster->getName() : $comment->name; if (!empty($comment->url)) { $commentAuthor = EasyBlogHelper::getHelper('String')->htmlAnchorLink($comment->url, $commentAuthor); } ?> <b><?php echo $commentAuthor; ?> </b> </span> <span class="comment-date"> <?php echo EasyBlogDateHelper::toFormat($created, 'd.m.Y'); ?> </span> <span class="comment-action small fsm float-r"> <?php if (($this->acl->rules->manage_comment || ($my->id == $comment->created_by && $this->acl->rules->edit_comment || $system->admin)) && $my->id != 0) { ?> <a href="javascript:eblog.comments.edit( '<?php echo $comment->id; ?> ' );"><?php echo JText::_('COM_EASYBLOG_COMMENT_EDIT'); ?> </a>
<div class="ui-content"> <div class="ui-comment-meta mbs"> <?php $blogLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $comment->post_id); $blogTitle = $comment->blog_title; $profileLink = '#'; if ($comment->created_by != 0) { $commentor = EasyBlogHelper::getTable('Profile', 'Table'); $commentor->load($comment->created_by); $profileLink = $commentor->getProfileLink(); $submitterName = $commentor->getName(); } else { $submitterName = $comment->name; } $submitterLink = $profileLink; $dateSubmitted = EasyBlogDateHelper::toFormat(EasyBlogDateHelper::dateWithOffSet($comment->created), $system->config->get('layout_dateformat', '%A, %d %B %Y')); echo JText::sprintf('COM_EASYBLOG_DASHBOARD_COMMENTS_COMMENTED_ON_BLOG', '<b>' . $submitterName . '</b>', $blogLink, $blogTitle); ?> </div> <div class="ui-item-content" id="comment-content-<?php echo $comment->id; ?> "> <?php if (!empty($comment->title)) { ?> <b class="ui-comment-title"> <?php $commentLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $comment->post_id . '#comment-' . $comment->id); $commentTitle = !empty($comment->title) ? $comment->title : JText::_('COM_EASYBLOG_COMMENT_NO_TITLE'); echo JText::sprintf('COM_EASYBLOG_DASHBOARD_COMMENTS_COMMENT_TITLE', $commentLink, $commentTitle);
public function store($updateNulls = false) { $state = parent::store(); // @rule: Process notifications for admins when the blog post is pending approvals if ($this->pending_approval) { $user = EasyBlogHelper::getTable('Profile'); $user->load($this->created_by); $date = EasyBlogDateHelper::dateWithOffSet($this->created); $data = array('blogTitle' => $this->title, 'blogAuthor' => $user->getName(), 'blogAuthorLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $user->id, false, true), 'blogIntro' => $this->intro, 'blogContent' => $this->content, 'blogAuthorAvatar' => $user->getAvatar(), 'blogDate' => EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'), 'reviewLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=dashboard&layout=pending&draft_id=' . $this->id, false, true)); // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls. $sh404exists = EasyBlogRouter::isSh404Enabled(); if (JFactory::getApplication()->isAdmin() && $sh404exists) { $data['blogAuthorLink'] = JURI::root() . 'index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $user->id; $data['reviewLink'] = JURI::root() . 'index.php?option=com_easyblog&view=dashboard&layout=pending&draft_id' . $this->id; } $emailTitle = JText::_('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_PENDING_REVIEW'); $emails = array(); $notification = EasyBlogHelper::getHelper('Notification'); $config = EasyBlogHelper::getConfig(); // @rule: if custom_email_as_admin is enabled, use custom email as admin email if ($config->get('custom_email_as_admin')) { // @rule: Send to custom email addresses $notification->getCustomEmails($emails); } else { // @rule: Send to administrator's on the site. $notification->getAdminEmails($emails); } $notification->send($emails, $emailTitle, 'email.blog.review', $data); } return $state; }
?> :</label> <div> <?php $notEmpty = true; if ($blog->publish_down == "0000-00-00 00:00:00" || empty($blog->publish_down)) { $newDate = EasyBlogDateHelper::getDate(); $now = ''; $displaynow = ''; $nowReset = EasyBlogDateHelper::toFormat($newDate); $notEmpty = false; } else { $newDate = EasyBlogDateHelper::getDate($blog->publish_down); $now = EasyBlogDateHelper::toFormat($newDate); $displaynow = EasyBlogDateHelper::toFormat($newDate, $system->config->get('layout_dateformat')); $nowReset = EasyBlogDateHelper::toFormat($newDate); $notEmpty = true; } echo EasyBlogHelper::dateTimePicker('publish_down', $notEmpty ? $displaynow : JText::_('COM_EASYBLOG_NEVER'), $now, true); ?> <input type="hidden" name="publish_down_reset" id="publish_down_reset" value="<?php echo $nowReset; ?> "/> <input type="hidden" name="publish_down_ori" id="publish_down_ori" value="<?php echo $blog->publish_down; ?> "/> </div> </li>
public function notify($underApproval = false) { if (empty($this->send_notification_emails)) { return; } // @rule: Send email notifications out to subscribers. $author = EasyBlogHelper::getTable('Profile'); $author->load($this->created_by); $data['blogTitle'] = $this->title; $data['blogAuthor'] = $author->getName(); $data['blogAuthorAvatar'] = $author->getAvatar(); $data['blogAuthorLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id, false, true); $data['blogAuthorEmail'] = $author->user->email; $data['blogIntro'] = $this->intro; $data['blogContent'] = $this->content; // Try to truncate introtext based on the configured settings because content is empty. if (empty($this->content)) { $obj = clone $this; $obj->readmore = EasyBlogHelper::requireReadmore($obj); EasyBlogHelper::truncateContent($obj, false, true); $data['blogIntro'] = $obj->text; } $data['blogLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $this->id, false, true); $date = EasyBlogDateHelper::dateWithOffSet($this->created); $data['blogDate'] = EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'); // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls. $sh404exists = EasyBlogRouter::isSh404Enabled(); if (JFactory::getApplication()->isAdmin() && $sh404exists) { $data['blogLink'] = JURI::root() . 'index.php?option=com_easyblog&view=entry&id=' . $this->id; $data['blogAuthorLink'] = JURI::root() . 'index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id; } $config = EasyBlogHelper::getConfig(); $emailBlogTitle = JString::substr($this->title, 0, $config->get('main_mailtitle_length')); $emailTitle = JText::sprintf('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_ADDED_WITH_TITLE', $emailBlogTitle) . ' ...'; $notification = EasyBlogHelper::getHelper('Notification'); $emails = array(); // @rule: Fetch custom emails defined at the back end. if ($config->get('notification_blogadmin')) { if ($config->get('custom_email_as_admin')) { $notification->getCustomEmails($emails); } else { $notification->getAdminEmails($emails); } } // @task: If this blog post is a team posting, we shouldn't send notification to everyone. $model = JModel::getInstance('TeamBlogs', 'EasyBlogModel'); $contribution = $model->getBlogContributed($this->id); if ($contribution) { $team = EasyBlogHelper::getTable('TeamBlog'); $team->load($contribution->team_id); $contribution->access = $team->access; } else { $contribution = new stdClass(); $contribution->access = EBLOG_TEAMBLOG_ACCESS_EVERYONE; } // @task: This is when this blog post is posted into a team. if ($contribution && $config->get('notification_teamsubscriber') && isset($contribution->team_id)) { // @task: Send emails to users who is a member of the team $notification->getTeamUserEmails($emails, $contribution->team_id); // @task: Send emails to users who have subscribed to the team $notification->getTeamSubscriberEmails($emails, $this); } // @task: Only send emails to these group of users provided that, it is not a team posting or private team posting. if (!$contribution || $contribution->access != EBLOG_TEAMBLOG_ACCESS_MEMBER) { // @rule: Get all email addresses for the whole site. if ($config->get('notification_allmembers')) { $notification->getAllEmails($emails); } else { // @rule: Send to subscribers that subscribe to the bloggers if ($config->get('notification_blogsubscriber')) { $notification->getBloggerSubscriberEmails($emails, $this); } // @rule: Send to subscribers that subscribed to the category if ($config->get('notification_categorysubscriber')) { $notification->getCategorySubscriberEmails($emails, $this); } // @rule: Send notification to all site's subscribers if ($config->get('notification_sitesubscriber')) { $notification->getSiteSubscriberEmails($emails, $this); } } } // @rule: We need to remove the email of the creator since the creator of this blog post should not receive the email. if (isset($emails[$author->user->email])) { unset($emails[$author->user->email]); } // @task: Add the emails into the mail queue now. if (!empty($emails)) { $notification->send($emails, $emailTitle, 'email.blog.new', $data); } // @task: If this blog post is under approval, we need to send email to the site admin if ($underApproval) { // We know that this blog post requires moderation. Send notification to the author and let them know, that it is being moderated. $authorEmail = array(); $obj = new stdClass(); $obj->unsubscribe = false; $obj->email = $author->user->email; $authorEmail[$author->user->email] = $obj; $notification->send($authorEmail, JText::_('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_APPROVED'), 'email.blog.approved', $data); } }
public function submitForm($type, $post) { $ejax = new Ejax(); $mainframe = JFactory::getApplication(); $my = JFactory::getUser(); $config = EasyBlogHelper::getConfig(); $acl = EasyBlogACLHelper::getRuleSet(); $id = isset($post['id']) ? $post['id'] : ''; if (empty($acl->rules->allow_subscription) && (empty($my->id) && !$config->get('main_allowguestsubscribe'))) { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_NO_PERMISSION_TO_SUBSCRIBE_BLOG')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } $isModerate = false; $userId = isset($post['userid']) ? $post['userid'] : ''; $email = JString::trim($post['email']); //registration $register = isset($post['esregister']) ? true : false; $fullname = isset($post['esfullname']) ? $post['esfullname'] : ''; $username = isset($post['esusername']) ? $post['esusername'] : ''; $newId = ''; $msg = ''; if (JString::trim($email) == '') { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_EMAIL_EMPTY_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } else { if (!EasyBlogHelper::getHelper('Email')->isValidInetAddress($email)) { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_EMAIL_INVALID_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } } if (JString::trim($fullname) == '') { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_NAME_EMPTY_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } if ($register && $my->id == 0) { if (JString::trim($username) == '') { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_USERNAME_EMPTY_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } $registor = EasyBlogHelper::getRegistor(); $options = array('username' => $username, 'email' => $email); $validate = $registor->validate($options); if ($validate !== true) { $theme = new CodeThemes(); $theme->set('message', $validate); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } else { $options['fullname'] = $fullname; $newId = $registor->addUser($options); if (!is_numeric($newId)) { // registration failed. $msg = $newId; } else { $userId = $newId; } } } // Real logic operation goes here. $method = 'subscribe' . ucfirst($type); // @rule: Process mailchimp subscriptions here. EasyBlogHelper::getHelper('Mailchimp')->subscribe($email, $fullname); if (!$this->{$method}($id, $userId, $email, $fullname)) { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_ALREADY_SUBSCRIBED_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } // message if ($register && is_numeric($newId)) { $message = JText::sprintf('COM_EASYBLOG_YOU_SUCCESSFULLY_SUBSCRIBED_AND_REGISTERED_AS_MEMBER'); } else { $message = JText::sprintf('COM_EASYBLOG_SUBSCRIPTION_SUBSCRIBED_SUCCESS', $email); } $theme = new CodeThemes(); $theme->set('message', $message); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_SUCCESS_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.success.php'))->toObject(); $ejax->dialog($options); // Send email to notify admin upon successful subscriptions $user = EasyBlogHelper::getTable('Profile'); $user->load($userId); $date = EasyBlogDateHelper::getDate(); $subscriberName = $my->id == 0 ? $post['esfullname'] : $user->getName(); $data = array('title' => JText::_('COM_EASYBLOG_SUBSCRIPTION_SUCCESS_DIALOG_TITLE'), 'subscriber' => $subscriberName, 'subscriberLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $user->id, false, true), 'subscriberAvatar' => $user->getAvatar(), 'subscriberDate' => EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'), 'type' => $type); if ($type == 'entry') { $data['reviewLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $id, false, true); } if ($type == 'category') { $data['reviewLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $id, false, true); } $emailTitle = JText::_('COM_EASYBLOG_NEW') . ' ' . JText::_('COM_EASYBLOG_SUBSCRIPTION_TYPE_' . strtoupper($type)) . ' ' . strtolower(JText::_('COM_EASYBLOG_SUBSCRIPTION')); $emails = array(); $notification = EasyBlogHelper::getHelper('Notification'); $config = EasyBlogHelper::getConfig(); // @rule: if custom_email_as_admin is enabled, use custom email as admin email if ($config->get('custom_email_as_admin')) { // @rule: Send to custom email addresses $notification->getCustomEmails($emails); } else { // @rule: Send to administrator's on the site. $notification->getAdminEmails($emails); } $notification->send($emails, $emailTitle, 'email.subscriptions', $data); return $ejax->send(); }
private function sendNotificationsJomsocial($blog, $isNew, $key, $source, $author) { JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); // @rule: Send email notifications out to subscribers. $author = EB::user($blog->created_by); $data['blogTitle'] = $blog->title; $data['blogAuthor'] = $author->getName(); $data['blogAuthorAvatar'] = $author->getAvatar(); $data['blogAuthorLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id, false, true); $data['blogAuthorEmail'] = $author->user->email; $data['blogIntro'] = $blog->intro; $data['blogContent'] = $blog->content; $data['blogLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true); $date = EasyBlogDateHelper::dateWithOffSet($blog->created); $data['blogDate'] = EasyBlogDateHelper::toFormat($date, JText::_('DATE_FORMAT_LC1')); // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls. $sh404exists = EasyBlogRouter::isSh404Enabled(); if (JFactory::getApplication()->isAdmin() && $sh404exists) { $data['blogLink'] = JURI::root() . 'index.php?option=com_easyblog&view=entry&id=' . $blog->id; $data['blogAuthorLink'] = JURI::root() . 'index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id; } // Get group members emails if (!class_exists('CommunityModelGroups')) { jimport('joomla.application.component.model'); JLoader::import('groups', JPATH_ROOT . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'models'); } $model = JModelLegacy::getInstance('Groups', 'CommunityModel'); if (is_array($key)) { $key = $key[0]; } if (!method_exists($model, 'getAllMember')) { // Snippet taken from getAllMember $db = EasyBlogHelper::db(); $query = 'SELECT a.' . $db->nameQuote('memberid') . ' AS id, a.' . $db->nameQuote('approved') . ' , b.' . $db->nameQuote('name') . ' as name , a.' . $db->nameQuote('permissions') . ' as permission FROM ' . $db->nameQuote('#__community_groups_members') . ' AS a ' . ' INNER JOIN ' . $db->nameQuote('#__users') . ' AS b ' . ' WHERE b.' . $db->nameQuote('id') . '=a.' . $db->nameQuote('memberid') . ' AND a.' . $db->nameQuote('groupid') . '=' . $db->Quote($key) . ' AND b.' . $db->nameQuote('block') . '=' . $db->Quote('0') . ' ' . ' AND a.' . $db->nameQuote('permissions') . ' !=' . $db->quote(-1); $db->setQuery($query); $members = $db->loadObjectList(); } else { $members = $model->getAllMember($key); } $emails = array(); $jsCoreFile = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php'; foreach ($members as $member) { $user = CFactory::getUser($member->id); $userParam = $user->getParams(); $enabled = $userParam->get('etype_groups_sendmail', 0); if (!$enabled) { continue; } if ($author->user->email != $user->email) { $obj = new stdClass(); $obj->email = $user->email; $emails[] = $obj; } } $config = EasyBlogHelper::getConfig(); $notification = EasyBlogHelper::getHelper('Notification'); $emailBlogTitle = JString::substr($blog->title, 0, $config->get('main_mailtitle_length')); $emailTitle = JText::sprintf('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_ADDED_WITH_TITLE', $emailBlogTitle) . ' ...'; $notification->send($emails, $emailTitle, 'email.blog.new', $data); }