Esempio n. 1
0
 public function store($updateNulls = false)
 {
     if (!$this->created) {
         $this->created = EasyBlogHelper::getDate()->toMySQL();
     }
     return parent::store($updateNulls);
 }
Esempio n. 2
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);
 }
Esempio n. 3
0
 /**
  * Adds a notification item in JomSocial
  *
  * @access	public
  * @param 	TableBlog	$blog 	The blog table.
  */
 public function addNotification($title, $type, $target, $author, $link)
 {
     jimport('joomla.filesystem.file');
     // @since this only works with JomSocial 2.6, we need to test certain files.
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'notificationtypes.php';
     if (!$this->exists || empty($target) || $target[0] == $author->getId() || !JFile::exists($file)) {
         return false;
     }
     CFactory::load('helpers', 'notificationtypes');
     CFactory::load('helpers', 'content');
     CFactory::load('libraries', 'notificationtypes');
     // @task: Set the necessary parameters first.
     $params = EasyBlogHelper::getRegistry('');
     $params->set('url', str_replace("administrator/", "", $author->getProfileLink()));
     // @task: Obtain model from jomsocial.
     $model = CFactory::getModel('Notification');
     // @task: Currently we are not using this, so we should just skip this.
     $requireAction = 0;
     if (!is_array($target)) {
         $target = array($target);
     }
     foreach ($target as $targetId) {
         JTable::addIncludePath(JPATH_ROOT . '/components/com_community/tables');
         $notification = JTable::getInstance('Notification', 'CTable');
         $notification->actor = $author->getId();
         $notification->target = $targetId;
         $notification->content = $title;
         $notification->created = EasyBlogHelper::getDate()->toMySQL();
         $notification->params = $params->toString();
         $notification->cmd_type = CNotificationTypesHelper::convertNotifId($type);
         $notification->type = 0;
         $notification->store();
     }
     return true;
 }
Esempio n. 4
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;
 }
Esempio n. 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();
 }
Esempio n. 6
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');
 }
Esempio n. 7
0
 /**
  * Delete the outdated entries.
  */
 function clear()
 {
     $db = EasyBlogHelper::db();
     $date = EasyBlogHelper::getDate();
     $query = 'DELETE FROM `#__easyblog_captcha` WHERE `created` <= DATE_SUB( ' . $db->Quote($date->toMySQL()) . ', INTERVAL 12 HOUR )';
     $db->setQuery($query);
     $db->query();
     return true;
 }
Esempio n. 8
0
 private function _buildQuery($userId, $limit = 0, $startdate = '', $isCnt = false)
 {
     $db = EasyBlogHelper::db();
     $dates = $this->_getDateRange($userId, $limit, $startdate);
     $this->currentDateRange = $dates;
     //$limitQuery = '';
     $limitQuery = ' and (a.`created` >= ' . $db->Quote($dates['startdate']) . ' and a.`created` <= ' . $db->Quote($dates['enddate']) . ')';
     $query = '';
     if ($isCnt) {
         $query = ' select COUNT(1) FROM (';
     } else {
         $query = ' select * FROM (';
     }
     $operation = '( UNIX_TIMESTAMP( \'' . EasyBlogHelper::getDate()->toMySQL() . '\' ) - UNIX_TIMESTAMP( a.`created`) )';
     $query .= ' (select ';
     if ($isCnt) {
         $query .= ' a.id';
     } else {
         $query .= ' FLOOR( ' . $operation . ' ) AS minsecdiff,';
         $query .= ' FLOOR( ' . $operation . ' / 60 / 60) AS hourdiff,';
         $query .= ' FLOOR( ' . $operation . ' / 60 / 60 / 24) AS daydiff,';
         $query .= ' a.`id`, a.`actor_id`, a.`target_id`, concat( a.`context_type`, ' . $db->Quote('-') . ', a.`verb`) as `context_type`,';
         $query .= ' a.`context_type` as `plain_context_type`, a.`context_id`, a.`verb`, a.`source_id`, a.`created`, a.`uuid`';
     }
     $query .= ' from `#__easyblog_stream` as a';
     $query .= ' 	INNER JOIN `#__users` as b ON b.id = a.actor_id';
     $query .= ' where a.actor_id = ' . $db->Quote($userId);
     $query .= $limitQuery;
     $query .= ' )';
     $query .= ' UNION ';
     $query .= ' (select ';
     if ($isCnt) {
         $query .= ' a.id';
     } else {
         $query .= ' FLOOR( ' . $operation . ' ) AS minsecdiff,';
         $query .= ' FLOOR( ' . $operation . ' / 60 / 60) AS hourdiff,';
         $query .= ' FLOOR( ' . $operation . ' / 60 / 60 / 24) AS daydiff,';
         $query .= ' a.`id`, a.`actor_id`, a.`target_id`, concat( a.`context_type`, ' . $db->Quote('-') . ', a.`verb`) as `context_type`,';
         $query .= ' a.`context_type` as `plain_context_type`, a.`context_id`, a.`verb`, a.`source_id`, a.`created`, a.`uuid`';
     }
     $query .= ' from `#__easyblog_stream` as a';
     $query .= ' 	INNER JOIN `#__users` as b ON b.id = a.target_id';
     $query .= ' where a.target_id = ' . $db->Quote($userId);
     $query .= ' and a.actor_id != ' . $db->Quote($userId);
     $query .= $limitQuery;
     $query .= ' )';
     $query .= ' ) as x';
     if (!$isCnt) {
         $query .= ' order by x.created desc';
     }
     return $query;
 }
