Example #1
0
 /**
  * Displays the files and folders that are in the media manager.
  */
 public function display($tpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $document = JFactory::getDocument();
     $my = JFactory::getUser();
     $app = JFactory::getApplication();
     $profile = EasyBlogHelper::getTable('Profile');
     $profile->load($my->id);
     if ($my->id <= 0) {
         echo JText::_('COM_EASYBLOG_NOT_ALLOWED');
         exit;
     }
     $user = JFactory::getUser();
     $document->setTitle(JText::_('COM_EASYBLOG_MEDIA_MANAGER'));
     // Only allow admin to impersonate anyone.
     if (EasyBlogHelper::isSiteAdmin()) {
         $user = JFactory::getUser(JRequest::getVar('blogger_id', $my->id));
     }
     $debug = $config->get('debug_javascript') || JRequest::getVar('ebjsdebug') == 1 ? 'true' : 'false';
     $theme = new CodeThemes(true);
     $theme->set('debug', $debug);
     $theme->set('session', JFactory::getSession());
     $theme->set('blogger_id', $user->id);
     // @rule: Test if the user is already associated with Flickr
     $oauth = EasyBlogHelper::getTable('Oauth');
     $associated = $oauth->loadByUser($my->id, EBLOG_OAUTH_FLICKR);
     $theme->set('flickrAssociated', $associated);
     echo $theme->fetch('media.php');
 }
Example #2
0
 function getHTML($blogId)
 {
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $pdfEnabled = $config->get('layout_enablepdf');
     $printEnabled = $config->get('layout_enableprint');
     // check if pdf enabled
     if ($pdfEnabled == '2') {
         if ($my->id == 0) {
             $pdfEnabled = 0;
         }
     }
     // check if pdf enabled
     if ($printEnabled == '2') {
         if ($my->id == 0) {
             $printEnabled = 0;
         }
     }
     $theme = new CodeThemes();
     $theme->set('blogId', $blogId);
     $theme->set('pdfEnabled', $pdfEnabled);
     $theme->set('printEnabled', $printEnabled);
     $theme->set('pdfLinkProperties', EasyBlogHelper::getPDFlinkProperties());
     $html = $theme->fetch('blog.publishing.tool.php');
     $bookmark = EasyBlogBookmark::getHTML();
     return $html . $bookmark;
 }
Example #3
0
 public function getHTML($content, $options)
 {
     $json = new Services_JSON();
     $options = $json->encode($options);
     $themes = new CodeThemes();
     $themes->set('content', $content);
     $themes->set('options', $options);
     return $themes->fetch('tooltip.php');
 }
Example #4
0
 public static function getHTML($blog)
 {
     $theme = new CodeThemes();
     $config = EasyBlogHelper::getConfig();
     $siteId = $config->get('comment_livefyre_siteid');
     $theme->set('siteId', $siteId);
     $theme->set('blog', $blog);
     $contents = $theme->fetch('comment.livefyre.php');
     return $contents;
 }
Example #5
0
 public static function getAddThis()
 {
     $config = EasyBlogHelper::getConfig();
     $addthis_customcode = $config->get('social_addthis_customcode', 'xa-4be11e1875bf6363');
     $addthis_style = $config->get('social_addthis_style', '2');
     $displayText = JText::_('COM_EASYBLOG_BOOKMARK');
     $theme = new CodeThemes();
     $theme->set('addthis_customcode', $addthis_customcode);
     $theme->set('displayText', $displayText);
     return $theme->fetch('addthis.button.style' . $addthis_style . '.php');
 }
