Release of v3.0.5

Add PHP check to install/update class. Add Database check and fix to install/update class.
This commit is contained in:
Robot 2024-05-03 07:22:58 +02:00
parent cda404b810
commit 2d15ab4172
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
139 changed files with 3517 additions and 529 deletions

View File

@ -1,3 +1,8 @@
# v3.0.5
- Add PHP check to install/update class
- Add Database check and fix to install/update class
# v3.0.4
- Add the getDocument method call to view

View File

@ -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*: 7th March, 2024
+ *Last Build*: 3rd May, 2024
+ *Version*: 3.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:
**237 Hours** or **30 Eight Hour Days** (actual time the author saved -
**254 Hours** or **32 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (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*: **84910**
+ *File count*: **572**
+ *Folder count*: **101**
+ *Line count*: **91259**
+ *File count*: **601**
+ *Folder count*: **105**
**156 Hours** or **19 Eight Hour Days** (the actual time the author spent)
**168 Hours** or **21 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @59hours** = codingtime / 4;
> **planning @34hours** = codingtime / 7;
> **mapping @24hours** = codingtime / 10;
> **office @39hours** = codingtime / 6;)
> **debugging @64hours** = codingtime / 4;
> **planning @36hours** = codingtime / 7;
> **mapping @25hours** = codingtime / 10;
> **office @42hours** = codingtime / 6;)
**393 Hours** or **49 Eight Hour Days**
**422 Hours** or **53 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: **9.8 weeks** or **2 months**
Project duration: **10.6 weeks** or **2.2 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -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*: 7th March, 2024
+ *Last Build*: 3rd May, 2024
+ *Version*: 3.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:
**237 Hours** or **30 Eight Hour Days** (actual time the author saved -
**254 Hours** or **32 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (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*: **84910**
+ *File count*: **572**
+ *Folder count*: **101**
+ *Line count*: **91259**
+ *File count*: **601**
+ *Folder count*: **105**
**156 Hours** or **19 Eight Hour Days** (the actual time the author spent)
**168 Hours** or **21 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @59hours** = codingtime / 4;
> **planning @34hours** = codingtime / 7;
> **mapping @24hours** = codingtime / 10;
> **office @39hours** = codingtime / 6;)
> **debugging @64hours** = codingtime / 4;
> **planning @36hours** = codingtime / 7;
> **mapping @25hours** = codingtime / 10;
> **office @42hours** = codingtime / 6;)
**393 Hours** or **49 Eight Hour Days**
**422 Hours** or **53 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: **9.8 weeks** or **2 months**
Project duration: **10.6 weeks** or **2.2 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -29,8 +29,8 @@ use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* General Controller of Sermondistributor component

View File

