From 2aa520e444bc44e72978b92d9624474adcb3aff9 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 3 Mar 2022 05:49:35 +0200 Subject: [PATCH] update --- README.md | 20 ++--- admin/README.txt | 20 ++--- admin/config.xml | 18 ++--- admin/controllers/ajax.json.php | 74 +++++++++++++------ admin/controllers/sermondistributor.php | 2 + .../en-GB/en-GB.com_sermondistributor.ini | 14 ++-- admin/models/external_sources.php | 26 ++++--- admin/models/forms/external_source.xml | 12 +-- admin/models/help_documents.php | 14 ++-- admin/models/local_listings.php | 14 ++-- admin/models/preachers.php | 14 ++-- admin/models/series_list.php | 14 ++-- admin/models/sermondistributor.php | 12 +-- admin/models/sermons.php | 14 ++-- admin/models/statistics.php | 14 ++-- admin/sermondistributor.php | 6 +- admin/sql/install.mysql.utf8.sql | 14 ++-- admin/tables/help_document.php | 2 +- admin/tables/preacher.php | 2 +- admin/tables/series.php | 2 +- admin/tables/sermon.php | 2 +- admin/views/external_source/tmpl/edit.php | 3 +- admin/views/external_source/view.html.php | 6 +- admin/views/external_sources/tmpl/default.php | 1 - admin/views/external_sources/view.html.php | 6 +- admin/views/help_document/tmpl/edit.php | 3 +- admin/views/help_document/view.html.php | 6 +- admin/views/help_documents/tmpl/default.php | 1 - admin/views/help_documents/view.html.php | 6 +- admin/views/import/view.html.php | 6 +- admin/views/local_listing/tmpl/edit.php | 3 +- admin/views/local_listing/view.html.php | 6 +- admin/views/local_listings/tmpl/default.php | 1 - admin/views/local_listings/view.html.php | 6 +- admin/views/manual_updater/tmpl/default.php | 3 +- admin/views/manual_updater/view.html.php | 6 +- admin/views/preacher/tmpl/edit.php | 3 +- admin/views/preacher/view.html.php | 6 +- admin/views/preachers/tmpl/default.php | 1 - admin/views/preachers/view.html.php | 6 +- admin/views/series/tmpl/edit.php | 3 +- admin/views/series/view.html.php | 6 +- admin/views/series_list/tmpl/default.php | 1 - admin/views/series_list/view.html.php | 6 +- admin/views/sermon/tmpl/edit.php | 3 +- admin/views/sermon/view.html.php | 6 +- .../views/sermondistributor/tmpl/default.php | 2 +- admin/views/sermondistributor/view.html.php | 8 +- admin/views/sermons/tmpl/default.php | 1 - admin/views/sermons/view.html.php | 6 +- admin/views/statistic/tmpl/edit.php | 3 +- admin/views/statistic/view.html.php | 6 +- admin/views/statistics/tmpl/default.php | 1 - admin/views/statistics/view.html.php | 6 +- media/js/marked.js | 7 +- script.php | 27 +++---- sermondistributor.xml | 4 +- site/controllers/ajax.json.php | 39 +++++++--- site/models/category.php | 4 +- site/models/preacher.php | 8 +- site/models/preachers.php | 4 +- site/models/series.php | 8 +- site/models/serieslist.php | 4 +- site/models/sermon.php | 4 +- site/router.php | 2 +- site/sermondistributor.php | 4 +- site/views/api/view.html.php | 6 +- site/views/categories/view.html.php | 6 +- site/views/category/tmpl/default.xml | 4 +- site/views/category/view.html.php | 6 +- site/views/preacher/tmpl/default.xml | 4 +- site/views/preacher/view.html.php | 6 +- site/views/preachers/view.html.php | 6 +- site/views/series/tmpl/default.xml | 4 +- site/views/series/view.html.php | 6 +- site/views/serieslist/view.html.php | 6 +- site/views/sermon/view.html.php | 6 +- 77 files changed, 340 insertions(+), 282 deletions(-) diff --git a/README.md b/README.md index 907bcad9..bb99e3c7 100644 --- a/README.md +++ b/README.md @@ -24,38 +24,38 @@ The best way to see all your options is to install this component on you Joomla + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Sermon Distributor](https://www.vdm.io/) + *First Build*: 22nd October, 2015 -+ *Last Build*: 16th August, 2021 ++ *Last Build*: 2nd March, 2022 + *Version*: 2.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time :hourglass: -**204 Hours** or **26 Eight Hour Days** (actual time the author saved - +**206 Hours** or **26 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **73073** -+ *File count*: **460** -+ *Folder count*: **93** ++ *Line count*: **73932** ++ *File count*: **472** ++ *Folder count*: **99** -**134 Hours** or **16 Eight Hour Days** (the actual time the author spent) +**136 Hours** or **17 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @51hours** = codingtime / 4; +> **debugging @52hours** = codingtime / 4; > **planning @29hours** = codingtime / 7; -> **mapping @20hours** = codingtime / 10; +> **mapping @21hours** = codingtime / 10; > **office @34hours** = codingtime / 6;) -**338 Hours** or **42 Eight Hour Days** +**342 Hours** or **43 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **8.4 weeks** or **1.8 months** +Project duration: **8.6 weeks** or **1.8 months** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/README.txt b/admin/README.txt index 907bcad9..bb99e3c7 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -24,38 +24,38 @@ The best way to see all your options is to install this component on you Joomla + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Sermon Distributor](https://www.vdm.io/) + *First Build*: 22nd October, 2015 -+ *Last Build*: 16th August, 2021 ++ *Last Build*: 2nd March, 2022 + *Version*: 2.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time :hourglass: -**204 Hours** or **26 Eight Hour Days** (actual time the author saved - +**206 Hours** or **26 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **73073** -+ *File count*: **460** -+ *Folder count*: **93** ++ *Line count*: **73932** ++ *File count*: **472** ++ *Folder count*: **99** -**134 Hours** or **16 Eight Hour Days** (the actual time the author spent) +**136 Hours** or **17 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @51hours** = codingtime / 4; +> **debugging @52hours** = codingtime / 4; > **planning @29hours** = codingtime / 7; -> **mapping @20hours** = codingtime / 10; +> **mapping @21hours** = codingtime / 10; > **office @34hours** = codingtime / 6;) -**338 Hours** or **42 Eight Hour Days** +**342 Hours** or **43 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **8.4 weeks** or **1.8 months** +Project duration: **8.6 weeks** or **1.8 months** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/config.xml b/admin/config.xml index c2ad6c10..bbd532ef 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -60,8 +60,8 @@ last="50000" step="10" /> - - + + COM_SERMONDISTRIBUTOR_CONFIG_JPLAYER + COM_SERMONDISTRIBUTOR_CONFIG_HTML_5_BASIC
COM_SERMONDISTRIBUTOR_CONFIG_NO - - + + COM_SERMONDISTRIBUTOR_CONFIG_NO - - + + COM_SERMONDISTRIBUTOR_CONFIG_NO - - + + setMimeEncoding( 'application/json' ); - JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"'); - JResponse::setHeader("Access-Control-Allow-Origin", "*"); + // get the application + $app = JFactory::getApplication(); + $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); + $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks $this->registerTask('isNew', 'ajax'); $this->registerTask('isRead', 'ajax'); @@ -50,20 +52,26 @@ class SermondistributorControllerAjax extends JControllerLegacy public function ajax() { + // get the user for later use $user = JFactory::getUser(); + // get the input values $jinput = JFactory::getApplication()->input; + // check if we should return raw + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + // return to a callback function + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { + // get the task $task = $this->getTask(); switch($task) { case 'isNew': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { @@ -73,7 +81,7 @@ class SermondistributorControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -88,10 +96,14 @@ class SermondistributorControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -101,7 +113,6 @@ class SermondistributorControllerAjax extends JControllerLegacy case 'isRead': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { @@ -111,7 +122,7 @@ class SermondistributorControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -126,10 +137,14 @@ class SermondistributorControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -139,7 +154,6 @@ class SermondistributorControllerAjax extends JControllerLegacy case 'getBuildTable': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idNameValue = $jinput->get('idName', NULL, 'WORD'); $ojectValue = $jinput->get('oject', NULL, 'STRING'); if($idNameValue && $user->id != 0 && $ojectValue) @@ -150,7 +164,7 @@ class SermondistributorControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -165,10 +179,14 @@ class SermondistributorControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -178,7 +196,6 @@ class SermondistributorControllerAjax extends JControllerLegacy case 'getSourceStatus': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { @@ -188,7 +205,7 @@ class SermondistributorControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -203,10 +220,14 @@ class SermondistributorControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -216,7 +237,6 @@ class SermondistributorControllerAjax extends JControllerLegacy case 'getCronPath': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $getTypeValue = $jinput->get('getType', NULL, 'WORD'); if($getTypeValue && $user->id != 0) { @@ -226,7 +246,7 @@ class SermondistributorControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -241,10 +261,14 @@ class SermondistributorControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -254,7 +278,6 @@ class SermondistributorControllerAjax extends JControllerLegacy case 'updateLocalListingExternal': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); $targetValue = $jinput->get('target', NULL, 'INT'); $typeValue = $jinput->get('type', NULL, 'INT'); @@ -267,7 +290,7 @@ class SermondistributorControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -282,10 +305,14 @@ class SermondistributorControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -296,10 +323,15 @@ class SermondistributorControllerAjax extends JControllerLegacy } else { - if($callback = $jinput->get('callback', null, 'CMD')) + // return to a callback function + if($callback) { echo $callback."(".json_encode(false).");"; } + elseif($returnRaw) + { + echo json_encode(false); + } else { echo "(".json_encode(false).");"; diff --git a/admin/controllers/sermondistributor.php b/admin/controllers/sermondistributor.php index 996ce96e..3a5dc3ea 100644 --- a/admin/controllers/sermondistributor.php +++ b/admin/controllers/sermondistributor.php @@ -25,6 +25,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); + + /** * Sermondistributor Controller */ diff --git a/admin/language/en-GB/en-GB.com_sermondistributor.ini b/admin/language/en-GB/en-GB.com_sermondistributor.ini index 54186df2..03ce1b09 100644 --- a/admin/language/en-GB/en-GB.com_sermondistributor.ini +++ b/admin/language/en-GB/en-GB.com_sermondistributor.ini @@ -136,7 +136,7 @@ COM_SERMONDISTRIBUTOR_CONFIG_GLOBAL_LABEL="Global" COM_SERMONDISTRIBUTOR_CONFIG_GRADIANT_LOAD="Gradient" COM_SERMONDISTRIBUTOR_CONFIG_GREEN="Green" COM_SERMONDISTRIBUTOR_CONFIG_GRID="Grid" -COM_SERMONDISTRIBUTOR_CONFIG_HTML_FIVE_BASIC="HTML 5 (basic)" +COM_SERMONDISTRIBUTOR_CONFIG_HTML_5_BASIC="HTML 5 (basic)" COM_SERMONDISTRIBUTOR_CONFIG_JPLAYER="jPlayer" COM_SERMONDISTRIBUTOR_CONFIG_LEGACY="Legacy" COM_SERMONDISTRIBUTOR_CONFIG_LINES="Lines" @@ -415,6 +415,8 @@ COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_UNPUBLISHED="%s External Sources COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_UNPUBLISHED_1="%s External Source unpublished." COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_SUBMENU="External Sources Submenu" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_SUBMENU_DESC="Allows the users in this group to submenu of external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_3G2=".3g2" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_3GP=".3gp" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_APICRONJOB_NOTE_DESCRIPTION="You must setup a cronjob that will update your local listing with the external sources.

USE THE FOLLOWING: loading...

Please note that if your Joomla website has a Firewall installed, it will not allow cronjob via direct URL (most of the time), you will then need to adapt the cornjob request to look like a browser. For more info please read https://stackoverflow.com/a/31597823/1429677