Esempio n. 9
0
 public static function processDate($timestamp = '')
 {
     //This gets today's date
     if (empty($timestamp)) {
         $jdate = EasyBlogHelper::getDate();
         $timestamp = $jdate->toUnix();
     }
     //This puts the day, month, and year in seperate variables
     $date['day'] = date('d', $timestamp);
     $date['month'] = date('m', $timestamp);
     $date['year'] = date('Y', $timestamp);
     $date['unix'] = $timestamp;
     return $date;
 }
Esempio n. 10
0
 function request()
 {
     $mainframe = JFactory::getApplication();
     if (!EasyBlogHelper::isLoggedIn()) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog', false));
         return;
     }
     $redirect = JRequest::getVar('redirect', '');
     $type = JRequest::getCmd('type');
     if (!empty($redirect)) {
         $redirect = '&redirect=' . $redirect;
     }
     $userId = JRequest::getVar('id');
     // Flickr integration does not require user id.
     if (empty($userId)) {
         $mainframe->enqueueMessage(JText::_('Error, User not found.'), 'error');
         $redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
         $this->setRedirect($redirect);
         return;
     }
     $call = JRequest::getWord('call');
     $callUri = !empty($call) ? '&call=' . $call . '&id=' . $userId : '&id=' . $userId;
     $config = EasyBlogHelper::getConfig();
     $key = $config->get('integrations_' . $type . '_api_key');
     $secret = $config->get('integrations_' . $type . '_secret_key');
     $callback = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&c=oauth&task=grant&type=' . $type . $redirect . $callUri;
     $consumer = EasyBlogOauthHelper::getConsumer($type, $key, $secret, $callback);
     $request = $consumer->getRequestToken();
     if (empty($request->token) || empty($request->secret)) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_OAUTH_KEY_INVALID'), 'error');
         $redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
         $this->setRedirect($redirect);
         return;
     }
     $oauth = EasyBlogHelper::getTable('Oauth', 'Table');
     $oauth->user_id = $userId;
     $oauth->type = $type;
     $oauth->created = EasyBlogHelper::getDate()->toMySQL();
     // Bind the request tokens
     $param = EasyBlogHelper::getRegistry('');
     $param->set('token', $request->token);
     $param->set('secret', $request->secret);
     $oauth->request_token = $param->toString();
     $oauth->store();
     $this->setRedirect($consumer->getAuthorizationURL($request->token, false, 'popup'));
 }
