示例#1
0
 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);
     }
 }
示例#2
0
 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);
 }
示例#3
0
 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);
 }
示例#4
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $jConfig = EasyBlogHelper::getJConfig();
     if (!$config->get('main_rss')) {
         return;
     }
     $model = $this->getModel('Featured');
     $data = $model->getFeaturedBlog();
     $document = JFactory::getDocument();
     $document->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=featured');
     $document->setTitle(JText::_('COM_EASYBLOG_FEEDS_FEATURED_TITLE'));
     $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_FEATURED_DESC', JURI::root()));
     if (!empty($data)) {
         for ($i = 0; $i < count($data); $i++) {
             $row =& $data[$i];
             $profile = EasyBlogHelper::getTable('Profile', 'Table');
             $profile->load($row->created_by);
             $created = EasyBlogDateHelper::dateWithOffSet($row->created);
             $formatDate = true;
             if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
                 $langCode = EasyBlogStringHelper::getLangCode();
                 if ($langCode != 'en-GB' || $langCode != 'en-US') {
                     $formatDate = false;
                 }
             }
             // $row->created       = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat();
             $row->created = $created->toMySQL();
             if ($config->get('main_rss_content') == 'introtext') {
                 $row->text = !empty($row->intro) ? $row->intro : $row->content;
                 //read more for feed
                 $row->text .= '<br /><a href=' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>';
             } else {
                 $row->text = $row->intro . $row->content;
             }
             $row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text);
             $row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text);
             $category = EasyBlogHelper::getTable('Category', 'Table');
             $category->load($row->category_id);
             // Assign to feed item
             $title = $this->escape($row->title);
             $title = html_entity_decode($title);
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = $title;
             $item->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id);
             $item->description = $row->text;
             $item->date = $row->created;
             $item->category = $category->title;
             $item->author = $profile->getName();
             if ($jConfig->get('feed_email') == 'author') {
                 $item->authorEmail = $profile->user->email;
             } else {
                 $item->authorEmail = $jConfig->get('mailfrom');
             }
             $document->addItem($item);
         }
     }
 }
示例#5
0
 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();
 }
 public function mapPost($row, $strip_tags = '', $text_length = 0, $skip = array())
 {
     $config = EasyBlogHelper::getConfig();
     $blog = EasyBlogHelper::getTable('Blog');
     $blog->load($row->id);
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($row->created_by);
     $created = EasyBlogDateHelper::dateWithOffSet($row->created);
     $formatDate = true;
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         $langCode = EasyBlogStringHelper::getLangCode();
         if ($langCode != 'en-GB' || $langCode != 'en-US') {
             $formatDate = false;
         }
     }
     $blog->created = $created->toMySQL();
     $blog->text = $row->intro . $row->content;
     $config->set('max_video_width', 320);
     $config->set('max_video_width', 180);
     $blog->text = EasyBlogHelper::getHelper('Videos')->processVideos($blog->text);
     $blog->text = EasyBlogGoogleAdsense::stripAdsenseCode($blog->text);
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($row->category_id);
     $item = new PostSimpleSchema();
     $item->textplain = $blog->text;
     // @TODO : Take care of a case when strip tags and length are used together
     if ($strip_tags) {
         $item->textplain = strip_tags($blog->text, $strip_tags);
     }
     if ($text_length > 0) {
         $pos = JString::strpos(strip_tags($item->textplain), ' ', $text_length);
         $item->textplain = JString::substr(strip_tags($blog->text), 0, $pos);
     }
     $image_data = json_decode($blog->image);
     $item->postid = $blog->id;
     $item->title = $blog->title;
     $item->text = $blog->text;
     $item->textplain = $this->sanitize($item->textplain);
     $item->image = $blog->getImage();
     $item->image->url = $image_data->url;
     $item->created_date = $blog->created;
     $item->created_date_elapsed = EasyBlogDateHelper::getLapsedTime($blog->created);
     $item->author->name = $profile->nickname;
     $item->author->photo = JURI::root() . $profile->avatar;
     $item->category->categoryid = $category->id;
     $item->category->title = $category->title;
     $item->url = JURI::root() . trim(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id), '/');
     // Tags
     $modelPT = EasyBlogHelper::getModel('PostTag');
     $item->tags = $modelPT->getBlogTags($blog->id);
     foreach ($skip as $v) {
         unset($item->{$v});
     }
     return $item;
 }
