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')); }
/** * 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; }
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')); }
public function buildcategorytier() { $ajax = EasyBlogHelper::getHelper('Ajax'); $id = JRequest::getInt('id'); if (empty($id)) { return $ajax->fail(); } $loop = true; $scategory = EasyBlogHelper::getTable('Category'); $scategory->load($id); $model = $this->getModel('categories'); $tier = array(); $searchId = $scategory->parent_id; while ($loop) { if (empty($searchId)) { $loop = false; } else { $category = EasyBlogHelper::getTable('Category'); $category->load($searchId); $tier[] = $category; $searchId = $category->parent_id; } } // get the root tier $root = array_pop($tier); //reverse the array order $tier = array_reverse($tier); array_push($tier, $scategory); // echo '<pre>'; // print_r($tier); // echo '</pre>'; // exit; $categories = array(); foreach ($tier as $cat) { $pItem = new stdClass(); $pItem->id = $cat->id; $pItem->parent_id = $cat->parent_id; $pItem->hasChild = 1; $model = $this->getModel('categories'); $items = $model->getChildCategories($cat->parent_id, true, true); if (!$items) { $pItem->hasChild = 0; $categories[] = $pItem; continue; } for ($i = 0; $i < count($items); $i++) { $item = $items[$i]; $category = EasyBlogHelper::getTable('Category'); $category->load($item->id); $item->hasChild = $category->getChildCount(); } $pItem->childs = $items; $categories[] = $pItem; } // echo '<pre>'; // print_r($categories); // echo '</pre>'; // exit; $ajax->success($categories); }
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')); }
public function store() { // @task: Load language file from the front end. JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); $this->clear($this->draft_id); // @rule: Send notification to the author of the post. $draft = EasyBlogHelper::getTable('Draft'); $draft->load($this->draft_id); $author = EasyBlogHelper::getTable('Profile'); $author->load($draft->created_by); $data['blogTitle'] = $draft->title; $data['blogAuthor'] = $author->getName(); $data['blogAuthorAvatar'] = $author->getAvatar(); $data['blogEditLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id, false, true); $data['blogAuthorEmail'] = $author->user->email; $data['rejectMessage'] = $this->message; // 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['blogEditLink'] = JURI::root() . 'index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id; } $emailTitle = JText::_('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_REJECTED'); $obj = new StdClass(); $obj->unsubscribe = false; $obj->email = $author->user->email; $emails = array($obj); $notification = EasyBlogHelper::getHelper('Notification'); $notification->send($emails, $emailTitle, 'email.blog.rejected', $data); return parent::store(); }
public function get() { $input = JFactory::getApplication()->input; $model = EasyBlogHelper::getModel('Blog'); $category = EasyBlogHelper::getTable('Category', 'Table'); $id = $input->get('id', null, 'INT'); $search = $input->get('search', null, 'STRING'); $posts = array(); if (!isset($id)) { $categoriesmodel = EasyBlogHelper::getModel('Categories'); $categories = $categoriesmodel->getCategoryTree('ordering'); $this->plugin->setResponse($categories); return; } $category->load($id); // private category shouldn't allow to access. $privacy = $category->checkPrivacy(); if (!$category->id || !$privacy->allowed) { $this->plugin->setResponse($this->getErrorResponse(404, 'Category not found')); return; } $catIds = array(); $catIds[] = $category->id; EasyBlogHelper::accessNestedCategoriesId($category, $catIds); $sorting = $this->plugin->params->get('sorting', 'latest'); $rows = $model->getBlogsBy('category', $catIds, $sorting, 0, EBLOG_FILTER_PUBLISHED, $search); foreach ($rows as $k => $v) { $item = EasyBlogHelper::getHelper('SimpleSchema')->mapPost($v, '', 100, array('text')); $item->isowner = $v->created_by == $this->plugin->get('user')->id ? true : false; $posts[] = $item; } $this->plugin->setResponse($posts); }
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>'); $item->isowner = $blog->created_by == $this->plugin->get('user')->id ? true : false; // 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); }
function exists() { $db = EasyBlogHelper::db(); $query = 'SELECT COUNT(1) FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE `team_id`=' . $db->Quote($this->team_id) . ' ' . 'AND `group_id`=' . $db->Quote($this->group_id); $db->setQuery($query); return $db->loadResult() > 0 ? true : false; }
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); } } }
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; }
public function getDescription($rule) { $db = EasyBlogHelper::db(); $query = 'SELECT ' . EasyBlogHelper::getHelper('SQL')->nameQuote('description') . ' ' . 'FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_acl') . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('action') . '=' . $db->Quote($rule); $db->setQuery($query); $description = $db->loadResult(); return $description; }
function _buildQueryWhere($userId) { $mainframe = JFactory::getApplication(); $db = EasyBlogHelper::db(); $where[] = 'a.' . EasyBlogHelper::getHelper('SQL')->nameQuote('user_id') . '=' . $db->Quote($userId); $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : ''; return $where; }
function loadByOauthId($blogId, $id) { $db = $this->getDBO(); $query = 'SELECT * FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('oauth_id') . '=' . $db->Quote($id) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('post_id') . '=' . $db->Quote($blogId); $db->setQuery($query); $result = $db->loadResult(); return $this->bind($result); }
function loadBySource($postId, $key, $source) { $db = EasyBlogHelper::db(); $query = 'SELECT * FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('uid') . '=' . $db->Quote($key) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('post_id') . '=' . $db->Quote($postId) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('source') . '=' . $db->Quote($source); $db->setQuery($query); $obj = $db->loadObject(); return parent::bind($obj); }
public function getLanguageTitle($code) { $db = EasyBlogHelper::db(); $query = 'SELECT ' . EasyBlogHelper::getHelper('SQL')->nameQuote('title') . ' FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__languages') . ' WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('lang_code') . '=' . $db->Quote($code); $db->setQuery($query); $title = $db->loadResult(); return $title; }
function getGroupTitle($user_id) { $db = EasyBlogHelper::db(); $sql = "SELECT title FROM " . EasyBlogHelper::getHelper('SQL')->nameQuote('#__usergroups') . " ug left join " . EasyBlogHelper::getHelper('SQL')->nameQuote('#__user_usergroup_map') . " map on (ug.id = map.group_id)" . " WHERE map.user_id=" . $db->Quote($user_id); $db->setQuery($sql); $result = $db->loadResultArray(); return nl2br(implode("\n", $result)); }
public function loadByPost($postId) { $db = $this->getDBO(); $query = 'SELECT * FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('post_id') . '=' . $db->Quote($postId); $db->setQuery($query); $result = $db->loadObject(); $this->bind($result); }
public function getRatingUsers($uid, $type, $limit = 5) { $db = EasyBlogHelper::db(); $query = 'SELECT COUNT(' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . ') AS times, ' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . ' , ' . EasyBlogHelper::getHelper('SQL')->nameQuote('created') . ' ' . 'FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_ratings') . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('uid') . ' = ' . $db->Quote($uid) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('type') . ' = ' . $db->Quote($type) . ' ' . 'GROUP BY ' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . ' ' . 'LIMIT 0,' . $limit; $db->setQuery($query); $result = $db->loadObjectList(); return $result; }
/** * Method to build the query for the tags * * @access private * @return string */ function _buildQuery($type = '') { // Get the WHERE and ORDER BY clauses for the query $where = $this->_buildQueryWhere($type); $orderby = $this->_buildQueryOrderBy(); $db = EasyBlogHelper::db(); $query = 'SELECT m.*, p.title AS title FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_meta') . ' AS m ' . 'LEFT JOIN ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post') . ' AS p ' . 'ON m.content_id = p.id ' . $where . ' ' . $orderby; return $query; }
function _getAvatar($profile) { $easysocial = EasyBlogHelper::getHelper('EasySocial'); $easysocial->init(); $user = Foundry::user($profile->id); $avatar = new stdClass(); $avatar->link = $user->getAvatar(); return $avatar; }
public function store() { $db = $this->getDBO(); $query = 'SELECT COUNT(1) FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE `id_str`=' . $db->Quote($this->id_str); $db->setQuery($query); if ($db->loadResult()) { return $db->updateObject($this->_tbl, $this, $this->_tbl_key); } return $db->insertObject($this->_tbl, $this, $this->_tbl_key); }
public function load($path = null, $type = true) { $db = EasyBlogHelper::db(); $query = 'SELECT * FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl); $query .= ' WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('path') . '=' . $db->Quote($path); $query .= ' AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('type') . '=' . $db->Quote($type); $db->setQuery($query); $obj = $db->loadObject(); return parent::bind($obj); }
function store($updateNulls = false) { $db = $this->getDBO(); $query = 'SELECT COUNT(1) FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE user_id=' . $db->Quote($this->user_id); $db->setQuery($query); if ($db->loadResult()) { return $db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls); } return $db->insertObject($this->_tbl, $this, $this->_tbl_key); }
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; }
function &_getParams($key = 'config') { static $params = null; if (is_null($params)) { $db = EasyBlogHelper::db(); $query = 'SELECT ' . EasyBlogHelper::getHelper('SQL')->nameQuote('params') . ' ' . 'FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_configs') . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('name') . '=' . $db->Quote($key); $db->setQuery($query); $params = $db->loadResult(); } return $params; }
/** * Overrides parent's delete method to add our own logic. * * @return boolean * @param object $db */ function delete($pk = null) { $db = $this->getDBO(); $query = 'SELECT COUNT(1) FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post') . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('category_id') . '=' . $db->Quote($this->id); $db->setQuery($query); $count = $db->loadResult(); if ($count > 0) { return false; } return parent::delete($pk); }
public function toFormat($format = '%Y-%m-%d %H:%M:%S') { if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (JString::stristr($format, '%') !== false) { $format = EasyBlogHelper::getHelper('date')->strftimeToDate($format); } return $this->date->format($format); } else { return $this->date->toFormat($format); } }
function deletePostTag($blogId) { $db = EasyBlogHelper::db(); $query = ' DELETE FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post_tag') . ' WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('post_id') . ' = ' . $db->quote($blogId); $db->setQuery($query); $result = $db->Query(); if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); } return $result; }
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; }