Пример #1
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;
 }
Пример #2
0
 public function getLimit($key = 'listlength')
 {
     $app = JFactory::getApplication();
     $default = EasyBlogHelper::getJConfig()->get('list_limit');
     if ($app->isAdmin()) {
         return $default;
     }
     $menus = JFactory::getApplication()->getMenu();
     $menu = $menus->getActive();
     $limit = -2;
     if (is_object($menu)) {
         $params = EasyBlogHelper::getRegistry();
         $params->load($menu->params);
         $limit = $params->get('limit', '-2');
     }
     // if menu did not specify the limit, then we use easyblog setting.
     if ($limit == '-2') {
         // Use default configurations.
         $config = EasyBlogHelper::getConfig();
         // @rule: For compatibility between older versions
         if ($key == 'listlength') {
             $key = 'layout_listlength';
         } else {
             $key = 'layout_pagination_' . $key;
         }
         $limit = $config->get($key);
     }
     // Revert to joomla's pagination if configured to inherit from Joomla
     if ($limit == '0' || $limit == '-1' || $limit == '-2') {
         $limit = $default;
     }
     return $limit;
 }
Пример #3
0
 /**
  * Responsible to perform the blog mappings
  */
 public function bind(&$blog)
 {
     $videoSource = JRequest::getVar('videoSource');
     $desc = JRequest::getVar('content');
     $title = JRequest::getVar('title', '');
     // If title is not set, we use the image name as the title
     if ($title == JText::_('COM_EASYBLOG_MICROBLOG_TITLE_OPTIONAL', true) || empty($title)) {
         $date = EasyBlogHelper::getHelper('Date')->dateWithOffSet(EasyBlogHelper::getDate()->toMySQL());
         $dateString = EasyBlogHelper::getHelper('Date')->toFormat($date, '%d-%m-%Y');
         // Define a generic video title
         $title = JText::sprintf('COM_EASYBLOG_MICROBLOG_VIDEO_TITLE_GENERIC', $dateString);
     }
     // Get the default settings
     $config = EasyBlogHelper::getConfig();
     $width = $config->get('dashboard_video_width');
     $height = $config->get('dashboard_video_height');
     // Now we need to embed the image URL into the blog content.
     $content = '[embed=videolink]{"video":"' . $videoSource . '","width":"' . $width . '","height":"' . $height . '"}[/embed]';
     // @task: If user specified some description, append it into the content.
     if (!empty($desc)) {
         // @task: Replace newlines with <br /> tags since the form is a plain textarea.
         $desc = nl2br($desc);
         $content .= '<p>' . $desc . '</p>';
     }
     $blog->set('title', $title);
     $blog->set('content', $content);
     $blog->set('source', EBLOG_MICROBLOG_VIDEO);
 }
Пример #4
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');
 }
Пример #5
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $id = JRequest::getCmd('id', '0');
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($id);
     // private category shouldn't allow to access.
     $privacy = $category->checkPrivacy();
     if (!$privacy->allowed) {
         return;
     }
     $catIds = array();
     $catIds[] = $category->id;
     EasyBlogHelper::accessNestedCategoriesId($category, $catIds);
     $model = $this->getModel('Blog');
     $posts = $model->getBlogsBy('category', $catIds);
     $weever = EasyBlogHelper::getHelper('Weever')->getMainFeed();
     $weever->set('description', JText::sprintf('COM_EASYBLOG_FEEDS_CATEGORY_DESC', $this->escape($category->title)));
     $weever->set('url', EasyBlogRouter::getRoutedUrl('index.php?option=com_easyblog&view=categories&id=' . $id . '&format=weever', false, true));
     $weever->set('thisPage', 1);
     $weever->set('lastPage', 1);
     if ($posts) {
         foreach ($posts as $post) {
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($post->id);
             $weever->addChild($blog);
         }
     }
     $weever->toJSON(true, JRequest::getVar('callback'));
 }