示例#7
0
 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);
 }
示例#8
0
文件: date.php 项目: Tommar/vino2
 public static function getOffSet($numberOnly = false)
 {
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         //return a timezone object
         return EasyBlogDateHelper::getOffSet16($numberOnly);
     }
     $mainframe = JFactory::getApplication();
     $user = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $userTZ = '';
     $dstOffset = $config->get('main_dstoffset', 0);
     if ($user->id != 0) {
         $userTZ = $user->getParam('timezone') + $dstOffset;
     }
     //if user did not set timezone, we use joomla one.
     if (empty($userTZ)) {
         $userTZ = $mainframe->getCfg('offset') + $dstOffset;
     }
     return $userTZ;
 }
示例#9
0
 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);
     }
 }
示例#10
0
 public function getArchivePostCountByMonth($month = '', $year = '', $showPrivate = true)
 {
     $db = EB::db();
     $user = JFactory::getUser();
     $privateBlog = $showPrivate ? '' : 'AND ' . $db->nameQuote('access') . ' = ' . $db->Quote('0');
     $tzoffset = EasyBlogDateHelper::getOffSet(true);
     $query = 'SELECT COUNT(1) as count, DAY( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS day,';
     $query .= ' MONTH( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS month,';
     $query .= ' YEAR( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS year ';
     $query .= ' FROM ' . $db->nameQuote('#__easyblog_post');
     $query .= ' WHERE ' . $db->nameQuote('published') . ' = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query .= ' AND ' . $db->nameQuote('state') . ' = ' . $db->Quote(EASYBLOG_POST_NORMAL);
     $query .= ' ' . $privateBlog;
     $query .= ' AND (' . $db->nameQuote('created') . ' > ' . $db->Quote($year . '-' . $month . '-01 00:00:00') . ' AND ' . $db->nameQuote('created') . ' < ' . $db->Quote($year . '-' . $month . '-31 23:59:59') . ')';
     $query .= ' GROUP BY day, year, month ';
     $query .= ' ORDER BY ' . $db->nameQuote('created') . ' ASC ';
     $db->setQuery($query);
     $row = $db->loadAssocList();
     $postCount = new stdClass();
     for ($i = 1; $i <= 31; $i++) {
         $postCount->{$year}->{$month}->{$i} = 0;
     }
     if (!empty($row)) {
         foreach ($row as $data) {
             $postCount->{$year}->{$month}->{$data['day']} = $data['count'];
         }
     }
     return $postCount;
 }
