Fixed the access filter in query. Fixed the array to int helper use. Added the correct language strings to category and access filters.

This commit is contained in:
Llewellyn van der Merwe 2020-12-03 02:15:39 +02:00
parent e726e758b4
commit 10946ba899
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
30 changed files with 136 additions and 44 deletions

View File

@ -23,7 +23,7 @@ The best way to see all your options is to install this component on you Joomla
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015
+ *Last Build*: 30th November, 2020
+ *Last Build*: 3rd December, 2020
+ *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -36,11 +36,11 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **72694**
+ *Line count*: **72786**
+ *File count*: **459**
+ *Folder count*: **93**
**133 Hours** or **17 Eight Hour Days** (the actual time the author spent)
**134 Hours** or **17 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @51hours** = codingtime / 4;
@ -48,7 +48,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder
> **mapping @20hours** = codingtime / 10;
> **office @34hours** = codingtime / 6;)
**336 Hours** or **42 Eight Hour Days**
**337 Hours** or **42 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,

View File

@ -23,7 +23,7 @@ The best way to see all your options is to install this component on you Joomla
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015
+ *Last Build*: 30th November, 2020
+ *Last Build*: 3rd December, 2020
+ *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -36,11 +36,11 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **72694**
+ *Line count*: **72786**
+ *File count*: **459**
+ *Folder count*: **93**
**133 Hours** or **17 Eight Hour Days** (the actual time the author spent)
**134 Hours** or **17 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @51hours** = codingtime / 4;
@ -48,7 +48,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder
> **mapping @20hours** = codingtime / 10;
> **office @34hours** = codingtime / 6;)
**336 Hours** or **42 Eight Hour Days**
**337 Hours** or **42 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,

View File

@ -68,7 +68,7 @@ class SermondistributorControllerExternal_sources extends JControllerAdmin
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
$pks = ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('External_sources');
// get the data to export

View File

@ -68,7 +68,7 @@ class SermondistributorControllerHelp_documents extends JControllerAdmin
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
$pks = ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Help_documents');
// get the data to export

View File

@ -68,7 +68,7 @@ class SermondistributorControllerLocal_listings extends JControllerAdmin
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
$pks = ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Local_listings');
// get the data to export

View File

@ -68,7 +68,7 @@ class SermondistributorControllerPreachers extends JControllerAdmin
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
$pks = ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Preachers');
// get the data to export

View File

@ -68,7 +68,7 @@ class SermondistributorControllerSeries_list extends JControllerAdmin
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
$pks = ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Series_list');
// get the data to export

View File

@ -68,7 +68,7 @@ class SermondistributorControllerSermons extends JControllerAdmin
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
$pks = ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Sermons');
// get the data to export

View File

@ -68,7 +68,7 @@ class SermondistributorControllerStatistics extends JControllerAdmin
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
$pks = ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Statistics');
// get the data to export

View File

@ -699,6 +699,7 @@ COM_SERMONDISTRIBUTOR_FILTER_SEARCH_PREACHERS="Search the preacher items. Prefix
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_SERIES_LIST="Search the series items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_SERMONS="Search the sermon items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_STATISTICS="Search the statistic items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS="Select Access"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_ADMIN_VIEW="Select Admin View"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_BUILD="Select Build"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_EXTERNALSOURCES="Select Externalsources"

View File

@ -24,8 +24,8 @@
<field
type="accesslevel"
name="access"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"

View File

@ -24,8 +24,8 @@
<field
type="accesslevel"
name="access"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"

View File

@ -24,8 +24,8 @@
<field
type="accesslevel"
name="access"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"

View File

@ -24,7 +24,7 @@
<field
type="category"
name="category_id"
label="JOPTION_FILTER_CATEGORY"
label="COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES"
description="JOPTION_FILTER_CATEGORY_DESC"
multiple="true"
class="multipleCategories"
@ -35,8 +35,8 @@
<field
type="accesslevel"
name="access"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"

View File

@ -24,8 +24,8 @@
<field
type="accesslevel"
name="access"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"

View File