Example #6
0
 public function getItems()
 {
     $catid = $this->get('ezb_catfilter') ? $this->get('ezb_catid', NULL) : '';
     $ordering = $this->get('ezb_ordering', 'latest');
     $user = JFactory::getUser();
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($catid);
     if ($category->private && $user->id == 0) {
         echo JText::_('This category is set to private');
         return;
     }
     if (!class_exists('EasyBlogModelBlog')) {
         jimport('joomla.application.component.model');
         JLoader::import('blog', EBLOG_ROOT . '/' . 'models');
     }
     $model = EasyBlogHelper::getModel('Blog');
     if ($this->get('ezfeatured')) {
         $items = $model->getFeaturedBlog($catid, $this->get('count'));
     } else {
         $items = $model->getBlogsBy('category', $catid, $ordering, $this->get('count'), EBLOG_FILTER_PUBLISHED, null, false);
     }
     $config = EasyBlogHelper::getConfig();
     if (!empty($items)) {
         for ($i = 0; $i < count($items); $i++) {
             $row =& $items[$i];
             $author = EasyBlogHelper::getTable('Profile', 'Table');
             $row->author = $author->load($row->created_by);
             $row->commentCount = EasyBlogHelper::getCommentCount($row->id);
             $requireVerification = false;
             if ($config->get('main_password_protect', true) && !empty($row->blogpassword)) {
                 $row->title = JText::sprintf('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_TITLE', $row->title);
                 $requireVerification = true;
             }
             if ($requireVerification && !EasyBlogHelper::verifyBlogPassword($row->blogpassword, $row->id)) {
                 $theme = new CodeThemes();
                 $theme->set('id', $row->id);
                 $theme->set('return', base64_encode(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id)));
                 $row->introtext = $theme->fetch('blog.protected.php');
                 $row->content = $row->introtext;
                 $row->showRating = false;
                 $row->protect = true;
             } else {
                 $row->introtext = EasyBlogHelper::getHelper('Videos')->strip($row->content);
                 $row->showRating = true;
                 $row->protect = false;
             }
         }
         //end foreach
     }
     //XEFUtility::debug($items);
     $items = $this->prepareItems($items);
     return $items;
 }
Example #7
0
 public static function getHTML($blog)
 {
     $config = EasyBlogHelper::getConfig();
     $theme = new CodeThemes();
     $code = $config->get('comment_intensedebate_code');
     if (empty($code)) {
         return '';
     }
     $theme->set('code', $code);
     $theme->set('blog', $blog);
     return $theme->fetch('comment.intensedebate.php');
 }
Example #8
0
 public function show()
 {
     $theme = new CodeThemes();
     $ajax = EasyBlogHelper::getHelper('Ajax');
     $type = JRequest::getCmd('type');
     $id = JRequest::getInt('id');
     $theme->set('id', $id);
     $theme->set('type', $type);
     $contents = $theme->fetch('ajax.dialog.report.form.php');
     $ajax->success(JText::_('COM_EASYBLOG_REPORT_THIS_BLOG_POST'), $contents);
     $ajax->send();
 }
Example #9
0
 public static function getHTML($blog)
 {
     $theme = new CodeThemes();
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $language = explode('-', $language);
     if (count($language) != 2) {
         $language = array('en', 'GB');
     }
     $theme->set('language', $language);
     $theme->set('blog', $blog);
     return $theme->fetch('comment.facebook.php');
 }
Example #10
0
 function showSubscription($bloggerId)
 {
     $my = JFactory::getUser();
     $ejax = new Ejax();
     $tpl = new CodeThemes();
     $tpl->set('my', $my);
     $tpl->set('blogId', $bloggerId);
     $options = new stdClass();
     $options->title = JText::_('COM_EASYBLOG_SUBSCRIBE_BLOGGER');
     $options->content = $tpl->fetch('blogger.subscription.box.php');
     $ejax->dialog($options);
     $ejax->send();
     return;
 }
Example #11
0
 /**
  * Retrieves the html codes for the ratings.
  *
  * @param	int	$uid	The unique id for the item that is being rated
  * @param	string	$type	The unique type for the item that is being rated
  * @param	string	$command	A textual representation to request user to vote for this item.
  * @param	string	$element	A dom element id.
  **/
 public function getHTML($uid, $type, $command, $elementId, $disabled = false)
 {
     $config = EasyBlogHelper::getConfig();
     if (!$config->get('main_ratings')) {
         return false;
     }
     $language = JFactory::getLanguage();
     $language->load('com_easyblog', JPATH_ROOT);
     // Add ratings to the page
     $document = JFactory::getDocument();
     $rating = EasyBlogHelper::getTable('Ratings', 'Table');
     $my = JFactory::getUser();
     $hash = $my->id > 0 ? '' : JFactory::getSession()->getId();
     $voted = $rating->fill($my->id, $uid, $type, $hash);
     $locked = $voted || $my->id < 1 && !$config->get('main_ratings_guests') || $disabled;
     $model = EasyBlogHelper::getModel('Ratings');
     $ratingValue = $model->getRatingValues($uid, $type);
     $theme = new CodeThemes();
     $theme->set('voted', $voted);
     $theme->set('elementId', $elementId);
     $theme->set('rating', $ratingValue->ratings);
     $theme->set('total', $ratingValue->total);
     $theme->set('locked', $locked);
     $theme->set('command', $command);
     $theme->set('uid', $uid);
     $theme->set('type', $type);
     return $theme->fetch('ratings.form.php');
 }
