Updated with JCB v2.10.9

This commit is contained in:
Llewellyn van der Merwe 2020-01-06 00:53:13 +02:00
parent 0ea8a253df
commit 8275919cab
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
39 changed files with 1314 additions and 237 deletions

View File

@ -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) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Sermon Distributor](https://www.vdm.io/) + *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015 + *First Build*: 22nd October, 2015
+ *Last Build*: 14th August, 2019 + *Last Build*: 5th January, 2020
+ *Version*: 2.0.x + *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time :hourglass: ## 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)) 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**, > (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.) > never making one mistake or taking any coffee break.)
+ *Line count*: **67680** + *Line count*: **68757**
+ *File count*: **445** + *File count*: **445**
+ *Folder count*: **93** + *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: > (with the following break down:
> **debugging @47hours** = codingtime / 4; > **debugging @48hours** = codingtime / 4;
> **planning @27hours** = codingtime / 7; > **planning @27hours** = codingtime / 7;
> **mapping @19hours** = codingtime / 10; > **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) (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**, > (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.) > 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). > 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) > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -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) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Sermon Distributor](https://www.vdm.io/) + *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015 + *First Build*: 22nd October, 2015
+ *Last Build*: 14th August, 2019 + *Last Build*: 5th January, 2020
+ *Version*: 2.0.x + *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time :hourglass: ## 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)) 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**, > (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.) > never making one mistake or taking any coffee break.)
+ *Line count*: **67680** + *Line count*: **68757**
+ *File count*: **445** + *File count*: **445**
+ *Folder count*: **93** + *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: > (with the following break down:
> **debugging @47hours** = codingtime / 4; > **debugging @48hours** = codingtime / 4;
> **planning @27hours** = codingtime / 7; > **planning @27hours** = codingtime / 7;
> **mapping @19hours** = codingtime / 10; > **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) (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**, > (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.) > 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). > 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) > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -140,7 +140,7 @@ class SermondistributorControllerAjax extends JControllerLegacy
$returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$idNameValue = $jinput->get('idName', NULL, 'WORD'); $idNameValue = $jinput->get('idName', NULL, 'WORD');
$ojectValue = $jinput->get('oject', NULL, 'STRING'); $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); $result = $this->getModel('ajax')->getBuildTable($idNameValue, $ojectValue);
} }
@ -257,7 +257,7 @@ class SermondistributorControllerAjax extends JControllerLegacy
$targetValue = $jinput->get('target', NULL, 'INT'); $targetValue = $jinput->get('target', NULL, 'INT');
$typeValue = $jinput->get('type', NULL, 'INT'); $typeValue = $jinput->get('type', NULL, 'INT');
$sleutelValue = $jinput->get('sleutel', NULL, 'CMD'); $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); $result = $this->getModel('ajax')->updateLocalListingExternal($idValue, $targetValue, $typeValue, $sleutelValue);
} }

View File