Esempio n. 11
0
 /**
  * Process report items.
  *
  * @access	public
  * @param	null
  **/
 public function submitReport()
 {
     JRequest::checkToken() or die('Invalid Token');
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     if (!$my->id && !$config->get('main_reporting_guests')) {
         echo JText::_('COM_EASYBLOG_CATEGORIES_FOR_REGISTERED_USERS_ONLY');
         exit;
     }
     $objId = JRequest::getInt('obj_id');
     $objType = JRequest::getCmd('obj_type');
     $reason = JRequest::getString('reason');
     // @task: Ensure that the reason is never empty.
     if (empty($reason)) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_REPORT_PLEASE_SPECIFY_REASON'), 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false));
         return;
     }
     $report = EasyBlogHelper::getTable('Report');
     $report->set('obj_id', $objId);
     $report->set('obj_type', $objType);
     $report->set('reason', $reason);
     $report->set('created', EasyBlogHelper::getDate()->toMySQL());
     $report->set('created_by', $my->id);
     $report->set('ip', @$_SERVER['REMOTE_ADDR']);
     if (!$report->store()) {
         $error = $report->getError();
         EasyBlogHelper::setMessageQueue($error, 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false));
         return;
     }
     // @TODO: Configurable report links
     switch ($objType) {
         case EBLOG_REPORTING_POST:
         default:
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($objId);
             $report->notify($blog);
             $message = JText::_('COM_EASYBLOG_THANKS_FOR_REPORTING');
             $redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false);
             break;
     }
     EasyBlogHelper::setMessageQueue($message);
     $this->setRedirect($redirect);
 }
Esempio n. 12
0
 public function vote($value, $uid, $type, $elementId)
 {
     $ajax = new Ejax();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $blog = EasyBlogHelper::getTable('Blog', 'Table');
     $blog->load($uid);
     if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
         if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
             echo 'Invalid Access.';
             exit;
         }
     }
     $rating = EasyBlogHelper::getTable('Ratings', 'Table');
     // Do not allow guest to vote, or if the voter already voted.
     if ($rating->fill($my->id, $uid, $type, JFactory::getSession()->getId()) || $my->id < 1 && !$config->get('main_ratings_guests')) {
         // We wouldn't allow user to vote more than once so don't do anything here
         $ajax->send();
     }
     $rating->set('created_by', $my->id);
     $rating->set('type', $type);
     $rating->set('uid', $uid);
     $rating->set('ip', @$_SERVER['REMOTE_ADDR']);
     $rating->set('value', (int) $value);
     $rating->set('sessionid', JFactory::getSession()->getId());
     $rating->set('created', EasyBlogHelper::getDate()->toMySQL());
     $rating->set('published', 1);
     $rating->store();
     $model = EasyBlogHelper::getModel('Ratings');
     $ratingValue = $model->getRatingValues($uid, $type);
     $total = $ratingValue->total;
     $rating = $ratingValue->ratings;
     // Assign badge for users that report blog post.
     // Only give points if the viewer is viewing another person's blog post.
     EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.rate', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_RATED_BLOG'));
     $ajax->script('eblog.loader.doneLoading("' . $elementId . '-command .ratings-text")');
     $ajax->script('eblog.ratings.update("' . $elementId . '", "' . $type . '" , "' . $rating . '" , "' . JText::_('COM_EASYBLOG_RATINGS_RATED_THANK_YOU') . '");');
     $ajax->assign($elementId . ' .ratings-value', '<i></i>' . $total . '<b>&radic;</b>');
     if (EasyBlogHelper::isAUPEnabled()) {
         $id = AlphaUserPointsHelper::getAnyUserReferreID($my->id);
         AlphaUserPointsHelper::newpoints('plgaup_easyblog_rate_blog', $id, '', JText::sprintf('COM_EASYBLOG_AUP_BLOG_RATED'), '');
     }
     $ajax->send();
 }
Esempio n. 13
0
 /**
  * Responsible to perform the blog mappings
  */
 public function bind(&$blog)
 {
     $content = JRequest::getVar('content');
     $title = JRequest::getVar('title');
     $link = JRequest::getVar('link', '');
     // If title is not set, we use the image name as the title
     if ($title == JText::_('COM_EASYBLOG_MICROBLOG_TITLE_OPTIONAL', true) || empty($title)) {
         $title = $link;
     }
     if (empty($content)) {
         $date = EasyBlogHelper::getHelper('Date')->dateWithOffSet(EasyBlogHelper::getDate()->toMySQL());
         $dateString = EasyBlogHelper::getHelper('Date')->toFormat($date, '%d-%m-%Y');
         // Define a generic video title
         $content = '<p>' . JText::sprintf('COM_EASYBLOG_MICROBLOG_LINK_CONTENT_GENERIC', $dateString) . '</p>';
     } else {
         // @task: Replace newlines with <br /> tags since the form is a plain textarea.
         $content = nl2br($content);
     }
     $blog->set('title', $title);
     $blog->set('content', $content);
     $blog->set('source', EBLOG_MICROBLOG_LINK);
 }
