Release of v4.0.0-beta4

Add fallback option to ensure that all JCB tables and fields exist. Move the powers autoloader to its own file.
This commit is contained in:
2024-04-22 01:07:22 +02:00
parent e146195159
commit 5e52db0d54
95 changed files with 11151 additions and 6749 deletions

View File

@ -2851,7 +2851,7 @@ class AjaxModel extends ListModel
// #__componentbuilder_joomla_component (a)
'joomla_component' => array(
'search' => array('id', 'system_name', 'php_preflight_install', 'php_postflight_install',
'php_preflight_update', 'php_postflight_update', 'php_method_uninstall',
'php_preflight_update', 'php_postflight_update', 'php_method_uninstall', 'php_method_install',
'php_helper_admin', 'php_admin_event', 'php_helper_both', 'php_helper_site',
'php_site_event', 'javascript', 'readme', 'sql', 'sql_uninstall'),
'views' => 'joomla_components',

View File

@ -289,7 +289,7 @@ class FieldtypeModel extends AdminModel
*
* @return mixed An array of data items on success, false on failure.
*/
public function getVycfields()
public function getVxtfields()
{
// Get the user object.
$user = Factory::getApplication()->getIdentity();
@ -431,13 +431,13 @@ class FieldtypeModel extends AdminModel
foreach ($items as $nr => &$item)
{
// convert datatype
$item->datatype = $this->selectionTranslationVycfields($item->datatype, 'datatype');
$item->datatype = $this->selectionTranslationVxtfields($item->datatype, 'datatype');
// convert indexes
$item->indexes = $this->selectionTranslationVycfields($item->indexes, 'indexes');
$item->indexes = $this->selectionTranslationVxtfields($item->indexes, 'indexes');
// convert null_switch
$item->null_switch = $this->selectionTranslationVycfields($item->null_switch, 'null_switch');
$item->null_switch = $this->selectionTranslationVxtfields($item->null_switch, 'null_switch');
// convert store
$item->store = $this->selectionTranslationVycfields($item->store, 'store');
$item->store = $this->selectionTranslationVxtfields($item->store, 'store');
}
}
@ -451,7 +451,7 @@ class FieldtypeModel extends AdminModel
*
* @return string The translatable string.
*/
public function selectionTranslationVycfields($value,$name)
public function selectionTranslationVxtfields($value,$name)
{
// Array of datatype language strings
if ($name === 'datatype')

View File

@ -97,11 +97,28 @@ class Joomla_componentModel extends AdminModel
'not_required'
)
),
'dynamic_build' => array(
'libs_helpers' => array(
'fullwidth' => array(
'note_buildcomp_dynamic_mysql',
'buildcomp',
'buildcompsql'
'creatuserhelper',
'adduikit',
'addfootable',
'add_email_helper',
'add_php_helper_both',
'php_helper_both',
'add_php_helper_admin',
'php_helper_admin',
'add_admin_event',
'php_admin_event',
'add_php_helper_site',
'php_helper_site',
'add_site_event',
'php_site_event',
'add_javascript',
'javascript',
'add_css_admin',
'css_admin',
'add_css_site',
'css_site'
)
),
'dynamic_integration' => array(
@ -133,15 +150,6 @@ class Joomla_componentModel extends AdminModel
'crowdin_account_api_key'
)
),
'mysql' => array(
'fullwidth' => array(
'add_sql',
'sql',
'add_sql_uninstall',
'sql_uninstall',
'assets_table_fix'
)
),
'dash_install' => array(
'left' => array(
'dashboard_type'
@ -161,31 +169,9 @@ class Joomla_componentModel extends AdminModel
'add_php_postflight_update',
'php_postflight_update',
'add_php_method_uninstall',
'php_method_uninstall'
)
),
'libs_helpers' => array(
'fullwidth' => array(
'creatuserhelper',
'adduikit',
'addfootable',
'add_email_helper',
'add_php_helper_both',
'php_helper_both',
'add_php_helper_admin',
'php_helper_admin',
'add_admin_event',
'php_admin_event',
'add_php_helper_site',
'php_helper_site',
'add_site_event',
'php_site_event',
'add_javascript',
'javascript',
'add_css_admin',
'css_admin',
'add_css_site',
'css_site'
'php_method_uninstall',
'add_php_method_install',
'php_method_install'
)
),
'readme' => array(
@ -197,6 +183,22 @@ class Joomla_componentModel extends AdminModel
'note_readme'
)
),
'mysql' => array(
'fullwidth' => array(
'add_sql',
'sql',
'add_sql_uninstall',
'sql_uninstall',
'assets_table_fix'
)
),
'dynamic_build' => array(
'fullwidth' => array(
'note_buildcomp_dynamic_mysql',
'buildcomp',
'buildcompsql'
)
),
'settings' => array(
'left' => array(
'note_moved_views',
@ -401,42 +403,18 @@ class Joomla_componentModel extends AdminModel
$item->metadata = $registry->toArray();
}
if (!empty($item->sql_uninstall))
{
// base64 Decode sql_uninstall.
$item->sql_uninstall = base64_decode($item->sql_uninstall);
}
if (!empty($item->php_postflight_install))
{
// base64 Decode php_postflight_install.
$item->php_postflight_install = base64_decode($item->php_postflight_install);
}
if (!empty($item->php_site_event))
{
// base64 Decode php_site_event.
$item->php_site_event = base64_decode($item->php_site_event);
}
if (!empty($item->php_helper_both))
{
// base64 Decode php_helper_both.
$item->php_helper_both = base64_decode($item->php_helper_both);
}
if (!empty($item->php_admin_event))
{
// base64 Decode php_admin_event.
$item->php_admin_event = base64_decode($item->php_admin_event);
}
if (!empty($item->css_admin))
{
// base64 Decode css_admin.
$item->css_admin = base64_decode($item->css_admin);
}
if (!empty($item->php_preflight_install))
{
// base64 Decode php_preflight_install.
@ -449,6 +427,30 @@ class Joomla_componentModel extends AdminModel
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
}
if (!empty($item->css_admin))
{
// base64 Decode css_admin.
$item->css_admin = base64_decode($item->css_admin);
}
if (!empty($item->php_postflight_install))
{
// base64 Decode php_postflight_install.
$item->php_postflight_install = base64_decode($item->php_postflight_install);
}
if (!empty($item->sql))
{
// base64 Decode sql.
$item->sql = base64_decode($item->sql);
}
if (!empty($item->buildcompsql))
{
// base64 Decode buildcompsql.
$item->buildcompsql = base64_decode($item->buildcompsql);
}
if (!empty($item->php_helper_admin))
{
// base64 Decode php_helper_admin.
@ -485,16 +487,16 @@ class Joomla_componentModel extends AdminModel
$item->php_postflight_update = base64_decode($item->php_postflight_update);
}
if (!empty($item->sql))
if (!empty($item->php_method_install))
{
// base64 Decode sql.
$item->sql = base64_decode($item->sql);
// base64 Decode php_method_install.
$item->php_method_install = base64_decode($item->php_method_install);
}
if (!empty($item->buildcompsql))
if (!empty($item->sql_uninstall))
{
// base64 Decode buildcompsql.
$item->buildcompsql = base64_decode($item->buildcompsql);
// base64 Decode sql_uninstall.
$item->sql_uninstall = base64_decode($item->sql_uninstall);
}
if (!empty($item->readme))
@ -503,23 +505,29 @@ class Joomla_componentModel extends AdminModel
$item->readme = base64_decode($item->readme);
}
if (!empty($item->php_helper_both))
{
// base64 Decode php_helper_both.
$item->php_helper_both = base64_decode($item->php_helper_both);
}
// Get the basic encryption.
$basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object.
$basic = new AES($basickey);
if (!empty($item->whmcs_key) && $basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true)))
{
// basic decrypt data whmcs_key.
$item->whmcs_key = rtrim($basic->decryptString($item->whmcs_key), "\0");
}
if (!empty($item->crowdin_username) && $basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true)))
{
// basic decrypt data crowdin_username.
$item->crowdin_username = rtrim($basic->decryptString($item->crowdin_username), "\0");
}
if (!empty($item->whmcs_key) && $basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true)))
{
// basic decrypt data whmcs_key.
$item->whmcs_key = rtrim($basic->decryptString($item->whmcs_key), "\0");
}
if (!empty($item->export_key) && $basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true)))
{
// basic decrypt data export_key.
@ -1494,42 +1502,18 @@ class Joomla_componentModel extends AdminModel
$data['addcontributors'] = '';
}
// Set the sql_uninstall string to base64 string.
if (isset($data['sql_uninstall']))
{
$data['sql_uninstall'] = base64_encode($data['sql_uninstall']);
}
// Set the php_postflight_install string to base64 string.
if (isset($data['php_postflight_install']))
{
$data['php_postflight_install'] = base64_encode($data['php_postflight_install']);
}
// Set the php_site_event string to base64 string.
if (isset($data['php_site_event']))
{
$data['php_site_event'] = base64_encode($data['php_site_event']);
}
// Set the php_helper_both string to base64 string.
if (isset($data['php_helper_both']))
{
$data['php_helper_both'] = base64_encode($data['php_helper_both']);
}
// Set the php_admin_event string to base64 string.
if (isset($data['php_admin_event']))
{
$data['php_admin_event'] = base64_encode($data['php_admin_event']);
}
// Set the css_admin string to base64 string.
if (isset($data['css_admin']))
{
$data['css_admin'] = base64_encode($data['css_admin']);
}
// Set the php_preflight_install string to base64 string.
if (isset($data['php_preflight_install']))
{
@ -1542,6 +1526,30 @@ class Joomla_componentModel extends AdminModel
$data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']);
}
// Set the css_admin string to base64 string.
if (isset($data['css_admin']))
{
$data['css_admin'] = base64_encode($data['css_admin']);
}
// Set the php_postflight_install string to base64 string.
if (isset($data['php_postflight_install']))
{
$data['php_postflight_install'] = base64_encode($data['php_postflight_install']);
}
// Set the sql string to base64 string.
if (isset($data['sql']))
{
$data['sql'] = base64_encode($data['sql']);
}
// Set the buildcompsql string to base64 string.
if (isset($data['buildcompsql']))
{
$data['buildcompsql'] = base64_encode($data['buildcompsql']);
}
// Set the php_helper_admin string to base64 string.
if (isset($data['php_helper_admin']))
{
@ -1578,16 +1586,16 @@ class Joomla_componentModel extends AdminModel
$data['php_postflight_update'] = base64_encode($data['php_postflight_update']);
}
// Set the sql string to base64 string.
if (isset($data['sql']))
// Set the php_method_install string to base64 string.
if (isset($data['php_method_install']))
{
$data['sql'] = base64_encode($data['sql']);
$data['php_method_install'] = base64_encode($data['php_method_install']);
}
// Set the buildcompsql string to base64 string.
if (isset($data['buildcompsql']))
// Set the sql_uninstall string to base64 string.
if (isset($data['sql_uninstall']))
{
$data['buildcompsql'] = base64_encode($data['buildcompsql']);
$data['sql_uninstall'] = base64_encode($data['sql_uninstall']);
}
// Set the readme string to base64 string.
@ -1596,23 +1604,29 @@ class Joomla_componentModel extends AdminModel
$data['readme'] = base64_encode($data['readme']);
}
// Set the php_helper_both string to base64 string.
if (isset($data['php_helper_both']))
{
$data['php_helper_both'] = base64_encode($data['php_helper_both']);
}
// Get the basic encryption key.
$basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object
$basic = new AES($basickey);
// Encrypt data whmcs_key.
if (isset($data['whmcs_key']) && $basickey)
{
$data['whmcs_key'] = $basic->encryptString($data['whmcs_key']);
}
// Encrypt data crowdin_username.
if (isset($data['crowdin_username']) && $basickey)
{
$data['crowdin_username'] = $basic->encryptString($data['crowdin_username']);
}
// Encrypt data whmcs_key.
if (isset($data['whmcs_key']) && $basickey)
{
$data['whmcs_key'] = $basic->encryptString($data['whmcs_key']);
}
// Encrypt data export_key.
if (isset($data['export_key']) && $basickey)
{

View File

@ -2146,7 +2146,7 @@ class Joomla_componentsModel extends ListModel
// #__componentbuilder_joomla_component (a)
'joomla_component' => array(
'search' => array('id', 'system_name', 'php_preflight_install', 'php_postflight_install',
'php_preflight_update', 'php_postflight_update', 'php_method_uninstall',
'php_preflight_update', 'php_postflight_update', 'php_method_uninstall', 'php_method_install',
'php_helper_admin', 'php_admin_event', 'php_helper_both', 'php_helper_site',
'php_site_event', 'javascript', 'readme', 'sql', 'sql_uninstall'),
'views' => 'joomla_components',
@ -2745,31 +2745,36 @@ class Joomla_componentsModel extends ListModel
continue;
}
// decode sql_uninstall
$item->sql_uninstall = base64_decode($item->sql_uninstall);
// decode php_postflight_install
$item->php_postflight_install = base64_decode($item->php_postflight_install);
// decode php_site_event
$item->php_site_event = base64_decode($item->php_site_event);
// decode php_helper_both
$item->php_helper_both = base64_decode($item->php_helper_both);
// decode php_admin_event
$item->php_admin_event = base64_decode($item->php_admin_event);
// decode css_admin
$item->css_admin = base64_decode($item->css_admin);
if ($basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true)))
{
// decrypt crowdin_username
$item->crowdin_username = $basic->decryptString($item->crowdin_username);
}
// decode php_preflight_install
$item->php_preflight_install = base64_decode($item->php_preflight_install);
// decode php_method_uninstall
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
// decode css_admin
$item->css_admin = base64_decode($item->css_admin);
// decode php_postflight_install
$item->php_postflight_install = base64_decode($item->php_postflight_install);
// decode sql
$item->sql = base64_decode($item->sql);
// decode buildcompsql
$item->buildcompsql = base64_decode($item->buildcompsql);
// decode php_helper_admin
$item->php_helper_admin = base64_decode($item->php_helper_admin);
// decode php_helper_site
$item->php_helper_site = base64_decode($item->php_helper_site);
if ($basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true)))
{
// decrypt whmcs_key
$item->whmcs_key = $basic->decryptString($item->whmcs_key);
}
// decode php_helper_admin
$item->php_helper_admin = base64_decode($item->php_helper_admin);
// decode php_helper_site
$item->php_helper_site = base64_decode($item->php_helper_site);
// decode javascript
$item->javascript = base64_decode($item->javascript);
// decode css_site
@ -2778,15 +2783,10 @@ class Joomla_componentsModel extends ListModel
$item->php_preflight_update = base64_decode($item->php_preflight_update);
// decode php_postflight_update
$item->php_postflight_update = base64_decode($item->php_postflight_update);
// decode sql
$item->sql = base64_decode($item->sql);
if ($basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true)))
{
// decrypt crowdin_username
$item->crowdin_username = $basic->decryptString($item->crowdin_username);
}
// decode buildcompsql
$item->buildcompsql = base64_decode($item->buildcompsql);
// decode php_method_install
$item->php_method_install = base64_decode($item->php_method_install);
// decode sql_uninstall
$item->sql_uninstall = base64_decode($item->sql_uninstall);
if ($basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true)))
{
// decrypt export_key
@ -2804,6 +2804,8 @@ class Joomla_componentsModel extends ListModel
// decrypt crowdin_account_api_key
$item->crowdin_account_api_key = $basic->decryptString($item->crowdin_account_api_key);
}
// decode php_helper_both
$item->php_helper_both = base64_decode($item->php_helper_both);
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);