@ -25,11 +25,21 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Language;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Sermondistributor component helper. * Sermondistributor component helper.
*/ */
abstract class SermondistributorHelper abstract class SermondistributorHelper
{ {
/**
* The Main Active Language
*
* @var string
*/
public static $langTag;
/** /**
* The global params * The global params
@ -673,7 +683,7 @@ abstract class SermondistributorHelper
* *
* @var array * @var array
**/ **/
protected static $fileExtentionToMimeType = array( protected static $fileExtensionToMimeType = array(
'123' => 'application/vnd.lotus-1-2-3', '123' => 'application/vnd.lotus-1-2-3',
'3dml' => 'text/vnd.in3d.3dml', '3dml' => 'text/vnd.in3d.3dml',
'3ds' => 'image/x-3ds', '3ds' => 'image/x-3ds',
@ -1680,9 +1690,9 @@ abstract class SermondistributorHelper
// get the extension form file // get the extension form file
$extension = \strtolower(\pathinfo($file, \PATHINFO_EXTENSION)); $extension = \strtolower(\pathinfo($file, \PATHINFO_EXTENSION));
// check if we have the extension listed // 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')) elseif (function_exists('mime_content_type'))
{ {
@ -1698,6 +1708,61 @@ abstract class SermondistributorHelper
return 'application/octet-stream'; 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) protected static function getDownloadFileName(&$sermon, $file, $type)
{ {
// first get file name and file type // first get file name and file type
@ -2681,6 +2746,7 @@ abstract class SermondistributorHelper
// return opened values // return opened values
return $open; return $open;
} }
/** /**
* Load the Component xml manifest. * 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')) 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_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')) 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->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->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
@ -3353,14 +3427,19 @@ abstract class SermondistributorHelper
* @param string $views The related list view name * @param string $views The related list view name
* @param mixed $target Only get this permission (like edit, create, delete) * @param mixed $target Only get this permission (like edit, create, delete)
* @param string $component The target component * @param string $component The target component
* @param object $user The user whose permissions we are loading
* *
* @return object The JObject of permission/authorised actions * @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')
{
// load the user if not given
if (!self::checkObject($user))
{ {
// get the user object // get the user object
$user = JFactory::getUser(); $user = JFactory::getUser();
}
// load the JObject // load the JObject
$result = new JObject; $result = new JObject;
// make view name safe (just incase) // make view name safe (just incase)
@ -3694,7 +3773,7 @@ abstract class SermondistributorHelper
} }
} }
// check if there are any view values remaining // check if there are any view values remaining
if (count($_result)) if (count((array) $_result))
{ {
$_result = json_encode($_result); $_result = json_encode($_result);
$_result = array($_result); $_result = array($_result);
@ -3819,7 +3898,31 @@ abstract class SermondistributorHelper
jimport('joomla.form.form'); jimport('joomla.form.form');
} }
// get field type // 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 // start field xml
$XML = new SimpleXMLElement('<field/>'); $XML = new SimpleXMLElement('<field/>');
// load the attributes // load the attributes
@ -3830,10 +3933,8 @@ abstract class SermondistributorHelper
// load the options // load the options
self::xmlAddOptions($XML, $options); self::xmlAddOptions($XML, $options);
} }
// setup the field // return the field xml
$field->setup($XML, $default); return $XML;
// return the field object
return $field;
} }
return false; return false;
} }
@ -4081,6 +4182,8 @@ abstract class SermondistributorHelper
$string = trim($string); $string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string); $string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string); $string = preg_replace('/\s+/', ' ', $string);
// Transliterate string
$string = self::transliterate($string);
// remove all and keep only characters // remove all and keep only characters
if ($keepOnlyCharacters) if ($keepOnlyCharacters)
{ {
@ -4149,6 +4252,19 @@ abstract class SermondistributorHelper
return ''; 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) public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
{ {
if (self::checkString($var)) if (self::checkString($var))

View File

@ -343,7 +343,7 @@ COM_SERMONDISTRIBUTOR_DASHBOARD_PREACHER_ADD="Add&nbsp;Preacher<br /><br />"
COM_SERMONDISTRIBUTOR_DASHBOARD_SERIES_ADD="Add&nbsp;Series<br /><br />" COM_SERMONDISTRIBUTOR_DASHBOARD_SERIES_ADD="Add&nbsp;Series<br /><br />"
COM_SERMONDISTRIBUTOR_DASHBOARD_SERIES_LIST="Series List<br /><br />" COM_SERMONDISTRIBUTOR_DASHBOARD_SERIES_LIST="Series List<br /><br />"
COM_SERMONDISTRIBUTOR_DASHBOARD_SERMONS="Sermons<br /><br />" COM_SERMONDISTRIBUTOR_DASHBOARD_SERMONS="Sermons<br /><br />"
COM_SERMONDISTRIBUTOR_DASHBOARD_SERMONS_CATID="Category &nbsp;For<br />Sermons" COM_SERMONDISTRIBUTOR_DASHBOARD_SERMONS_CATID="Categories&nbsp;For<br />Sermons"
COM_SERMONDISTRIBUTOR_DASHBOARD_SERMON_ADD="Add&nbsp;Sermon<br /><br />" COM_SERMONDISTRIBUTOR_DASHBOARD_SERMON_ADD="Add&nbsp;Sermon<br /><br />"
COM_SERMONDISTRIBUTOR_DASHBOARD_STATISTICS="Statistics<br /><br />" COM_SERMONDISTRIBUTOR_DASHBOARD_STATISTICS="Statistics<br /><br />"
COM_SERMONDISTRIBUTOR_DATE="Date" 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_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_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_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_WAV=".wav"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WMV=".wmv" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WMV=".wmv"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLS=".xls" 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_LABEL="URL"
COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_URL_MESSAGE="Error! Please add url here." 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_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_HELP_MANAGER="Help"
COM_SERMONDISTRIBUTOR_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BSERMONDISTRIBUTORB_WILL_NOT_FUNCTION_CORRECTLYP="<h2>Curl Not Found!</h2><p>Please setup curl on your system, or <b>sermondistributor</b> will not function correctly!</p>" COM_SERMONDISTRIBUTOR_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BSERMONDISTRIBUTORB_WILL_NOT_FUNCTION_CORRECTLYP="<h2>Curl Not Found!</h2><p>Please setup curl on your system, or <b>sermondistributor</b> will not function correctly!</p>"
COM_SERMONDISTRIBUTOR_IMPORT_CONTINUE="Continue" 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_LABEL="Shared-URL"
COM_SERMONDISTRIBUTOR_LOCAL_LISTING_URL_MESSAGE="Error! Please add shared-URL here." 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_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_CLEARED_SUCCESSFULLY="Local listing was cleared successfully."
COM_SERMONDISTRIBUTOR_LOCAL_LISTING_WAS_NOT_CLEARED="Local listing was not cleared." COM_SERMONDISTRIBUTOR_LOCAL_LISTING_WAS_NOT_CLEARED="Local listing was not cleared."
COM_SERMONDISTRIBUTOR_MANUAL_UPDATER="Manual Updater" 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="Email"
COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_DESCRIPTION="Enter Email" COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_DESCRIPTION="Enter Email"
COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_HINT="demo@example.com" COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_HINT="demo@example.com"
COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_LABEL="Email" COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_LABEL="Email<br><small>not required</small>"
COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_MESSAGE="Error! Please add email address here." 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_ERROR_UNIQUE_ALIAS="Another Preacher has the same alias."
COM_SERMONDISTRIBUTOR_PREACHER_ICON="Icon" 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_SERMONS="Sermons"
COM_SERMONDISTRIBUTOR_PREACHER_STATUS="Status" 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_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="Website"
COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE_DESCRIPTION="Enter website address" COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE_DESCRIPTION="Enter website address"
COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE_HINT="http://www.example.com" 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_SERMONS="Sermons"
COM_SERMONDISTRIBUTOR_SERIES_STATUS="Status" 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_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_SERMON="Sermon"
COM_SERMONDISTRIBUTOR_SERMONS="Sermons" COM_SERMONDISTRIBUTOR_SERMONS="Sermons"
COM_SERMONDISTRIBUTOR_SERMONS_ACCESS="Sermons Access" 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="Series"
COM_SERMONDISTRIBUTOR_SERMON_SERIES_DESCRIPTION="Select the series this sermon belongs to." COM_SERMONDISTRIBUTOR_SERMON_SERIES_DESCRIPTION="Select the series this sermon belongs to."
COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL="Series" 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="Short Description"
COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_DESCRIPTION="Enter short description" COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_DESCRIPTION="Enter short description"
COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_HINT="Your Short Description Here" 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_LABEL="File URL"
COM_SERMONDISTRIBUTOR_SERMON_URL_MESSAGE="Error! Please add sermon url here." 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_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_SHAREDURL="Shared-url"
COM_SERMONDISTRIBUTOR_SOURCE_STATUS_REPORT="Source Status Report." COM_SERMONDISTRIBUTOR_SOURCE_STATUS_REPORT="Source Status Report."
COM_SERMONDISTRIBUTOR_STATISTIC="Statistic" 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_SERMON_LABEL="Sermon"
COM_SERMONDISTRIBUTOR_STATISTIC_STATUS="Status" 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_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_DASHBOARD="Dashboard"
COM_SERMONDISTRIBUTOR_SUBMENU_EXTERNAL_SOURCES="External Sources" COM_SERMONDISTRIBUTOR_SUBMENU_EXTERNAL_SOURCES="External Sources"
COM_SERMONDISTRIBUTOR_SUBMENU_HELP_DOCUMENTS="Help Documents" 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_THIS_SOURCE_HAS_NO_LOCAL_LISTING_SET="This source has no local listing set."
COM_SERMONDISTRIBUTOR_TOTAL_DOWNLOADS="total downloads" COM_SERMONDISTRIBUTOR_TOTAL_DOWNLOADS="total downloads"
COM_SERMONDISTRIBUTOR_TRASHED="Trashed" 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_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_UPDATE_LOCAL_LINKS_OF_TARGET_S_EXTERNAL_SOURCE="Update Local Links of (target %s) External Source"
COM_SERMONDISTRIBUTOR_UP_TO_DATE="Up to date" COM_SERMONDISTRIBUTOR_UP_TO_DATE="Up to date"

View File

@ -81,7 +81,7 @@ $can = SermondistributorHelper::getActions('sermon');
<?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL'); ?>
</th> </th>
<th data-hide="phone,tablet"> <th data-hide="phone,tablet">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMON_CATEGORY'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES'); ?>
</th> </th>
<th data-hide="phone,tablet"> <th data-hide="phone,tablet">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL'); ?>

View File

@ -76,7 +76,7 @@ $can = SermondistributorHelper::getActions('sermon');
<?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL'); ?>
</th> </th>
<th data-hide="phone,tablet"> <th data-hide="phone,tablet">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMON_CATEGORY'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES'); ?>
</th> </th>
<th data-hide="phone,tablet"> <th data-hide="phone,tablet">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL'); ?>

View File

@ -251,8 +251,23 @@ class SermondistributorModelExternal_source extends JModelAdmin
{ {
// set load data option // set load data option
$options['load_data'] = $loadData; $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. // 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)) if (empty($form))
{ {
@ -484,6 +499,8 @@ class SermondistributorModelExternal_source extends JModelAdmin
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_sermondistributor.external_source', $data);
} }
return $data; return $data;

View File

@ -111,37 +111,34 @@ class SermondistributorModelExternal_sources extends JModelList
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
continue; continue;
} }
// convert filetypes // decode filetypes
$filetypesArray = json_decode($item->filetypes, true); $filetypesArray = json_decode($item->filetypes, true);
if (SermondistributorHelper::checkArray($filetypesArray)) if (SermondistributorHelper::checkArray($filetypesArray))
{ {
$filetypesNames = ''; $filetypesNames = array();
$counter = 0;
foreach ($filetypesArray as $filetypes) foreach ($filetypesArray as $filetypes)
{ {
if ($counter == 0) $filetypesNames[] = JText::_($this->selectionTranslation($filetypes, 'filetypes'));
{
$filetypesNames .= JText::_($this->selectionTranslation($filetypes, 'filetypes'));
} }
else $item->filetypes = implode(', ', $filetypesNames);
{
$filetypesNames .= ', '.JText::_($this->selectionTranslation($filetypes, 'filetypes'));
}
$counter++;
}
$item->filetypes = $filetypesNames;
} }
} }
} }
@ -330,17 +327,23 @@ class SermondistributorModelExternal_sources extends JModelList
/** /**
* Method to get list export data. * 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. * @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 // setup the query
if (SermondistributorHelper::checkArray($pks)) 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; $_export = true;
// Get the user object. // Get the user object if not set.
if (!isset($user) || !SermondistributorHelper::checkObject($user))
{
$user = JFactory::getUser(); $user = JFactory::getUser();
}
// Create a new query object. // Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
@ -367,12 +370,13 @@ class SermondistributorModelExternal_sources extends JModelList
// Get the encryption object. // Get the encryption object.
$basic = new FOFEncryptAes($basickey); $basic = new FOFEncryptAes($basickey);
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);

View File

@ -157,7 +157,6 @@
class="text_area" class="text_area"
required="false" required="false"
filter="STRING" filter="STRING"
validate="email"
message="COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_MESSAGE" message="COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_MESSAGE"
hint="COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_HINT" hint="COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_HINT"
/> />

View File

@ -157,8 +157,23 @@ class SermondistributorModelHelp_document extends JModelAdmin
{ {
// set load data option // set load data option
$options['load_data'] = $loadData; $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. // 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)) if (empty($form))
{ {
@ -388,6 +403,8 @@ class SermondistributorModelHelp_document extends JModelAdmin
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_sermondistributor.help_document', $data);
} }
return $data; return $data;

View File

@ -115,12 +115,18 @@ class SermondistributorModelHelp_documents extends JModelList
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -131,21 +137,12 @@ class SermondistributorModelHelp_documents extends JModelList
$groupsArray = json_decode($item->groups, true); $groupsArray = json_decode($item->groups, true);
if (SermondistributorHelper::checkArray($groupsArray)) if (SermondistributorHelper::checkArray($groupsArray))
{ {
$groupsNames = ''; $groupsNames = array();
$counter = 0;
foreach ($groupsArray as $groups) foreach ($groupsArray as $groups)
{ {
if ($counter == 0) $groupsNames[] = SermondistributorHelper::getGroupName($groups);
{
$groupsNames .= SermondistributorHelper::getGroupName($groups);
} }
else $item->groups = implode(', ', $groupsNames);
{
$groupsNames .= ', '.SermondistributorHelper::getGroupName($groups);
}
$counter++;
}
$item->groups = $groupsNames;
} }
} }
} }
@ -299,17 +296,23 @@ class SermondistributorModelHelp_documents extends JModelList
/** /**
* Method to get list export data. * 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. * @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 // setup the query
if (SermondistributorHelper::checkArray($pks)) 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; $_export = true;
// Get the user object. // Get the user object if not set.
if (!isset($user) || !SermondistributorHelper::checkObject($user))
{
$user = JFactory::getUser(); $user = JFactory::getUser();
}
// Create a new query object. // Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
@ -337,12 +340,13 @@ class SermondistributorModelHelp_documents extends JModelList
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);

View File

@ -186,8 +186,23 @@ class SermondistributorModelLocal_listing extends JModelAdmin
{ {
// set load data option // set load data option
$options['load_data'] = $loadData; $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. // 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)) if (empty($form))
{ {
@ -521,6 +536,8 @@ class SermondistributorModelLocal_listing extends JModelAdmin
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_sermondistributor.local_listing', $data);
} }
return $data; return $data;

View File

@ -115,12 +115,18 @@ class SermondistributorModelLocal_listings extends JModelList
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -242,17 +248,23 @@ class SermondistributorModelLocal_listings extends JModelList
/** /**
* Method to get list export data. * 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. * @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 // setup the query
if (SermondistributorHelper::checkArray($pks)) 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; $_export = true;
// Get the user object. // Get the user object if not set.
if (!isset($user) || !SermondistributorHelper::checkObject($user))
{
$user = JFactory::getUser(); $user = JFactory::getUser();
}
// Create a new query object. // Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
@ -279,12 +291,13 @@ class SermondistributorModelLocal_listings extends JModelList
// Get the encryption object. // Get the encryption object.
$basic = new FOFEncryptAes($basickey); $basic = new FOFEncryptAes($basickey);
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);

View File

@ -199,12 +199,18 @@ class SermondistributorModelPreacher extends JModelAdmin
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -284,8 +290,23 @@ class SermondistributorModelPreacher extends JModelAdmin
{ {
// set load data option // set load data option
$options['load_data'] = $loadData; $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. // Get the form.
$form = $this->loadForm('com_sermondistributor.preacher', 'preacher', $options); $form = $this->loadForm('com_sermondistributor.preacher', 'preacher', $options, $clear, $xpath);
if (empty($form)) if (empty($form))
{ {
@ -517,6 +538,8 @@ class SermondistributorModelPreacher extends JModelAdmin
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_sermondistributor.preacher', $data);
} }
return $data; return $data;

View File

@ -103,12 +103,18 @@ class SermondistributorModelPreachers extends JModelList
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -196,17 +202,23 @@ class SermondistributorModelPreachers extends JModelList
/** /**
* Method to get list export data. * 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. * @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 // setup the query
if (SermondistributorHelper::checkArray($pks)) 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; $_export = true;
// Get the user object. // Get the user object if not set.
if (!isset($user) || !SermondistributorHelper::checkObject($user))
{
$user = JFactory::getUser(); $user = JFactory::getUser();
}
// Create a new query object. // Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
@ -234,12 +246,13 @@ class SermondistributorModelPreachers extends JModelList
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);

View File

@ -198,12 +198,18 @@ class SermondistributorModelSeries extends JModelAdmin
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -283,8 +289,23 @@ class SermondistributorModelSeries extends JModelAdmin
{ {
// set load data option // set load data option
$options['load_data'] = $loadData; $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. // Get the form.
$form = $this->loadForm('com_sermondistributor.series', 'series', $options); $form = $this->loadForm('com_sermondistributor.series', 'series', $options, $clear, $xpath);
if (empty($form)) if (empty($form))
{ {
@ -516,6 +537,8 @@ class SermondistributorModelSeries extends JModelAdmin
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_sermondistributor.series', $data);
} }
return $data; return $data;

View File

@ -99,12 +99,18 @@ class SermondistributorModelSeries_list extends JModelList
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -192,17 +198,23 @@ class SermondistributorModelSeries_list extends JModelList
/** /**
* Method to get list export data. * 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. * @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 // setup the query
if (SermondistributorHelper::checkArray($pks)) 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; $_export = true;
// Get the user object. // Get the user object if not set.
if (!isset($user) || !SermondistributorHelper::checkObject($user))
{
$user = JFactory::getUser(); $user = JFactory::getUser();
}
// Create a new query object. // Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
@ -230,12 +242,13 @@ class SermondistributorModelSeries_list extends JModelList
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);

View File

@ -235,12 +235,18 @@ class SermondistributorModelSermon extends JModelAdmin
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -269,8 +275,23 @@ class SermondistributorModelSermon extends JModelAdmin
{ {
// set load data option // set load data option
$options['load_data'] = $loadData; $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. // Get the form.
$form = $this->loadForm('com_sermondistributor.sermon', 'sermon', $options); $form = $this->loadForm('com_sermondistributor.sermon', 'sermon', $options, $clear, $xpath);
if (empty($form)) if (empty($form))
{ {
@ -502,6 +523,8 @@ class SermondistributorModelSermon extends JModelAdmin
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_sermondistributor.sermon', $data);
} }
return $data; return $data;

View File

@ -381,7 +381,7 @@ class SermondistributorModelSermondistributor extends JModelList
$document->addScript(JURI::root() . "media/com_sermondistributor/js/marked.js"); $document->addScript(JURI::root() . "media/com_sermondistributor/js/marked.js");
$document->addScriptDeclaration(' $document->addScriptDeclaration('
var token = "'.JSession::getFormToken().'"; 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(document).ready(function () {
jQuery.get(noticeboard) jQuery.get(noticeboard)
.success(function(board) { .success(function(board) {
@ -416,9 +416,9 @@ class SermondistributorModelSermondistributor extends JModelList
// to check is READ/NEW // to check is READ/NEW
function getIS(type,notice){ function getIS(type,notice){
if(type == 1){ 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) { } 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){ if(token.length > 0 && notice.length){
var request = "token="+token+"&notice="+notice; var request = "token="+token+"&notice="+notice;
@ -426,13 +426,14 @@ class SermondistributorModelSermondistributor extends JModelList
return jQuery.ajax({ return jQuery.ajax({
type: "POST", type: "POST",
url: getUrl, url: getUrl,
dataType: "jsonp", dataType: "json",
data: request, data: request,
jsonp: "callback" jsonp: false
}); });
} }
// nice little dot trick :)
jQuery(document).ready( function($) { // nice little dot trick :)
jQuery(document).ready( function($) {
var x=0; var x=0;
setInterval(function() { setInterval(function() {
var dots = ""; var dots = "";
@ -442,7 +443,7 @@ class SermondistributorModelSermondistributor extends JModelList
} }
$(".loading-dots").text(dots); $(".loading-dots").text(dots);
} , 500); } , 500);
});'); });');
return '<div id="noticeboard-md">'.JText::_('COM_SERMONDISTRIBUTOR_THE_NOTICE_BOARD_IS_LOADING').'.<span class="loading-dots">.</span></small></div>'; return '<div id="noticeboard-md">'.JText::_('COM_SERMONDISTRIBUTOR_THE_NOTICE_BOARD_IS_LOADING').'.<span class="loading-dots">.</span></small></div>';
} }

View File

@ -131,12 +131,18 @@ class SermondistributorModelSermons extends JModelList
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -327,17 +333,23 @@ class SermondistributorModelSermons extends JModelList
/** /**
* Method to get list export data. * 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. * @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 // setup the query
if (SermondistributorHelper::checkArray($pks)) 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; $_export = true;
// Get the user object. // Get the user object if not set.
if (!isset($user) || !SermondistributorHelper::checkObject($user))
{
$user = JFactory::getUser(); $user = JFactory::getUser();
}
// Create a new query object. // Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
@ -365,12 +377,13 @@ class SermondistributorModelSermons extends JModelList
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);

View File

@ -140,8 +140,23 @@ class SermondistributorModelStatistic extends JModelAdmin
{ {
// set load data option // set load data option
$options['load_data'] = $loadData; $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. // Get the form.
$form = $this->loadForm('com_sermondistributor.statistic', 'statistic', $options); $form = $this->loadForm('com_sermondistributor.statistic', 'statistic', $options, $clear, $xpath);
if (empty($form)) if (empty($form))
{ {
@ -373,6 +388,8 @@ class SermondistributorModelStatistic extends JModelAdmin
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_sermondistributor.statistic', $data);
} }
return $data; return $data;

View File

@ -115,12 +115,18 @@ class SermondistributorModelStatistics extends JModelList
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) 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) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -235,17 +241,23 @@ class SermondistributorModelStatistics extends JModelList
/** /**
* Method to get list export data. * 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. * @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 // setup the query
if (SermondistributorHelper::checkArray($pks)) 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; $_export = true;
// Get the user object. // Get the user object if not set.
if (!isset($user) || !SermondistributorHelper::checkObject($user))
{
$user = JFactory::getUser(); $user = JFactory::getUser();
}
// Create a new query object. // Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
@ -273,12 +285,13 @@ class SermondistributorModelStatistics extends JModelList
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// set values to display correctly. // Set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) 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) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);

View File

@ -23,13 +23,13 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_preacher` (
`metadesc` TEXT NOT NULL, `metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL, `metadata` TEXT NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_name` (`name`),
KEY `idx_alias` (`alias`),
KEY `idx_access` (`access`), KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`), KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`), KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`), KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`), KEY `idx_state` (`published`)
KEY `idx_name` (`name`),
KEY `idx_alias` (`alias`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_sermon` ( CREATE TABLE IF NOT EXISTS `#__sermondistributor_sermon` (
@ -68,18 +68,18 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_sermon` (
`metadesc` TEXT NOT NULL, `metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL, `metadata` TEXT NOT NULL,
PRIMARY KEY (`id`), 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_name` (`name`),
KEY `idx_preacher` (`preacher`), KEY `idx_preacher` (`preacher`),
KEY `idx_series` (`series`), KEY `idx_series` (`series`),
KEY `idx_catid` (`catid`), KEY `idx_catid` (`catid`),
KEY `idx_link_type` (`link_type`), KEY `idx_link_type` (`link_type`),
KEY `idx_alias` (`alias`), 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; ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_series` ( CREATE TABLE IF NOT EXISTS `#__sermondistributor_series` (
@ -106,13 +106,13 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_series` (
`metadesc` TEXT NOT NULL, `metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL, `metadata` TEXT NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_name` (`name`),
KEY `idx_alias` (`alias`),
KEY `idx_access` (`access`), KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`), KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`), KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`), KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`), KEY `idx_state` (`published`)
KEY `idx_name` (`name`),
KEY `idx_alias` (`alias`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_statistic` ( CREATE TABLE IF NOT EXISTS `#__sermondistributor_statistic` (
@ -139,15 +139,15 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_statistic` (
`metadesc` TEXT NOT NULL, `metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL, `metadata` TEXT NOT NULL,
PRIMARY KEY (`id`), 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_access` (`access`),
KEY `idx_checkout` (`checked_out`), KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`), KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`), KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`), KEY `idx_state` (`published`)
KEY `idx_filename` (`filename`),
KEY `idx_sermon` (`sermon`),
KEY `idx_preacher` (`preacher`),
KEY `idx_series` (`series`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_external_source` ( 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, `hits` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0, `ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), 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_description` (`description`),
KEY `idx_externalsources` (`externalsources`), KEY `idx_externalsources` (`externalsources`),
KEY `idx_update_method` (`update_method`), KEY `idx_update_method` (`update_method`),
KEY `idx_build` (`build`), KEY `idx_build` (`build`),
KEY `idx_dropboxoptions` (`dropboxoptions`), 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; ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_local_listing` ( 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, `hits` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0, `ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_name` (`name`),
KEY `idx_build` (`build`),
KEY `idx_key` (`key`),
KEY `idx_checkout` (`checked_out`), KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`), KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`), KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`), KEY `idx_state` (`published`)
KEY `idx_name` (`name`),
KEY `idx_build` (`build`),
KEY `idx_key` (`key`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__sermondistributor_help_document` ( CREATE TABLE IF NOT EXISTS `#__sermondistributor_help_document` (
@ -250,17 +250,17 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_help_document` (
`metadesc` TEXT NOT NULL, `metadesc` TEXT NOT NULL,
`metadata` TEXT NOT NULL, `metadata` TEXT NOT NULL,
PRIMARY KEY (`id`), 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_title` (`title`),
KEY `idx_type` (`type`), KEY `idx_type` (`type`),
KEY `idx_location` (`location`), KEY `idx_location` (`location`),
KEY `idx_article` (`article`), KEY `idx_article` (`article`),
KEY `idx_target` (`target`), 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; ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

View File

@ -57,7 +57,7 @@ class SermondistributorViewManual_updater extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('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); parent::display($tpl);
@ -147,6 +147,7 @@ class SermondistributorViewManual_updater extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) 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'.$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 // add the document default css file

View File

@ -55,7 +55,7 @@ defined('_JEXEC') or die('Restricted access');
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL', 'short_description', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL', 'short_description', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SERMON_CATEGORY', 'catid', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES', 'catid', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL', 'link_type', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL', 'link_type', $this->listDirn, $this->listOrder); ?>

View File

@ -384,7 +384,7 @@ class SermondistributorViewSermons extends JViewLegacy
'g.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL'), 'g.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL'),
'h.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL'), 'h.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL'),
'a.short_description' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_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.link_type' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL'),
'a.source' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL'), 'a.source' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID') 'a.id' => JText::_('JGRID_HEADING_ID')

View File

@ -768,6 +768,206 @@ class com_sermondistributorInstallerScript
$app->enqueueMessage(JText::_('All related items was removed from the <b>#__assets</b> table')); $app->enqueueMessage(JText::_('All related items was removed from the <b>#__assets</b> 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 <b>#__action_logs_extensions</b> 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 <b>#__action_log_config</b> 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 <b>#__action_log_config</b> 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 <b>#__action_log_config</b> 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 <b>#__action_log_config</b> 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 <b>#__action_log_config</b> 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 <b>#__action_log_config</b> 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 <b>#__action_log_config</b> table'));
}
// little notice as after service, in case of bad experience with component. // little notice as after service, in case of bad experience with component.
echo '<h2>Did something go wrong? Are you disappointed?</h2> echo '<h2>Did something go wrong? Are you disappointed?</h2>
<p>Please let me know at <a href="mailto:joomla@vdm.io">joomla@vdm.io</a>. <p>Please let me know at <a href="mailto:joomla@vdm.io">joomla@vdm.io</a>.
@ -1060,6 +1260,137 @@ class com_sermondistributorInstallerScript
echo '<a target="_blank" href="https://www.vdm.io/" title="Sermon Distributor"> echo '<a target="_blank" href="https://www.vdm.io/" title="Sermon Distributor">
<img src="components/com_sermondistributor/assets/images/vdm-component.jpg"/> <img src="components/com_sermondistributor/assets/images/vdm-component.jpg"/>
</a>'; </a>';
// 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 // do any updates needed
if ($type === 'update') if ($type === 'update')
@ -1392,6 +1723,267 @@ class com_sermondistributorInstallerScript
<img src="components/com_sermondistributor/assets/images/vdm-component.jpg"/> <img src="components/com_sermondistributor/assets/images/vdm-component.jpg"/>
</a> </a>
<h3>Upgrade to Version 2.0.2 Was Successful! Let us know if anything is not working as expected.</h3>'; <h3>Upgrade to Version 2.0.2 Was Successful! Let us know if anything is not working as expected.</h3>';
// 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; return true;
} }

View File

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

View File

@ -62,11 +62,11 @@ class SermondistributorControllerDownload extends JControllerLegacy
// we must first count this download // we must first count this download
if (SermondistributorHelper::countDownload($keys,$filename)) if (SermondistributorHelper::countDownload($keys,$filename))
{ {
$model = SermondistributorHelper::getModel('preachers', JPATH_COMPONENT_ADMINISTRATOR); // $model = SermondistributorHelper::getModel('preachers', JPATH_COMPONENT_ADMINISTRATOR);
if (($result = $model->getSomeStuff($filename)) !== false) // if (($result = $model->getSomeStuff($filename)) !== false)
{ // {
// on success do some thing more (code here) // on success do some thing more (code here)
} // }
// get Site name // get Site name
$config = JFactory::getConfig(); $config = JFactory::getConfig();
$vendor = $config->get('sitename'); $vendor = $config->get('sitename');

View File

@ -25,11 +25,21 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Language;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Sermondistributor component helper * Sermondistributor component helper
*/ */
abstract class SermondistributorHelper abstract class SermondistributorHelper
{ {
/**
* The Main Active Language
*
* @var string
*/
public static $langTag;
/** /**
* The global params * The global params
@ -673,7 +683,7 @@ abstract class SermondistributorHelper
* *
* @var array * @var array
**/ **/
protected static $fileExtentionToMimeType = array( protected static $fileExtensionToMimeType = array(
'123' => 'application/vnd.lotus-1-2-3', '123' => 'application/vnd.lotus-1-2-3',
'3dml' => 'text/vnd.in3d.3dml', '3dml' => 'text/vnd.in3d.3dml',
'3ds' => 'image/x-3ds', '3ds' => 'image/x-3ds',
@ -1680,9 +1690,9 @@ abstract class SermondistributorHelper
// get the extension form file // get the extension form file
$extension = \strtolower(\pathinfo($file, \PATHINFO_EXTENSION)); $extension = \strtolower(\pathinfo($file, \PATHINFO_EXTENSION));
// check if we have the extension listed // 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')) elseif (function_exists('mime_content_type'))
{ {
@ -1698,6 +1708,61 @@ abstract class SermondistributorHelper
return 'application/octet-stream'; 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) protected static function getDownloadFileName(&$sermon, $file, $type)
{ {
// first get file name and file type // first get file name and file type
@ -3023,7 +3088,7 @@ abstract class SermondistributorHelper
} }
} }
// check if there are any view values remaining // check if there are any view values remaining
if (count($_result)) if (count((array) $_result))
{ {
$_result = json_encode($_result); $_result = json_encode($_result);
$_result = array($_result); $_result = array($_result);
@ -3137,7 +3202,7 @@ abstract class SermondistributorHelper
* @return object * @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 // make sure we have attributes and a type value
if (self::checkArray($attributes) && isset($attributes['type'])) if (self::checkArray($attributes) && isset($attributes['type']))
@ -3148,7 +3213,31 @@ abstract class SermondistributorHelper
jimport('joomla.form.form'); jimport('joomla.form.form');
} }
// get field type // 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 // start field xml
$XML = new SimpleXMLElement('<field/>'); $XML = new SimpleXMLElement('<field/>');
// load the attributes // load the attributes
@ -3159,10 +3248,8 @@ abstract class SermondistributorHelper
// load the options // load the options
self::xmlAddOptions($XML, $options); self::xmlAddOptions($XML, $options);
} }
// setup the field // return the field xml
$field->setup($XML, $default); return $XML;
// return the field object
return $field;
} }
return false; return false;
} }
@ -3403,7 +3490,15 @@ abstract class SermondistributorHelper
{ {
$query->from($db->quoteName('#_'.$main.'_'.$table)); $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->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
@ -3465,14 +3560,19 @@ abstract class SermondistributorHelper
* @param string $views The related list view name * @param string $views The related list view name
* @param mixed $target Only get this permission (like edit, create, delete) * @param mixed $target Only get this permission (like edit, create, delete)
* @param string $component The target component * @param string $component The target component
* @param object $user The user whose permissions we are loading
* *
* @return object The JObject of permission/authorised actions * @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')
{
// load the user if not given
if (!self::checkObject($user))
{ {
// get the user object // get the user object
$user = JFactory::getUser(); $user = JFactory::getUser();
}
// load the JObject // load the JObject
$result = new JObject; $result = new JObject;
// make view name safe (just incase) // make view name safe (just incase)
@ -3859,6 +3959,8 @@ abstract class SermondistributorHelper
$string = trim($string); $string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string); $string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string); $string = preg_replace('/\s+/', ' ', $string);
// Transliterate string
$string = self::transliterate($string);
// remove all and keep only characters // remove all and keep only characters
if ($keepOnlyCharacters) if ($keepOnlyCharacters)
{ {
@ -3927,6 +4029,19 @@ abstract class SermondistributorHelper
return ''; 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) public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
{ {
if (self::checkString($var)) if (self::checkString($var))

View File

@ -53,7 +53,7 @@ class SermondistributorViewApi extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('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); parent::display($tpl);
@ -109,6 +109,7 @@ class SermondistributorViewApi extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) 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'.$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 // add the document default css file

View File

@ -74,7 +74,7 @@ class SermondistributorViewCategories extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('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); parent::display($tpl);
@ -165,6 +165,7 @@ class SermondistributorViewCategories extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) 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'.$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');
} }
} }

View File

@ -44,7 +44,7 @@ class SermondistributorViewCategory extends JViewLegacy
$this->pagination = $this->get('Pagination'); $this->pagination = $this->get('Pagination');
$this->category = $this->get('Category'); $this->category = $this->get('Category');
// add a hit to the category // add a hit to the category
if ($this->hit($this->category->id)) if ($this->hit($this->category->id, true))
{ {
$this->category->hits++; $this->category->hits++;
} }
@ -90,7 +90,7 @@ class SermondistributorViewCategory extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('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); parent::display($tpl);
@ -104,7 +104,7 @@ class SermondistributorViewCategory extends JViewLegacy
* *
* @return boolean True if successful; * @return boolean True if successful;
*/ */
public function hit($pk = 0) public function hit($pk = 0, $category = false)
{ {
if ($pk) if ($pk)
{ {
@ -120,8 +120,15 @@ class SermondistributorViewCategory extends JViewLegacy
$conditions = array( $conditions = array(
$db->quoteName('id') . ' = ' . $pk $db->quoteName('id') . ' = ' . $pk
); );
// 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); $query->update($db->quoteName('#__sermondistributor_category'))->set($fields)->where($conditions);
}
$db->setQuery($query); $db->setQuery($query);
return $db->execute(); return $db->execute();
@ -229,6 +236,7 @@ class SermondistributorViewCategory extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) 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'.$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');
} }
} }