Esempio n. 14
0
 public function updateComment()
 {
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     $acl = EasyBlogACLHelper::getRuleSet();
     $id = JRequest::getInt('commentId');
     $post = JRequest::get('POST');
     //add here so that other component with the same comment.php jtable file will not get reference.
     JTable::addIncludePath(EBLOG_TABLES);
     $comment = EasyBlogHelper::getTable('Comment', 'Table');
     $comment->load($id);
     $redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $comment->post_id, false);
     if (($my->id != $comment->created_by || !$acl->rules->delete_comment) && !EasyBlogHelper::isSiteAdmin() && !$acl->rules->manage_comment || $my->id == 0) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_UPDATE_COMMENT'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     $comment->bindPost($post);
     if (!$comment->validate('title')) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_COMMENT_TITLE_IS_EMPTY'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     if (!$comment->validate('comment')) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_COMMENT_IS_EMPTY'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     $comment->modified = EasyBlogHelper::getDate()->toMySQL();
     if (!$comment->store()) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_COMMENT_FAILED_TO_SAVE'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_COMMENT_UPDATED_SUCCESS'), 'success');
     $mainframe->redirect($redirect);
     $mainframe->close();
 }
Esempio n. 15
0
 function request()
 {
     if (!EasyBlogHelper::isLoggedIn()) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog', false));
         return;
     }
     $redirect = JRequest::getVar('redirect', '');
     if (!empty($redirect)) {
         $redirect = '&redirect=' . $redirect;
     }
     $call = JRequest::getWord('call');
     $callUri = !empty($call) ? '&call=' . $call : '';
     $type = JRequest::getCmd('type');
     $config = EasyBlogHelper::getConfig();
     $key = $config->get('integrations_' . $type . '_api_key');
     $secret = $config->get('integrations_' . $type . '_secret_key');
     $callback = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&controller=oauth&task=grant&type=' . $type . $redirect . $callUri, false, true);
     $consumer = EasyBlogOauthHelper::getConsumer($type, $key, $secret, $callback);
     $request = $consumer->getRequestToken();
     if (empty($request->token) || empty($request->secret)) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_OAUTH_KEY_INVALID'), 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
         return;
     }
     $oauth = EasyBlogHelper::getTable('Oauth', 'Table');
     $oauth->user_id = JFactory::getUser()->id;
     $oauth->type = $type;
     $oauth->created = EasyBlogHelper::getDate()->toMySQL();
     // Bind the request tokens
     $param = EasyBlogHelper::getRegistry('');
     $param->set('token', $request->token);
     $param->set('secret', $request->secret);
     $oauth->request_token = $param->toString();
     $oauth->store();
     $this->setRedirect($consumer->getAuthorizationURL($request->token, false, 'popup'));
 }
Esempio n. 16
0
 function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // @task: Check for acl rules.
     $this->checkAccess('teamblog');
     $post = JRequest::get('post');
     $team_desc = JRequest::getVar('write_description', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $post['description'] = $team_desc;
     if (!empty($post['title'])) {
         $team = EasyBlogHelper::getTable('TeamBlog', 'Table');
         $date = EasyBlogHelper::getDate();
         $team->created = $date->toMySQL();
         $team->bind($post);
         $team->title = JString::trim($team->title);
         $team->alias = JString::trim($team->alias);
         $msgStatus = 'message';
         $message = JText::_('COM_EASYBLOG_TEAM_BLOG_ADDED');
         if ($team->id != 0) {
             $message = JText::_('COM_EASYBLOG_TEAMBLOG_SAVED_SUCCESSFULLY');
         }
         if ($team->store()) {
             //meta post info
             $metapost = array();
             $metapost['keywords'] = JRequest::getVar('keywords', '');
             $metapost['description'] = JRequest::getVar('description', '');
             $metapost['content_id'] = $team->id;
             $metapost['type'] = META_TYPE_TEAM;
             $metaId = JRequest::getVar('metaid', '');
             $meta = EasyBlogHelper::getTable('Meta', 'Table');
             $meta->load($metaId);
             $meta->bind($metapost);
             $meta->store();
             // @rule: Process groups
             if (isset($post['groups'])) {
                 foreach ($post['groups'] as $id) {
                     $group = EasyBlogHelper::getTable('TeamBlogGroup', 'Table');
                     $group->team_id = $team->id;
                     $group->group_id = $id;
                     if (!$group->exists()) {
                         $group->store();
                     }
                 }
             }
             if (isset($post['deletegroups'])) {
                 $delGroups = explode(',', $post['deletegroups']);
                 if (count($delGroups) > 0) {
                     foreach ($delGroups as $id) {
                         if (!empty($id)) {
                             $team->deleteGroup($id);
                         }
                     }
                 }
             }
             if (isset($post['deletemembers'])) {
                 $delMember = explode(',', $post['deletemembers']);
                 if (count($delMember) > 0) {
                     foreach ($delMember as $id) {
                         if (!empty($id)) {
                             $team->deleteMembers($id);
                         }
                     }
                 }
             }
             // @rule: Process members
             if (isset($post['members'])) {
                 foreach ($post['members'] as $id) {
                     $member = EasyBlogHelper::getTable('TeamBlogUsers', 'Table');
                     $member->team_id = $team->id;
                     $member->user_id = $id;
                     if (!$member->exists()) {
                         $member->addMember();
                     }
                 }
             }
             $file = JRequest::getVar('Filedata', '', 'files', 'array');
             if (!empty($file['name'])) {
                 $newAvatar = EasyBlogHelper::uploadTeamAvatar($team, true);
                 $team->avatar = $newAvatar;
                 $team->store();
                 //now update the avatar.
             }
         }
     } else {
         $msgStatus = 'error';
         $message = JText::_('COM_EASYBLOG_INVALID_TEAM_BLOG_TITLE');
     }
     if (JRequest::getVar('task') == 'apply') {
         $this->setRedirect('index.php?option=com_easyblog&c=teamblogs&task=edit&id=' . $team->id, $message, $msgStatus);
         return;
     }
     $this->setRedirect('index.php?option=com_easyblog&view=teamblogs', $message, $msgStatus);
     return;
 }