示例#11
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $jConfig = EasyBlogHelper::getJConfig();
     if (!$config->get('main_rss')) {
         return;
     }
     $mainframe = JFactory::getApplication();
     $menuParams = $mainframe->getParams();
     $date = EasyBlogHelper::getDate();
     $sort = 'latest';
     $model = $this->getModel('Archive');
     $year = $model->getArchiveMinMaxYear();
     $defaultYear = $menuParams->get('es_archieve_year', empty($year['maxyear']) ? $date->toFormat('%Y') : $year['maxyear']);
     $defaultMonth = $menuParams->get('es_archieve_month', $date->toFormat('%m'));
     $archiveYear = JRequest::getVar('archiveyear', $defaultYear, 'REQUEST');
     $archiveMonth = JRequest::getVar('archivemonth', $defaultMonth, 'REQUEST');
     $data = EasyBlogHelper::formatBlog($model->getArchive($archiveYear, $archiveMonth));
     $pagination = $model->getPagination();
     $params = $mainframe->getParams('com_easyblog');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $document = JFactory::getDocument();
     $viewDate = EasyBlogHelper::getDate($archiveYear . '-' . $archiveMonth . '-01');
     $document->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=archive');
     $document->setTitle(JText::sprintf('COM_EASYBLOG_FEEDS_ARCHIVE_TITLE', $viewDate->toFormat('%B %Y')));
     $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_ARCHIVE_DESC', $viewDate->toFormat('%B %Y')));
     if (!empty($data)) {
         for ($i = 0; $i < count($data); $i++) {
             $row =& $data[$i];
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($row->id);
             $profile = EasyBlogHelper::getTable('Profile', 'Table');
             $profile->load($row->created_by);
             $created = EasyBlogDateHelper::dateWithOffSet($row->created);
             $formatDate = true;
             if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
                 $langCode = EasyBlogStringHelper::getLangCode();
                 if ($langCode != 'en-GB' || $langCode != 'en-US') {
                     $formatDate = false;
                 }
             }
             //$row->created       = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat();
             $row->created = $created->toMySQL();
             if ($config->get('main_rss_content') == 'introtext') {
                 $row->text = !empty($row->intro) ? $row->intro : $row->content;
                 $row->text .= '<br /><a href=' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>';
             } else {
                 $row->text = $row->intro . $row->content;
             }
             $row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text);
             $row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text);
             $image = '';
             if ($blog->getImage()) {
                 $image = '<img src="' . $blog->getImage()->getSource('frontpage') . '" />';
             }
             $category = EasyBlogHelper::getTable('Category', 'Table');
             $category->load($row->category_id);
             // Assign to feed item
             $title = $this->escape($row->title);
             $title = html_entity_decode($title);
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = $title;
             $item->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id);
             $item->description = $image . $row->text;
             $item->date = $row->created;
             $item->category = $category->title;
             $item->author = $profile->getName();
             if ($jConfig->get('feed_email') == 'author') {
                 $item->authorEmail = $profile->user->email;
             } else {
                 $item->authorEmail = $jConfig->get('mailfrom');
             }
             $document->addItem($item);
         }
     }
 }
示例#12
0
 public function getDate($item)
 {
     $config = EasyBlogHelper::getConfig();
     return EasyBlogDateHelper::toFormat(JFactory::getDate($item->created), $config->get('layout_dateformat', '%A, %d %B %Y'));
 }
示例#13
0
        <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);
示例#14
0
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>
示例#15
0
    ?>
		</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>
示例#16
0
</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 
示例#17
0
 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);
     }
 }
示例#18
0
 * 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);