Example #12
0
 public static function getHTML($blog)
 {
     $config = EasyBlogHelper::getConfig();
     $theme = new CodeThemes();
     $code = $config->get('comment_disqus_code');
     if (empty($code)) {
         return '';
     }
     $code = JString::str_ireplace('Please enable JavaScript to view the comments powered by Disqus.', '', $code);
     $code = JString::str_ireplace('blog comments powered by Disqus', '', $code);
     $theme->set('code', $code);
     $theme->set('blog', $blog);
     return $theme->fetch('comment.disqus.php');
 }
Example #13
0
 function display($tmpl = null)
 {
     $my = JFactory::getUser();
     if ($my->id < 1) {
         EasyBlogHelper::showLogin();
         return;
     }
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $acl = EasyBlogACLHelper::getRuleSet();
     $config = EasyBlogHelper::getConfig();
     $sort = JRequest::getCmd('sort', $config->get('layout_postorder'));
     $blogger = EasyBlogHelper::getTable('Profile', 'Table');
     $blogger->load($my->id);
     // set meta tags for blogger
     EasyBlogHelper::setMeta($my->id, META_ID_BLOGGERS);
     if (!EasyBlogRouter::isCurrentActiveMenu('myblog', $my->id)) {
         $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger'));
         $this->setPathway($blogger->getName());
     }
     $model = $this->getModel('Blog');
     $data = $model->getBlogsBy('blogger', $blogger->id, $sort);
     $pagination = $model->getPagination();
     $pageNumber = $pagination->get('pages.current');
     $pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
     $document->setTitle($blogger->getName() . $pageText . EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_MY_BLOG_PAGE_TITLE')));
     $data = EasyBlogHelper::formatBlog($data, false, true, true, true);
     if ($config->get('layout_showcomment', false)) {
         for ($i = 0; $i < count($data); $i++) {
             $row =& $data[$i];
             $maxComment = $config->get('layout_showcommentcount', 3);
             $comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc');
             $comments = EasyBlogHelper::formatBlogCommentsLite($comments);
             $row->comments = $comments;
         }
     }
     $rssURL = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&task=rss');
     //twitter follow me link
     $twitterFollowMelink = EasyBlogSocialShareHelper::getLink('twitter', $blogger->id);
     $theme = new CodeThemes();
     $theme->set('rssURL', $rssURL);
     $theme->set('blogger', $blogger);
     $theme->set('sort', $sort);
     $theme->set('blogs', $data);
     $theme->set('currentURL', 'index.php?option=com_easyblog&view=latest');
     $theme->set('pagination', $pagination->getPagesLinks());
     $theme->set('twitterFollowMelink', $twitterFollowMelink);
     $theme->set('my', $my);
     $theme->set('acl', $acl);
     echo $theme->fetch('blog.blogger.php');
 }
Example #14
0
 /**
  * Shares a story through 3rd party oauth clients
  *
  * @param	TableBlog	$blog	A blog table object
  * @param	string		$type	The type of oauth client
  *
  * @return	boolean		True on success and false otherwise.
  **/
 public function getHTML($bloggerid = "")
 {
     $html = '';
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     if ($config->get('main_jomsocial_messaging') && $my->id != $bloggerid) {
         $file_core = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
         $file_messaging = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'messaging.php';
         if (file_exists($file_core) && file_exists($file_messaging)) {
             require_once $file_core;
             require_once $file_messaging;
             CMessaging::load();
             $html = '<a href="javascript:void(0);" onclick="' . CMessaging::getPopup($bloggerid) . '" class="author-message" title="' . JText::_('COM_EASYBLOG_MESSAGE_AUTHOR') . '"><span>' . JText::_('COM_EASYBLOG_MESSAGE_AUTHOR') . '</span></a>';
         }
     }
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_conversations') && $easysocial->exists() && $my->id != $bloggerid) {
         $easysocial->init();
         $user = Foundry::user($bloggerid);
         $theme = new CodeThemes();
         $theme->set('user', $user);
         $html = $theme->fetch('easysocial.conversation.php');
     }
     return $html;
 }