View File

@ -84,7 +84,7 @@ class SermondistributorViewPreacher extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('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); parent::display($tpl);
@ -98,7 +98,7 @@ class SermondistributorViewPreacher extends JViewLegacy
* *
* @return boolean True if successful; * @return boolean True if successful;
*/ */
public function hit($pk = 0) public function hit($pk = 0, $category = false)
{ {
if ($pk) if ($pk)
{ {
@ -114,8 +114,15 @@ class SermondistributorViewPreacher extends JViewLegacy
$conditions = array( $conditions = array(
$db->quoteName('id') . ' = ' . $pk $db->quoteName('id') . ' = ' . $pk
); );
// 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); $query->update($db->quoteName('#__sermondistributor_preacher'))->set($fields)->where($conditions);
}
$db->setQuery($query); $db->setQuery($query);
return $db->execute(); return $db->execute();
@ -224,6 +231,7 @@ class SermondistributorViewPreacher extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) 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'.$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');
} }
} }

View File

@ -74,7 +74,7 @@ class SermondistributorViewPreachers extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('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); parent::display($tpl);
@ -180,6 +180,7 @@ class SermondistributorViewPreachers extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) 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'.$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');
} }
} }

View File

@ -84,7 +84,7 @@ class SermondistributorViewSeries extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('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); parent::display($tpl);
@ -98,7 +98,7 @@ class SermondistributorViewSeries extends JViewLegacy
* *
* @return boolean True if successful; * @return boolean True if successful;
*/ */
public function hit($pk = 0) public function hit($pk = 0, $category = false)
{ {
if ($pk) if ($pk)
{ {
@ -114,8 +114,15 @@ class SermondistributorViewSeries extends JViewLegacy
$conditions = array( $conditions = array(
$db->quoteName('id') . ' = ' . $pk $db->quoteName('id') . ' = ' . $pk
); );
// 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); $query->update($db->quoteName('#__sermondistributor_series'))->set($fields)->where($conditions);
}
$db->setQuery($query); $db->setQuery($query);
return $db->execute(); return $db->execute();
@ -223,6 +230,7 @@ class SermondistributorViewSeries extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) 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'.$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');
} }
} }

View File

@ -74,7 +74,7 @@ class SermondistributorViewSerieslist extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('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); parent::display($tpl);
@ -180,6 +180,7 @@ class SermondistributorViewSerieslist extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) 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'.$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');
} }
} }

View File

@ -58,7 +58,7 @@ class SermondistributorViewSermon extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('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); parent::display($tpl);
@ -72,7 +72,7 @@ class SermondistributorViewSermon extends JViewLegacy
* *
* @return boolean True if successful; * @return boolean True if successful;
*/ */
public function hit($pk = 0) public function hit($pk = 0, $category = false)
{ {
if ($pk) if ($pk)
{ {
@ -88,8 +88,15 @@ class SermondistributorViewSermon extends JViewLegacy
$conditions = array( $conditions = array(
$db->quoteName('id') . ' = ' . $pk $db->quoteName('id') . ' = ' . $pk
); );
// 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); $query->update($db->quoteName('#__sermondistributor_sermon'))->set($fields)->where($conditions);
}
$db->setQuery($query); $db->setQuery($query);
return $db->execute(); return $db->execute();
@ -198,6 +205,7 @@ class SermondistributorViewSermon extends JViewLegacy
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) 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'.$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 // load the meta description