Release of v5.0.3-alpha4

Fix database default fields to allow NULL. #1169. Fix the power list field to allow search. #1167. Expanded the Demo component in JCB v4 to include more advance features.
This commit is contained in:
Robot 2024-09-18 04:40:33 +02:00
parent fc8fabe298
commit 0603c39cc1
Signed by untrusted user: Robot
GPG Key ID: 14DECD44E7E1BB95
129 changed files with 7128 additions and 1449 deletions

View File

@ -1,7 +1,8 @@
# v5.0.3-alpha3
# v5.0.3-alpha4
- Fix usergrouplist compiler triggers. #1100
- Add field type power integration [init, reset, push]
- Fix database default fields to allow NULL. #1169
- Fix the power list field to allow search. #1167
- Expanded the Demo component in JCB v4 to include more advance features.
# v5.0.3-alpha
@ -9,6 +10,8 @@
- Fix library save as copy error. #1162
- Fix the error when no components exists. #1164
- Fix search page error due to File class.
- Fix usergrouplist compiler triggers. #1100
- Add field type power integration [init, reset, push]
# v5.0.2

View File

@ -1514,10 +1514,10 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
// Fix the assets table rules column size.
$this->setDatabaseAssetsRulesFix(95680, "MEDIUMTEXT");
$this->setDatabaseAssetsRulesFix(95520, "MEDIUMTEXT");
// Install the global extension params.
$this->setExtensionsParams(
'{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","subform_layouts":"default","editor":"none","manage_jcb_package_directories":"2","set_browser_storage":"1","storage_time_to_live":"global","super_powers_documentation":"0","powers_repository":"0","super_powers_repositories":"0","builder_gif_size":"480-272","compiler_plugin":["componentbuilderactionlogcompiler","componentbuilderfieldorderingcompiler","componentbuilderheaderscompiler","componentbuilderpowersautoloadercompiler","componentbuilderprivacycompiler"],"add_menu_prefix":"1","menu_prefix":"»","namespace_prefix":"JCB","minify":"0","language":"en-GB","percentagelanguageadd":"30","assets_table_fix":"2","compiler_field_builder_type":"2","field_name_builder":"1","type_name_builder":"1","import_guid_only":"1","export_language_strings":"1","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_company":"Vast Development Method","export_owner":"Llewellyn van der Merwe","export_email":"joomla@vdm.io","export_website":"https://dev.vdm.io/","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","add_jquery_framework":"1","uikit_load":"1","uikit_min":"","uikit_style":""}'
'{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","subform_layouts":"default","editor":"none","manage_jcb_package_directories":"2","set_browser_storage":"1","storage_time_to_live":"global","super_powers_documentation":"0","powers_repository":"0","super_powers_repositories":"0","builder_gif_size":"480-272","compiler_plugin":["componentbuilderactionlogcompiler","componentbuilderfieldorderingcompiler","componentbuilderheaderscompiler","componentbuilderpowersautoloadercompiler","componentbuilderprivacycompiler"],"add_menu_prefix":"1","menu_prefix":"»","namespace_prefix":"JCB","minify":"0","language":"en-GB","percentagelanguageadd":"30","assets_table_fix":"2","compiler_field_builder_type":"2","field_name_builder":"2","type_name_builder":"2","import_guid_only":"1","export_language_strings":"1","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_company":"Vast Development Method","export_owner":"Llewellyn van der Merwe","export_email":"joomla@vdm.io","export_website":"https://dev.vdm.io/","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","add_jquery_framework":"1","uikit_load":"1","uikit_min":"","uikit_style":""}'
);
@ -3270,7 +3270,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 5.0.3-alpha3 Was Successful! Let us know if anything is not working as expected.</h3></div>';
<h3>Upgrade to Version 5.0.3-alpha4 Was Successful! Let us know if anything is not working as expected.</h3></div>';
// Add/Update component in the action logs extensions table.
$this->setActionLogsExtensions();

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.3-alpha3) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.3-alpha4) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,14 +144,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 23rd August, 2024
+ *Version*: 5.0.3-alpha3
+ *Last Build*: 18th September, 2024
+ *Version*: 5.0.3-alpha4
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **835017**
+ *Line count*: **855127**
+ *Field count*: **2104**
+ *File count*: **5805**
+ *Folder count*: **622**
+ *File count*: **5912**
+ *Folder count*: **630**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.3-alpha3) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.3-alpha4) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,14 +144,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 23rd August, 2024
+ *Version*: 5.0.3-alpha3
+ *Last Build*: 18th September, 2024
+ *Version*: 5.0.3-alpha4
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **835017**
+ *Line count*: **855127**
+ *Field count*: **2104**
+ *File count*: **5805**
+ *Folder count*: **622**
+ *File count*: **5912**
+ *Folder count*: **630**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -314,7 +314,6 @@
<action name="joomla_component.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE_DESC" />
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
<action name="joomla_component.submenu" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC" />
<action name="joomla_module.get_snippets" title="COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
<action name="joomla_module.access" title="COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS_DESC" />
<action name="joomla_module.batch" title="COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE_DESC" />
<action name="joomla_module.create" title="COM_COMPONENTBUILDER_JOOMLA_MODULES_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_MODULES_CREATE_DESC" />

View File

@ -52,7 +52,23 @@ class ###View###Controller extends FormController
* @var string
* @since 1.6
*/
protected $view_list = '###views###';###ADMIN_CUSTOM_BUTTONS_CONTROLLER###
protected $view_list = '###views###';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;###ADMIN_CUSTOM_BUTTONS_CONTROLLER###
/**
* Method override to check if you can add a new record.

View File

@ -0,0 +1,16 @@
<?php
/**
*
* @version 2.0.0 - September 03, 2014
* @package Component Builder
* @author Llewellyn van de Merwe <http://www.vdm.io>
* @copyright Copyright (C) 2014. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*
**/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
[CUSTOMCODE=dynamicDownloadController]

View File

@ -144,6 +144,7 @@
label="COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">

View File

@ -287,7 +287,7 @@
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">

View File

@ -238,10 +238,10 @@
label="COM_COMPONENTBUILDER_POWER_NAMESPACE_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
buttons="add,remove"
icon="list"
max="30"
min="1"
min="0"
nested_depth="1">
<form hidden="true" name="list_namespace_modal" repeat="true">
<!-- Use Field. Type: Text. (joomla) -->
@ -496,7 +496,8 @@
type="namespaces"
name="use"
label="COM_COMPONENTBUILDER_POWER_USE_LABEL"
class="list_class span12"
class="span12"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default="0"
button="false"

View File

@ -264,9 +264,9 @@
label="COM_COMPONENTBUILDER_REPOSITORY_ACCESS_REPO_LABEL"
description="COM_COMPONENTBUILDER_REPOSITORY_ACCESS_REPO_DESCRIPTION"
class="btn-group btn-group-yesno"
default="">
default="0">
<!-- Option Set. -->
<option value="">
<option value="0">
COM_COMPONENTBUILDER_REPOSITORY_GLOBAL</option>
<option value="1">
COM_COMPONENTBUILDER_REPOSITORY_OVERRIDE</option>

View File