Пример #6
0
 function sendOnPageLoad($max = 5)
 {
     $db = EasyBlogHelper::db();
     $config = EasyBlogHelper::getConfig();
     $sendHTML = $config->get('main_mailqueuehtmlformat', 0);
     // Delete existing mails that has already been sent.
     $query = 'DELETE FROM ' . $db->nameQuote('#__easyblog_mailq') . ' WHERE ' . $db->nameQuote('status') . '=' . $db->Quote(1) . ' AND DATEDIFF(NOW(), `created`) >= 7';
     $db->setQuery($query);
     $db->Query();
     $query = 'SELECT `id` FROM `#__easyblog_mailq` WHERE `status` = 0';
     $query .= ' ORDER BY `created` ASC';
     $query .= ' LIMIT ' . $max;
     $db->setQuery($query);
     $result = $db->loadObjectList();
     if (!empty($result)) {
         foreach ($result as $mail) {
             $mailq = EasyBlogHelper::getTable('MailQueue', 'Table');
             $mailq->load($mail->id);
             // update the status to 1 == proccessed
             $mailq->status = 1;
             if ($mailq->store()) {
                 // Send emails out.
                 if (EasyBlogHelper::getJoomlaVersion() >= '3.0') {
                     $mail = JFactory::getMailer();
                     $mail->sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $sendHTML);
                 } else {
                     JUtility::sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $sendHTML);
                 }
             }
         }
     }
 }
Пример #7
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');
 }
Пример #8
0
    public static function getHTML($row)
    {
        $config = EasyBlogHelper::getConfig();
        if (!$config->get('main_tweetmeme')) {
            return '';
        }
        $service = $config->get('main_tweetmeme_url');
        $style = $config->get('main_tweetmeme_style');
        $source = $config->get('main_tweetmeme_rtsource');
        $buttonSize = 'social-button-';
        switch ($style) {
            case 'normal':
                $buttonSize .= 'large';
                break;
            case 'compact':
            default:
                $buttonSize .= 'small';
                break;
        }
        $url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $row->id, false, true);
        $title = addslashes($row->title);
        $placeholder = 'sb-' . rand();
        $html = '<div class="social-button ' . $buttonSize . ' tweetmeme"><span id="' . $placeholder . '"></span></div>';
        $html .= EasyBlogHelper::addScriptDeclarationBookmarklet('$("#' . $placeholder . '").bookmarklet("tweetMeme", {
			service: "' . $service . '",
			style: "' . $style . '",
			url: "' . $url . '",
			title: "' . $title . '",
			source: "' . $source . '"
		});');
        return $html;
    }
Пример #9
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);
     }
 }
Пример #10
0
 public static function addCard(&$blog, $rawIntroText)
 {
     $cfg = EasyBlogHelper::getConfig();
     // @rule: Check if user really wants to append the opengraph tags on the headers.
     if (!$cfg->get('main_twitter_cards')) {
         return false;
     }
     // Get the absolute permalink for this blog item.
     $url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     // Get the image of the blog post.
     $image = self::getImage($blog, $rawIntroText);
     // @task: Get Joomla's document object.
     $doc = JFactory::getDocument();
     // Add card definition.
     $doc->addCustomTag('<meta property="twitter:card" content="summary" />');
     $doc->addCustomTag('<meta property="twitter:url" content="' . $url . '" />');
     $doc->addCustomTag('<meta property="twitter:title" content="' . $blog->title . '" />');
     $text = EasyBlogHelper::stripEmbedTags($rawIntroText);
     $text = strip_tags($text);
     $text = str_ireplace("\r\n", "", $text);
     // Remove any " in the content as this would mess up the headers.
     $text = str_ireplace('"', '', $text);
     $maxLength = 137;
     if (!empty($maxLength)) {
         $text = JString::strlen($text) > $maxLength ? JString::substr($text, 0, $maxLength) . '...' : $text;
     }
     $text = EasyBlogStringHelper::escape($text);
     $doc->addCustomTag('<meta property="twitter:description" content="' . $text . '" />');
     if ($image) {
         $doc->addCustomTag('<meta property="twitter:image" content="' . $image . '"/> ');
     }
     return true;
 }
Пример #11
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;
 }
Пример #12
0
 public function __construct()
 {
     $lang = JFactory::getLanguage();
     $lang->load('com_easyblog', JPATH_ROOT);
     $this->exists = $this->exists();
     $this->config = EasyBlogHelper::getConfig();
 }