@ -39,6 +39,7 @@ class SermondistributorModelHelp_documents extends JModelList
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.access','access',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
@ -268,9 +269,17 @@ class SermondistributorModelHelp_documents extends JModelList
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
$_access = $this->getState('filter.access');
if ($_access && is_numeric($_access))
{
$query->where('a.access = ' . (int) $access);
$query->where('a.access = ' . (int) $_access);
}
elseif (SermondistributorHelper::checkArray($_access))
{
// Secure the array for the query
$_access = ArrayHelper::toInteger($_access);
// Filter by the Access Array.
$query->where('a.access IN (' . implode(',', $_access) . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
@ -507,6 +516,7 @@ class SermondistributorModelHelp_documents extends JModelList
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');

View File

@ -179,9 +179,17 @@ class SermondistributorModelPreacher extends JModelAdmin
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
$_access = $this->getState('filter.access');
if ($_access && is_numeric($_access))
{
$query->where('a.access = ' . (int) $access);
$query->where('a.access = ' . (int) $_access);
}
elseif (SermondistributorHelper::checkArray($_access))
{
// Secure the array for the query
$_access = ArrayHelper::toInteger($_access);
// Filter by the Access Array.
$query->where('a.access IN (' . implode(',', $_access) . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))

View File

@ -39,6 +39,7 @@ class SermondistributorModelPreachers extends JModelList
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.access','access',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
@ -182,9 +183,17 @@ class SermondistributorModelPreachers extends JModelList
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
$_access = $this->getState('filter.access');
if ($_access && is_numeric($_access))
{
$query->where('a.access = ' . (int) $access);
$query->where('a.access = ' . (int) $_access);
}
elseif (SermondistributorHelper::checkArray($_access))
{
// Secure the array for the query
$_access = ArrayHelper::toInteger($_access);
// Filter by the Access Array.
$query->where('a.access IN (' . implode(',', $_access) . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
@ -353,6 +362,7 @@ class SermondistributorModelPreachers extends JModelList
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');

View File

@ -178,9 +178,17 @@ class SermondistributorModelSeries extends JModelAdmin
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
$_access = $this->getState('filter.access');
if ($_access && is_numeric($_access))
{
$query->where('a.access = ' . (int) $access);
$query->where('a.access = ' . (int) $_access);
}
elseif (SermondistributorHelper::checkArray($_access))
{
// Secure the array for the query
$_access = ArrayHelper::toInteger($_access);
// Filter by the Access Array.
$query->where('a.access IN (' . implode(',', $_access) . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))

View File

@ -39,6 +39,7 @@ class SermondistributorModelSeries_list extends JModelList
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.access','access',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
@ -174,9 +175,17 @@ class SermondistributorModelSeries_list extends JModelList
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
$_access = $this->getState('filter.access');
if ($_access && is_numeric($_access))
{
$query->where('a.access = ' . (int) $access);
$query->where('a.access = ' . (int) $_access);
}
elseif (SermondistributorHelper::checkArray($_access))
{
// Secure the array for the query
$_access = ArrayHelper::toInteger($_access);
// Filter by the Access Array.
$query->where('a.access IN (' . implode(',', $_access) . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
@ -345,6 +354,7 @@ class SermondistributorModelSeries_list extends JModelList
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');

View File

@ -215,9 +215,17 @@ class SermondistributorModelSermon extends JModelAdmin
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
$_access = $this->getState('filter.access');
if ($_access && is_numeric($_access))
{
$query->where('a.access = ' . (int) $access);
$query->where('a.access = ' . (int) $_access);
}
elseif (SermondistributorHelper::checkArray($_access))
{
// Secure the array for the query
$_access = ArrayHelper::toInteger($_access);
// Filter by the Access Array.
$query->where('a.access IN (' . implode(',', $_access) . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))

View File

@ -39,6 +39,7 @@ class SermondistributorModelSermons extends JModelList
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.access','access',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
@ -291,9 +292,17 @@ class SermondistributorModelSermons extends JModelList
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
$_access = $this->getState('filter.access');
if ($_access && is_numeric($_access))
{
$query->where('a.access = ' . (int) $access);
$query->where('a.access = ' . (int) $_access);
}
elseif (SermondistributorHelper::checkArray($_access))
{
// Secure the array for the query
$_access = ArrayHelper::toInteger($_access);
// Filter by the Access Array.
$query->where('a.access IN (' . implode(',', $_access) . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
@ -447,7 +456,7 @@ class SermondistributorModelSermons extends JModelList
}
elseif (is_array($categoryId))
{
ArrayHelper::toInteger($categoryId);
$categoryId = ArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId);
$query->where('a.catid IN (' . $categoryId . ')');
}
@ -598,6 +607,7 @@ class SermondistributorModelSermons extends JModelList
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');

View File

@ -39,6 +39,7 @@ class SermondistributorModelStatistics extends JModelList
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.access','access',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
@ -218,9 +219,17 @@ class SermondistributorModelStatistics extends JModelList
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
$_access = $this->getState('filter.access');
if ($_access && is_numeric($_access))
{
$query->where('a.access = ' . (int) $access);
$query->where('a.access = ' . (int) $_access);
}
elseif (SermondistributorHelper::checkArray($_access))
{
// Secure the array for the query
$_access = ArrayHelper::toInteger($_access);
// Filter by the Access Array.
$query->where('a.access IN (' . implode(',', $_access) . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
@ -440,6 +449,7 @@ class SermondistributorModelStatistics extends JModelList
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');

View File

@ -5,3 +5,14 @@ DROP TABLE IF EXISTS `#__sermondistributor_statistic`;
DROP TABLE IF EXISTS `#__sermondistributor_external_source`;
DROP TABLE IF EXISTS `#__sermondistributor_local_listing`;
DROP TABLE IF EXISTS `#__sermondistributor_help_document`;
--
-- Always insure this column rules is reversed to Joomla defaults on uninstall. (as on 1st Dec 2020)
--
ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';
--
-- Always insure this column name is reversed to Joomla defaults on uninstall. (as on 1st Dec 2020).
--
ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.';

View File

@ -28,6 +28,7 @@ defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{

View File

@ -28,6 +28,7 @@ defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{

View File

@ -28,6 +28,7 @@ defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{

View File

@ -30,6 +30,8 @@ JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multiplePreachers', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_PREACHER') . ' -'));
JHtml::_('formbehavior.chosen', '.multipleSeries', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERIES') . ' -'));
JHtml::_('formbehavior.chosen', '.multipleCategories', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERMONS_CATEGORIES') . ' -'));
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{

View File

@ -28,6 +28,7 @@ defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_SERMONDISTRIBUTOR</name>
<creationDate>30th November, 2020</creationDate>
<creationDate>3rd December, 2020</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://www.vdm.io/</authorUrl>