@ -31,8 +31,8 @@ use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
/**
* External_sources Admin Controller

View File

@ -31,8 +31,8 @@ use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
/**
* Help_documents Admin Controller

View File

@ -31,8 +31,8 @@ use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
/**
* Local_listings Admin Controller

View File

@ -31,8 +31,8 @@ use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
/**
* Preachers Admin Controller

View File

@ -31,8 +31,8 @@ use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
/**
* Series_list Admin Controller

View File

@ -31,8 +31,8 @@ use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
/**
* Sermons Admin Controller

View File

@ -31,8 +31,8 @@ use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
/**
* Statistics Admin Controller

View File

@ -0,0 +1,70 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 3.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage powerloader.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die;
// register additional namespace
spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/vendor_sermondistributor/TrueChristianChurch.Joomla.FOF' => 'TrueChristianChurch\\Joomla\\FOF',
'libraries/vendor_sermondistributor/TrueChristianChurch.Joomla' => 'TrueChristianChurch\\Joomla'
];
// Start the search and load if found
$found = false;
$found_base_dir = "";
$found_len = 0;
foreach ($search as $base_dir => $prefix)
{
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) === 0)
{
// we have a match so load the values
$found = true;
$found_base_dir = $base_dir;
$found_len = $len;
// done here
break;
}
}
// check if we found a match
if (!$found)
{
// not found so move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $found_len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file))
{
require $file;
}
});

View File

@ -25,49 +25,12 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// register additional namespace
\spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla'
];
// Start the search and load if found
$found = false;
$found_base_dir = "";
$found_len = 0;
foreach ($search as $base_dir => $prefix)
{
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) === 0)
{
// we have a match so load the values
$found = true;
$found_base_dir = $base_dir;
$found_len = $len;
// done here
break;
}
}
// check if we found a match
if (!$found)
{
// not found so move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $found_len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file))
{
require $file;
}
});
// The power autoloader for this project (JPATH_ADMINISTRATOR) area.
$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_sermondistributor/helpers/powerloader.php';
if (file_exists($power_autoloader))
{
require_once $power_autoloader;
}
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
@ -88,15 +51,17 @@ use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use Joomla\CMS\Filesystem\Folder;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\MimeHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\FormHelper;
use TrueChristianChurch\Joomla\Utilities\FileHelper;
use TrueChristianChurch\Joomla\Utilities\MimeHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\GetHelper;
use TrueChristianChurch\Joomla\Utilities\JsonHelper;
use TrueChristianChurch\Joomla\Utilities\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\HTML\HTMLHelper;
/**
* Sermondistributor component helper.
@ -209,7 +174,7 @@ abstract class SermondistributorHelper
}
$keyCounterRAW = $safe->encryptString(json_encode($keyCounter));
$keyCounter = self::base64_urlencode($keyCounterRAW);
$token = \JSession::getFormToken();
$token = Session::getFormToken();
$downloadURL = Uri::root().'index.php?option=com_sermondistributor&task=download.file&key='.$keyCounter.'&token='.$token;
// check if local .htaccess should be set
$setHtaccess = false;
@ -219,7 +184,7 @@ abstract class SermondistributorHelper
{
case 1:
// local file get local folder and check if outside root (if not then allow direct)
$localFolder = \JComponentHelper::getParams('com_sermondistributor')->get('localfolder', JPATH_ROOT.'/images').'/';
$localFolder = ComponentHelper::getParams('com_sermondistributor')->get('localfolder', JPATH_ROOT.'/images').'/';
// should we allow direct downloads
$allowDirect = false;
if (2 == $sermon->link_type && strpos($localFolder, JPATH_ROOT) !== false)
@ -257,7 +222,7 @@ abstract class SermondistributorHelper
break;
case 2:
// Dropbox get global dropbox switch
$addToButton = \JComponentHelper::getParams('com_sermondistributor')->get('add_to_button', 0);
$addToButton = ComponentHelper::getParams('com_sermondistributor')->get('add_to_button', 0);
if (1 == $sermon->build)
{
if (self::checkArray($sermon->manual_files))
@ -490,7 +455,7 @@ abstract class SermondistributorHelper
public static function getExternalListingUpdateKeys($id = null, $updateMethod = 2, $returnType = 1)
{
// first check if this file already has statistics
$db = JFactory::getDbo();
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id','sharedurl','folder','permissiontype','dropboxoptions','build')));
$query->from($db->quoteName('#__sermondistributor_external_source'));
@ -607,9 +572,9 @@ abstract class SermondistributorHelper
{
$counter->filename = $filename;
// set the date object
$date = JFactory::getDate();
$date = Factory::getDate();
// first check if this file already has statistics
$db = JFactory::getDbo();
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id','counter')));
$query->from($db->quoteName('#__sermondistributor_statistic'));
@ -657,7 +622,7 @@ abstract class SermondistributorHelper
$opener = new FOFEncryptAes($localkey, 128);
$key = rtrim($opener->decryptString($key), "\0");
// load the links from the database
$db = JFactory::getDbo();
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select('size');
@ -746,7 +711,7 @@ abstract class SermondistributorHelper
if (isset($build[$type]))
{
// load the links from the database
$db = JFactory::getDbo();
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('key', $target[$get])));
@ -777,7 +742,7 @@ abstract class SermondistributorHelper
if (!isset(self::$localkey[$type]))
{
// get the main key
self::$localkey[$type] = \JComponentHelper::getParams('com_sermondistributor')->get($type, 'localKey34fdWEkl');
self::$localkey[$type] = ComponentHelper::getParams('com_sermondistributor')->get($type, 'localKey34fdWEkl');
}
return self::$localkey[$type];
}
@ -803,7 +768,7 @@ abstract class SermondistributorHelper
return false;
}
}
self::setUpdateError($id, array(JText::_('COM_SERMONDISTRIBUTOR_THE_EXTERNAL_SOURCE_COULD_NOT_BE_FOUND')));
self::setUpdateError($id, array(Text::_('COM_SERMONDISTRIBUTOR_THE_EXTERNAL_SOURCE_COULD_NOT_BE_FOUND')));
return false;
}
@ -826,7 +791,7 @@ abstract class SermondistributorHelper
$updateInfo = self::updateInfo($id);
if (!$updateInfo)
{
$errors[] = JText::_('COM_SERMONDISTRIBUTOR_THIS_SOURCE_HAS_NO_LOCAL_LISTING_SET');
$errors[] = Text::_('COM_SERMONDISTRIBUTOR_THIS_SOURCE_HAS_NO_LOCAL_LISTING_SET');
}
// build the return string
if (isset($updateInfo['last']) || self::checkArray($errors))
@ -835,19 +800,19 @@ abstract class SermondistributorHelper
// great we have source status
if (isset($updateInfo['last']))
{
$body[] = '<h3>'. JText::_('COM_SERMONDISTRIBUTOR_LISTING_INFO') . '</h3>';
$body[] = '<p><b>'. JText::_('COM_SERMONDISTRIBUTOR_LAST_UPDATE') . ':</b> <em>'.$updateInfo['last'];
$body[] = '</em><br /><b>'. JText::_('COM_SERMONDISTRIBUTOR_NUMBER_OF_FILES_LISTED') . ':</b> <em>'.$updateInfo['qty'];
$body[] = '<h3>'. Text::_('COM_SERMONDISTRIBUTOR_LISTING_INFO') . '</h3>';
$body[] = '<p><b>'. Text::_('COM_SERMONDISTRIBUTOR_LAST_UPDATE') . ':</b> <em>'.$updateInfo['last'];
$body[] = '</em><br /><b>'. Text::_('COM_SERMONDISTRIBUTOR_NUMBER_OF_FILES_LISTED') . ':</b> <em>'.$updateInfo['qty'];
$body[] = '</em></p>';
}
// now set any errors found
if (self::checkArray($errors))
{
$body[] = '<h3>'. JText::_('COM_SERMONDISTRIBUTOR_NOTICE') . '</h3>';
$body[] = '<h3>'. Text::_('COM_SERMONDISTRIBUTOR_NOTICE') . '</h3>';
$body[] = implode('', $errors);
}
return '<a class="btn btn-small btn-success" href="#source-status'.$id.'" data-toggle="modal">'.JText::_('COM_SERMONDISTRIBUTOR_VIEW_UPDATE_STATUS').'</a>'
. JHtml::_('bootstrap.renderModal', 'source-status'.$id, array('title' => JText::_('COM_SERMONDISTRIBUTOR_SOURCE_STATUS_REPORT')), implode('', $body));
return '<a class="btn btn-small btn-success" href="#source-status'.$id.'" data-toggle="modal">'.Text::_('COM_SERMONDISTRIBUTOR_VIEW_UPDATE_STATUS').'</a>'
. HTMLHelper::_('bootstrap.renderModal', 'source-status'.$id, array('title' => Text::_('COM_SERMONDISTRIBUTOR_SOURCE_STATUS_REPORT')), implode('', $body));
}
// no status found
return false;
@ -855,7 +820,7 @@ abstract class SermondistributorHelper
public static function updateInfo($id)
{
$db = JFactory::getDbo();
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.created','a.modified')));
@ -907,7 +872,7 @@ abstract class SermondistributorHelper
{
return '<ul><li>'.implode('</li><li>', self::$updateErrors[$id]).'</li></ul>';
}
return JText::_('COM_SERMONDISTRIBUTOR_UNKNOWN_ERROR_HAS_OCCURRED');
return Text::_('COM_SERMONDISTRIBUTOR_UNKNOWN_ERROR_HAS_OCCURRED');
}
protected static function setUpdateError($id, $errorArray)

View File

@ -10,7 +10,6 @@ COM_SERMONDISTRIBUTOR_A_FEW_CLOSED_ISSUES_FROM_GITHUB_IS_LOADING="A few closed i
COM_SERMONDISTRIBUTOR_A_FEW_OPEN_ISSUES_FROM_GITHUB_IS_LOADING="A few open issues from Github is loading"
COM_SERMONDISTRIBUTOR_BACK="Back"
COM_SERMONDISTRIBUTOR_BCOULD_NOT_USE_THE_GIVEN_TOKEN_OR_THE_GIVEN_BUILD_OPTION_DOES_NOT_EXISTB="<b>Could not use the given token, or the given build option does not exist.</b>"
COM_SERMONDISTRIBUTOR_BETA_RELEASE="Beta Release"
COM_SERMONDISTRIBUTOR_BY_USING_AN_ACCESS_TOKEN_YOU_WILL_BE_ABLE_TO_MAKE_API_CALLS_FOR_YOUR_OWN_ACCOUNT_WITHOUT_GOING_THROUGH_THE_AUTHORIZATION_FLOW_DURING_THIS_MANUAL_UPDATE_OF_THE_LOCAL_LISTINGBR_THE_TOKEN_WILL_NOT_BE_STORED_AND_FOR_SAFETY_THE_TOKEN_WILL_BE_REVOKED_ONCE_THE_UPDATE_IS_COMPLETED_SUCCESSFULLYBR_BTHIS_WILL_MEAN_IT_CAN_ONLY_BE_USED_THIS_ONCEB_YOU_WOULD_NEED_A_NEW_TOKEN_EACH_TIME_YOU_RUN_THIS_UPDATE_MANUALLY_BR_SMALLMAKE_SURE_TO_HAVE_SSL_INPLACE_ON_THIS_PAGE_WHEN_DOING_THIS_UPDATE_AS_AN_EXTRA_SECURITY_MEASURESMALL="By using an access token, you will be able to make API calls for your own account without going through the authorization flow during this manual update of the local listing.<br />The token will not be stored and for safety the token will be revoked once the update is completed successfully.<br /><b>This will mean it can only be used this once</b>, you would need a new token each time you run this update manually. <br /><small>Make sure to have SSL in-place on this page when doing this update, as an extra security measure.</small>"
COM_SERMONDISTRIBUTOR_CATEGORIES_ACCESS_SITE="Categories (Site) Access"
COM_SERMONDISTRIBUTOR_CATEGORIES_ACCESS_SITE_DESC="Allows the users in this group to access site categories."
@ -994,6 +993,7 @@ COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE_DESCRIPTION="Enter website address"
COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE_HINT="http://www.example.com"
COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE_LABEL="Website"
COM_SERMONDISTRIBUTOR_PREACHER_WEBSITE_MESSAGE="Error! Please add website here."
COM_SERMONDISTRIBUTOR_PRE_RELEASE="Pre Release"
COM_SERMONDISTRIBUTOR_PUBLISHED="Published"
COM_SERMONDISTRIBUTOR_RELEASED_THIS="released this"
COM_SERMONDISTRIBUTOR_RESETTING_THE_UPDATE_STATUS_WAS_SUCCESSFUL="Resetting the update status was successful!"

View File

@ -28,8 +28,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
// set the defaults
$items = $displayData->vvvsermons;

View File

@ -28,8 +28,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
// set the defaults
$items = $displayData->vwcsermons;

View File

@ -28,8 +28,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
// set the defaults
$items = $displayData->vwbstastics;

View File

@ -31,12 +31,13 @@ use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GetHelper;
use TrueChristianChurch\Joomla\Utilities\FileHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\JsonHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\GetHelper;
use Joomla\CMS\Uri\Uri;
/**
* Sermondistributor Ajax List Model
@ -245,11 +246,11 @@ class SermondistributorModelAjax extends ListModel
$result['error'] = '<span style="color: red;">' . Text::sprintf('COM_SERMONDISTRIBUTOR_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . '</span>';
if ($this->hasCurl())
{
$path = '*/15 * * * * curl -s "' .\JUri::root() . 'index.php?option=com_sermondistributor&task=api.externalUpdate" >/dev/null 2>&1';
$path = '*/15 * * * * curl -s "' .Uri::root() . 'index.php?option=com_sermondistributor&task=api.externalUpdate" >/dev/null 2>&1';
}
else
{
$path = '*/15 * * * * wget "' .\JUri::root() . 'index.php?option=com_sermondistributor&task=api.externalUpdate" >/dev/null 2>&1';
$path = '*/15 * * * * wget "' .Uri::root() . 'index.php?option=com_sermondistributor&task=api.externalUpdate" >/dev/null 2>&1';
}
$result['path'] = '<code>' . $path . '</code>';
}

