public function confirmAutopost($type, $id) { $ajax = new Ejax(); $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_AUTOPOST_DIALOG_INFO'); $action = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? 'Joomla.submitbutton(\'autopost\');' : 'submitbutton(\'autopost\')'; ob_start(); ?> <p><?php echo JText::sprintf('COM_EASYBLOG_AUTOPOST_DIALOG_DESC', ucfirst($type)); ?> </p> <div class="dialog-actions"> <input type="button" onclick="ejax.closedlg();" name="edialog-cancel" id="edialog-cancel" class="button" value="<?php echo JText::_('COM_EASYBLOG_CANCEL_BUTTON'); ?> "> <input type="button" class="button" value="<?php echo JText::_('COM_EASYBLOG_SHARE_BUTTON'); ?> " onclick="<?php echo $action; ?> "> </div> <?php $options->content = ob_get_contents(); ob_end_clean(); $ajax->script('$("#adminForm input[name=autopost_type]").val("' . $type . '");'); $ajax->script('$("#adminForm input[name=autopost_selected]").val("' . $id . '");'); $ajax->dialog($options); $ajax->send(); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.report', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $result = $this->get('Data'); $pagination = $this->get('Pagination'); $reports = array(); if ($result) { foreach ($result as $row) { $report = EasyBlogHelper::getTable('Report'); $report->bind($row); $reports[] = $report; } } $this->assign('pagination', $pagination); $this->assign('reports', $reports); parent::display($tpl); }
public function set($key, $value) { if (EasyBlogHelper::getJoomlaVersion() >= '2.5') { return $this->registry->set($key, $value); } return $this->registry->setValue($key, $value); }
public function get($key, $default = null) { if (EasyBlogHelper::getJoomlaVersion() >= '3.0') { return $this->config->get($key, $default); } return $this->config->getValue($key, $default); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.trackback', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $filter_state = $mainframe->getUserStateFromRequest('com_easyblog.trackbacks.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easyblog.trackbacks.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easyblog.trackbacks.filter_order', 'filter_order', 'created', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easyblog.trackbacks.filter_order_Dir', 'filter_order_Dir', '', 'word'); //Get data from the model $trackbacks = $this->get('Data'); $pagination = $this->get('Pagination'); $this->assignRef('trackbacks', $trackbacks); $this->assignRef('pagination', $pagination); $this->assign('state', $this->getFilterState($filter_state)); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.comment', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); //Load pane behavior jimport('joomla.html.pane'); $commentId = JRequest::getVar('commentid', ''); $comment = EasyBlogHelper::getTable('Comment', 'Table'); $comment->load($commentId); $this->comment = $comment; // Set default values for new entries. if (empty($comment->created)) { $date = EasyBlogDateHelper::getDate(); $now = EasyBlogDateHelper::toFormat($date); $comment->created = $now; $comment->published = true; } $this->assignRef('comment', $comment); parent::display($tpl); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.tag', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); // Render modal JHTML::_('behavior.modal'); $tagId = JRequest::getVar('tagid', ''); $tag = EasyBlogHelper::getTable('Tag', 'Table'); $tag->load($tagId); $tag->title = JString::trim($tag->title); $tag->alias = JString::trim($tag->alias); $this->tag = $tag; // Set default values for new entries. if (empty($tag->created)) { $date = EasyBlogDateHelper::getDate(); $now = EasyBlogDateHelper::toFormat($date); $tag->created = $now; $tag->published = true; } $this->assignRef('my', $user); $this->assignRef('tag', $tag); parent::display($tpl); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.pending', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $search = $mainframe->getUserStateFromRequest('com_easyblog.blogs.search', 'search', '', 'string'); $filter_category = $mainframe->getUserStateFromRequest('com_easyblog.blogs.filter_category', 'filter_category', '*', 'int'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easyblog.blogs.filter_order', 'filter_order', 'ordering', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easyblog.blogs.filter_order_Dir', 'filter_order_Dir', '', 'word'); //Get data from the model $blogs = $this->get('Blogs'); $pagination = $this->get('Pagination'); $catFilter = $this->getFilterCategory($filter_category); $document->setTitle(JText::_('COM_EASYBLOG_PENDING_PAGE_TITLE')); $this->assignRef('blogs', $blogs); $this->assignRef('pagination', $pagination); $this->assign('category', $catFilter); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
public function export() { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.setting', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } $db = JFactory::getDBO(); $query = 'SELECT `params` FROM ' . $db->quoteName('#__easyblog_configs') . ' WHERE `name` = ' . $db->Quote('config'); $db->setQuery($query); $data = $db->loadResult(); // Get the file size $size = strlen($data); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=settings.json'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . $size); ob_clean(); flush(); echo $data; exit; }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.autoposting', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal', 'a.modal'); $config = EasyBlogHelper::getConfig(); $layout = $this->getLayout(); if (method_exists($this, $layout)) { $this->{$layout}($tpl); return; } $isFacebookAssociated = EasyBlogHelper::getHelper('OAuth')->isAssociated('facebook'); $isTwitterAssociated = EasyBlogHelper::getHelper('OAuth')->isAssociated('twitter'); $isLinkedinAssociated = EasyBlogHelper::getHelper('OAuth')->isAssociated('linkedin'); $this->assignRef('config', $config); $this->assignRef('isFacebookAssociated', $isFacebookAssociated); $this->assignRef('isTwitterAssociated', $isTwitterAssociated); $this->assignRef('isLinkedinAssociated', $isLinkedinAssociated); parent::display($tpl); }
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); } } } } }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.mail', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $filter_state = $mainframe->getUserStateFromRequest('com_easyblog.spools.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easyblog.spools.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easyblog.spools.filter_order', 'filter_order', 'created', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easyblog.spools.filter_order_Dir', 'filter_order_Dir', 'asc', 'word'); $mails = $this->get('Data'); $pagination = $this->get('Pagination'); $this->assign('mails', $mails); $this->assign('pagination', $pagination); $this->assign('state', JHTML::_('grid.state', $filter_state, JText::_('COM_EASYBLOG_SENT'), JText::_('COM_EASYBLOG_PENDING'))); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
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; }
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); } } }
/** * Creates a new registry object. */ public function get($contents = '') { $version = EasyBlogHelper::getJoomlaVersion(); if ($version >= '1.6') { return JFactory::getSession()->getFormToken(); } return JUtility::getToken(); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.blog', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); JHTML::_('behavior.tooltip'); $filter_state = $mainframe->getUserStateFromRequest('com_easyblog.blogs.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easyblog.blogs.search', 'search', '', 'string'); $filter_category = $mainframe->getUserStateFromRequest('com_easyblog.blogs.filter_category', 'filter_category', '*', 'int'); $filterLanguage = $mainframe->getUserStateFromRequest('com_easyblog.blogs.filter_language', 'filter_language', '', ''); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easyblog.blogs.filter_order', 'filter_order', 'a.id', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easyblog.blogs.filter_order_Dir', 'filter_order_Dir', 'desc', 'word'); $source = JRequest::getVar('filter_source', '-1'); $filteredBlogger = $mainframe->getUserStateFromRequest('com_easyblog.blogs.filter_blogger', 'filter_blogger', '', 'int'); //Get data from the model $blogs = $this->get('Blogs'); $pagination = $this->get('Pagination'); $catFilter = $this->getFilterCategory($filter_category); $browse = JRequest::getInt('browse', 0); $browsefunction = JRequest::getVar('browsefunction', 'insertBlog'); // @task: Get the centralized oauth consumers $consumers = array(); $sites = array('twitter', 'facebook', 'linkedin'); $centralizedConfigured = false; foreach ($sites as $site) { $consumer = EasyBlogHelper::getTable('OAuth'); $consumer->loadSystemByType($site); if (!empty($consumer->id)) { $centralizedConfigured = true; } $consumers[] = $consumer; } $this->assignRef('consumers', $consumers); $this->assignRef('centralizedConfigured', $centralizedConfigured); $this->assignRef('source', $source); $this->assign('filterLanguage', $filterLanguage); $this->assign('filteredBlogger', $filteredBlogger); $this->assign('browse', $browse); $this->assign('browseFunction', $browsefunction); $this->assignRef('blogs', $blogs); $this->assignRef('pagination', $pagination); $this->assignRef('filter_state', $filter_state); $this->assign('state', $this->getFilterState($filter_state)); $this->assign('category', $catFilter); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
public function __construct() { $version = EasyBlogHelper::getJoomlaVersion(); $className = 'EasyBlogDBJoomla15'; if ($version >= '2.5') { $className = 'EasyBlogDBJoomla30'; } $this->helper = new $className(); }
public function nameQuote($str) { $db = EasyBlogHelper::db(); $version = EasyBlogHelper::getJoomlaVersion(); if ($version >= '2.5') { return $db->quoteName($str); } return $db->nameQuote($str); }
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; }
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); } }
/** * Creates a new instance of the Joomla parser. * * @since 1.0 * @access public */ public function __construct($contents = '', $isFile = false) { $this->version = EasyBlogHelper::getJoomlaVersion(); if ($this->version >= '3.0') { $parser = JFactory::getXML($contents, $isFile); } else { $parser = JFactory::getXMLParser('Simple'); $parser->loadString($contents); } $this->parser = $parser; return $this; }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.category', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $filter_state = $mainframe->getUserStateFromRequest('com_easyblog.categories.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easyblog.categories.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easyblog.categories.filter_order', 'filter_order', 'lft', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easyblog.categories.filter_order_Dir', 'filter_order_Dir', 'asc', 'word'); $publishedOnly = JRequest::getVar('p', '0'); JTable::addIncludePath(EBLOG_TABLES); $category = EasyBlogHelper::getTable('Category', 'Table'); $category->rebuildOrdering(); //Get data from the model $ordering = array(); $model = $this->getModel(); $categories = $model->getData(true, $publishedOnly); for ($i = 0; $i < count($categories); $i++) { $category = $categories[$i]; $category->count = $model->getUsedCount($category->id); $category->child_count = $model->getChildCount($category->id); $ordering[$category->parent_id][] = $category->id; } $pagination = $this->get('Pagination'); $browse = JRequest::getInt('browse', 0); $browsefunction = JRequest::getVar('browsefunction', 'insertCategory'); $this->assign('browse', $browse); $this->assign('browsefunction', $browsefunction); $this->assignRef('categories', $categories); $this->assignRef('pagination', $pagination); $this->assignRef('ordering', $ordering); $this->assign('state', JHTML::_('grid.state', $filter_state)); $this->assign('search', $search); $this->assign('order', $order); $this->assign('saveOrder', $order == 'lft' && $orderDirection == 'asc'); $this->assign('ordering', $ordering); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.updater', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $curl = function_exists('curl_multi_init'); $this->assign('curl', $curl); echo parent::display($tpl); }
function getMembersCount($teamId) { $db = EasyBlogHelper::db(); $query = 'SELECT COUNT(1) FROM `#__easyblog_team_users` ' . 'WHERE `team_id`=' . $db->Quote($teamId); $db->setQuery($query); $total = $db->loadResult(); // Now we need to calculate the group members. if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { $query = 'SELECT COUNT(1) ' . 'FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_team_groups') . ' AS a ' . 'INNER JOIN ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__user_usergroup_map') . ' AS b ' . 'ON a.`group_id` = b.`group_id` ' . 'WHERE a.' . EasyBlogHelper::getHelper('SQL')->nameQuote('team_id') . ' = ' . $db->Quote($teamId); } else { $query = 'SELECT COUNT(c.`value`) ' . 'FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_team_groups') . ' AS a ' . 'LEFT JOIN ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__core_acl_groups_aro_map') . ' AS b ' . 'ON a.`group_id` = b.`group_id` ' . 'INNER JOIN ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__core_acl_aro') . ' AS c ' . 'ON b.' . EasyBlogHelper::getHelper('SQL')->nameQuote('aro_id') . ' = c.' . EasyBlogHelper::getHelper('SQL')->nameQuote('id') . 'WHERE a.' . EasyBlogHelper::getHelper('SQL')->nameQuote('team_id') . ' = ' . $db->Quote($teamId); } $db->setQuery($query); $groupsTotal = $db->loadResult(); if (!$groupsTotal) { return $total; } return $total + $groupsTotal; }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.category', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $config = EasyBlogHelper::getConfig(); $acl = EasyBlogACLHelper::getRuleSet(); //Load pane behavior jimport('joomla.html.pane'); $catId = JRequest::getVar('catid', ''); $cat = EasyBlogHelper::getTable('Category', 'Table'); $cat->load($catId); $this->cat = $cat; // Set default values for new entries. if (empty($cat->created)) { $date = EasyBlogDateHelper::getDate(); $now = EasyBlogDateHelper::toFormat($date); $cat->created = $now; $cat->published = true; } $catRuleItems = EasyBlogHelper::getTable('CategoryAclItem', 'Table'); $categoryRules = $catRuleItems->getAllRuleItems(); $assignedACL = $cat->getAssignedACL(); $parentList = EasyBlogHelper::populateCategories('', '', 'select', 'parent_id', $cat->parent_id, false, false, false, array($cat->id)); $editor = JFactory::getEditor($config->get('layout_editor')); $this->assignRef('editor', $editor); $this->assignRef('cat', $cat); $this->assignRef('config', $config); $this->assignRef('acl', $acl); $this->assignRef('parentList', $parentList); $this->assignRef('categoryRules', $categoryRules); $this->assignRef('assignedACL', $assignedACL); parent::display($tpl); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.theme', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $config = EasyBlogHelper::getConfig(); $themes = $this->getThemes(); $this->assign('default', $config->get('layout_theme')); $this->assign('themes', $themes); $this->assign('search', ''); parent::display($tpl); }
public function getFormValues() { $result = array(); if (EasyBlogHelper::getJoomlaVersion() >= '3.0') { foreach ($this->form->getFieldsets() as $name => $fieldset) { foreach ($this->form->getFieldset($name) as $field) { $obj = new stdClass(); $obj->type = $field->type; $obj->label = $field->label; $obj->key = $field->fieldname; $obj->value = $field->value; $obj->desc = $field->description; $obj->input = $field->input; $result[] = $obj; } } } else { $params = $this->form->getParams('params', '_default'); if (count($params) > 0) { foreach ($params as $param) { $obj = new stdClass(); $type = $param[1]; if (EasyBlogHelper::getJoomlaVersion() <= '2.5') { if (strpos($param[1], '</select>') !== false) { $type = 'list'; } else { $type = 'string'; } } $obj->type = $type; $obj->label = $param[3]; $obj->key = $param[5]; $obj->value = $param[4]; $obj->desc = $param[2]; $obj->input = $param[1]; $result[] = $obj; } } } return $result; }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.acl', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $model = EasyBlogHelper::getModel('Acl', true); $config = EasyBlogHelper::getConfig(); $type = $mainframe->getUserStateFromRequest('com_easyblog.acls.filter_type', 'filter_type', 'group', 'word'); //filtering $filter = new stdClass(); $filter->type = $this->getFilterType($type); $filter->search = $mainframe->getUserStateFromRequest('com_easyblog.acls.search', 'search', '', 'string'); //sorting $sort = new stdClass(); $sort->order = $mainframe->getUserStateFromRequest('com_easyblog.acls.filter_order', 'filter_order', 'a.`id`', 'cmd'); $sort->orderDirection = $mainframe->getUserStateFromRequest('com_easyblog.acls.filter_order_Dir', 'filter_order_Dir', '', 'word'); $rulesets = $model->getRuleSets($type); $pagination = $model->getPagination($type); if ($type == 'assigned') { $document->setTitle(JText::_("COM_EASYBLOG_ACL_ASSIGN_USER")); JToolBarHelper::title(JText::_('COM_EASYBLOG_ACL_ASSIGN_USER'), 'acl'); } else { $document->setTitle(JText::_("COM_EASYBLOG_ACL_JOOMLA_USER_GROUP")); JToolBarHelper::title(JText::_('COM_EASYBLOG_ACL_JOOMLA_USER_GROUP'), 'acl'); } $this->assignRef('config', $config); $this->assignRef('rulesets', $rulesets); $this->assignRef('filter', $filter); $this->assignRef('sort', $sort); $this->assignRef('type', $type); $this->assignRef('pagination', $pagination); parent::display($tpl); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.comment', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $filter_state = $mainframe->getUserStateFromRequest('com_easyblog.comments.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easyblog.comments.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easyblog.comments.filter_order', 'filter_order', 'ordering', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easyblog.comments.filter_order_Dir', 'filter_order_Dir', '', 'word'); //Get data from the model $comments = $this->get('Data'); $pagination = $this->get('Pagination'); //convert the status. if (count($comments) > 0) { for ($i = 0; $i < count($comments); $i++) { $item = $comments[$i]; if ($item->published == '2') { $item->isModerate = true; $item->published = '0'; } else { $item->isModerate = false; } } } $this->assignRef('comments', $comments); $this->assignRef('pagination', $pagination); $this->assign('state', $this->getFilterState($filter_state)); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.feeds', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); JHTML::_('behavior.tooltip'); $layout = $this->getLayout(); if ($layout != 'default') { $this->{$layout}($tpl); return; } JToolBarHelper::title(JText::_('COM_EASYBLOG_BLOGS_FEEDS_TITLE'), 'feeds'); JToolbarHelper::back(JText::_('COM_EASYBLOG_TOOLBAR_HOME'), 'index.php?option=com_easyblog'); JToolBarHelper::divider(); JToolBarHelper::custom('addNew', 'new.png', 'new_f2.png', JText::_('COM_EASYBLOG_ADD_BUTTON'), false); JToolbarHelper::divider(); JToolbarHelper::publishList('publish'); JToolbarHelper::unpublishList('unpublish'); JToolBarHelper::divider(); JToolBarHelper::custom('download', 'download', 'download.png', JText::_('Execute'), false); JToolBarHelper::divider(); JToolbarHelper::deleteList(); $feeds = $this->get('Data'); $pagination = $this->get('Pagination'); $filter_state = $mainframe->getUserStateFromRequest('com_easyblog.categories.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easyblog.categories.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $this->assign('state', JHTML::_('grid.state', $filter_state)); $this->assign('search', $search); $this->assign('feeds', $feeds); $this->assign('pagination', $pagination); parent::display($tpl); }