Example #15
0
 public function showVoters($elementId, $type)
 {
     $ajax = new Ejax();
     $model = $this->getModel('Ratings');
     $config = EasyBlogHelper::getConfig();
     $voters = $model->getRatingUsers($elementId, $type, $config->get('main_ratings_display_raters_max'));
     $guests = false;
     $theme = new CodeThemes();
     $theme->set('guests', $guests);
     $theme->set('voters', $voters);
     $options = new stdClass();
     $options->title = JText::_('COM_EASYBLOG_DIALOG_TITLE_RECENT_VOTERS');
     $options->content = $theme->fetch('ratings.users.php');
     $ajax->dialog($options);
     return $ajax->send();
 }
Example #16
0
 /**
  *
  * $filtering
  *      if index page:
  *      category_id
  *      filter
  *      sort
  *      query
  */
 public function toHTML($viewpage = 'index', $doReplace = false)
 {
     $data = $this->getData();
     if (count($data->pages) == $this->get('pages.total') && $this->get('pages.total') == '1' || $this->get('pages.total') == 0) {
         return false;
     }
     $queries = '';
     if (!empty($data) && $doReplace) {
         $curPageLink = 'index.php?option=com_easyblog&view=' . $viewpage . $queries;
         foreach ($data->pages as $page) {
             if (!empty($page->link)) {
                 $limitstart = !empty($page->base) ? '&limitstart=' . $page->base : '';
                 $page->link = EasyBlogRouter::_($curPageLink . $limitstart);
             }
         }
         // newer link
         if (!empty($data->next->link)) {
             $limitstart = !empty($data->next->base) ? '&limitstart=' . $data->next->base : '';
             $data->next->link = EasyBlogRouter::_($curPageLink . $limitstart);
         }
         // older link
         if (!empty($data->previous->link)) {
             $limitstart = !empty($data->previous->base) ? '&limitstart=' . $data->previous->base : '';
             $data->previous->link = EasyBlogRouter::_($curPageLink . $limitstart);
         }
     }
     $theme = new CodeThemes();
     $theme->set('data', $data);
     return $theme->fetch('blog.pagination.php');
 }
Example #17
0
 public static function getHTML()
 {
     $captcha = EasyBlogHelper::getTable('Captcha', 'Table');
     $captcha->created = EasyBlogHelper::getDate()->toMySQL();
     $captcha->store();
     $theme = new CodeThemes();
     $theme->set('id', $captcha->id);
     return $theme->fetch('comment.captcha.php');
 }
Example #18
0
 public static function getHTML($blog)
 {
     $theme = new CodeThemes();
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jomcomment' . DIRECTORY_SEPARATOR . 'config.jomcomment.php';
     if (!JFile::exists($file)) {
         return '';
     }
     include_once JPATH_PLUGINS . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . 'jom_comment_bot.php';
     $theme->set('blog', $blog);
     return $theme->fetch('comment.jomcomment.php');
 }
Example #19
0
 public static function getHTML($blog)
 {
     $theme = new CodeThemes();
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_rscomments' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'rscomments.php';
     if (!JFile::exists($file)) {
         return '';
     }
     include_once $file;
     $theme->set('blog', $blog);
     return $theme->fetch('comment.rscomments.php');
 }