示例#19
0
文件: xmlrpc.php 项目: Tommar/vino2
 function getPost($postid, $username, $password)
 {
     global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
     EasyBlogXMLRPCHelper::loginUser($username, $password);
     $my = JFactory::getUser($username);
     $acl = EasyBlogACLHelper::getRuleSet($my->id);
     if (empty($acl->rules->add_entry)) {
         return new xmlrpcresp(0, $xmlrpcerruser + 2, JText::_('ACCESS DENIED'));
     }
     jimport('joomla.application.component.model');
     // JTable::addIncludePath( JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'tables' );
     // JModel::addIncludePath( JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'models' );
     // create a new blog jtable object
     $blog = EasyBlogHelper::getTable('Blog', 'Table');
     $blog->load($postid);
     if (empty($blog->title)) {
         return new xmlrpcresp(0, $xmlrpcerruser + 1, JText::_('Blog post not found.'));
     }
     $catId = empty($blog->category_id) ? '1' : $blog->category_id;
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($catId);
     //publishing
     $publish = 'publish';
     switch ($blog->published) {
         case 1:
             $publish = 'publish';
             break;
         case 3:
             $publish = 'draft';
             break;
         case 2:
         default:
             $publish = 'pending';
     }
     //tags /* to do */
     $modelPT = EasyBlogHelper::getModel('PostTag');
     $blogTags = $modelPT->getBlogTags($blog->id);
     $arrBlogTags = array();
     $tagnames = '';
     if (!empty($blogTags)) {
         foreach ($blogTags as $bt) {
             $arrBlogTags[] = $bt->title;
         }
         $tagnames = implode(',', $arrBlogTags);
     }
     $tagnames = array(new xmlrpcval($tagnames, $xmlrpcString));
     $tzoffset = EasyBlogDateHelper::getOffSet();
     $dateCreated = EasyBlogHelper::getDate($blog->created, $tzoffset);
     $postURL = 'index.php?option=com_easyblog&view=entry&id=' . $blog->id;
     $articleLink = EasyBlogRouter::getRoutedURL($postURL, false, true);
     $struct = new xmlrpcval(array('link' => new xmlrpcval($articleLink), 'permaLink' => new xmlrpcval($articleLink), 'userid' => new xmlrpcval($my->id), 'title' => new xmlrpcval($blog->title), 'description' => new xmlrpcval($blog->intro), 'more_text' => new xmlrpcval($blog->content), 'mt_text_more' => new xmlrpcval($blog->content), 'dateCreated' => new xmlrpcval($dateCreated->toISO8601(), 'dateTime.iso8601'), 'categories' => new xmlrpcval(array(new xmlrpcval($category->title)), $xmlrpcArray), 'mt_excerpt' => new xmlrpcval($blog->intro), 'mt_text_more' => new xmlrpcval($blog->content), 'mt_allow_comments' => new xmlrpcval($blog->allowcomment), 'mt_allow_pings' => new xmlrpcval('0'), 'mt_keywords' => new xmlrpcval($tagnames, $xmlrpcArray), 'post_status' => new xmlrpcval($publish), 'postid' => new xmlrpcval($blog->id), 'date_created_gmt' => new xmlrpcval($dateCreated->toISO8601()), 'wp_slug' => new xmlrpcval($blog->permalink)), $xmlrpcStruct);
     return new xmlrpcresp($struct);
 }
示例#20
0
			<?php 
echo JHTML::_('select.booleanlist', 'published', 'class="input text"', $tag->published);
?>
		</td>
	</tr>
	<tr>
		<td class="key">
			<label for="created">
				<?php 
echo JText::_('COM_EASYBLOG_CREATED');
?>
			</label>
		</td>
		<td>
			<?php 
$createdDate = EasyBlogDateHelper::getDate($tag->created);
?>
			<input type="text" name="created" id="created" value="<?php 
echo $createdDate->toFormat($system->config->get('layout_systemdateformat'));
?>
" class="calendar"/>
		</td>
	</tr>
</table>
<input type="hidden" name="id" id="id" value="<?php 
echo $tag->id;
?>
"/>

<div class="dialog-actions">
	<input type="button" value="<?php 
示例#21
0
echo JText::_('COM_EASYBLOG_UNPUBLISHED');
?>
</option>
    		</select>
		</td>
	</tr>
	<tr>
		<td class="key">
			<label for="created"><?php 
echo JText::_('COM_EASYBLOG_CREATED');
?>
</label>
		</td>
		<td>
			<?php 
$createdDate = EasyBlogDateHelper::getDate($category->created);
?>
			<input type="text" name="created" id="created" value="<?php 
echo $createdDate->toFormat($system->config->get('layout_systemdateformat'));
?>
" class="calendar"/>
		</td>
	</tr>
</table>

<div class="ui-modbox">
    <div class="ui-modhead">
    	<div class="ui-modtitle"><?php 