View File

@ -37,10 +37,10 @@ use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\FileHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
/**
* Sermondistributor External_source Admin Model

View File

@ -32,10 +32,10 @@ use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
/**
* External_sources List Model

View File

@ -28,7 +28,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// import the list field type
jimport('joomla.form.helper');

View File

@ -52,23 +52,24 @@ class JFormFieldArticles extends JFormFieldList
*/
protected function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias')));
$query->from($db->quoteName('#__content', 'a'));
$query->where($db->quoteName('a.state') . ' = 1');
$query->order('a.title ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an Article');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')');
}
}
return $options;
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias')));
$query->from($db->quoteName('#__content', 'a'));
$query->where($db->quoteName('a.state') . ' = 1');
$query->order('a.title ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an Article');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')');
}
}
return $options;
}
}

View File

@ -107,7 +107,7 @@ class JFormFieldExternalsource extends JFormFieldList
if ($user->authorise('external_source.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 3px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@ -107,7 +107,7 @@ class JFormFieldPreachers extends JFormFieldList
if ($user->authorise('preacher.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 3px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@ -107,7 +107,7 @@ class JFormFieldSeries extends JFormFieldList
if ($user->authorise('series.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 3px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@ -107,7 +107,7 @@ class JFormFieldSermon extends JFormFieldList
if ($user->authorise('sermon.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 3px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@ -28,7 +28,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// import the list field type
jimport('joomla.form.helper');

View File

@ -171,6 +171,7 @@
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL"
description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default=""
required="true"
@ -183,6 +184,7 @@
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL"
description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
button="false"
@ -218,6 +220,7 @@
name="article"
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ARTICLE_LABEL"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default="0"
required="true"

View File

@ -37,8 +37,8 @@ use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
/**
* Sermondistributor Help_document Admin Model

View File

@ -32,10 +32,10 @@ use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\JsonHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Help_documents List Model

View File

@ -36,7 +36,7 @@ use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use PhpOffice\PhpSpreadsheet\IOFactory;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
/***
* Sermondistributor Import Base Database Model

View File

@ -37,9 +37,9 @@ use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
/**
* Sermondistributor Local_listing Admin Model

View File

@ -32,10 +32,10 @@ use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
/**
* Local_listings List Model

View File

@ -31,9 +31,9 @@ use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\JsonHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\JsonHelper;
/**
* Sermondistributor List Model for Manual_updater

View File

@ -37,9 +37,9 @@ use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
/**
* Sermondistributor Preacher Admin Model

View File

@ -32,9 +32,9 @@ use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Preachers List Model

View File

@ -37,9 +37,9 @@ use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
/**
* Sermondistributor Series Admin Model

View File

@ -32,9 +32,9 @@ use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Series_list List Model

View File

@ -37,9 +37,9 @@ use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
/**
* Sermondistributor Sermon Admin Model

View File

@ -34,8 +34,8 @@ use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor List Model
@ -327,7 +327,7 @@ class SermondistributorModelSermondistributor extends ListModel
var activeVersion = tagreleases[0].tag_name.substring(1);
if (activeVersion === manifest.version) {
// local version is in sync with latest release
jQuery(".update-notice").html("<small><span style=\'color:green;\'><span class=\'icon-shield\'></span>'.Text::_('COM_SERMONDISTRIBUTOR_UP_TO_DATE').'</span></small>");
jQuery(".update-notice").html("<small><span style=\'color:green;\'><span class=\'icon-shield\'></span>&nbsp;'.Text::_('COM_SERMONDISTRIBUTOR_UP_TO_DATE').'</span></small>");
} else {
// split versions in to array
var activeVersionArray = activeVersion.split(".");
@ -336,10 +336,10 @@ class SermondistributorModelSermondistributor extends ListModel
(+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] > +activeVersionArray[1]) ||
(+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] == +activeVersionArray[1] && +localVersionArray[2] > +activeVersionArray[2])) {
// local version head latest release
jQuery(".update-notice").html("<small><span style=\'color:#F7B033;\'><span class=\'icon-wrench\'></span>'.Text::_('COM_SERMONDISTRIBUTOR_BETA_RELEASE').'</span></small>");
jQuery(".update-notice").html("<small><span style=\'color:#F7B033;\'><span class=\'icon-wrench\'></span>&nbsp;'.Text::_('COM_SERMONDISTRIBUTOR_PRE_RELEASE').'</span></small>");
} else {
// local version behind latest release
jQuery(".update-notice").html("<small><span style=\'color:red;\'><span class=\'icon-warning-circle\'></span>'.Text::_('COM_SERMONDISTRIBUTOR_OUT_OF_DATE').'</span></small>");
jQuery(".update-notice").html("<small><span style=\'color:red;\'><span class=\'icon-warning-circle\'></span>&nbsp;'.Text::_('COM_SERMONDISTRIBUTOR_OUT_OF_DATE').'</span></small>");
}
}
// set the taged releases

View File

@ -32,9 +32,9 @@ use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermons List Model

View File

@ -37,8 +37,8 @@ use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
/**
* Sermondistributor Statistic Admin Model

View File

@ -32,9 +32,9 @@ use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Statistics List Model

View File

@ -25,49 +25,12 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// register additional namespace
\spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla'
];
// Start the search and load if found
$found = false;
$found_base_dir = "";
$found_len = 0;
foreach ($search as $base_dir => $prefix)
{
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) === 0)
{
// we have a match so load the values
$found = true;
$found_base_dir = $base_dir;
$found_len = $len;
// done here
break;
}
}
// check if we found a match
if (!$found)
{
// not found so move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $found_len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file))
{
require $file;
}
});
// The power autoloader for this project (JPATH_ADMINISTRATOR) area.
$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_sermondistributor/helpers/powerloader.php';
if (file_exists($power_autoloader))
{
require_once $power_autoloader;
}
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

View File

@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_preacher` (
`icon` CHAR(64) NOT NULL DEFAULT '',
`name` VARCHAR(255) NOT NULL DEFAULT '',
`website` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -52,7 +52,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_sermon` (
`source` TINYINT(1) NOT NULL DEFAULT 0,
`tags` CHAR(11) NOT NULL DEFAULT 0,
`url` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -90,7 +90,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_series` (
`icon` CHAR(64) NOT NULL DEFAULT '',
`name` VARCHAR(255) NOT NULL DEFAULT '',
`scripture` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -123,7 +123,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_statistic` (
`preacher` INT(11) NOT NULL DEFAULT 0,
`series` INT(11) NOT NULL DEFAULT 0,
`sermon` INT(11) NOT NULL DEFAULT 0,
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -165,7 +165,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_external_source` (
`sharedurl` TEXT NOT NULL,
`update_method` TINYINT NOT NULL DEFAULT 0,
`update_timer` INT(1) NOT NULL DEFAULT 0,
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -198,7 +198,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_local_listing` (
`name` VARCHAR(255) NOT NULL DEFAULT '',
`size` INT(50) NOT NULL DEFAULT 0,
`url` TEXT NOT NULL,
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -233,7 +233,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_help_document` (
`title` CHAR(64) NOT NULL DEFAULT '',
`type` TINYINT(1) NOT NULL DEFAULT 0,
`url` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,

View File

@ -0,0 +1 @@

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* External_source Html View class

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor Html View class for the External_sources

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Help_document Html View class

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor Html View class for the Help_documents

View File

@ -28,8 +28,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
Html::_('jquery.framework');
Html::_('bootstrap.tooltip');
Html::_('script', 'system/core.js', false, true);

View File

@ -29,7 +29,7 @@ use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor Import Html View

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Local_listing Html View class

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor Html View class for the Local_listings

View File

@ -30,8 +30,9 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use Joomla\CMS\Session\Session;
Html::addIncludePath(JPATH_COMPONENT.'/helpers/html');
Html::_('behavior.formvalidator');
Html::_('formbehavior.chosen', 'select');
@ -127,7 +128,7 @@ jQuery(document).ready(function($) {
</div>
<script>
// token
var token = '<?php echo \JSession::getFormToken(); ?>';
var token = '<?php echo Session::getFormToken(); ?>';
// nice little dot trick :)
jQuery(document).ready( function($) {
var x=0;

View File

@ -34,8 +34,8 @@ use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Filesystem\File;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor Html View class for the Manual_updater

View File

@ -38,7 +38,7 @@ use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Filesystem\File;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Preacher Html View class

View File

@ -38,8 +38,8 @@ use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Filesystem\File;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor Html View class for the Preachers

View File

@ -38,7 +38,7 @@ use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Filesystem\File;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Series Html View class

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor Html View class for the Series_list

View File

@ -38,7 +38,7 @@ use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Filesystem\File;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermon Html View class

View File

@ -26,7 +26,7 @@
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
use VDM\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
?>
<img alt="<?php echo Text::_('COM_SERMONDISTRIBUTOR'); ?>" src="components/com_sermondistributor/assets/images/vdm-component.jpg">

View File

@ -30,7 +30,7 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor View class

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor Html View class for the Sermons

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Statistic Html View class

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**
* Sermondistributor Html View class for the Statistics

View File

@ -13,13 +13,13 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt;
namespace TrueChristianChurch\Joomla\FOF\Encrypt;
use VDM\Joomla\FOF\Encrypt\AES\AesInterface;
use VDM\Joomla\FOF\Encrypt\AES\Mcrypt;
use VDM\Joomla\FOF\Encrypt\AES\Openssl;
use VDM\Joomla\FOF\Utils\Phpfunc;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\AesInterface;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\Mcrypt;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\Openssl;
use TrueChristianChurch\Joomla\FOF\Utils\Phpfunc;
/**

View File

@ -13,7 +13,7 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt\AES;
namespace TrueChristianChurch\Joomla\FOF\Encrypt\AES;
/**

View File

@ -13,10 +13,10 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt\AES;
namespace TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\FOF\Utils\Phpfunc;
use TrueChristianChurch\Joomla\FOF\Utils\Phpfunc;
/**

View File

@ -13,13 +13,13 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt\AES;
namespace TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\FOF\Encrypt\Randval;
use VDM\Joomla\FOF\Utils\Phpfunc;
use VDM\Joomla\FOF\Encrypt\AES\AesInterface;
use VDM\Joomla\FOF\Encrypt\AES\Abstraction;
use TrueChristianChurch\Joomla\FOF\Encrypt\Randval;
use TrueChristianChurch\Joomla\FOF\Utils\Phpfunc;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\AesInterface;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\Abstraction;
/**

View File

@ -13,13 +13,13 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt\AES;
namespace TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\FOF\Encrypt\Randval;
use VDM\Joomla\FOF\Utils\Phpfunc;
use VDM\Joomla\FOF\Encrypt\AES\AesInterface;
use VDM\Joomla\FOF\Encrypt\AES\Abstraction;
use TrueChristianChurch\Joomla\FOF\Encrypt\Randval;
use TrueChristianChurch\Joomla\FOF\Utils\Phpfunc;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\AesInterface;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\Abstraction;
/**

View File

@ -13,10 +13,10 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt;
namespace TrueChristianChurch\Joomla\FOF\Encrypt;
use VDM\Joomla\FOF\Encrypt\Randvalinterface;
use TrueChristianChurch\Joomla\FOF\Encrypt\Randvalinterface;
/**

View File

@ -13,7 +13,7 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt;
namespace TrueChristianChurch\Joomla\FOF\Encrypt;
/**

View File

@ -7,7 +7,7 @@
* @note This file has been modified by the Joomla! Project (and VDM) and no longer reflects the original work of its author.
* @depreciation This was ported for the sake of those who have stuff encrypted with the FOF encryption suite.
*/
namespace VDM\Joomla\FOF\Utils;
namespace TrueChristianChurch\Joomla\FOF\Utils;
/**

View File

@ -0,0 +1,65 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 3.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage Schema.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
namespace TrueChristianChurch\Joomla\SermonDistributor\Table;
use TrueChristianChurch\Joomla\SermonDistributor\Table;
use TrueChristianChurch\Joomla\Interfaces\SchemaInterface;
use TrueChristianChurch\Joomla\Abstraction\Schema as ExtendingSchema;
/**
* SermonDistributor Tables Schema
*
* @since 3.0.8
*/
final class Schema extends ExtendingSchema implements SchemaInterface
{
/**
* Constructor.
*
* @param Table $table The Table Class.
*
* @since 3.0.8
*/
public function __construct(?Table $table = null)
{
$table ??= new Table;
parent::__construct($table);
}
/**
* Get the targeted component code
*
* @return string
* @since 3.0.8
*/
protected function getCode(): string
{
return 'sermondistributor';
}
}

View File

@ -0,0 +1,502 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace TrueChristianChurch\Joomla\Abstraction;
use TrueChristianChurch\Joomla\Interfaces\Tableinterface;
/**
* Base Table
*
* @since 3.2.0
*/
abstract class BaseTable implements Tableinterface
{
/**
* All areas/views/tables with their field details
*
* @var array
* @since 3.2.0
**/
protected array $tables;
/**
* All default fields
*
* @var array
* @since 3.2.1
**/
protected array $defaults = [
'id' => [
'order' => -1,
'name' => 'id',
'label' => 'ID',
'type' => 'text',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(11)',
'default' => 'EMPTY',
'auto_increment' => true,
'primary_key' => true,
'null_switch' => 'NOT NULL'
]
],
'asset_id' => [
'name' => 'asset_id',
'label' => NULL,
'type' => NULL,
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'comment' => 'FK to the #__assets table.'
]
],
'ordering' => [
'name' => 'ordering',
'label' => 'Ordering',
'type' => 'number',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(11)',
'default' => '0',
'null_switch' => 'NOT NULL'
]
],
'published' => [
'name' => 'published',
'label' => 'Status',
'type' => 'list',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'TINYINT(3)',
'default' => '1',
'null_switch' => 'NOT NULL',
'key' => true,
'key_name' => 'state'
]
],
'modified_by' => [
'name' => 'modified_by',
'label' => 'Modified by',
'type' => 'user',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'key' => true,
'key_name' => 'modifiedby'
]
],
'modified' => [
'name' => 'modified',
'label' => 'Modified',
'type' => 'calendar',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NOT NULL'
]
],
'created_by' => [
'name' => 'created_by',
'label' => 'Created by',
'type' => 'user',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'key' => true,
'key_name' => 'createdby'
]
],
'created' => [
'name' => 'created',
'label' => 'Created',
'type' => 'calendar',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NOT NULL'
]
],
'checked_out' => [
'name' => 'checked_out',
'label' => NULL,
'type' => NULL,
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'key' => true,
'key_name' => 'checkout'
]
],
'checked_out_time' => [
'name' => 'checked_out_time',
'label' => NULL,
'type' => NULL,
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NOT NULL'
]
],
'hits' => [
'name' => 'hits',
'label' => 'Hits',
'type' => 'number',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL'
]
],
'version' => [
'name' => 'version',
'label' => 'Version',
'type' => 'text',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '1',
'null_switch' => 'NOT NULL'
]
],
'params' => [
'name' => 'params',
'label' => NULL,
'type' => NULL,
'title' => false,
'list' => NULL,
'store' => 'json',
'tab_name' => NULL,
'db' => [
'type' => 'TEXT',
'default' => 'EMPTY',
'null_switch' => 'NULL'
]
]
];
/**
* Get any value from a item/field/column of an area/view/table
* Example: $this->get('table_name', 'field_name', 'value_key');
* Get an item/field/column of an area/view/table
* Example: $this->get('table_name', 'field_name');
* Get all items/fields/columns of an area/view/table
* Example: $this->get('table_name');
* Get all areas/views/tables with all their item/field/column details
* Example: $this->get('All');
* Example: $this->get();
*
* @param string|null $table The table
* @param string|null $field The field
* @param string|null $key The value key
*
* @return mixed
* @since 3.2.1
*/
public function get(?string $table = null, ?string $field = null, ?string $key = null)
{
// Return specific value
if ($table && $field && $key)
{
return $this->tables[$table][$field][$key] ?? $this->getDefaultKey($field, $key);
}
// Return field within table
if ($table && $field)
{
return $this->tables[$table][$field] ?? $this->getDefault($field);
}
// Return all fields in a table or all tables if 'All' is passed
if ($table)
{
if (strtoupper($table) === 'ALL')
{
return $this->tables;
}
return $this->tables[$table] ?? null;
}
// Return all tables
return $this->tables;
}
/**
* Get title field from an area/view/table
*
* @param string $table The area
*
* @return ?array
* @since 3.2.0
*/
public function title(string $table): ?array
{
// return the title item/field/column of an area/view/table
if (($table = $this->get($table)) !== null)
{
foreach ($table as $item)
{
if ($item['title'])
{
return $item;
}
}
}
// none found
return null;
}
/**
* Get title field name
*
* @param string $table The area
*
* @return string
* @since 3.2.0
*/
public function titleName(string $table): string
{
// return the title name of an area/view/table
if (($field = $this->title($table)) !== null)
{
return $field['name'];
}
// none found default to ID
return 'id';
}
/**
* Get all tables
*
* @return array
* @since 3.2.0
*/
public function tables(): array
{
// return all areas/views/tables
return array_keys($this->tables);
}
/**
* Check if a table (and field) exist
*
* @param string $table The area
* @param string|null $field The area
*
* @return bool
* @since 3.2.0
*/
public function exist(string $table, ?string $field = null): bool
{
if (isset($this->tables[$table]))
{
// if we have a field
if (is_string($field))
{
if (isset($this->tables[$table][$field]))
{
return true;
}
}
else
{
return true;
}
}
return $this->isDefault($field);
}
/**
* Get all fields of an area/view/table
*
* @param string $table The area
* @param bool $default Add the default fields
* @param bool $details Add/Leave fields the details
*
* @return array|null On success an array of fields
* @since 3.2.0
*/
public function fields(string $table, bool $default = false, bool $details = false): ?array
{
// Retrieve fields from the specified table
$fields = $this->get($table);
if ($fields === null)
{
return null;
}
// Determine the fields output based on the $default and $details flags
if ($details)
{
return $default ? $this->addDefaultDetails($fields) : $fields;
}
$fieldKeys = array_keys($fields);
return $default ? $this->addDefault($fieldKeys) : $fieldKeys;
}
/**
* Add the default fields
*
* @param array $fields The table dynamic fields
*
* @return array Fields (with defaults added)
* @since 3.2.0
*/
protected function addDefault(array $fields): array
{
// add default fields
foreach ($this->defaults as $default)
{
if (in_array($default['name'], $fields))
{
continue;
}
// used just for loading the fields
$order = $default['order'] ?? 1;
unset($default['order']);
if ($order < 0)
{
array_unshift($fields, $default['name']);
}
else
{
$fields[] = $default['name'];
}
}
return $fields;
}
/**
* Add the default fields
*
* @param array $fields The table dynamic fields
*
* @return array Fields (with defaults details added)
* @since 3.2.0
*/
protected function addDefaultDetails(array $fields): array
{
// add default fields
foreach ($this->defaults as $default)
{
// remove ordering for now
unset($default['order']);
if (!isset($fields[$default['name']]))
{
$fields[$default['name']] = $default;
}
}
return $fields;
}
/**
* Check if the field is a default field
*
* @param string $field The field to check
*
* @return bool True if a default field
* @since 3.2.0
*/
protected function isDefault(string $field): bool
{
return isset($this->defaults[$field]);
}
/**
* Get a default field
*
* @param string $field The field to check
*
* @return array|null True if a default field
* @since 3.2.0
*/
protected function getDefault(string $field): ?array
{
return $this->defaults[$field] ?? null;
}
/**
* Get a default field property
*
* @param string $field The field to check
* @param string $key The field key/property to check
*
* @return mixed String value if a default field property exist
* @since 3.2.0
*/
protected function getDefaultKey(string $field, string $key)
{
return $this->defaults[$field][$key] ?? null;
}
}