Example #20
0
 function loadCalendar($position = 'module', $itemId = '0', $size = 'small', $type = 'blog', $timestamp = '')
 {
     $my = JFactory::getUser();
     $ajax = new Ejax();
     $config = EasyBlogHelper::getConfig();
     $tpl = new CodeThemes();
     $model = new EasyBlogModelArchive();
     $allowed = array('module', 'component');
     if (!in_array($position, $allowed)) {
         return;
     }
     if (!empty($itemId)) {
         JRequest::setVar('Itemid', $itemId);
     }
     //get date.
     $date = EasyBlogCalendarHelper::processDate($timestamp);
     //get the required data to build the calendar.
     $data = EasyBlogCalendarHelper::prepareData($date);
     //get the postcount
     //$postCount 	= $model->getArchivePostCountByMonth($date['month'], $date['year']);
     $postData = $model->getArchivePostByMonth($date['month'], $date['year']);
     switch ($position) {
         case 'module':
             $namespace = 'mod_easyblogcalendar';
             $preFix = 'mod_easyblog';
             $ajax->script('mod_easyblogcalendar.calendar.setItemId("' . $itemId . '");');
             break;
         case 'component':
             $namespace = 'eblog';
             $preFix = 'com_easyblog';
             break;
     }
     $previous = $namespace . '.calendar.reload( \'archive\' , \'loadCalendar\', \'' . $position . '\', \'' . $itemId . '\', \'' . $size . '\', \'' . $type . '\', \'' . $data->previous . '\');';
     $next = $namespace . '.calendar.reload( \'archive\' , \'loadCalendar\', \'' . $position . '\', \'' . $itemId . '\', \'' . $size . '\', \'' . $type . '\', \'' . $data->next . '\');';
     $tpl->set('calendar', $data);
     $tpl->set('date', $date);
     $tpl->set('postData', $postData);
     $tpl->set('previous', $previous);
     $tpl->set('next', $next);
     $tpl->set('namespace', $namespace);
     $tpl->set('preFix', $preFix);
     $tpl->set('itemId', $itemId);
     $layout = $tpl->fetch('calendar.' . $size . '.php');
     $ajax->assign('easyblogcalendar-' . $position . '-wrapper', $layout);
     $ajax->send();
     return;
 }
Example #21
0
 public function getHTML($bloggerid = "")
 {
     $config = EasyBlogHelper::getConfig();
     $html = '';
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_badges') && $easysocial->exists()) {
         $easysocial->init();
         $user = Foundry::user($bloggerid);
         $badges = $user->getBadges();
         $theme = new CodeThemes();
         $theme->set('badges', $badges);
         $html = $theme->fetch('easysocial.achievements.php');
     }
     return $html;
 }
Example #22
0
File: aup.php Project: Tommar/vino2
 public function getRanks($userId)
 {
     $config = EasyBlogHelper::getConfig();
     if (!$config->get('main_alpha_userpoint_ranks')) {
         return false;
     }
     if (!$this->loadHelper()) {
         return false;
     }
     if (!method_exists('AlphaUserPointsHelper', 'getUserRank')) {
         return false;
     }
     $rank = AlphaUserPointsHelper::getUserRank('', $userId);
     $theme = new CodeThemes();
     $theme->set('rank', $rank);
     return $theme->fetch('author.aup.ranks.php');
 }
Example #23
0
 public function showVideoForm($editorName)
 {
     $ajax = new Ejax();
     $my = JFactory::getUser();
     if ($my->id <= 0) {
         $title = JText::_('COM_EASYBLOG_INFO');
         $callback = JText::_('COM_EASYBLOG_NO_PERMISSION_TO_PUBLISH_OR_UNPUBLISH_COMMENT');
         $width = '450';
         $height = 'auto';
         $ajax->alert($callback, $title, $width, $height);
         $ajax->send();
         return;
     }
     $theme = new CodeThemes(true);
     $theme->set('editorName', $editorName);
     $content = $theme->fetch('ajax.dialog.videos.add.php');
     $title = JText::_('COM_EASYBLOG_DASHBOARD_WRITE_INSERT_VIDEO_DIALOG_TITLE');
     $ajax->dialog(EasyBlogHelper::getHelper('DialogOptions')->set('title', $title)->set('content', $content)->toObject());
     return $ajax->send();
 }
Example #24
0
 function showDialog($teamId, $type = 'join')
 {
     $my = JFactory::getUser();
     $ejax = new Ejax();
     $config = EasyBlogHelper::getConfig();
     if ($my->id <= 0) {
         echo JText::_('COM_EASYBLOG_NOT_ALLOWED');
         return;
     }
     $team = EasyBlogHelper::getTable('TeamBlog', 'Table');
     $team->load($teamId);
     $theme = new CodeThemes();
     $theme->set('team', $team);
     $messageText = $type == 'join' ? 'COM_EASYBLOG_TEAMBLOG_DIALOG_JOIN_TEAM_TITLE' : 'COM_EASYBLOG_TEAMBLOG_DIALOG_LEAVE_TEAM_TITLE';
     $template = $type == 'join' ? 'ajax.dialog.team.join.php' : 'ajax.dialog.team.leave.php';
     $options = new stdClass();
     $options->title = JText::_($messageText);
     $options->content = $theme->fetch($template);
     $ejax->dialog($options);
     $ejax->send();
     return;
 }
