Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/com_content.zip
Назад
PK iX!]�C�r` ` content.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_content * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php'); JLoader::register('ContentHelperQuery', JPATH_SITE . '/components/com_content/helpers/query.php'); JLoader::register('ContentHelperAssociation', JPATH_SITE . '/components/com_content/helpers/association.php'); $input = JFactory::getApplication()->input; $user = JFactory::getUser(); $checkCreateEdit = ($input->get('view') === 'articles' && $input->get('layout') === 'modal') || ($input->get('view') === 'article' && $input->get('layout') === 'pagebreak'); if ($checkCreateEdit) { // Can create in any category (component permission) or at least in one category $canCreateRecords = $user->authorise('core.create', 'com_content') || count($user->getAuthorisedCategories('com_content', 'core.create')) > 0; // Instead of checking edit on all records, we can use **same** check as the form editing view $values = (array) JFactory::getApplication()->getUserState('com_content.edit.article.id'); $isEditingRecords = count($values); $hasAccess = $canCreateRecords || $isEditingRecords; if (!$hasAccess) { JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning'); return; } } $controller = JControllerLegacy::getInstance('Content'); $controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect(); PK iX!]2 $ $ models/archive.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_content * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; JLoader::register('ContentModelArticles', __DIR__ . '/articles.php'); /** * Content Component Archive Model * * @since 1.5 */ class ContentModelArchive extends ContentModelArticles { /** * Model context string. * * @var string */ public $_context = 'com_content.archive'; /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering The field to order on. * @param string $direction The direction to order on. * * @return void * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { parent::populateState(); $app = JFactory::getApplication(); // Add archive properties $params = $this->state->params; // Filter on archived articles $this->setState('filter.published', 2); // Filter on month, year $this->setState('filter.month', $app->input->getInt('month')); $this->setState('filter.year', $app->input->getInt('year')); // Optional filter text $this->setState('list.filter', $app->input->getString('filter-search')); // Get list limit $itemid = $app->input->get('Itemid', 0, 'int'); $limit = $app->getUserStateFromRequest('com_content.archive.list' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint'); $this->setState('list.limit', $limit); // Set the archive ordering $articleOrderby = $params->get('orderby_sec', 'rdate'); $articleOrderDate = $params->get('order_date'); // No category ordering $secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate); $this->setState('list.ordering', $secondary . ', a.created DESC'); $this->setState('list.direction', ''); } /** * Get the master query for retrieving a list of articles subject to the model state. * * @return JDatabaseQuery * * @since 1.6 */ protected function getListQuery() { $params = $this->state->params; $app = JFactory::getApplication('site'); $catids = ArrayHelper::toInteger($app->input->get('catid', array(), 'array')); $catids = array_values(array_diff($catids, array(0))); $articleOrderDate = $params->get('order_date'); // Create a new query object. $query = parent::getListQuery(); // Add routing for archive // Sqlsrv changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id . ' END as slug'; $query->select($case_when); $case_when = ' CASE WHEN '; $case_when .= $query->charLength('c.alias', '!=', '0'); $case_when .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $c_id . ' END as catslug'; $query->select($case_when); // Filter on month, year // First, get the date field $queryDate = ContentHelperQuery::getQueryDate($articleOrderDate); if ($month = $this->getState('filter.month')) { $query->where($query->month($queryDate) . ' = ' . $month); } if ($year = $this->getState('filter.year')) { $query->where($query->year($queryDate) . ' = ' . $year); } if (count($catids) > 0) { $query->where('c.id IN (' . implode(', ', $catids) . ')'); } return $query; } /** * Method to get the archived article list * * @access public * @return array */ public function getData() { $app = JFactory::getApplication(); // Lets load the content if it doesn't already exist if (empty($this->_data)) { // Get the page/component configuration $params = $app->getParams(); // Get the pagination request variables $limit = $app->input->get('limit', $params->get('display_num', 20), 'uint'); $limitstart = $app->input->get('limitstart', 0, 'uint'); $query = $this->_buildQuery(); $this->_data = $this->_getList($query, $limitstart, $limit); } return $this->_data; } /** * JModelLegacy override to add alternating value for $odd * * @param string $query The query. * @param integer $limitstart Offset. * @param integer $limit The number of records. * * @return array An array of results. * * @since 3.0.1 * @throws RuntimeException */ protected function _getList($query, $limitstart=0, $limit=0) { $result = parent::_getList($query, $limitstart, $limit); $odd = 1; foreach ($result as $k => $row) { $result[$k]->odd = $odd; $odd = 1 - $odd; } return $result; } /** * Gets the archived articles years * * @return array * * @since 3.6.0 */ public function getYears() { $db = $this->getDbo(); $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); $query = $db->getQuery(true); $years = $query->year($db->qn('created')); $query->select('DISTINCT (' . $years . ')') ->from($db->qn('#__content')) ->where($db->qn('state') . '= 2') ->where('(publish_up = ' . $nullDate . ' OR publish_up <= ' . $nowDate . ')') ->where('(publish_down = ' . $nullDate . ' OR publish_down >= ' . $nowDate . ')') ->order('1 ASC'); $db->setQuery($query); return $db->loadColumn(); } } PK iX!]��L�) �) models/article.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_content * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; use Joomla\Utilities\IpHelper; /** * Content Component Article Model * * @since 1.5 */ class ContentModelArticle extends JModelItem { /** * Model context string. * * @var string */ protected $_context = 'com_content.article'; /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 * * @return void */ protected function populateState() { $app = JFactory::getApplication('site'); // Load state from the request. $pk = $app->input->getInt('id'); $this->setState('article.id', $pk); $offset = $app->input->getUInt('limitstart'); $this->setState('list.offset', $offset); // Load the parameters. $params = $app->getParams(); $this->setState('params', $params); $user = JFactory::getUser(); // If $pk is set then authorise on complete asset, else on component only $asset = empty($pk) ? 'com_content' : 'com_content.article.' . $pk; if ((!$user->authorise('core.edit.state', $asset)) && (!$user->authorise('core.edit', $asset))) { $this->setState('filter.published', 1); $this->setState('filter.archived', 2); } $this->setState('filter.language', JLanguageMultilang::isEnabled()); } /** * Method to get article data. * * @param integer $pk The id of the article. * * @return object|boolean|JException Menu item data object on success, boolean false or JException instance on error */ public function getItem($pk = null) { $user = JFactory::getUser(); $pk = (!empty($pk)) ? $pk : (int) $this->getState('article.id'); if ($this->_item === null) { $this->_item = array(); } if (!isset($this->_item[$pk])) { try { $db = $this->getDbo(); $query = $db->getQuery(true) ->select( $this->getState( 'item.select', 'a.id, a.asset_id, a.title, a.alias, a.introtext, a.fulltext, ' . 'a.state, a.catid, a.created, a.created_by, a.created_by_alias, ' . // Use created if modified is 0 'CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END as modified, ' . 'a.modified_by, a.checked_out, a.checked_out_time, a.publish_up, a.publish_down, ' . 'a.images, a.urls, a.attribs, a.version, a.ordering, ' . 'a.metakey, a.metadesc, a.access, a.hits, a.metadata, a.featured, a.language, a.xreference' ) ); $query->from('#__content AS a') ->where('a.id = ' . (int) $pk); // Join on category table. $query->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access') ->innerJoin('#__categories AS c on c.id = a.catid') ->where('c.published > 0'); // Join on user table. $query->select('u.name AS author') ->join('LEFT', '#__users AS u on u.id = a.created_by'); // Filter by language if ($this->getState('filter.language')) { $query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } // Join over the categories to get parent category titles $query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias') ->join('LEFT', '#__categories as parent ON parent.id = c.parent_id'); // Join on voting table $query->select('ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count') ->join('LEFT', '#__content_rating AS v ON a.id = v.content_id'); if ((!$user->authorise('core.edit.state', 'com_content.article.' . $pk)) && (!$user->authorise('core.edit', 'com_content.article.' . $pk))) { // Filter by start and end dates. $nullDate = $db->quote($db->getNullDate()); $date = JFactory::getDate(); $nowDate = $db->quote($date->toSql()); $query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } // Filter by published state. $published = $this->getState('filter.published'); $archived = $this->getState('filter.archived'); if (is_numeric($published)) { $query->where('(a.state = ' . (int) $published . ' OR a.state =' . (int) $archived . ')'); } $db->setQuery($query); $data = $db->loadObject(); if (empty($data)) { return JError::raiseError(404, JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND')); } // Check for published state if filter set. if ((is_numeric($published) || is_numeric($archived)) && (($data->state != $published) && ($data->state != $archived))) { return JError::raiseError(404, JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND')); } // Convert parameter fields to objects. $registry = new Registry($data->attribs); $data->params = clone $this->getState('params'); $data->params->merge($registry); $data->metadata = new Registry($data->metadata); // Technically guest could edit an article, but lets not check that to improve performance a little. if (!$user->get('guest')) { $userId = $user->get('id'); $asset = 'com_content.article.' . $data->id; // Check general edit permission first. if ($user->authorise('core.edit', $asset)) { $data->params->set('access-edit', true); } // Now check if edit.own is available. elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) { // Check for a valid user and that they are the owner. if ($userId == $data->created_by) { $data->params->set('access-edit', true); } } } // Compute view access permissions. if ($access = $this->getState('filter.access')) { // If the access filter has been set, we already know this user can view. $data->params->set('access-view', true); } else { // If no access filter is set, the layout takes some responsibility for display of limited information. $user = JFactory::getUser(); $groups = $user->getAuthorisedViewLevels(); if ($data->catid == 0 || $data->category_access === null) { $data->params->set('access-view', in_array($data->access, $groups)); } else { $data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups)); } } $this->_item[$pk] = $data; } catch (Exception $e) { if ($e->getCode() == 404) { // Need to go thru the error handler to allow Redirect to work. JError::raiseError(404, $e->getMessage()); } else { $this->setError($e); $this->_item[$pk] = false; } } } return $this->_item[$pk]; } /** * Increment the hit counter for the article. * * @param integer $pk Optional primary key of the article to increment. * * @return boolean True if successful; false otherwise and internal error set. */ public function hit($pk = 0) { $input = JFactory::getApplication()->input; $hitcount = $input->getInt('hitcount', 1); if ($hitcount) { $pk = (!empty($pk)) ? $pk : (int) $this->getState('article.id'); $table = JTable::getInstance('Content', 'JTable'); $table->hit($pk); } return true; } /** * Save user vote on article * * @param integer $pk Joomla Article Id * @param integer $rate Voting rate * * @return boolean Return true on success */ public function storeVote($pk = 0, $rate = 0) { if ($rate >= 1 && $rate <= 5 && $pk > 0) { $userIP = IpHelper::getIp(); // Initialize variables. $db = $this->getDbo(); $query = $db->getQuery(true); // Create the base select statement. $query->select('*') ->from($db->quoteName('#__content_rating')) ->where($db->quoteName('content_id') . ' = ' . (int) $pk); // Set the query and load the result. $db->setQuery($query); // Check for a database error. try { $rating = $db->loadObject(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); return false; } // There are no ratings yet, so lets insert our rating if (!$rating) { $query = $db->getQuery(true); // Create the base insert statement. $query->insert($db->quoteName('#__content_rating')) ->columns(array($db->quoteName('content_id'), $db->quoteName('lastip'), $db->quoteName('rating_sum'), $db->quoteName('rating_count'))) ->values((int) $pk . ', ' . $db->quote($userIP) . ',' . (int) $rate . ', 1'); // Set the query and execute the insert. $db->setQuery($query); try { $db->execute(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); return false; } } else { if ($userIP != $rating->lastip) { $query = $db->getQuery(true); // Create the base update statement. $query->update($db->quoteName('#__content_rating')) ->set($db->quoteName('rating_count') . ' = rating_count + 1') ->set($db->quoteName('rating_sum') . ' = rating_sum + ' . (int) $rate) ->set($db->quoteName('lastip') . ' = ' . $db->quote($userIP)) ->where($db->quoteName('content_id') . ' = ' . (int) $pk); // Set the query and execute the update. $db->setQuery($query); try { $db->execute(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); return false; } } else { return false; } } $this->cleanCache(); return true; } JError::raiseWarning(500, JText::sprintf('COM_CONTENT_INVALID_RATING', $rate), "JModelArticle::storeVote($rate)"); return false; } /** * Cleans the cache of com_content and content modules * * @param string $group The cache group * @param integer $clientId The ID of the client * * @return void * * @since 3.9.9 */ protected function cleanCache($group = null, $clientId = 0) { parent::cleanCache('com_content'); parent::cleanCache('mod_articles_archive'); parent::cleanCache('mod_articles_categories'); parent::cleanCache('mod_articles_category'); parent::cleanCache('mod_articles_latest'); parent::cleanCache('mod_articles_news'); parent::cleanCache('mod_articles_popular'); } } PK iX!]D2 �| | models/categories.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; /** * This models supports retrieving lists of article categories. * * @since 1.6 */ class ContentModelCategories extends JModelList { /** * Model context string. * * @var string */ public $_context = 'com_content.categories'; /** * The category context (allows other extensions to derived from this model). * * @var string */ protected $_extension = 'com_content'; private $_parent = null; /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering The field to order on. * @param string $direction The direction to order on. * * @return void * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $this->setState('filter.extension', $this->_extension); // Get the parent id if defined. $parentId = $app->input->getInt('id'); $this->setState('filter.parentId', $parentId); $params = $app->getParams(); $this->setState('params', $params); $this->setState('filter.published', 1); $this->setState('filter.access', true); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.extension'); $id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.parentId'); return parent::getStoreId($id); } /** * Redefine the function an add some properties to make the styling more easy * * @param bool $recursive True if you want to return children recursively. * * @return mixed An array of data items on success, false on failure. * * @since 1.6 */ public function getItems($recursive = false) { $store = $this->getStoreId(); if (!isset($this->cache[$store])) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); $params = new Registry; if ($active) { $params->loadString($active->params); } $options = array(); $options['countItems'] = $params->get('show_cat_num_articles_cat', 1) || !$params->get('show_empty_categories_cat', 0); $categories = JCategories::getInstance('Content', $options); $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); if (is_object($this->_parent)) { $this->cache[$store] = $this->_parent->getChildren($recursive); } else { $this->cache[$store] = false; } } return $this->cache[$store]; } /** * Get the parent. * * @return object An array of data items on success, false on failure. * * @since 1.6 */ public function getParent() { if (!is_object($this->_parent)) { $this->getItems(); } return $this->_parent; } } PK iX!]���߃Y �Y models/articles.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; JLoader::register('ContentHelperAssociation', JPATH_SITE . '/components/com_content/helpers/association.php'); /** * This models supports retrieving lists of articles. * * @since 1.6 */ class ContentModelArticles extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'title', 'a.title', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'state', 'a.state', 'access', 'a.access', 'access_level', 'created', 'a.created', 'created_by', 'a.created_by', 'ordering', 'a.ordering', 'featured', 'a.featured', 'language', 'a.language', 'hits', 'a.hits', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'images', 'a.images', 'urls', 'a.urls', 'filter_tag', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * This method should only be called once per instantiation and is designed * to be called on the first call to the getState() method unless the model * configuration flag to ignore the request is set. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 3.0.1 */ protected function populateState($ordering = 'ordering', $direction = 'ASC') { $app = JFactory::getApplication(); // List state information $value = $app->input->get('limit', $app->get('list_limit', 0), 'uint'); $this->setState('list.limit', $value); $value = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $value); $value = $app->input->get('filter_tag', 0, 'uint'); $this->setState('filter.tag', $value); $orderCol = $app->input->get('filter_order', 'a.ordering'); if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'a.ordering'; } $this->setState('list.ordering', $orderCol); $listOrder = $app->input->get('filter_order_Dir', 'ASC'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $params = $app->getParams(); $this->setState('params', $params); $user = JFactory::getUser(); if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))) { // Filter on published for those who do not have edit or edit.state rights. $this->setState('filter.published', 1); } $this->setState('filter.language', JLanguageMultilang::isEnabled()); // Process show_noauth parameter if ((!$params->get('show_noauth')) || (!JComponentHelper::getParams('com_content')->get('show_noauth'))) { $this->setState('filter.access', true); } else { $this->setState('filter.access', false); } $this->setState('layout', $app->input->getString('layout')); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . serialize($this->getState('filter.published')); $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.featured'); $id .= ':' . serialize($this->getState('filter.article_id')); $id .= ':' . $this->getState('filter.article_id.include'); $id .= ':' . serialize($this->getState('filter.category_id')); $id .= ':' . $this->getState('filter.category_id.include'); $id .= ':' . serialize($this->getState('filter.author_id')); $id .= ':' . $this->getState('filter.author_id.include'); $id .= ':' . serialize($this->getState('filter.author_alias')); $id .= ':' . $this->getState('filter.author_alias.include'); $id .= ':' . $this->getState('filter.date_filtering'); $id .= ':' . $this->getState('filter.date_field'); $id .= ':' . $this->getState('filter.start_date_range'); $id .= ':' . $this->getState('filter.end_date_range'); $id .= ':' . $this->getState('filter.relative_date'); $id .= ':' . serialize($this->getState('filter.tag')); return parent::getStoreId($id); } /** * Get the master query for retrieving a list of articles subject to the model state. * * @return JDatabaseQuery * * @since 1.6 */ protected function getListQuery() { // Get the current user for authorisation checks $user = JFactory::getUser(); // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.id, a.title, a.alias, a.introtext, a.fulltext, ' . 'a.checked_out, a.checked_out_time, ' . 'a.catid, a.created, a.created_by, a.created_by_alias, ' . // Published/archived article in archive category is treats as archive article // If category is not published then force 0 'CASE WHEN c.published = 2 AND a.state > 0 THEN 2 WHEN c.published != 1 THEN 0 ELSE a.state END as state,' . // Use created if modified is 0 'CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END as modified, ' . 'a.modified_by, uam.name as modified_by_name,' . // Use created if publish_up is 0 'CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END as publish_up,' . 'a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, ' . 'a.hits, a.xreference, a.featured, a.language, ' . ' ' . $query->length('a.fulltext') . ' AS readmore, a.ordering' ) ); $query->from('#__content AS a'); $params = $this->getState('params'); $orderby_sec = $params->get('orderby_sec'); // Join over the frontpage articles if required. if ($this->getState('filter.frontpage')) { if ($orderby_sec === 'front') { $query->select('fp.ordering'); $query->join('INNER', '#__content_frontpage AS fp ON fp.content_id = a.id'); } else { $query->where('a.featured = 1'); } } elseif ($orderby_sec === 'front' || $this->getState('list.ordering') === 'fp.ordering') { $query->select('fp.ordering'); $query->join('LEFT', '#__content_frontpage AS fp ON fp.content_id = a.id'); } // Join over the categories. $query->select('c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias') ->select('c.published, c.published AS parents_published, c.lft') ->join('LEFT', '#__categories AS c ON c.id = a.catid'); // Join over the users for the author and modified_by names. $query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author") ->select('ua.email AS author_email') ->join('LEFT', '#__users AS ua ON ua.id = a.created_by') ->join('LEFT', '#__users AS uam ON uam.id = a.modified_by'); // Join over the categories to get parent category titles $query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias') ->join('LEFT', '#__categories as parent ON parent.id = c.parent_id'); if (JPluginHelper::isEnabled('content', 'vote')) { // Join on voting table $query->select('COALESCE(NULLIF(ROUND(v.rating_sum / v.rating_count, 0), 0), 0) AS rating, COALESCE(NULLIF(v.rating_count, 0), 0) as rating_count') ->join('LEFT', '#__content_rating AS v ON a.id = v.content_id'); } // Filter by access level. if ($this->getState('filter.access', true)) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')') ->where('c.access IN (' . $groups . ')'); } // Filter by published state $published = $this->getState('filter.published'); if (is_numeric($published) && $published == 2) { /** * If category is archived then article has to be published or archived. * Or category is published then article has to be archived. */ $query->where('((c.published = 2 AND a.state > 0) OR (c.published = 1 AND a.state = 2))'); } elseif (is_numeric($published)) { // Category has to be published $query->where('c.published = 1 AND a.state = ' . (int) $published); } elseif (is_array($published)) { $published = ArrayHelper::toInteger($published); $published = implode(',', $published); // Category has to be published $query->where('c.published = 1 AND a.state IN (' . $published . ')'); } // Filter by featured state $featured = $this->getState('filter.featured'); switch ($featured) { case 'hide': $query->where('a.featured = 0'); break; case 'only': $query->where('a.featured = 1'); break; case 'show': default: // Normally we do not discriminate between featured/unfeatured items. break; } // Filter by a single or group of articles. $articleId = $this->getState('filter.article_id'); if (is_numeric($articleId)) { $type = $this->getState('filter.article_id.include', true) ? '= ' : '<> '; $query->where('a.id ' . $type . (int) $articleId); } elseif (is_array($articleId)) { $articleId = ArrayHelper::toInteger($articleId); $articleId = implode(',', $articleId); $type = $this->getState('filter.article_id.include', true) ? 'IN' : 'NOT IN'; $query->where('a.id ' . $type . ' (' . $articleId . ')'); } // Filter by a single or group of categories $categoryId = $this->getState('filter.category_id'); if (is_numeric($categoryId)) { $type = $this->getState('filter.category_id.include', true) ? '= ' : '<> '; // Add subcategory check $includeSubcategories = $this->getState('filter.subcategories', false); $categoryEquals = 'a.catid ' . $type . (int) $categoryId; if ($includeSubcategories) { $levels = (int) $this->getState('filter.max_category_levels', '1'); // Create a subquery for the subcategory list $subQuery = $db->getQuery(true) ->select('sub.id') ->from('#__categories as sub') ->join('INNER', '#__categories as this ON sub.lft > this.lft AND sub.rgt < this.rgt') ->where('this.id = ' . (int) $categoryId); if ($levels >= 0) { $subQuery->where('sub.level <= this.level + ' . $levels); } // Add the subquery to the main query $query->where('(' . $categoryEquals . ' OR a.catid IN (' . (string) $subQuery . '))'); } else { $query->where($categoryEquals); } } elseif (is_array($categoryId) && (count($categoryId) > 0)) { $categoryId = ArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); if (!empty($categoryId)) { $type = $this->getState('filter.category_id.include', true) ? 'IN' : 'NOT IN'; $query->where('a.catid ' . $type . ' (' . $categoryId . ')'); } } // Filter by author $authorId = $this->getState('filter.author_id'); $authorWhere = ''; if (is_numeric($authorId)) { $type = $this->getState('filter.author_id.include', true) ? '= ' : '<> '; $authorWhere = 'a.created_by ' . $type . (int) $authorId; } elseif (is_array($authorId)) { $authorId = array_filter($authorId, 'is_numeric'); if ($authorId) { $authorId = implode(',', $authorId); $type = $this->getState('filter.author_id.include', true) ? 'IN' : 'NOT IN'; $authorWhere = 'a.created_by ' . $type . ' (' . $authorId . ')'; } } // Filter by author alias $authorAlias = $this->getState('filter.author_alias'); $authorAliasWhere = ''; if (is_string($authorAlias)) { $type = $this->getState('filter.author_alias.include', true) ? '= ' : '<> '; $authorAliasWhere = 'a.created_by_alias ' . $type . $db->quote($authorAlias); } elseif (is_array($authorAlias)) { $first = current($authorAlias); if (!empty($first)) { foreach ($authorAlias as $key => $alias) { $authorAlias[$key] = $db->quote($alias); } $authorAlias = implode(',', $authorAlias); if ($authorAlias) { $type = $this->getState('filter.author_alias.include', true) ? 'IN' : 'NOT IN'; $authorAliasWhere = 'a.created_by_alias ' . $type . ' (' . $authorAlias . ')'; } } } if (!empty($authorWhere) && !empty($authorAliasWhere)) { $query->where('(' . $authorWhere . ' OR ' . $authorAliasWhere . ')'); } elseif (empty($authorWhere) && empty($authorAliasWhere)) { // If both are empty we don't want to add to the query } else { // One of these is empty, the other is not so we just add both $query->where($authorWhere . $authorAliasWhere); } // Define null and now dates $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); // Filter by start and end dates. if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))) { $query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } // Filter by Date Range or Relative Date $dateFiltering = $this->getState('filter.date_filtering', 'off'); $dateField = $this->getState('filter.date_field', 'a.created'); switch ($dateFiltering) { case 'range': $startDateRange = $db->quote($this->getState('filter.start_date_range', $nullDate)); $endDateRange = $db->quote($this->getState('filter.end_date_range', $nullDate)); $query->where( '(' . $dateField . ' >= ' . $startDateRange . ' AND ' . $dateField . ' <= ' . $endDateRange . ')' ); break; case 'relative': $relativeDate = (int) $this->getState('filter.relative_date', 0); $query->where( $dateField . ' >= ' . $query->dateAdd($nowDate, -1 * $relativeDate, 'DAY') ); break; case 'off': default: break; } // Process the filter for list views with user-entered filters if (is_object($params) && ($params->get('filter_field') !== 'hide') && ($filter = $this->getState('list.filter'))) { // Clean filter variable $filter = StringHelper::strtolower($filter); $monthFilter = $filter; $hitsFilter = (int) $filter; $filter = $db->quote('%' . $db->escape($filter, true) . '%', false); switch ($params->get('filter_field')) { case 'author': $query->where( 'LOWER( CASE WHEN a.created_by_alias > ' . $db->quote(' ') . ' THEN a.created_by_alias ELSE ua.name END ) LIKE ' . $filter . ' ' ); break; case 'hits': $query->where('a.hits >= ' . $hitsFilter . ' '); break; case 'month': if ($monthFilter != '') { $query->where( $db->quote(date("Y-m-d", strtotime($monthFilter)) . ' 00:00:00') . ' <= CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END' ); $query->where( $db->quote(date("Y-m-t", strtotime($monthFilter)) . ' 23:59:59') . ' >= CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END' ); } break; case 'title': default: // Default to 'title' if parameter is not valid $query->where('LOWER( a.title ) LIKE ' . $filter); break; } } // Filter by language if ($this->getState('filter.language')) { $query->where('a.language IN (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } // Filter by a single or group of tags. $tagId = $this->getState('filter.tag'); if (is_array($tagId) && count($tagId) === 1) { $tagId = current($tagId); } if (is_array($tagId)) { $tagId = implode(',', ArrayHelper::toInteger($tagId)); if ($tagId) { $subQuery = $db->getQuery(true) ->select('DISTINCT content_item_id') ->from($db->quoteName('#__contentitem_tag_map')) ->where('tag_id IN (' . $tagId . ')') ->where('type_alias = ' . $db->quote('com_content.article')); $query->innerJoin('(' . (string) $subQuery . ') AS tagmap ON tagmap.content_item_id = a.id'); } } elseif ($tagId) { $query->innerJoin( $db->quoteName('#__contentitem_tag_map', 'tagmap') . ' ON tagmap.tag_id = ' . (int) $tagId . ' AND tagmap.content_item_id = a.id' . ' AND tagmap.type_alias = ' . $db->quote('com_content.article') ); } // Add the list ordering clause. $query->order($this->getState('list.ordering', 'a.ordering') . ' ' . $this->getState('list.direction', 'ASC')); return $query; } /** * Method to get a list of articles. * * Overridden to inject convert the attribs field into a JParameter object. * * @return mixed An array of objects on success, false on failure. * * @since 1.6 */ public function getItems() { $items = parent::getItems(); $user = JFactory::getUser(); $userId = $user->get('id'); $guest = $user->get('guest'); $groups = $user->getAuthorisedViewLevels(); $input = JFactory::getApplication()->input; // Get the global params $globalParams = JComponentHelper::getParams('com_content', true); // Convert the parameter fields into objects. foreach ($items as &$item) { $articleParams = new Registry($item->attribs); // Unpack readmore and layout params $item->alternative_readmore = $articleParams->get('alternative_readmore'); $item->layout = $articleParams->get('layout'); $item->params = clone $this->getState('params'); /** * For blogs, article params override menu item params only if menu param = 'use_article' * Otherwise, menu item params control the layout * If menu item is 'use_article' and there is no article param, use global */ if (($input->getString('layout') === 'blog') || ($input->getString('view') === 'featured') || ($this->getState('params')->get('layout_type') === 'blog')) { // Create an array of just the params set to 'use_article' $menuParamsArray = $this->getState('params')->toArray(); $articleArray = array(); foreach ($menuParamsArray as $key => $value) { if ($value === 'use_article') { // If the article has a value, use it if ($articleParams->get($key) != '') { // Get the value from the article $articleArray[$key] = $articleParams->get($key); } else { // Otherwise, use the global value $articleArray[$key] = $globalParams->get($key); } } } // Merge the selected article params if (count($articleArray) > 0) { $articleParams = new Registry($articleArray); $item->params->merge($articleParams); } } else { // For non-blog layouts, merge all of the article params $item->params->merge($articleParams); } // Get display date switch ($item->params->get('list_show_date')) { case 'modified': $item->displayDate = $item->modified; break; case 'published': $item->displayDate = ($item->publish_up == 0) ? $item->created : $item->publish_up; break; default: case 'created': $item->displayDate = $item->created; break; } /** * Compute the asset access permissions. * Technically guest could edit an article, but lets not check that to improve performance a little. */ if (!$guest) { $asset = 'com_content.article.' . $item->id; // Check general edit permission first. if ($user->authorise('core.edit', $asset)) { $item->params->set('access-edit', true); } // Now check if edit.own is available. elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) { // Check for a valid user and that they are the owner. if ($userId == $item->created_by) { $item->params->set('access-edit', true); } } } $access = $this->getState('filter.access'); if ($access) { // If the access filter has been set, we already have only the articles this user can view. $item->params->set('access-view', true); } else { // If no access filter is set, the layout takes some responsibility for display of limited information. if ($item->catid == 0 || $item->category_access === null) { $item->params->set('access-view', in_array($item->access, $groups)); } else { $item->params->set('access-view', in_array($item->access, $groups) && in_array($item->category_access, $groups)); } } // Some contexts may not use tags data at all, so we allow callers to disable loading tag data if ($this->getState('load_tags', $item->params->get('show_tags', '1'))) { $item->tags = new JHelperTags; $item->tags->getItemTags('com_content.article', $item->id); } if ($item->params->get('show_associations')) { $item->associations = ContentHelperAssociation::displayAssociations($item->id); } } return $items; } /** * Method to get the starting number of items for the data set. * * @return integer The starting number of items available in the data set. * * @since 3.0.1 */ public function getStart() { return $this->getState('list.start'); } /** * Count Items by Month * * @return mixed An array of objects on success, false on failure. * * @since 3.9.0 */ public function countItemsByMonth() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); $query ->select('DATE(' . $query->concatenate( array( $query->year($query->quoteName('publish_up')), $query->quote('-'), $query->month($query->quoteName('publish_up')), $query->quote('-01') ) ) . ') as d' ) ->select('COUNT(*) as c') ->from('(' . $this->getListQuery() . ') as b') ->group($query->quoteName('d')) ->order($query->quoteName('d') . ' desc'); return $db->setQuery($query)->loadObjectList(); } } PK iX!]�u��W1 W1 models/category.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_content * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; use Joomla\Utilities\ArrayHelper; /** * This models supports retrieving a category, the articles associated with the category, * sibling, child and parent categories. * * @since 1.5 */ class ContentModelCategory extends JModelList { /** * Category items data * * @var array */ protected $_item = null; protected $_articles = null; protected $_siblings = null; protected $_children = null; protected $_parent = null; /** * Model context string. * * @var string */ protected $_context = 'com_content.category'; /** * The category that applies. * * @access protected * @var object */ protected $_category = null; /** * The list of other newfeed categories. * * @access protected * @var array */ protected $_categories = null; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'title', 'a.title', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'state', 'a.state', 'access', 'a.access', 'access_level', 'created', 'a.created', 'created_by', 'a.created_by', 'modified', 'a.modified', 'ordering', 'a.ordering', 'featured', 'a.featured', 'language', 'a.language', 'hits', 'a.hits', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'author', 'a.author', 'filter_tag' ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering The field to order on. * @param string $direction The direction to order on. * * @return void * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication('site'); $pk = $app->input->getInt('id'); $this->setState('category.id', $pk); // Load the parameters. Merge Global and Menu Item params into new object $params = $app->getParams(); $menuParams = new Registry; if ($menu = $app->getMenu()->getActive()) { $menuParams->loadString($menu->params); } $mergedParams = clone $menuParams; $mergedParams->merge($params); $this->setState('params', $mergedParams); $user = JFactory::getUser(); $asset = 'com_content'; if ($pk) { $asset .= '.category.' . $pk; } if ((!$user->authorise('core.edit.state', $asset)) && (!$user->authorise('core.edit', $asset))) { // Limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); } else { $this->setState('filter.published', array(0, 1, 2)); } // Process show_noauth parameter if (!$params->get('show_noauth')) { $this->setState('filter.access', true); } else { $this->setState('filter.access', false); } $itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int'); $value = $this->getUserStateFromRequest('com_content.category.filter.' . $itemid . '.tag', 'filter_tag', 0, 'int', false); $this->setState('filter.tag', $value); // Optional filter text $search = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter-search', 'filter-search', '', 'string'); $this->setState('list.filter', $search); // Filter.order $orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string'); if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'a.ordering'; } $this->setState('list.ordering', $orderCol); $listOrder = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $this->setState('list.start', $app->input->get('limitstart', 0, 'uint')); // Set limit for query. If list, use parameter. If blog, add blog parameters for limit. if (($app->input->get('layout') === 'blog') || $params->get('layout_type') === 'blog') { $limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links'); $this->setState('list.links', $params->get('num_links')); } else { $limit = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint'); } $this->setState('list.limit', $limit); // Set the depth of the category query based on parameter $showSubcategories = $params->get('show_subcategory_content', '0'); if ($showSubcategories) { $this->setState('filter.max_category_levels', $params->get('show_subcategory_content', '1')); $this->setState('filter.subcategories', true); } $this->setState('filter.language', JLanguageMultilang::isEnabled()); $this->setState('layout', $app->input->getString('layout')); // Set the featured articles state $this->setState('filter.featured', $params->get('show_featured')); } /** * Get the articles in the category * * @return mixed An array of articles or false if an error occurs. * * @since 1.5 */ public function getItems() { $limit = $this->getState('list.limit'); if ($this->_articles === null && $category = $this->getCategory()) { $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); $model->setState('params', JFactory::getApplication()->getParams()); $model->setState('filter.category_id', $category->id); $model->setState('filter.published', $this->getState('filter.published')); $model->setState('filter.access', $this->getState('filter.access')); $model->setState('filter.language', $this->getState('filter.language')); $model->setState('filter.featured', $this->getState('filter.featured')); $model->setState('list.ordering', $this->_buildContentOrderBy()); $model->setState('list.start', $this->getState('list.start')); $model->setState('list.limit', $limit); $model->setState('list.direction', $this->getState('list.direction')); $model->setState('list.filter', $this->getState('list.filter')); $model->setState('filter.tag', $this->getState('filter.tag')); // Filter.subcategories indicates whether to include articles from subcategories in the list or blog $model->setState('filter.subcategories', $this->getState('filter.subcategories')); $model->setState('filter.max_category_levels', $this->getState('filter.max_category_levels')); $model->setState('list.links', $this->getState('list.links')); if ($limit >= 0) { $this->_articles = $model->getItems(); if ($this->_articles === false) { $this->setError($model->getError()); } } else { $this->_articles = array(); } $this->_pagination = $model->getPagination(); } return $this->_articles; } /** * Build the orderby for the query * * @return string $orderby portion of query * * @since 1.5 */ protected function _buildContentOrderBy() { $app = JFactory::getApplication('site'); $db = $this->getDbo(); $params = $this->state->params; $itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int'); $orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string'); $orderDirn = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd'); $orderby = ' '; if (!in_array($orderCol, $this->filter_fields)) { $orderCol = null; } if (!in_array(strtoupper($orderDirn), array('ASC', 'DESC', ''))) { $orderDirn = 'ASC'; } if ($orderCol && $orderDirn) { $orderby .= $db->escape($orderCol) . ' ' . $db->escape($orderDirn) . ', '; } $articleOrderby = $params->get('orderby_sec', 'rdate'); $articleOrderDate = $params->get('order_date'); $categoryOrderby = $params->def('orderby_pri', ''); $secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', '; $primary = ContentHelperQuery::orderbyPrimary($categoryOrderby); $orderby .= $primary . ' ' . $secondary . ' a.created '; return $orderby; } /** * Method to get a JPagination object for the data set. * * @return JPagination A JPagination object for the data set. * * @since 3.0.1 */ public function getPagination() { if (empty($this->_pagination)) { return null; } return $this->_pagination; } /** * Method to get category data for the current category * * @return object * * @since 1.5 */ public function getCategory() { if (!is_object($this->_item)) { if (isset($this->state->params)) { $params = $this->state->params; $options = array(); $options['countItems'] = $params->get('show_cat_num_articles', 1) || !$params->get('show_empty_categories_cat', 0); $options['access'] = $params->get('check_access_rights', 1); } else { $options['countItems'] = 0; } $categories = JCategories::getInstance('Content', $options); $this->_item = $categories->get($this->getState('category.id', 'root')); // Compute selected asset permissions. if (is_object($this->_item)) { $user = JFactory::getUser(); $asset = 'com_content.category.' . $this->_item->id; // Check general create permission. if ($user->authorise('core.create', $asset)) { $this->_item->getParams()->set('access-create', true); } // TODO: Why aren't we lazy loading the children and siblings? $this->_children = $this->_item->getChildren(); $this->_parent = false; if ($this->_item->getParent()) { $this->_parent = $this->_item->getParent(); } $this->_rightsibling = $this->_item->getSibling(); $this->_leftsibling = $this->_item->getSibling(false); } else { $this->_children = false; $this->_parent = false; } } return $this->_item; } /** * Get the parent category. * * @return mixed An array of categories or false if an error occurs. * * @since 1.6 */ public function getParent() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_parent; } /** * Get the left sibling (adjacent) categories. * * @return mixed An array of categories or false if an error occurs. * * @since 1.6 */ public function &getLeftSibling() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_leftsibling; } /** * Get the right sibling (adjacent) categories. * * @return mixed An array of categories or false if an error occurs. * * @since 1.6 */ public function &getRightSibling() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_rightsibling; } /** * Get the child categories. * * @return mixed An array of categories or false if an error occurs. * * @since 1.6 */ public function &getChildren() { if (!is_object($this->_item)) { $this->getCategory(); } // Order subcategories if ($this->_children) { $params = $this->getState()->get('params'); $orderByPri = $params->get('orderby_pri'); if ($orderByPri === 'alpha' || $orderByPri === 'ralpha') { $this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($orderByPri === 'alpha') ? 1 : (-1)); } } return $this->_children; } /** * Increment the hit counter for the category. * * @param int $pk Optional primary key of the category to increment. * * @return boolean True if successful; false otherwise and internal error set. */ public function hit($pk = 0) { $input = JFactory::getApplication()->input; $hitcount = $input->getInt('hitcount', 1); if ($hitcount) { $pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id'); $table = JTable::getInstance('Category', 'JTable'); $table->hit($pk); } return true; } } PK iX!]���� � models/forms/filter_articles.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?> <form> <fields name="filter"> <field name="search" type="text" inputmode="search" label="COM_CONTENT_MODAL_FILTER_SEARCH_LABEL" description="COM_CONTENT_MODAL_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" /> <field name="published" type="status" label="COM_CONTENT_FILTER_PUBLISHED" description="COM_CONTENT_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_PUBLISHED</option> </field> <field name="category_id" type="category" label="JOPTION_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" multiple="true" class="multipleCategories" extension="com_content" onchange="this.form.submit();" published="0,1,2" /> <field name="access" type="accesslevel" label="JOPTION_FILTER_ACCESS" description="JOPTION_FILTER_ACCESS_DESC" multiple="true" class="multipleAccessLevels" onchange="this.form.submit();" /> <field name="author_id" type="author" label="COM_CONTENT_FILTER_AUTHOR" description="COM_CONTENT_FILTER_AUTHOR_DESC" multiple="true" class="multipleAuthors" onchange="this.form.submit();" > <option value="0">JNONE</option> </field> <field name="level" type="integer" label="JOPTION_FILTER_LEVEL" description="JOPTION_FILTER_LEVEL_DESC" first="1" last="10" step="1" languages="*" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_MAX_LEVELS</option> </field> <field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_LANGUAGE</option> <option value="*">JALL</option> </field> <field name="tag" type="tag" label="JOPTION_FILTER_TAG" description="JOPTION_FILTER_TAG_DESC" multiple="true" class="multipleTags" mode="nested" onchange="this.form.submit();" /> </fields> <fields name="list"> <field name="fullordering" type="list" label="COM_CONTENT_LIST_FULL_ORDERING" description="COM_CONTENT_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option> <option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option> <option value="a.state ASC">JSTATUS_ASC</option> <option value="a.state DESC">JSTATUS_DESC</option> <option value="a.title ASC">JGLOBAL_TITLE_ASC</option> <option value="a.title DESC">JGLOBAL_TITLE_DESC</option> <option value="category_title ASC">JCATEGORY_ASC</option> <option value="category_title DESC">JCATEGORY_DESC</option> <option value="association ASC" requires="associations">JASSOCIATIONS_ASC</option> <option value="association DESC" requires="associations">JASSOCIATIONS_DESC</option> <option value="a.access ASC">JGRID_HEADING_ACCESS_ASC</option> <option value="a.access DESC">JGRID_HEADING_ACCESS_DESC</option> <option value="a.created_by ASC">JAUTHOR_ASC</option> <option value="a.created_by DESC">JAUTHOR_DESC</option> <option value="language ASC">JGRID_HEADING_LANGUAGE_ASC</option> <option value="language DESC">JGRID_HEADING_LANGUAGE_DESC</option> <option value="a.created ASC">JDATE_ASC</option> <option value="a.created DESC">JDATE_DESC</option> <option value="a.id ASC">JGRID_HEADING_ID_ASC</option> <option value="a.id DESC">JGRID_HEADING_ID_DESC</option> <option value="a.featured ASC">JFEATURED_ASC</option> <option value="a.featured DESC">JFEATURED_DESC</option> <option value="a.hits ASC">JGLOBAL_HITS_ASC</option> <option value="a.hits DESC">JGLOBAL_HITS_DESC</option> </field> <field name="limit" type="limitbox" label="COM_CONTENT_LIST_LIMIT" description="COM_CONTENT_LIST_LIMIT_DESC" class="inputbox input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> PK iX!]���"