echo JText::_('COM_EASYBLOG_CATEGORIES_ACCESS');
?>
</div>
示例#22
0
文件: archive.php 项目: Tommar/vino2
 function getArchivePostByMonth($month = '', $year = '', $showPrivate = false)
 {
     $db = EasyBlogHelper::db();
     $user = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     // used for privacy
     $queryWhere = '';
     $queryExclude = '';
     $queryExcludePending = '';
     $excludeCats = array();
     if ($user->id == 0) {
         $showPrivate = false;
     }
     if (!$showPrivate) {
         $excludeCats = EasyBlogHelper::getPrivateCategories();
     }
     //blog privacy setting
     // @integrations: jomsocial privacy
     $privateBlog = '';
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_privacy') && $easysocial->exists() && !EasyBlogHelper::isSiteAdmin()) {
         $esPrivacyQuery = $easysocial->buildPrivacyQuery('a');
         $privateBlog .= $esPrivacyQuery;
     } else {
         if ($config->get('main_jomsocial_privacy') && JFile::exists($file) && !EasyBlogHelper::isSiteAdmin()) {
             require_once $file;
             $jsFriends = CFactory::getModel('Friends');
             $friends = $jsFriends->getFriendIds($user->id);
             // Insert query here.
             $privateBlog .= ' AND (';
             $privateBlog .= ' (a.`private`= 0 ) OR';
             $privateBlog .= ' ( (a.`private` = 20) AND (' . $db->Quote($user->id) . ' > 0 ) ) OR';
             if (empty($friends)) {
                 $privateBlog .= ' ( (a.`private` = 30) AND ( 1 = 2 ) ) OR';
             } else {
                 $privateBlog .= ' ( (a.`private` = 30) AND ( a.' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
             }
             $privateBlog .= ' ( (a.`private` = 40) AND ( a.' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . '=' . $user->id . ') )';
             $privateBlog .= ' )';
         } else {
             if ($user->id == 0) {
                 $privateBlog .= ' AND a.`private` = ' . $db->Quote(0);
             }
         }
     }
     $privateBlog = $showPrivate ? '' : $privateBlog;
     //get teamblogs id.
     $teamBlogIds = '';
     $query = '';
     if ($config->get('main_includeteamblogpost')) {
         $teamBlogIds = EasyBlogHelper::getViewableTeamIds();
         if (count($teamBlogIds) > 0) {
             $teamBlogIds = implode(',', $teamBlogIds);
         }
     }
     if (!empty($excludeCats)) {
         $queryWhere .= ' AND a.`category_id` NOT IN (' . implode(',', $excludeCats) . ')';
     }
     $jsPostIds = self::getJomSocialPosts();
     if ($config->get('main_includeteamblogpost') && !empty($teamBlogIds)) {
         if (!empty($jsPostIds)) {
             $tmpIds = implode(',', $jsPostIds);
             $queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
         } else {
             $queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
         }
     } else {
         if (!empty($jsPostIds)) {
             $tmpIds = implode(',', $jsPostIds);
             $queryWhere .= ' AND (a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
         } else {
             $queryWhere .= ' AND a.`issitewide` = ' . $db->Quote('1');
         }
     }
     $extraSQL = '';
     $blogger = EasyBlogRouter::isBloggerMode();
     if ($blogger !== false) {
         $extraSQL = ' AND a.`created_by` = ' . $db->Quote($blogger);
     }
     $tzoffset = EasyBlogDateHelper::getOffSet(true);
     $query = 'SELECT *, DAY( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS day,';
     $query .= ' MONTH( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS month,';
     $query .= ' YEAR( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS year ';
     $query .= ' FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post') . ' as a';
     if ($config->get('main_includeteamblogpost')) {
         $query .= ' LEFT JOIN `#__easyblog_team_post` AS u ON a.id = u.post_id';
     }
     $query .= ' WHERE a.`published` = ' . $db->Quote(true) . ' ';
     $query .= $privateBlog . ' ';
     $query .= ' AND (a.`created` > ' . $db->Quote($year . '-' . $month . '-01 00:00:00') . ' AND a.`created` < ' . $db->Quote($year . '-' . $month . '-31 23:59:59') . ') ';
     $query .= $extraSQL . ' ';
     $query .= $queryWhere;
     $query .= ' ORDER BY a.`created` ASC ';
     $db->setQuery($query);
     $row = $db->loadObjectList();
     $postCount = new EasyblogCalendarObject($month, $year);
     if (!empty($row)) {
         foreach ($row as $data) {
             if ($postCount->{$year}->{$month}->{$data->day} == 0) {
                 $postCount->{$year}->{$month}->{$data->day} = array($data);
             } else {
                 array_push($postCount->{$year}->{$month}->{$data->day}, $data);
             }
         }
     }
     return $postCount;
 }