View File

@ -746,42 +746,6 @@ class Joomla_moduleModel extends AdminModel
return $data;
}
/**
* Method to validate the form data.
*
* @param JForm $form The form to validate against.
* @param array $data The data to validate.
* @param string $group The name of the field group to validate.
*
* @return mixed Array of filtered data if valid, false otherwise.
*
* @see JFormRule
* @see JFilterInput
* @since 12.2
*/
public function validate($form, $data, $group = null)
{
// check if the not_required field is set
if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required']))
{
$requiredFields = (array) explode(',',(string) $data['not_required']);
$requiredFields = array_unique($requiredFields);
// now change the required field attributes value
foreach ($requiredFields as $requiredField)
{
// make sure there is a string value
if (UtilitiesStringHelper::check($requiredField))
{
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
}
}
}
return parent::validate($form, $data, $group);
}
/**
* Method to get the unique fields of this table.
*

View File

@ -711,42 +711,6 @@ class Joomla_pluginModel extends AdminModel
return $data;
}
/**
* Method to validate the form data.
*
* @param JForm $form The form to validate against.
* @param array $data The data to validate.
* @param string $group The name of the field group to validate.
*
* @return mixed Array of filtered data if valid, false otherwise.
*
* @see JFormRule
* @see JFilterInput
* @since 12.2
*/
public function validate($form, $data, $group = null)
{
// check if the not_required field is set
if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required']))
{
$requiredFields = (array) explode(',',(string) $data['not_required']);
$requiredFields = array_unique($requiredFields);
// now change the required field attributes value
foreach ($requiredFields as $requiredField)
{
// make sure there is a string value
if (UtilitiesStringHelper::check($requiredField))
{
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
}
}
}
return parent::validate($form, $data, $group);
}
/**
* Method to get the unique fields of this table.
*

View File

@ -230,7 +230,7 @@ class ServerModel extends AdminModel
*
* @return mixed An array of data items on success, false on failure.
*/
public function getVymlinked_components()
public function getVydlinked_components()
{
// Get the user object.
$user = Factory::getApplication()->getIdentity();