Пример #13
0
 /**
  * Initiate class variables
  */
 public function init()
 {
     $this->config = EasyBlogHelper::getConfig();
     $this->enabled = $this->config->get('main_remotepublishing_mailbox');
     $this->server = $this->config->get('main_remotepublishing_mailbox_remotesystemname');
     $this->port = $this->config->get('main_remotepublishing_mailbox_port');
     $this->mailbox_name = $this->config->get('main_remotepublishing_mailbox_mailboxname');
     $this->service = $this->config->get('main_remotepublishing_mailbox_service');
     $this->username = $this->config->get('main_remotepublishing_mailbox_username');
     $this->password = $this->config->get('main_remotepublishing_mailbox_password');
     $this->ssl = $this->config->get('main_remotepublishing_mailbox_ssl');
     $this->subject_prefix = $this->config->get('main_remotepublishing_mailbox_prefix');
     $this->check_interval = $this->config->get('main_remotepublishing_mailbox_run_interval');
     $this->validate_cert = $this->config->get('main_remotepublishing_mailbox_validate_cert');
     $this->flags = '';
     $this->flags .= $this->service ? '/' . $this->service : '';
     $this->flags .= $this->ssl ? '/ssl' : '';
     $this->flags .= $this->debug ? '/debug' : '';
     $this->flags .= $this->norch ? '/norch' : '';
     $this->flags .= $this->validate_cert ? '' : '/novalidate-cert';
     //$this->flags			.= $this->tls 		? '/tls' : '/notls';
     $this->flags .= $this->readonly ? '/readonly' : '';
     $this->mailbox_params = '{' . $this->server . ':' . $this->port . $this->flags . '}' . $this->mailbox_name;
     $this->initiated = true;
 }
Пример #14
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $id = JRequest::getInt('id');
     $team = EasyBlogHelper::getTable('TeamBlog');
     $team->load($id);
     if ($team->access != EBLOG_TEAMBLOG_ACCESS_EVERYONE) {
         return;
     }
     $model = $this->getModel('Blog');
     $posts = $model->getBlogsBy('teamblog', $team->id);
     $weever = EasyBlogHelper::getHelper('Weever')->getMainFeed();
     $weever->set('description', JText::sprintf('COM_EASYBLOG_FEEDS_TEAMBLOGS_DESC', $team->title));
     $weever->set('url', EasyBlogRouter::getRoutedUrl('index.php?option=com_easyblog&view=teamblog&id=' . $id . '&format=weever', false, true));
     $weever->set('thisPage', 1);
     $weever->set('lastPage', 1);
     if ($posts) {
         foreach ($posts as $post) {
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($post->id);
             $weever->addChild($blog);
         }
     }
     $weever->toJSON(true, JRequest::getVar('callback'));
 }
Пример #15
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $id = JRequest::getInt('id');
     $my = JFactory::getUser();
     if (!$id) {
         echo JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND');
         exit;
     }
     // @task: Do not allow access to read when configured to.
     if ($my->id <= 0 && $config->get('main_login_read')) {
         echo JText::_('You are not allowed to read this');
         exit;
     }
     // @task: Do not allow users to read password protected entries
     if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
         echo JText::_('Password protected entries are not allowed yet.');
         exit;
     }
     $blog = EasyBlogHelper::getTable('Blog');
     $blog->load($id);
     $weever = EasyBlogHelper::getHelper('Weever')->getDetailsFeed();
     $weever->map($blog);
     $weever->toJSON(true, JRequest::getVar('callback'));
 }
Пример #16
0
 public function get()
 {
     $input = JFactory::getApplication()->input;
     $model = EasyBlogHelper::getModel('Blog');
     $config = EasyBlogHelper::getConfig();
     $id = $input->get('id', null, 'INT');
     // If we have an id try to fetch the user
     $blog = EasyBlogHelper::getTable('Blog');
     $blog->load($id);
     if (!$id) {
         $this->plugin->setResponse($this->getErrorResponse(404, 'Blog id cannot be blank'));
         return;
     }
     if (!$blog->id) {
         $this->plugin->setResponse($this->getErrorResponse(404, 'Blog not found'));
         return;
     }
     //$item = EasyBlogHelper::getHelper( 'SimpleSchema' )->mapPost($blog, '<p><br><pre><a><blockquote><strong><h2><h3><em><ul><ol><li><iframe>');
     $scm_obj = new EasyBlogSimpleSchema_4();
     $item = $scm_obj->mapPost($blog, '<p><br><pre><a><blockquote><strong><h2><h3><em><ul><ol><li><iframe>');
     $item->isowner = $blog->created_by == $this->plugin->get('user')->id ? true : false;
     $item->allowcomment = $blog->allowcomment;
     $item->allowsubscribe = $blog->subscription;
     // Tags
     $modelPT = EasyBlogHelper::getModel('PostTag');
     $item->tags = $modelPT->getBlogTags($blog->id);
     //created by vishal - for show extra images
     //$item->text = preg_replace('/"images/i', '"'.JURI::root().'images', $item->text );
     $item->text = str_replace('href="', 'href="' . JURI::root(), $item->text);
     $item->text = str_replace('src="', 'src="' . JURI::root(), $item->text);
     $this->plugin->setResponse($item);
 }
