Skip to content

Commit

Permalink
Fixed issue #9
Browse files Browse the repository at this point in the history
  • Loading branch information
fevangelou committed Mar 14, 2018
1 parent 52c9837 commit 3d064c0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This is a backend extension so a public demo or showcase is currently not availa
This is a JCE extension and the only basic requirements to use it are:

- JCE v2.6.x
- K2 v2.7.x or newer
- K2 v2.8.x
- Joomla v3.x

Support for Joomla 1.5 & 2.5 is no longer available.
Expand Down
14 changes: 7 additions & 7 deletions plugins/jce/links-k2/k2links/k2.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,18 @@ public static function _getK2Items($category_id = 0)
// K2 2.x
if (defined('K2_JVERSION')) {
$db = JFactory::getDBO();
$user = JFactory::getUser();

$query = 'SELECT id, title, alias, CONCAT(' . $db->quoteName('introtext') . ',' . $db->quoteName('fulltext') . ') AS content FROM #__k2_items WHERE published = 1';
$query = '
SELECT id, title, alias, catid, CONCAT(' . $db->quoteName('introtext') . ',' . $db->quoteName('fulltext') . ') AS content FROM #__k2_items WHERE published = 1';

$user = JFactory::getUser();
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$query .= ' AND `access` IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
} else {
$query .= "\nAND `access` <=" . (int) $user->get('aid');
}

$query .= ' AND catid = ' . $db->Quote($category_id) . ' ORDER BY ordering ASC';
$query .= ' AND catid = ' . $db->Quote($category_id) . ' ORDER BY id DESC';

$db->setQuery($query);
$rows = $db->loadObjectList();
Expand All @@ -132,10 +133,11 @@ public static function _getK2Items($category_id = 0)
public function getLinks($args)
{
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();

$advlink = WFEditorPlugin::getInstance();
if (defined('K2_JVERSION')) {
require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'route.php';
require_once JPATH_SITE.'/components/com_k2/helpers/route.php';
}

$items = array();
Expand All @@ -159,11 +161,9 @@ public function getLinks($args)
$items[] = array('id' => $category->href, 'name' => $category->name, 'class' => 'folder content');
}
foreach ($itemlist as $item) {
$item->href = K2HelperRoute::getItemRoute($item->id . ':' . $item->alias, $item->catid);
$item->href = K2HelperRoute::getItemRoute($item->id.':'.urlencode($item->alias), $item->catid);
$items[] = array('id' => $item->href, 'name' => $item->title, 'class' => 'file');

$anchors = self::getAnchors($item->content);

foreach ($anchors as $anchor) {
$items[] = array(
'id' => $item->href . '#' . $anchor,
Expand Down
12 changes: 6 additions & 6 deletions plugins/jce/links-k2/k2links/tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ public static function _getK2Items($tag = '')
$db = JFactory::getDBO();
$user = JFactory::getUser();
$query = "SELECT `i`.`id`, `i`.`title`, `i`.`alias`, `i`.`catid`, `c`.`alias` AS categoryAlias
FROM `#__k2_tags_xref` as `x`
INNER JOIN `#__k2_items` as `i` ON(`i`.`id` = `x`.`itemID`)
INNER JOIN `#__k2_tags` as `t` ON (`t`.`id` = `x`.`tagID`)
INNER JOIN `#__k2_categories` as `c` ON(`i`.`catid` = `c`.`id`)
WHERE `t`.`name` = ".$db->quote($tag);
FROM `#__k2_tags_xref` as `x`
INNER JOIN `#__k2_items` as `i` ON(`i`.`id` = `x`.`itemID`)
INNER JOIN `#__k2_tags` as `t` ON (`t`.`id` = `x`.`tagID`)
INNER JOIN `#__k2_categories` as `c` ON(`i`.`catid` = `c`.`id`)
WHERE `t`.`name` = ".$db->quote($tag);
$query .= ' AND `i`.`published` = 1 AND `c`.`published` = 1 ';
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$query .= ' AND `i`.`access` IN ('.implode(',', $user->getAuthorisedViewLevels()).')';
Expand Down Expand Up @@ -122,7 +122,7 @@ public function getLinks($args)
$advlink = WFEditorPlugin::getInstance();

if (defined('K2_JVERSION')) {
require_once(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
require_once JPATH_SITE.'/components/com_k2/helpers/route.php';
}
$items = array();
$view = isset($args->view) ? $args->view : '';
Expand Down
4 changes: 2 additions & 2 deletions plugins/jce/links-k2/k2links/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ public function getLinks($args)
$advlink = WFEditorPlugin::getInstance();

if (defined('K2_JVERSION')) {
require_once(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php');
require_once(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
require_once JPATH_SITE.'/components/com_k2/helpers/utilities.php';
require_once JPATH_SITE.'/components/com_k2/helpers/route.php';
}

$items = array();
Expand Down

0 comments on commit 3d064c0

Please sign in to comment.