Esempio n. 17
0
 public static function cleanImageName($argFileName)
 {
     // Ensure that the file name is safe.
     $argFileName = JFile::makeSafe($argFileName);
     // Ensure that the file name does not contain UTF-8 data.
     $argFileName = trim($argFileName);
     $fileName = $argFileName;
     //
     if (strpos($fileName, '.') === false) {
         $fileName = EasyBlogHelper::getDate()->toFormat("%Y%m%d-%H%M%S") . '.' . $fileName;
     } else {
         if (strpos($fileName, '.') == 0) {
             $fileName = EasyBlogHelper::getDate()->toFormat("%Y%m%d-%H%M%S") . $fileName;
         }
     }
     // We do not want to allow spaces in the name.
     $fileName = str_ireplace(' ', '-', $fileName);
     return $fileName;
 }
Esempio n. 18
0
						</td>
						<td>
							<a href="<?php 
        echo $row->url;
        ?>
" target="_blank"><?php 
        echo $row->url;
        ?>
</a>
						</td>
						<td class="center nowrap">
							<?php 
        if ($row->last_import == '0000-00-00 00:00:00') {
            echo JText::_('COM_EASYBLOG_NEVER');
        } else {
            $date = EasyBlogHelper::getDate();
            echo $date->toMySQL();
        }
        ?>
						</td>
						<td class="center nowrap">
							<?php 
        echo JHTML::_('jgrid.published', $row->published, $i);
        ?>
						</td>
						<td class="center nowrap"><?php 
        echo $row->id;
        ?>
</td>
					</tr>
					<?php 
Esempio n. 19
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);
         }
     }
 }
Esempio n. 20
0
 function addTeamSubscription($teamId, $email, $userId = '0', $fullname = '')
 {
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     $my = JFactory::getUser();
     $teamTbl = EasyBlogHelper::getTable('Teamblog', 'Table');
     $teamTbl->load($teamId);
     $gid = EasyBlogHelper::getUserGids($userId);
     $isMember = $teamTbl->isMember($userId, $gid);
     if ($teamTbl->allowSubscription($teamTbl->access, $userId, $isMember, $acl->rules->allow_subscription)) {
         $date = EasyBlogHelper::getDate();
         $subscriber = EasyBlogHelper::getTable('TeamSubscription', 'Table');
         $subscriber->team_id = $teamId;
         $subscriber->email = $email;
         if ($userId != '0') {
             $subscriber->user_id = $userId;
         }
         $subscriber->fullname = $fullname;
         $subscriber->created = $date->toMySQL();
         $state = $subscriber->store();
         if ($state) {
             // lets send confirmation email to subscriber.
             $helper = EasyBlogHelper::getHelper('Subscription');
             $template = $helper->getTemplate();
             $template->uid = $subscriber->id;
             $template->utype = 'teamsubscription';
             $template->user_id = $subscriber->user_id;
             $template->uemail = $email;
             $template->ufullname = $fullname;
             $template->ucreated = $subscriber->created;
             $template->targetname = $teamTbl->title;
             $template->targetlink = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=teamblog&layout=listings&id=' . $teamId, false, true);
             $helper->addMailQueue($template);
         }
     }
 }