Пример #17
0
 public function __construct(&$subject, $config = array())
 {
     parent::__construct($subject, $config = array());
     $easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php';
     if (!JFile::exists($easyblog) || !JComponentHelper::isEnabled('com_easysocial', true)) {
         ApiError::raiseError(404, 'Easyblog not installed');
         return;
     }
     // Load Easyblog language & bootstrap files
     $language = JFactory::getLanguage();
     $language->load('com_easyblog');
     require_once JPATH_ROOT . '/components/com_easyblog/constants.php';
     require_once EBLOG_HELPERS . '/helper.php';
     // Set resources & access
     ApiResource::addIncludePath(dirname(__FILE__) . '/easyblog');
     $this->setResourceAccess('latest', 'public', 'get');
     $this->setResourceAccess('category', 'public', 'get');
     $this->setResourceAccess('blog', 'public', 'get');
     $this->setResourceAccess('blog', 'public', 'post');
     $this->setResourceAccess('comments', 'public', 'get');
     $this->setResourceAccess('easyblog_users', 'public', 'get');
     $config = EasyBlogHelper::getConfig();
     if ($config->get('main_allowguestcomment')) {
         $this->setResourceAccess('comments', 'public', 'post');
     }
 }
Пример #18
0
 function display()
 {
     JTable::addIncludePath(EBLOG_TABLES);
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $config = EasyBlogHelper::getConfig();
     $id = JRequest::getInt('post_id', 0);
     if (!$config->get('main_trackbacks')) {
         echo JText::_('Trackback disabled');
         return;
     }
     if ($id == 0) {
         echo JText::_('COM_EASYBLOG_TRACKBACK_INVALID_BLOG_ENTRY_PROVIDED');
         return;
     }
     $blog = EasyBlogHelper::getTable('Blog', 'Table');
     $blog->load($id);
     header('Content-Type: text/xml');
     require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'trackback.php';
     $data = JRequest::get('REQUEST');
     $trackback = EasyBlogHelper::getTable('Trackback', 'Table');
     $trackback->bind($data);
     $title = JString::trim($trackback->title);
     $excerpt = JString::trim($trackback->excerpt);
     $url = JString::trim($trackback->url);
     $tb = new EasyBlogTrackback('', '', 'UTF-8');
     //@task: We must have at least the important information
     if (empty($title)) {
         echo $tb->receive(false, JText::_('COM_EASYBLOG_TRACKBACK_INVALID_TITLE_PROVIDED'));
         exit;
     }
     //@task: We must have at least the important information
     if (empty($excerpt)) {
         echo $tb->receive(false, JText::_('COM_EASYBLOG_TRACKBACK_INVALID_EXCERT_PROVIDED'));
         exit;
     }
     //@task: We must have at least the important information
     if (empty($url)) {
         echo $tb->receive(false, JText::_('COM_EASYBLOG_TRACKBACK_INVALID_URL_PROVIDED'));
         exit;
     }
     // Check for spams with Akismet
     if ($config->get('comment_akismet_trackback')) {
         $data = array('author' => $title, 'email' => '', 'website' => JURI::root(), 'body' => $excerpt, 'permalink' => $url);
         if (EasyBlogHelper::getHelper('Akismet')->isSpam($data)) {
             echo $tb->receive(false, JText::_('COM_EASYBLOG_TRACKBACK_MARKED_AS_SPAM'));
             exit;
         }
     }
     $trackback->created = EasyBlogHelper::getDate()->toMySQL();
     $trackback->published = '0';
     $trackback->ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
     if ($trackback->store()) {
         echo $tb->receive(true);
         exit;
     }
     echo $tb->receive(false, JText::_('COM_EASYBLOG_ERROR'));
     exit;
 }
Пример #19
0
 public function display($tmpl = null)
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     //for trigger
     $params = $mainframe->getParams('com_easyblog');
     $joomlaVersion = EasyBlogHelper::getJoomlaVersion();
     $blogId = $this->input->get('id', 0, 'int');
     if (empty($blogId)) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_BLOG_NOT_FOUND'));
     }
     $my = JFactory::getUser();
     $blog = EB::table('Blog');
     $blog->load($blogId);
     $post = EB::post($blogId);
     // Check if blog is password protected.
     $protected = $this->isProtected($post);
     if ($protected !== false) {
         return;
     }
     // If the blog post is already deleted, we shouldn't let it to be accessible at all.
     if ($post->isTrashed()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // Check if the blog post is trashed
     if (!$post->isPublished() && $this->my->id != $post->created_by && !EB::isSiteAdmin()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // Check for team's privacy
     $allowed = $this->checkTeamPrivacy($post);
     if ($allowed === false) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_TEAMBLOG_MEMBERS_ONLY'));
     }
     // Check if the blog post is accessible.
     $accessible = $post->isAccessible();
     if (!$accessible->allowed) {
         echo $accessible->error;
         return;
     }
     // Format the post
     $post = EB::formatter('entry', $post);
     $tags = $post->getTags();
     $theme = EB::template();
     $theme->set('post', $post);
     $theme->set('tags', $tags);
     $blogHtml = $theme->output('site/blogs/entry/pdf');
     $pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
     $document->setTitle($post->title . $pageTitle);
     $document->setName($post->getPermalink());
     // Fix phoca pdf plugin.
     if (method_exists($document, 'setArticleText')) {
         $document->setArticleText($blogHtml);
     }
     echo $blogHtml;
     return;
 }
