0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: content.php.tar
home/academiac/www/administrator/components/com_content/content.php 0000644 00000001224 15137206773 0021761 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Access check. if (!JFactory::getUser()->authorise('core.manage', 'com_content')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } // Register helper class JLoader::register('ContentHelper', dirname(__FILE__) . '/helpers/content.php'); $controller = JControllerLegacy::getInstance('Content'); $controller->execute(JRequest::getCmd('task')); $controller->redirect(); home/academiac/www/components/com_content/content.php 0000644 00000001002 15137253335 0017067 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_content * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Include dependancies require_once JPATH_COMPONENT.'/helpers/route.php'; require_once JPATH_COMPONENT.'/helpers/query.php'; $controller = JControllerLegacy::getInstance('Content'); $controller->execute(JRequest::getCmd('task')); $controller->redirect(); home/academiac/www/libraries/joomla/html/html/content.php 0000644 00000002263 15137257532 0017554 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage HTML * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * Utility class to fire onContentPrepare for non-article based content. * * @package Joomla.Platform * @subpackage HTML * @since 11.1 */ abstract class JHtmlContent { /** * Fire onContentPrepare for content that isn't part of an article. * * @param string $text The content to be transformed. * @param array $params The content params. * @param string $context The context of the content to be transformed. * * @return string The content after transformation. * * @since 11.1 */ public static function prepare($text, $params = null, $context = 'text') { if ($params === null) { $params = new JObject; } $article = new stdClass; $article->text = $text; JPluginHelper::importPlugin('content'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onContentPrepare', array($context, &$article, &$params, 0)); return $article->text; } } home/academiac/www/plugins/finder/content/content.php 0000644 00000025453 15137265275 0017022 0 ustar 00 <?php /** * @package Joomla.Plugin * @subpackage Finder.Content * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_BASE') or die; jimport('joomla.application.component.helper'); // Load the base adapter. require_once JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php'; /** * Finder adapter for com_content. * * @package Joomla.Plugin * @subpackage Finder.Content * @since 2.5 */ class plgFinderContent extends FinderIndexerAdapter { /** * The plugin identifier. * * @var string * @since 2.5 */ protected $context = 'Content'; /** * The extension name. * * @var string * @since 2.5 */ protected $extension = 'com_content'; /** * The sublayout to use when rendering the results. * * @var string * @since 2.5 */ protected $layout = 'article'; /** * The type of content that the adapter indexes. * * @var string * @since 2.5 */ protected $type_title = 'Article'; /** * The table name. * * @var string * @since 2.5 */ protected $table = '#__content'; /** * Constructor * * @param object &$subject The object to observe * @param array $config An array that holds the plugin configuration * * @since 2.5 */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); } /** * Method to update the item link information when the item category is * changed. This is fired when the item category is published or unpublished * from the list view. * * @param string $extension The extension whose category has been updated. * @param array $pks A list of primary key ids of the content that has changed state. * @param integer $value The value of the state that the content has been changed to. * * @return void * * @since 2.5 */ public function onFinderCategoryChangeState($extension, $pks, $value) { // Make sure we're handling com_content categories if ($extension == 'com_content') { $this->categoryStateChange($pks, $value); } } /** * Method to remove the link information for items that have been deleted. * * @param string $context The context of the action being performed. * @param JTable $table A JTable object containing the record to be deleted * * @return boolean True on success. * * @since 2.5 * @throws Exception on database error. */ public function onFinderAfterDelete($context, $table) { if ($context == 'com_content.article') { $id = $table->id; } elseif ($context == 'com_finder.index') { $id = $table->link_id; } else { return true; } // Remove the items. return $this->remove($id); } /** * Method to determine if the access level of an item changed. * * @param string $context The context of the content passed to the plugin. * @param JTable $row A JTable object * @param boolean $isNew If the content has just been created * * @return boolean True on success. * * @since 2.5 * @throws Exception on database error. */ public function onFinderAfterSave($context, $row, $isNew) { // We only want to handle articles here if ($context == 'com_content.article' || $context == 'com_content.form') { // Check if the access levels are different if (!$isNew && $this->old_access != $row->access) { // Process the change. $this->itemAccessChange($row); } // Reindex the item $this->reindex($row->id); } // Check for access changes in the category if ($context == 'com_categories.category') { // Check if the access levels are different if (!$isNew && $this->old_cataccess != $row->access) { $this->categoryAccessChange($row); } } return true; } /** * Method to reindex the link information for an item that has been saved. * This event is fired before the data is actually saved so we are going * to queue the item to be indexed later. * * @param string $context The context of the content passed to the plugin. * @param JTable $row A JTable object * @param boolean $isNew If the content is just about to be created * * @return boolean True on success. * * @since 2.5 * @throws Exception on database error. */ public function onFinderBeforeSave($context, $row, $isNew) { // We only want to handle articles here if ($context == 'com_content.article' || $context == 'com_content.form') { // Query the database for the old access level if the item isn't new if (!$isNew) { $this->checkItemAccess($row); } } // Check for access levels from the category if ($context == 'com_categories.category') { // Query the database for the old access level if the item isn't new if (!$isNew) { $this->checkCategoryAccess($row); } } return true; } /** * Method to update the link information for items that have been changed * from outside the edit screen. This is fired when the item is published, * unpublished, archived, or unarchived from the list view. * * @param string $context The context for the content passed to the plugin. * @param array $pks A list of primary key ids of the content that has changed state. * @param integer $value The value of the state that the content has been changed to. * * @return void * * @since 2.5 */ public function onFinderChangeState($context, $pks, $value) { // We only want to handle articles here if ($context == 'com_content.article' || $context == 'com_content.form') { $this->itemStateChange($pks, $value); } // Handle when the plugin is disabled if ($context == 'com_plugins.plugin' && $value === 0) { $this->pluginDisable($pks); } } /** * Method to index an item. The item must be a FinderIndexerResult object. * * @param FinderIndexerResult $item The item to index as an FinderIndexerResult object. * @param string $format The item format * * @return void * * @since 2.5 * @throws Exception on database error. */ protected function index(FinderIndexerResult $item, $format = 'html') { // Check if the extension is enabled if (JComponentHelper::isEnabled($this->extension) == false) { return; } // Initialize the item parameters. $registry = new JRegistry; $registry->loadString($item->params); $item->params = JComponentHelper::getParams('com_content', true); $item->params->merge($registry); $registry = new JRegistry; $registry->loadString($item->metadata); $item->metadata = $registry; // Trigger the onContentPrepare event. $item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params); $item->body = FinderIndexerHelper::prepareContent($item->body, $item->params); // Build the necessary route and path information. $item->url = $this->getURL($item->id, $this->extension, $this->layout); $item->route = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->language); $item->path = FinderIndexerHelper::getContentPath($item->route); // Get the menu title if it exists. $title = $this->getItemMenuTitle($item->url); // Adjust the title if necessary. if (!empty($title) && $this->params->get('use_menu_title', true)) { $item->title = $title; } // Add the meta-author. $item->metaauthor = $item->metadata->get('author'); // Add the meta-data processing instructions. $item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey'); $item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc'); $item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor'); $item->addInstruction(FinderIndexer::META_CONTEXT, 'author'); $item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias'); // Translate the state. Articles should only be published if the category is published. $item->state = $this->translateState($item->state, $item->cat_state); // Add the type taxonomy data. $item->addTaxonomy('Type', 'Article'); // Add the author taxonomy data. if (!empty($item->author) || !empty($item->created_by_alias)) { $item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author); } // Add the category taxonomy data. $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access); // Add the language taxonomy data. $item->addTaxonomy('Language', $item->language); // Get content extras. FinderIndexerHelper::getContentExtras($item); // Index the item. FinderIndexer::index($item); } /** * Method to setup the indexer to be run. * * @return boolean True on success. * * @since 2.5 */ protected function setup() { // Load dependent classes. include_once JPATH_SITE . '/components/com_content/helpers/route.php'; return true; } /** * Method to get the SQL query used to retrieve the list of content items. * * @param mixed $sql A JDatabaseQuery object or null. * * @return JDatabaseQuery A database object. * * @since 2.5 */ protected function getListQuery($sql = null) { $db = JFactory::getDbo(); // Check if we can use the supplied SQL query. $sql = $sql instanceof JDatabaseQuery ? $sql : $db->getQuery(true); $sql->select('a.id, a.title, a.alias, a.introtext AS summary, a.fulltext AS body'); $sql->select('a.state, a.catid, a.created AS start_date, a.created_by'); $sql->select('a.created_by_alias, a.modified, a.modified_by, a.attribs AS params'); $sql->select('a.metakey, a.metadesc, a.metadata, a.language, a.access, a.version, a.ordering'); $sql->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date'); $sql->select('c.title AS category, c.published AS cat_state, c.access AS cat_access'); // Handle the alias CASE WHEN portion of the query $case_when_item_alias = ' CASE WHEN '; $case_when_item_alias .= $sql->charLength('a.alias'); $case_when_item_alias .= ' THEN '; $a_id = $sql->castAsChar('a.id'); $case_when_item_alias .= $sql->concatenate(array($a_id, 'a.alias'), ':'); $case_when_item_alias .= ' ELSE '; $case_when_item_alias .= $a_id.' END as slug'; $sql->select($case_when_item_alias); $case_when_category_alias = ' CASE WHEN '; $case_when_category_alias .= $sql->charLength('c.alias'); $case_when_category_alias .= ' THEN '; $c_id = $sql->castAsChar('c.id'); $case_when_category_alias .= $sql->concatenate(array($c_id, 'c.alias'), ':'); $case_when_category_alias .= ' ELSE '; $case_when_category_alias .= $c_id.' END as catslug'; $sql->select($case_when_category_alias); $sql->select('u.name AS author'); $sql->from('#__content AS a'); $sql->join('LEFT', '#__categories AS c ON c.id = a.catid'); $sql->join('LEFT', '#__users AS u ON u.id = a.created_by'); return $sql; } } home/academiac/www/libraries/joomla/database/table/content.php 0000644 00000023706 15137275323 0020502 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage Database * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; jimport('joomla.database.tableasset'); jimport('joomla.database.table'); /** * Content table * * @package Joomla.Platform * @subpackage Table * @since 11.1 */ class JTableContent extends JTable { /** * Constructor * * @param JDatabase &$db A database connector object * * @since 11.1 */ public function __construct(&$db) { parent::__construct('#__content', 'id', $db); } /** * Method to compute the default name of the asset. * The default name is in the form table_name.id * where id is the value of the primary key of the table. * * @return string * * @since 11.1 */ protected function _getAssetName() { $k = $this->_tbl_key; return 'com_content.article.' . (int) $this->$k; } /** * Method to return the title to use for the asset table. * * @return string * * @since 11.1 */ protected function _getAssetTitle() { return $this->title; } /** * Method to get the parent asset id for the record * * @param JTable $table A JTable object (optional) for the asset parent * @param integer $id The id (optional) of the content. * * @return integer * * @since 11.1 */ protected function _getAssetParentId($table = null, $id = null) { // Initialise variables. $assetId = null; // This is a article under a category. if ($this->catid) { // Build the query to get the asset id for the parent category. $query = $this->_db->getQuery(true); $query->select($this->_db->quoteName('asset_id')); $query->from($this->_db->quoteName('#__categories')); $query->where($this->_db->quoteName('id') . ' = ' . (int) $this->catid); // Get the asset id from the database. $this->_db->setQuery($query); if ($result = $this->_db->loadResult()) { $assetId = (int) $result; } } // Return the asset id. if ($assetId) { return $assetId; } else { return parent::_getAssetParentId($table, $id); } } /** * Overloaded bind function * * @param array $array Named array * @param mixed $ignore An optional array or space separated list of properties * to ignore while binding. * * @return mixed Null if operation was satisfactory, otherwise returns an error string * * @see JTable::bind * @since 11.1 */ public function bind($array, $ignore = '') { // Search for the {readmore} tag and split the text up accordingly. if (isset($array['articletext'])) { $pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i'; $tagPos = preg_match($pattern, $array['articletext']); if ($tagPos == 0) { $this->introtext = $array['articletext']; $this->fulltext = ''; } else { list ($this->introtext, $this->fulltext) = preg_split($pattern, $array['articletext'], 2); } } if (isset($array['attribs']) && is_array($array['attribs'])) { $registry = new JRegistry; $registry->loadArray($array['attribs']); $array['attribs'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { $rules = new JAccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); } /** * Overloaded check function * * @return boolean True on success, false on failure * * @see JTable::check * @since 11.1 */ public function check() { if (trim($this->title) == '') { $this->setError(JText::_('COM_CONTENT_WARNING_PROVIDE_VALID_NAME')); return false; } if (trim($this->alias) == '') { $this->alias = $this->title; } $this->alias = JApplication::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); } if (trim(str_replace(' ', '', $this->fulltext)) == '') { $this->fulltext = ''; } if (trim($this->introtext) == '' && trim($this->fulltext) == '') { $this->setError(JText::_('JGLOBAL_ARTICLE_MUST_HAVE_TEXT')); return false; } // Check the publish down date is not earlier than publish up. if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) { $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); return false; } // Clean up keywords -- eliminate extra spaces between phrases // and cr (\r) and lf (\n) characters from string if (!empty($this->metakey)) { // Only process if not empty $bad_characters = array("\n", "\r", "\"", "<", ">"); // array of characters to remove $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); // remove bad characters $keys = explode(',', $after_clean); // create array using commas as delimiter $clean_keys = array(); foreach ($keys as $key) { if (trim($key)) { // Ignore blank keywords $clean_keys[] = trim($key); } } $this->metakey = implode(", ", $clean_keys); // put array back together delimited by ", " } return true; } /** * Overrides JTable::store to set modified data and user id. * * @param boolean $updateNulls True to update fields even if they are null. * * @return boolean True on success. * * @since 11.1 */ public function store($updateNulls = false) { $date = JFactory::getDate(); $user = JFactory::getUser(); if ($this->id) { // Existing item $this->modified = $date->toSql(); $this->modified_by = $user->get('id'); } else { // New article. An article created and created_by field can be set by the user, // so we don't touch either of these if they are set. if (!intval($this->created)) { $this->created = $date->toSql(); } if (empty($this->created_by)) { $this->created_by = $user->get('id'); } } // Verify that the alias is unique $table = JTable::getInstance('Content', 'JTable'); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { $this->setError(JText::_('JLIB_DATABASE_ERROR_ARTICLE_UNIQUE_ALIAS')); return false; } return parent::store($updateNulls); } /** * Method to set the publishing state for a row or list of rows in the database * table. The method respects checked out rows by other users and will attempt * to checkin rows that it can after adjustments are made. * * @param mixed $pks An optional array of primary key values to update. If not set the instance property value is used. * @param integer $state The publishing state. eg. [0 = unpublished, 1 = published] * @param integer $userId The user id of the user performing the operation. * * @return boolean True on success. * * @since 11.1 */ public function publish($pks = null, $state = 1, $userId = 0) { // Initialise variables. $k = $this->_tbl_key; // Sanitize input. JArrayHelper::toInteger($pks); $userId = (int) $userId; $state = (int) $state; // If there are no primary keys set check to see if the instance key is set. if (empty($pks)) { if ($this->$k) { $pks = array($this->$k); } // Nothing to set publishing state on, return false. else { $this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); return false; } } // Build the WHERE clause for the primary keys. $where = $k . '=' . implode(' OR ' . $k . '=', $pks); // Determine if there is checkin support for the table. if (!property_exists($this, 'checked_out') || !property_exists($this, 'checked_out_time')) { $checkin = ''; } else { $checkin = ' AND (checked_out = 0 OR checked_out = ' . (int) $userId . ')'; } // Get the JDatabaseQuery object $query = $this->_db->getQuery(true); // Update the publishing state for rows with the given primary keys. $query->update($this->_db->quoteName($this->_tbl)); $query->set($this->_db->quoteName('state') . ' = ' . (int) $state); $query->where('(' . $where . ')' . $checkin); $this->_db->setQuery($query); $this->_db->execute(); // Check for a database error. if ($this->_db->getErrorNum()) { $this->setError($this->_db->getErrorMsg()); return false; } // If checkin is supported and all rows were adjusted, check them in. if ($checkin && (count($pks) == $this->_db->getAffectedRows())) { // Checkin the rows. foreach ($pks as $pk) { $this->checkin($pk); } } // If the JTable instance value is in the list of primary keys that were set, set the instance. if (in_array($this->$k, $pks)) { $this->state = $state; } $this->setError(''); return true; } /** * Converts record to XML * * @param boolean $mapKeysToText Map foreign keys to text values * * @return string Record in XML format * * @since 11.1 * @deprecated 12.1 * @codeCoverageIgnore */ public function toXML($mapKeysToText = false) { // Deprecation warning. JLog::add('JTableContent::toXML() is deprecated.', JLog::WARNING, 'deprecated'); if ($mapKeysToText) { // Get the JDatabaseQuery object $query = $this->_db->getQuery(true); $query->select($this->_db->quoteName('name')); $query->from($this->_db->quoteName('#__categories')); $query->where($this->_db->quoteName('id') . ' = ' . (int) $this->catid); $this->_db->setQuery($query); $this->catid = $this->_db->loadResult(); $query->clear(); $query->select($this->_db->quoteName('name')); $query->from($this->_db->quoteName('#__users')); $query->where($this->_db->quoteName('id') . ' = ' . (int) $this->created_by); $this->_db->setQuery($query); $this->created_by = $this->_db->loadResult(); } return parent::toXML($mapKeysToText); } } home/academiac/www/plugins/search/content/content.php 0000644 00000020256 15137347072 0017010 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // no direct access defined('_JEXEC') or die; require_once JPATH_SITE.'/components/com_content/router.php'; /** * Content Search plugin * * @package Joomla.Plugin * @subpackage Search.content * @since 1.6 */ class plgSearchContent extends JPlugin { /** * @return array An array of search areas */ function onContentSearchAreas() { static $areas = array( 'content' => 'JGLOBAL_ARTICLES' ); return $areas; } /** * Content Search method * The sql must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav * @param string Target search string * @param string mathcing option, exact|any|all * @param string ordering option, newest|oldest|popular|alpha|category * @param mixed An array if the search it to be restricted to areas, null if search all */ function onContentSearch($text, $phrase='', $ordering='', $areas=null) { $db = JFactory::getDbo(); $app = JFactory::getApplication(); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $tag = JFactory::getLanguage()->getTag(); require_once JPATH_SITE . '/components/com_content/helpers/route.php'; require_once JPATH_ADMINISTRATOR . '/components/com_search/helpers/search.php'; $searchText = $text; if (is_array($areas)) { if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) { return array(); } } $sContent = $this->params->get('search_content', 1); $sArchived = $this->params->get('search_archived', 1); $limit = $this->params->def('search_limit', 50); $nullDate = $db->getNullDate(); $date = JFactory::getDate(); $now = $date->toSql(); $text = trim($text); if ($text == '') { return array(); } $wheres = array(); switch ($phrase) { case 'exact': $text = $db->Quote('%'.$db->escape($text, true).'%', false); $wheres2 = array(); $wheres2[] = 'a.title LIKE '.$text; $wheres2[] = 'a.introtext LIKE '.$text; $wheres2[] = 'a.fulltext LIKE '.$text; $wheres2[] = 'a.metakey LIKE '.$text; $wheres2[] = 'a.metadesc LIKE '.$text; $where = '(' . implode(') OR (', $wheres2) . ')'; break; case 'all': case 'any': default: $words = explode(' ', $text); $wheres = array(); foreach ($words as $word) { $word = $db->Quote('%'.$db->escape($word, true).'%', false); $wheres2 = array(); $wheres2[] = 'a.title LIKE '.$word; $wheres2[] = 'a.introtext LIKE '.$word; $wheres2[] = 'a.fulltext LIKE '.$word; $wheres2[] = 'a.metakey LIKE '.$word; $wheres2[] = 'a.metadesc LIKE '.$word; $wheres[] = implode(' OR ', $wheres2); } $where = '(' . implode(($phrase == 'all' ? ') AND (' : ') OR ('), $wheres) . ')'; break; } $morder = ''; switch ($ordering) { case 'oldest': $order = 'a.created ASC'; break; case 'popular': $order = 'a.hits DESC'; break; case 'alpha': $order = 'a.title ASC'; break; case 'category': $order = 'c.title ASC, a.title ASC'; $morder = 'a.title ASC'; break; case 'newest': default: $order = 'a.created DESC'; break; } $rows = array(); $query = $db->getQuery(true); // search articles if ($sContent && $limit > 0) { $query->clear(); //sqlsrv changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias'); $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'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id.' END as catslug'; $query->select('a.title AS title, a.metadesc, a.metakey, a.created AS created, a.language'); $query->select($query->concatenate(array('a.introtext', 'a.fulltext')).' AS text'); $query->select('c.title AS section, '.$case_when.','.$case_when1.', '.'\'2\' AS browsernav'); $query->from('#__content AS a'); $query->innerJoin('#__categories AS c ON c.id=a.catid'); $query->where('('. $where .')' . 'AND a.state=1 AND c.published = 1 AND a.access IN ('.$groups.') ' .'AND c.access IN ('.$groups.') ' .'AND (a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).') ' .'AND (a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).')' ); $query->group('a.id, a.title, a.metadesc, a.metakey, a.created, a.introtext, a.fulltext, c.title, a.alias, c.alias, c.id'); $query->order($order); // Filter by language if ($app->isSite() && $app->getLanguageFilter()) { $query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')'); $query->where('c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')'); } $db->setQuery($query, 0, $limit); $list = $db->loadObjectList(); $limit -= count($list); if (isset($list)) { foreach($list as $key => $item) { $list[$key]->href = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->language); } } $rows[] = $list; } // search archived content if ($sArchived && $limit > 0) { $searchArchived = JText::_('JARCHIVED'); $query->clear(); //sqlsrv changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias'); $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'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id.' END as catslug'; $query->select('a.title AS title, a.metadesc, a.metakey, a.created AS created, ' .$query->concatenate(array("a.introtext", "a.fulltext")).' AS text,' .$case_when.','.$case_when1.', ' .'c.title AS section, \'2\' AS browsernav'); //.'CONCAT_WS("/", c.title) AS section, \'2\' AS browsernav' ); $query->from('#__content AS a'); $query->innerJoin('#__categories AS c ON c.id=a.catid AND c.access IN ('. $groups .')'); $query->where('('. $where .') AND a.state = 2 AND c.published = 1 AND a.access IN ('. $groups .') AND c.access IN ('. $groups .') ' .'AND (a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).') ' .'AND (a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).')' ); $query->order($order); // Filter by language if ($app->isSite() && $app->getLanguageFilter()) { $query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')'); $query->where('c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')'); } $db->setQuery($query, 0, $limit); $list3 = $db->loadObjectList(); // find an itemid for archived to use if there isn't another one $item = $app->getMenu()->getItems('link', 'index.php?option=com_content&view=archive', true); $itemid = isset($item->id) ? '&Itemid='.$item->id : ''; if (isset($list3)) { foreach($list3 as $key => $item) { $date = JFactory::getDate($item->created); $created_month = $date->format("n"); $created_year = $date->format("Y"); $list3[$key]->href = JRoute::_('index.php?option=com_content&view=archive&year='.$created_year.'&month='.$created_month.$itemid); } } $rows[] = $list3; } $results = array(); if (count($rows)) { foreach($rows as $row) { $new_row = array(); foreach($row as $key => $article) { if (searchHelper::checkNoHTML($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) { $new_row[] = $article; } } $results = array_merge($results, (array) $new_row); } } return $results; } }
©
2018.