Example #25
0
 public function getHTML($bloggerid = "")
 {
     $html = '';
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     // We don't want to show the link to the same user
     if ($my->id == $bloggerid) {
         return;
     }
     if ($config->get('main_jomsocial_friends')) {
         $file_core = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
         $file_messaging = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'friends.php';
         jimport('joomla.filesystem.file');
         if (JFile::exists($file_core) && JFile::exists($file_messaging)) {
             require_once $file_core;
             require_once $file_messaging;
             $user = CFactory::getUser();
             $model = CFactory::getModel('Friends');
             $friends = $model->getFriendIds($bloggerid);
             if (!in_array($my->id, $friends)) {
                 CFriends::load();
                 $html = '<a href="javascript:void(0);" onclick="' . CFriends::getPopup($bloggerid) . '" class="author-friend"><span>' . JText::_('COM_EASYBLOG_ADD_FRIEND') . '</span></a>';
             }
         }
     }
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_friends') && $easysocial->exists()) {
         $user = Foundry::user($bloggerid);
         // Check if the user is friends with the current viewer.
         if ($user->isFriends($my->id)) {
             return;
         }
         $easysocial->init();
         $theme = new CodeThemes();
         $theme->set('id', $bloggerid);
         $html = $theme->fetch('easysocial.friends.php');
     }
     return $html;
 }
Example #26
0
 public function getHTML($bloggerid = "")
 {
     $html = '';
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     // We don't want to show the link to the same user
     if ($my->id == $bloggerid) {
         return;
     }
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_followers') && $easysocial->exists()) {
         $user = Foundry::user($bloggerid);
         $followed = $user->isFollowed($my->id);
         if ($followed) {
             return;
         }
         $easysocial->init();
         $theme = new CodeThemes();
         $theme->set('id', $bloggerid);
         $html = $theme->fetch('easysocial.followers.php');
     }
     return $html;
 }
Example #27
0
 public function search($query = '')
 {
     $ajax = new Ejax();
     $model = $this->getModel('Search');
     $result = $model->searchText($query);
     if (empty($result)) {
         $ajax->script('$("#editor-content .search-results-content").height(24);');
         $ajax->assign('editor-content .search-results-content', JText::_('COM_EASYBLOG_DASHBOARD_WRITE_SEARCH_NO_RESULT'));
         return $ajax->send();
     }
     $count = count($result);
     if ($count > 10) {
         $height = "240";
     } else {
         $height = "24" * $count;
     }
     $theme = new CodeThemes('dashboard');
     $theme->set('result', $result);
     $ajax->assign('editor-content .search-results-content', $theme->fetch('dashboard.write.search.result.php'));
     $ajax->script('$("#editor-content .search-results-content").height(' . $height . ');');
     $ajax->script('$("#editor-content .search-results-content").show();');
     // $ajax->script( 'eblog.fileManager.setDockLayout();' );
     return $ajax->send();
 }
Example #28
0
 function display($tmpl = null)
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     if (!EasyBlogRouter::isCurrentActiveMenu('featured')) {
         $this->setPathway(JText::_('COM_EASYBLOG_FEATURED_BREADCRUMB'));
     }
     // set meta tags for featured view
     EasyBlogHelper::setMeta(META_ID_FEATURED, META_TYPE_VIEW);
     EasyBlogHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easyblog&view=featured');
     $model = $this->getModel('Featured');
     $data = $model->getFeaturedBlog();
     $pagination = $model->getPagination();
     $params = $mainframe->getParams('com_easyblog');
     $data = EasyBlogHelper::formatBlog($data);
     $blogModel = $this->getModel('Blog');
     $pageNumber = $pagination->get('pages.current');
     $pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
     $document->setTitle(EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_FEATURED_PAGE_TITLE') . $pageText));
     if ($config->get('layout_showcomment', false)) {
         for ($i = 0; $i < count($data); $i++) {
             $row =& $data[$i];
             $maxComment = $config->get('layout_showcommentcount', 3);
             $comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc');
             $comments = EasyBlogHelper::formatBlogCommentsLite($comments);
             $row->comments = $comments;
         }
     }
     $theme = new CodeThemes();
     $theme->set('data', $data);
     $theme->set('pagination', $pagination->getPagesLinks());
     $theme->set('currentURL', 'index.php?option=com_easyblog&view=featured');
     $theme->set('siteadmin', EasyBlogHelper::isSiteAdmin());
     $theme->set('config', $config);
     $theme->set('acl', $acl);
     echo $theme->fetch('blog.featured.php');
 }