View File

@ -0,0 +1,754 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace TrueChristianChurch\Joomla\Abstraction;
use Joomla\CMS\Factory;
use Joomla\CMS\Version;
use TrueChristianChurch\Joomla\Interfaces\Tableinterface as Table;
use TrueChristianChurch\Joomla\Interfaces\SchemaInterface;
/**
* Schema Checking
*
* @since 3.2.1
*/
abstract class Schema implements SchemaInterface
{
/**
* The Table Class.
*
* @var Table
* @since 3.2.1
*/
protected Table $table;
/**
* The Database Class
*
* @since 3.2.1
*/
protected $db;
/**
* The local tables
*
* @var array
* @since 3.2.1
*/
private array $tables;
/**
* The component table prefix
*
* @var string
* @since 3.2.1
*/
private string $prefix;
/**
* The field unique keys
*
* @var array
* @since 3.2.1
*/
private array $uniqueKeys;
/**
* The field keys
*
* @var array
* @since 3.2.1
*/
private array $keys;
/**
* The current table columns
*
* @var array
* @since 3.2.1
*/
private array $columns;
/**
* The success messages of the action
*
* @var array
* @since 3.2.1
*/
private array $success;
/**
* Current Joomla Version We are IN
*
* @var int
* @since 3.2.1
**/
protected $currentVersion;
/**
* Constructor.
*
* @param Table $table The Table Class.
*
* @since 3.2.1
* @throws \Exception If the database fails
*/
public function __construct(Table $table)
{
$this->table = $table;
try {
// set the database object
$this->db = Factory::getDbo();
// get current component tables
$this->tables = $this->db->getTableList();
// set the component table
$this->prefix = $this->db->getPrefix() . $this->getCode();
// set the current version
$this->currentVersion = Version::MAJOR_VERSION;
} catch (\Exception $e) {
throw new \Exception("Error: failed to initialize schema class due to a database error.");
}
}
/**
* Check and update database schema for missing fields or tables.
*
* @return array The array of successful updates/actions, if empty no update/action was taken.
* @since 3.2.1
* @throws \Exception If there is an error during the update process.
*/
public function update(): array
{
try {
$this->success = [
"Success: scan of the component tables started."
];
foreach ($this->table->tables() as $table)
{
$this->uniqueKeys = [];
$this->keys = [];
if ($this->tableExists($table))
{
$this->updateSchema($table);
}
else
{
$this->createTable($table);
}
}
} catch (\Exception $e) {
throw new \Exception("Error: updating database schema. " . $e->getMessage());
}
if (count($this->success) == 1)
{
$this->success[] = "Success: scan of the component tables completed with no update needed.";
}
else
{
$this->success[] = "Success: scan of the component tables completed.";
}
return $this->success;
}
/**
* Get the targeted component code
*
* @return string
* @since 3.2.1
*/
abstract protected function getCode(): string;
/**
* Check if a table exists in the database.
*
* @param string $table The name of the table to check.
*
* @return bool True if table exists, False otherwise.
* @since 3.2.1
*/
protected function tableExists(string $table): bool
{
return in_array($this->getTable($table), $this->tables);
}
/**
* Update the schema of an existing table.
*
* @param string $table The table to update.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error while updating the schema.
*/
public function updateSchema(string $table): void
{
try {
$existingColumns = $this->getExistingColumns($table);
$expectedColumns = $this->table->fields($table, true);
$missingColumns = array_diff($expectedColumns, $existingColumns);
if (!empty($missingColumns))
{
$this->addMissingColumns($table, $missingColumns);
}
$this->checkColumnsDataType($table, $expectedColumns);
} catch (\Exception $e) {
throw new \Exception("Error: updating schema for $table table. " . $e->getMessage());
}
if (!empty($missingColumns))
{
$column_s = (count($missingColumns) == 1) ? 'column' : 'columns';
$missingColumns = implode(', ', $missingColumns);
$this->success[] = "Success: added missing ($missingColumns) $column_s to $table table.";
}
}
/**
* Create a table with all necessary fields.
*
* @param string $table The name of the table to create.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error creating the table.
*/
public function createTable(string $table): void
{
try {
$columns = [];
$fields = $this->table->fields($table, true);
$createTable = 'CREATE TABLE IF NOT EXISTS ' . $this->db->quoteName($this->getTable($table));
foreach ($fields as $field)
{
if (($def = $this->getColumnDefinition($table, $field)) !== null)
{
$columns[] = $def;
}
}
$columnDefinitions = implode(', ', $columns);
$keys = $this->getTableKeys();
$createTableSql = "$createTable ($columnDefinitions, $keys)";
$this->db->setQuery($createTableSql);
$this->db->execute();
} catch (\Exception $e) {
throw new \Exception("Error: failed to create missing $table table. " . $e->getMessage());
}
$this->success[] = "Success: created missing $table table.";
}
/**
* Fetch existing columns from a database table.
*
* @param string $table The name of the table.
*
* @return array An array of column names.
* @since 3.2.1
*/
protected function getExistingColumns(string $table): array
{
$this->columns = $this->db->getTableColumns($this->getTable($table), false);
return array_keys($this->columns);
}
/**
* Add missing columns to a table.
*
* @param string $table The table to update.
* @param array $columns List of missing columns/fields.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error adding columns.
*/
protected function addMissingColumns(string $table, array $columns): void
{
try {
$query = $this->db->getQuery(true);
$alterTable = 'ALTER TABLE ' . $this->db->quoteName($this->getTable($table)) . ' ';
// Start an ALTER TABLE query
$alterQueries = [];
foreach ($columns as $column)
{
if (($def = $this->getColumnDefinition($table, $column)) !== null)
{
$alterQueries[] = " ADD " . $def;
}
}
$this->db->setQuery($alterTable . implode(', ', $alterQueries));
$this->db->execute();
} catch (\Exception $e) {
$column_s = (count($columns) == 1) ? 'column' : 'columns';
$columns = implode(', ', $columns);
throw new \Exception("Error: failed to add ($columns) $column_s to $table table. " . $e->getMessage());
}
}
/**
* Validate and update the data type of existing fields/columns
*
* @param string $table The table to update.
* @param array $columns List of columns/fields to check.
*
* @return void
* @since 3.2.1
*/
protected function checkColumnsDataType(string $table, array $columns): void
{
$requireUpdate = [];
foreach ($columns as $column)
{
$current = $this->columns[$column] ?? null;
if ($current === null || ($expected = $this->table->get($table, $column, 'db')) === null)
{
continue;
}
// check if the data type and size match
if ($this->isDataTypeChangeSignificant($current->Type, $expected['type']))
{
$requireUpdate[$column] = [
'column' => $column,
'current' => $current->Type,
'expected' => $expected['type']
];
}
// check if update of default values is needed
if ($this->checkDefault($table, $column) && !isset($requireUpdate[$column]))
{
$requireUpdate[$column] = [
'column' => $column,
'current' => $current->Type,
'expected' => $expected['type']
];
}
}
if (!empty($requireUpdate))
{
$this->updateColumnsDataType($table, $requireUpdate);
}
}
/**
* Generates a SQL snippet for defining a table column, incorporating column type,
* default value, nullability, and auto-increment properties.
*
* @param string $table The table name to be used.
* @param string $field The field name in the table to generate SQL for.
*
* @return string|null The SQL snippet for the column definition.
* @since 3.2.1
* @throws \Exception If the schema details cannot be retrieved or the SQL statement cannot be constructed properly.
*/
protected function getColumnDefinition(string $table, string $field): ?string
{
try {
// Retrieve the database schema details for the specified table and field
if (($db = $this->table->get($table, $field, 'db')) === null)
{
return null;
}
// Prepare the column name
$column_name = $this->db->quoteName($field);
$db['name'] = $field;
// Prepare the type and default value SQL statement
$type = $db['type'] ?? 'TEXT';
$db_default = isset($db['default']) ? $db['default'] : null;
$default = $this->getDefaultValue($type, $db_default);
// Prepare the null switch, and auto increment statement
$null_switch = !empty($db['null_switch']) ? " " . $db['null_switch'] : '';
$auto_increment = !empty($db['auto_increment']) ? " AUTO_INCREMENT" : '';
$this->setKeys($db);
// Assemble the SQL snippet for the column definition
return "{$column_name} {$type}{$null_switch}{$default}{$auto_increment}";
} catch (\Exception $e) {
throw new \Exception("Error: failed to generate column definition for ($table.$field). " . $e->getMessage());
}
}
/**
* Check and Update the default values if needed, including existing data adjustments
*
* @param string $table The table to update.
* @param string $column The column/field to check.
*
* @return bool
* @since 3.2.1
*/
protected function checkDefault(string $table, string $column): bool
{
// Retrieve the expected column configuration
$expected = $this->table->get($table, $column, 'db');
// Skip updates if the column is auto_increment
if (isset($expected['auto_increment']) && $expected['auto_increment'] === true)
{
return false;
}
// Retrieve the current column configuration
$current = $this->columns[$column];
// Determine the new default value based on the expected settings
$type = $expected['type'] ?? 'TEXT';
$db_default = isset($expected['default']) ? $expected['default'] : null;
$newDefault = $this->getDefaultValue($type, $db_default, true);
// First, adjust existing rows to conform to the new default if necessary
if (is_numeric($newDefault) && $this->adjustExistingDefaults($table, $column, $current->Default, $newDefault))
{
$this->success[] = "Success: updated the ($column) defaults in $table table.";
return true;
}
if (is_string($expected['default']) && strtoupper($expected['default']) === 'EMPTY' &&
is_string($current->Default) && strpos($current->Default, 'EMPTY') !== false)
{
return true; // little fix
}
return false;
}
/**
* Update the data type of the given fields.
*
* @param string $table The table to update.
* @param array $columns List of columns/fields that must be updated.
*
* @return void
* @since 3.2.1
*/
protected function updateColumnsDataType(string $table, array $columns): void
{
$alterTable = 'ALTER TABLE ' . $this->db->quoteName($this->getTable($table));
foreach ($columns as $column => $types)
{
if (($def = $this->getColumnDefinition($table, $column)) === null)
{
continue;
}
$dbField = $this->db->quoteName($column);
$alterQuery = "$alterTable CHANGE $dbField ". $def;
if ($this->updateColumnDataType($alterQuery, $table, $column))
{
$current = $types['current'] ?? 'error';
$expected = $types['expected'] ?? 'error';
$this->success[] = "Success: updated ($column) column datatype $current to $expected in $table table.";
}
}
}
/**
* Add the component name to get the full table name.
*
* @param string $table The table name.
*
* @return void
* @since 3.2.1
*/
protected function getTable(string $table): string
{
return $this->prefix . '_' . $table;
}
/**
* Determines if the change in data type between two definitions is significant.
*
* This function checks if there's a significant difference between the current
* data type and the expected data type that would require updating the database schema.
* It ignores display width for numeric types where MySQL considers these attributes
* irrelevant for storage but considers size and other modifiers for types like VARCHAR.
*
* @param string $currentType The current data type from the database schema.
* @param string $expectedType The expected data type to validate against.
*
* @return bool Returns true if the data type change is significant, otherwise false.
* @since 3.2.1
*/
protected function isDataTypeChangeSignificant(string $currentType, string $expectedType): bool
{
// Normalize both input types to lowercase for case-insensitive comparison
$currentType = strtolower($currentType);
$expectedType = strtolower($expectedType);
// Regex to extract the base data type and numeric parameters with named groups
$typePattern = '/^(?<datatype>\w+)(\((?<params>\d+(,\d+)?)\))?/';
// Match types and parameters
preg_match($typePattern, $currentType, $currentMatches);
preg_match($typePattern, $expectedType, $expectedMatches);
// Compare base types
if ($currentMatches['datatype'] !== $expectedMatches['datatype'])
{
return true; // Base types differ
}
// Define types where size and other modifiers are irrelevant
$sizeIrrelevantTypes = [
'int', 'tinyint', 'smallint', 'mediumint', 'bigint',
'float', 'double', 'decimal', 'numeric' // Numeric types where display width is irrelevant
];
// If the type is not in the size irrelevant list, compare full definitions
if (!in_array($currentMatches['datatype'], $sizeIrrelevantTypes))
{
return $currentType !== $expectedType; // Use full definition for types where size matters
}
// For size irrelevant types, only compare base type, ignoring size and unsigned
$currentBaseType = preg_replace('/\(\d+(,\d+)?\)|unsigned/', '', $currentType);
$expectedBaseType = preg_replace('/\(\d+(,\d+)?\)|unsigned/', '', $expectedType);
// Perform a final comparison for numeric types ignoring size
return $currentBaseType !== $expectedBaseType;
}
/**
* Updates existing rows in a column to a new default value
*
* @param string $table The table to update.
* @param string $column The column to update.
* @param mixed $currentDefault Current default value.
* @param mixed $newDefault The new default value to be set.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error updating column defaults.
*/
protected function adjustExistingDefaults(string $table, string $column, $currentDefault, $newDefault): bool
{
// Determine if adjustment is needed based on new and current defaults
if ($newDefault !== $currentDefault)
{
try {
// Format the new default for SQL use
$sqlDefault = $this->db->quote($newDefault);
$updateTable = 'UPDATE ' . $this->db->quoteName($this->getTable($table));
$dbField = $this->db->quoteName($column);
// Update SQL to set new default on existing rows where the default is currently the old default
$sql = $updateTable . " SET $dbField = $sqlDefault WHERE $dbField IS NULL OR $dbField = ''";
// Execute the update
$this->db->setQuery($sql);
return $this->db->execute();
} catch (\Exception $e) {
throw new \Exception("Error: failed to update ($column) column defaults in $table table. " . $e->getMessage());
}
}
return false;
}
/**
* Update the data type of the given field.
*
* @param string $updateString The SQL command to update the column data type
* @param string $table The table to update.
* @param string $field Column/field that must be updated.
*
* @return bool true on succes
* @since 3.2.1
* @throws \Exception If there is an error adding columns.
*/
protected function updateColumnDataType(string $updateString, string $table, string $field): bool
{
try {
$this->db->setQuery($updateString);
return $this->db->execute();
} catch (\Exception $e) {
throw new \Exception("Error: failed to update the datatype of ($field) column in $table table. " . $e->getMessage());
}
}
/**
* Key all needed keys for this table
*
* @return string of keys
* @since 3.2.1
*/
protected function getTableKeys(): string
{
$keys = [];
$keys[] = 'PRIMARY KEY (`id`)'; // TODO (we may want this to be dynamicly set)
if (!empty($this->uniqueKeys))
{
$keys[] = implode(', ', $this->uniqueKeys);
}
if (!empty($this->keys))
{
$keys[] = implode(', ', $this->keys);
}
return implode(', ', $keys);
}
/**
* Function to set the view keys
*
* @param string $column The field column database array values
*
* @return void
* @since 3.2.1
*/
protected function setKeys(array $column): void
{
$this->setUniqueKey($column);
$this->setKey($column);
}
/**
* Function to set the unique key
*
* @param string $column The field column database array values
*
* @return void
* @since 3.2.1
*/
protected function setUniqueKey(array $column): void
{
if (isset($column['unique_key']) && $column['unique_key'])
{
$key = $column['unique_key_name'] ?? $column['name'];
$this->uniqueKeys[] = "UNIQUE KEY `idx_" . $key . "` (`" . $column['name'] . "`)";
}
}
/**
* Function to set the key
*
* @param string $column The field column database array values
*
* @return void
* @since 3.2.1
*/
protected function setKey(array $column): void
{
if (isset($column['key']) && $column['key'])
{
$key = $column['key_name'] ?? $column['name'];
$this->keys[] = "KEY `idx_" . $key . "` (`" . $column['name'] . "`)";
}
}
/**
* Adjusts the default value SQL fragment for a database field based on its type and specific rules.
*
* If the field is of type DATETIME and the Joomla version is not 3, it sets the default to CURRENT_TIMESTAMP
* if not explicitly specified otherwise. For all other types, or when a 'EMPTY' default is specified, it handles
* defaults by either leaving them unset or applying the provided default, properly quoted for SQL safety.
*
* @param string $type The type of the database field (e.g., 'DATETIME').
* @param string|null $defaultValue Optional default value for the field, null if not provided.
* @param bool $pure Optional to add the 'DEFAULT' string or not.
*
* @return string The SQL fragment to set the default value for a field.
* @since 3.2.1
*/
protected function getDefaultValue(string $type, ?string $defaultValue, bool $pure = false): string
{
if ($defaultValue === null)
{
return '';
}
// Set default for DATETIME fields in Joomla versions above 3
if (strtoupper($type) === 'DATETIME' && $this->currentVersion != 3)
{
return $pure ? "CURRENT_TIMESTAMP" : " DEFAULT CURRENT_TIMESTAMP";
}
// Apply and quote the default value
$sql_default = $this->quote($defaultValue);
return $pure ? $defaultValue : " DEFAULT $sql_default";
}
/**
* Set a value based on data type
*
* @param mixed $value The value to set
*
* @return mixed
* @since 3.2.0
**/
protected function quote($value)
{
if ($value === null) // hmm the null does pose an issue (will keep an eye on this)
{
return 'NULL';
}
if (is_string($value) && strtoupper($value) === 'EMPTY')
{
return "''";
}
elseif (is_numeric($value))
{
if (filter_var($value, FILTER_VALIDATE_INT))
{
return (int) $value;
}
elseif (filter_var($value, FILTER_VALIDATE_FLOAT))
{
return (float) $value;
}
}
elseif (is_bool($value)) // not sure if this will work well (but its correct)
{
return $value ? 'TRUE' : 'FALSE';
}
// For date and datetime values
elseif ($value instanceof \DateTime)
{
return $this->db->quote($value->format('Y-m-d H:i:s'));
}
// For other data types, just escape it
return $this->db->quote($value);
}
}