示例#23
0
        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 
示例#24
0
 public function getSharedDate($blogId)
 {
     $db = EasyBlogHelper::db();
     $query = 'SELECT ' . $db->nameQuote('sent') . ' FROM ' . $db->nameQuote('#__easyblog_oauth_posts') . ' ' . 'WHERE ' . $db->nameQuote('oauth_id') . '=' . $db->Quote($this->id) . ' ' . 'AND ' . $db->nameQuote('post_id') . '=' . $db->Quote($blogId);
     $db->setQuery($query);
     $result = $db->loadResult();
     return EasyBlogDateHelper::dateWithOffSet($result)->toMySQL();
 }
示例#25
0
            </form>
        </div>
    </div>
	<?php 
}
?>

	<form name="adminForm" id="adminForm" class="">

        <?php 
if ($tags) {
    ?>
        <ul class="tag-list reset-ul float-li clearfix">
            <?php 
    foreach ($tags as $tag) {
        $created = EasyBlogDateHelper::dateWithOffSet($tag->created);
        ?>

            <li id="td-<?php 
        echo $tag->id;
        ?>
">
                <a class="tag-delete" href="javascript:eblog.tag.remove('<?php 
        echo EasyBlogRouter::_('index.php?option=com_easyblog&controller=dashboard');
        ?>
','<?php 
        echo $tag->id;
        ?>
');">
                    <?php 
        echo JText::_('COM_EASYBLOG_DELETE');
示例#26
0
 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;
 }
示例#27
0
?>
 :</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>
示例#28
0
 public function processCommentMailbox()
 {
     /*
      * Check enabled
      */
     $config = EasyBlogHelper::getConfig();
     $debug = JRequest::getBool('debug', false);
     if (!$config->get('main_comment_email')) {
         return;
     }
     $interval = (int) $config->get('main_remotepublishing_mailbox_run_interval');
     $nextrun = (int) $config->get('main_remotepublishing_mailbox_next_run');
     $nextrun = EasyBlogHelper::getDate($nextrun)->toUnix();
     $timenow = EasyBlogHelper::getDate()->toUnix();
     if ($nextrun !== 0 && $timenow < $nextrun) {
         if (!$debug) {
             echo 'time now: ' . EasyBlogHelper::getDate($timenow)->toMySQL() . "<br />\n";
             echo 'next email run: ' . EasyBlogHelper::getDate($nextrun)->toMySQL() . "<br />\n";
             return;
         }
     }
     $txOffset = EasyBlogDateHelper::getOffSet();
     $newnextrun = EasyBlogHelper::getDate('+ ' . $interval . ' minutes', $txOffset)->toUnix();
     // use $configTable to avoid variable name conflict
     $configTable = EasyBlogHelper::getTable('configs');
     $configTable->load('config');
     $parameters = new JParameter($configTable->params);
     $parameters->set('main_remotepublishing_mailbox_next_run', $newnextrun);
     $configTable->params = $parameters->toString('ini');
     $configTable->store();
     /*
      * Connect to mailbox
      */
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_easyblog' . DS . 'classes' . DS . 'mailbox.php';
     $mailbox = new EasyblogMailbox();
     if (!$mailbox->connect()) {
         $mailbox->disconnect();
         echo 'Comment Mailbox: Could not connect to mailbox.';
         return false;
     }
     $total = 0;
     /*
      * Get data from mailbox
      */
     $total_mails = $mailbox->getMessageCount();
     if ($total_mails < 1) {
         // No mails in mailbox
         $mailbox->disconnect();
         echo 'Comment Mailbox: No emails found.';
         return false;
     }
     // Let's get the correct mails
     $messages = $mailbox->searchMessages('UNSEEN');
     if ($messages) {
         $prefix = '/\\[\\#(.*)\\]/is';
         $filter = JFilterInput::getInstance();
         $db = EasyBlogHelper::db();
         foreach ($messages as $messageSequence) {
             $info = $mailbox->getMessageInfo($messageSequence);
             $from = $info->fromemail;
             $senderName = $info->from[0]->personal;
             $subject = $filter->clean($info->subject);
             // @rule: Detect if this is actually a reply.
             preg_match('/\\[\\#(.*)\\]/is', $subject, $matches);
             // If the title doesn't match the comment specific title, just continue the block.
             if (empty($matches)) {
                 continue;
             }
             $query = 'SELECT ' . $db->nameQuote('id') . ' FROM ' . $db->nameQuote('#__users') . ' ' . 'WHERE ' . $db->nameQuote('email') . '=' . $db->Quote($from);
             $db->setQuery($query);
             $userId = $db->loadResult();
             $commentId = $matches[1];
             $refComment = EasyBlogHelper::getTable('Comment');
             $refComment->load($commentId);
             // Get the message contents.
             $message = new EasyblogMailboxMessage($mailbox->stream, $messageSequence);
             $message->getMessage();
             $content = $message->getPlain();
             // If guest commenting is not allowed, and user's email does not exist in system, pass this.
             if (!$config->get('main_allowguestcomment') && !$userId) {
                 continue;
             }
             // Apply akismet filtering
             if ($config->get('comment_akismet')) {
                 $data = array('author' => $senderName, 'email' => $from, 'website' => JURI::root(), 'body' => $content, 'permalink' => EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $refComment->post_id));
                 if (EasyBlogHelper::getHelper('Akismet')->isSpam($data)) {
                     continue;
                 }
             }
             $model = EasyBlogHelper::getModel('Comment');
             $comment = EasyBlogHelper::getTable('Comment');
             $comment->name = $senderName;
             $comment->email = $from;
             $comment->comment = $content;
             $comment->post_id = $refComment->post_id;
             $date = EasyBlogHelper::getDate();
             $comment->created = $date->toMySQL();
             $comment->modified = $date->toMySQL();
             $comment->published = 1;
             if ($userId) {
                 $comment->created_by = $userId;
             }
             $comment->sent = 0;
             $isModerated = false;
             // Update publish status if the comment requires moderation
             if ($config->get('comment_moderatecomment') == 1 || !$userId && $config->get('comment_moderateguestcomment') == 1) {
                 $comment->set('published', EBLOG_COMMENT_STATUS_MODERATED);
                 $isModerated = true;
             }
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($comment->post_id);
             // If moderation for author is disabled, ensure that the comment is published.
             // If the author is the owner of the blog, it should never be moderated.
             if (!$config->get('comment_moderateauthorcomment') && $blog->created_by == $userId) {
                 $comment->set('published', 1);
                 $isModerated = false;
             }
             if (!$comment->store()) {
                 echo 'Error storing comment: ' . $comment->getError();
                 return;
             }
             echo '* Added comment for post <strong>' . $blog->title . '</strong><br />';
             // @rule: Process notifications
             $comment->processEmails($isModerated, $blog);
             // Update the sent flag
             $comment->updateSent();
             $total++;
         }
     }
     /*
      * Disconnect from mailbox
      */
     $mailbox->disconnect();
     /*
      * Generate report
      */
     echo JText::sprintf('Comment Mailbox: %1s comments fetched from mailbox: ' . $config->get('main_remotepublishing_mailbox_remotesystemname') . '.', $total);
 }