Esempio n. 21
0
&call=doneLogin';
		window.open(url, '' , 'scrollbars=no,resizable=no, width=300,height=300,left=' + left + ',top=' + top );
	});
});

window.doneLogin = function(){
	window.location.href = '<?php 
    echo EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false);
    ?>
';
}
</script>
<?php 
    $expires = $facebook->getAccessTokenValue('expires');
    $created = strtotime($facebook->created);
    $expire = EasyBlogHelper::getDate($created + $expires)->toFormat('%A, %d %B %Y');
    ?>

<div class="ui-modbox" id="widget-profile-facebook">
    <div class="ui-modhead">
    	<div class="ui-modtitle"><?php 
    echo JText::_('COM_EASYBLOG_DASHBOARD_FACEBOOK_SETTINGS_TITLE');
    ?>
</div>
        <a href="javascript:void(0);" onclick="eblog.dashboard.toggle( this );" class="ui-tog pabs atr ir"><?php 
    echo JText::_('COM_EASYBLOG_HIDE');
    ?>
</a>
    </div>
    <div class="ui-modbody clearfix">
        <div class="eblog-message info">
Esempio n. 22
0
 function addSiteSubscription($email, $userId = '0', $fullname = '')
 {
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     $my = JFactory::getUser();
     if ($acl->rules->allow_subscription || empty($my->id) && $config->get('main_allowguestsubscribe')) {
         $date = EasyBlogHelper::getDate();
         $subscription = EasyBlogHelper::getTable('SiteSubscription');
         $subscription->email = $email;
         if ($userId) {
             $subscription->user_id = $userId;
         }
         $subscription->fullname = $fullname;
         $subscription->created = EasyBlogHelper::getDate()->toMySQL();
         $state = $subscription->store();
         if ($state) {
             // lets send confirmation email to subscriber.
             $helper = EasyBlogHelper::getHelper('Subscription');
             $template = $helper->getTemplate();
             $template->uid = $subscription->id;
             $template->utype = 'sitesubscription';
             $template->user_id = $subscription->user_id;
             $template->uemail = $email;
             $template->ufullname = $fullname;
             $template->ucreated = $subscription->created;
             $template->targetname = $config->get('main_title');
             $template->targetlink = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=latest', false, true);
             $helper->addMailQueue($template);
         }
         return $state;
     }
 }
Esempio n. 23
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();
    }
Esempio n. 24
0
 /**
  * Sends an email out.
  **/
 public function send($emails, $emailTitle, $template, $data)
 {
     $config = EasyBlogHelper::getConfig();
     $app = JFactory::getApplication();
     $jConfig = EasyBlogHelper::getJConfig();
     $defaultEmailFrom = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? $jConfig->get('mailfrom') : $jConfig->get('mailfrom');
     $defaultFromName = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? $jConfig->get('fromname') : $jConfig->get('fromname');
     $fromEmail = $config->get('notification_from_email', $defaultEmailFrom);
     $fromName = $config->get('notification_from_name', $defaultFromName);
     if (empty($fromEmail)) {
         $fromEmail = $defaultEmailFrom;
     }
     if (empty($fromName)) {
         $fromName = $defaultFromName;
     }
     // @rule: Make sure there are only unique emails so we don't send duplicates.
     foreach ($emails as $email => $obj) {
         if ($obj->unsubscribe) {
             $data['unsubscribeLink'] = $obj->unsubscribe;
         }
         // Retrieve the template's contents.
         $output = $this->getTemplateContents($template, $data);
         $mailq = EasyBlogHelper::getTable('MailQueue');
         $mailq->mailfrom = $fromEmail;
         $mailq->fromname = $fromName;
         $mailq->recipient = $obj->email;
         $mailq->subject = $emailTitle;
         $mailq->body = $output;
         $mailq->created = EasyBlogHelper::getDate()->toMySQL();
         $mailq->store();
     }
 }
