Skip to content

Commit

Permalink
Remove query
Browse files Browse the repository at this point in the history
  • Loading branch information
Septdir committed Apr 24, 2018
1 parent 0ead6d3 commit 88f8e6a
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions components/com_content/helpers/association.php
Expand Up @@ -37,8 +37,6 @@ public static function getAssociations($id = 0, $view = null, $layout = null)
$view = $view === null ? $jinput->get('view') : $view;
$layout = $layout === null ? $jinput->get('layout', '', 'string') : $layout;
$id = empty($id) ? $jinput->getInt('id') : $id;
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());

if ($view === 'article')
{
Expand All @@ -55,20 +53,7 @@ public static function getAssociations($id = 0, $view = null, $layout = null)
$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('access IN (' . $groups . ')');
$db->setQuery($query);

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

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

Expand Down

0 comments on commit 88f8e6a

Please sign in to comment.