示例#29
0
 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();
 }
示例#30
0
    /**
     * comment save function used by cb.easyblog plugin.
     */
    function saveCBcomment($post)
    {
        require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'constants.php';
        $mainframe = JFactory::getApplication();
        $my = JFactory::getUser();
        $config = EasyBlogHelper::getConfig();
        $ajax = new Ejax();
        if (JString::strlen($post['comment']) == 0) {
            $ajax->script('easyblogApp.comment.notify("' . $post['id'] . '","' . JText::_('Comment is empty') . '","' . 'error' . '")');
            $ajax->script('easyblogApp.spinner.hide()');
            $ajax->script('easyblogApp.element.focus("comment")');
            return $ajax->send();
        }
        // We don't require a title here.
        $post['title'] = '';
        //real work start here.
        $isModerate = false;
        $parentId = "0";
        $commentDepth = $post['comment_depth'];
        $blogId = $post['id'];
        //we need to rename the esname and esemail back to name and email.
        $post['url'] = '';
        $post['name'] = $post['esname'];
        $post['email'] = $post['esemail'];
        unset($post['esname']);
        unset($post['esemail']);
        JTable::addIncludePath(EBLOG_TABLES);
        $db = EasyBlogHelper::db();
        $comment = EasyBlogHelper::getTable('Comment', 'Table');
        $comment->bindPost($post);
        $now = EasyBlogHelper::getDate();
        $totalComment = empty($post['totalComment']) ? 1 : $post['totalComment'];
        $comment->created = $now->toMySql();
        $comment->modified = $now->toMySql();
        $comment->published = 1;
        $comment->parent_id = $parentId;
        $comment->created_by = $my->id;
        if ($my->id != 0 && $config->get('comment_moderatecomment') == 1 || $my->id == 0 && $config->get('comment_moderateguestcomment') == 1) {
            $comment->published = 0;
            $isModerate = true;
        }
        jimport('joomla.application.component.model');
        JLoader::import('Comment', EBLOG_ROOT . DIRECTORY_SEPARATOR . 'models');
        $model = JModel::getInstance('Comment', 'EasyBlogModel');
        $latestComment = $model->getLatestComment($blogId, $parentId);
        $left = 1;
        $right = 2;
        if (!empty($latestComment)) {
            $left = $latestComment->rgt + 1;
            $right = $latestComment->rgt + 2;
            $model->updateCommentSibling($blogId, $latestComment->rgt);
        }
        $comment->lft = $left;
        $comment->rgt = $right;
        if (!$comment->store()) {
            $ajax->script('easyblogApp.comment.notify("' . $post['id'] . '","' . JText::_('Comment add failed') . '","' . 'error' . '")');
            $ajax->script('easyblogApp.spinner.hide()');
            $ajax->{$ajax}('easyblogApp.element.focus("comment")');
            return $ajax->send();
        }
        $profile = EasyBlogHelper::getTable('Profile', 'Table');
        $profile->load($comment->created_by);
        $comment->creator = $profile;
        $date = EasyBlogDateHelper::dateWithOffSet($comment->created);
        $comment->formattedDate = $date->toFormat($config->get('layout_dateformat', '%A, %d %B %Y'));
        $text = JString::strlen($comment->comment) > 50 ? JString::substr(strip_tags($comment->comment), 0, 50) . '...' : strip_tags($comment->comment);
        $commentText = '
				<li>
					<div class="blog-comment-avatar">
						<a href="' . $comment->creator->getProfileLink() . '"><img src="' . $comment->creator->getAvatar() . '" width="32" /></a>
					</div>
					<div class="blog-comment-item eztc">
						<div class="small">
							<a href="' . $comment->creator->getProfileLink() . '">' . $comment->creator->getName() . '</a>
							' . JText::_('on') . '
							<span class="small">' . $comment->formattedDate . '</span>
						</div>
						' . $text . '
					</div>
					<div style="clear: both;"></div>
				</li>';
        $ajax->prepend('comments-wrapper' . $blogId, $commentText);
        $ajax->script('easyblogApp.comment.cancel("' . $blogId . '")');
        $ajax->script('easyblogApp.spinner.hide()');
        $ajax->script('easyblogApp.comment.notify("' . $blogId . '","' . JText::_('Comment Added') . '","' . 'success' . '")');
        return $ajax->send();
    }