diff --git a/src/com_weblinks/admin/language/en-GB/en-GB.com_weblinks.ini b/src/com_weblinks/admin/language/en-GB/en-GB.com_weblinks.ini
index cd9e177..ff09b36 100644
--- a/src/com_weblinks/admin/language/en-GB/en-GB.com_weblinks.ini
+++ b/src/com_weblinks/admin/language/en-GB/en-GB.com_weblinks.ini
@@ -1,12 +1,12 @@
; Joomla! Project
-; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
+; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
COM_WEBLINKS="Weblinks"
COM_WEBLINKS_ACCESS_HEADING="Access"
COM_WEBLINKS_BATCH_OPTIONS="Batch process the selected links"
-COM_WEBLINKS_BATCH_TIP="If choosing to copy a link, any other actions selected will be applied to the copied link. Otherwise, all actions are applied to the selected link."
+COM_WEBLINKS_BATCH_TIP="If a category is selected for move/copy, any actions selected will be applied to the copied or moved links. Otherwise, all actions are applied to the selected links."
COM_WEBLINKS_CATEGORIES_DESC="These settings apply for Web Links Categories Options unless they are changed for a specific menu item."
COM_WEBLINKS_CATEGORY_DESC="These settings apply for Web Links Category Options unless they are changed for a specific menu item."
COM_WEBLINKS_COMPONENT_DESC="These settings apply for Web Links unless they are changed for a specific menu item or web link."
diff --git a/src/com_weblinks/admin/language/en-GB/en-GB.com_weblinks.sys.ini b/src/com_weblinks/admin/language/en-GB/en-GB.com_weblinks.sys.ini
index f092a6b..915e886 100644
--- a/src/com_weblinks/admin/language/en-GB/en-GB.com_weblinks.sys.ini
+++ b/src/com_weblinks/admin/language/en-GB/en-GB.com_weblinks.sys.ini
@@ -1,5 +1,5 @@
; Joomla! Project
-; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
+; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
diff --git a/src/com_weblinks/admin/models/forms/weblink.xml b/src/com_weblinks/admin/models/forms/weblink.xml
index 4940bce..f3b6cda 100644
--- a/src/com_weblinks/admin/models/forms/weblink.xml
+++ b/src/com_weblinks/admin/models/forms/weblink.xml
@@ -8,30 +8,28 @@
description="JGLOBAL_FIELD_ID_DESC"/>
-
@@ -64,21 +62,21 @@
value="-2">JTRASHED
-
+ description="JFIELD_ACCESS_DESC" size="1" />
+ >
@@ -86,7 +84,6 @@
type="tag"
label="JTAG"
description="JTAG_DESC"
- class="inputbox"
multiple="true"
>
@@ -95,13 +92,13 @@
type="text"
label="JGLOBAL_FIELD_VERSION_NOTE_LABEL"
description="JGLOBAL_FIELD_VERSION_NOTE_DESC"
- class="inputbox" size="45"
+ size="45"
labelclass="control-label"
/>
+ size="20" />
+ rows="3" cols="30" />
+ rows="3" cols="30" />
+ size="20" />
@@ -167,11 +164,11 @@
diff --git a/src/com_weblinks/admin/models/weblinks.php b/src/com_weblinks/admin/models/weblinks.php
index 407caef..580a360 100644
--- a/src/com_weblinks/admin/models/weblinks.php
+++ b/src/com_weblinks/admin/models/weblinks.php
@@ -194,7 +194,7 @@ class WeblinksModelWeblinks extends JModelList
}
else
{
- $search = $db->quote('%' . $db->escape($search, true) . '%');
+ $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
$query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ')');
}
}
diff --git a/src/com_weblinks/admin/sql/install.mysql.utf8.sql b/src/com_weblinks/admin/sql/install.mysql.utf8.sql
index 4723ee0..fb2eeb5 100644
--- a/src/com_weblinks/admin/sql/install.mysql.utf8.sql
+++ b/src/com_weblinks/admin/sql/install.mysql.utf8.sql
@@ -1,42 +1,42 @@
-CREATE TABLE IF NOT EXISTS `#__weblinks` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `catid` int(11) NOT NULL DEFAULT '0',
- `sid` int(11) NOT NULL DEFAULT '0',
- `title` varchar(250) NOT NULL DEFAULT '',
- `alias` varchar(255) NOT NULL DEFAULT '',
- `url` varchar(250) NOT NULL DEFAULT '',
- `description` text NOT NULL,
- `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `hits` int(11) NOT NULL DEFAULT '0',
- `state` tinyint(1) NOT NULL DEFAULT '0',
- `checked_out` int(11) NOT NULL DEFAULT '0',
- `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `ordering` int(11) NOT NULL DEFAULT '0',
- `archived` tinyint(1) NOT NULL DEFAULT '0',
- `approved` tinyint(1) NOT NULL DEFAULT '1',
- `access` int(11) NOT NULL DEFAULT '1',
- `params` text NOT NULL,
- `language` char(7) NOT NULL DEFAULT '',
- `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `created_by` int(10) unsigned NOT NULL DEFAULT '0',
- `created_by_alias` varchar(255) NOT NULL DEFAULT '',
- `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `modified_by` int(10) unsigned NOT NULL DEFAULT '0',
- `metakey` text NOT NULL,
- `metadesc` text NOT NULL,
- `metadata` text NOT NULL,
- `featured` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Set if link is featured.',
- `xreference` varchar(50) NOT NULL COMMENT 'A reference to enable linkages to external data sets.',
- `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (`id`),
- KEY `idx_access` (`access`),
- KEY `idx_checkout` (`checked_out`),
- KEY `idx_state` (`state`),
- KEY `idx_catid` (`catid`),
- KEY `idx_createdby` (`created_by`),
- KEY `idx_featured_catid` (`featured`,`catid`),
- KEY `idx_language` (`language`),
- KEY `idx_xreference` (`xreference`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-
+CREATE TABLE IF NOT EXISTS `#__weblinks` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `catid` int(11) NOT NULL DEFAULT '0',
+ `sid` int(11) NOT NULL DEFAULT '0',
+ `title` varchar(250) NOT NULL DEFAULT '',
+ `alias` varchar(255) NOT NULL DEFAULT '',
+ `url` varchar(250) NOT NULL DEFAULT '',
+ `description` text NOT NULL,
+ `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `hits` int(11) NOT NULL DEFAULT '0',
+ `state` tinyint(1) NOT NULL DEFAULT '0',
+ `checked_out` int(11) NOT NULL DEFAULT '0',
+ `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `ordering` int(11) NOT NULL DEFAULT '0',
+ `archived` tinyint(1) NOT NULL DEFAULT '0',
+ `approved` tinyint(1) NOT NULL DEFAULT '1',
+ `access` int(11) NOT NULL DEFAULT '1',
+ `params` text NOT NULL,
+ `language` char(7) NOT NULL DEFAULT '',
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `created_by` int(10) unsigned NOT NULL DEFAULT '0',
+ `created_by_alias` varchar(255) NOT NULL DEFAULT '',
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `modified_by` int(10) unsigned NOT NULL DEFAULT '0',
+ `metakey` text NOT NULL,
+ `metadesc` text NOT NULL,
+ `metadata` text NOT NULL,
+ `featured` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Set if link is featured.',
+ `xreference` varchar(50) NOT NULL COMMENT 'A reference to enable linkages to external data sets.',
+ `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`),
+ KEY `idx_access` (`access`),
+ KEY `idx_checkout` (`checked_out`),
+ KEY `idx_state` (`state`),
+ KEY `idx_catid` (`catid`),
+ KEY `idx_createdby` (`created_by`),
+ KEY `idx_featured_catid` (`featured`,`catid`),
+ KEY `idx_language` (`language`),
+ KEY `idx_xreference` (`xreference`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
diff --git a/src/com_weblinks/admin/tables/weblink.php b/src/com_weblinks/admin/tables/weblink.php
index 557555e..39dd02b 100644
--- a/src/com_weblinks/admin/tables/weblink.php
+++ b/src/com_weblinks/admin/tables/weblink.php
@@ -26,6 +26,9 @@ class WeblinksTableWeblink extends JTable
public function __construct(&$db)
{
parent::__construct('#__weblinks', 'id', $db);
+
+ JTableObserverTags::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
+ JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
}
/**
@@ -77,10 +80,11 @@ class WeblinksTableWeblink extends JTable
$date = JFactory::getDate();
$user = JFactory::getUser();
+ $this->modified = $date->toSql();
+
if ($this->id)
{
// Existing item
- $this->modified = $date->toSql();
$this->modified_by = $user->get('id');
}
else
diff --git a/src/com_weblinks/site/language/en-GB/en-GB.com_weblinks.ini b/src/com_weblinks/site/language/en-GB/en-GB.com_weblinks.ini
index 2fa7de6..bd495ec 100644
--- a/src/com_weblinks/site/language/en-GB/en-GB.com_weblinks.ini
+++ b/src/com_weblinks/site/language/en-GB/en-GB.com_weblinks.ini
@@ -1,5 +1,5 @@
; Joomla! Project
-; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
+; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 - No BOM
diff --git a/src/com_weblinks/site/models/category.php b/src/com_weblinks/site/models/category.php
index f26867d..10b0fdf 100644
--- a/src/com_weblinks/site/models/category.php
+++ b/src/com_weblinks/site/models/category.php
@@ -193,7 +193,7 @@ class WeblinksModelCategory extends JModelList
$params = JComponentHelper::getParams('com_weblinks');
// List state information
- $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint');
+ $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint');
$this->setState('list.limit', $limit);
$limitstart = $app->input->get('limitstart', 0, 'uint');
@@ -334,6 +334,7 @@ class WeblinksModelCategory extends JModelList
{
$this->getCategory();
}
+
return $this->_children;
}
@@ -348,13 +349,12 @@ class WeblinksModelCategory extends JModelList
*/
public function hit($pk = 0)
{
- $input = JFactory::getApplication()->input;
+ $input = JFactory::getApplication()->input;
$hitcount = $input->getInt('hitcount', 1);
if ($hitcount)
{
- $pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id');
-
+ $pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id');
$table = JTable::getInstance('Category', 'JTable');
$table->load($pk);
$table->hit($pk);
diff --git a/src/com_weblinks/site/router.php b/src/com_weblinks/site/router.php
index 25c3102..d437216 100644
--- a/src/com_weblinks/site/router.php
+++ b/src/com_weblinks/site/router.php
@@ -10,220 +10,272 @@
defined('_JEXEC') or die;
/**
- * Build the route for the com_weblinks component
+ * Routing class from com_weblinks
*
- * @return array An array of URL arguments
- *
- * @return array The URL arguments to use to assemble the subsequent URL.
+ * @package Joomla.Site
+ * @subpackage com_weblinks
+ * @since 3.3
*/
-function WeblinksBuildRoute(&$query)
+class WeblinksRouter extends JComponentRouterBase
{
- $segments = array();
-
- // get a menu item based on Itemid or currently active
- $app = JFactory::getApplication();
- $menu = $app->getMenu();
- $params = JComponentHelper::getParams('com_weblinks');
- $advanced = $params->get('sef_advanced_link', 0);
-
- // we need a menu item. Either the one specified in the query, or the current active one if none specified
- if (empty($query['Itemid']))
+ /**
+ * Build the route for the com_weblinks component
+ *
+ * @param array &$query An array of URL arguments
+ *
+ * @return array The URL arguments to use to assemble the subsequent URL.
+ *
+ * @since 3.3
+ */
+ public function build(&$query)
{
- $menuItem = $menu->getActive();
- }
- else
- {
- $menuItem = $menu->getItem($query['Itemid']);
- }
+ $segments = array();
- $mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
- $mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
+ // Get a menu item based on Itemid or currently active
+ $app = JFactory::getApplication();
+ $menu = $app->getMenu();
+ $params = JComponentHelper::getParams('com_weblinks');
+ $advanced = $params->get('sef_advanced_link', 0);
- if (isset($query['view']))
- {
- $view = $query['view'];
-
- if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component != 'com_weblinks')
+ // We need a menu item. Either the one specified in the query, or the current active one if none specified
+ if (empty($query['Itemid']))
{
- $segments[] = $query['view'];
+ $menuItem = $menu->getActive();
+ }
+ else
+ {
+ $menuItem = $menu->getItem($query['Itemid']);
}
- // We need to keep the view for forms since they never have their own menu item
- if ($view != 'form')
+ $mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
+ $mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
+
+ if (isset($query['view']))
+ {
+ $view = $query['view'];
+
+ if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component != 'com_weblinks')
+ {
+ $segments[] = $query['view'];
+ }
+
+ // We need to keep the view for forms since they never have their own menu item
+ if ($view != 'form')
+ {
+ unset($query['view']);
+ }
+ }
+
+ // Are we dealing with an weblink that is attached to a menu item?
+ if (isset($query['view']) && ($mView == $query['view']) and (isset($query['id'])) and ($mId == (int) $query['id']))
{
unset($query['view']);
- }
- }
+ unset($query['catid']);
+ unset($query['id']);
- // are we dealing with an weblink that is attached to a menu item?
- if (isset($query['view']) && ($mView == $query['view']) and (isset($query['id'])) and ($mId == (int) $query['id']))
- {
- unset($query['view']);
- unset($query['catid']);
- unset($query['id']);
+ return $segments;
+ }
+
+ if (isset($view) and ($view == 'category' or $view == 'weblink'))
+ {
+ if ($mId != (int) $query['id'] || $mView != $view)
+ {
+ if ($view == 'weblink' && isset($query['catid']))
+ {
+ $catid = $query['catid'];
+ }
+ elseif (isset($query['id']))
+ {
+ $catid = $query['id'];
+ }
+
+ $menuCatid = $mId;
+ $categories = JCategories::getInstance('Weblinks');
+ $category = $categories->get($catid);
+
+ if ($category)
+ {
+ // TODO Throw error that the category either not exists or is unpublished
+ $path = $category->getPath();
+ $path = array_reverse($path);
+
+ $array = array();
+
+ foreach ($path as $id)
+ {
+ if ((int) $id == (int) $menuCatid)
+ {
+ break;
+ }
+
+ if ($advanced)
+ {
+ list($tmp, $id) = explode(':', $id, 2);
+ }
+
+ $array[] = $id;
+ }
+
+ $segments = array_merge($segments, array_reverse($array));
+ }
+
+ if ($view == 'weblink')
+ {
+ if ($advanced)
+ {
+ list($tmp, $id) = explode(':', $query['id'], 2);
+ }
+ else
+ {
+ $id = $query['id'];
+ }
+
+ $segments[] = $id;
+ }
+ }
+
+ unset($query['id']);
+ unset($query['catid']);
+ }
+
+ if (isset($query['layout']))
+ {
+ if (!empty($query['Itemid']) && isset($menuItem->query['layout']))
+ {
+ if ($query['layout'] == $menuItem->query['layout'])
+ {
+ unset($query['layout']);
+ }
+ }
+ else
+ {
+ if ($query['layout'] == 'default')
+ {
+ unset($query['layout']);
+ }
+ }
+ }
+
+ $total = count($segments);
+
+ for ($i = 0; $i < $total; $i++)
+ {
+ $segments[$i] = str_replace(':', '-', $segments[$i]);
+ }
return $segments;
}
- if (isset($view) and ($view == 'category' or $view == 'weblink'))
+ /**
+ * Parse the segments of a URL.
+ *
+ * @param array &$segments The segments of the URL to parse.
+ *
+ * @return array The URL attributes to be used by the application.
+ *
+ * @since 3.3
+ */
+ public function parse(&$segments)
{
- if ($mId != (int) $query['id'] || $mView != $view)
+ $total = count($segments);
+ $vars = array();
+
+ for ($i = 0; $i < $total; $i++)
{
- if ($view == 'weblink' && isset($query['catid']))
- {
- $catid = $query['catid'];
- }
- elseif (isset($query['id']))
- {
- $catid = $query['id'];
- }
+ $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1);
+ }
- $menuCatid = $mId;
- $categories = JCategories::getInstance('Weblinks');
- $category = $categories->get($catid);
+ // Get the active menu item.
+ $app = JFactory::getApplication();
+ $menu = $app->getMenu();
+ $item = $menu->getActive();
+ $params = JComponentHelper::getParams('com_weblinks');
+ $advanced = $params->get('sef_advanced_link', 0);
- if ($category)
+ // Count route segments
+ $count = count($segments);
+
+ // Standard routing for weblinks.
+ if (!isset($item))
+ {
+ $vars['view'] = $segments[0];
+ $vars['id'] = $segments[$count - 1];
+
+ return $vars;
+ }
+
+ // From the categories view, we can only jump to a category.
+ $id = (isset($item->query['id']) && $item->query['id'] > 1) ? $item->query['id'] : 'root';
+
+ $category = JCategories::getInstance('Weblinks')->get($id);
+
+ $categories = $category->getChildren();
+ $found = 0;
+
+ foreach ($segments as $segment)
+ {
+ foreach ($categories as $category)
{
- //TODO Throw error that the category either not exists or is unpublished
- $path = $category->getPath();
- $path = array_reverse($path);
-
- $array = array();
- foreach ($path as $id)
+ if (($category->slug == $segment) || ($advanced && $category->alias == str_replace(':', '-', $segment)))
{
- if ((int) $id == (int) $menuCatid)
- {
- break;
- }
+ $vars['id'] = $category->id;
+ $vars['view'] = 'category';
+ $categories = $category->getChildren();
+ $found = 1;
- if ($advanced)
- {
- list($tmp, $id) = explode(':', $id, 2);
- }
-
- $array[] = $id;
+ break;
}
- $segments = array_merge($segments, array_reverse($array));
}
- if ($view == 'weblink')
+ if ($found == 0)
{
if ($advanced)
{
- list($tmp, $id) = explode(':', $query['id'], 2);
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select($db->quoteName('id'))
+ ->from('#__weblinks')
+ ->where($db->quoteName('catid') . ' = ' . (int) $vars['catid'])
+ ->where($db->quoteName('alias') . ' = ' . $db->quote($db->quote(str_replace(':', '-', $segment))));
+ $db->setQuery($query);
+ $id = $db->loadResult();
}
else
{
- $id = $query['id'];
+ $id = $segment;
}
- $segments[] = $id;
- }
- }
-
- unset($query['id']);
- unset($query['catid']);
- }
-
- if (isset($query['layout']))
- {
- if (!empty($query['Itemid']) && isset($menuItem->query['layout']))
- {
- if ($query['layout'] == $menuItem->query['layout'])
- {
- unset($query['layout']);
- }
- }
- else
- {
- if ($query['layout'] == 'default')
- {
- unset($query['layout']);
- }
- }
- }
-
- return $segments;
-}
-
-/**
- * Parse the segments of a URL.
- *
- * @return array The segments of the URL to parse.
- *
- * @return array The URL attributes to be used by the application.
- */
-function WeblinksParseRoute($segments)
-{
- $vars = array();
-
- //Get the active menu item.
- $app = JFactory::getApplication();
- $menu = $app->getMenu();
- $item = $menu->getActive();
- $params = JComponentHelper::getParams('com_weblinks');
- $advanced = $params->get('sef_advanced_link', 0);
-
- // Count route segments
- $count = count($segments);
-
- // Standard routing for weblinks.
- if (!isset($item))
- {
- $vars['view'] = $segments[0];
- $vars['id'] = $segments[$count - 1];
- return $vars;
- }
-
- // From the categories view, we can only jump to a category.
- $id = (isset($item->query['id']) && $item->query['id'] > 1) ? $item->query['id'] : 'root';
-
- $category = JCategories::getInstance('Weblinks')->get($id);
-
- $categories = $category->getChildren();
- $found = 0;
-
- foreach ($segments as $segment)
- {
- foreach ($categories as $category)
- {
- if (($category->slug == $segment) || ($advanced && $category->alias == str_replace(':', '-', $segment)))
- {
- $vars['id'] = $category->id;
- $vars['view'] = 'category';
- $categories = $category->getChildren();
- $found = 1;
+ $vars['id'] = $id;
+ $vars['view'] = 'weblink';
break;
}
+
+ $found = 0;
}
- if ($found == 0)
- {
- if ($advanced)
- {
- $db = JFactory::getDbo();
- $query = $db->getQuery(true)
- ->select($db->quoteName('id'))
- ->from('#__weblinks')
- ->where($db->quoteName('catid') . ' = ' . (int) $vars['catid'])
- ->where($db->quoteName('alias') . ' = ' . $db->quote($db->quote(str_replace(':', '-', $segment))));
- $db->setQuery($query);
- $id = $db->loadResult();
- }
- else
- {
- $id = $segment;
- }
-
- $vars['id'] = $id;
- $vars['view'] = 'weblink';
-
- break;
- }
-
- $found = 0;
+ return $vars;
}
-
- return $vars;
+}
+
+/**
+ * Weblinks router functions
+ *
+ * These functions are proxys for the new router interface
+ * for old SEF extensions.
+ *
+ * @deprecated 4.0 Use Class based routers instead
+ */
+function WeblinksBuildRoute(&$query)
+{
+ $router = new WeblinksRouter;
+
+ return $router->build($query);
+}
+
+function WeblinksParseRoute($segments)
+{
+ $router = new WeblinksRouter;
+
+ return $router->parse($segments);
}
diff --git a/src/com_weblinks/site/views/categories/tmpl/default_items.php b/src/com_weblinks/site/views/categories/tmpl/default_items.php
index 7cc7d6d..f4272f3 100644
--- a/src/com_weblinks/site/views/categories/tmpl/default_items.php
+++ b/src/com_weblinks/site/views/categories/tmpl/default_items.php
@@ -33,7 +33,7 @@ if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
numitems; ?>
- getChildren()) > 0) : ?>
+ getChildren()) > 0 && $this->maxLevelcat > 1) : ?>
@@ -45,7 +45,7 @@ if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
- getChildren()) > 0) :?>
+ getChildren()) > 0 && $this->maxLevelcat > 1) :?>
items[$item->id] = $item->getChildren();
diff --git a/src/com_weblinks/site/views/category/tmpl/default_items.php b/src/com_weblinks/site/views/category/tmpl/default_items.php
index 938adcb..e353662 100644
--- a/src/com_weblinks/site/views/category/tmpl/default_items.php
+++ b/src/com_weblinks/site/views/category/tmpl/default_items.php
@@ -9,16 +9,18 @@
defined('_JEXEC') or die;
-JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
+JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.framework');
// Create a shortcut for params.
$params = &$this->item->params;
+
// Get the user object.
$user = JFactory::getUser();
+
// Check if user is allowed to add/edit based on weblinks permissinos.
-$canEdit = $user->authorise('core.edit', 'com_weblinks.category.'.$this->category->id);
+$canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $this->category->id);
$canCreate = $user->authorise('core.create', 'com_weblinks');
$canEditState = $user->authorise('core.edit.state', 'com_weblinks');
@@ -36,7 +38,7 @@ $listDirn = $this->escape($this->state->get('list.direction'));