; return $query; } function _buildContentOrderBy() { global $mainframe; // Get the page/component configuration $params = &$mainframe->getParams(); if (!is_object($params)) { $params = &JComponentHelper::getParams('com_content'); } $orderby_sec = $params->def('orderby_sec', ''); $orderby_pri = $params->def('orderby_pri', ''); $secondary = ContentHelperQuery::orderbySecondary($orderby_sec); $primary = ContentHelperQuery::orderbyPrimary($orderby_pri); $orderby = ' ORDER BY '.$primary.' '.$secondary; return $orderby; } function _buildContentWhere() { global $mainframe; $user =& JFactory::getUser(); $gid = $user->get('aid', 0); // TODO: Should we be using requestTime here? or is JDate ok? // $now = $mainframe->get('requestTime'); $jnow =& JFactory::getDate(); $now = $jnow->toMySQL(); // Get the page/component configuration $params = &$mainframe->getParams(); $noauth = !$params->get('show_noauth'); $nullDate = $this->_db->getNullDate(); //First thing we need to do is assert that the articles are in the current category $where = ' WHERE 1'; // Does the user have access to view the items? if ($noauth) { $where .= ' AND a.access <= '.(int) $gid; } if ($user->authorize('com_content', 'edit', 'content', 'all')) { $where .= ' AND a.state >= 0'; } else { $where .= ' AND a.state = 1'. ' AND (( cc.published = 1'. ' AND s.published = 1 )'. ' OR ( a.catid = 0 AND a.sectionid = 0 ) )'; $where .= ' AND ( a.publish_up = '.$this->_db->Quote($nullDate).' OR a.publish_up <= '.$this->_db->Quote($now).' )' . ' AND ( a.publish_down = '.$this->_db->Quote($nullDate).' OR a.publish_down >= '.$this->_db->Quote($now).' )'; } return $where; } } setId((int)$id); } /** * Method to set the section id * * @access public * @param int Section ID number */ function setId($id) { // Set new ID and wipe data $this->_id = $id; $this->_data = array(); $this->_total = null; $this->_section = null; $this->_categories = null; } /** * Method to get content item data for the section * * @param int $state The content state to pull from for the current * section * @since 1.5 */ function getData($state = 1) { // Load the Category data if ($this->_loadSection() && $this->_loadData($state)) { // Initialize some variables $user =& JFactory::getUser(); // Make sure the category is published if (!$this->_section->published) { JError::raiseError(404, JText::_("Resource Not Found")); return false; } // check whether category access level allows access if ($this->_section->access > $user->get('aid', 0)) { JError::raiseError(403, JText::_("ALERTNOTAUTH")); return false; } } return $this->_data[$state]; } /** * Method to get the total number of content items for the section * * @access public * @return integer */ function getTotal($state = 1) { // Lets load the content if it doesn't already exist if (empty($this->_total)) { $query = $this->_buildQuery($state); $this->_total[$state] = $this->_getListCount($