@ -1370,6 +1370,7 @@ COM_COMPONENTBUILDER_BULK_UPDATE_ALL_DIVERGED_SNIPPETS="Bulk Update All Diverged
COM_COMPONENTBUILDER_BULK_UPDATE_ALL_OUT_DATED_SNIPPETS="Bulk Update All Out Dated Snippets"
COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_TIME="Button to create %s will show once %s is saved for the first time."
COM_COMPONENTBUILDER_CANCEL="Cancel"
COM_COMPONENTBUILDER_CAN_NOT_SAVE_USER_WITHOUT_EMAIL_VALUE="Can not save user without email value."
COM_COMPONENTBUILDER_CHAIN="Chain"
COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="Check your owner details, it has not been set. Open the JCB Global Options, go to the Company tab and add the correct company details there."
COM_COMPONENTBUILDER_CLASS_EXTENDINGS="Class Extendings"
@ -4988,6 +4989,7 @@ COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED="File <b>%s</b> could not be
COM_COMPONENTBUILDER_FILE_BSB_WAS_MOVED_TO_BSB="File <b>%s</b> was moved to <b>%s</b>"
COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVED_TO_BSB="File <b>%s</b> was not moved to <b>%s</b>"
COM_COMPONENTBUILDER_FILE_BSB_WAS_SUCCESSFULLY_UNLOCKED="File <b>%s</b> was successfully unlocked!"
COM_COMPONENTBUILDER_FILE_TYPE_NOT_VALID_IN_S_AREA="File type not valid in %s area."
COM_COMPONENTBUILDER_FILTER="Filter"
COM_COMPONENTBUILDER_FILTER_ADD_TYPE_ASCENDING="Add Type ascending"
COM_COMPONENTBUILDER_FILTER_ADD_TYPE_DESCENDING="Add Type descending"
@ -5839,7 +5841,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PUBLISHING="Publishing"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README="Readme"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README_LABEL="README.md"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_DESCRIPTION="Should we remove all line breaks (&quot;\r&quot;, &quot;\n&quot;) from all language strings in this component."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_LABEL="Remove line breaks<br /><small>from language strings</small>"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_LABEL="Remove line breaks<br /><small>from language strings<br>This switch will be removed since it must always be true for J4+.</small>"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SALES_SERVER_DESCRIPTION="Select your sales server for this component"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SALES_SERVER_LABEL="Sales Server"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Joomla Component to customise the alias."
@ -6181,8 +6183,6 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_FILE_DESCRIPTION="Leave default if you don't
COM_COMPONENTBUILDER_JOOMLA_MODULE_FILE_HINT="config"
COM_COMPONENTBUILDER_JOOMLA_MODULE_FILE_LABEL="File Name"
COM_COMPONENTBUILDER_JOOMLA_MODULE_FORMS_FIELDS="Forms & Fields"
COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS="Joomla Module Get Snippets Button Access"
COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button."
COM_COMPONENTBUILDER_JOOMLA_MODULE_GUID_DESCRIPTION="Globally Unique Identifier"
COM_COMPONENTBUILDER_JOOMLA_MODULE_GUID_HINT="Auto Generated"
COM_COMPONENTBUILDER_JOOMLA_MODULE_GUID_LABEL="GUID"
@ -7488,7 +7488,7 @@ COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_THREE_DESCRIPTION="There is no be
COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_THREE_LABEL="No Behaviour"
COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_TWO_DESCRIPTION="There is no behaviour set for this library. This means JCB will not add any files unless you custom code it in somewhere."
COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_TWO_LABEL="No Behaviour"
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_LIBRARY_DESCRIPTION="We are working on this feature it is not yet ready, but soon enough you will be able to build real Joomla library integration here."
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_LIBRARY_DESCRIPTION="To effectively integrate a PHP library into your component, leverage the [Powers] Area within JCB. This feature empowers you to seamlessly incorporate Composer packages as well as standard PHP class structures into your component, ensuring a robust and maintainable solution."
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_LIBRARY_LABEL="Set Behaviour"
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_ONE_DESCRIPTION="All the library files linked to this library will always be added to a view if linked to the view."
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_ONE_LABEL="Set Behaviour"
@ -7600,6 +7600,7 @@ COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_A
COM_COMPONENTBUILDER_NO_S_FOUND="No %s Found"
COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE="No %s have been linked to this view. Soon as this is done it will be displayed here."
COM_COMPONENTBUILDER_NO_TYPE="No Type"
COM_COMPONENTBUILDER_NO_UPLOAD_SELECTED="No upload selected"
COM_COMPONENTBUILDER_NO_VALIDATION_RULES_FOUND="No validation rules found."
COM_COMPONENTBUILDER_NO_VALID_MODE_HAS_BEEN_SPECIFIED="No valid mode has been specified!"
COM_COMPONENTBUILDER_OFFICIAL_VDM_PACKAGES="Official VDM Packages"
@ -9053,6 +9054,7 @@ COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME="There are no
COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST="There has been an error, if this continues please inform your system administrator of a type error in the fields display request!"
COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN="There has been an error please try again"
COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_GETTING_THE_PACKAGE_INFO="There was an error getting the package info."
COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_UPLOADING_TO_THE_SERVER="There was an error uploading to the server."
COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="There was a problem, <b>no view or id found in session or view not allowed to access area</b>, we could not load any linked to values. Please inform your system administrator!"
COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_BGET_PACKAGEB_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE="These are the same packages found on <a %s >gitHub</a> and can be imported by simply making a selection and then clicking the <b>[Get Package]</b> button.<br />Some of these packages would require a key, since they are not free."
COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_BGET_PACKAGEB_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE_A_S_GET_A_KEY_TODAYA="These are the same packages found on <a %s >gitHub</a> and can be imported by simply making a selection and then clicking the <b>[Get Package]</b> button.<br />Some of these packages would require a key, since they are not free. <a %s >Get a key today!</a>."
@ -9129,6 +9131,7 @@ COM_COMPONENTBUILDER_THE_NOTICE_BOARD_IS_LOADING="The notice board is loading"
COM_COMPONENTBUILDER_THE_OPTION_TO_ADD_A_DYNAMIC_BUTTON_IS_NOT_AVAILABLE_IN_BOWN_CUSTOM_FIELD_TYPESB_YOU_WILL_HAVE_TO_CUSTOM_CODE_IT="The option to add a dynamic button is not available in <b>own custom field types</b>, you will have to custom code it."
COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE="The package key is: <code>%s</code>"
COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S="The package key is: %s"
COM_COMPONENTBUILDER_THE_PHP_TEMPORARY_FOLDER_IS_NOT_SET="The PHP temporary folder is not set."
COM_COMPONENTBUILDER_THE_PLUGIN_FILES_FOLDERS="The plugin files & folders"
COM_COMPONENTBUILDER_THE_PLUGIN_UPDATES="The plugin updates"
COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_PUSHED="The power has successfully been pushed."
@ -9159,7 +9162,7 @@ COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DAT
COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_VALID_DATA="The url (%s) set to retrieve the packages did not return valid data!"
COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST="The url (%s) set to retrieve the packages does not exist!"
COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_DATA="The url (%s) set to retrieve the packages does not return any data!"
COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JOOMLA_COMPONENT_BUILDER_SYSTEM_HAS_INTERNET_CONNECTION="The wiki can only be loaded when your Joomla Component Builder system has internet connection."
COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION="The wiki can only be loaded when your JCB system has internet connection."
COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading"
COM_COMPONENTBUILDER_THIS_ADDS_POWERS_TO_A_LOCAL_REPOSITORY_FOLDER_ALL_BAPPROVEDB_POWERS_LINKED_TO_THIS_COMPONENT_WILL_BE_MOVED_TO_YOUR_BLOCALB_POWERS_REPOSITORY_FOLDER_INTO_THEIR_SELECTIVE_TARGET_PATHS_THIS_LOCAL_FOLDER_PATH_MUST_BE_SET_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_BSUPER_POWERB_TAB="This adds powers to a local repository folder. All <b>approved</b> powers, linked to this component, will be moved to your <b>local</b> powers repository folder into their selective target paths. This local folder path must be set in the global options of JCB under the <b>super power</b> tab."
COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_OTHER_AREAS_OF_JCB_AT_THIS_TIME="This <b>%s</b> is not linked to any other areas of JCB at this time!"
@ -9247,9 +9250,13 @@ COM_COMPONENTBUILDER_UPDATE_ALL="Update All"
COM_COMPONENTBUILDER_UPDATE_ALL_DIVERGED_SNIPPETS="Update All Diverged Snippets"
COM_COMPONENTBUILDER_UPDATE_ALL_ITEMS_FOUND_WITH_THIS_DATABASE_SEARCH_WITH_THE_REPLACE_VALUE="Update all items found with this database search, with the replace value."
COM_COMPONENTBUILDER_UPDATE_ALL_OUT_DATED_SNIPPETS="Update All Out Dated Snippets"
COM_COMPONENTBUILDER_UPDATE_OF_USER_S_S_FAILEDS="Update of user %s (%s) failed!%s"
COM_COMPONENTBUILDER_UPLOAD_IS_NOT_A_VALID_TYPE="Upload is not a valid type."
COM_COMPONENTBUILDER_UP_TO_DATE="Up to date"
COM_COMPONENTBUILDER_USAGE="Usage"
COM_COMPONENTBUILDER_USED_IN="Used in"
COM_COMPONENTBUILDER_USER_CREATION_FAILED="User creation failed!"
COM_COMPONENTBUILDER_USER_S_S_CREATION_FAILEDS="User %s (%s) creation failed!%s"
COM_COMPONENTBUILDER_USE_BATCH="Use Batch"
COM_COMPONENTBUILDER_USE_BATCH_DESC="Allows users in this group to use batch copy/update method."
COM_COMPONENTBUILDER_USE_KEY="Use Key"
@ -9350,6 +9357,7 @@ COM_COMPONENTBUILDER_VIEW_THE_CONTRIBUTOR_DETAILS="View the contributor details"
COM_COMPONENTBUILDER_VIEW_USAGE_OF_COMMUNITY_VERSION="View Usage of community version"
COM_COMPONENTBUILDER_VIEW_WHO_CONTRIBUTED_TO_THIS_SNIPPET="View who contributed to this snippet"
COM_COMPONENTBUILDER_VJRZDESSMHBTRWFIFTYTWVZEROAESFLVVXJTMTHREEJTWOIXM="VjRzdE%ssMHBtRW50TWV0aE%sFlvVXJTM3J2IXM="
COM_COMPONENTBUILDER_WARNING_UPLOAD_ERROR="Warning, upload error."
COM_COMPONENTBUILDER_WEBSITE="Website"
COM_COMPONENTBUILDER_WEBSITE_OF_S="Website of %s"
COM_COMPONENTBUILDER_WEBSITE_S="Website: %s"
@ -9385,10 +9393,12 @@ COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FIVE="You
COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FOUR="Your component will be compiled to work in Joomla 4"
COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_THREE="Your component will be compiled to work in Joomla 3"
COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY="Your data is encrypted with a AES 256 bit encryption using the above 32 character key."
COM_COMPONENTBUILDER_YOUR_FILE_WAS_IS_LARGER_THAN_THE_ALLOWED_SIZE="Your file was is larger than the allowed size."
COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS="You are currently viewing the trashed items."
COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT="You are currently viewing the trash area, and you don't have any items in trash at the moment!"
COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA="You can directly download the latest update, or use the Joomla update area."
COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LIKE_TO_IMPORTBR_SMALLPLEASE_NOTE_THAT_SMART_COMPONENT_IMPORT_ONLY_WORKS_WITH_THE_FOLLOWING_FORMAT_BZIPBSMALL="You can now select the component <b>zip</b> package you would like to import.<br /><small>Please note that smart component import only works with the following format: <b>(.zip)</b></small>"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSIONS_TO_UPLOAD_S="You do not have permissions to upload (%s)."
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THE_SERVER_DETAILS_BS_DENIEDB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="You do not have permission to access the server details (<b>%s - denied</b>), please contact your system administrator for more info."
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to clone a component, please contact your system administrator for more help."
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_DOWNLOAD_THE_COMPILER_ANIMATIONS="You do not have permission to download the compiler animations!"

View File

@ -682,8 +682,6 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_STATE="Joomla Modules Updates E
COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla module updates"
COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION="Joomla Modules Updates Edit Version"
COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla modules updates"
COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS="Joomla Module Get Snippets Button Access"
COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button."
COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS="Joomla Plugins Access"
COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS_DESC="Allows the users in this group to access access joomla plugins"
COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE="Joomla Plugins Batch Use"

View File

@ -44,9 +44,9 @@ else
$ref = ($id) ? "&ref=fieldtype&refid=" . $id : "";
}
// set the create new URL
$new = "index.php?option=com_componentbuilder&view=fields&task=field.edit" . $ref;
$new = "index.php?option=com_componentbuilder&view=fields&task=field.add" . $ref;
// set the create new and close URL
$close_new = "index.php?option=com_componentbuilder&view=fields&task=field.edit";
$close_new = "index.php?option=com_componentbuilder&view=fields&task=field.add";
// load the action object
$can = ComponentbuilderHelper::getActions('field');

View File