Esempio n. 25
0
 public function getDateCreated()
 {
     $date = EasyBlogHelper::getDate(filemtime($this->file));
     $format = JText::_('DATE_FORMAT_LC1');
     if (method_exists($date, 'format')) {
         return $date->format($format);
     }
     return $date->toFormat($format);
 }
Esempio n. 26
0
 function addBloggerSubscription($bloggerId, $email, $userId = '0', $fullname)
 {
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     $my = JFactory::getUser();
     if ($acl->rules->allow_subscription || empty($my->id) && $config->get('main_allowguestsubscribe')) {
         $date = EasyBlogHelper::getDate();
         $subscriber = EasyBlogHelper::getTable('BloggerSubscription', 'Table');
         $subscriber->blogger_id = $bloggerId;
         $subscriber->email = $email;
         if ($userId != '0') {
             $subscriber->user_id = $userId;
         }
         $subscriber->fullname = $fullname;
         $subscriber->created = $date->toMySQL();
         $state = $subscriber->store();
     }
 }
Esempio n. 27
0
 function addCategorySubscription($categoryId, $email, $userId = '0', $fullname = '')
 {
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     $my = JFactory::getUser();
     if ($acl->rules->allow_subscription || empty($my->id) && $config->get('main_allowguestsubscribe')) {
         $date = EasyBlogHelper::getDate();
         $subscriber = EasyBlogHelper::getTable('CategorySubscription', 'Table');
         $subscriber->category_id = $categoryId;
         $subscriber->email = $email;
         if ($userId != '0') {
             $subscriber->user_id = $userId;
         }
         $subscriber->fullname = $fullname;
         $subscriber->created = $date->toMySQL();
         $state = $subscriber->store();
         if ($state) {
             $category = EasyBlogHelper::getTable('Category', 'Table');
             $category->load($categoryId);
             // lets send confirmation email to subscriber.
             $helper = EasyBlogHelper::getHelper('Subscription');
             $template = $helper->getTemplate();
             $template->uid = $subscriber->id;
             $template->utype = 'categorysubscription';
             $template->user_id = $subscriber->user_id;
             $template->uemail = $email;
             $template->ufullname = $fullname;
             $template->ucreated = $subscriber->created;
             $template->targetname = $category->title;
             $template->targetlink = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $categoryId, false, true);
             $helper->addMailQueue($template);
         }
         return $state;
     }
 }
Esempio n. 28
0
 public static function getUniqueFileName($originalFilename, $path)
 {
     $ext = JFile::getExt($originalFilename);
     $ext = $ext ? '.' . $ext : '';
     $uniqueFilename = JFile::stripExt($originalFilename);
     $i = 1;
     while (JFile::exists($path . DIRECTORY_SEPARATOR . $uniqueFilename . $ext)) {
         // $uniqueFilename	= JFile::stripExt($originalFilename) . '-' . $i;
         $uniqueFilename = JFile::stripExt($originalFilename) . '_' . $i . '_' . EasyBlogHelper::getDate()->toFormat("%Y%m%d-%H%M%S");
         $i++;
     }
     //remove the space into '-'
     $uniqueFilename = str_ireplace(' ', '-', $uniqueFilename);
     return $uniqueFilename . $ext;
 }
Esempio n. 29
0
			</tr>
		</thead>
		<tbody>
		<?php 
