Skip to content

Commit

Permalink
Revert #19683
Browse files Browse the repository at this point in the history
  • Loading branch information
Septdir committed Apr 24, 2018
1 parent 0d9b502 commit 4e3ae20
Showing 1 changed file with 21 additions and 39 deletions.
60 changes: 21 additions & 39 deletions components/com_content/helpers/association.php
Expand Up @@ -20,14 +20,6 @@
*/
abstract class ContentHelperAssociation extends CategoryHelperAssociation
{
/**
* Cached array of the content item id.
*
* @var array
* @since __DEPLOY_VERSION__
*/
protected static $filters = array();

/**
* Method to get the associations for a given item
*
Expand All @@ -50,45 +42,35 @@ public static function getAssociations($id = 0, $view = null)
{
if ($id)
{
if (!isset(static::$filters[$id]))
{
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $id);
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $id);

$return = array();
$return = array();

foreach ($associations as $tag => $item)
foreach ($associations as $tag => $item)
{
if ($item->language != JFactory::getLanguage()->getTag())
{
if ($item->language != JFactory::getLanguage()->getTag())
{
$arrId = explode(':', $item->id);
$assocId = $arrId[0];

$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->qn('state'))
->from($db->qn('#__content'))
->where($db->qn('id') . ' = ' . (int) $assocId)
->where($db->qn('access') . ' IN (' . $groups . ')');
$db->setQuery($query);

$result = (int) $db->loadResult();

if ($result > 0)
{
$return[$tag] = ContentHelperRoute::getArticleRoute($item->id, (int) $item->catid, $item->language);
}
}
$arrId = explode(':', $item->id);
$assocId = $arrId[0];

static::$filters[$id] = $return;
}
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->qn('state'))
->from($db->qn('#__content'))
->where($db->qn('id') . ' = ' . (int) ($assocId))
->where('access IN (' . $groups . ')');
$db->setQuery($query);

if (count($associations) === 0)
{
static::$filters[$id] = array();
$result = (int) $db->loadResult();

if ($result > 0)
{
$return[$tag] = ContentHelperRoute::getArticleRoute($item->id, (int) $item->catid, $item->language);
}
}
}

return static::$filters[$id];
return $return;
}
}

Expand Down

0 comments on commit 4e3ae20

Please sign in to comment.