public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.spools', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } // Initialise variables $mainframe = JFactory::getApplication(); $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.spools.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easydiscuss.spools.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easydiscuss.spools.filter_order', 'filter_order', 'created', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.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_EASYDISCUSS_SENT'), JText::_('COM_EASYDISCUSS_PENDING'))); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.post_types', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } // Initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); // REMOVE THIS COMMENT LATER: Don't ever use $this->getModel because it will conflict with K2 $model = DiscussHelper::getModel('Post_Types', true); $postTypes = $model->getTypes(); $pagination = $this->get('Pagination'); $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.filter_state', 'filter_state', '*', 'word'); $order = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.filter_order', 'filter_order', 'id', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.filter_order_Dir', 'filter_order_Dir', '', 'word'); $browse = JRequest::getInt('browse', 0); $browseFunction = JRequest::getVar('browseFunction', ''); $search = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $this->assign('browseFunction', $browseFunction); $this->assign('browse', $browse); $this->assign('search', $search); $this->assign('postTypes', $postTypes); $this->assign('state', $this->getFilterState($filter_state)); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); $this->assign('pagination', $pagination); parent::display($tpl); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.labels', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } $task = JRequest::getCmd('task'); if ($task == 'labels.edit') { $this->diplayLabel(); } else { // Initialise variables $mainframe = JFactory::getApplication(); $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.labels.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easydiscuss.labels.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easydiscuss.labels.filter_order', 'filter_order', 'a.ordering', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.labels.filter_order_Dir', 'filter_order_Dir', 'asc', 'word'); // Get data from the model $labels = $this->get('Data'); $pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->assignRef('labels', $labels); $this->assignRef('pagination', $pagination); $this->assign('state', JHTML::_('grid.state', $filter_state)); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); } }
public function get($key, $default = null) { if (DiscussHelper::getJoomlaVersion() >= '3.0') { return $this->config->get($key, $default); } return $this->config->getValue($key, $default); }
public function display($tpl = null) { $mainframe = JFactory::getApplication(); $model = $this->getModel('Acl'); $document = JFactory::getDocument(); $cid = JRequest::getVar('cid', null, 'REQUEST'); $type = JRequest::getVar('type', '', 'REQUEST'); $add = JRequest::getVar('add', '', 'REQUEST'); if ((is_null($cid) || empty($type)) && empty($add)) { $mainframe->redirect('index.php?option=com_easydiscuss&view=acls', JText::_('Invalid Id or acl type. Please try again.'), 'error'); } $rulesets = $model->getRuleSet($type, $cid, $add); if ($type == 'assigned') { $document->setTitle(JText::_("COM_EASYDISCUSS_ACL_ASSIGN_USER")); JToolBarHelper::title(JText::_('COM_EASYDISCUSS_ACL_ASSIGN_USER'), 'acl'); } else { $document->setTitle(JText::_("COM_EASYDISCUSS_ACL_JOOMLA_USER_GROUP")); JToolBarHelper::title(JText::_('COM_EASYDISCUSS_ACL_JOOMLA_USER_GROUP'), 'acl'); } $joomlaVersion = DiscussHelper::getJoomlaVersion(); $this->assignRef('joomlaversion', $joomlaVersion); $this->assignRef('rulesets', $rulesets); $this->assignRef('type', $type); $this->assignRef('add', $add); parent::display($tpl); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.tags', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } // Initialise variables $mainframe = JFactory::getApplication(); $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.tags.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easydiscuss.tags.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easydiscuss.tags.filter_order', 'filter_order', 'id', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.tags.filter_order_Dir', 'filter_order_Dir', '', 'word'); // Get data from the model $tags = $this->get('Data'); $model = $this->getModel('tags'); for ($i = 0; $i < count($tags); $i++) { $tag = $tags[$i]; $tag->count = $model->getUsedCount($tag->id); $tag->title = JString::trim($tag->title); $tag->alias = JString::trim($tag->alias); } $pagination = $this->get('Pagination'); $this->assignRef('tags', $tags); $this->assignRef('pagination', $pagination); $this->assign('state', JHTML::_('grid.state', $filter_state)); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.reports', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } // Initialise variables $mainframe = JFactory::getApplication(); $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.reports.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easydiscuss.reports.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easydiscuss.reports.filter_order', 'filter_order', 'a.id', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.reports.filter_order_Dir', 'filter_order_Dir', '', 'word'); $reportModel = $this->getModel('reports'); $reports = $reportModel->getReports(); $pagination = $reportModel->getPagination(); $this->assignRef('reports', $reports); $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); }
public function setOffset($offset) { if (DiscussHelper::getJoomlaVersion() >= '3.0') { $tz = new DateTimeZone($offset); return $this->date->setTimezone($tz); } return $this->date->setOffset($offset); }
public function __construct() { $version = DiscussHelper::getJoomlaVersion(); $className = 'EasyDiscussDBJoomla15'; if ($version >= '2.5') { $className = 'EasyDiscussDBJoomla30'; } $this->helper = new $className(); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.migrators', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } parent::display($tpl); }
/** * Creates a new instance of the Joomla parser. * * @since 1.0 * @access public */ public function __construct($contents = '', $isFile = false) { $this->version = DiscussHelper::getJoomlaVersion(); if ($this->version >= '3.0') { $parser = JFactory::getXML($contents, $isFile); } else { $parser = JFactory::getXMLParser('Simple'); $parser->loadString($contents); } $this->parser = $parser; return $this; }
/** * Method to build the query for the roles * * @access private * @return string */ protected function _buildQuery() { // Get the WHERE and ORDER BY clauses for the query $where = $this->_buildQueryWhere(); $orderby = $this->_buildQueryOrderBy(); $db = DiscussHelper::getDBO(); if (DiscussHelper::getJoomlaVersion() >= '1.6') { $select = ' b.title AS usergroup_title'; $join = ' LEFT JOIN `#__usergroups` AS b ON b.id = a.usergroup_id'; } else { $select = ' b.name AS usergroup_title'; $join = ' LEFT JOIN `#__core_acl_aro_groups` AS b ON b.id = a.usergroup_id'; } $query = 'SELECT a.*, ' . $select . ' FROM `#__discuss_roles` AS a ' . $join . $where . ' ' . $orderby; return $query; }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.ranks', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } $model = $this->getModel('Ranks'); $ranks = $model->getRanks(); $config = DiscussHelper::getConfig(); $this->assign('ranks', $ranks); $this->assign('config', $config); parent::display($tpl); }
public function display($tpl = null) { // Initialise variables $doc = JFactory::getDocument(); $doc->addScript(JURI::root() . 'administrator/components/com_easydiscuss/assets/js/admin.js'); // Load front end language file. JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT); $postId = JRequest::getInt('id', 0); $parentId = JRequest::getString('pid', ''); $source = JRequest::getVar('source', 'posts'); $post = JTable::getInstance('Posts', 'Discuss'); $post->load($postId); $post->content_raw = $post->content; // Get post's tags $postModel = $this->getModel('Posts'); $post->tags = $postModel->getPostTags($post->id); $post->content = EasyDiscussParser::html2bbcode($post->content); // Select top 20 tags. $tagmodel = $this->getModel('Tags'); $populartags = $tagmodel->getTagCloud('20', 'post_count', 'DESC'); $repliesCnt = $postModel->getPostRepliesCount($post->id); $nestedCategories = DiscussHelper::populateCategories('', '', 'select', 'category_id', $post->category_id, true, true); $config = DiscussHelper::getConfig(); // Get's the creator's name $creatorName = $post->poster_name; if ($post->user_id) { $author = DiscussHelper::getTable('Profile'); $author->load($post->user_id); $creatorName = $author->getName(); } require_once DISCUSS_CLASSES . '/composer.php'; $composer = new DiscussComposer("creating", $post); $this->assignRef('creatorName', $creatorName); $this->assignRef('config', $config); $this->assignRef('post', $post); $this->assignRef('populartags', $populartags); $this->assignRef('repliesCnt', $repliesCnt); $this->assignRef('source', $source); $this->assignRef('parentId', $parentId); $this->assignRef('nestedCategories', $nestedCategories); $this->assignRef('composer', $composer); $this->assign('joomlaversion', DiscussHelper::getJoomlaVersion()); //load require javascript string DiscussHelper::loadString(JRequest::getVar('view')); parent::display($tpl); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.posts', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } // Initialise variables $mainframe = JFactory::getApplication(); $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.posts.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easydiscuss.posts.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easydiscuss.posts.filter_order', 'filter_order', 'a.id', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.posts.filter_order_Dir', 'filter_order_Dir', '', 'word'); $parentId = JRequest::getString('pid', ''); $parentTitle = ''; $this->addPathway(JText::_('COM_EASYDISCUSS_BREADCRUMB_HOME'), 'index.php?option=com_easydiscuss'); if (!empty($parentId)) { $post = JTable::getInstance('Posts', 'Discuss'); $post->load($parentId); $parentTitle = $post->title; $this->addPathway(JText::_('COM_EASYDISCUSS_BREADCRUMB_DISCUSSIONS'), 'index.php?option=com_easydiscuss&view=posts'); $this->addPathway(JText::sprintf('COM_EASYDISCUSS_BREADCRUMB_VIEWING_REPLIES', $parentTitle), ''); } else { $this->addPathway(JText::_('COM_EASYDISCUSS_BREADCRUMB_DISCUSSIONS'), ''); } $postModel = $this->getModel('Threaded'); $filterCategory = JRequest::getInt('category_id'); $categoryFilter = DiscussHelper::populateCategories('', '', 'select', 'category_id', $filterCategory, true, false, true, true, 'inputbox'); $posts = $postModel->getPosts(); $pagination = $postModel->getPagination(); $this->assignRef('posts', $posts); $this->assignRef('pagination', $pagination); $this->assign('categoryFilter', $categoryFilter); $this->assign('state', $this->getFilterState($filter_state)); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); $this->assign('parentId', $parentId); $this->assign('parentTitle', $parentTitle); parent::display($tpl); }
function sendOnPageLoad() { $db = DiscussHelper::getDBO(); $config = DiscussHelper::getConfig(); $max = (int) $config->get('main_mailqueuenumber'); // Delete existing mails that has already been sent. $query = 'DELETE FROM ' . $db->nameQuote('#__discuss_mailq') . ' WHERE ' . $db->nameQuote('status') . '=' . $db->Quote(1) . ' AND DATEDIFF(NOW(), `created`) >= 30'; $db->setQuery($query); $db->Query(); $query = 'SELECT `id` FROM `#__discuss_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 = DiscussHelper::getTable('MailQueue'); $mailq->load($mail->id); // update the status to 1 == proccessed $mailq->status = 1; if ($mailq->store()) { if (DiscussHelper::getJoomlaVersion() > '1.6') { $mail = JFactory::getMailer(); $result = $mail->sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $mailq->ashtml); // This code is to record all the activities from crons. // Need to create a table for this // $date = JFactory::getDate(); // $data = new stdClass(); // $data->id = null; // $data->recipient = $mailq->recipient; // $data->subject = $mailq->subject; // $data->body = $mailq->body; // $data->status = $mailq->status; // $data->created = $date->toMySQL(); // $db->insertObject( '#__discuss_cron_logs', $data, id ); } else { JUtility::sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $mailq->ashtml); } } //end foreach } } }
public function registerToolbar() { if ($this->cat->id != 0) { JToolBarHelper::title(JText::sprintf('COM_EASYDISCUSS_CATEGORIES_EDIT_CATEGORY_TITLE', $this->cat->title), 'category'); } else { JToolBarHelper::title(JText::_('COM_EASYDISCUSS_CATEGORIES_EDIT_ADD_CATEGORY_TITLE'), 'category'); } JToolBarHelper::back(JText::_('COM_EASYDISCUSS_BACK'), 'index.php?option=com_easydiscuss&view=categories'); JToolBarHelper::divider(); JToolbarHelper::apply(); JToolbarHelper::save(); if (DiscussHelper::getJoomlaVersion() > '1.6') { JToolBarHelper::save2new('savePublishNew'); } else { JToolBarHelper::save('savePublishNew', JText::_('COM_EASYDISCUSS_SAVE_AND_NEW')); } JToolBarHelper::divider(); JToolBarHelper::cancel(); }
function getAdmins() { $db = DiscussHelper::getDBO(); $query = 'SELECT `id`'; $query .= ' FROM #__users'; if (DiscussHelper::getJoomlaVersion() >= '1.6') { $saUsersIds = DiscussHelper::getSAUsersIds(); $query .= ' WHERE id IN (' . implode(',', $saUsersIds) . ')'; } else { $query .= ' WHERE LOWER( `usertype` ) = ' . $db->Quote('super administrator'); } $query .= ' AND `sendEmail` = ' . $db->Quote('1'); $db->setQuery($query); if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); } $result = $db->loadObjectList(); return $result; }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.categories', 'com_easydiscuss')) { 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_easydiscuss.categories.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easydiscuss.categories.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easydiscuss.categories.filter_order', 'filter_order', 'lft', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.categories.filter_order_Dir', 'filter_order_Dir', 'asc', 'word'); // Get data from the model $model = $this->getModel('Categories'); $categories = $model->getData(); $ordering = array(); JTable::addIncludePath(DISCUSS_TABLES); $category = JTable::getInstance('Category', 'Discuss'); for ($i = 0; $i < count($categories); $i++) { $category = $categories[$i]; $category->count = $model->getUsedCount($category->id, false, true); $category->child_count = $model->getChildCount($category->id); // Preprocess the list of items to find ordering divisions. $ordering[$category->parent_id][] = $category->id; } $pagination = $this->get('Pagination'); $this->addPathway('Home', 'index.php?option=com_easydiscuss'); $this->addPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_CATEGORIES')); $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('orderDirection', $orderDirection); parent::display($tpl); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.badges', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } // Initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); if ($this->getLayout() == 'install') { return $this->installLayout(); } if ($this->getLayout() == 'managerules') { return $this->manageRules(); } $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.badges.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easydiscuss.badges.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easydiscuss.badges.filter_order', 'filter_order', 'a.id', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.badges.filter_order_Dir', 'filter_order_Dir', '', 'word'); $exclusion = JRequest::getVar('exclude', ''); $model = $this->getModel('Badges'); $badges = $model->getBadges($exclusion); $pagination = $this->get('Pagination'); // Determines if the current request is shown in a modal window. $browse = JRequest::getInt('browse', 0); $browseFunction = JRequest::getVar('browseFunction', ''); $this->assign('browseFunction', $browseFunction); $this->assign('browse', $browse); $this->assign('badges', $badges); $this->assign('pagination', $pagination); $this->assign('state', $this->getFilterState($filter_state)); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.acls', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } // Initialise variables $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $model = $this->getModel('Acl'); $config = DiscussHelper::getConfig(); $type = $mainframe->getUserStateFromRequest('com_easydiscuss.acls.filter_type', 'filter_type', 'group', 'word'); // Filtering $filter = new stdClass(); $filter->type = $this->getFilterType($type); $filter->search = $mainframe->getUserStateFromRequest('com_easydiscuss.acls.search', 'search', '', 'string'); // Sorting $sort = new stdClass(); $sort->order = $mainframe->getUserStateFromRequest('com_easydiscuss.acls.filter_order', 'filter_order', 'a.`id`', 'cmd'); $sort->orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.acls.filter_order_Dir', 'filter_order_Dir', '', 'word'); $rulesets = $model->getRuleSets($type); $pagination = $model->getPagination($type); if ($type == 'assigned') { $document->setTitle(JText::_("COM_EASYDISCUSS_ACL_ASSIGN_USER")); JToolBarHelper::title(JText::_('COM_EASYDISCUSS_ACL_ASSIGN_USER'), 'acl'); } else { $document->setTitle(JText::_("COM_EASYDISCUSS_ACL_JOOMLA_USER_GROUP")); JToolBarHelper::title(JText::_('COM_EASYDISCUSS_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); }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.autoposting', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } $config = DiscussHelper::getConfig(); $this->assignRef('config', $config); $layout = $this->getLayout(); if (method_exists($this, $layout)) { $this->{$layout}($tpl); return; } $facebookSetup = $this->setuped('facebook'); $twitterSetup = $this->setuped('twitter'); $this->assignRef('twitterSetup', $twitterSetup); $this->assignRef('facebookSetup', $facebookSetup); parent::display($tpl); }
public function showMoveDialog() { $ajax = new Disjax(); $options = new stdClass(); // Get list of categories. $categories = DiscussHelper::populateCategories('', '', 'select', 'new_category', '', true, true, true, true); $options->title = JText::_('COM_EASYDISCUSS_DIALOG_MOVE_TITLE'); $action = DiscussHelper::getJoomlaVersion() >= '1.6' ? 'Joomla.submitbutton(\'movePosts\');' : 'submitbutton(\'movePosts\')'; ob_start(); ?> <div style="display:none;" id="new_category_error" class="alert alert-error"></div> <p><?php echo JText::_('COM_EASYDISCUSS_DIALOG_MOVE_CONTENT'); ?> </p> <p> <?php echo $categories; ?> </p> <?php $options->content = ob_get_clean(); $buttons = array(); $button = new stdClass(); $button->title = JText::_('COM_EASYDISCUSS_CANCEL_BUTTON'); $button->action = 'disjax.closedlg();'; $buttons[] = $button; $button = new stdClass(); $button->title = JText::_('COM_EASYDISCUSS_MOVE_BUTTON'); $button->action = $action; $button->className = 'btn-primary'; $buttons[] = $button; $options->buttons = $buttons; $ajax->dialog($options); $ajax->send(); }
function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.points', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $this->addPathway('Home', 'index.php?option=com_easydiscuss'); $this->addPathway('Points', ''); if ($this->getLayout() == 'install') { return $this->installLayout(); } if ($this->getLayout() == 'managerules') { return $this->manageRules(); } $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.points.filter_state', 'filter_state', '*', 'word'); $search = $mainframe->getUserStateFromRequest('com_easydiscuss.points.search', 'search', '', 'string'); $search = trim(JString::strtolower($search)); $order = $mainframe->getUserStateFromRequest('com_easydiscuss.points.filter_order', 'filter_order', 'a.id', 'cmd'); $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.points.filter_order_Dir', 'filter_order_Dir', '', 'word'); $points = $this->get('Points'); $pagination = $this->get('Pagination'); $this->assign('points', $points); $this->assign('pagination', $pagination); $this->assign('state', $this->getFilterState($filter_state)); $this->assign('search', $search); $this->assign('order', $order); $this->assign('orderDirection', $orderDirection); parent::display($tpl); }
public static function getLoginLink($returnURL = '') { $config = DiscussHelper::getConfig(); if (!empty($returnURL)) { $returnURL = '&return=' . $returnURL; } if (DiscussHelper::getJoomlaVersion() >= '1.6') { $link = DiscussRouter::_('index.php?option=com_users&view=login' . $returnURL); } else { $link = DiscussRouter::_('index.php?option=com_user&view=login' . $returnURL); } return $link; }
<span class="pull-left"> <label for="discuss-post-remember" class="checkbox"> <input type="checkbox" tabindex="203" id="discuss-post-remember" name="remember" class="" value="yes" /> <?php echo JText::_('COM_EASYDISCUSS_REMEMBER_ME'); ?> </label> </span> <input type="submit" tabindex="204" value="<?php echo JText::_('COM_EASYDISCUSS_LOGIN', true); ?> " name="Submit" class="btn btn-primary pull-right" /> </li> </ul> <?php if (DiscussHelper::getJoomlaVersion() >= '1.6') { ?> <input type="hidden" value="com_users" name="option"> <input type="hidden" value="user.login" name="task"> <input type="hidden" name="return" value="<?php echo base64_encode(DiscussRouter::getPostRoute($post->id, false)); ?> " /> <?php } else { ?> <input type="hidden" value="com_user" name="option"> <input type="hidden" value="login" name="task"> <input type="hidden" name="return" value="<?php echo base64_encode(DiscussRouter::getPostRoute($post->id, false)); ?>
private function _getRuleSet($userId) { static $rulesData = null; $my = empty($userId) ? JFactory::getUser() : JFactory::getUser($userId); if (!isset($rulesData[$my->id])) { $db = DiscussHelper::getDBO(); $config = DiscussHelper::getConfig(); $rulesets = new stdClass(); $rulesets->rules = new stdClass(); if (!empty($my->id)) { $rulesets->id = $my->id; $rulesets->name = $my->name; $rulesets->group = isset($my->usertype) ? $my->usertype : ''; // @Task: Retreive assigned rulesets for this particular user. // Assigned rulesets always have higher precedence $query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_acl_group') . ' ' . 'WHERE ' . $db->nameQuote('content_id') . '=' . $db->Quote($my->id) . ' ' . 'AND ' . $db->nameQuote('type') . '=' . $db->Quote('assigned') . ' ORDER BY `acl_id`'; $db->setQuery($query); $tmp = $db->loadObjectList(); $result = array(); foreach ($tmp as $row) { $result[$row->acl_id] = $row; } if (count($result) > 0) { $rulesets = $this->_mapRules($result, $rulesets); } else { if (DiscussHelper::getJoomlaVersion() >= '1.6') { // get user's joomla usergroups ids. $groupIds = ''; $query = 'SELECT `group_id` FROM `#__user_usergroup_map` WHERE `user_id` = ' . $db->Quote($my->id); $db->setQuery($query); $groupIds = $db->loadResultArray(); $groups = array(); // get the last index. for ($i = 0; $i < count($groupIds); $i++) { $grpId =& $groupIds[$i]; $query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_acl_group') . ' ' . 'WHERE ' . $db->nameQuote('content_id') . '=' . $db->Quote($grpId) . ' ' . 'AND ' . $db->nameQuote('type') . '=' . $db->Quote('group') . ' ORDER BY `acl_id`'; $db->setQuery($query); $groups[] = $db->loadObjectList(); } // Allow explicit overrides in the groups // If user A is in group A (allow) and group B (not allowed) , user A should be allowed $result = array(); foreach ($groups as $group) { foreach ($group as $rule) { if (!isset($result[$rule->acl_id])) { $result[$rule->acl_id] = new stdClass(); } if (isset($result[$rule->acl_id]->acl_id) && $result[$rule->acl_id]->status != '1' || !isset($result[$rule->acl_id]->acl_id)) { $result[$rule->acl_id]->acl_id = $rule->acl_id; $result[$rule->acl_id]->status = $rule->status; } } } } else { $query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_acl_group') . ' ' . 'WHERE ' . $db->nameQuote('content_id') . '=' . $db->Quote($my->gid) . ' ' . 'AND ' . $db->nameQuote('type') . '=' . $db->Quote('group') . ' ORDER BY `acl_id`'; $db->setQuery($query); $group = $db->loadObjectList(); $result = array(); foreach ($group as $rule) { if (!isset($result[$rule->acl_id])) { $result[$rule->acl_id] = new stdClass(); } if (isset($result[$rule->acl_id]->acl_id) && $result[$rule->acl_id]->status != '1' || !isset($result[$rule->acl_id]->acl_id)) { $result[$rule->acl_id]->acl_id = $rule->acl_id; $result[$rule->acl_id]->status = $rule->status; } } } $rulesets = $this->_mapRules($result, $rulesets); } } else { $rulesets->id = '0'; $rulesets->name = 'guest'; $rulesets->group = 'public'; if (DiscussHelper::getJoomlaVersion() >= '1.6') { $query = 'SELECT `id` FROM ' . $db->nameQuote('#__usergroups') . ' ' . 'WHERE ' . $db->nameQuote('parent_id') . '=' . $db->Quote('0'); $db->setQuery($query); $publicGroup = $db->loadResult(); } else { $publicGroup = '0'; } $query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_acl_group') . ' ' . 'WHERE ' . $db->nameQuote('content_id') . '=' . $db->Quote($publicGroup) . ' ' . 'AND ' . $db->nameQuote('type') . '=' . $db->Quote('group') . ' ORDER BY `acl_id`'; $db->setQuery($query); $tmp = $db->loadObjectList(); $result = array(); foreach ($tmp as $row) { $result[$row->acl_id] = $row; } $rulesets = $this->_mapRules($result, $rulesets); } $rulesData[$my->id] = $rulesets; } $this->ruleset = $rulesData[$my->id]; return $rulesData[$my->id]; }
function _verifyOnwerShip($id) { $db = DiscussHelper::getDBO(); $query = 'SELECT `id` FROM `#__users` WHERE `id` = ' . $db->Quote($id); $db->setQuery($query); $result = $db->loadResult(); if (empty($result)) { if (DiscussHelper::getJoomlaVersion() >= '1.6') { $saUsersId = DiscussHelper::getSAUsersIds(); $result = $saUsersId[0]; } else { $result = $this->_getSuperAdminId(); } } return $result; }
private static function _getPhpbbConfig($phpbbDB = null) { DiscussHelper::getJoomlaVersion() >= '3.0' ? $nameQuote = 'quoteName' : ($nameQuote = 'nameQuote'); $sql = 'SELECT ' . $phpbbDB->{$nameQuote}('config_name') . ', ' . $phpbbDB->{$nameQuote}('config_value') . ' ' . 'FROM ' . $phpbbDB->{$nameQuote}('#__config') . ' ' . 'WHERE ' . $phpbbDB->{$nameQuote}('config_name') . ' IN (' . $phpbbDB->quote('avatar_gallery_path') . ', ' . $phpbbDB->quote('avatar_path') . ', ' . $phpbbDB->quote('default_style') . ')'; $phpbbDB->setQuery($sql); $result = $phpbbDB->loadObjectList(); if (empty($result)) { return false; } $phpbbConfig = new stdClass(); $phpbbConfig->avatar_gallery_path = null; $phpbbConfig->avatar_upload_path = null; $phpbbConfig->default_style = 1; foreach ($result as $row) { switch ($row->config_name) { case 'avatar_gallery_path': $phpbbConfig->avatar_gallery_path = $row->config_value; break; case 'avatar_path': $phpbbConfig->avatar_upload_path = $row->config_value; break; case 'default_style': $phpbbConfig->default_style = $row->config_value; break; } } return $phpbbConfig; }
<td class="center"> <?php $category = DiscussHelper::getTable('Category'); $category->load($row->category_id); ?> <a href="index.php?option=com_easydiscuss&view=category&catid=<?php echo $category->id; ?> "><?php echo $this->escape($category->title); ?> </a> </td> <td class="center" style="text-align:center;"> <?php if (DiscussHelper::getJoomlaVersion() <= '1.5') { ?> <a href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i; ?> ','<?php echo $row->featured ? 'unfeature' : 'feature'; ?> ')"> <img src="<?php echo JURI::root(); ?> administrator/components/com_easydiscuss/themes/default/images/<?php echo $row->featured ? 'small_default.png' : 'small_default-x.png'; ?> " width="16" height="16" border="0" />