@ -21,12 +21,28 @@ use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
defined('JPATH_BASE') or die;
$table_id = (isset($displayData['id'])) ? $displayData['id'] : StringHelper::random(7);
$name = (isset($displayData['name'])) ? $displayData['name'] : false;
$table_class = (isset($displayData['table_class'])) ? $displayData['table_class'] : 'uk-table';
$table_container_class = (isset($displayData['table_container_class'])) ? $displayData['table_container_class'] : 'uk-overflow-auto';
$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_HEADERS'), Text::_('COM_COMPONENTBUILDER_FOUND')];
$items = (isset($displayData['items'])) ? $displayData['items'] : 6;
// Extract all keys from $displayData as individual variables.
extract($displayData);
// Assign default values for variables that might not be present in $displayData.
// The 'table_id' parameter, defaulting to a randomly generated value if not set or is null.
$table_id = $id ?? StringHelper::random(7);
// The 'name' parameter, defaulting to false if not set or is null.
$name ??= false;
// The 'table_class' parameter, defaulting to 'uk-table' if not set or is null.
$table_class ??= 'uk-table';
// The 'table_container_class' parameter, defaulting to 'uk-overflow-auto' if not set or is null.
$table_container_class ??= 'uk-overflow-auto';
// The 'headers' parameter, defaulting to an array of default header values if not set or is null.
$headers ??= [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_HEADERS'), Text::_('COM_COMPONENTBUILDER_FOUND')];
// The 'items' parameter, defaulting to 6 if not set or is null.
$items ??= 6;
?>
<div class="<?php echo $$table_container_class; ?>">

File diff suppressed because one or more lines are too long

View File

@ -62,6 +62,22 @@ class Admin_custom_tabsController extends FormController
*/
protected $view_list = 'admins_custom_tabs';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Admin_fieldsController extends FormController
*/
protected $view_list = 'admins_fields';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Admin_fields_conditionsController extends FormController
*/
protected $view_list = 'admins_fields_conditions';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Admin_fields_relationsController extends FormController
*/
protected $view_list = 'admins_fields_relations';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -63,6 +63,22 @@ class Admin_viewController extends FormController
*/
protected $view_list = 'admin_views';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Class_extendsController extends FormController
*/
protected $view_list = 'class_extendings';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Class_methodController extends FormController
*/
protected $view_list = 'class_methods';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Class_propertyController extends FormController
*/
protected $view_list = 'class_properties';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -19,6 +19,7 @@ use Joomla\CMS\Session\Session;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use Joomla\CMS\Version;
use VDM\Joomla\Componentbuilder\File\Factory as FileFactory;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
@ -69,6 +70,11 @@ class CompilerController extends AdminController
$this->setRedirect(Route::_('index.php?option=com_componentbuilder', false));
}
/**
* Adding this so that the upload factory gets build for Super Powers
* FileFactory
*/
/**
* get all the animations used in the compiler
*

View File

@ -62,6 +62,22 @@ class Component_admin_viewsController extends FormController
*/
protected $view_list = 'components_admin_views';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_configController extends FormController
*/
protected $view_list = 'components_config';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_custom_admin_menusController extends FormController
*/
protected $view_list = 'components_custom_admin_menus';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_custom_admin_viewsController extends FormController
*/
protected $view_list = 'components_custom_admin_views';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_dashboardController extends FormController
*/
protected $view_list = 'components_dashboard';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_files_foldersController extends FormController
*/
protected $view_list = 'components_files_folders';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_modulesController extends FormController
*/
protected $view_list = 'components_modules';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_mysql_tweaksController extends FormController
*/
protected $view_list = 'components_mysql_tweaks';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_placeholdersController extends FormController
*/
protected $view_list = 'components_placeholders';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_pluginsController extends FormController
*/
protected $view_list = 'components_plugins';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_routerController extends FormController
*/
protected $view_list = 'components_routers';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Component_site_viewsController extends FormController
*/
protected $view_list = 'components_site_views';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -65,6 +65,22 @@ class Component_updatesController extends FormController
*/
protected $view_list = 'components_updates';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Custom_admin_viewController extends FormController
*/
protected $view_list = 'custom_admin_views';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Custom_codeController extends FormController
*/
protected $view_list = 'custom_codes';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Dynamic_getController extends FormController
*/
protected $view_list = 'dynamic_gets';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class FieldController extends FormController
*/
protected $view_list = 'fields';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -25,7 +25,6 @@ use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Componentbuilder\Fieldtype\Factory as FieldtypeFactory;
use VDM\Joomla\Utilities\GetHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -64,75 +63,34 @@ class FieldtypeController extends FormController
*/
protected $view_list = 'fieldtypes';
/**
* Initializes all remote Joomla Field Types and syncs them with the local database.
* Referral value
*
* This function performs several checks and operations:
* 1. It verifies the authenticity of the request to prevent request forgery.
* 2. It checks whether the current user has the necessary permissions to initialize the Joomla Field Types.
* 3. If the user is authorized, it attempts to initialize the remote Joomla Field Types.
* 4. Depending on the result of the initialization operation, it sets the appropriate success or error message.
* 5. It redirects the user to a specified URL with the result message and status.
*
* @return bool True on successful initialization, false on failure.
* @var string
* @since 5.0
*/
public function initPowers()
{
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INITIALIZE_JOOMLA_FIELD_TYPES') . '</p>';
$status = 'error';
$success = false;
if($user->authorise('fieldtype.init', 'com_componentbuilder'))
{
try {
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->init())
{
// set success message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_JOOMLA_POWERS') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_JOOMLA_FIELD_TYPES_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES') . '</p>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
protected string $ref;
/**
* Resets the selected Joomla Field Types.
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Resets the specified Joomla Field Type.
*
* This function performs several checks and operations:
* 1. It verifies the authenticity of the request to prevent request forgery.
* 2. It retrieves the IDs of the selected powers from the user input.
* 3. It sanitizes the input by converting the IDs to integers.
* 4. It checks whether any powers have been selected.
* 5. It checks whether the current user has the necessary permissions to reset the selected Joomla Field Types.
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Joomla Field Types.
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
* 8. It redirects the user to a specified URL with the result message and status.
* 2. It retrieves the item data posted by the user.
* 3. It checks whether the current user has the necessary permissions to reset the Joomla Field Type.
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Joomla Field Type.
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
* 7. It redirects the user to a specified URL with the result message and status.
*
* @return bool True on successful reset, false on failure.
*/
@ -141,77 +99,73 @@ class FieldtypeController extends FormController
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// get IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
if ($pks === [])
{
// set error message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
$status = 'error';
$success = false;
// get Item posted
$item = $this->input->post->get('jform', array(), 'array');
// check if user has the right
$user = Factory::getUser();
if($user->authorise('fieldtype.reset', 'com_componentbuilder'))
{
$guids = GetHelper::vars('fieldtype', $pks, 'id', 'guid');
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_JOOMLA_FIELD_TYPE') . '</p>';
$status = 'error';
$success = false;
// load the ID
$id = $item['id'] ?? null;
$guid = $item['guid'] ?? null;
// check if there is any selections
if ($id === null || $guid === null)
{
// set error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_FIELD_TYPE_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('fieldtype.reset', 'com_componentbuilder'))
{
try {
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->reset($guids))
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->reset([$guid]))
{
// set success message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_FIELD_TYPES_HAVE_SUCCESSFULLY_BEEN_RESET').'</p>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_FIELD_TYPE_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=fieldtype'
. $this->getRedirectToItemAppend($id), $success
);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url);
return $success;
}
/**
* Pushes the selected Joomla Field Types.
* Pushes the specified Joomla Field Type.
*
* This function performs several checks and operations:
* 1. It verifies the authenticity of the request to prevent request forgery.
* 2. It retrieves the IDs of the selected powers from the user input.
* 3. It sanitizes the input by converting the IDs to integers.
* 4. It checks whether any powers have been selected.
* 5. It checks whether the current user has the necessary permissions to push the selected Joomla Field Types.
* 6. If the user is authorized and powers are selected, it attempts to push the selected Joomla Field Types.
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
* 8. It redirects the user to a specified URL with the result message and status.
* 2. It retrieves the item data posted by the user.
* 3. It checks whether the current user has the necessary permissions to push the Joomla Field Type.
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Joomla Field Type.
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
* 7. It redirects the user to a specified URL with the result message and status.
*
* @return bool True on successful push, false on failure.
*/
@ -220,62 +174,59 @@ class FieldtypeController extends FormController
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// get IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
if ($pks === [])
{
// set error message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
$status = 'error';
$success = false;
// get Item posted
$item = $this->input->post->get('jform', array(), 'array');
// check if user has the right
$user = Factory::getUser();
if($user->authorise('fieldtype.push', 'com_componentbuilder'))
{
$guids = GetHelper::vars('fieldtype', $pks, 'id', 'guid');
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_PUSH_THIS_JOOMLA_FIELD_TYPE') . '</p>';
$status = 'error';
$success = false;
// load the ID
$id = $item['id'] ?? null;
$guid = $item['guid'] ?? null;
// check if there is any selections
if ($id === null || $guid === null)
{
// set error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_FIELD_TYPE_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('fieldtype.push', 'com_componentbuilder'))
{
try {
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Set')->items($guids))
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Set')->items([$guid]))
{
// set success message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_FIELD_TYPES_HAVE_SUCCESSFULLY_BEEN_PUSHED').'</p>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_PUSHED').'</p>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_FIELD_TYPE_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url);
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=fieldtype'
. $this->getRedirectToItemAppend($id), $success
);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}

View File

@ -18,6 +18,7 @@ use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Componentbuilder\Fieldtype\Factory as FieldtypeFactory;
use VDM\Joomla\Utilities\GetHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -55,16 +56,73 @@ class FieldtypesController extends AdminController
/**
* Resets the specified Joomla Field Type.
* Initializes all remote Joomla Field Types and syncs them with the local database.
*
* This function performs several checks and operations:
* 1. It verifies the authenticity of the request to prevent request forgery.
* 2. It retrieves the item data posted by the user.
* 3. It checks whether the current user has the necessary permissions to reset the Joomla Field Type.
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Joomla Field Type.
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
* 7. It redirects the user to a specified URL with the result message and status.
* 2. It checks whether the current user has the necessary permissions to initialize the Joomla Field Types.
* 3. If the user is authorized, it attempts to initialize the remote Joomla Field Types.
* 4. Depending on the result of the initialization operation, it sets the appropriate success or error message.
* 5. It redirects the user to a specified URL with the result message and status.
*
* @return bool True on successful initialization, false on failure.
*/
public function initPowers()
{
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INITIALIZE_JOOMLA_FIELD_TYPES') . '</p>';
$status = 'error';
$success = false;
if($user->authorise('fieldtype.init', 'com_componentbuilder'))
{
try {
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->init())
{
// set success message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_JOOMLA_POWERS') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_JOOMLA_FIELD_TYPES_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES') . '</p>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
/**
* Resets the selected Joomla Field Types.
*
* This function performs several checks and operations:
* 1. It verifies the authenticity of the request to prevent request forgery.
* 2. It retrieves the IDs of the selected powers from the user input.
* 3. It sanitizes the input by converting the IDs to integers.
* 4. It checks whether any powers have been selected.
* 5. It checks whether the current user has the necessary permissions to reset the selected Joomla Field Types.
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Joomla Field Types.
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
* 8. It redirects the user to a specified URL with the result message and status.
*
* @return bool True on successful reset, false on failure.
*/
@ -73,73 +131,77 @@ class FieldtypesController extends AdminController
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// get Item posted
$item = $this->input->post->get('jform', array(), 'array');
// get IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// check if user has the right
$user = Factory::getUser();
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
if ($pks === [])
{
// set error message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_JOOMLA_FIELD_TYPE') . '</p>';
$status = 'error';
$success = false;
// load the ID
$id = $item['id'] ?? null;
$guid = $item['guid'] ?? null;
// check if user has the right
$user = Factory::getUser();
if($user->authorise('fieldtype.reset', 'com_componentbuilder'))
{
$guids = GetHelper::vars('fieldtype', $pks, 'id', 'guid');
// check if there is any selections
if ($id === null || $guid === null)
{
// set error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_FIELD_TYPE_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('fieldtype.reset', 'com_componentbuilder'))
{
try {
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->reset([$guid]))
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->reset($guids))
{
// set success message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_FIELD_TYPES_HAVE_SUCCESSFULLY_BEEN_RESET').'</p>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_FIELD_TYPE_HAS_FAILED') . '</p>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=fieldtype'
. $this->getRedirectToItemAppend($id), $success
);
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url);
return $success;
}
/**
* Pushes the specified Joomla Field Type.
* Pushes the selected Joomla Field Types.
*
* This function performs several checks and operations:
* 1. It verifies the authenticity of the request to prevent request forgery.
* 2. It retrieves the item data posted by the user.
* 3. It checks whether the current user has the necessary permissions to push the Joomla Field Type.
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Joomla Field Type.
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
* 7. It redirects the user to a specified URL with the result message and status.
* 2. It retrieves the IDs of the selected powers from the user input.
* 3. It sanitizes the input by converting the IDs to integers.
* 4. It checks whether any powers have been selected.
* 5. It checks whether the current user has the necessary permissions to push the selected Joomla Field Types.
* 6. If the user is authorized and powers are selected, it attempts to push the selected Joomla Field Types.
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
* 8. It redirects the user to a specified URL with the result message and status.
*
* @return bool True on successful push, false on failure.
*/
@ -148,59 +210,62 @@ class FieldtypesController extends AdminController
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// get Item posted
$item = $this->input->post->get('jform', array(), 'array');
// get IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// check if user has the right
$user = Factory::getUser();
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
if ($pks === [])
{
// set error message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_PUSH_THIS_JOOMLA_FIELD_TYPE') . '</p>';
$status = 'error';
$success = false;
// load the ID
$id = $item['id'] ?? null;
$guid = $item['guid'] ?? null;
// check if user has the right
$user = Factory::getUser();
if($user->authorise('fieldtype.push', 'com_componentbuilder'))
{
$guids = GetHelper::vars('fieldtype', $pks, 'id', 'guid');
// check if there is any selections
if ($id === null || $guid === null)
{
// set error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_FIELD_TYPE_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('fieldtype.push', 'com_componentbuilder'))
{
try {
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Set')->items([$guid]))
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Set')->items($guids))
{
// set success message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_PUSHED').'</p>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_FIELD_TYPES_HAVE_SUCCESSFULLY_BEEN_PUSHED').'</p>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_FIELD_TYPE_HAS_FAILED') . '</p>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=fieldtype'
. $this->getRedirectToItemAppend($id), $success
);
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url);
return $success;
}
}

View File

@ -62,6 +62,22 @@ class Help_documentController extends FormController
*/
protected $view_list = 'help_documents';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -63,6 +63,22 @@ class Joomla_componentController extends FormController
*/
protected $view_list = 'joomla_components';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
public function refresh()
{
// Check for request forgeries

View File

@ -63,6 +63,22 @@ class Joomla_moduleController extends FormController
*/
protected $view_list = 'joomla_modules';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Joomla_module_files_folders_urlsController extends FormController
*/
protected $view_list = 'joomla_modules_files_folders_urls';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -64,6 +64,22 @@ class Joomla_module_updatesController extends FormController
*/
protected $view_list = 'joomla_modules_updates';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -51,13 +51,4 @@ class Joomla_modulesController extends AdminController
{
return parent::getModel($name, $prefix, $config);
}
public function getSnippets()
{
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// redirect to the import snippets custom admin view
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false));
return;
}
}

View File

@ -63,6 +63,22 @@ class Joomla_pluginController extends FormController
*/
protected $view_list = 'joomla_plugins';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Joomla_plugin_files_folders_urlsController extends FormController
*/
protected $view_list = 'joomla_plugins_files_folders_urls';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Joomla_plugin_groupController extends FormController
*/
protected $view_list = 'joomla_plugin_groups';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -64,6 +64,22 @@ class Joomla_plugin_updatesController extends FormController
*/
protected $view_list = 'joomla_plugins_updates';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -63,6 +63,22 @@ class Joomla_powerController extends FormController
*/
protected $view_list = 'joomla_powers';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Resets the specified Joomla Power.

View File

@ -62,6 +62,22 @@ class LanguageController extends FormController
*/
protected $view_list = 'languages';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Language_translationController extends FormController
*/
protected $view_list = 'language_translations';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class LayoutController extends FormController
*/
protected $view_list = 'layouts';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -63,6 +63,22 @@ class LibraryController extends FormController
*/
protected $view_list = 'libraries';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Library_configController extends FormController
*/
protected $view_list = 'libraries_config';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Library_files_folders_urlsController extends FormController
*/
protected $view_list = 'libraries_files_folders_urls';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class PlaceholderController extends FormController
*/
protected $view_list = 'placeholders';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -63,6 +63,22 @@ class PowerController extends FormController
*/
protected $view_list = 'powers';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Resets the specified power.

View File

@ -62,6 +62,22 @@ class RepositoryController extends FormController
*/
protected $view_list = 'repositories';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class ServerController extends FormController
*/
protected $view_list = 'servers';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Site_viewController extends FormController
*/
protected $view_list = 'site_views';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class SnippetController extends FormController
*/
protected $view_list = 'snippets';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Snippet_typeController extends FormController
*/
protected $view_list = 'snippet_types';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class TemplateController extends FormController
*/
protected $view_list = 'templates';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -62,6 +62,22 @@ class Validation_ruleController extends FormController
*/
protected $view_list = 'validation_rules';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;
/**
* Method override to check if you can add a new record.
*

View File

@ -44,6 +44,7 @@ use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\Component\Helper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory;
use VDM\Joomla\Utilities\Base64Helper;
@ -55,7 +56,6 @@ use VDM\Joomla\Utilities\String\NamespaceHelper;
use VDM\Joomla\Utilities\MathHelper;
use VDM\Joomla\Utilities\String\PluginHelper;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Utilities\Component\Helper;
use VDM\Joomla\Utilities\FormHelper;
use Joomla\CMS\Router\Route;
@ -1230,7 +1230,8 @@ abstract class ComponentbuilderHelper
if ((int) $id > 0)
{
// get the model
$model = self::getModel($type);
Helper::setOption('com_componentbuilder');
$model = Helper::getModel($type);
$app = Factory::getApplication();
// get item
if ($item = $model->getItem($id))
@ -5418,7 +5419,6 @@ abstract class ComponentbuilderHelper
return $d && $d->format($format) == $date;
}
/**
* The subform layouts
**/

View File

@ -480,10 +480,23 @@ class AjaxModel extends ListModel
return ['error' => $message];
}
return ['error' => Text::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JOOMLA_COMPONENT_BUILDER_SYSTEM_HAS_INTERNET_CONNECTION')];
return ['error' => Text::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION')];
}
// Used in joomla_module
/**
* Generates and returns the module code based on the provided data.
*
* This method processes the input data to generate module-specific code snippets
* for class inclusion, data handling, libraries, CSS, and template loading.
* It merges these code blocks into an array and specifies their placement within the final module output.
*
* @param string $data JSON-encoded string containing the module's class, get, lib, and other properties.
*
* @return array An associative array containing the generated code snippets for the module,
* including class, get, libraries, CSS, and template code, each with merge settings.
* @since 3.0.9
*/
public function getModuleCode($data)
{
// reset the return array
@ -532,7 +545,7 @@ class AjaxModel extends ListModel
$code['css']['code'] = '// get the module class sfx (local)';
$code['css']['code'] .= PHP_EOL . "\$moduleclass_sfx = htmlspecialchars(\$params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');";
$code['tmpl']['code'] = '// load the default Tmpl';
$code['tmpl']['code'] .= PHP_EOL . "require JModuleHelper::getLayoutPath('mod_[[[module]]]', \$params->get('layout', 'default'));";
$code['tmpl']['code'] .= PHP_EOL . "require Joomla__"."_f15d556d_33dd_4ee3_a0f7_0653e4a7a1e4___Power::getLayoutPath('mod_[[[module]]]', \$params->get('layout', 'default'));";
// set placement
$code['css']['merge'] = 1;
$code['css']['merge_target'] = '// load the default Tmpl';
@ -542,13 +555,31 @@ class AjaxModel extends ListModel
return $code;
}
// Used in joomla_plugin
/**
* Retrieves the class code based on the provided ID and type.
*
* @param int|string $id The ID of the class.
* @param string $type The type of the class (e.g., 'property', 'method').
*
* @return mixed The class code, or false on failure.
* @since 3.0.9
*/
public function getClassCode($id, $type)
{
return ComponentbuilderHelper::getClassCode($id, $type);
}
/**
* Retrieves class code IDs based on the provided ID, type, and key.
*
* @param int|string $id The ID of the class.
* @param string $type The type of the class (e.g., 'property', 'method', 'joomla_plugin_group').
* @param int $key The key that determines which data to return (e.g., 1 for 'joomla_plugin_group', 2 for 'extension_type').
*
* @return mixed The corresponding class code IDs or false if no valid data is found.
* @since 3.0.9
*/
public function getClassCodeIds($id, $type, $key)
{
if ('property' === $type || 'method' === $type)
@ -570,9 +601,20 @@ class AjaxModel extends ListModel
return false;
}
/**
* Retrieves the header code of the class based on the provided ID and type.
*
* @param int|string $id The ID of the class.
* @param string $type The type of the header (e.g., 'extends').
*
* @return string|false The decoded header code, or false if no valid data is found.
* @since 3.0.9
*/
public function getClassHeaderCode($id, $type)
{
if ('extends' === $type && ($head = GetHelper::var('class_' . $type, $id, 'id', 'head')) !== false && StringHelper::check($head))
if ('extends' === $type &&
($head = GetHelper::var('class_' . $type, $id, 'id', 'head')) !== false &&
StringHelper::check($head))
{
return base64_decode($head);
}

View File

@ -267,7 +267,6 @@ class Joomla_pluginsModel extends ListModel
return true;
}
/**
* Method to auto-populate the model state.
*

View File

@ -327,9 +327,9 @@ class HtmlView extends BaseHtmlView
Html::_('script', 'media/com_componentbuilder/js/jstorage.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/js/strtotime.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
$this->getDocument()->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) Uri::getInstance())) . "';");
$this->getDocument()->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) Uri::getInstance())) . "';");
// check if we should use browser storage
$setBrowserStorage = $this->params->get('set_browser_storage', null);
if ($setBrowserStorage)
@ -360,6 +360,6 @@ class HtmlView extends BaseHtmlView
$expire = 30000; // only 30 seconds
}
// Set the Time To Live To JavaScript
$this->document->addScriptDeclaration("var expire = ". (int) $expire.";");
$this->getDocument()->addScriptDeclaration("var expire = ". (int) $expire.";");
}
}

View File

@ -198,11 +198,6 @@ class HtmlView extends BaseHtmlView
ToolbarHelper::trash('joomla_modules.trash');
}
}
if ($this->user->authorise('joomla_module.get_snippets', 'com_componentbuilder'))
{
// add Get Snippets button.
ToolbarHelper::custom('joomla_modules.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_modules');

View File

@ -328,9 +328,9 @@ class HtmlView extends BaseHtmlView
Html::_('script', 'media/com_componentbuilder/js/jstorage.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/js/strtotime.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
$this->getDocument()->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) Uri::getInstance())) . "';");
$this->getDocument()->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) Uri::getInstance())) . "';");
// set some lang
Text::script('COM_COMPONENTBUILDER_ALREADY_SELECTED_TRY_ANOTHER');
Text::script('COM_COMPONENTBUILDER_TYPE_OR_SELECT_SOME_OPTIONS');
@ -367,11 +367,11 @@ class HtmlView extends BaseHtmlView
$expire = 30000; // only 30 seconds
}
// Set the Time To Live To JavaScript
$this->document->addScriptDeclaration("var expire = ". (int) $expire.";");
$this->document->addScriptDeclaration("selectionArray = {'property':{},'method':{}};");
$this->getDocument()->addScriptDeclaration("var expire = ". (int) $expire.";");
$this->getDocument()->addScriptDeclaration("selectionArray = {'property':{},'method':{}};");
// add a few field options via PHP
\JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
$tmp_ = \JFormHelper::loadFieldType('joomlaplugingroups')->options;
FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
$tmp_ = FormHelper::loadFieldType('joomlaplugingroups')->options;
if (ArrayHelper::check($tmp_))
{
$_tmp = array();
@ -380,9 +380,9 @@ class HtmlView extends BaseHtmlView
$_tmp[$item->value] = $item->text;
}
// Set the values to JavaScript
$this->document->addScriptDeclaration("selectionArray['joomla_plugin_group'] = ". json_encode($_tmp) . ";");
$this->getDocument()->addScriptDeclaration("selectionArray['joomla_plugin_group'] = ". json_encode($_tmp) . ";");
}
$tmp_ = \JFormHelper::loadFieldType('pluginsclassproperties')->options;
$tmp_ = FormHelper::loadFieldType('pluginsclassproperties')->options;
if (ArrayHelper::check($tmp_))
{
$_tmp = array();
@ -391,9 +391,9 @@ class HtmlView extends BaseHtmlView
$_tmp[$item->value] = $item->text;
}
// Set the values to JavaScript
$this->document->addScriptDeclaration("selectionArray['property'] = ". json_encode($_tmp) . ";");
$this->getDocument()->addScriptDeclaration("selectionArray['property'] = ". json_encode($_tmp) . ";");
}
$tmp_ = \JFormHelper::loadFieldType('pluginsclassmethods')->options;
$tmp_ = FormHelper::loadFieldType('pluginsclassmethods')->options;
if (ArrayHelper::check($tmp_))
{
$_tmp = array();
@ -402,7 +402,7 @@ class HtmlView extends BaseHtmlView
$_tmp[$item->value] = $item->text;
}
// Set the values to JavaScript
$this->document->addScriptDeclaration("selectionArray['method'] = ". json_encode($_tmp) . ";");
$this->getDocument()->addScriptDeclaration("selectionArray['method'] = ". json_encode($_tmp) . ";");
}
}
}

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="5.0" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>23rd August, 2024</creationDate>
<creationDate>18th September, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>5.0.3-alpha3</version>
<version>5.0.3-alpha4</version>
<description><![CDATA[
<h1>Component Builder (v.5.0.3-alpha3)</h1>
<h1>Component Builder (v.5.0.3-alpha4)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.

View File

@ -98,7 +98,7 @@
<version>5.0.3-alpha</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.3-alpha3.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.3-alpha4.zip</downloadurl>
</downloads>
<tags>
<tag>alpha</tag>
@ -113,10 +113,10 @@
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>5.0.3-alpha3</version>
<version>5.0.3-alpha4</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.3-alpha3.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.3-alpha4.zip</downloadurl>
</downloads>
<tags>
<tag>alpha</tag>

BIN
images/vdm/demo500.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

1
images/vdm/index.html Normal file
View File

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

View File

@ -65,7 +65,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'null_switch' => 'NULL',
'comment' => 'FK to the #__assets table.'
]
],
@ -80,7 +80,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'INT(11)',
'default' => '0',
'null_switch' => 'NOT NULL'
'null_switch' => 'NULL'
]
],
'published' => [
@ -94,7 +94,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'TINYINT(3)',
'default' => '1',
'null_switch' => 'NOT NULL',
'null_switch' => 'NULL',
'key' => true,
'key_name' => 'state'
]
@ -110,7 +110,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'null_switch' => 'NULL',
'key' => true,
'key_name' => 'modifiedby'
]
@ -126,7 +126,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NOT NULL'
'null_switch' => 'NULL'
]
],
'created_by' => [
@ -140,7 +140,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'null_switch' => 'NULL',
'key' => true,
'key_name' => 'createdby'
]
@ -156,7 +156,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NOT NULL'
'null_switch' => 'NULL'
]
],
'checked_out' => [
@ -170,7 +170,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'null_switch' => 'NULL',
'key' => true,
'key_name' => 'checkout'
]
@ -186,7 +186,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NOT NULL'
'null_switch' => 'NULL'
]
],
'hits' => [
@ -200,7 +200,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL'
'null_switch' => 'NULL'
]
],
'version' => [
@ -214,7 +214,7 @@ abstract class BaseTable implements Tableinterface
'db' => [
'type' => 'INT(10) unsigned',
'default' => '1',
'null_switch' => 'NOT NULL'
'null_switch' => 'NULL'
]
],
'params' => [

View File

@ -118,7 +118,7 @@ abstract class Model implements ModelInterface
* @return array|null
* @since 3.2.2
*/
public function values(?array $items = null, string $field, ?string $table = null): ?array
public function values(?array $items, string $field, ?string $table = null): ?array
{
// check if this is a valid table
if (ArrayHelper::check($items))

View File

@ -0,0 +1,127 @@
<?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 VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\ComHelperClass;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
/**
* Helper Class Create User Class for Joomla 5
*
* @since 5.0.2
*/
final class CreateUser implements CreateUserInterface
{
/**
* Generates the method definition for creating or updating a user based on the provided parameters.
*
* This method returns a string representation of a PHP function that includes various
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
*
* @param $add Determines whether to generate the user creation method or not.
* If true, the method will be generated and returned as a string.
*
* @return string The generated method code as a string if $add is true.
* Returns an empty string if $add is false.
*/
public function get($add): string
{
if ($add)
{
$method = [];
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1)
. " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]";
$method[] = Indent::_(1) . " * @param int \$autologin";
$method[] = Indent::_(1)
. " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]";
$method[] = Indent::_(1)
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @return int User ID on success";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing.";
$method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails.";
$method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @since 3.0.0";
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
$method[] = Indent::_(1) . " */";
$method[] = Indent::_(1)
. "public static function createUser(\$credentials, \$autologin = 0,";
$method[] = Indent::_(2) . "\$params = [";
$method[] = Indent::_(3)
. "'useractivation' => 0, 'sendpassword' => 1";
$method[] = Indent::_(2) . "], \$mode = 1";
$method[] = Indent::_(1) . ")";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Create a user with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)";
$method[] = Indent::_(2)
. "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
$method[] = Indent::_(1) . "}";
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Update the given component params.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name.";
$method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated.";
$method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @since 3.0.0";
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
$method[] = Indent::_(1) . " */";
$method[] = PHP_EOL . Indent::_(1)
. "public static function setParams(\$option, \$target, \$value)";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Sets a parameter value for the given target in the specified option's params";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " (Super---640b5352_fb09_425f_a26e_cd44eda03f15---Power)";
$method[] = Indent::_(2)
. "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
$method[] = Indent::_(1) . "}";
$method[] = PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Update user details";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @return int Updated user ID on success.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @since 3.0.0";
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
$method[] = Indent::_(1) . " */";
$method[] = Indent::_(1)
. "public static function updateUser(\$userDetails): int";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2)
. "//" . Line::_(__Line__, __Class__)
. " Update user details with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)";
$method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
$method[] = Indent::_(1) . "}";
// return the help method
return implode(PHP_EOL, $method);
}
return '';
}
}

View File

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

View File

@ -155,7 +155,7 @@ final class Extension implements ExtensionInterface
$counter = 0;
foreach ($methods as $method)
{
if ($method['access'] === 'public' && !$method['static'] && !$method['abstract'])
if ($this->validEventName($method))
{
$events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'";
@ -191,6 +191,37 @@ final class Extension implements ExtensionInterface
return implode(PHP_EOL, $method);
}
/**
* Validates if a method name is a valid event name for a Joomla plugin.
*
* The method must meet the following criteria:
* - It must be public, not static, and not abstract.
* - It must not be a magic method (i.e., should not start with '__').
*
* @param array $method The method details, including 'name', 'access', 'static', and 'abstract'.
*
* @return bool Returns true if the method is a valid event name, otherwise false.
*
* @since 5.0.2
*/
protected function validEventName(array $method): bool
{
// Check if the method is public, static, and not abstract
if ($method['access'] !== 'public' || $method['static'] || $method['abstract'])
{
return false;
}
// Check if the method is a magic method (starts with '__')
if (substr($method['name'], 0, 2) === '__')
{
return false;
}
// If all checks pass, the method is a valid event name
return true;
}
/**
* Check if the getSubscribedEvents is set
*

View File

@ -0,0 +1,125 @@
<?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 VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\ComHelperClass;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
/**
* Helper Class Create User Class for Joomla 4
*
* @since 5.0.2
*/
final class CreateUser implements CreateUserInterface
{
/**
* Generates the method definition for creating or updating a user based on the provided parameters.
*
* This method returns a string representation of a PHP function that includes various
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
*
* @param $add Determines whether to generate the user creation method or not.
* If true, the method will be generated and returned as a string.
*
* @return string The generated method code as a string if $add is true.
* Returns an empty string if $add is false.
*/
public function get($add): string
{
if ($add)
{
$method = [];
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1)
. " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]";
$method[] = Indent::_(1) . " * @param int \$autologin";
$method[] = Indent::_(1)
. " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]";
$method[] = Indent::_(1)
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @return int User ID on success";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing.";
$method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails.";
$method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @since 3.0.0";
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
$method[] = Indent::_(1) . " */";
$method[] = Indent::_(1)
. "public static function createUser(\$credentials, \$autologin = 0,";
$method[] = Indent::_(2) . "\$params = [";
$method[] = Indent::_(3)
. "'useractivation' => 0, 'sendpassword' => 1";
$method[] = Indent::_(2) . "], \$mode = 1";
$method[] = Indent::_(1) . ")";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Create a user with the UserHelper class";
$method[] = Indent::_(2)
. "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
$method[] = Indent::_(1) . "}";
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Update the given component params.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name.";
$method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated.";
$method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @since 3.0.0";
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
$method[] = Indent::_(1) . " */";
$method[] = PHP_EOL . Indent::_(1)
. "public static function setParams(\$option, \$target, \$value)";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Sets a parameter value for the given target in the specified option's params";
$method[] = Indent::_(2)
. "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
$method[] = Indent::_(1) . "}";
$method[] = PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Update user details";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @return int Updated user ID on success.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails.";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1) . " * @since 3.0.0";
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
$method[] = Indent::_(1) . " */";
$method[] = Indent::_(1)
. "public static function updateUser(\$userDetails): int";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2)
. "//" . Line::_(__Line__, __Class__)
. " Update user details with the UserHelper class";
$method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
$method[] = Indent::_(1) . "}";
// return the help method
return implode(PHP_EOL, $method);
}
return '';
}
}

View File

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

View File

@ -155,7 +155,7 @@ final class Extension implements ExtensionInterface
$counter = 0;
foreach ($methods as $method)
{
if ($method['access'] === 'public' && !$method['static'] && !$method['abstract'])
if ($this->validEventName($method))
{
$events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'";
@ -191,6 +191,37 @@ final class Extension implements ExtensionInterface
return implode(PHP_EOL, $method);
}
/**
* Validates if a method name is a valid event name for a Joomla plugin.
*
* The method must meet the following criteria:
* - It must be public, not static, and not abstract.
* - It must not be a magic method (i.e., should not start with '__').
*
* @param array $method The method details, including 'name', 'access', 'static', and 'abstract'.
*
* @return bool Returns true if the method is a valid event name, otherwise false.
*
* @since 5.0.2
*/
protected function validEventName(array $method): bool
{
// Check if the method is public, static, and not abstract
if ($method['access'] !== 'public' || $method['static'] || $method['abstract'])
{
return false;
}
// Check if the method is a magic method (starts with '__')
if (substr($method['name'], 0, 2) === '__')
{
return false;
}
// If all checks pass, the method is a valid event name
return true;
}
/**
* Check if the getSubscribedEvents is set
*

View File

@ -0,0 +1,366 @@
<?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 VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\ComHelperClass;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
/**
* Helper Class Create User Class for Joomla 3
*
* @since 5.0.2
*/
final class CreateUser implements CreateUserInterface
{
/**
* Generates the method definition for creating or updating a user based on the provided parameters.
*
* This method returns a string representation of a PHP function that includes various
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
*
* @param $add Determines whether to generate the user creation method or not.
* If true, the method will be generated and returned as a string.
*
* @return string The generated method code as a string if $add is true.
* Returns an empty string if $add is false.
*/
public function get($add): string
{
if ($add)
{
$method = [];
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Greate user and update given table";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1)
. " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)";
$method[] = Indent::_(1) . " * @param int \$autologin";
$method[] = Indent::_(1)
. " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)";
$method[] = Indent::_(1)
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1)
. " * @return int|Error User ID on success, or an error.";
$method[] = Indent::_(1) . " */";
$method[] = Indent::_(1)
. "public static function createUser(\$credentials, \$autologin = 0,";
$method[] = Indent::_(2) . "\$params = array(";
$method[] = Indent::_(3)
. "'useractivation' => 0, 'sendpassword' => 1";
$method[] = Indent::_(2) . "), \$mode = 1";
$method[] = Indent::_(1) . ")";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Override mode";
$method[] = Indent::_(2)
. "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Update params";
$method[] = Indent::_(3) . "\$params['autologin'] = \$autologin;";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Now Register User";
$method[] = Indent::_(3)
. "return self::registerUser(\$credentials, \$params);";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "elseif (\$mode == 2)";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Fallback to Site Registrations";
$method[] = Indent::_(3) . "\$mode = 1;";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " load the user component language files if there is an error.";
$method[] = Indent::_(2) . "\$lang = Factory::getLanguage();";
$method[] = Indent::_(2) . "\$extension = 'com_users';";
$method[] = Indent::_(2) . "\$base_dir = JPATH_SITE;";
$method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB')
. "';";
$method[] = Indent::_(2) . "\$reload = true;";
$method[] = Indent::_(2)
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Load the correct user model.";
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
__LINE__,__CLASS__
)
. " 1 = Site Registrations";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Load the user site-registration model";
$method[] = Indent::_(3)
. "\$model = self::getModel('registration', \$base_dir . '/components/' . \$extension, 'Users');";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
. " 0 = Admin Registration";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Load the backend-user model";
$method[] = Indent::_(3)
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/' . \$extension, 'Users');";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check if we have params/config";
$method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Make changes to user config";
$method[] = Indent::_(3)
. "foreach (\$params as \$param => \$set)";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " If you know of a better path, let me know";
$method[] = Indent::_(4)
. "\$params[\$param] = self::setParams(\$extension, \$param, \$set);";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Set username to email if not set";
$method[] = Indent::_(2)
. "if (!isset(\$credentials['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['username']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$credentials['username'] = \$credentials['email'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Lineup new user data array";
$method[] = Indent::_(2) . "\$data = array(";
$method[] = Indent::_(3)
. "'username' => \$credentials['username'],";
$method[] = Indent::_(3) . "'name' => \$credentials['name'],";
$method[] = Indent::_(3) . "'block' => 0 );";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Added details based on mode";
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
__LINE__,__CLASS__
)
. " 1 = Site-registration mode";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$data['email1'] = \$credentials['email'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
. " 0 = Admin-registration mode";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$data['email'] = \$credentials['email'];";
$method[] = Indent::_(3)
. "\$data['registerDate'] = Factory::getDate()->toSql();";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check if password was set";
$method[] = Indent::_(2)
. "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2'])))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Set random password when empty password was submitted,";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " when using the 1 = site-registration mode";
$method[] = Indent::_(3)
. "\$credentials['password'] = self::randomkey(8);";
$method[] = Indent::_(3)
. "\$credentials['password2'] = \$credentials['password'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Now Add password if set";
$method[] = Indent::_(2)
. "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "if (\$mode == 1) //" . Line::_(
__LINE__,__CLASS__
)
. " 1 = Site-registration mode";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4)
. "\$data['password1'] = \$credentials['password'];";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(3) . "else //" . Line::_(__Line__, __Class__)
. " 0 = Admin-registration mode";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4)
. "\$data['password'] = \$credentials['password'];";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(3)
. "\$data['password2'] = \$credentials['password2'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Load the group/s value if set, only for Admin Registration (\$mode == 0)";
$method[] = Indent::_(2)
. "if (\$mode == 0 && isset(\$credentials['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$credentials['groups']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$data['groups'] = \$credentials['groups'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Create the new user";
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
__LINE__,__CLASS__
)
. " 1 = Site-registration mode";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "\$userId = \$model->register(\$data);";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
. " 0 = Admin-registration mode";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "\$model->save(\$data);";
$method[] = Indent::_(3)
. "\$userId = \$model->getState('user.id', 0);";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check if we have params";
$method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Change user params/config back";
$method[] = Indent::_(3)
. "foreach (\$params as \$param => \$set)";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " If you know of a better path, let me know";
$method[] = Indent::_(4)
. "self::setParams(\$extension, \$param, \$set);";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " if user is created";
$method[] = Indent::_(2) . "if (\$userId > 0)";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Auto Login if Needed";
$method[] = Indent::_(3)
. "if (\$autologin && isset(\$credentials['password']))";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " Try to login";
$method[] = Indent::_(4) . "try{";
$method[] = Indent::_(5)
. "Factory::getApplication()->login(\$credentials);";
$method[] = Indent::_(4) . "} catch (\Exception \$exception){";
$method[] = Indent::_(5) . "//" . Line::_(__Line__, __Class__)
. " Do noting for now, may want to set redirect.";
$method[] = Indent::_(4) . "}";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Return ID";
$method[] = Indent::_(3) . "return \$userId;";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "return \$model->getError();";
$method[] = Indent::_(1) . "}";
$method[] = PHP_EOL . Indent::_(1)
. "public static function setParams(\$component,\$target,\$value)";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Get the params and set the new values";
$method[] = Indent::_(2)
. "\$params = ComponentHelper::getParams(\$component);";
$method[] = Indent::_(2) . "\$was = \$params->get(\$target, null);";
$method[] = Indent::_(2) . "if (\$was != \$value)";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "\$params->set(\$target, \$value);";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Get a new database query instance";
$method[] = Indent::_(3) . "\$db = Factory::getDBO();";
$method[] = Indent::_(3) . "\$query = \$db->getQuery(true);";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Build the query";
$method[] = Indent::_(3) . "\$query->update('#__extensions AS a');";
$method[] = Indent::_(3)
. "\$query->set('a.params = ' . \$db->quote((string)\$params));";
$method[] = Indent::_(3)
. "\$query->where('a.element = ' . \$db->quote((string)\$component));";
$method[] = Indent::_(3);
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Execute the query";
$method[] = Indent::_(3) . "\$db->setQuery(\$query);";
$method[] = Indent::_(3) . "\$db->execute();";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "return \$was;";
$method[] = Indent::_(1) . "}";
$method[] = PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Update user values";
$method[] = Indent::_(1) . " */";
$method[] = Indent::_(1)
. "public static function updateUser(\$new)";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2)
. "// load the user component language files if there is an error.";
$method[] = Indent::_(2) . "\$lang = Factory::getLanguage();";
$method[] = Indent::_(2) . "\$extension = 'com_users';";
$method[] = Indent::_(2) . "\$base_dir = JPATH_ADMINISTRATOR;";
$method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB')
. "';";
$method[] = Indent::_(2) . "\$reload = true;";
$method[] = Indent::_(2)
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
$method[] = Indent::_(2) . "// load the user model";
$method[] = Indent::_(2)
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/com_users', 'Users');";
$method[] = Indent::_(2) . "// Check if password was set";
$method[] = Indent::_(2)
. "if (isset(\$new['password']) && isset(\$new['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password2']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "// Use the users passwords";
$method[] = Indent::_(3) . "\$password = \$new['password'];";
$method[] = Indent::_(3) . "\$password2 = \$new['password2'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "// set username";
$method[] = Indent::_(2)
. "if (!isset(\$new['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['username']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$new['username'] = \$new['email'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "// lineup update user data";
$method[] = Indent::_(2) . "\$data = array(";
$method[] = Indent::_(3) . "'id' => \$new['id'],";
$method[] = Indent::_(3) . "'username' => \$new['username'],";
$method[] = Indent::_(3) . "'name' => \$new['name'],";
$method[] = Indent::_(3) . "'email' => \$new['email'],";
$method[] = Indent::_(3)
. "'password' => \$password, // First password field";
$method[] = Indent::_(3)
. "'password2' => \$password2, // Confirm password field";
$method[] = Indent::_(3) . "'block' => 0 );";
$method[] = Indent::_(2) . "// set groups if found";
$method[] = Indent::_(2)
. "if (isset(\$new['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$new['groups']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "\$data['groups'] = \$new['groups'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "// register the new user";
$method[] = Indent::_(2) . "\$done = \$model->save(\$data);";
$method[] = Indent::_(2) . "// if user is updated";
$method[] = Indent::_(2) . "if (\$done)";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "return \$new['id'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "return \$model->getError();";
$method[] = Indent::_(1) . "}";
// return the help method
return implode(PHP_EOL, $method);
}
return '';
}
}

View File

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

View File

@ -543,14 +543,7 @@ class Config extends BaseConfig
*/
protected function getRemovelinebreaks(): bool
{
// get posted value
$value = $this->input->post->get('remove_line_breaks', 2, 'INT');
// get global
if ($value > 1)
{
return (bool) GetHelper::var('joomla_component', $this->component_id, 'id', 'remove_line_breaks');
}
return (bool) $value;
return (bool) true;
}
/**
@ -889,7 +882,26 @@ class Config extends BaseConfig
*/
protected function getApprovedjoomlapaths(): array
{
return array_values($this->joomla_powers_init_repos);
// some defaults repos we need by JCB
$approved = $this->joomla_powers_init_repos;
$paths = RepoHelper::get(2); // Joomla Power = 2
if ($paths !== null)
{
foreach ($paths as $path)
{
$owner = $path->organisation ?? null;
$repo = $path->repository ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$approved = ["{$owner}.{$repo}" => $path] + $approved;
}
}
}
return array_values($approved);
}
/**

View File

@ -992,7 +992,8 @@ final class Builders
'code' => $name,
'name' => $listLangName,
'extension' => $_extension,
'filter' => $field['filter']
'filter' => $field['filter'],
'add_icon' => StringHelper::check($view['settings']->icon_category)
]);
// also set code name for title alias fix
$this->categorycode->set($nameSingleCode, [

View File

@ -12,13 +12,12 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Hash;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\LockBase;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\DispenserInterface;
@ -80,22 +79,22 @@ class Dispenser implements DispenserInterface
/**
* Constructor.
*
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param Customcode|null $customcode The compiler customcode object.
* @param Gui|null $gui The compiler customcode gui object.
* @param Hash|null $hash The compiler customcode hash object.
* @param LockBase|null $base64 The compiler customcode lock base64 object.
* @param Placeholder $placeholder The Placeholder Class.
* @param Customcode $customcode The Customcode Class.
* @param Gui $gui The Gui Class.
* @param Hash $hash The Hash Class.
* @param LockBase $lockbase The LockBase Class.
*
* @since 3.2.0
*/
public function __construct(?Placeholder $placeholder = null, ?Customcode $customcode = null,
?Gui $gui = null, ?Hash $hash = null, ?LockBase $base64 = null)
public function __construct(Placeholder $placeholder, Customcode $customcode, Gui $gui,
Hash $hash, LockBase $lockbase)
{
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->customcode = $customcode ?: Compiler::_('Customcode');
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
$this->hash = $hash ?: Compiler::_('Customcode.Hash');
$this->base64 = $base64 ?: Compiler::_('Customcode.LockBase');
$this->placeholder = $placeholder;
$this->customcode = $customcode;
$this->gui = $gui;
$this->hash = $hash;
$this->base64 = $lockbase;
}
/**

View File

@ -787,7 +787,7 @@ class Extractor implements ExtractorInterface
$query->columns($this->db->quoteName($columns));
foreach ($this->new as $values)
{
if (count((array) $values) == 15)
if (count((array) $values) == 16)
{
$query->values(implode(',', $values));
$continue = true;

View File

@ -42,6 +42,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Service\Utilities;
use VDM\Joomla\Componentbuilder\Compiler\Service\BuilderAJ;
use VDM\Joomla\Componentbuilder\Compiler\Service\BuilderLZ;
use VDM\Joomla\Componentbuilder\Compiler\Service\Creator;
use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitectureComHelperClass;
use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitectureController;
use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitectureModel;
use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitecturePlugin;
@ -142,6 +143,7 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
->registerServiceProvider(new BuilderAJ())
->registerServiceProvider(new BuilderLZ())
->registerServiceProvider(new Creator())
->registerServiceProvider(new ArchitectureComHelperClass())
->registerServiceProvider(new ArchitectureController())
->registerServiceProvider(new ArchitectureModel())
->registerServiceProvider(new ArchitecturePlugin())

View File

@ -173,7 +173,7 @@ class Get
* @var bool
* @deprecated 3.3 Use CFactory::_('Config')->remove_line_breaks;
*/
public $removeLineBreaks = false;
public $removeLineBreaks = true;
/**
* The placeholders for custom code keys

View File

@ -337,9 +337,10 @@ class Infusion extends Interpretation
// HELPER_CREATEUSER
CFactory::_('Compiler.Builder.Content.One')->add('HELPER_CREATEUSER',
$this->setCreateUserHelperMethod(
CFactory::_('Component')->get('creatuserhelper')
));
CFactory::_('Architecture.ComHelperClass.CreateUser')->get(
CFactory::_('Component')->get('creatuserhelper', 0)
)
);
// HELP
CFactory::_('Compiler.Builder.Content.One')->set('HELP', $this->noHelp());

View File

@ -1827,340 +1827,24 @@ class Interpretation extends Fields
return '';
}
public function setCreateUserHelperMethod($add)
/**
* Generates the method definition for creating or updating a user based on the provided parameters.
*
* This method returns a string representation of a PHP function that includes various
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
*
* @param int $add Determines whether to generate the user creation method or not.
* If true, the method will be generated and returned as a string.
*
* @return string The generated method code as a string if $add is true.
* Returns an empty string if $add is false.
*
* @since 3.0
* @deprecated 5.0.3 Use CFactory::_('Architecture.ComHelperClass.CreateUser')->get($add);
*/
public function setCreateUserHelperMethod($add): string
{
if ($add)
{
$method = [];
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Greate user and update given table";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1)
. " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)";
$method[] = Indent::_(1) . " * @param int \$autologin";
$method[] = Indent::_(1)
. " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)";
$method[] = Indent::_(1)
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
$method[] = Indent::_(1) . " *";
$method[] = Indent::_(1)
. " * @return int|Error User ID on success, or an error.";
$method[] = Indent::_(1) . " */";
$method[] = Indent::_(1)
. "public static function createUser(\$credentials, \$autologin = 0,";
$method[] = Indent::_(2) . "\$params = array(";
$method[] = Indent::_(3)
. "'useractivation' => 0, 'sendpassword' => 1";
$method[] = Indent::_(2) . "), \$mode = 1";
$method[] = Indent::_(1) . ")";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Override mode";
$method[] = Indent::_(2)
. "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Update params";
$method[] = Indent::_(3) . "\$params['autologin'] = \$autologin;";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Now Register User";
$method[] = Indent::_(3)
. "return self::registerUser(\$credentials, \$params);";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "elseif (\$mode == 2)";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Fallback to Site Registrations";
$method[] = Indent::_(3) . "\$mode = 1;";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " load the user component language files if there is an error.";
$method[] = Indent::_(2) . "\$lang = Factory::getLanguage();";
$method[] = Indent::_(2) . "\$extension = 'com_users';";
$method[] = Indent::_(2) . "\$base_dir = JPATH_SITE;";
$method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB')
. "';";
$method[] = Indent::_(2) . "\$reload = true;";
$method[] = Indent::_(2)
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Load the correct user model.";
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
__LINE__,__CLASS__
)
. " 1 = Site Registrations";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Load the user site-registration model";
$method[] = Indent::_(3)
. "\$model = self::getModel('registration', \$base_dir . '/components/' . \$extension, 'Users');";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
. " 0 = Admin Registration";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Load the backend-user model";
$method[] = Indent::_(3)
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/' . \$extension, 'Users');";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check if we have params/config";
$method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Make changes to user config";
$method[] = Indent::_(3)
. "foreach (\$params as \$param => \$set)";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " If you know of a better path, let me know";
$method[] = Indent::_(4)
. "\$params[\$param] = self::setParams(\$extension, \$param, \$set);";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Set username to email if not set";
$method[] = Indent::_(2)
. "if (!isset(\$credentials['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['username']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$credentials['username'] = \$credentials['email'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Lineup new user data array";
$method[] = Indent::_(2) . "\$data = array(";
$method[] = Indent::_(3)
. "'username' => \$credentials['username'],";
$method[] = Indent::_(3) . "'name' => \$credentials['name'],";
$method[] = Indent::_(3) . "'block' => 0 );";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Added details based on mode";
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
__LINE__,__CLASS__
)
. " 1 = Site-registration mode";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$data['email1'] = \$credentials['email'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
. " 0 = Admin-registration mode";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$data['email'] = \$credentials['email'];";
$method[] = Indent::_(3)
. "\$data['registerDate'] = Factory::getDate()->toSql();";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check if password was set";
$method[] = Indent::_(2)
. "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2'])))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Set random password when empty password was submitted,";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " when using the 1 = site-registration mode";
$method[] = Indent::_(3)
. "\$credentials['password'] = self::randomkey(8);";
$method[] = Indent::_(3)
. "\$credentials['password2'] = \$credentials['password'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Now Add password if set";
$method[] = Indent::_(2)
. "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "if (\$mode == 1) //" . Line::_(
__LINE__,__CLASS__
)
. " 1 = Site-registration mode";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4)
. "\$data['password1'] = \$credentials['password'];";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(3) . "else //" . Line::_(__Line__, __Class__)
. " 0 = Admin-registration mode";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4)
. "\$data['password'] = \$credentials['password'];";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(3)
. "\$data['password2'] = \$credentials['password2'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Load the group/s value if set, only for Admin Registration (\$mode == 0)";
$method[] = Indent::_(2)
. "if (\$mode == 0 && isset(\$credentials['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$credentials['groups']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$data['groups'] = \$credentials['groups'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Create the new user";
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
__LINE__,__CLASS__
)
. " 1 = Site-registration mode";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "\$userId = \$model->register(\$data);";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
. " 0 = Admin-registration mode";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "\$model->save(\$data);";
$method[] = Indent::_(3)
. "\$userId = \$model->getState('user.id', 0);";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check if we have params";
$method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Change user params/config back";
$method[] = Indent::_(3)
. "foreach (\$params as \$param => \$set)";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " If you know of a better path, let me know";
$method[] = Indent::_(4)
. "self::setParams(\$extension, \$param, \$set);";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " if user is created";
$method[] = Indent::_(2) . "if (\$userId > 0)";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Auto Login if Needed";
$method[] = Indent::_(3)
. "if (\$autologin && isset(\$credentials['password']))";
$method[] = Indent::_(3) . "{";
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " Try to login";
$method[] = Indent::_(4) . "try{";
$method[] = Indent::_(5)
. "Factory::getApplication()->login(\$credentials);";
$method[] = Indent::_(4) . "} catch (\Exception \$exception){";
$method[] = Indent::_(5) . "//" . Line::_(__Line__, __Class__)
. " Do noting for now, may want to set redirect.";
$method[] = Indent::_(4) . "}";
$method[] = Indent::_(3) . "}";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Return ID";
$method[] = Indent::_(3) . "return \$userId;";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "return \$model->getError();";
$method[] = Indent::_(1) . "}";
$method[] = PHP_EOL . Indent::_(1)
. "public static function setParams(\$component,\$target,\$value)";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Get the params and set the new values";
$method[] = Indent::_(2)
. "\$params = ComponentHelper::getParams(\$component);";
$method[] = Indent::_(2) . "\$was = \$params->get(\$target, null);";
$method[] = Indent::_(2) . "if (\$was != \$value)";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "\$params->set(\$target, \$value);";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Get a new database query instance";
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$method[] = Indent::_(3) . "\$db = Factory::getDBO();";
}
else
{
$method[] = Indent::_(3) . "\$db = Factory::getContainer()->get(DatabaseInterface::class);";
}
$method[] = Indent::_(3) . "\$query = \$db->getQuery(true);";
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Build the query";
$method[] = Indent::_(3) . "\$query->update('#__extensions AS a');";
$method[] = Indent::_(3)
. "\$query->set('a.params = ' . \$db->quote((string)\$params));";
$method[] = Indent::_(3)
. "\$query->where('a.element = ' . \$db->quote((string)\$component));";
$method[] = Indent::_(3);
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " Execute the query";
$method[] = Indent::_(3) . "\$db->setQuery(\$query);";
$method[] = Indent::_(3) . "\$db->execute();";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "return \$was;";
$method[] = Indent::_(1) . "}";
$method[] = PHP_EOL . Indent::_(1) . "/**";
$method[] = Indent::_(1) . " * Update user values";
$method[] = Indent::_(1) . " */";
$method[] = Indent::_(1)
. "public static function updateUser(\$new)";
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2)
. "// load the user component language files if there is an error.";
$method[] = Indent::_(2) . "\$lang = Factory::getLanguage();";
$method[] = Indent::_(2) . "\$extension = 'com_users';";
$method[] = Indent::_(2) . "\$base_dir = JPATH_ADMINISTRATOR;";
$method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB')
. "';";
$method[] = Indent::_(2) . "\$reload = true;";
$method[] = Indent::_(2)
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
$method[] = Indent::_(2) . "// load the user model";
$method[] = Indent::_(2)
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/com_users', 'Users');";
$method[] = Indent::_(2) . "// Check if password was set";
$method[] = Indent::_(2)
. "if (isset(\$new['password']) && isset(\$new['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password2']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "// Use the users passwords";
$method[] = Indent::_(3) . "\$password = \$new['password'];";
$method[] = Indent::_(3) . "\$password2 = \$new['password2'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "// set username";
$method[] = Indent::_(2)
. "if (!isset(\$new['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['username']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3)
. "\$new['username'] = \$new['email'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "// lineup update user data";
$method[] = Indent::_(2) . "\$data = array(";
$method[] = Indent::_(3) . "'id' => \$new['id'],";
$method[] = Indent::_(3) . "'username' => \$new['username'],";
$method[] = Indent::_(3) . "'name' => \$new['name'],";
$method[] = Indent::_(3) . "'email' => \$new['email'],";
$method[] = Indent::_(3)
. "'password' => \$password, // First password field";
$method[] = Indent::_(3)
. "'password2' => \$password2, // Confirm password field";
$method[] = Indent::_(3) . "'block' => 0 );";
$method[] = Indent::_(2) . "// set groups if found";
$method[] = Indent::_(2)
. "if (isset(\$new['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$new['groups']))";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "\$data['groups'] = \$new['groups'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "// register the new user";
$method[] = Indent::_(2) . "\$done = \$model->save(\$data);";
$method[] = Indent::_(2) . "// if user is updated";
$method[] = Indent::_(2) . "if (\$done)";
$method[] = Indent::_(2) . "{";
$method[] = Indent::_(3) . "return \$new['id'];";
$method[] = Indent::_(2) . "}";
$method[] = Indent::_(2) . "return \$model->getError();";
$method[] = Indent::_(1) . "}";
// return the help method
return implode(PHP_EOL, $method);
}
return '';
return CFactory::_('Architecture.ComHelperClass.CreateUser')->get($add);
}
public function setAdminViewMenu(&$nameSingleCode, &$view)
@ -10251,7 +9935,7 @@ class Interpretation extends Fields
. "`id` INT(11) NOT NULL AUTO_INCREMENT,";
}
$db_ .= PHP_EOL . Indent::_(1)
. "`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',";
. "`asset_id` INT(10) unsigned NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',";
ksort($fields);
$last_name = 'asset_id';
foreach ($fields as $field => $data)
@ -10350,19 +10034,19 @@ class Interpretation extends Fields
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.published'))
{
$db_ .= PHP_EOL . Indent::_(1)
. "`published` TINYINT(3) NOT NULL DEFAULT 1,";
. "`published` TINYINT(3) NULL DEFAULT 1,";
}
// check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created_by'))
{
$db_ .= PHP_EOL . Indent::_(1)
. "`created_by` INT(10) unsigned NOT NULL DEFAULT 0,";
. "`created_by` INT(10) unsigned NULL DEFAULT 0,";
}
// check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.modified_by'))
{
$db_ .= PHP_EOL . Indent::_(1)
. "`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,";
. "`modified_by` INT(10) unsigned NULL DEFAULT 0,";
}
// check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created'))
@ -10370,7 +10054,7 @@ class Interpretation extends Fields
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$db_ .= PHP_EOL . Indent::_(1)
. "`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',";
. "`created` DATETIME NULL DEFAULT '0000-00-00 00:00:00',";
}
else
{
@ -10384,7 +10068,7 @@ class Interpretation extends Fields
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$db_ .= PHP_EOL . Indent::_(1)
. "`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',";
. "`modified` DATETIME NULL DEFAULT '0000-00-00 00:00:00',";
}
else
{
@ -10396,7 +10080,7 @@ class Interpretation extends Fields
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out'))
{
$db_ .= PHP_EOL . Indent::_(1)
. "`checked_out` int(11) unsigned NOT NULL DEFAULT 0,";
. "`checked_out` int(11) unsigned NULL DEFAULT 0,";
}
// check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out_time'))
@ -10404,7 +10088,7 @@ class Interpretation extends Fields
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$db_ .= PHP_EOL . Indent::_(1)
. "`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',";
. "`checked_out_time` DATETIME NULL DEFAULT '0000-00-00 00:00:00',";
}
else
{
@ -10416,20 +10100,20 @@ class Interpretation extends Fields
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.version'))
{
$db_ .= PHP_EOL . Indent::_(1)
. "`version` INT(10) unsigned NOT NULL DEFAULT 1,";
. "`version` INT(10) unsigned NULL DEFAULT 1,";
}
// check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.hits'))
{
$db_ .= PHP_EOL . Indent::_(1)
. "`hits` INT(10) unsigned NOT NULL DEFAULT 0,";
. "`hits` INT(10) unsigned NULL DEFAULT 0,";
}
// check if view has access
if (CFactory::_('Compiler.Builder.Access.Switch')->exists($view)
&& !CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.access'))
{
$db_ .= PHP_EOL . Indent::_(1)
. "`access` INT(10) unsigned NOT NULL DEFAULT 0,";
. "`access` INT(10) unsigned NULL DEFAULT 0,";
// add to component dynamic fields
CFactory::_('Compiler.Builder.Component.Fields')->set($view . '.access',
[
@ -10443,7 +10127,7 @@ class Interpretation extends Fields
'type' => 'INT(10) unsigned',
'default' => '0',
'key' => true,
'null_switch' => 'NOT NULL'
'null_switch' => 'NULL'
]
]
);
@ -10452,7 +10136,7 @@ class Interpretation extends Fields
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.ordering'))
{
$db_ .= PHP_EOL . Indent::_(1)
. "`ordering` INT(11) NOT NULL DEFAULT 0,";
. "`ordering` INT(11) NULL DEFAULT 0,";
}
// check if metadata is added to this view
if (CFactory::_('Compiler.Builder.Meta.Data')->isString($view))
@ -10463,7 +10147,7 @@ class Interpretation extends Fields
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$db_ .= PHP_EOL . Indent::_(1)
. "`metakey` TEXT NOT NULL,";
. "`metakey` TEXT NULL,";
}
else
{
@ -10477,7 +10161,7 @@ class Interpretation extends Fields
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$db_ .= PHP_EOL . Indent::_(1)
. "`metadesc` TEXT NOT NULL,";
. "`metadesc` TEXT NULL,";
}
else
{
@ -10491,7 +10175,7 @@ class Interpretation extends Fields
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$db_ .= PHP_EOL . Indent::_(1)
. "`metadata` TEXT NOT NULL,";
. "`metadata` TEXT NULL,";
}
else
{
@ -10663,22 +10347,25 @@ class Interpretation extends Fields
// add to main DB string
$db .= $db_ . PHP_EOL . PHP_EOL;
}
// add custom sql dump to the file
if (isset(CFactory::_('Customcode.Dispenser')->hub['sql'])
&& ArrayHelper::check(
CFactory::_('Customcode.Dispenser')->hub['sql']
))
{
foreach (
CFactory::_('Customcode.Dispenser')->hub['sql'] as $for => $customSql
)
foreach (CFactory::_('Customcode.Dispenser')->hub['sql'] as $for => $customSql)
{
$placeholders = array(Placefix::_('component') => $component,
Placefix::_('view') => $for);
$placeholders = [
Placefix::_('component') => $component,
Placefix::_('view') => $for
]; // dont change this just use ###view### or componentbuilder (took you a while to get here right :)
$db .= CFactory::_('Placeholder')->update(
$customSql, $placeholders
) . PHP_EOL . PHP_EOL;
}
unset(CFactory::_('Customcode.Dispenser')->hub['sql']);
}
@ -13762,6 +13449,14 @@ class Interpretation extends Fields
$headerscript .= PHP_EOL . '}';
if ($addNewButon > 0)
{
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$add_key = 'edit';
}
else
{
$add_key = 'add';
}
// add the link for new
if ($addNewButon == 1 || $addNewButon == 2)
{
@ -13770,7 +13465,7 @@ class Interpretation extends Fields
$headerscript .= PHP_EOL . '$new = "index.php?option=com_'
. CFactory::_('Config')->component_code_name . '&view=' . $name_list_code
. '&task='
. $name_single_code . '.edit" . $ref;';
. $name_single_code . '.' . $add_key . '" . $ref;';
}
// and the link for close and new
if ($addNewButon == 2 || $addNewButon == 3)
@ -13781,7 +13476,7 @@ class Interpretation extends Fields
. '$close_new = "index.php?option=com_'
. CFactory::_('Config')->component_code_name . '&view=' . $name_list_code
. '&task='
. $name_single_code . '.edit";';
. $name_single_code . '.' . $add_key . '";';
}
$headerscript .= PHP_EOL . '//' . Line::_(__Line__, __Class__)
. ' load the action object';
@ -21553,7 +21248,8 @@ class Interpretation extends Fields
$counter++;
}
// dashboard link to category on dashboard is build here
if (CFactory::_('Compiler.Builder.Category')->exists("{$name_list}.code"))
if (CFactory::_('Compiler.Builder.Category')->exists("{$name_list}.code") &&
CFactory::_('Compiler.Builder.Category')->get("{$name_list}.add_icon"))
{
$catCode = CFactory::_('Compiler.Builder.Category')->get("{$name_list}.code");

View File

@ -0,0 +1,36 @@
<?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 VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass;
/**
* Component Helper Class Create User Interface
*
* @since 5.0.2
*/
interface CreateUserInterface
{
/**
* Generates the method definition for creating or updating a user based on the provided parameters.
*
* This method returns a string representation of a PHP function that includes various
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
*
* @param $add Determines whether to generate the user creation method or not.
* If true, the method will be generated and returned as a string.
*
* @return string The generated method code as a string if $add is true.
* Returns an empty string if $add is false.
*/
public function get($add): string;
}

View File

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

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