Пример #20
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);
         }
     }
 }
Пример #21
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();
 }
Пример #22
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;
 }
Пример #23
0
 function _init()
 {
     $config = EasyBlogHelper::getConfig();
     $this->phpbbpath = $config->get('layout_phpbb_path');
     $this->files = JPATH_ROOT . DIRECTORY_SEPARATOR . $this->phpbbpath . DIRECTORY_SEPARATOR . 'config.php';
     if (!JFile::exists($this->files)) {
         return false;
     }
     return true;
 }
Пример #24
0
 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;
 }
Пример #25
0
 public function getAvatarURL($profile)
 {
     $config = EasyBlogHelper::getConfig();
     $class = 'EasyBlogAvatar' . $config->get('layout_avatarIntegration');
     $obj = new $class();
     if ($obj->_init()) {
         return $obj->_getAvatar($profile)->link;
     }
     $obj = new EasyBlogAvatarDefault();
     return $obj->_getAvatar($profile)->link;
 }
Пример #26
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $useLimit = $config->get('layout_listlength') == 0 ? $mainframe->getCfg('list_limit') : $config->get('layout_listlength');
     $limit = $mainframe->getUserStateFromRequest('com_easyblog.drafts.limit', 'limit', $useLimit, 'int');
     $limitstart = (int) JRequest::getVar('limitstart', 0, '', 'int');
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
 }
Пример #27
0
 public function isAssociated($userId, $type)
 {
     //check if centralized, then use centralized.
     $config = EasyBlogHelper::getConfig();
     $allowed = $config->get('integrations_' . strtolower($type) . '_centralized_and_own');
     if (!$allowed) {
         return false;
     }
     $oauth = EB::table('Oauth');
     return $oauth->loadByUser($userId, constant('EBLOG_OAUTH_' . strtoupper($type)));
 }
Пример #28
0
 function addSubscription($post)
 {
     $ejax = new Ejax();
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $isModerate = false;
     $userId = $post['userid'];
     $email = $post['email'];
     $bloggerId = $post['id'];
     if (JString::trim($email) == '') {
         $ejax->alert(JText::_('COM_EASYBLOG_SUBSCRIPTIONS_EMAIL_IS_EMPTY'), JText::_('COM_EASYBLOG_ERROR'), '450', 'auto');
         $ejax->send();
         return;
     }
     //check if userid not empty (site member)
     //check the userid exists in table. If exists, just do a update incase user email has been updated.
     //if userid empty (non-site member)
     //check if the email address already in table.
     //if yes, show message say the email already in.
     //if not, add the email into table
     $model = $this->getModel('Blogger');
     $sid = '';
     if ($userId == 0) {
         $sid = $model->isBloggerSubscribedEmail($bloggerId, $email);
         if ($sid != '') {
             //user found.
             // show message.
             $ejax->alert(JText::_('COM_EASYBLOG_SUBSCRIBE_BLOGGER_ALREADY_SUBSCRIBED'), JText::_('COM_EASYBLOG_WARNING'), '450', 'auto');
             $ejax->send();
             return;
         } else {
             $model->addBloggerSubscription($bloggerId, $email);
         }
     } else {
         $sid = $model->isBloggerSubscribedUser($bloggerId, $userId);
         if ($sid != '') {
             // user found.
             // update the email address
             $model->updateBloggerSubscriptionEmail($sid, $email);
         } else {
             //add new subscription.
             $model->addBloggerSubscription($bloggerId, $email, $userId);
         }
     }
     $ejax->alert(JText::_('COM_EASYBLOG_SUBSCRIBE_BLOGGER_SUCCESS'), JText::_('COM_EASYBLOG_INFO'), '450', 'auto');
     $ejax->send();
     return;
     //        echo '<pre>';
     //        print_r($post);
     //        echo '</pre>';
     //        exit;
 }
Пример #29
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');
 }
Пример #30
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');
 }