Example #29
0
 function statistic()
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $acl = EasyBlogACLHelper::getRuleSet();
     // Add noindex for tags view by default.
     $document->setMetadata('robots', 'noindex,follow');
     $sort = JRequest::getCmd('sort', $config->get('layout_postorder'));
     $bId = JRequest::getCmd('id', '0');
     //stats type
     $statType = JRequest::getString('stat', '');
     $statId = $statType == 'tag' ? JRequest::getString('tagid', '') : JRequest::getString('catid', '');
     $statObject = null;
     if ($statType == 'category') {
         $statObject = EasyBlogHelper::getTable('Category', 'Table');
         $statObject->load($statId);
     } else {
         JTable::addIncludePath(EBLOG_TABLES);
         $statObject = EasyBlogHelper::getTable('Tag', 'Table');
         $statObject->load($statId);
     }
     $blogger = EasyBlogHelper::getTable('Profile', 'Table');
     $blogger->load($bId);
     // set meta tags for blogger
     if ($acl->rules->allow_seo) {
         EasyBlogHelper::setMeta($blogger->id, META_TYPE_BLOGGER, true);
     }
     if (!EasyBlogRouter::isCurrentActiveMenu('blogger')) {
         $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS'), EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger'));
     }
     if (!EasyBlogRouter::isCurrentActiveMenu('blogger', $blogger->id)) {
         $this->setPathway($blogger->getName());
     }
     $model = $this->getModel('Blog');
     $data = $model->getBlogsBy('blogger', $blogger->id, $sort);
     $pagination = $model->getPagination();
     $data = EasyBlogHelper::formatBlog($data);
     $rssURL = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&task=rss');
     if ($config->get('layout_showcomment', false)) {
         for ($i = 0; $i < count($data); $i++) {
             $row =& $data[$i];
             $maxComment = $config->get('layout_showcommentcount', 3);
             $comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc');
             $comments = EasyBlogHelper::formatBlogCommentsLite($comments);
             $row->comments = $comments;
         }
     }
     $twitterFollowMelink = EasyBlogSocialShareHelper::getLink('twitter', $blogger->id);
     if ($config->get('main_rss')) {
         if ($config->get('main_feedburner') && $config->get('main_feedburnerblogger')) {
             $document->addHeadLink($blogger->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         } else {
             // Add rss feed link
             $document->addHeadLink($blogger->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
             $document->addHeadLink($blogger->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
         }
     }
     $pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
     $pageNumber = $pagination->get('pages.current');
     $pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
     $statTitle = '';
     if (isset($statType)) {
         if ($statType == 'tag') {
             $statTitle = ' - ' . JText::sprintf('COM_EASYBLOG_BLOGGER_STAT_TAG', $statObject->title);
         } else {
             $statTitle = ' - ' . JText::sprintf('COM_EASYBLOG_BLOGGER_STAT_CATEGORY', $statObject->title);
         }
     }
     $document->setTitle($blogger->getName() . $statTitle . $pageText . $pageTitle);
     $tpl = new CodeThemes();
     $tpl->set('blogger', $blogger);
     $tpl->set('sort', $sort);
     $tpl->set('blogs', $data);
     $tpl->set('config', $config);
     $tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin());
     $tpl->set('pagination', $pagination->getPagesLinks());
     $tpl->set('twitterFollowMelink', $twitterFollowMelink);
     $tpl->set('my', $my);
     $tpl->set('acl', $acl);
     $tpl->set('currentURL', ltrim('/', JRequest::getURI()));
     $tpl->set('statType', $statType);
     $tpl->set('statObject', $statObject);
     echo $tpl->fetch('blog.blogger.php');
 }
Example #30
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();
 }