View File

@ -0,0 +1,53 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace TrueChristianChurch\Joomla\Interfaces;
/**
* Schema Checking Interface
*
* @since 3.2.1
*/
interface SchemaInterface
{
/**
* Check and update database schema for missing fields or tables.
*
* @return array The array of successful updates/actions, if empty no update/action was taken.
* @since 3.2.1
* @throws \Exception If there is an error during the update process.
*/
public function update(): array;
/**
* Create a table with all necessary fields.
*
* @param string $table The name of the table to create.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error creating the table.
*/
public function createTable(string $table): void;
/**
* Update the schema of an existing table.
*
* @param string $table The table to update.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error while updating the schema.
*/
public function updateSchema(string $table): void;
}

View File

@ -0,0 +1,91 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace TrueChristianChurch\Joomla\Interfaces;
/**
* The VDM Core Table Interface
*/
interface Tableinterface
{
/**
* Get any value from a item/field/column of an area/view/table
* Example: $this->get('table_name', 'field_name', 'value_key');
* Get an item/field/column of an area/view/table
* Example: $this->get('table_name', 'field_name');
* Get all items/fields/columns of an area/view/table
* Example: $this->get('table_name');
* Get all areas/views/tables with all their item/field/column details
* Example: $this->get('All');
* Example: $this->get();
*
* @param string|null $table The table
* @param string|null $field The field
* @param string|null $key The value key
*
* @return mixed
* @since 3.2.0
*/
public function get(?string $table = null, ?string $field = null, ?string $key = null);
/**
* Get title field from an area/view/table
*
* @param string $table The area
*
* @return ?array
* @since 3.2.0
*/
public function title(string $table): ?array;
/**
* Get title field name
*
* @param string $table The area
*
* @return string
* @since 3.2.0
*/
public function titleName(string $table): string;
/**
* Get all tables
*
* @return array
* @since 3.2.0
*/
public function tables(): array;
/**
* Check if a table (and field) exist
*
* @param string $table The area
* @param string|null $field The area
*
* @return bool
* @since 3.2.0
*/
public function exist(string $table, ?string $field = null): bool;
/**
* Get all fields of an area/view/table
*
* @param string $table The area
* @param bool $default Add the default fields
* @param bool $details Add/Leave fields the details
*
* @return array|null On success an array of fields
* @since 3.2.0
*/
public function fields(string $table, bool $default = false, bool $details = false): ?array;
}

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities;
namespace TrueChristianChurch\Joomla\Utilities;
/**

View File

@ -9,14 +9,14 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities\Component;
namespace TrueChristianChurch\Joomla\Utilities\Component;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\Input\Input;
use Joomla\Registry\Registry;
use VDM\Joomla\Utilities\String\NamespaceHelper;
use TrueChristianChurch\Joomla\Utilities\String\NamespaceHelper;
/**

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities;
namespace TrueChristianChurch\Joomla\Utilities;
use Joomla\CMS\Uri\Uri;
@ -19,7 +19,7 @@ use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\Archive\Archive;
use VDM\Joomla\Utilities\Component\Helper;
use TrueChristianChurch\Joomla\Utilities\Component\Helper;
/**

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities;
namespace TrueChristianChurch\Joomla\Utilities;
use Joomla\CMS\Form\FormHelper as JoomlaFormHelper;
@ -75,24 +75,24 @@ abstract class FormHelper
// element was not returned
return;
}
switch (get_class($node))
if ($node instanceof \stdClass)
{
case 'stdClass':
if (property_exists($node, 'comment'))
{
self::comment($xml, $node->comment);
}
if (property_exists($node, 'fieldXML'))
{
self::append($xml, $node->fieldXML);
}
break;
case 'SimpleXMLElement':
$domXML = \dom_import_simplexml($xml);
$domNode = \dom_import_simplexml($node);
$domXML->appendChild($domXML->ownerDocument->importNode($domNode, true));
$xml = \simplexml_import_dom($domXML);
break;
if (property_exists($node, 'comment'))
{
self::comment($xml, $node->comment);
}
if (property_exists($node, 'fieldXML'))
{
self::append($xml, $node->fieldXML);
}
}
elseif ($node instanceof \SimpleXMLElement)
{
$domXML = \dom_import_simplexml($xml);
$domNode = \dom_import_simplexml($node);
$domXML->appendChild($domXML->ownerDocument->importNode($domNode, true));
$xml = \simplexml_import_dom($domXML);
}
}
@ -127,7 +127,7 @@ abstract class FormHelper
{
foreach ($attributes as $key => $value)
{
$xml->addAttribute($key, $value);
$xml->addAttribute($key, $value ?? '');
}
}
@ -145,7 +145,7 @@ abstract class FormHelper
foreach ($options as $key => $value)
{
$addOption = $xml->addChild('option');
$addOption->addAttribute('value', $key);
$addOption->addAttribute('value', $key ?? '');
$addOption[] = $value;
}
}

View File

@ -9,11 +9,11 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities;
namespace TrueChristianChurch\Joomla\Utilities;
use Joomla\CMS\Factory;
use VDM\Joomla\Utilities\Component\Helper;
use TrueChristianChurch\Joomla\Utilities\Component\Helper;
/**

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities;
namespace TrueChristianChurch\Joomla\Utilities;
/**

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities;
namespace TrueChristianChurch\Joomla\Utilities;
/**

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities;
namespace TrueChristianChurch\Joomla\Utilities;
/**

View File

@ -9,10 +9,10 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities\String;
namespace TrueChristianChurch\Joomla\Utilities\String;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
/**

Some files were not shown because too many files have changed in this diff Show More