diff --git a/README.md b/README.md
index 1fdfd38a..24e338d6 100644
--- a/README.md
+++ b/README.md
@@ -23,38 +23,38 @@ 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*: 14th August, 2019
++ *Last Build*: 5th January, 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
## Build Time :hourglass:
-**189 Hours** or **24 Eight Hour Days** (actual time the author saved -
+**192 Hours** or **24 Eight Hour Days** (actual time the author saved -
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*: **67680**
++ *Line count*: **68757**
+ *File count*: **445**
+ *Folder count*: **93**
-**124 Hours** or **15 Eight Hour Days** (the actual time the author spent)
+**126 Hours** or **16 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
-> **debugging @47hours** = codingtime / 4;
+> **debugging @48hours** = codingtime / 4;
> **planning @27hours** = codingtime / 7;
> **mapping @19hours** = codingtime / 10;
-> **office @31hours** = codingtime / 6;)
+> **office @32hours** = codingtime / 6;)
-**313 Hours** or **39 Eight Hour Days**
+**318 Hours** or **40 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**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
-Project duration: **7.8 weeks** or **1.6 months**
+Project duration: **8 weeks** or **1.7 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
diff --git a/admin/README.txt b/admin/README.txt
index 1fdfd38a..24e338d6 100644
--- a/admin/README.txt
+++ b/admin/README.txt
@@ -23,38 +23,38 @@ 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*: 14th August, 2019
++ *Last Build*: 5th January, 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
## Build Time :hourglass:
-**189 Hours** or **24 Eight Hour Days** (actual time the author saved -
+**192 Hours** or **24 Eight Hour Days** (actual time the author saved -
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*: **67680**
++ *Line count*: **68757**
+ *File count*: **445**
+ *Folder count*: **93**
-**124 Hours** or **15 Eight Hour Days** (the actual time the author spent)
+**126 Hours** or **16 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
-> **debugging @47hours** = codingtime / 4;
+> **debugging @48hours** = codingtime / 4;
> **planning @27hours** = codingtime / 7;
> **mapping @19hours** = codingtime / 10;
-> **office @31hours** = codingtime / 6;)
+> **office @32hours** = codingtime / 6;)
-**313 Hours** or **39 Eight Hour Days**
+**318 Hours** or **40 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**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
-Project duration: **7.8 weeks** or **1.6 months**
+Project duration: **8 weeks** or **1.7 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php
index 240cc0fd..197a91d8 100644
--- a/admin/controllers/ajax.json.php
+++ b/admin/controllers/ajax.json.php
@@ -140,7 +140,7 @@ class SermondistributorControllerAjax extends JControllerLegacy
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$idNameValue = $jinput->get('idName', NULL, 'WORD');
$ojectValue = $jinput->get('oject', NULL, 'STRING');
- if($idNameValue && $ojectValue && $user->id != 0)
+ if($idNameValue && $user->id != 0 && $ojectValue)
{
$result = $this->getModel('ajax')->getBuildTable($idNameValue, $ojectValue);
}
@@ -257,7 +257,7 @@ class SermondistributorControllerAjax extends JControllerLegacy
$targetValue = $jinput->get('target', NULL, 'INT');
$typeValue = $jinput->get('type', NULL, 'INT');
$sleutelValue = $jinput->get('sleutel', NULL, 'CMD');
- if($idValue && $targetValue && $typeValue && $sleutelValue && $user->id != 0)
+ if($idValue && $user->id != 0 && $targetValue && $typeValue && $sleutelValue)
{
$result = $this->getModel('ajax')->updateLocalListingExternal($idValue, $targetValue, $typeValue, $sleutelValue);
}
diff --git a/admin/helpers/sermondistributor.php b/admin/helpers/sermondistributor.php
index 49566b24..eb72d6ad 100644
--- a/admin/helpers/sermondistributor.php
+++ b/admin/helpers/sermondistributor.php
@@ -25,11 +25,21 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
+use Joomla\CMS\Language\Language;
+use Joomla\String\StringHelper;
+use Joomla\Utilities\ArrayHelper;
+
/**
* Sermondistributor component helper.
*/
abstract class SermondistributorHelper
-{
+{
+ /**
+ * The Main Active Language
+ *
+ * @var string
+ */
+ public static $langTag;
/**
* The global params
@@ -673,7 +683,7 @@ abstract class SermondistributorHelper
*
* @var array
**/
- protected static $fileExtentionToMimeType = array(
+ protected static $fileExtensionToMimeType = array(
'123' => 'application/vnd.lotus-1-2-3',
'3dml' => 'text/vnd.in3d.3dml',
'3ds' => 'image/x-3ds',
@@ -1680,9 +1690,9 @@ abstract class SermondistributorHelper
// get the extension form file
$extension = \strtolower(\pathinfo($file, \PATHINFO_EXTENSION));
// check if we have the extension listed
- if (isset(self::$fileExtentionToMimeType[$extension]))
+ if (isset(self::$fileExtensionToMimeType[$extension]))
{
- return self::$fileExtentionToMimeType[$extension];
+ return self::$fileExtensionToMimeType[$extension];
}
elseif (function_exists('mime_content_type'))
{
@@ -1698,6 +1708,61 @@ abstract class SermondistributorHelper
return 'application/octet-stream';
}
+ /**
+ * Get the file extensions
+ *
+ * @param string $target The targeted/filter option
+ * @param boolean $sorted The multidimensional grouping sort (only if targeted filter is used)
+ *
+ * @return array All the extensions (targeted & sorted)
+ *
+ */
+ public static function getFileExtensions($target = null, $sorted = false)
+ {
+ // we have some in-house grouping/filters :)
+ $filters = array(
+ 'image' => array('image', 'font', 'model'),
+ 'document' => array('application', 'text', 'chemical', 'message'),
+ 'media' => array('video', 'audio'),
+ 'file' => array('image', 'application', 'text', 'video', 'audio'),
+ 'all' => array('application', 'text', 'chemical', 'message', 'image', 'font', 'model', 'video', 'audio', 'x-conference')
+ );
+ // sould we filter
+ if ($target)
+ {
+ // the bucket to get extensions
+ $fileextensions = array();
+ // check if filter exist (if not return empty array)
+ if (isset($filters[$target]))
+ {
+ foreach (self::$fileExtensionToMimeType as $extension => $mimetype)
+ {
+ // get the key mime type
+ $mimearr = explode("/", $mimetype, 2);
+ // check if this file extension should be added
+ if (in_array($mimearr[0], $filters[$target]))
+ {
+ if ($sorted)
+ {
+ if (!isset($fileextensions[$mimearr[0]]))
+ {
+ $fileextensions[$mimearr[0]] = array();
+ }
+ $fileextensions[$mimearr[0]][$extension] = $extension;
+ }
+ else
+ {
+ $fileextensions[$extension] = $extension;
+ }
+ }
+ }
+ }
+ return $fileextensions;
+ }
+ // we just return all file extensions
+ return array_keys(self::$fileExtensionToMimeType);
+ }
+
protected static function getDownloadFileName(&$sermon, $file, $type)
{
// first get file name and file type
@@ -2681,6 +2746,7 @@ abstract class SermondistributorHelper
// return opened values
return $open;
}
+
/**
* Load the Component xml manifest.
**/
@@ -2834,7 +2900,7 @@ abstract class SermondistributorHelper
if ($user->authorise('sermon.access', 'com_sermondistributor') && $user->authorise('sermon.submenu', 'com_sermondistributor'))
{
JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_SERMONS'), 'index.php?option=com_sermondistributor&view=sermons', $submenu === 'sermons');
- JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMON_CATEGORY'), 'index.php?option=com_categories&view=categories&extension=com_sermondistributor.sermons', $submenu === 'categories.sermons');
+ JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_sermondistributor.sermons', $submenu === 'categories.sermons');
}
if ($user->authorise('series.access', 'com_sermondistributor') && $user->authorise('series.submenu', 'com_sermondistributor'))
{
@@ -3243,7 +3309,15 @@ abstract class SermondistributorHelper
{
$query->from($db->quoteName('#_'.$main.'_'.$table));
}
- $query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
+ // add strings to array search
+ if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator)
+ {
+ $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")');
+ }
+ else
+ {
+ $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')');
+ }
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
@@ -3353,14 +3427,19 @@ abstract class SermondistributorHelper
* @param string $views The related list view name
* @param mixed $target Only get this permission (like edit, create, delete)
* @param string $component The target component
+ * @param object $user The user whose permissions we are loading
*
* @return object The JObject of permission/authorised actions
*
**/
- public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'sermondistributor')
+ public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'sermondistributor', $user = 'null')
{
- // get the user object
- $user = JFactory::getUser();
+ // load the user if not given
+ if (!self::checkObject($user))
+ {
+ // get the user object
+ $user = JFactory::getUser();
+ }
// load the JObject
$result = new JObject;
// make view name safe (just incase)
@@ -3694,7 +3773,7 @@ abstract class SermondistributorHelper
}
}
// check if there are any view values remaining
- if (count($_result))
+ if (count((array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);
@@ -3819,7 +3898,31 @@ abstract class SermondistributorHelper
jimport('joomla.form.form');
}
// get field type
- $field = JFormHelper::loadFieldType($attributes['type'],true);
+ $field = JFormHelper::loadFieldType($attributes['type'], true);
+ // get field xml
+ $XML = self::getFieldXML($attributes, $options);
+ // setup the field
+ $field->setup($XML, $default);
+ // return the field object
+ return $field;
+ }
+ return false;
+ }
+
+ /**
+ * get the field xml
+ *
+ * @param array $attributes The array of attributes
+ * @param array $options The options to apply to the XML element
+ *
+ * @return object
+ *
+ */
+ public static function getFieldXML(&$attributes, $options = null)
+ {
+ // make sure we have attributes and a type value
+ if (self::checkArray($attributes))
+ {
// start field xml
$XML = new SimpleXMLElement('');
// load the attributes
@@ -3830,10 +3933,8 @@ abstract class SermondistributorHelper
// load the options
self::xmlAddOptions($XML, $options);
}
- // setup the field
- $field->setup($XML, $default);
- // return the field object
- return $field;
+ // return the field xml
+ return $XML;
}
return false;
}
@@ -4081,6 +4182,8 @@ abstract class SermondistributorHelper
$string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string);
+ // Transliterate string
+ $string = self::transliterate($string);
// remove all and keep only characters
if ($keepOnlyCharacters)
{
@@ -4149,6 +4252,19 @@ abstract class SermondistributorHelper
return '';
}
+ public static function transliterate($string)
+ {
+ // set tag only once
+ if (!self::checkString(self::$langTag))
+ {
+ // get global value
+ self::$langTag = JComponentHelper::getParams('com_sermondistributor')->get('language', 'en-GB');
+ }
+ // Transliterate on the language requested
+ $lang = Language::getInstance(self::$langTag);
+ return $lang->transliterate($string);
+ }
+
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
{
if (self::checkString($var))
diff --git a/admin/language/en-GB/en-GB.com_sermondistributor.ini b/admin/language/en-GB/en-GB.com_sermondistributor.ini
index 807c54bc..eedb25a1 100644
--- a/admin/language/en-GB/en-GB.com_sermondistributor.ini
+++ b/admin/language/en-GB/en-GB.com_sermondistributor.ini
@@ -343,7 +343,7 @@ COM_SERMONDISTRIBUTOR_DASHBOARD_PREACHER_ADD="Add Preacher
"
COM_SERMONDISTRIBUTOR_DASHBOARD_SERIES_ADD="Add Series
"
COM_SERMONDISTRIBUTOR_DASHBOARD_SERIES_LIST="Series List
"
COM_SERMONDISTRIBUTOR_DASHBOARD_SERMONS="Sermons
"
-COM_SERMONDISTRIBUTOR_DASHBOARD_SERMONS_CATID="Category For
Sermons"
+COM_SERMONDISTRIBUTOR_DASHBOARD_SERMONS_CATID="Categories For
Sermons"
COM_SERMONDISTRIBUTOR_DASHBOARD_SERMON_ADD="Add Sermon
"
COM_SERMONDISTRIBUTOR_DASHBOARD_STATISTICS="Statistics
"
COM_SERMONDISTRIBUTOR_DATE="Date"
@@ -651,7 +651,7 @@ COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_TIMER="Update Timer"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_TIMER_DESCRIPTION="Set the timer in minutes for updating the external source local listing of file links."
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_TIMER_LABEL="Update Timer"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_VERSION_DESC="A count of the number of times this External Source has been revised."
-COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_VERSION_LABEL="Revision"
+COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_VERSION_LABEL="Version"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WAV=".wav"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WMV=".wmv"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLS=".xls"
@@ -764,7 +764,7 @@ COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_URL_HINT="http://www.example.com"
COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_URL_LABEL="URL"
COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_URL_MESSAGE="Error! Please add url here."
COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_VERSION_DESC="A count of the number of times this Help Document has been revised."
-COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_VERSION_LABEL="Revision"
+COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_VERSION_LABEL="Version"
COM_SERMONDISTRIBUTOR_HELP_MANAGER="Help"
COM_SERMONDISTRIBUTOR_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BSERMONDISTRIBUTORB_WILL_NOT_FUNCTION_CORRECTLYP="
Curl Not Found!
Please setup curl on your system, or sermondistributor will not function correctly!
"
COM_SERMONDISTRIBUTOR_IMPORT_CONTINUE="Continue"
@@ -928,7 +928,7 @@ COM_SERMONDISTRIBUTOR_LOCAL_LISTING_URL_HINT="shared URL"
COM_SERMONDISTRIBUTOR_LOCAL_LISTING_URL_LABEL="Shared-URL"
COM_SERMONDISTRIBUTOR_LOCAL_LISTING_URL_MESSAGE="Error! Please add shared-URL here."
COM_SERMONDISTRIBUTOR_LOCAL_LISTING_VERSION_DESC="A count of the number of times this Local Listing has been revised."
-COM_SERMONDISTRIBUTOR_LOCAL_LISTING_VERSION_LABEL="Revision"
+COM_SERMONDISTRIBUTOR_LOCAL_LISTING_VERSION_LABEL="Version"
COM_SERMONDISTRIBUTOR_LOCAL_LISTING_WAS_CLEARED_SUCCESSFULLY="Local listing was cleared successfully."
COM_SERMONDISTRIBUTOR_LOCAL_LISTING_WAS_NOT_CLEARED="Local listing was not cleared."
COM_SERMONDISTRIBUTOR_MANUAL_UPDATER="Manual Updater"
@@ -1030,7 +1030,7 @@ COM_SERMONDISTRIBUTOR_PREACHER_EDIT="Editing the Preacher"
COM_SERMONDISTRIBUTOR_PREACHER_EMAIL="Email"
COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_DESCRIPTION="Enter Email"
COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_HINT="demo@example.com"
-COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_LABEL="Email"
+COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_LABEL="Email
not required"
COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_MESSAGE="Error! Please add email address here."
COM_SERMONDISTRIBUTOR_PREACHER_ERROR_UNIQUE_ALIAS="Another Preacher has the same alias."
COM_SERMONDISTRIBUTOR_PREACHER_ICON="Icon"
@@ -1054,7 +1054,7 @@ COM_SERMONDISTRIBUTOR_PREACHER_SAVE_WARNING="Alias already existed so a number w
COM_SERMONDISTRIBUTOR_PREACHER_SERMONS="Sermons"
COM_SERMONDISTRIBUTOR_PREACHER_STATUS="Status"
COM_SERMONDISTRIBUTOR_PREACHER_VERSION_DESC="A count of the number of times this Preacher has been revised."
-COM_SERMONDISTRIBUTOR_PREACHER_VERSION_LABEL="Revision"
+COM_SERMONDISTRIBUTOR_PREACHER_VERSION_LABEL="Version"
COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE="Website"
COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE_DESCRIPTION="Enter website address"
COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE_HINT="http://www.example.com"
@@ -1162,7 +1162,7 @@ COM_SERMONDISTRIBUTOR_SERIES_SCRIPTURE_MESSAGE="Error! Please add some scripture
COM_SERMONDISTRIBUTOR_SERIES_SERMONS="Sermons"
COM_SERMONDISTRIBUTOR_SERIES_STATUS="Status"
COM_SERMONDISTRIBUTOR_SERIES_VERSION_DESC="A count of the number of times this Series has been revised."
-COM_SERMONDISTRIBUTOR_SERIES_VERSION_LABEL="Revision"
+COM_SERMONDISTRIBUTOR_SERIES_VERSION_LABEL="Version"
COM_SERMONDISTRIBUTOR_SERMON="Sermon"
COM_SERMONDISTRIBUTOR_SERMONS="Sermons"
COM_SERMONDISTRIBUTOR_SERMONS_ACCESS="Sermons Access"
@@ -1366,7 +1366,7 @@ COM_SERMONDISTRIBUTOR_SERMON_SELECT_SOURCE="Select Source"
COM_SERMONDISTRIBUTOR_SERMON_SERIES="Series"
COM_SERMONDISTRIBUTOR_SERMON_SERIES_DESCRIPTION="Select the series this sermon belongs to."
COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL="Series"
-COM_SERMONDISTRIBUTOR_SERMON_SERMON_CATEGORY="Sermon Category"
+COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES="Sermons Categories"
COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION="Short Description"
COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_DESCRIPTION="Enter short description"
COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_HINT="Your Short Description Here"
@@ -1386,7 +1386,7 @@ COM_SERMONDISTRIBUTOR_SERMON_URL_HINT="http://www.domain.com/direct-link-to-down
COM_SERMONDISTRIBUTOR_SERMON_URL_LABEL="File URL"
COM_SERMONDISTRIBUTOR_SERMON_URL_MESSAGE="Error! Please add sermon url here."
COM_SERMONDISTRIBUTOR_SERMON_VERSION_DESC="A count of the number of times this Sermon has been revised."
-COM_SERMONDISTRIBUTOR_SERMON_VERSION_LABEL="Revision"
+COM_SERMONDISTRIBUTOR_SERMON_VERSION_LABEL="Version"
COM_SERMONDISTRIBUTOR_SHAREDURL="Shared-url"
COM_SERMONDISTRIBUTOR_SOURCE_STATUS_REPORT="Source Status Report."
COM_SERMONDISTRIBUTOR_STATISTIC="Statistic"
@@ -1476,7 +1476,7 @@ COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_DESCRIPTION="Select a sermon."
COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL="Sermon"
COM_SERMONDISTRIBUTOR_STATISTIC_STATUS="Status"
COM_SERMONDISTRIBUTOR_STATISTIC_VERSION_DESC="A count of the number of times this Statistic has been revised."
-COM_SERMONDISTRIBUTOR_STATISTIC_VERSION_LABEL="Revision"
+COM_SERMONDISTRIBUTOR_STATISTIC_VERSION_LABEL="Version"
COM_SERMONDISTRIBUTOR_SUBMENU_DASHBOARD="Dashboard"
COM_SERMONDISTRIBUTOR_SUBMENU_EXTERNAL_SOURCES="External Sources"
COM_SERMONDISTRIBUTOR_SUBMENU_HELP_DOCUMENTS="Help Documents"
@@ -1501,6 +1501,13 @@ COM_SERMONDISTRIBUTOR_THE_WIKI_IS_LOADING="The wiki is loading"
COM_SERMONDISTRIBUTOR_THIS_SOURCE_HAS_NO_LOCAL_LISTING_SET="This source has no local listing set."
COM_SERMONDISTRIBUTOR_TOTAL_DOWNLOADS="total downloads"
COM_SERMONDISTRIBUTOR_TRASHED="Trashed"
+COM_SERMONDISTRIBUTOR_TYPE_EXTERNAL_SOURCE="External Source"
+COM_SERMONDISTRIBUTOR_TYPE_HELP_DOCUMENT="Help Document"
+COM_SERMONDISTRIBUTOR_TYPE_LOCAL_LISTING="Local Listing"
+COM_SERMONDISTRIBUTOR_TYPE_PREACHER="Preacher"
+COM_SERMONDISTRIBUTOR_TYPE_SERIES="Series"
+COM_SERMONDISTRIBUTOR_TYPE_SERMON="Sermon"
+COM_SERMONDISTRIBUTOR_TYPE_STATISTIC="Statistic"
COM_SERMONDISTRIBUTOR_UNKNOWN_ERROR_HAS_OCCURRED="Unknown error has occurred."
COM_SERMONDISTRIBUTOR_UPDATE_LOCAL_LINKS_OF_TARGET_S_EXTERNAL_SOURCE="Update Local Links of (target %s) External Source"
COM_SERMONDISTRIBUTOR_UP_TO_DATE="Up to date"
diff --git a/admin/layouts/preacher/sermons_fullwidth.php b/admin/layouts/preacher/sermons_fullwidth.php
index 86c1615f..0916c729 100644
--- a/admin/layouts/preacher/sermons_fullwidth.php
+++ b/admin/layouts/preacher/sermons_fullwidth.php
@@ -81,7 +81,7 @@ $can = SermondistributorHelper::getActions('sermon');
-
+
|
diff --git a/admin/layouts/series/sermons_fullwidth.php b/admin/layouts/series/sermons_fullwidth.php
index 4fe0208b..6886d9ed 100644
--- a/admin/layouts/series/sermons_fullwidth.php
+++ b/admin/layouts/series/sermons_fullwidth.php
@@ -76,7 +76,7 @@ $can = SermondistributorHelper::getActions('sermon');
|
-
+
|
diff --git a/admin/models/external_source.php b/admin/models/external_source.php
index 4d4432d7..399fbe16 100644
--- a/admin/models/external_source.php
+++ b/admin/models/external_source.php
@@ -251,8 +251,23 @@ class SermondistributorModelExternal_source extends JModelAdmin
{
// set load data option
$options['load_data'] = $loadData;
+ // check if xpath was set in options
+ $xpath = false;
+ if (isset($options['xpath']))
+ {
+ $xpath = $options['xpath'];
+ unset($options['xpath']);
+ }
+ // check if clear form was set in options
+ $clear = false;
+ if (isset($options['clear']))
+ {
+ $clear = $options['clear'];
+ unset($options['clear']);
+ }
+
// Get the form.
- $form = $this->loadForm('com_sermondistributor.external_source', 'external_source', $options);
+ $form = $this->loadForm('com_sermondistributor.external_source', 'external_source', $options, $clear, $xpath);
if (empty($form))
{
@@ -484,6 +499,8 @@ class SermondistributorModelExternal_source extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_sermondistributor.external_source', $data);
}
return $data;
diff --git a/admin/models/external_sources.php b/admin/models/external_sources.php
index bdb5e7e1..3cc0718f 100644
--- a/admin/models/external_sources.php
+++ b/admin/models/external_sources.php
@@ -111,37 +111,34 @@ class SermondistributorModelExternal_sources extends JModelList
// load parent items
$items = parent::getItems();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('external_source.access', 'com_sermondistributor.external_source.' . (int) $item->id) && JFactory::getUser()->authorise('external_source.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('external_source.access', 'com_sermondistributor.external_source.' . (int) $item->id) && $user->authorise('external_source.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
continue;
}
- // convert filetypes
+ // decode filetypes
$filetypesArray = json_decode($item->filetypes, true);
if (SermondistributorHelper::checkArray($filetypesArray))
{
- $filetypesNames = '';
- $counter = 0;
+ $filetypesNames = array();
foreach ($filetypesArray as $filetypes)
{
- if ($counter == 0)
- {
- $filetypesNames .= JText::_($this->selectionTranslation($filetypes, 'filetypes'));
- }
- else
- {
- $filetypesNames .= ', '.JText::_($this->selectionTranslation($filetypes, 'filetypes'));
- }
- $counter++;
+ $filetypesNames[] = JText::_($this->selectionTranslation($filetypes, 'filetypes'));
}
- $item->filetypes = $filetypesNames;
+ $item->filetypes = implode(', ', $filetypesNames);
}
}
}
@@ -330,17 +327,23 @@ class SermondistributorModelExternal_sources extends JModelList
/**
* Method to get list export data.
*
+ * @param array $pks The ids of the items to get
+ * @param JUser $user The user making the request
+ *
* @return mixed An array of data items on success, false on failure.
*/
- public function getExportData($pks)
+ public function getExportData($pks, $user = null)
{
// setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // Set a value to know this is exporting method.
+ // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
- // Get the user object.
- $user = JFactory::getUser();
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
@@ -367,12 +370,13 @@ class SermondistributorModelExternal_sources extends JModelList
// Get the encryption object.
$basic = new FOFEncryptAes($basickey);
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('external_source.access', 'com_sermondistributor.external_source.' . (int) $item->id) && JFactory::getUser()->authorise('external_source.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('external_source.access', 'com_sermondistributor.external_source.' . (int) $item->id) && $user->authorise('external_source.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
diff --git a/admin/models/forms/preacher.xml b/admin/models/forms/preacher.xml
index 608eb548..70772ea9 100644
--- a/admin/models/forms/preacher.xml
+++ b/admin/models/forms/preacher.xml
@@ -157,7 +157,6 @@
class="text_area"
required="false"
filter="STRING"
- validate="email"
message="COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_MESSAGE"
hint="COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_HINT"
/>
diff --git a/admin/models/help_document.php b/admin/models/help_document.php
index f73d5e60..b2d8cfa4 100644
--- a/admin/models/help_document.php
+++ b/admin/models/help_document.php
@@ -157,8 +157,23 @@ class SermondistributorModelHelp_document extends JModelAdmin
{
// set load data option
$options['load_data'] = $loadData;
+ // check if xpath was set in options
+ $xpath = false;
+ if (isset($options['xpath']))
+ {
+ $xpath = $options['xpath'];
+ unset($options['xpath']);
+ }
+ // check if clear form was set in options
+ $clear = false;
+ if (isset($options['clear']))
+ {
+ $clear = $options['clear'];
+ unset($options['clear']);
+ }
+
// Get the form.
- $form = $this->loadForm('com_sermondistributor.help_document', 'help_document', $options);
+ $form = $this->loadForm('com_sermondistributor.help_document', 'help_document', $options, $clear, $xpath);
if (empty($form))
{
@@ -388,6 +403,8 @@ class SermondistributorModelHelp_document extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_sermondistributor.help_document', $data);
}
return $data;
diff --git a/admin/models/help_documents.php b/admin/models/help_documents.php
index 5453f2ed..31a31547 100644
--- a/admin/models/help_documents.php
+++ b/admin/models/help_documents.php
@@ -115,12 +115,18 @@ class SermondistributorModelHelp_documents extends JModelList
// load parent items
$items = parent::getItems();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('help_document.access', 'com_sermondistributor.help_document.' . (int) $item->id) && JFactory::getUser()->authorise('help_document.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('help_document.access', 'com_sermondistributor.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
@@ -131,21 +137,12 @@ class SermondistributorModelHelp_documents extends JModelList
$groupsArray = json_decode($item->groups, true);
if (SermondistributorHelper::checkArray($groupsArray))
{
- $groupsNames = '';
- $counter = 0;
+ $groupsNames = array();
foreach ($groupsArray as $groups)
{
- if ($counter == 0)
- {
- $groupsNames .= SermondistributorHelper::getGroupName($groups);
- }
- else
- {
- $groupsNames .= ', '.SermondistributorHelper::getGroupName($groups);
- }
- $counter++;
+ $groupsNames[] = SermondistributorHelper::getGroupName($groups);
}
- $item->groups = $groupsNames;
+ $item->groups = implode(', ', $groupsNames);
}
}
}
@@ -299,17 +296,23 @@ class SermondistributorModelHelp_documents extends JModelList
/**
* Method to get list export data.
*
+ * @param array $pks The ids of the items to get
+ * @param JUser $user The user making the request
+ *
* @return mixed An array of data items on success, false on failure.
*/
- public function getExportData($pks)
+ public function getExportData($pks, $user = null)
{
// setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // Set a value to know this is exporting method.
+ // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
- // Get the user object.
- $user = JFactory::getUser();
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
@@ -337,12 +340,13 @@ class SermondistributorModelHelp_documents extends JModelList
{
$items = $db->loadObjectList();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('help_document.access', 'com_sermondistributor.help_document.' . (int) $item->id) && JFactory::getUser()->authorise('help_document.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('help_document.access', 'com_sermondistributor.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
diff --git a/admin/models/local_listing.php b/admin/models/local_listing.php
index 1d7b95f8..0f84d1eb 100644
--- a/admin/models/local_listing.php
+++ b/admin/models/local_listing.php
@@ -186,8 +186,23 @@ class SermondistributorModelLocal_listing extends JModelAdmin
{
// set load data option
$options['load_data'] = $loadData;
+ // check if xpath was set in options
+ $xpath = false;
+ if (isset($options['xpath']))
+ {
+ $xpath = $options['xpath'];
+ unset($options['xpath']);
+ }
+ // check if clear form was set in options
+ $clear = false;
+ if (isset($options['clear']))
+ {
+ $clear = $options['clear'];
+ unset($options['clear']);
+ }
+
// Get the form.
- $form = $this->loadForm('com_sermondistributor.local_listing', 'local_listing', $options);
+ $form = $this->loadForm('com_sermondistributor.local_listing', 'local_listing', $options, $clear, $xpath);
if (empty($form))
{
@@ -521,6 +536,8 @@ class SermondistributorModelLocal_listing extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_sermondistributor.local_listing', $data);
}
return $data;
diff --git a/admin/models/local_listings.php b/admin/models/local_listings.php
index a7882e9b..bc04169d 100644
--- a/admin/models/local_listings.php
+++ b/admin/models/local_listings.php
@@ -115,12 +115,18 @@ class SermondistributorModelLocal_listings extends JModelList
// load parent items
$items = parent::getItems();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('local_listing.access', 'com_sermondistributor.local_listing.' . (int) $item->id) && JFactory::getUser()->authorise('local_listing.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('local_listing.access', 'com_sermondistributor.local_listing.' . (int) $item->id) && $user->authorise('local_listing.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
@@ -242,17 +248,23 @@ class SermondistributorModelLocal_listings extends JModelList
/**
* Method to get list export data.
*
+ * @param array $pks The ids of the items to get
+ * @param JUser $user The user making the request
+ *
* @return mixed An array of data items on success, false on failure.
*/
- public function getExportData($pks)
+ public function getExportData($pks, $user = null)
{
// setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // Set a value to know this is exporting method.
+ // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
- // Get the user object.
- $user = JFactory::getUser();
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
@@ -279,12 +291,13 @@ class SermondistributorModelLocal_listings extends JModelList
// Get the encryption object.
$basic = new FOFEncryptAes($basickey);
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('local_listing.access', 'com_sermondistributor.local_listing.' . (int) $item->id) && JFactory::getUser()->authorise('local_listing.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('local_listing.access', 'com_sermondistributor.local_listing.' . (int) $item->id) && $user->authorise('local_listing.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
diff --git a/admin/models/preacher.php b/admin/models/preacher.php
index 7faa3a29..839e735f 100644
--- a/admin/models/preacher.php
+++ b/admin/models/preacher.php
@@ -199,12 +199,18 @@ class SermondistributorModelPreacher extends JModelAdmin
{
$items = $db->loadObjectList();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $item->id) && JFactory::getUser()->authorise('sermon.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $item->id) && $user->authorise('sermon.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
@@ -284,8 +290,23 @@ class SermondistributorModelPreacher extends JModelAdmin
{
// set load data option
$options['load_data'] = $loadData;
+ // check if xpath was set in options
+ $xpath = false;
+ if (isset($options['xpath']))
+ {
+ $xpath = $options['xpath'];
+ unset($options['xpath']);
+ }
+ // check if clear form was set in options
+ $clear = false;
+ if (isset($options['clear']))
+ {
+ $clear = $options['clear'];
+ unset($options['clear']);
+ }
+
// Get the form.
- $form = $this->loadForm('com_sermondistributor.preacher', 'preacher', $options);
+ $form = $this->loadForm('com_sermondistributor.preacher', 'preacher', $options, $clear, $xpath);
if (empty($form))
{
@@ -517,6 +538,8 @@ class SermondistributorModelPreacher extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_sermondistributor.preacher', $data);
}
return $data;
diff --git a/admin/models/preachers.php b/admin/models/preachers.php
index bfcb42fb..4c37b051 100644
--- a/admin/models/preachers.php
+++ b/admin/models/preachers.php
@@ -103,12 +103,18 @@ class SermondistributorModelPreachers extends JModelList
// load parent items
$items = parent::getItems();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $item->id) && JFactory::getUser()->authorise('preacher.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $item->id) && $user->authorise('preacher.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
@@ -196,17 +202,23 @@ class SermondistributorModelPreachers extends JModelList
/**
* Method to get list export data.
*
+ * @param array $pks The ids of the items to get
+ * @param JUser $user The user making the request
+ *
* @return mixed An array of data items on success, false on failure.
*/
- public function getExportData($pks)
+ public function getExportData($pks, $user = null)
{
// setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // Set a value to know this is exporting method.
+ // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
- // Get the user object.
- $user = JFactory::getUser();
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
@@ -234,12 +246,13 @@ class SermondistributorModelPreachers extends JModelList
{
$items = $db->loadObjectList();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $item->id) && JFactory::getUser()->authorise('preacher.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $item->id) && $user->authorise('preacher.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
diff --git a/admin/models/series.php b/admin/models/series.php
index d9b39f80..7d0a2798 100644
--- a/admin/models/series.php
+++ b/admin/models/series.php
@@ -198,12 +198,18 @@ class SermondistributorModelSeries extends JModelAdmin
{
$items = $db->loadObjectList();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $item->id) && JFactory::getUser()->authorise('sermon.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $item->id) && $user->authorise('sermon.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
@@ -283,8 +289,23 @@ class SermondistributorModelSeries extends JModelAdmin
{
// set load data option
$options['load_data'] = $loadData;
+ // check if xpath was set in options
+ $xpath = false;
+ if (isset($options['xpath']))
+ {
+ $xpath = $options['xpath'];
+ unset($options['xpath']);
+ }
+ // check if clear form was set in options
+ $clear = false;
+ if (isset($options['clear']))
+ {
+ $clear = $options['clear'];
+ unset($options['clear']);
+ }
+
// Get the form.
- $form = $this->loadForm('com_sermondistributor.series', 'series', $options);
+ $form = $this->loadForm('com_sermondistributor.series', 'series', $options, $clear, $xpath);
if (empty($form))
{
@@ -516,6 +537,8 @@ class SermondistributorModelSeries extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_sermondistributor.series', $data);
}
return $data;
diff --git a/admin/models/series_list.php b/admin/models/series_list.php
index 977b49a8..01509e42 100644
--- a/admin/models/series_list.php
+++ b/admin/models/series_list.php
@@ -99,12 +99,18 @@ class SermondistributorModelSeries_list extends JModelList
// load parent items
$items = parent::getItems();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('series.access', 'com_sermondistributor.series.' . (int) $item->id) && JFactory::getUser()->authorise('series.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('series.access', 'com_sermondistributor.series.' . (int) $item->id) && $user->authorise('series.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
@@ -192,17 +198,23 @@ class SermondistributorModelSeries_list extends JModelList
/**
* Method to get list export data.
*
+ * @param array $pks The ids of the items to get
+ * @param JUser $user The user making the request
+ *
* @return mixed An array of data items on success, false on failure.
*/
- public function getExportData($pks)
+ public function getExportData($pks, $user = null)
{
// setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // Set a value to know this is exporting method.
+ // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
- // Get the user object.
- $user = JFactory::getUser();
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
@@ -230,12 +242,13 @@ class SermondistributorModelSeries_list extends JModelList
{
$items = $db->loadObjectList();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('series.access', 'com_sermondistributor.series.' . (int) $item->id) && JFactory::getUser()->authorise('series.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('series.access', 'com_sermondistributor.series.' . (int) $item->id) && $user->authorise('series.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
diff --git a/admin/models/sermon.php b/admin/models/sermon.php
index 89c02fbd..025f966e 100644
--- a/admin/models/sermon.php
+++ b/admin/models/sermon.php
@@ -235,12 +235,18 @@ class SermondistributorModelSermon extends JModelAdmin
{
$items = $db->loadObjectList();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $item->id) && JFactory::getUser()->authorise('statistic.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $item->id) && $user->authorise('statistic.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
@@ -269,8 +275,23 @@ class SermondistributorModelSermon extends JModelAdmin
{
// set load data option
$options['load_data'] = $loadData;
+ // check if xpath was set in options
+ $xpath = false;
+ if (isset($options['xpath']))
+ {
+ $xpath = $options['xpath'];
+ unset($options['xpath']);
+ }
+ // check if clear form was set in options
+ $clear = false;
+ if (isset($options['clear']))
+ {
+ $clear = $options['clear'];
+ unset($options['clear']);
+ }
+
// Get the form.
- $form = $this->loadForm('com_sermondistributor.sermon', 'sermon', $options);
+ $form = $this->loadForm('com_sermondistributor.sermon', 'sermon', $options, $clear, $xpath);
if (empty($form))
{
@@ -502,6 +523,8 @@ class SermondistributorModelSermon extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_sermondistributor.sermon', $data);
}
return $data;
diff --git a/admin/models/sermondistributor.php b/admin/models/sermondistributor.php
index 8308ac5e..35a11e43 100644
--- a/admin/models/sermondistributor.php
+++ b/admin/models/sermondistributor.php
@@ -381,7 +381,7 @@ class SermondistributorModelSermondistributor extends JModelList
$document->addScript(JURI::root() . "media/com_sermondistributor/js/marked.js");
$document->addScriptDeclaration('
var token = "'.JSession::getFormToken().'";
- var noticeboard = "https://www.vdm.io/sermondistributor-noticeboard-md";
+ var noticeboard = "https://vdm.bz/sermondistributor-noticeboard-md";
jQuery(document).ready(function () {
jQuery.get(noticeboard)
.success(function(board) {
@@ -416,9 +416,9 @@ class SermondistributorModelSermondistributor extends JModelList
// to check is READ/NEW
function getIS(type,notice){
if(type == 1){
- var getUrl = "index.php?option=com_sermondistributor&task=ajax.isNew&format=json";
+ var getUrl = "index.php?option=com_sermondistributor&task=ajax.isNew&format=json&raw=true";
} else if (type == 2) {
- var getUrl = "index.php?option=com_sermondistributor&task=ajax.isRead&format=json";
+ var getUrl = "index.php?option=com_sermondistributor&task=ajax.isRead&format=json&raw=true";
}
if(token.length > 0 && notice.length){
var request = "token="+token+"¬ice="+notice;
@@ -426,23 +426,24 @@ class SermondistributorModelSermondistributor extends JModelList
return jQuery.ajax({
type: "POST",
url: getUrl,
- dataType: "jsonp",
+ dataType: "json",
data: request,
- jsonp: "callback"
+ jsonp: false
});
}
- // nice little dot trick :)
- jQuery(document).ready( function($) {
- var x=0;
- setInterval(function() {
- var dots = "";
- x++;
- for (var y=0; y < x%8; y++) {
- dots+=".";
- }
- $(".loading-dots").text(dots);
- } , 500);
- });');
+
+// nice little dot trick :)
+jQuery(document).ready( function($) {
+ var x=0;
+ setInterval(function() {
+ var dots = "";
+ x++;
+ for (var y=0; y < x%8; y++) {
+ dots+=".";
+ }
+ $(".loading-dots").text(dots);
+ } , 500);
+});');
return ' '.JText::_('COM_SERMONDISTRIBUTOR_THE_NOTICE_BOARD_IS_LOADING').'.. ';
}
diff --git a/admin/models/sermons.php b/admin/models/sermons.php
index 7df270b9..17cfefc6 100644
--- a/admin/models/sermons.php
+++ b/admin/models/sermons.php
@@ -131,12 +131,18 @@ class SermondistributorModelSermons extends JModelList
// load parent items
$items = parent::getItems();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $item->id) && JFactory::getUser()->authorise('sermon.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $item->id) && $user->authorise('sermon.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
@@ -327,17 +333,23 @@ class SermondistributorModelSermons extends JModelList
/**
* Method to get list export data.
*
+ * @param array $pks The ids of the items to get
+ * @param JUser $user The user making the request
+ *
* @return mixed An array of data items on success, false on failure.
*/
- public function getExportData($pks)
+ public function getExportData($pks, $user = null)
{
// setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // Set a value to know this is exporting method.
+ // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
- // Get the user object.
- $user = JFactory::getUser();
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
@@ -365,12 +377,13 @@ class SermondistributorModelSermons extends JModelList
{
$items = $db->loadObjectList();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $item->id) && JFactory::getUser()->authorise('sermon.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $item->id) && $user->authorise('sermon.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
diff --git a/admin/models/statistic.php b/admin/models/statistic.php
index c77dce16..6a6f147a 100644
--- a/admin/models/statistic.php
+++ b/admin/models/statistic.php
@@ -140,8 +140,23 @@ class SermondistributorModelStatistic extends JModelAdmin
{
// set load data option
$options['load_data'] = $loadData;
+ // check if xpath was set in options
+ $xpath = false;
+ if (isset($options['xpath']))
+ {
+ $xpath = $options['xpath'];
+ unset($options['xpath']);
+ }
+ // check if clear form was set in options
+ $clear = false;
+ if (isset($options['clear']))
+ {
+ $clear = $options['clear'];
+ unset($options['clear']);
+ }
+
// Get the form.
- $form = $this->loadForm('com_sermondistributor.statistic', 'statistic', $options);
+ $form = $this->loadForm('com_sermondistributor.statistic', 'statistic', $options, $clear, $xpath);
if (empty($form))
{
@@ -373,6 +388,8 @@ class SermondistributorModelStatistic extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_sermondistributor.statistic', $data);
}
return $data;
diff --git a/admin/models/statistics.php b/admin/models/statistics.php
index 9645dded..8d045eeb 100644
--- a/admin/models/statistics.php
+++ b/admin/models/statistics.php
@@ -115,12 +115,18 @@ class SermondistributorModelStatistics extends JModelList
// load parent items
$items = parent::getItems();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $item->id) && JFactory::getUser()->authorise('statistic.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $item->id) && $user->authorise('statistic.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
@@ -235,17 +241,23 @@ class SermondistributorModelStatistics extends JModelList
/**
* Method to get list export data.
*
+ * @param array $pks The ids of the items to get
+ * @param JUser $user The user making the request
+ *
* @return mixed An array of data items on success, false on failure.
*/
- public function getExportData($pks)
+ public function getExportData($pks, $user = null)
{
// setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // Set a value to know this is exporting method.
+ // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
- // Get the user object.
- $user = JFactory::getUser();
+ // Get the user object if not set.
+ if (!isset($user) || !SermondistributorHelper::checkObject($user))
+ {
+ $user = JFactory::getUser();
+ }
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
@@ -273,12 +285,13 @@ class SermondistributorModelStatistics extends JModelList
{
$items = $db->loadObjectList();
- // set values to display correctly.
+ // Set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- $access = (JFactory::getUser()->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $item->id) && JFactory::getUser()->authorise('statistic.access', 'com_sermondistributor'));
+ // Remove items the user can't access.
+ $access = ($user->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $item->id) && $user->authorise('statistic.access', 'com_sermondistributor'));
if (!$access)
{
unset($items[$nr]);
diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql
index 007c1f7e..d81e2447 100644
--- a/admin/sql/install.mysql.utf8.sql
+++ b/admin/sql/install.mysql.utf8.sql
@@ -23,13 +23,13 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_preacher` (
`metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL,
PRIMARY KEY (`id`),
+ KEY `idx_name` (`name`),
+ KEY `idx_alias` (`alias`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`),
- KEY `idx_state` (`published`),
- KEY `idx_name` (`name`),
- KEY `idx_alias` (`alias`)
+ KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_sermon` (
@@ -68,18 +68,18 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_sermon` (
`metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL,
PRIMARY KEY (`id`),
- KEY `idx_access` (`access`),
- KEY `idx_checkout` (`checked_out`),
- KEY `idx_createdby` (`created_by`),
- KEY `idx_modifiedby` (`modified_by`),
- KEY `idx_state` (`published`),
KEY `idx_name` (`name`),
KEY `idx_preacher` (`preacher`),
KEY `idx_series` (`series`),
KEY `idx_catid` (`catid`),
KEY `idx_link_type` (`link_type`),
KEY `idx_alias` (`alias`),
- KEY `idx_build` (`build`)
+ KEY `idx_build` (`build`),
+ KEY `idx_access` (`access`),
+ KEY `idx_checkout` (`checked_out`),
+ KEY `idx_createdby` (`created_by`),
+ KEY `idx_modifiedby` (`modified_by`),
+ KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_series` (
@@ -106,13 +106,13 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_series` (
`metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL,
PRIMARY KEY (`id`),
+ KEY `idx_name` (`name`),
+ KEY `idx_alias` (`alias`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`),
- KEY `idx_state` (`published`),
- KEY `idx_name` (`name`),
- KEY `idx_alias` (`alias`)
+ KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_statistic` (
@@ -139,15 +139,15 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_statistic` (
`metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL,
PRIMARY KEY (`id`),
+ KEY `idx_filename` (`filename`),
+ KEY `idx_sermon` (`sermon`),
+ KEY `idx_preacher` (`preacher`),
+ KEY `idx_series` (`series`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`),
- KEY `idx_state` (`published`),
- KEY `idx_filename` (`filename`),
- KEY `idx_sermon` (`sermon`),
- KEY `idx_preacher` (`preacher`),
- KEY `idx_series` (`series`)
+ KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_external_source` (
@@ -177,16 +177,16 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_external_source` (
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
- KEY `idx_checkout` (`checked_out`),
- KEY `idx_createdby` (`created_by`),
- KEY `idx_modifiedby` (`modified_by`),
- KEY `idx_state` (`published`),
KEY `idx_description` (`description`),
KEY `idx_externalsources` (`externalsources`),
KEY `idx_update_method` (`update_method`),
KEY `idx_build` (`build`),
KEY `idx_dropboxoptions` (`dropboxoptions`),
- KEY `idx_permissiontype` (`permissiontype`)
+ KEY `idx_permissiontype` (`permissiontype`),
+ KEY `idx_checkout` (`checked_out`),
+ KEY `idx_createdby` (`created_by`),
+ KEY `idx_modifiedby` (`modified_by`),
+ KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_local_listing` (
@@ -210,13 +210,13 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_local_listing` (
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
+ KEY `idx_name` (`name`),
+ KEY `idx_build` (`build`),
+ KEY `idx_key` (`key`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`),
- KEY `idx_state` (`published`),
- KEY `idx_name` (`name`),
- KEY `idx_build` (`build`),
- KEY `idx_key` (`key`)
+ KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_help_document` (
@@ -250,17 +250,17 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_help_document` (
`metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL,
PRIMARY KEY (`id`),
- KEY `idx_access` (`access`),
- KEY `idx_checkout` (`checked_out`),
- KEY `idx_createdby` (`created_by`),
- KEY `idx_modifiedby` (`modified_by`),
- KEY `idx_state` (`published`),
KEY `idx_title` (`title`),
KEY `idx_type` (`type`),
KEY `idx_location` (`location`),
KEY `idx_article` (`article`),
KEY `idx_target` (`target`),
- KEY `idx_alias` (`alias`)
+ KEY `idx_alias` (`alias`),
+ KEY `idx_access` (`access`),
+ KEY `idx_checkout` (`checked_out`),
+ KEY `idx_createdby` (`created_by`),
+ KEY `idx_modifiedby` (`modified_by`),
+ KEY `idx_state` (`published`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
diff --git a/admin/views/manual_updater/view.html.php b/admin/views/manual_updater/view.html.php
index e9269e6d..8826a46c 100644
--- a/admin/views/manual_updater/view.html.php
+++ b/admin/views/manual_updater/view.html.php
@@ -57,7 +57,7 @@ class SermondistributorViewManual_updater extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
- throw new Exception(implode("\n", $errors), 500);
+ throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -147,6 +147,7 @@ class SermondistributorViewManual_updater extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
$this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
}
// add the document default css file
diff --git a/admin/views/sermons/tmpl/default_head.php b/admin/views/sermons/tmpl/default_head.php
index baeb7a3d..f99b1a7f 100644
--- a/admin/views/sermons/tmpl/default_head.php
+++ b/admin/views/sermons/tmpl/default_head.php
@@ -55,7 +55,7 @@ defined('_JEXEC') or die('Restricted access');
listDirn, $this->listOrder); ?>
|
- listDirn, $this->listOrder); ?>
+ listDirn, $this->listOrder); ?>
|
listDirn, $this->listOrder); ?>
diff --git a/admin/views/sermons/view.html.php b/admin/views/sermons/view.html.php
index 1b998d46..2af04150 100644
--- a/admin/views/sermons/view.html.php
+++ b/admin/views/sermons/view.html.php
@@ -384,7 +384,7 @@ class SermondistributorViewSermons extends JViewLegacy
'g.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL'),
'h.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL'),
'a.short_description' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL'),
- 'c.category_title' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMON_CATEGORY'),
+ 'c.category_title' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES'),
'a.link_type' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL'),
'a.source' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID')
diff --git a/script.php b/script.php
index 1f0aa2b7..fc634153 100644
--- a/script.php
+++ b/script.php
@@ -767,7 +767,207 @@ class com_sermondistributorInstallerScript
// If succesfully remove sermondistributor add queued success message.
$app->enqueueMessage(JText::_('All related items was removed from the #__assets table'));
}
-
+
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Set app if not set already.
+ if (!isset($app))
+ {
+ $app = JFactory::getApplication();
+ }
+ // Remove Sermondistributor from the action_logs_extensions table
+ $sermondistributor_action_logs_extensions = array( $db->quoteName('extension') . ' = ' . $db->quote('com_sermondistributor') );
+ // Create a new query object.
+ $query = $db->getQuery(true);
+ $query->delete($db->quoteName('#__action_logs_extensions'));
+ $query->where($sermondistributor_action_logs_extensions);
+ $db->setQuery($query);
+ // Execute the query to remove Sermondistributor
+ $sermondistributor_removed_done = $db->execute();
+ if ($sermondistributor_removed_done)
+ {
+ // If successfully remove Sermondistributor add queued success message.
+ $app->enqueueMessage(JText::_('The com_sermondistributor extension was removed from the #__action_logs_extensions table'));
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Set app if not set already.
+ if (!isset($app))
+ {
+ $app = JFactory::getApplication();
+ }
+ // Remove Sermondistributor Preacher from the action_log_config table
+ $preacher_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') );
+ // Create a new query object.
+ $query = $db->getQuery(true);
+ $query->delete($db->quoteName('#__action_log_config'));
+ $query->where($preacher_action_log_config);
+ $db->setQuery($query);
+ // Execute the query to remove com_sermondistributor.preacher
+ $preacher_action_log_config_done = $db->execute();
+ if ($preacher_action_log_config_done)
+ {
+ // If successfully removed Sermondistributor Preacher add queued success message.
+ $app->enqueueMessage(JText::_('The com_sermondistributor.preacher type alias was removed from the #__action_log_config table'));
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Set app if not set already.
+ if (!isset($app))
+ {
+ $app = JFactory::getApplication();
+ }
+ // Remove Sermondistributor Sermon from the action_log_config table
+ $sermon_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') );
+ // Create a new query object.
+ $query = $db->getQuery(true);
+ $query->delete($db->quoteName('#__action_log_config'));
+ $query->where($sermon_action_log_config);
+ $db->setQuery($query);
+ // Execute the query to remove com_sermondistributor.sermon
+ $sermon_action_log_config_done = $db->execute();
+ if ($sermon_action_log_config_done)
+ {
+ // If successfully removed Sermondistributor Sermon add queued success message.
+ $app->enqueueMessage(JText::_('The com_sermondistributor.sermon type alias was removed from the #__action_log_config table'));
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Set app if not set already.
+ if (!isset($app))
+ {
+ $app = JFactory::getApplication();
+ }
+ // Remove Sermondistributor Series from the action_log_config table
+ $series_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') );
+ // Create a new query object.
+ $query = $db->getQuery(true);
+ $query->delete($db->quoteName('#__action_log_config'));
+ $query->where($series_action_log_config);
+ $db->setQuery($query);
+ // Execute the query to remove com_sermondistributor.series
+ $series_action_log_config_done = $db->execute();
+ if ($series_action_log_config_done)
+ {
+ // If successfully removed Sermondistributor Series add queued success message.
+ $app->enqueueMessage(JText::_('The com_sermondistributor.series type alias was removed from the #__action_log_config table'));
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Set app if not set already.
+ if (!isset($app))
+ {
+ $app = JFactory::getApplication();
+ }
+ // Remove Sermondistributor Statistic from the action_log_config table
+ $statistic_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') );
+ // Create a new query object.
+ $query = $db->getQuery(true);
+ $query->delete($db->quoteName('#__action_log_config'));
+ $query->where($statistic_action_log_config);
+ $db->setQuery($query);
+ // Execute the query to remove com_sermondistributor.statistic
+ $statistic_action_log_config_done = $db->execute();
+ if ($statistic_action_log_config_done)
+ {
+ // If successfully removed Sermondistributor Statistic add queued success message.
+ $app->enqueueMessage(JText::_('The com_sermondistributor.statistic type alias was removed from the #__action_log_config table'));
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Set app if not set already.
+ if (!isset($app))
+ {
+ $app = JFactory::getApplication();
+ }
+ // Remove Sermondistributor External_source from the action_log_config table
+ $external_source_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.external_source') );
+ // Create a new query object.
+ $query = $db->getQuery(true);
+ $query->delete($db->quoteName('#__action_log_config'));
+ $query->where($external_source_action_log_config);
+ $db->setQuery($query);
+ // Execute the query to remove com_sermondistributor.external_source
+ $external_source_action_log_config_done = $db->execute();
+ if ($external_source_action_log_config_done)
+ {
+ // If successfully removed Sermondistributor External_source add queued success message.
+ $app->enqueueMessage(JText::_('The com_sermondistributor.external_source type alias was removed from the #__action_log_config table'));
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Set app if not set already.
+ if (!isset($app))
+ {
+ $app = JFactory::getApplication();
+ }
+ // Remove Sermondistributor Local_listing from the action_log_config table
+ $local_listing_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.local_listing') );
+ // Create a new query object.
+ $query = $db->getQuery(true);
+ $query->delete($db->quoteName('#__action_log_config'));
+ $query->where($local_listing_action_log_config);
+ $db->setQuery($query);
+ // Execute the query to remove com_sermondistributor.local_listing
+ $local_listing_action_log_config_done = $db->execute();
+ if ($local_listing_action_log_config_done)
+ {
+ // If successfully removed Sermondistributor Local_listing add queued success message.
+ $app->enqueueMessage(JText::_('The com_sermondistributor.local_listing type alias was removed from the #__action_log_config table'));
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Set app if not set already.
+ if (!isset($app))
+ {
+ $app = JFactory::getApplication();
+ }
+ // Remove Sermondistributor Help_document from the action_log_config table
+ $help_document_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') );
+ // Create a new query object.
+ $query = $db->getQuery(true);
+ $query->delete($db->quoteName('#__action_log_config'));
+ $query->where($help_document_action_log_config);
+ $db->setQuery($query);
+ // Execute the query to remove com_sermondistributor.help_document
+ $help_document_action_log_config_done = $db->execute();
+ if ($help_document_action_log_config_done)
+ {
+ // If successfully removed Sermondistributor Help_document add queued success message.
+ $app->enqueueMessage(JText::_('The com_sermondistributor.help_document type alias was removed from the #__action_log_config table'));
+ }
// little notice as after service, in case of bad experience with component.
echo 'Did something go wrong? Are you disappointed?
Please let me know at joomla@vdm.io.
@@ -1059,7 +1259,138 @@ class com_sermondistributorInstallerScript
echo '
- ';
+ ';
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the sermondistributor action logs extensions object.
+ $sermondistributor_action_logs_extensions = new stdClass();
+ $sermondistributor_action_logs_extensions->extension = 'com_sermondistributor';
+
+ // Set the object into the action logs extensions table.
+ $sermondistributor_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $sermondistributor_action_logs_extensions);
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the preacher action log config object.
+ $preacher_action_log_config = new stdClass();
+ $preacher_action_log_config->type_title = 'PREACHER';
+ $preacher_action_log_config->type_alias = 'com_sermondistributor.preacher';
+ $preacher_action_log_config->id_holder = 'id';
+ $preacher_action_log_config->title_holder = 'name';
+ $preacher_action_log_config->table_name = '#__sermondistributor_preacher';
+ $preacher_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Set the object into the action log config table.
+ $preacher_Inserted = $db->insertObject('#__action_log_config', $preacher_action_log_config);
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the sermon action log config object.
+ $sermon_action_log_config = new stdClass();
+ $sermon_action_log_config->type_title = 'SERMON';
+ $sermon_action_log_config->type_alias = 'com_sermondistributor.sermon';
+ $sermon_action_log_config->id_holder = 'id';
+ $sermon_action_log_config->title_holder = 'name';
+ $sermon_action_log_config->table_name = '#__sermondistributor_sermon';
+ $sermon_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Set the object into the action log config table.
+ $sermon_Inserted = $db->insertObject('#__action_log_config', $sermon_action_log_config);
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the series action log config object.
+ $series_action_log_config = new stdClass();
+ $series_action_log_config->type_title = 'SERIES';
+ $series_action_log_config->type_alias = 'com_sermondistributor.series';
+ $series_action_log_config->id_holder = 'id';
+ $series_action_log_config->title_holder = 'name';
+ $series_action_log_config->table_name = '#__sermondistributor_series';
+ $series_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Set the object into the action log config table.
+ $series_Inserted = $db->insertObject('#__action_log_config', $series_action_log_config);
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the statistic action log config object.
+ $statistic_action_log_config = new stdClass();
+ $statistic_action_log_config->type_title = 'STATISTIC';
+ $statistic_action_log_config->type_alias = 'com_sermondistributor.statistic';
+ $statistic_action_log_config->id_holder = 'id';
+ $statistic_action_log_config->title_holder = 'filename';
+ $statistic_action_log_config->table_name = '#__sermondistributor_statistic';
+ $statistic_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Set the object into the action log config table.
+ $statistic_Inserted = $db->insertObject('#__action_log_config', $statistic_action_log_config);
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the external_source action log config object.
+ $external_source_action_log_config = new stdClass();
+ $external_source_action_log_config->type_title = 'EXTERNAL_SOURCE';
+ $external_source_action_log_config->type_alias = 'com_sermondistributor.external_source';
+ $external_source_action_log_config->id_holder = 'id';
+ $external_source_action_log_config->title_holder = 'description';
+ $external_source_action_log_config->table_name = '#__sermondistributor_external_source';
+ $external_source_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Set the object into the action log config table.
+ $external_source_Inserted = $db->insertObject('#__action_log_config', $external_source_action_log_config);
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the local_listing action log config object.
+ $local_listing_action_log_config = new stdClass();
+ $local_listing_action_log_config->type_title = 'LOCAL_LISTING';
+ $local_listing_action_log_config->type_alias = 'com_sermondistributor.local_listing';
+ $local_listing_action_log_config->id_holder = 'id';
+ $local_listing_action_log_config->title_holder = 'name';
+ $local_listing_action_log_config->table_name = '#__sermondistributor_local_listing';
+ $local_listing_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Set the object into the action log config table.
+ $local_listing_Inserted = $db->insertObject('#__action_log_config', $local_listing_action_log_config);
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the help_document action log config object.
+ $help_document_action_log_config = new stdClass();
+ $help_document_action_log_config->type_title = 'HELP_DOCUMENT';
+ $help_document_action_log_config->type_alias = 'com_sermondistributor.help_document';
+ $help_document_action_log_config->id_holder = 'id';
+ $help_document_action_log_config->title_holder = 'title';
+ $help_document_action_log_config->table_name = '#__sermondistributor_help_document';
+ $help_document_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Set the object into the action log config table.
+ $help_document_Inserted = $db->insertObject('#__action_log_config', $help_document_action_log_config);
}
// do any updates needed
if ($type === 'update')
@@ -1391,7 +1722,268 @@ class com_sermondistributorInstallerScript
echo '
- Upgrade to Version 2.0.2 Was Successful! Let us know if anything is not working as expected.';
+ Upgrade to Version 2.0.2 Was Successful! Let us know if anything is not working as expected.';
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the sermondistributor action logs extensions object.
+ $sermondistributor_action_logs_extensions = new stdClass();
+ $sermondistributor_action_logs_extensions->extension = 'com_sermondistributor';
+
+ // Check if sermondistributor action log extension is already in action logs extensions DB.
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('id')));
+ $query->from($db->quoteName('#__action_logs_extensions'));
+ $query->where($db->quoteName('extension') . ' LIKE '. $db->quote($sermondistributor_action_logs_extensions->extension));
+ $db->setQuery($query);
+ $db->execute();
+
+ // Set the object into the action logs extensions table if not found.
+ if (!$db->getNumRows())
+ {
+ $sermondistributor_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $sermondistributor_action_logs_extensions);
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the preacher action log config object.
+ $preacher_action_log_config = new stdClass();
+ $preacher_action_log_config->id = null;
+ $preacher_action_log_config->type_title = 'PREACHER';
+ $preacher_action_log_config->type_alias = 'com_sermondistributor.preacher';
+ $preacher_action_log_config->id_holder = 'id';
+ $preacher_action_log_config->title_holder = 'name';
+ $preacher_action_log_config->table_name = '#__sermondistributor_preacher';
+ $preacher_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Check if preacher action log config is already in action_log_config DB.
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('id')));
+ $query->from($db->quoteName('#__action_log_config'));
+ $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($preacher_action_log_config->type_alias));
+ $db->setQuery($query);
+ $db->execute();
+
+ // Set the object into the content types table.
+ if ($db->getNumRows())
+ {
+ $preacher_action_log_config->id = $db->loadResult();
+ $preacher_action_log_config_Updated = $db->updateObject('#__action_log_config', $preacher_action_log_config, 'id');
+ }
+ else
+ {
+ $preacher_action_log_config_Inserted = $db->insertObject('#__action_log_config', $preacher_action_log_config);
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the sermon action log config object.
+ $sermon_action_log_config = new stdClass();
+ $sermon_action_log_config->id = null;
+ $sermon_action_log_config->type_title = 'SERMON';
+ $sermon_action_log_config->type_alias = 'com_sermondistributor.sermon';
+ $sermon_action_log_config->id_holder = 'id';
+ $sermon_action_log_config->title_holder = 'name';
+ $sermon_action_log_config->table_name = '#__sermondistributor_sermon';
+ $sermon_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Check if sermon action log config is already in action_log_config DB.
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('id')));
+ $query->from($db->quoteName('#__action_log_config'));
+ $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($sermon_action_log_config->type_alias));
+ $db->setQuery($query);
+ $db->execute();
+
+ // Set the object into the content types table.
+ if ($db->getNumRows())
+ {
+ $sermon_action_log_config->id = $db->loadResult();
+ $sermon_action_log_config_Updated = $db->updateObject('#__action_log_config', $sermon_action_log_config, 'id');
+ }
+ else
+ {
+ $sermon_action_log_config_Inserted = $db->insertObject('#__action_log_config', $sermon_action_log_config);
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the series action log config object.
+ $series_action_log_config = new stdClass();
+ $series_action_log_config->id = null;
+ $series_action_log_config->type_title = 'SERIES';
+ $series_action_log_config->type_alias = 'com_sermondistributor.series';
+ $series_action_log_config->id_holder = 'id';
+ $series_action_log_config->title_holder = 'name';
+ $series_action_log_config->table_name = '#__sermondistributor_series';
+ $series_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Check if series action log config is already in action_log_config DB.
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('id')));
+ $query->from($db->quoteName('#__action_log_config'));
+ $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($series_action_log_config->type_alias));
+ $db->setQuery($query);
+ $db->execute();
+
+ // Set the object into the content types table.
+ if ($db->getNumRows())
+ {
+ $series_action_log_config->id = $db->loadResult();
+ $series_action_log_config_Updated = $db->updateObject('#__action_log_config', $series_action_log_config, 'id');
+ }
+ else
+ {
+ $series_action_log_config_Inserted = $db->insertObject('#__action_log_config', $series_action_log_config);
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the statistic action log config object.
+ $statistic_action_log_config = new stdClass();
+ $statistic_action_log_config->id = null;
+ $statistic_action_log_config->type_title = 'STATISTIC';
+ $statistic_action_log_config->type_alias = 'com_sermondistributor.statistic';
+ $statistic_action_log_config->id_holder = 'id';
+ $statistic_action_log_config->title_holder = 'filename';
+ $statistic_action_log_config->table_name = '#__sermondistributor_statistic';
+ $statistic_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Check if statistic action log config is already in action_log_config DB.
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('id')));
+ $query->from($db->quoteName('#__action_log_config'));
+ $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($statistic_action_log_config->type_alias));
+ $db->setQuery($query);
+ $db->execute();
+
+ // Set the object into the content types table.
+ if ($db->getNumRows())
+ {
+ $statistic_action_log_config->id = $db->loadResult();
+ $statistic_action_log_config_Updated = $db->updateObject('#__action_log_config', $statistic_action_log_config, 'id');
+ }
+ else
+ {
+ $statistic_action_log_config_Inserted = $db->insertObject('#__action_log_config', $statistic_action_log_config);
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the external_source action log config object.
+ $external_source_action_log_config = new stdClass();
+ $external_source_action_log_config->id = null;
+ $external_source_action_log_config->type_title = 'EXTERNAL_SOURCE';
+ $external_source_action_log_config->type_alias = 'com_sermondistributor.external_source';
+ $external_source_action_log_config->id_holder = 'id';
+ $external_source_action_log_config->title_holder = 'description';
+ $external_source_action_log_config->table_name = '#__sermondistributor_external_source';
+ $external_source_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Check if external_source action log config is already in action_log_config DB.
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('id')));
+ $query->from($db->quoteName('#__action_log_config'));
+ $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($external_source_action_log_config->type_alias));
+ $db->setQuery($query);
+ $db->execute();
+
+ // Set the object into the content types table.
+ if ($db->getNumRows())
+ {
+ $external_source_action_log_config->id = $db->loadResult();
+ $external_source_action_log_config_Updated = $db->updateObject('#__action_log_config', $external_source_action_log_config, 'id');
+ }
+ else
+ {
+ $external_source_action_log_config_Inserted = $db->insertObject('#__action_log_config', $external_source_action_log_config);
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the local_listing action log config object.
+ $local_listing_action_log_config = new stdClass();
+ $local_listing_action_log_config->id = null;
+ $local_listing_action_log_config->type_title = 'LOCAL_LISTING';
+ $local_listing_action_log_config->type_alias = 'com_sermondistributor.local_listing';
+ $local_listing_action_log_config->id_holder = 'id';
+ $local_listing_action_log_config->title_holder = 'name';
+ $local_listing_action_log_config->table_name = '#__sermondistributor_local_listing';
+ $local_listing_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Check if local_listing action log config is already in action_log_config DB.
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('id')));
+ $query->from($db->quoteName('#__action_log_config'));
+ $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($local_listing_action_log_config->type_alias));
+ $db->setQuery($query);
+ $db->execute();
+
+ // Set the object into the content types table.
+ if ($db->getNumRows())
+ {
+ $local_listing_action_log_config->id = $db->loadResult();
+ $local_listing_action_log_config_Updated = $db->updateObject('#__action_log_config', $local_listing_action_log_config, 'id');
+ }
+ else
+ {
+ $local_listing_action_log_config_Inserted = $db->insertObject('#__action_log_config', $local_listing_action_log_config);
+ }
+
+ // Set db if not set already.
+ if (!isset($db))
+ {
+ $db = JFactory::getDbo();
+ }
+ // Create the help_document action log config object.
+ $help_document_action_log_config = new stdClass();
+ $help_document_action_log_config->id = null;
+ $help_document_action_log_config->type_title = 'HELP_DOCUMENT';
+ $help_document_action_log_config->type_alias = 'com_sermondistributor.help_document';
+ $help_document_action_log_config->id_holder = 'id';
+ $help_document_action_log_config->title_holder = 'title';
+ $help_document_action_log_config->table_name = '#__sermondistributor_help_document';
+ $help_document_action_log_config->text_prefix = 'COM_SERMONDISTRIBUTOR';
+
+ // Check if help_document action log config is already in action_log_config DB.
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('id')));
+ $query->from($db->quoteName('#__action_log_config'));
+ $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($help_document_action_log_config->type_alias));
+ $db->setQuery($query);
+ $db->execute();
+
+ // Set the object into the content types table.
+ if ($db->getNumRows())
+ {
+ $help_document_action_log_config->id = $db->loadResult();
+ $help_document_action_log_config_Updated = $db->updateObject('#__action_log_config', $help_document_action_log_config, 'id');
+ }
+ else
+ {
+ $help_document_action_log_config_Inserted = $db->insertObject('#__action_log_config', $help_document_action_log_config);
+ }
}
return true;
}
diff --git a/sermondistributor.xml b/sermondistributor.xml
index 64c145fc..d21c023b 100644
--- a/sermondistributor.xml
+++ b/sermondistributor.xml
@@ -1,7 +1,7 @@
COM_SERMONDISTRIBUTOR
- 14th August, 2019
+ 5th January, 2020
Llewellyn van der Merwe
joomla@vdm.io
https://www.vdm.io/
diff --git a/site/controllers/download.php b/site/controllers/download.php
index 6716e45e..fe8cb4b3 100644
--- a/site/controllers/download.php
+++ b/site/controllers/download.php
@@ -62,11 +62,11 @@ class SermondistributorControllerDownload extends JControllerLegacy
// we must first count this download
if (SermondistributorHelper::countDownload($keys,$filename))
{
- $model = SermondistributorHelper::getModel('preachers', JPATH_COMPONENT_ADMINISTRATOR);
- if (($result = $model->getSomeStuff($filename)) !== false)
- {
+ // $model = SermondistributorHelper::getModel('preachers', JPATH_COMPONENT_ADMINISTRATOR);
+ // if (($result = $model->getSomeStuff($filename)) !== false)
+ // {
// on success do some thing more (code here)
- }
+ // }
// get Site name
$config = JFactory::getConfig();
$vendor = $config->get('sitename');
diff --git a/site/helpers/sermondistributor.php b/site/helpers/sermondistributor.php
index e3ad0615..439f806e 100644
--- a/site/helpers/sermondistributor.php
+++ b/site/helpers/sermondistributor.php
@@ -25,11 +25,21 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
+use Joomla\CMS\Language\Language;
+use Joomla\String\StringHelper;
+use Joomla\Utilities\ArrayHelper;
+
/**
* Sermondistributor component helper
*/
abstract class SermondistributorHelper
-{
+{
+ /**
+ * The Main Active Language
+ *
+ * @var string
+ */
+ public static $langTag;
/**
* The global params
@@ -673,7 +683,7 @@ abstract class SermondistributorHelper
*
* @var array
**/
- protected static $fileExtentionToMimeType = array(
+ protected static $fileExtensionToMimeType = array(
'123' => 'application/vnd.lotus-1-2-3',
'3dml' => 'text/vnd.in3d.3dml',
'3ds' => 'image/x-3ds',
@@ -1680,9 +1690,9 @@ abstract class SermondistributorHelper
// get the extension form file
$extension = \strtolower(\pathinfo($file, \PATHINFO_EXTENSION));
// check if we have the extension listed
- if (isset(self::$fileExtentionToMimeType[$extension]))
+ if (isset(self::$fileExtensionToMimeType[$extension]))
{
- return self::$fileExtentionToMimeType[$extension];
+ return self::$fileExtensionToMimeType[$extension];
}
elseif (function_exists('mime_content_type'))
{
@@ -1698,6 +1708,61 @@ abstract class SermondistributorHelper
return 'application/octet-stream';
}
+ /**
+ * Get the file extensions
+ *
+ * @param string $target The targeted/filter option
+ * @param boolean $sorted The multidimensional grouping sort (only if targeted filter is used)
+ *
+ * @return array All the extensions (targeted & sorted)
+ *
+ */
+ public static function getFileExtensions($target = null, $sorted = false)
+ {
+ // we have some in-house grouping/filters :)
+ $filters = array(
+ 'image' => array('image', 'font', 'model'),
+ 'document' => array('application', 'text', 'chemical', 'message'),
+ 'media' => array('video', 'audio'),
+ 'file' => array('image', 'application', 'text', 'video', 'audio'),
+ 'all' => array('application', 'text', 'chemical', 'message', 'image', 'font', 'model', 'video', 'audio', 'x-conference')
+ );
+ // sould we filter
+ if ($target)
+ {
+ // the bucket to get extensions
+ $fileextensions = array();
+ // check if filter exist (if not return empty array)
+ if (isset($filters[$target]))
+ {
+ foreach (self::$fileExtensionToMimeType as $extension => $mimetype)
+ {
+ // get the key mime type
+ $mimearr = explode("/", $mimetype, 2);
+ // check if this file extension should be added
+ if (in_array($mimearr[0], $filters[$target]))
+ {
+ if ($sorted)
+ {
+ if (!isset($fileextensions[$mimearr[0]]))
+ {
+ $fileextensions[$mimearr[0]] = array();
+ }
+ $fileextensions[$mimearr[0]][$extension] = $extension;
+ }
+ else
+ {
+ $fileextensions[$extension] = $extension;
+ }
+ }
+ }
+ }
+ return $fileextensions;
+ }
+ // we just return all file extensions
+ return array_keys(self::$fileExtensionToMimeType);
+ }
+
protected static function getDownloadFileName(&$sermon, $file, $type)
{
// first get file name and file type
@@ -2681,7 +2746,7 @@ abstract class SermondistributorHelper
// return opened values
return $open;
}
-
+
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
{
// do some table foot work
@@ -3023,7 +3088,7 @@ abstract class SermondistributorHelper
}
}
// check if there are any view values remaining
- if (count($_result))
+ if (count((array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);
@@ -3137,7 +3202,7 @@ abstract class SermondistributorHelper
* @return object
*
*/
- public static function getFieldObject($attributes, $default = '', $options = null)
+ public static function getFieldObject(&$attributes, $default = '', $options = null)
{
// make sure we have attributes and a type value
if (self::checkArray($attributes) && isset($attributes['type']))
@@ -3148,7 +3213,31 @@ abstract class SermondistributorHelper
jimport('joomla.form.form');
}
// get field type
- $field = JFormHelper::loadFieldType($attributes['type'],true);
+ $field = JFormHelper::loadFieldType($attributes['type'], true);
+ // get field xml
+ $XML = self::getFieldXML($attributes, $options);
+ // setup the field
+ $field->setup($XML, $default);
+ // return the field object
+ return $field;
+ }
+ return false;
+ }
+
+ /**
+ * get the field xml
+ *
+ * @param array $attributes The array of attributes
+ * @param array $options The options to apply to the XML element
+ *
+ * @return object
+ *
+ */
+ public static function getFieldXML(&$attributes, $options = null)
+ {
+ // make sure we have attributes and a type value
+ if (self::checkArray($attributes))
+ {
// start field xml
$XML = new SimpleXMLElement('');
// load the attributes
@@ -3159,10 +3248,8 @@ abstract class SermondistributorHelper
// load the options
self::xmlAddOptions($XML, $options);
}
- // setup the field
- $field->setup($XML, $default);
- // return the field object
- return $field;
+ // return the field xml
+ return $XML;
}
return false;
}
@@ -3403,7 +3490,15 @@ abstract class SermondistributorHelper
{
$query->from($db->quoteName('#_'.$main.'_'.$table));
}
- $query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
+ // add strings to array search
+ if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator)
+ {
+ $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")');
+ }
+ else
+ {
+ $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')');
+ }
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
@@ -3465,14 +3560,19 @@ abstract class SermondistributorHelper
* @param string $views The related list view name
* @param mixed $target Only get this permission (like edit, create, delete)
* @param string $component The target component
+ * @param object $user The user whose permissions we are loading
*
* @return object The JObject of permission/authorised actions
*
**/
- public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'sermondistributor')
+ public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'sermondistributor', $user = 'null')
{
- // get the user object
- $user = JFactory::getUser();
+ // load the user if not given
+ if (!self::checkObject($user))
+ {
+ // get the user object
+ $user = JFactory::getUser();
+ }
// load the JObject
$result = new JObject;
// make view name safe (just incase)
@@ -3859,6 +3959,8 @@ abstract class SermondistributorHelper
$string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string);
+ // Transliterate string
+ $string = self::transliterate($string);
// remove all and keep only characters
if ($keepOnlyCharacters)
{
@@ -3927,6 +4029,19 @@ abstract class SermondistributorHelper
return '';
}
+ public static function transliterate($string)
+ {
+ // set tag only once
+ if (!self::checkString(self::$langTag))
+ {
+ // get global value
+ self::$langTag = JComponentHelper::getParams('com_sermondistributor')->get('language', 'en-GB');
+ }
+ // Transliterate on the language requested
+ $lang = Language::getInstance(self::$langTag);
+ return $lang->transliterate($string);
+ }
+
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
{
if (self::checkString($var))
diff --git a/site/views/api/view.html.php b/site/views/api/view.html.php
index a4c04c6f..1da4194d 100644
--- a/site/views/api/view.html.php
+++ b/site/views/api/view.html.php
@@ -53,7 +53,7 @@ class SermondistributorViewApi extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
- throw new Exception(implode("\n", $errors), 500);
+ throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -109,6 +109,7 @@ class SermondistributorViewApi extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
$this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
}
// add the document default css file
diff --git a/site/views/categories/view.html.php b/site/views/categories/view.html.php
index 141cdf32..c6d17391 100644
--- a/site/views/categories/view.html.php
+++ b/site/views/categories/view.html.php
@@ -74,7 +74,7 @@ class SermondistributorViewCategories extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
- throw new Exception(implode("\n", $errors), 500);
+ throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -165,6 +165,7 @@ class SermondistributorViewCategories extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
$this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
}
diff --git a/site/views/category/view.html.php b/site/views/category/view.html.php
index decafe76..571f927b 100644
--- a/site/views/category/view.html.php
+++ b/site/views/category/view.html.php
@@ -44,7 +44,7 @@ class SermondistributorViewCategory extends JViewLegacy
$this->pagination = $this->get('Pagination');
$this->category = $this->get('Category');
// add a hit to the category
- if ($this->hit($this->category->id))
+ if ($this->hit($this->category->id, true))
{
$this->category->hits++;
}
@@ -90,7 +90,7 @@ class SermondistributorViewCategory extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
- throw new Exception(implode("\n", $errors), 500);
+ throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -104,7 +104,7 @@ class SermondistributorViewCategory extends JViewLegacy
*
* @return boolean True if successful;
*/
- public function hit($pk = 0)
+ public function hit($pk = 0, $category = false)
{
if ($pk)
{
@@ -120,8 +120,15 @@ class SermondistributorViewCategory extends JViewLegacy
$conditions = array(
$db->quoteName('id') . ' = ' . $pk
);
-
- $query->update($db->quoteName('#__sermondistributor_category'))->set($fields)->where($conditions);
+ // set for category
+ if ($category)
+ {
+ $query->update($db->quoteName('#__categories'))->set($fields)->where($conditions);
+ }
+ else
+ {
+ $query->update($db->quoteName('#__sermondistributor_category'))->set($fields)->where($conditions);
+ }
$db->setQuery($query);
return $db->execute();
@@ -229,6 +236,7 @@ class SermondistributorViewCategory extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
$this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
}
diff --git a/site/views/preacher/view.html.php b/site/views/preacher/view.html.php
index ec2c9efc..3aa0effb 100644
--- a/site/views/preacher/view.html.php
+++ b/site/views/preacher/view.html.php
@@ -84,7 +84,7 @@ class SermondistributorViewPreacher extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
- throw new Exception(implode("\n", $errors), 500);
+ throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -98,7 +98,7 @@ class SermondistributorViewPreacher extends JViewLegacy
*
* @return boolean True if successful;
*/
- public function hit($pk = 0)
+ public function hit($pk = 0, $category = false)
{
if ($pk)
{
@@ -114,8 +114,15 @@ class SermondistributorViewPreacher extends JViewLegacy
$conditions = array(
$db->quoteName('id') . ' = ' . $pk
);
-
- $query->update($db->quoteName('#__sermondistributor_preacher'))->set($fields)->where($conditions);
+ // set for category
+ if ($category)
+ {
+ $query->update($db->quoteName('#__categories'))->set($fields)->where($conditions);
+ }
+ else
+ {
+ $query->update($db->quoteName('#__sermondistributor_preacher'))->set($fields)->where($conditions);
+ }
$db->setQuery($query);
return $db->execute();
@@ -224,6 +231,7 @@ class SermondistributorViewPreacher extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
$this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
}
diff --git a/site/views/preachers/view.html.php b/site/views/preachers/view.html.php
index d54f72dd..4820b9da 100644
--- a/site/views/preachers/view.html.php
+++ b/site/views/preachers/view.html.php
@@ -74,7 +74,7 @@ class SermondistributorViewPreachers extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
- throw new Exception(implode("\n", $errors), 500);
+ throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -180,6 +180,7 @@ class SermondistributorViewPreachers extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
$this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
}
diff --git a/site/views/series/view.html.php b/site/views/series/view.html.php
index 32347375..710695b2 100644
--- a/site/views/series/view.html.php
+++ b/site/views/series/view.html.php
@@ -84,7 +84,7 @@ class SermondistributorViewSeries extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
- throw new Exception(implode("\n", $errors), 500);
+ throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -98,7 +98,7 @@ class SermondistributorViewSeries extends JViewLegacy
*
* @return boolean True if successful;
*/
- public function hit($pk = 0)
+ public function hit($pk = 0, $category = false)
{
if ($pk)
{
@@ -114,8 +114,15 @@ class SermondistributorViewSeries extends JViewLegacy
$conditions = array(
$db->quoteName('id') . ' = ' . $pk
);
-
- $query->update($db->quoteName('#__sermondistributor_series'))->set($fields)->where($conditions);
+ // set for category
+ if ($category)
+ {
+ $query->update($db->quoteName('#__categories'))->set($fields)->where($conditions);
+ }
+ else
+ {
+ $query->update($db->quoteName('#__sermondistributor_series'))->set($fields)->where($conditions);
+ }
$db->setQuery($query);
return $db->execute();
@@ -223,6 +230,7 @@ class SermondistributorViewSeries extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
$this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
}
diff --git a/site/views/serieslist/view.html.php b/site/views/serieslist/view.html.php
index 9bd6c431..b1ee5ce2 100644
--- a/site/views/serieslist/view.html.php
+++ b/site/views/serieslist/view.html.php
@@ -74,7 +74,7 @@ class SermondistributorViewSerieslist extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
- throw new Exception(implode("\n", $errors), 500);
+ throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -180,6 +180,7 @@ class SermondistributorViewSerieslist extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
$this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
}
diff --git a/site/views/sermon/view.html.php b/site/views/sermon/view.html.php
index e0fb1edd..ecff0003 100644
--- a/site/views/sermon/view.html.php
+++ b/site/views/sermon/view.html.php
@@ -58,7 +58,7 @@ class SermondistributorViewSermon extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
- throw new Exception(implode("\n", $errors), 500);
+ throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -72,7 +72,7 @@ class SermondistributorViewSermon extends JViewLegacy
*
* @return boolean True if successful;
*/
- public function hit($pk = 0)
+ public function hit($pk = 0, $category = false)
{
if ($pk)
{
@@ -88,8 +88,15 @@ class SermondistributorViewSermon extends JViewLegacy
$conditions = array(
$db->quoteName('id') . ' = ' . $pk
);
-
- $query->update($db->quoteName('#__sermondistributor_sermon'))->set($fields)->where($conditions);
+ // set for category
+ if ($category)
+ {
+ $query->update($db->quoteName('#__categories'))->set($fields)->where($conditions);
+ }
+ else
+ {
+ $query->update($db->quoteName('#__sermondistributor_sermon'))->set($fields)->where($conditions);
+ }
$db->setQuery($query);
return $db->execute();
@@ -198,6 +205,7 @@ class SermondistributorViewSermon extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
$this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
}
// load the meta description
|