if ($this->blogs) {
    $k = 0;
    $x = 0;
    $config = JFactory::getConfig();
    for ($i = 0, $n = count($this->blogs); $i < $n; $i++) {
        $row = $this->blogs[$i];
        $user = JFactory::getUser($row->created_by);
        $previewLink = rtrim(JURI::root(), "/") . "/" . JRoute::_("index.php?option=com_easyblog&view=entry&id=" . $row->id);
        $preview = '<a href="' . $previewLink . '" target="_blank"><img src="' . JURI::base() . '/images/preview_f2.png"/ style="width:20px; height:20px; "></a>';
        $editLink = JRoute::_('index.php?option=com_easyblog&c=blogs&task=edit&draft_id=' . $row->id . '&approval=1');
        $date = EasyBlogHelper::getDate($row->created);
        ?>

			<tr class="<?php 
        echo "row{$k}";
        ?>
">
				<td>
					<?php 
        echo $this->pagination->getRowOffset($i);
        ?>
				</td>
				<td width="7">
					<?php 
        echo JHTML::_('grid.id', $x++, $row->id);
        ?>
Esempio n. 30
0
 public function processTwitter()
 {
     // @rule: Find all oauth accounts
     $db = EasyBlogHelper::db();
     $config = EasyBlogHelper::getConfig();
     $key = $config->get('integrations_twitter_api_key');
     $secret = $config->get('integrations_twitter_secret_key');
     $query = 'SELECT * FROM ' . $db->nameQuote('#__easyblog_oauth');
     $query .= ' WHERE ' . $db->nameQuote('type') . '=' . $db->Quote('twitter');
     $query .= ' AND ' . $db->nameQuote('system') . '=' . $db->Quote(0);
     $db->setQuery($query);
     $accounts = $db->loadObjectList();
     $hashes = $config->get('integrations_twitter_microblog_hashes');
     // If hashes are empty, do not try to run anything since we wouldn't be able to find anything.
     if (empty($hashes)) {
         return false;
     }
     $hashes = explode(',', $hashes);
     $totalHashes = count($hashes);
     $search = '';
     $categoryId = $config->get('integrations_twitter_microblog_category');
     $published = $config->get('integrations_twitter_microblog_publish');
     $frontpage = $config->get('integrations_twitter_microblog_frontpage');
     // Build the hash queries
     for ($i = 0; $i < $totalHashes; $i++) {
         $search .= $hashes[$i];
         if (next($hashes) !== false) {
             $search .= ' OR ';
         }
     }
     $total = 0;
     if ($accounts) {
         foreach ($accounts as $account) {
             $query = 'SELECT `id_str` FROM ' . $db->nameQuote('#__easyblog_twitter_microblog') . ' ' . 'WHERE ' . $db->nameQuote('oauth_id') . '=' . $db->Quote($account->id) . ' ' . 'ORDER BY `created` DESC';
             $db->setQuery($query);
             $result = $db->loadObject();
             $jparam = EasyBlogHelper::getRegistry($account->params);
             $screen = $jparam->get('screen_name');
             // If we can't get the screen name, do not try to process it.
             if (!$screen) {
                 continue;
             }
             // @rule: Retrieve the consumer object for this oauth client.
             $consumer = EasyBlogHelper::getHelper('Oauth')->getConsumer('twitter', $key, $secret, '');
             $consumer->setAccess($account->access_token);
             $params = array('q' => $search . ' from:@' . $screen, 'showuser' => true);
             if ($result) {
                 $params['since_id'] = $result->id_str;
             }
             $data = $consumer->get('search/tweets', $params);
             $tweets = isset($data->statuses) ? $data->statuses : '';
             if ($tweets) {
                 foreach ($tweets as $tweet) {
                     // Ensure that the source of the author is the same as the user on site.
                     if ($tweet->user->screen_name != $screen) {
                         return;
                     }
                     // Remove hashtag from the content since it would be pointless to show it.
                     $tweet->text = str_ireplace($hashes, '', $tweet->text);
                     $blog = EasyBlogHelper::getTable('Blog');
                     $title = JString::substr($tweet->text, 0, 20) . '...';
                     $created = EasyBlogHelper::getDate($tweet->created_at);
                     $createdDate = $created->toMySQL();
                     $content = $tweet->text;
                     // @task: Store the blog post
                     $blog->set('title', $title);
                     $blog->set('source', 'twitter');
                     $blog->set('created_by', $account->user_id);
                     $blog->set('created', $createdDate);
                     $blog->set('modified', $createdDate);
                     $blog->set('publish_up', $createdDate);
                     $blog->set('intro', $content);
                     $blog->set('category_id', $categoryId);
                     $blog->set('published', $published);
                     $blog->set('frontpage', $frontpage);
                     $blog->set('issitewide', true);
                     $blog->set('source', EBLOG_MICROBLOG_TWITTER);
                     // Store the blog post
                     if (!$blog->store()) {
                         var_dump($blog->getError());
                     }
                     // @task: Add a history item
                     $history = EasyBlogHelper::getTable('TwitterMicroBlog', 'Table');
                     $history->set('id_str', $tweet->id_str);
                     $history->set('post_id', $blog->id);
                     $history->set('oauth_id', $account->id);
                     $history->set('created', $createdDate);
                     $history->set('tweet_author', $screen);
                     $history->store();
                     $total++;
                 }
             }
         }
     }
     echo JText::sprintf('%1s blog posts fetched from Twitter', $total);
 }