diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..1b2d180e0 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +# soon :) github: [Llewellynvdm] +open_collective: Joomla-Component-Builder diff --git a/README.md b/README.md index d62f0765e..b2a1ea926 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,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 safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.21) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.10.0) 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) @@ -146,14 +146,14 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 6th July, 2019 -+ *Version*: 2.9.21 ++ *Last Build*: 14th August, 2019 ++ *Version*: 2.10.0 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **211603** -+ *Field count*: **1143** -+ *File count*: **1346** -+ *Folder count*: **209** ++ *Line count*: **246448** ++ *Field count*: **1319** ++ *File count*: **1595** ++ *Folder count*: **244** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/README.txt b/admin/README.txt index d62f0765e..b2a1ea926 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -12,7 +12,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 safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.21) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.10.0) 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) @@ -146,14 +146,14 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 6th July, 2019 -+ *Version*: 2.9.21 ++ *Last Build*: 14th August, 2019 ++ *Version*: 2.10.0 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **211603** -+ *Field count*: **1143** -+ *File count*: **1346** -+ *Folder count*: **209** ++ *Line count*: **246448** ++ *Field count*: **1319** ++ *File count*: **1595** ++ *Folder count*: **244** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/access.xml b/admin/access.xml index f2126b51a..d6962a605 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -71,6 +71,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -157,6 +191,16 @@ + + + + + + + + + + @@ -271,7 +315,6 @@ - @@ -281,6 +324,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -406,6 +488,7 @@ + @@ -430,6 +513,17 @@ +
+ + + + + + + + + +
@@ -497,6 +591,28 @@
+
+ + + + + + + + + +
+
+ + + + + + + + + +
@@ -743,6 +859,17 @@
+
+ + + + + + + + + +
@@ -774,6 +901,42 @@
+
+ + + + + + + + + +
+
+ +
+
+ + + + + + + + + +
+
+ + + + + + + + + +
diff --git a/admin/assets/css/class_extendings.css b/admin/assets/css/class_extendings.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/class_extendings.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/class_extends.css b/admin/assets/css/class_extends.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/class_extends.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/class_method.css b/admin/assets/css/class_method.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/class_method.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/class_methods.css b/admin/assets/css/class_methods.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/class_methods.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/class_properties.css b/admin/assets/css/class_properties.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/class_properties.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/class_property.css b/admin/assets/css/class_property.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/class_property.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/component_plugins.css b/admin/assets/css/component_plugins.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/component_plugins.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/components_plugins.css b/admin/assets/css/components_plugins.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/components_plugins.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/joomla_plugin.css b/admin/assets/css/joomla_plugin.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/joomla_plugin.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/joomla_plugin_files_folders_urls.css b/admin/assets/css/joomla_plugin_files_folders_urls.css new file mode 100644 index 000000000..74e74f969 --- /dev/null +++ b/admin/assets/css/joomla_plugin_files_folders_urls.css @@ -0,0 +1,16 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + +.control-group, .controls, .controls input[type="url"], .controls input[type="text"], .controls input[type="number"], .controls input[type="email"], .controls select, .controls textarea { + max-width: 100%; +} diff --git a/admin/assets/css/joomla_plugin_group.css b/admin/assets/css/joomla_plugin_group.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/joomla_plugin_group.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/joomla_plugin_groups.css b/admin/assets/css/joomla_plugin_groups.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/joomla_plugin_groups.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/joomla_plugin_updates.css b/admin/assets/css/joomla_plugin_updates.css new file mode 100644 index 000000000..d24bb17e2 --- /dev/null +++ b/admin/assets/css/joomla_plugin_updates.css @@ -0,0 +1,15 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + +.mysql_update { width: 100%; height: 392px; } +.version_url { min-width: 100%; } diff --git a/admin/assets/css/joomla_plugins.css b/admin/assets/css/joomla_plugins.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/joomla_plugins.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/joomla_plugins_files_folders_urls.css b/admin/assets/css/joomla_plugins_files_folders_urls.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/joomla_plugins_files_folders_urls.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/joomla_plugins_updates.css b/admin/assets/css/joomla_plugins_updates.css new file mode 100644 index 000000000..3d7b98b8f --- /dev/null +++ b/admin/assets/css/joomla_plugins_updates.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/images/icons/joomla_component_add.png b/admin/assets/images/icons/joomla_component_add.png deleted file mode 100644 index cf9ee7dc5..000000000 Binary files a/admin/assets/images/icons/joomla_component_add.png and /dev/null differ diff --git a/admin/assets/images/icons/joomla_components.png b/admin/assets/images/icons/joomla_components.png index 3917f1e45..6f7d10067 100644 Binary files a/admin/assets/images/icons/joomla_components.png and b/admin/assets/images/icons/joomla_components.png differ diff --git a/admin/assets/images/icons/joomla_plugins.png b/admin/assets/images/icons/joomla_plugins.png new file mode 100644 index 000000000..623cc4140 Binary files /dev/null and b/admin/assets/images/icons/joomla_plugins.png differ diff --git a/admin/assets/images/icons/servers.png b/admin/assets/images/icons/servers.png index db130da40..6baf509e0 100644 Binary files a/admin/assets/images/icons/servers.png and b/admin/assets/images/icons/servers.png differ diff --git a/admin/assets/js/get_snippets.js b/admin/assets/js/get_snippets.js index 325a00747..98adece7b 100644 --- a/admin/assets/js/get_snippets.js +++ b/admin/assets/js/get_snippets.js @@ -386,16 +386,16 @@ function bulkSnippetGithub(status) { function doBulkUpdate_server(path, status) { // set the ajax scope ajaxcall = null; - var getUrl = "index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json&raw=true"); if (token.length > 0 && path.length > 0 && status.length > 0) { - var request = 'token='+token+'&path='+path+'&status='+status; + var request = token+'=1&path='+path+'&status='+status; } return jQuery.ajax({ type: 'POST', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -423,16 +423,16 @@ function setSnippetGithub(key, status) { function setSnippetGithub_server(path, status) { // set the ajax scope ajaxcall = null; - var getUrl = "index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json&raw=true"); if (token.length > 0 && path.length > 0 && status.length > 0) { - var request = 'token='+token+'&path='+path+'&status='+status; + var request = token+'=1&path='+path+'&status='+status; } return jQuery.ajax({ type: 'POST', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } diff --git a/admin/compiler/joomla_3/JControllerLegacyAjax.php b/admin/compiler/joomla_3/JControllerLegacyAjax.php index d865c8162..ba88f128e 100644 --- a/admin/compiler/joomla_3/JControllerLegacyAjax.php +++ b/admin/compiler/joomla_3/JControllerLegacyAjax.php @@ -39,7 +39,7 @@ class ###Component###ControllerAjax extends JControllerLegacy // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); - if($token == $call_token) + if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { $task = $this->getTask(); switch($task) diff --git a/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php b/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php index 0c483a598..fb10fd0fe 100644 --- a/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php +++ b/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php @@ -39,7 +39,7 @@ class ###Component###ControllerAjax extends JControllerLegacy // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); - if($token == $call_token) + if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { $task = $this->getTask(); switch($task) diff --git a/admin/compiler/joomla_3/JFormFieldCheckboxes.php b/admin/compiler/joomla_3/JFormFieldCheckboxes.php index 2b75c8137..d5f648d1a 100644 --- a/admin/compiler/joomla_3/JFormFieldCheckboxes.php +++ b/admin/compiler/joomla_3/JFormFieldCheckboxes.php @@ -24,7 +24,7 @@ JFormHelper::loadFieldClass('checkboxes'); /** * ###Type### Form Field class for the ###Component### component */ -class JFormField###Type### extends JFormFieldCheckboxes +class ###JPREFIX###FormField###Type### extends JFormFieldCheckboxes { /** * The ###type### field type. diff --git a/admin/compiler/joomla_3/JFormFieldCustom.php b/admin/compiler/joomla_3/JFormFieldCustom.php index 21e628cc0..85aa5469e 100644 --- a/admin/compiler/joomla_3/JFormFieldCustom.php +++ b/admin/compiler/joomla_3/JFormFieldCustom.php @@ -24,7 +24,7 @@ JFormHelper::loadFieldClass('###JFORM_extends###'); /** * ###Type### Form Field class for the ###Component### component */ -class JFormField###Type### extends JFormField###JFORM_EXTENDS### +class ###JPREFIX###FormField###Type### extends JFormField###JFORM_EXTENDS### { /** * The ###type### field type. diff --git a/admin/compiler/joomla_3/JFormFieldList.php b/admin/compiler/joomla_3/JFormFieldList.php index d130ff165..918796ba2 100644 --- a/admin/compiler/joomla_3/JFormFieldList.php +++ b/admin/compiler/joomla_3/JFormFieldList.php @@ -24,7 +24,7 @@ JFormHelper::loadFieldClass('list'); /** * ###Type### Form Field class for the ###Component### component */ -class JFormField###Type### extends JFormFieldList +class ###JPREFIX###FormField###Type### extends JFormFieldList { /** * The ###type### field type. diff --git a/admin/compiler/joomla_3/JFormFieldRadio.php b/admin/compiler/joomla_3/JFormFieldRadio.php index bd625b6c7..d8e5f6bfd 100644 --- a/admin/compiler/joomla_3/JFormFieldRadio.php +++ b/admin/compiler/joomla_3/JFormFieldRadio.php @@ -24,7 +24,7 @@ JFormHelper::loadFieldClass('radio'); /** * ###Type### Form Field class for the ###Component### component */ -class JFormField###Type### extends JFormFieldRadio +class ###JPREFIX###FormField###Type### extends JFormFieldRadio { /** * The ###type### field type. diff --git a/admin/compiler/joomla_3/JFormFieldUser.php b/admin/compiler/joomla_3/JFormFieldUser.php index cbaf59b9d..9889ba0bb 100644 --- a/admin/compiler/joomla_3/JFormFieldUser.php +++ b/admin/compiler/joomla_3/JFormFieldUser.php @@ -24,7 +24,7 @@ JFormHelper::loadFieldClass('user'); /** * ###Type### Form Field class for the ###Component### component */ -class JFormField###Type### extends JFormFieldUser +class ###JPREFIX###FormField###Type### extends JFormFieldUser { /** * The ###type### field type. diff --git a/admin/compiler/joomla_3/script.php b/admin/compiler/joomla_3/script.php index 9609154d4..e480f966b 100644 --- a/admin/compiler/joomla_3/script.php +++ b/admin/compiler/joomla_3/script.php @@ -5,7 +5,7 @@ * @created 30th April, 2015 * @author Llewellyn van der Merwe * @github Joomla Component Builder - * @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -25,21 +25,27 @@ JHTML::_('behavior.modal'); class com_###component###InstallerScript { /** - * method to install the component + * Constructor * - * @return void + * @param JAdapterInstance $parent The object responsible for running this script */ - function install($parent) - { - - } + public function __construct(JAdapterInstance $parent) {} /** - * method to uninstall the component + * Called on installation * - * @return void + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function uninstall($parent) + public function install(JAdapterInstance $parent) {} + + /** + * Called on uninstallation + * + * @param JAdapterInstance $parent The object responsible for running this script + */ + public function uninstall(JAdapterInstance $parent) {###UNINSTALLSCRIPT### // little notice as after service, in case of bad experience with component. echo '

Did something go wrong? Are you disappointed?

@@ -50,62 +56,69 @@ class com_###component###InstallerScript } /** - * method to update the component + * Called on update * - * @return void + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function update($parent) - { - - } + public function update(JAdapterInstance $parent){} /** - * method to run before an install/update/uninstall method + * Called before any type of action * - * @return void + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function preflight($type, $parent) + public function preflight($type, JAdapterInstance $parent) { // get application $app = JFactory::getApplication(); - // is redundant ...hmmm - if ($type == 'uninstall') + // is redundant or so it seems ...hmmm let me know if it works again + if ($type === 'uninstall') { return true; } // the default for both install and update $jversion = new JVersion(); - if (!$jversion->isCompatible('3.6.0')) + if (!$jversion->isCompatible('3.8.0')) { - $app->enqueueMessage('Please upgrade to at least Joomla! 3.6.0 before continuing!', 'error'); + $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); return false; } // do any updates needed - if ($type == 'update') + if ($type === 'update') {###PREUPDATESCRIPT### } // do any install needed - if ($type == 'install') + if ($type === 'install') {###PREINSTALLSCRIPT### } + return true; } /** - * method to run after an install/update/uninstall method + * Called after any type of action * - * @return void + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function postflight($type, $parent) + public function postflight($type, JAdapterInstance $parent) { // get application $app = JFactory::getApplication();###MOVEFOLDERSSCRIPT### // set the default component settings - if ($type == 'install') + if ($type === 'install') {###POSTINSTALLSCRIPT### } // do any updates needed - if ($type == 'update') + if ($type === 'update') {###POSTUPDATESCRIPT### } + return true; }###MOVEFOLDERSMETHOD### } diff --git a/admin/config.xml b/admin/config.xml index 20204b87b..69db069e6 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -263,6 +263,20 @@ + + + + + + diff --git a/admin/controller.php b/admin/controller.php index bf6e8d93d..b31cff972 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -91,6 +91,7 @@ class ComponentbuilderController extends JControllerLegacy // the view relationships $views = array( 'joomla_component' => 'joomla_components', + 'joomla_plugin' => 'joomla_plugins', 'admin_view' => 'admin_views', 'custom_admin_view' => 'custom_admin_views', 'site_view' => 'site_views', @@ -98,6 +99,8 @@ class ComponentbuilderController extends JControllerLegacy 'layout' => 'layouts', 'dynamic_get' => 'dynamic_gets', 'custom_code' => 'custom_codes', + 'class_property' => 'class_properties', + 'class_method' => 'class_methods', 'placeholder' => 'placeholders', 'library' => 'libraries', 'snippet' => 'snippets', @@ -122,9 +125,14 @@ class ComponentbuilderController extends JControllerLegacy 'component_dashboard' => 'components_dashboard', 'component_files_folders' => 'components_files_folders', 'component_placeholders' => 'components_placeholders', + 'component_plugins' => 'components_plugins', 'snippet_type' => 'snippet_types', 'library_config' => 'libraries_config', - 'library_files_folders_urls' => 'libraries_files_folders_urls' + 'library_files_folders_urls' => 'libraries_files_folders_urls', + 'class_extends' => 'class_extendings', + 'joomla_plugin_group' => 'joomla_plugin_groups', + 'joomla_plugin_updates' => 'joomla_plugins_updates', + 'joomla_plugin_files_folders_urls' => 'joomla_plugins_files_folders_urls' ); // check if this is a list view if (in_array($view, $views)) diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 8bcc6b72d..69a27a482 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -31,6 +31,9 @@ class ComponentbuilderControllerAjax extends JControllerLegacy $this->registerTask('getCronPath', 'ajax'); $this->registerTask('getJCBpackageInfo', 'ajax'); $this->registerTask('getCrowdinDetails', 'ajax'); + $this->registerTask('getClassCode', 'ajax'); + $this->registerTask('getClassCodeIds', 'ajax'); + $this->registerTask('getClassHeaderCode', 'ajax'); $this->registerTask('tableColumns', 'ajax'); $this->registerTask('fieldSelectOptions', 'ajax'); $this->registerTask('getDynamicScripts', 'ajax'); @@ -67,7 +70,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); - if($token == $call_token) + if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { $task = $this->getTask(); switch($task) @@ -301,6 +304,123 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } } break; + case 'getClassCode': + try + { + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $idValue = $jinput->get('id', NULL, 'INT'); + $typeValue = $jinput->get('type', NULL, 'WORD'); + if($idValue && $typeValue && $user->id != 0) + { + $result = $this->getModel('ajax')->getClassCode($idValue, $typeValue); + } + else + { + $result = false; + } + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback."(".json_encode($e).");"; + } + else + { + echo "(".json_encode($e).");"; + } + } + break; + case 'getClassCodeIds': + try + { + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $idValue = $jinput->get('id', NULL, 'INT'); + $typeValue = $jinput->get('type', NULL, 'WORD'); + if($idValue && $typeValue && $user->id != 0) + { + $result = $this->getModel('ajax')->getClassCodeIds($idValue, $typeValue); + } + else + { + $result = false; + } + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback."(".json_encode($e).");"; + } + else + { + echo "(".json_encode($e).");"; + } + } + break; + case 'getClassHeaderCode': + try + { + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $idValue = $jinput->get('id', NULL, 'INT'); + $typeValue = $jinput->get('type', NULL, 'WORD'); + if($idValue && $typeValue && $user->id != 0) + { + $result = $this->getModel('ajax')->getClassHeaderCode($idValue, $typeValue); + } + else + { + $result = false; + } + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback."(".json_encode($e).");"; + } + else + { + echo "(".json_encode($e).");"; + } + } + break; case 'tableColumns': try { diff --git a/admin/controllers/class_extendings.php b/admin/controllers/class_extendings.php new file mode 100644 index 000000000..fdd10006d --- /dev/null +++ b/admin/controllers/class_extendings.php @@ -0,0 +1,43 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_extendings Controller + */ +class ComponentbuilderControllerClass_extendings extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_CLASS_EXTENDINGS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Class_extends', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } +} diff --git a/admin/controllers/class_extends.php b/admin/controllers/class_extends.php new file mode 100644 index 000000000..5464f7dd5 --- /dev/null +++ b/admin/controllers/class_extends.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_extends Controller + */ +class ComponentbuilderControllerClass_extends extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Class_extendings'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('class_extends.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return $user->authorise('class_extends.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('class_extends.access', 'com_componentbuilder.class_extends.' . (int) $recordId) && $user->authorise('class_extends.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('class_extends.edit.own', 'com_componentbuilder.class_extends.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('class_extends.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('class_extends.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Class_extends', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_extendings' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/class_method.php b/admin/controllers/class_method.php new file mode 100644 index 000000000..986fa6fb4 --- /dev/null +++ b/admin/controllers/class_method.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_method Controller + */ +class ComponentbuilderControllerClass_method extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Class_methods'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('class_method.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return $user->authorise('class_method.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('class_method.access', 'com_componentbuilder.class_method.' . (int) $recordId) && $user->authorise('class_method.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('class_method.edit', 'com_componentbuilder.class_method.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('class_method.edit.own', 'com_componentbuilder.class_method.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('class_method.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('class_method.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Class_method', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_methods' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/class_methods.php b/admin/controllers/class_methods.php new file mode 100644 index 000000000..af11b3c2c --- /dev/null +++ b/admin/controllers/class_methods.php @@ -0,0 +1,106 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_methods Controller + */ +class ComponentbuilderControllerClass_methods extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_CLASS_METHODS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Class_method', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('class_method.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + JArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Class_methods'); + // get the data to export + $data = $model->getExportData($pks); + if (ComponentbuilderHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + ComponentbuilderHelper::xls($data,'Class_methods_'.$date->format('jS_F_Y'),'Class methods exported ('.$date->format('jS F, Y').')','class methods'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_methods', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('class_method.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) + { + // Get the import model + $model = $this->getModel('Class_methods'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (ComponentbuilderHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('class_method_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'class_methods'); + $session->set('dataType_VDM_IMPORTINTO', 'class_method'); + // Redirect to import view. + $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_METHODS'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_methods', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/class_properties.php b/admin/controllers/class_properties.php new file mode 100644 index 000000000..80b1b40e0 --- /dev/null +++ b/admin/controllers/class_properties.php @@ -0,0 +1,106 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_properties Controller + */ +class ComponentbuilderControllerClass_properties extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_CLASS_PROPERTIES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Class_property', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('class_property.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + JArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Class_properties'); + // get the data to export + $data = $model->getExportData($pks); + if (ComponentbuilderHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + ComponentbuilderHelper::xls($data,'Class_properties_'.$date->format('jS_F_Y'),'Class properties exported ('.$date->format('jS F, Y').')','class properties'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_properties', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('class_property.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) + { + // Get the import model + $model = $this->getModel('Class_properties'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (ComponentbuilderHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('class_property_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'class_properties'); + $session->set('dataType_VDM_IMPORTINTO', 'class_property'); + // Redirect to import view. + $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_PROPERTIES'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_properties', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/class_property.php b/admin/controllers/class_property.php new file mode 100644 index 000000000..2dc93983d --- /dev/null +++ b/admin/controllers/class_property.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_property Controller + */ +class ComponentbuilderControllerClass_property extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Class_properties'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('class_property.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return $user->authorise('class_property.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('class_property.access', 'com_componentbuilder.class_property.' . (int) $recordId) && $user->authorise('class_property.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('class_property.edit', 'com_componentbuilder.class_property.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('class_property.edit.own', 'com_componentbuilder.class_property.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('class_property.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('class_property.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Class_property', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_properties' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/compiler.php b/admin/controllers/compiler.php index 720f41699..cbdcca5a9 100644 --- a/admin/controllers/compiler.php +++ b/admin/controllers/compiler.php @@ -60,7 +60,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin // include component compiler require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php'; $model = $this->getModel('compiler'); - if ($model->builder($version,$componentId,$addBackup,$addRepo,$addPlaceholders,$debugLinenr, $minify)) + if ($model->builder($version, $componentId, $addBackup, $addRepo, $addPlaceholders, $debugLinenr, $minify)) { $cache = JFactory::getCache('mod_menu'); $cache->clean(); @@ -77,14 +77,36 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin if (empty($redirect_url) && $componentId > 0) { $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); - if (($pos = strpos($model->compiler->filepath, "/tmp/")) !== FALSE) + if (($pos = strpos($model->compiler->filepath['component'], "/tmp/")) !== FALSE) { - $url = JURI::root() . substr($model->compiler->filepath, $pos + 1); + $url = JURI::root() . substr($model->compiler->filepath['component'], $pos + 1); + } + // check if we have plugins + if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins'])) + { + // Message of successful build + $message = '

The Extensions were Successfully Compiled!

'; + $message .= '

You can install any one of the following extensions!

'; + } + else + { + // Message of successful build + $message = '

The (' . $model->compiler->filepath['component-folder'] . ') was Successfully Compiled!

'; + } + $message .= '

'; + // check if we have plugins + if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins'])) + { + foreach ($model->compiler->filepath['plugins-folder'] as $plugin_id => $plugin_folder) + { + $message .= '

'; + } + $message .= '

You can install all compiled extensions!

'; + $message .= '

'; } - // Message of successful build - $message = '

The ('.$model->compiler->componentFolderName.') Was Successfully Compiled!

'; - $message .= '

'; $message .= '

Total time saved

'; $message .= '
    '; $message .= '
  • Total folders created: '.$model->compiler->folderCount.'
  • '; @@ -100,15 +122,53 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $message .= '

    '.$model->compiler->actualTotalHours.' Hours or '.$model->compiler->actualTotalDays.' Eight Hour Days (a total of the realistic time frame for this project)
    '; $message .= '(if creating a folder and file took 5 seconds and writing one line of code took 10 seconds, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)

    '; $message .= '

    Project duration: '.$model->compiler->projectWeekTime. ' weeks or '.$model->compiler->projectMonthTime.' months

    '; - $message .= '

    Path to Zip File

    '; - $message .= '

    Path: '.$model->compiler->filepath.'
    '; - $message .= 'URL: '.$url.'

    '; - $message .= 'Hey! you can also download the file right now!
    Download

    '; - $message .= '

    Remember! This file is in your tmp folder and therefore publicly accessible untill you click [Clear tmp]!

    '; + // check if we have plugins + if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins'])) + { + $plugin_url = array(); + $message .= '

    Path to Zip Files

    '; + $message .= '

    Component Path: ' . $model->compiler->filepath['component'] . '
    '; + $message .= 'Component URL: ' . $url . '

    '; + // load the plugins path/url + foreach ($model->compiler->filepath['plugins'] as $plugin_id => $plugin_path) + { + // set plugin path + $message .= 'Plugin Path: ' . $plugin_path . '
    '; + if (($pos = strpos($plugin_path, "/tmp/")) !== FALSE) + { + $plugin_urls[$plugin_id] = JURI::root() . substr($plugin_path, $pos + 1); + $message .= 'Plugin URL: ' . $plugin_urls[$plugin_id] . '
    '; + } + } + $message .= '
    Hey! you can also download these zip files right now!
    '; + $message .= 'Download Component  '; + // load the plugin download URL's + foreach ($plugin_urls as $plugin_id => $plugin_url) + { + $message .= ' '; + $message .= 'Download ' . $model->compiler->filepath['plugins-folder'][$plugin_id] . '  '; + } + $message .= '

    '; + $message .= '

    Remember! These zip files are in your tmp folder and therefore publicly accessible until you click [Clear tmp]!

    '; + } + else + { + $message .= '

    Path to Zip File

    '; + $message .= '

    Path: ' . $model->compiler->filepath['component'] . '
    '; + $message .= 'URL: ' . $url . '

    '; + $message .= 'Hey! you can also download the zip file right now!
    '; + $message .= 'Download

    '; + $message .= '

    Remember! This zip file is in your tmp folder and therefore publicly accessible until you click [Clear tmp]!

    '; + } $message .= '

    Compilation took '.$model->compiler->secondsCompiled.' seconds to complete.

    '; // set redirect - $this->setRedirect($redirect_url,$message,'message'); - $app->setUserState('com_componentbuilder.extension_name', $model->compiler->componentFolderName); + $this->setRedirect($redirect_url, $message, 'message'); + $app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']); + // check if we have plugins + if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins'])) + { + $app->setUserState('com_componentbuilder.plugins_folder_name', $model->compiler->filepath['plugins-folder']); + } } else { @@ -116,9 +176,10 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $app->setUserState('com_componentbuilder.redirect_url', ''); $app->setUserState('com_componentbuilder.message', ''); $app->setUserState('com_componentbuilder.extension_message', ''); - $app->setUserState('com_componentbuilder.extension_name', ''); + $app->setUserState('com_componentbuilder.component_folder_name', ''); + $app->setUserState('com_componentbuilder.plugins_folder_name', ''); // set redirect - $this->setRedirect($redirect_url,$message); + $this->setRedirect($redirect_url, $message); } return true; } @@ -126,11 +187,11 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin } /** - * Install Compiled Extension + * Install All Compiled Extensions * * @return true on success */ - public function installExtention() + public function installCompiledExtensions() { // Check for request forgeries JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); @@ -138,27 +199,133 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $user = JFactory::getUser(); // set page redirect $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); - $message = 'Could not install component!'; + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THESE_EXTENSIONS'); if($user->authorise('core.admin')) { - // get the model - $model = $this->getModel('compiler'); + $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENTIONS'); + $_message = array('success' => array(), 'error' => array()); $app = JFactory::getApplication(); - $fileName = $app->getUserState('com_componentbuilder.extension_name'); - if (ComponentbuilderHelper::checkString($fileName)) + $fileNames = $app->getUserState('com_componentbuilder.plugins_folder_name', array()); + $fileNames[] = $app->getUserState('com_componentbuilder.component_folder_name', null); + foreach ($fileNames as $fileName) { - $lang = JFactory::getLanguage(); - $extension = 'com_installer'; - $base_dir = JPATH_ADMINISTRATOR; - $language_tag = 'en-GB'; - $reload = true; - $lang->load($extension, $base_dir, $language_tag, $reload); - $message = '('.$fileName.'.zip) file was also removed from tmp!'; - $this->setRedirect($redirect_url,$message,'message'); - return $model->install($fileName.'.zip'); + if ($this->installExtension($fileName)) + { + $_message['success'][] = JText::sprintf('COM_COMPONENTBUILDER_SZIP_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName); + } + else + { + $_message['error'][] = JText::sprintf('COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED', $fileName); + } + } + // catch errors + if (ComponentbuilderHelper::checkArray($_message['error'])) + { + $app->enqueueMessage(implode('
    ', $_message['error']), 'Error'); + } + // build success message + if (ComponentbuilderHelper::checkArray($_message['success'])) + { + $this->setRedirect($redirect_url, implode('
    ', $_message['success']), 'message'); + return true; } } - $this->setRedirect($redirect_url,$message,'error'); + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + /** + * Install Compiled Component + * + * @return true on success + */ + public function installCompiledComponent() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT'); + if($user->authorise('core.admin')) + { + $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT'); + $fileName = JFactory::getApplication()->getUserState('com_componentbuilder.component_folder_name'); + if ($this->installExtension($fileName)) + { + $message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + /** + * Install Compiled Plugin + * + * @return true on success + */ + public function installCompiledPlugin() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN'); + if($user->authorise('core.admin')) + { + $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN'); + $app = JFactory::getApplication(); + $fileNames = $app->getUserState('com_componentbuilder.plugins_folder_name'); + if (ComponentbuilderHelper::checkArray($fileNames)) + { + $jinput = JFactory::getApplication()->input; + $pluginId = $jinput->post->get('install_item_id', 0, 'INT'); + if ($pluginId > 0 && isset($fileNames[$pluginId]) && $this->installExtension($fileNames[$pluginId])) + { + $message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + /** + * Install Extension + * + * @return true on success + */ + protected function installExtension($fileName) + { + // check that the model is set + if (!isset($this->_compiler_model)) + { + // get the compiler model + $this->_compiler_model = $this->getModel('compiler'); + } + // set the language if not set + if (!isset($this->_installer_lang)) + { + $this->_installer_lang = JFactory::getLanguage(); + $extension = 'com_installer'; + $base_dir = JPATH_ADMINISTRATOR; + $language_tag = 'en-GB'; + $reload = true; + $this->_installer_lang->load($extension, $base_dir, $language_tag, $reload); + } + // make sure we have a string + if (ComponentbuilderHelper::checkString($fileName)) + { + return $this->_compiler_model->install($fileName.'.zip'); + } return false; } diff --git a/admin/controllers/component_plugins.php b/admin/controllers/component_plugins.php new file mode 100644 index 000000000..7e96456e4 --- /dev/null +++ b/admin/controllers/component_plugins.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Component_plugins Controller + */ +class ComponentbuilderControllerComponent_plugins extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Components_plugins'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('component_plugins.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return $user->authorise('component_plugins.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('component_plugins.access', 'com_componentbuilder.component_plugins.' . (int) $recordId) && $user->authorise('component_plugins.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('component_plugins.edit', 'com_componentbuilder.component_plugins.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('component_plugins.edit.own', 'com_componentbuilder.component_plugins.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('component_plugins.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('component_plugins.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Component_plugins', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_plugins' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/components_plugins.php b/admin/controllers/components_plugins.php new file mode 100644 index 000000000..12caea7bd --- /dev/null +++ b/admin/controllers/components_plugins.php @@ -0,0 +1,43 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Components_plugins Controller + */ +class ComponentbuilderControllerComponents_plugins extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_PLUGINS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Component_plugins', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } +} diff --git a/admin/controllers/joomla_plugin.php b/admin/controllers/joomla_plugin.php new file mode 100644 index 000000000..efea13c74 --- /dev/null +++ b/admin/controllers/joomla_plugin.php @@ -0,0 +1,347 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin Controller + */ +class ComponentbuilderControllerJoomla_plugin extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Joomla_plugins'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('joomla_plugin.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return $user->authorise('joomla_plugin.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('joomla_plugin.access', 'com_componentbuilder.joomla_plugin.' . (int) $recordId) && $user->authorise('joomla_plugin.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('joomla_plugin.edit', 'com_componentbuilder.joomla_plugin.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('joomla_plugin.edit.own', 'com_componentbuilder.joomla_plugin.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('joomla_plugin.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('joomla_plugin.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Joomla_plugin', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + // get the state object (Joomla\CMS\Object\CMSObject) + $state = $model->get('state'); + // if we save2copy we need to also copy linked tables found! + if ($state->task === 'save2copy' && $state->{'joomla_plugin.new'}) + { + // get new ID + $newID = $state->{'joomla_plugin.id'}; + // get old ID + $oldID = $this->input->get('id', 0, 'INT'); + // linked tables to update + $_tablesArray = array( + 'joomla_plugin_updates' => 'joomla_plugin', + 'joomla_plugin_files_folders_urls' => 'joomla_plugin' + ); + foreach($_tablesArray as $_updateTable => $_key) + { + // get the linked ID + if ($_value = ComponentbuilderHelper::getVar($_updateTable, $oldID, $_key, 'id')) + { + // copy fields to new linked table + ComponentbuilderHelper::copyItem(/*id->*/ $_value, /*table->*/ $_updateTable, /*change->*/ array($_key => $newID)); + } + } + } + + + return; + } + +} diff --git a/admin/controllers/joomla_plugin_files_folders_urls.php b/admin/controllers/joomla_plugin_files_folders_urls.php new file mode 100644 index 000000000..af8e3827b --- /dev/null +++ b/admin/controllers/joomla_plugin_files_folders_urls.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin_files_folders_urls Controller + */ +class ComponentbuilderControllerJoomla_plugin_files_folders_urls extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Joomla_plugins_files_folders_urls'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return $user->authorise('joomla_plugin_files_folders_urls.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $recordId) && $user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('joomla_plugin_files_folders_urls.edit', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('joomla_plugin_files_folders_urls.edit.own', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('joomla_plugin_files_folders_urls.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('joomla_plugin_files_folders_urls.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Joomla_plugin_files_folders_urls', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins_files_folders_urls' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/joomla_plugin_group.php b/admin/controllers/joomla_plugin_group.php new file mode 100644 index 000000000..b22c31396 --- /dev/null +++ b/admin/controllers/joomla_plugin_group.php @@ -0,0 +1,314 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin_group Controller + */ +class ComponentbuilderControllerJoomla_plugin_group extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Joomla_plugin_groups'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('joomla_plugin_group.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_componentbuilder.joomla_plugin_group.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_componentbuilder.joomla_plugin_group.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Joomla_plugin_group', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugin_groups' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/joomla_plugin_groups.php b/admin/controllers/joomla_plugin_groups.php new file mode 100644 index 000000000..3cee15bba --- /dev/null +++ b/admin/controllers/joomla_plugin_groups.php @@ -0,0 +1,43 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin_groups Controller + */ +class ComponentbuilderControllerJoomla_plugin_groups extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Joomla_plugin_group', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } +} diff --git a/admin/controllers/joomla_plugin_updates.php b/admin/controllers/joomla_plugin_updates.php new file mode 100644 index 000000000..210222991 --- /dev/null +++ b/admin/controllers/joomla_plugin_updates.php @@ -0,0 +1,339 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin_updates Controller + */ +class ComponentbuilderControllerJoomla_plugin_updates extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Joomla_plugins_updates'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('joomla_plugin_updates.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return $user->authorise('joomla_plugin_updates.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('joomla_plugin_updates.access', 'com_componentbuilder.joomla_plugin_updates.' . (int) $recordId) && $user->authorise('joomla_plugin_updates.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('joomla_plugin_updates.edit', 'com_componentbuilder.joomla_plugin_updates.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('joomla_plugin_updates.edit.own', 'com_componentbuilder.joomla_plugin_updates.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('joomla_plugin_updates.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('joomla_plugin_updates.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Joomla_plugin_updates', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins_updates' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + // update the component version to match the updated last version + if (isset($validData['joomla_plugin']) && is_numeric($validData['joomla_plugin']) && $validData['joomla_plugin'] > 0) + { + $objectUpdate = new stdClass(); + $objectUpdate->id = (int) $validData['joomla_plugin']; + if (isset($validData['version_update']) && ComponentbuilderHelper::checkArray($validData['version_update']) + && ($plugin_version = end($validData['version_update'])['version']) + && ComponentbuilderHelper::checkString($plugin_version)) + { + $objectUpdate->plugin_version = $plugin_version; + } + // be sure to update the table if we have a value + if (isset($objectUpdate->plugin_version)) + { + JFactory::getDbo()->updateObject('#__componentbuilder_joomla_plugin', $objectUpdate, 'id'); + } + } + + return; + } + +} diff --git a/admin/controllers/joomla_plugins.php b/admin/controllers/joomla_plugins.php new file mode 100644 index 000000000..e648b8ca3 --- /dev/null +++ b/admin/controllers/joomla_plugins.php @@ -0,0 +1,136 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugins Controller + */ +class ComponentbuilderControllerJoomla_plugins extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_PLUGINS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Joomla_plugin', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + + /** + * Run the Expansion + * + * @return void + */ + public function runExpansion() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins', false); + // set massage + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + // check if this user has the right to run expansion + if($user->authorise('joomla_plugins.run_expansion', 'com_componentbuilder')) + { + // set massage + $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + // run expansion via API + $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + // is there a message returned + if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + { + $this->setRedirect($redirect_url, $result); + return true; + } + elseif (is_numeric($result) && 1 == $result) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + + /** + * get Boilerplate + * + * @return boolean + */ + public function getBoilerplate() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins', false); + // set massage + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE'); + // check if this user has the right to run expansion + if($user->authorise('joomla_plugin.get_boilerplate', 'com_componentbuilder')) + { + // set massage + $message = JText::_('COM_COMPONENTBUILDER_GETTING_JOOMLA_PLUGIN_BOILERPLATE_FAILED_IF_THE_ISSUE_CONTINUES_INFORM_YOUR_SYSTEM_ADMINISTRATOR'); + // Get the model + $model = $this->getModel('joomla_plugins'); + // check if there is any selections + if (!$model->getBoilerplate()) + { + $message = '' . JText::_('COM_COMPONENTBUILDER_GETTING_JOOMLA_PLUGIN_BOILERPLATE_WAS_SUCCESSFULLY') . ''; + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + public function openClassMethods() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // redirect to the libraries + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_methods', false)); + return; + } + + public function openClassProperties() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // redirect to the libraries + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_properties', false)); + return; + } +} diff --git a/admin/controllers/joomla_plugins_files_folders_urls.php b/admin/controllers/joomla_plugins_files_folders_urls.php new file mode 100644 index 000000000..f3b2a6316 --- /dev/null +++ b/admin/controllers/joomla_plugins_files_folders_urls.php @@ -0,0 +1,43 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugins_files_folders_urls Controller + */ +class ComponentbuilderControllerJoomla_plugins_files_folders_urls extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Joomla_plugin_files_folders_urls', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } +} diff --git a/admin/controllers/joomla_plugins_updates.php b/admin/controllers/joomla_plugins_updates.php new file mode 100644 index 000000000..4f00edceb --- /dev/null +++ b/admin/controllers/joomla_plugins_updates.php @@ -0,0 +1,43 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugins_updates Controller + */ +class ComponentbuilderControllerJoomla_plugins_updates extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Joomla_plugin_updates', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } +} diff --git a/admin/controllers/validation_rules.php b/admin/controllers/validation_rules.php index 02462dc22..ee89c1c18 100644 --- a/admin/controllers/validation_rules.php +++ b/admin/controllers/validation_rules.php @@ -102,5 +102,46 @@ class ComponentbuilderControllerValidation_rules extends JControllerAdmin $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error'); return; + } + + + /** + * Run the Expansion + * + * @return void + */ + public function runExpansion() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=validation_rules', false); + // set massage + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + // check if this user has the right to run expansion + if($user->authorise('validation_rules.run_expansion', 'com_componentbuilder')) + { + // set massage + $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + // run expansion via API + $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + // is there a message returned + if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + { + $this->setRedirect($redirect_url, $result); + return true; + } + elseif (is_numeric($result) && 1 == $result) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; } + } diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index 695c72aaa..7726a86b7 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -35,7 +35,21 @@ class Compiler extends Infusion private $time_start; private $time_end; public $secondsCompiled; - public $filepath = ''; + + /* + * The file path array + * + * @var string + */ + public $filepath = array( + 'component' => '', + 'component-folder' => '', + 'package' => '', + 'plugins' => array(), + 'plugins-folders' => array(), + 'modules' => array() + ); + // fixed pathes protected $dynamicIntegration = false; protected $backupPath = false; @@ -58,9 +72,10 @@ class Compiler extends Infusion // set some folder paths in relation to distribution if ($config['backup']) { - $this->backupPath = $this->params->get('backup_folder_path', $this->tempPath) . '/' . $this->componentBackupName . '.zip'; + $this->backupPath = $this->params->get('backup_folder_path', $this->tempPath); $this->dynamicIntegration = true; } + // set local repos switch if ($config['repository']) { $this->repoPath = $this->params->get('git_folder_path', null); @@ -125,12 +140,16 @@ class Compiler extends Infusion $this->setCountingStuff(); // build read me $this->buildReadMe(); + // set local repos + $this->setLocalRepos(); // zip the component if (!$this->zipComponent()) { // done with error return false; } + // if there are plugins zip them + $this->zipPlugins(); // do lang mismatch check if (ComponentbuilderHelper::checkArray($this->langMismatch)) { @@ -240,6 +259,26 @@ class Compiler extends Infusion } // free up some memory unset($this->newFiles['dynamic']); + // do plugins if found + if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins)) + { + foreach ($this->componentData->joomla_plugins as $plugin) + { + if (ComponentbuilderHelper::checkObject($plugin) && isset($this->newFiles[$plugin->key]) && ComponentbuilderHelper::checkArray($this->newFiles[$plugin->key])) + { + foreach ($this->newFiles[$plugin->key] as $plugin_file) + { + if (JFile::exists($plugin_file['path'])) + { + $this->setFileContent($plugin_file['name'], $plugin_file['path'], $bom, $plugin->key); + } + } + // free up some memory + unset($this->newFiles[$plugin->key]); + unset($this->fileContentDynamic[$plugin->key]); + } + } + } return true; } return false; @@ -301,17 +340,37 @@ class Compiler extends Infusion */ protected function setUpdateServer() { - // move the update server to host - if ($this->componentData->add_update_server == 1 && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration) + // move the component update server to host + if ($this->componentData->add_update_server == 1 && $this->componentData->update_server_target == 1 + && isset($this->updateServerFileName) && $this->dynamicIntegration) { - $xml_update_server_path = $this->componentPath . '/' . $this->updateServerFileName . '.xml'; + $update_server_xml_path = $this->componentPath . '/' . $this->updateServerFileName . '.xml'; // make sure we have the correct file - if (JFile::exists($xml_update_server_path) && isset($this->componentData->update_server)) + if (JFile::exists($update_server_xml_path) && isset($this->componentData->update_server)) { // move to server - ComponentbuilderHelper::moveToServer($xml_update_server_path, $this->updateServerFileName . '.xml', (int) $this->componentData->update_server, $this->componentData->update_server_protocol); + ComponentbuilderHelper::moveToServer($update_server_xml_path, $this->updateServerFileName . '.xml', (int) $this->componentData->update_server, $this->componentData->update_server_protocol); // remove the local file - JFile::delete($xml_update_server_path); + JFile::delete($update_server_xml_path); + } + } + // move the plugins update server to host + if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins)) + { + foreach ($this->componentData->joomla_plugins as $plugin) + { + if (ComponentbuilderHelper::checkObject($plugin) + && isset($plugin->add_update_server) && $plugin->add_update_server == 1 + && isset($plugin->update_server_target) && $plugin->update_server_target == 1 + && isset($plugin->update_server) && is_numeric($plugin->update_server) && $plugin->update_server > 0 + && isset($plugin->update_server_xml_path) && JFile::exists($plugin->update_server_xml_path) + && isset($plugin->update_server_xml_file_name) && ComponentbuilderHelper::checkString($plugin->update_server_xml_file_name)) + { + // move to server + ComponentbuilderHelper::moveToServer($plugin->update_server_xml_path, $plugin->update_server_xml_file_name, (int) $plugin->update_server, $plugin->update_server_protocol); + // remove the local file + JFile::delete($plugin->update_server_xml_path); + } } } } @@ -452,10 +511,10 @@ class Compiler extends Infusion $this->fileContentStatic[$this->hhh . 'projectMonthTime' . $this->hhh] = $this->projectMonthTime; } - private function zipComponent() + private function setLocalRepos() { - // before we zip the component we first need to move it to the repo folder if set - if (ComponentbuilderHelper::checkString($this->repoPath)) + // move it to the repo folder if set + if (isset($this->repoPath) && ComponentbuilderHelper::checkString($this->repoPath)) { // set the repo path $repoFullPath = $this->repoPath . '/com_' . $this->componentData->sales_name . '__joomla_' . $this->joomlaVersion; @@ -467,21 +526,49 @@ class Compiler extends Infusion JFolder::copy($this->componentPath, $repoFullPath, '', true); // Trigger Event: jcb_ce_onAfterUpdateRepo $this->triggerEvent('jcb_ce_onAfterUpdateRepo', array(&$this->componentContext, &$this->componentPath, &$repoFullPath, &$this->componentData)); + + // move the plugins to local folder repos + if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins)) + { + foreach ($this->componentData->joomla_plugins as $plugin) + { + if (ComponentbuilderHelper::checkObject($plugin) && isset($plugin->file_name)) + { + $plugin_context = 'plugin.' . $plugin->file_name . '.' . $plugin->id; + // set the repo path + $repoFullPath = $this->repoPath . '/' . $plugin->folder_name . '__joomla_' . $this->joomlaVersion; + // Trigger Event: jcb_ce_onBeforeUpdateRepo + $this->triggerEvent('jcb_ce_onBeforeUpdateRepo', array(&$plugin_context, &$plugin->folder_path, &$repoFullPath, &$plugin)); + // remove old data + $this->removeFolder($repoFullPath, $this->componentData->toignore); + // set the new data + JFolder::copy($plugin->folder_path, $repoFullPath, '', true); + // Trigger Event: jcb_ce_onAfterUpdateRepo + $this->triggerEvent('jcb_ce_onAfterUpdateRepo', array(&$plugin_context, &$plugin->folder_path, &$repoFullPath, &$plugin)); + } + } + } } + } + + private function zipComponent() + { + // Component Folder Name + $this->filepath['component-folder'] = $this->componentFolderName; // the name of the zip file to create - $this->filepath = $this->tempPath . '/' . $this->componentFolderName . '.zip'; + $this->filepath['component'] = $this->tempPath . '/' . $this->filepath['component-folder'] . '.zip'; // Trigger Event: jcb_ce_onBeforeZipComponent - $this->triggerEvent('jcb_ce_onBeforeZipComponent', array(&$this->componentContext, &$this->componentPath, &$this->filepath, &$this->tempPath, &$this->componentFolderName, &$this->componentData)); + $this->triggerEvent('jcb_ce_onBeforeZipComponent', array(&$this->componentContext, &$this->componentPath, &$this->filepath['component'], &$this->tempPath, &$this->componentFolderName, &$this->componentData)); //create the zip file - if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath)) + if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath['component'])) { // now move to backup if zip was made and backup is required if ($this->backupPath && $this->dynamicIntegration) { // Trigger Event: jcb_ce_onBeforeBackupZip - $this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$this->componentContext, &$this->filepath, &$this->tempPath, &$this->backupPath, &$this->componentData)); + $this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$this->componentContext, &$this->filepath['component'], &$this->tempPath, &$this->backupPath, &$this->componentData)); // copy the zip to backup path - JFile::copy($this->filepath, $this->backupPath); + JFile::copy($this->filepath['component'], $this->backupPath . '/' . $this->componentBackupName . '.zip'); } // move to sales server host @@ -491,13 +578,13 @@ class Compiler extends Infusion if (isset($this->componentData->sales_server)) { // Trigger Event: jcb_ce_onBeforeMoveToServer - $this->triggerEvent('jcb_ce_onBeforeMoveToServer', array(&$this->componentContext, &$this->filepath, &$this->tempPath, &$this->componentSalesName, &$this->componentData)); + $this->triggerEvent('jcb_ce_onBeforeMoveToServer', array(&$this->componentContext, &$this->filepath['component'], &$this->tempPath, &$this->componentSalesName, &$this->componentData)); // move to server - ComponentbuilderHelper::moveToServer($this->filepath, $this->componentSalesName . '.zip', (int) $this->componentData->sales_server, $this->componentData->sales_server_protocol); + ComponentbuilderHelper::moveToServer($this->filepath['component'], $this->componentSalesName . '.zip', (int) $this->componentData->sales_server, $this->componentData->sales_server_protocol); } } // Trigger Event: jcb_ce_onAfterZipComponent - $this->triggerEvent('jcb_ce_onAfterZipComponent', array(&$this->componentContext, &$this->filepath, &$this->tempPath, &$this->componentFolderName, &$this->componentData)); + $this->triggerEvent('jcb_ce_onAfterZipComponent', array(&$this->componentContext, &$this->filepath['component'], &$this->tempPath, &$this->componentFolderName, &$this->componentData)); // remove the component folder since we are done if ($this->removeFolder($this->componentPath)) { @@ -507,6 +594,60 @@ class Compiler extends Infusion return false; } + private function zipPlugins() + { + if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins)) + { + foreach ($this->componentData->joomla_plugins as $plugin) + { + if (ComponentbuilderHelper::checkObject($plugin) && isset($plugin->zip_name) + && ComponentbuilderHelper::checkString($plugin->zip_name) + && isset($plugin->folder_path) + && ComponentbuilderHelper::checkString($plugin->folder_path)) + { + // set plugin context + $plugin_context = $plugin->file_name . '.' . $plugin->id; + // Component Folder Name + $this->filepath['plugins-folder'][$plugin->id] = $plugin->zip_name; + // the name of the zip file to create + $this->filepath['plugins'][$plugin->id] = $this->tempPath . '/' . $plugin->zip_name . '.zip'; + // Trigger Event: jcb_ce_onBeforeZipPlugin + $this->triggerEvent('jcb_ce_onBeforeZipPlugin', array(&$plugin_context, &$plugin->folder_path, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$plugin->zip_name, &$plugin)); + //create the zip file + if (ComponentbuilderHelper::zip($plugin->folder_path, $this->filepath['plugins'][$plugin->id])) + { + // now move to backup if zip was made and backup is required + if ($this->backupPath) + { + $__plugin_context = 'plugin.' . $plugin_context; + // Trigger Event: jcb_ce_onBeforeBackupZip + $this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$__plugin_context, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$this->backupPath, &$plugin)); + // copy the zip to backup path + JFile::copy($this->filepath['plugins'][$plugin->id], $this->backupPath . '/' . $plugin->zip_name . '.zip'); + } + + // move to sales server host + if ($plugin->add_sales_server == 1) + { + // make sure we have the correct file + if (isset($plugin->sales_server)) + { + // Trigger Event: jcb_ce_onBeforeMoveToServer + $this->triggerEvent('jcb_ce_onBeforeMoveToServer', array(&$__plugin_context, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$plugin->zip_name, &$plugin)); + // move to server + ComponentbuilderHelper::moveToServer($this->filepath['plugins'][$plugin->id], $plugin->zip_name . '.zip', (int) $plugin->sales_server, $plugin->sales_server_protocol); + } + } + // Trigger Event: jcb_ce_onAfterZipPlugin + $this->triggerEvent('jcb_ce_onAfterZipPlugin', array(&$plugin_context, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$plugin->zip_name, &$plugin)); + // remove the plugin folder since we are done + $this->removeFolder($plugin->folder_path); + } + } + } + } + } + protected function addCustomCode() { // reset all these diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 29186c266..fd043bcc5 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -18,6 +18,13 @@ defined('_JEXEC') or die('Restricted access'); class Get { + /** + * The Joomla Version + * + * @var string + */ + public $joomlaVersion; + /** * The hash placeholder * @@ -746,7 +753,6 @@ class Get /** * Constructor */ - public function __construct($config = array()) { if (isset($config) && count($config)) @@ -770,6 +776,8 @@ class Get } } } + // set the Joomla version + $this->joomlaVersion = $config['version']; // set the minfy switch of the JavaScript $this->minify = (isset($config['minify']) && $config['minify'] != 2) ? $config['minify'] : $this->params->get('minify', 0); // set the global language @@ -946,11 +954,32 @@ class Get if ($this->db->getNumRows()) { $bucket = $this->db->loadAssocList('target', 'value'); + // open all the code foreach ($bucket as $key => &$code) { $code = base64_decode($code); } } + // set component place holders + $bucket[$this->hhh . 'component' . $this->hhh] = $this->componentCodeName; + $bucket[$this->hhh . 'Component' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentCodeName, 'F'); + $bucket[$this->hhh . 'COMPONENT' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentCodeName, 'U'); + $bucket[$this->bbb . 'component' . $this->ddd] = $bucket[$this->hhh . 'component' . $this->hhh]; + $bucket[$this->bbb . 'Component' . $this->ddd] = $bucket[$this->hhh . 'Component' . $this->hhh]; + $bucket[$this->bbb . 'COMPONENT' . $this->ddd] = $bucket[$this->hhh . 'COMPONENT' . $this->hhh]; + // get the current components overides + if (($_placeholders = ComponentbuilderHelper::getVar('component_placeholders', $this->componentID, 'joomla_component', 'addplaceholders')) !== false + && ComponentbuilderHelper::checkJson($_placeholders)) + { + $_placeholders = json_decode($_placeholders, true); + if (ComponentbuilderHelper::checkArray($_placeholders)) + { + foreach($_placeholders as $row) + { + $bucket[$row['target']] = $row['value']; + } + } + } return $bucket; } @@ -966,59 +995,52 @@ class Get { // Create a new query object. $query = $this->db->getQuery(true); - + // selection + $selection = array( + 'b.addadmin_views' => 'addadmin_views', + 'b.id' => 'addadmin_views_id', + 'h.addconfig' => 'addconfig', + 'd.addcustom_admin_views' => 'addcustom_admin_views', + 'g.addcustommenus' => 'addcustommenus', + 'j.addfiles' => 'addfiles', + 'j.addfolders' => 'addfolders', + 'j.addfilesfullpath' => 'addfilesfullpath', + 'j.addfoldersfullpath' => 'addfoldersfullpath', + 'c.addsite_views' => 'addsite_views', + 'l.addjoomla_plugins' => 'addjoomla_plugins', + 'i.dashboard_tab' => 'dashboard_tab', + 'i.php_dashboard_methods' => 'php_dashboard_methods', + 'i.id' => 'component_dashboard_id', + 'f.sql_tweak' => 'sql_tweak', + 'e.version_update' => 'version_update', + 'e.id' => 'version_update_id' + ); $query->select('a.*'); $query->select( $this->db->quoteName( - array( - 'b.addadmin_views', - 'b.id', - 'h.addconfig', - 'd.addcustom_admin_views', - 'g.addcustommenus', - 'j.addfiles', - 'j.addfolders', - 'j.addfilesfullpath', - 'j.addfoldersfullpath', - 'c.addsite_views', - 'i.dashboard_tab', - 'i.php_dashboard_methods', - 'f.sql_tweak', - 'e.version_update', - 'e.id', - 'k.addplaceholders' - ), array( - 'addadmin_views', - 'addadmin_views_id', - 'addconfig', - 'addcustom_admin_views', - 'addcustommenus', - 'addfiles', - 'addfolders', - 'addfilesfullpath', - 'addfoldersfullpath', - 'addsite_views', - 'dashboard_tab', - 'php_dashboard_methods', - 'sql_tweak', - 'version_update', - 'version_update_id', - '_placeholders' - ) + array_keys($selection), array_values($selection) ) ); - // from these tables + // from this table $query->from('#__componentbuilder_joomla_component AS a'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_admin_views', 'b') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('b.joomla_component') . ')'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_site_views', 'c') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('c.joomla_component') . ')'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_custom_admin_views', 'd') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('d.joomla_component') . ')'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_updates', 'e') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('e.joomla_component') . ')'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_mysql_tweaks', 'f') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('f.joomla_component') . ')'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_custom_admin_menus', 'g') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('g.joomla_component') . ')'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_config', 'h') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('h.joomla_component') . ')'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_dashboard', 'i') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('i.joomla_component') . ')'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_files_folders', 'j') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('j.joomla_component') . ')'); - $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_placeholders', 'k') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('k.joomla_component') . ')'); + // jointer-map + $joiners = array( + 'b' => 'component_admin_views', + 'c' => 'component_site_views', + 'd' => 'component_custom_admin_views', + 'e' => 'component_updates', + 'f' => 'component_mysql_tweaks', + 'g' => 'component_custom_admin_menus', + 'h' => 'component_config', + 'i' => 'component_dashboard', + 'j' => 'component_files_folders', + 'l' => 'component_plugins' + ); + // load the joins + foreach($joiners as $as => $join) + { + $query->join('LEFT', $this->db->quoteName('#__componentbuilder_' . $join, $as) . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName($as . '.joomla_component') . ')'); + } $query->where($this->db->quoteName('a.id') . ' = ' . (int) $this->componentID); // Trigger Event: jcb_ce_onBeforeQueryComponentData @@ -1069,32 +1091,10 @@ class Get // update the repeatable fields $component = ComponentbuilderHelper::convertRepeatableFields($component, $searchRepeatables, $updater); - // set component place holders - $this->placeholders[$this->hhh . 'component' . $this->hhh] = ComponentbuilderHelper::safeString($component->name_code); - $this->placeholders[$this->hhh . 'Component' . $this->hhh] = ComponentbuilderHelper::safeString($component->name_code, 'F'); - $this->placeholders[$this->hhh . 'COMPONENT' . $this->hhh] = ComponentbuilderHelper::safeString($component->name_code, 'U'); - $this->placeholders[$this->bbb . 'component' . $this->ddd] = $this->placeholders[$this->hhh . 'component' . $this->hhh]; - $this->placeholders[$this->bbb . 'Component' . $this->ddd] = $this->placeholders[$this->hhh . 'Component' . $this->hhh]; - $this->placeholders[$this->bbb . 'COMPONENT' . $this->ddd] = $this->placeholders[$this->hhh . 'COMPONENT' . $this->hhh]; - - // set the addcustommenus data - $component->_placeholders = (isset($component->_placeholders) && ComponentbuilderHelper::checkJson($component->_placeholders)) ? json_decode($component->_placeholders, true) : null; - if (ComponentbuilderHelper::checkArray($component->_placeholders)) - { - foreach($component->_placeholders as $row) - { - $this->globalPlaceholders[$row['target']] = $row['value']; - } - } - unset($component->_placeholders); - // load the global placeholders if (ComponentbuilderHelper::checkArray($this->globalPlaceholders)) { - foreach ($this->globalPlaceholders as $globalPlaceholder => $gloabalValue) - { - $this->placeholders[$globalPlaceholder] = $gloabalValue; - } + $this->placeholders = $this->globalPlaceholders; } // set component sales name @@ -1374,10 +1374,19 @@ class Get // unset original value unset($component->addadmin_views); + // set GUI mapper + $guiMapper = array( 'table' => 'joomla_component', 'id' => (int) $this->componentID, 'field' => 'javascript', 'type' => 'js'); + // add_javascript if ($component->add_javascript == 1) { - $this->customScriptBuilder['component_js'] = base64_decode($component->javascript); + $this->setCustomScriptBuilder( + $component->javascript, + 'component_js', + false, + false, + $guiMapper + ); } else { @@ -1392,7 +1401,10 @@ class Get // add_css if found if (isset($component->{'add_css_' . $area}) && $component->{'add_css_' . $area} == 1 && isset($component->{'css_' . $area}) && ComponentbuilderHelper::checkString($component->{'css_' . $area})) { - $this->customScriptBuilder['component_css_' . $area] = base64_decode($component->{'css_' . $area}); + $this->setCustomScriptBuilder( + $component->{'css_' . $area}, + 'component_css_' . $area + ); } else { @@ -1405,13 +1417,23 @@ class Get // add PHP in ADMIN $addScriptMethods = array('php_preflight', 'php_postflight', 'php_method'); $addScriptTypes = array('install', 'update', 'uninstall'); + // update GUI mapper + $guiMapper['type'] = 'php'; foreach ($addScriptMethods as $scriptMethod) { foreach ($addScriptTypes as $scriptType) { if (isset($component->{'add_' . $scriptMethod . '_' . $scriptType}) && $component->{'add_' . $scriptMethod . '_' . $scriptType} == 1 && ComponentbuilderHelper::checkString($component->{$scriptMethod . '_' . $scriptType})) { - $this->customScriptBuilder[$scriptMethod][$scriptType] = $this->setDynamicValues(base64_decode($component->{$scriptMethod . '_' . $scriptType})); + // set GUI mapper field + $guiMapper['field'] = $scriptMethod . '_' . $scriptType; + $this->setCustomScriptBuilder( + $component->{$scriptMethod . '_' . $scriptType}, + $scriptMethod, + $scriptType, + false, + $guiMapper + ); } else { @@ -1424,7 +1446,17 @@ class Get if ($component->add_php_helper_admin == 1 && ComponentbuilderHelper::checkString($component->php_helper_admin)) { $this->lang = 'admin'; - $this->customScriptBuilder['component_php_helper_admin'] = PHP_EOL . PHP_EOL . $this->setDynamicValues(base64_decode($component->php_helper_admin)); + // update GUI mapper + $guiMapper['field'] = 'php_helper_admin'; + $guiMapper['prefix'] = PHP_EOL . PHP_EOL; + $this->setCustomScriptBuilder( + $component->php_helper_admin, + 'component_php_helper_admin', + false, + false, + $guiMapper + ); + unset($guiMapper['prefix']); } else { @@ -1435,7 +1467,15 @@ class Get if ($component->add_admin_event == 1 && ComponentbuilderHelper::checkString($component->php_admin_event)) { $this->lang = 'admin'; - $this->customScriptBuilder['component_php_admin_event'] = $this->setDynamicValues(base64_decode($component->php_admin_event)); + // update GUI mapper field + $guiMapper['field'] = 'php_admin_event'; + $this->setCustomScriptBuilder( + $component->php_admin_event, + 'component_php_admin_event', + false, + false, + $guiMapper + ); } else { @@ -1446,7 +1486,17 @@ class Get if ($component->add_php_helper_both == 1 && ComponentbuilderHelper::checkString($component->php_helper_both)) { $this->lang = 'both'; - $this->customScriptBuilder['component_php_helper_both'] = PHP_EOL . PHP_EOL . $this->setDynamicValues(base64_decode($component->php_helper_both)); + // update GUI mapper field + $guiMapper['field'] = 'php_helper_both'; + $guiMapper['prefix'] = PHP_EOL . PHP_EOL; + $this->setCustomScriptBuilder( + $component->php_helper_both, + 'component_php_helper_both', + false, + false, + $guiMapper + ); + unset($guiMapper['prefix']); } else { @@ -1456,7 +1506,17 @@ class Get if ($component->add_php_helper_site == 1 && ComponentbuilderHelper::checkString($component->php_helper_site)) { $this->lang = 'site'; - $this->customScriptBuilder['component_php_helper_site'] = PHP_EOL . PHP_EOL . $this->setDynamicValues(base64_decode($component->php_helper_site)); + // update GUI mapper field + $guiMapper['field'] = 'php_helper_site'; + $guiMapper['prefix'] = PHP_EOL . PHP_EOL; + $this->setCustomScriptBuilder( + $component->php_helper_site, + 'component_php_helper_site', + false, + false, + $guiMapper + ); + unset($guiMapper['prefix']); } else { @@ -1467,7 +1527,15 @@ class Get if ($component->add_site_event == 1 && ComponentbuilderHelper::checkString($component->php_site_event)) { $this->lang = 'site'; - $this->customScriptBuilder['component_php_site_event'] = $this->setDynamicValues(base64_decode($component->php_site_event)); + // update GUI mapper field + $guiMapper['field'] = 'php_site_event'; + $this->setCustomScriptBuilder( + $component->php_site_event, + 'component_php_site_event', + false, + false, + $guiMapper + ); } else { @@ -1477,13 +1545,20 @@ class Get // add_sql if ($component->add_sql == 1) { - $this->customScriptBuilder['sql']['component_sql'] = base64_decode($component->sql); + $this->setCustomScriptBuilder( + $component->sql, + 'sql', + 'component_sql' + ); } unset($component->sql); // add_sql_uninstall if ($component->add_sql_uninstall == 1) { - $this->customScriptBuilder['sql_uninstall'] = base64_decode($component->sql_uninstall); + $this->setCustomScriptBuilder( + $component->sql_uninstall, + 'sql_uninstall' + ); } unset($component->sql_uninstall); // bom @@ -1527,7 +1602,14 @@ class Get if (isset($component->php_dashboard_methods) && ComponentbuilderHelper::checkString($component->php_dashboard_methods)) { // load the php for the dashboard model - $component->php_dashboard_methods = $this->setDynamicValues(base64_decode($component->php_dashboard_methods)); + $component->php_dashboard_methods = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($component->php_dashboard_methods)), + array( + 'table' => 'component_dashboard', + 'field' => 'php_dashboard_methods', + 'id' => (int) $component->component_dashboard_id, + 'type' => 'php') + ); } else { @@ -1573,6 +1655,20 @@ class Get // the default is to ignore the repo folder $component->toignore = array('.git'); } + // get all plugins + $component->addjoomla_plugins = (isset($component->addjoomla_plugins) && ComponentbuilderHelper::checkJson($component->addjoomla_plugins)) ? json_decode($component->addjoomla_plugins, true) : null; + if (ComponentbuilderHelper::checkArray($component->addjoomla_plugins)) + { + $component->joomla_plugins = array_map(function($array) use(&$component) + { + return $this->getPlugins($array['plugin'], $component); + }, array_values($component->addjoomla_plugins)); + } + else + { + $component->joomla_plugins = ''; + } + unset($component->addjoomla_plugins); // Trigger Event: jcb_ce_onAfterModelComponentData $this->triggerEvent('jcb_ce_onAfterModelComponentData', array(&$this->componentContext, &$component)); @@ -2083,29 +2179,29 @@ class Get { $this->lang = 'both'; } + // set GUI mapper + $guiMapper = array( 'table' => 'admin_view', 'id' => (int) $id, 'type' => 'js'); // add_javascript $addArrayJ = array('javascript_view_file', 'javascript_view_footer', 'javascript_views_file', 'javascript_views_footer'); + // update GUI mapper + $guiMapper['prefix'] = PHP_EOL; foreach ($addArrayJ as $scripter) { if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 && ComponentbuilderHelper::checkString($view->$scripter)) { - $view->{$scripter} = $this->setDynamicValues(base64_decode($view->{$scripter})); $scripter_target = str_replace('javascript_', '', $scripter); - if (!isset($this->customScriptBuilder[$scripter_target]) || !isset($this->customScriptBuilder[$scripter_target][$name_single])) - { - // check if the script is set - if (!isset($this->customScriptBuilder[$scripter_target])) - { - $this->customScriptBuilder[$scripter_target] = array(); - } - // check if the script view is set - if (!isset($this->customScriptBuilder[$scripter_target][$name_single])) - { - $this->customScriptBuilder[$scripter_target][$name_single] = ''; - } - } - // load the script to class array - $this->customScriptBuilder[$scripter_target][$name_single] .= PHP_EOL . $view->{$scripter}; + // update GUI mapper field + $guiMapper['field'] = $scripter; + $this->setCustomScriptBuilder( + $view->{$scripter}, + $scripter_target, + $name_single, + false, + $guiMapper, + true, + true, + true + ); // check if a token must be set if (strpos($view->$scripter, "token") !== false || strpos($view->$scripter, "task=ajax") !== false) { @@ -2117,61 +2213,67 @@ class Get unset($view->{$scripter}); } } + unset($guiMapper['prefix']); // add_css $addArrayC = array('css_view', 'css_views'); foreach ($addArrayC as $scripter) { if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 && ComponentbuilderHelper::checkString($view->{$scripter})) { - $view->{$scripter} = $this->setDynamicValues(base64_decode($view->{$scripter})); - if (!isset($this->customScriptBuilder[$scripter]) || !isset($this->customScriptBuilder[$scripter][$name_single])) - { - // check if the script is set - if (!isset($this->customScriptBuilder[$scripter])) - { - $this->customScriptBuilder[$scripter] = array(); - } - // check if the script view is set - if (!isset($this->customScriptBuilder[$scripter][$name_single])) - { - $this->customScriptBuilder[$scripter][$name_single] = ''; - } - } - // load the script to class array - $this->customScriptBuilder[$scripter][$name_single] .= PHP_EOL . $view->{$scripter}; + $this->setCustomScriptBuilder( + $view->{$scripter}, + $scripter, + $name_single, + false, + array('prefix' => PHP_EOL), + true, + true, + true + ); unset($view->{$scripter}); } } + // update GUI mapper + $guiMapper['type'] = 'php'; // add_php $addArrayP = array('php_getitem', 'php_before_save', 'php_save', 'php_getform', 'php_postsavehook', 'php_getitems', 'php_getitems_after_all', 'php_getlistquery', 'php_allowadd', 'php_allowedit', 'php_before_cancel', 'php_after_cancel', 'php_before_delete', 'php_after_delete', 'php_before_publish', 'php_after_publish', 'php_batchcopy', 'php_batchmove', 'php_document'); foreach ($addArrayP as $scripter) { if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1) { - $this->customScriptBuilder[$scripter][$name_single] = $this->setDynamicValues(base64_decode($view->$scripter)); - unset($view->$scripter); + // update GUI mapper field + $guiMapper['field'] = $scripter; + $this->setCustomScriptBuilder( + $view->{$scripter}, + $scripter, + $name_single, + false, + $guiMapper + ); + unset($view->{$scripter}); } } // add the custom buttons if (isset($view->add_custom_button) && $view->add_custom_button == 1) { - // set for the edit views - if (ComponentbuilderHelper::checkString($view->php_model)) + $button_code_array = array( + 'php_model', + 'php_controller', + 'php_model_list', + 'php_controller_list' + ); + // set for the code + foreach ($button_code_array as $button_code_field) { - $view->php_model = $this->setDynamicValues(base64_decode($view->php_model)); - } - if (ComponentbuilderHelper::checkString($view->php_controller)) - { - $view->php_controller = $this->setDynamicValues(base64_decode($view->php_controller)); - } - // set for the list views - if (isset($view->php_model_list) && ComponentbuilderHelper::checkString($view->php_model_list)) - { - $view->php_model_list = $this->setDynamicValues(base64_decode($view->php_model_list)); - } - if (isset($view->php_controller_list) && ComponentbuilderHelper::checkString($view->php_controller_list)) - { - $view->php_controller_list = $this->setDynamicValues(base64_decode($view->php_controller_list)); + if (isset($view->{$button_code_field}) && ComponentbuilderHelper::checkString($view->{$button_code_field})) + { + // set field + $guiMapper['field'] = $button_code_field; + $view->{$button_code_field} = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($view->{$button_code_field})), + $guiMapper + ); + } } // set the button array $view->custom_button = (isset($view->custom_button) && ComponentbuilderHelper::checkJson($view->custom_button)) ? json_decode($view->custom_button, true) : null; @@ -2189,7 +2291,15 @@ class Get { if (isset($view->$importScripter) && strlen($view->$importScripter) > 0) { - $this->customScriptBuilder[$importScripter]['import_' . $name_list] = $this->setDynamicValues(base64_decode($view->$importScripter)); + // update GUI mapper field + $guiMapper['field'] = $importScripter; + $this->setCustomScriptBuilder( + $view->$importScripter, + $importScripter, + 'import_' . $name_list, + false, + $guiMapper + ); unset($view->$importScripter); } else @@ -2229,10 +2339,26 @@ class Get } if (ComponentbuilderHelper::checkString($view->php_ajaxmethod)) { - $this->customScriptBuilder['admin']['ajax_model'][$name_single] = $this->setDynamicValues(base64_decode($view->php_ajaxmethod)); + // update GUI mapper field + $guiMapper['field'] = 'php_ajaxmethod'; + $this->setCustomScriptBuilder( + $view->php_ajaxmethod, + 'admin', + 'ajax_model', + $name_single, + $guiMapper + ); if ($addAjaxSite) { - $this->customScriptBuilder['site']['ajax_model'][$name_single] = $this->customScriptBuilder['admin']['ajax_model'][$name_single]; + $this->setCustomScriptBuilder( + $view->php_ajaxmethod, + 'site', + 'ajax_model', + $name_single, + $guiMapper, + false, + false + ); } // unset anyway unset($view->php_ajaxmethod); @@ -2279,7 +2405,11 @@ class Get elseif ($view->source == 2 && isset($view->sql)) { // add the SQL dump string - $this->customScriptBuilder['sql'][$name_single] = base64_decode($view->sql); + $this->setCustomScriptBuilder( + $view->sql, + 'sql', + $name_single + ); unset($view->sql); } } @@ -2385,8 +2515,14 @@ class Get // update the repeatable fields $view = ComponentbuilderHelper::convertRepeatableFields($view, $searchRepeatables, $updater); + // set GUI mapper + $guiMapper = array( 'table' => $table, 'id' => (int) $id, 'field' => 'default', 'type' => 'html'); + // set the default data - $view->default = $this->setDynamicValues(base64_decode($view->default)); + $view->default = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($view->default)), + $guiMapper + ); // fix alias to use in code $view->code = $this->uniqueCode(ComponentbuilderHelper::safeString($view->codename)); $view->Code = ComponentbuilderHelper::safeString($view->code, 'F'); @@ -2478,11 +2614,26 @@ class Get $view->custom_get = $this->setGetData(json_decode($view->custom_get, true), $view->code, $view->context); // set array adding array of scripts $addArray = array('php_view', 'php_jview', 'php_jview_display', 'php_document', 'javascript_file', 'js_document', 'css_document', 'css'); + // set GUI mapper + $guiMapper['type'] = 'php'; foreach ($addArray as $scripter) { if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 && ComponentbuilderHelper::checkString($view->$scripter)) { - $view->$scripter = $this->setDynamicValues(base64_decode($view->$scripter)); + // css does not get placholders yet + if (strpos($scripter, 'css') === false) + { + // set field + $guiMapper['field'] = $scripter; + $view->$scripter = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($view->$scripter)), + $guiMapper + ); + } + else + { + $view->$scripter = $this->setDynamicValues(base64_decode($view->$scripter)); + } if (2 == $this->uikit || 1 == $this->uikit) { if (!isset($this->uikitComp[$view->code])) @@ -2556,7 +2707,15 @@ class Get // load the ajax class mathods (if set) if (ComponentbuilderHelper::checkString($view->php_ajaxmethod)) { - $this->customScriptBuilder[$target]['ajax_model'][$view->code] = $this->setDynamicValues(base64_decode($view->php_ajaxmethod)); + // set field + $guiMapper['field'] = 'php_ajaxmethod'; + $this->setCustomScriptBuilder( + $view->php_ajaxmethod, + $target, + 'ajax_model', + $view->code, + $guiMapper + ); $setAjax = true; } // unset anyway @@ -2578,13 +2737,23 @@ class Get // add the custom buttons if (isset($view->add_custom_button) && $view->add_custom_button == 1) { - if (ComponentbuilderHelper::checkString($view->php_model)) + $button_code_array = array( + 'php_model', + 'php_controller' + ); + // set for the code + foreach ($button_code_array as $button_code_field) { - $view->php_model = base64_decode($view->php_model); - $view->php_model = $this->setDynamicValues($view->php_model); + if (isset($view->{$button_code_field}) && ComponentbuilderHelper::checkString($view->{$button_code_field})) + { + // set field + $guiMapper['field'] = $button_code_field; + $view->{$button_code_field} = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($view->{$button_code_field})), + $guiMapper + ); + } } - $view->php_controller = base64_decode($view->php_controller); - $view->php_controller = $this->setDynamicValues($view->php_controller); // set the button array $view->custom_button = (isset($view->custom_button) && ComponentbuilderHelper::checkJson($view->custom_button)) ? json_decode($view->custom_button, true) : null; if (ComponentbuilderHelper::checkArray($view->custom_button)) @@ -2678,7 +2847,14 @@ class Get if ($this->validationRules[$validationRule] = ComponentbuilderHelper::getVar('validation_rule', $validationRule, 'name', 'php')) { // open and set the validation rule - $this->validationRules[$validationRule] = $this->setPlaceholders($this->setDynamicValues(base64_decode($this->validationRules[$validationRule])), $this->placeholders); + $this->validationRules[$validationRule] = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($this->validationRules[$validationRule])), $this->placeholders), + array( + 'table' => 'validation_rule', + 'field' => 'php', + 'id' => ComponentbuilderHelper::getVar('validation_rule', $validationRule, 'name', 'id'), + 'type' => 'php') + ); } else { @@ -2733,20 +2909,31 @@ class Get // add_javascript_view_footer if ($this->_fieldData[$id]->add_javascript_view_footer == 1 && ComponentbuilderHelper::checkString($this->_fieldData[$id]->javascript_view_footer)) { - if (!isset($this->customScriptBuilder['view_footer'])) + $convert__ = true; + if (isset($this->_fieldData[$id]->javascript_view_footer_decoded) + && $this->_fieldData[$id]->javascript_view_footer_decoded) { - $this->customScriptBuilder['view_footer'] = array(); - } - if (!isset($this->customScriptBuilder['view_footer'][$name_single])) - { - $this->customScriptBuilder['view_footer'][$name_single] = ''; + $convert__ = false; } + $this->setCustomScriptBuilder( + $this->_fieldData[$id]->javascript_view_footer, + 'view_footer', + $name_single, + false, + array( + 'table' => 'field', + 'id' => (int) $id, + 'field' => 'javascript_view_footer', + 'type' => 'js', + 'prefix' => PHP_EOL), + $convert__, + $convert__, + true + ); if (!isset($this->_fieldData[$id]->javascript_view_footer_decoded)) { - $this->_fieldData[$id]->javascript_view_footer = $this->setDynamicValues(base64_decode($this->_fieldData[$id]->javascript_view_footer)); $this->_fieldData[$id]->javascript_view_footer_decoded = true; } - $this->customScriptBuilder['view_footer'][$name_single] .= PHP_EOL . $this->_fieldData[$id]->javascript_view_footer; if (strpos($this->_fieldData[$id]->javascript_view_footer, "token") !== false || strpos($this->_fieldData[$id]->javascript_view_footer, "task=ajax") !== false) { @@ -2764,24 +2951,27 @@ class Get // add_css_view if ($this->_fieldData[$id]->add_css_view == 1) { - if (!isset($this->customScriptBuilder['css_view'])) + $convert__ = true; + if (isset($this->_fieldData[$id]->css_view_decoded) + && $this->_fieldData[$id]->css_view_decoded) { - $this->customScriptBuilder['css_view'] = array(); - } - if (!isset($this->customScriptBuilder['css_view'][$name_single])) - { - $this->customScriptBuilder['css_view'][$name_single] = ''; + $convert__ = false; } + $this->setCustomScriptBuilder( + $this->_fieldData[$id]->css_view, + 'css_view', + $name_single, + false, + array('prefix' => PHP_EOL), + $convert__, + $convert__, + true + ); if (!isset($this->_fieldData[$id]->css_view_decoded)) { - $this->_fieldData[$id]->css_view = base64_decode($this->_fieldData[$id]->css_view); - // check for custom code - $this->setCustomCodeData($this->_fieldData[$id]->css_view); $this->_fieldData[$id]->css_view_decoded = true; } - $this->customScriptBuilder['css_view'][$name_single] .= PHP_EOL . $this->_fieldData[$id]->css_view; } - // add this only once to view. $this->customFieldScript[$name_single][$id] = true; } @@ -2791,20 +2981,31 @@ class Get // add_javascript_views_footer if ($this->_fieldData[$id]->add_javascript_views_footer == 1 && ComponentbuilderHelper::checkString($this->_fieldData[$id]->javascript_views_footer)) { - if (!isset($this->customScriptBuilder['views_footer'])) + $convert__ = true; + if (isset($this->_fieldData[$id]->javascript_views_footer_decoded) + && $this->_fieldData[$id]->javascript_views_footer_decoded) { - $this->customScriptBuilder['views_footer'] = array(); - } - if (!isset($this->customScriptBuilder['views_footer'][$name_single])) - { - $this->customScriptBuilder['views_footer'][$name_single] = ''; + $convert__ = false; } + $this->setCustomScriptBuilder( + $this->_fieldData[$id]->javascript_views_footer, + 'views_footer', + $name_single, + false, + array( + 'table' => 'field', + 'id' => (int) $id, + 'field' => 'javascript_views_footer', + 'type' => 'js', + 'prefix' => PHP_EOL), + $convert__, + $convert__, + true + ); if (!isset($this->_fieldData[$id]->javascript_views_footer_decoded)) { - $this->_fieldData[$id]->javascript_views_footer = $this->setDynamicValues(base64_decode($this->_fieldData[$id]->javascript_views_footer)); $this->_fieldData[$id]->javascript_views_footer_decoded = true; } - $this->customScriptBuilder['views_footer'][$name_single] .= PHP_EOL . $this->_fieldData[$id]->javascript_views_footer; if (strpos($this->_fieldData[$id]->javascript_views_footer, "token") !== false || strpos($this->_fieldData[$id]->javascript_views_footer, "task=ajax") !== false) { @@ -2821,22 +3022,26 @@ class Get // add_css_views if ($this->_fieldData[$id]->add_css_views == 1) { - if (!isset($this->customScriptBuilder['css_views'])) + $convert__ = true; + if (isset($this->_fieldData[$id]->css_views_decoded) + && $this->_fieldData[$id]->css_views_decoded) { - $this->customScriptBuilder['css_views'] = array(); - } - if (!isset($this->customScriptBuilder['css_views'][$name_list])) - { - $this->customScriptBuilder['css_views'][$name_list] = ''; + $convert__ = false; } + $this->setCustomScriptBuilder( + $this->_fieldData[$id]->css_views, + 'css_views', + $name_list, + false, + array('prefix' => PHP_EOL), + $convert__, + $convert__, + true + ); if (!isset($this->_fieldData[$id]->css_views_decoded)) { - $this->_fieldData[$id]->css_views = base64_decode($this->_fieldData[$id]->css_views); - // check for custom code - $this->setCustomCodeData($this->_fieldData[$id]->css_views); $this->_fieldData[$id]->css_views_decoded = true; } - $this->customScriptBuilder['css_views'][$name_list] .= PHP_EOL . $this->_fieldData[$id]->css_views; } // add this only once to view. @@ -2926,11 +3131,11 @@ class Get $field['settings']->type_name = 'Custom'; } // set the type name - $type_name = ComponentbuilderHelper::safeString($field['settings']->type_name); + $type_name = ComponentbuilderHelper::safeTypeName($field['settings']->type_name); // if custom (we must use the xml value) - if ($type_name === 'custom' || $type_name === 'customuser') + if (strtolower($type_name) === 'custom' || strtolower($type_name) === 'customuser') { - $type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); + $type = ComponentbuilderHelper::safeTypeName(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); } else { @@ -2942,17 +3147,12 @@ class Get // force the default value if (isset($property['example']) && ComponentbuilderHelper::checkString($property['example'])) { - $type = ComponentbuilderHelper::safeString($property['example']); - } - // fallback on type name set in name field - elseif (ComponentbuilderHelper::checkString($type_name)) - { - $type = $type_name; + $type = ComponentbuilderHelper::safeTypeName($property['example']); } // fall back on the xml settings (not ideal) else { - $type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"')); + $type = ComponentbuilderHelper::safeTypeName(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); } // exit foreach loop break; @@ -2960,11 +3160,15 @@ class Get } } // check if the value is set - if (ComponentbuilderHelper::checkString($type)) + if (isset($type) && ComponentbuilderHelper::checkString($type)) { - // add the value return $type; } + // fallback on type name set in name field (not ideal) + else + { + return $type_name; + } } // fall back to text return 'text'; @@ -2993,7 +3197,7 @@ class Get return 'error'; } // set the type name - $type_name = ComponentbuilderHelper::safeFieldName($field['settings']->type_name); + $type_name = ComponentbuilderHelper::safeTypeName($field['settings']->type_name); // set the name of the field $name = ComponentbuilderHelper::safeFieldName($field['settings']->name); // check that we have the poperties @@ -3160,12 +3364,37 @@ class Get $results = $this->db->loadObjectList(); $typeArray = array(1 => 'LEFT', 2 => 'LEFT OUTER', 3 => 'INNER', 4 => 'RIGHT', 5 => 'RIGHT OUTER'); $operatorArray = array(1 => '=', 2 => '!=', 3 => '<>', 4 => '>', 5 => '<', 6 => '>=', 7 => '<=', 8 => '!<', 9 => '!>', 10 => 'IN', 11 => 'NOT IN'); + $guiMapper = array( 'table' => 'dynamic_get', 'type' => 'php'); foreach ($results as $_nr => &$result) { + // set GUI mapper id + $guiMapper['id'] = (int) $result->id; // add calculations if set if ($result->addcalculation == 1 && ComponentbuilderHelper::checkString($result->php_calculation)) { - $result->php_calculation = $this->setDynamicValues(base64_decode($result->php_calculation)); + // set GUI mapper field + $guiMapper['field'] = 'php_calculation'; + $result->php_calculation = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($result->php_calculation)), + $guiMapper + ); + } + // setup the router parse + if (isset($result->add_php_router_parse) + && $result->add_php_router_parse == 1 + && isset($result->php_router_parse) + && ComponentbuilderHelper::checkString($result->php_router_parse)) + { + // set GUI mapper field + $guiMapper['field'] = 'php_router_parse'; + $result->php_router_parse = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($result->php_router_parse)), + $guiMapper + ); + } + else + { + $result->add_php_router_parse = 0; } // The array of the php scripts that should be added to the script builder $phpSripts = array('php_before_getitem', 'php_after_getitem', 'php_before_getitems', 'php_after_getitems', 'php_getlistquery'); @@ -3178,19 +3407,35 @@ class Get // move all main gets out to the customscript builder if ($result->gettype <= 2) { - if (!isset($this->customScriptBuilder[$this->target . '_' . $script][$view_code])) - { - $this->customScriptBuilder[$this->target . '_' . $script][$view_code] = ''; - } - $this->customScriptBuilder[$this->target . '_' . $script][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->{$script})); + // set GUI mapper field + $guiMapper['field'] = $script; + $guiMapper['prefix'] = PHP_EOL . PHP_EOL; + $this->setCustomScriptBuilder( + $result->{$script}, + $this->target . '_' . $script, + $view_code, + false, + $guiMapper, + true, + true, + true + ); + unset($guiMapper['prefix']); // remove from local item unset($result->{$script}); unset($result->{'add_' . $script}); } else { + // set GUI mapper field + $guiMapper['field'] = $script; + $guiMapper['prefix'] = PHP_EOL; // only for custom gets - $result->{$script} = $this->setDynamicValues(PHP_EOL . base64_decode($result->{$script})); + $result->{$script} = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($result->{$script})), + $guiMapper + ); + unset($guiMapper['prefix']); } } else @@ -3237,8 +3482,13 @@ class Get unset($result->db_selection); break; case 3: + // set GUI mapper field + $guiMapper['field'] = 'php_custom_get'; // get the custom query - $customQueryString = $this->setDynamicValues(base64_decode($result->php_custom_get)); + $customQueryString = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($result->php_custom_get)), + $guiMapper + ); // get the table name $_searchQuery = ComponentbuilderHelper::getBetween($customQueryString, '$query->from(', ')'); if (ComponentbuilderHelper::checkString($_searchQuery) && strpos($_searchQuery, '#__') !== false) @@ -3447,6 +3697,121 @@ class Get return false; } + /** + * set the script for the custom script builder + * + * @param string $script The script + * @param string $first The first key + * @param string $second The second key (if not set we use only first key) + * @param string $third The third key (if not set we use only first and second key) + * @param array $config The config options + * @param bool $base64 The switch to decode base64 the script + * default: true + * @param bool $dynamic The switch to dynamic update the script + * default: true + * @param bool $add The switch to add to exiting instead of replace + * default: false + * + * @return boolean true on success + * + */ + public function setCustomScriptBuilder(&$script, $first, $second = false, $third = false, $config = array(), $base64 = true, $dynamic = true, $add = false) + { + // only load if we have a string + if (!ComponentbuilderHelper::checkString($script)) + { + return false; + } + // this needs refactoring (TODO) + if (!isset($this->customScriptBuilder[$first]) || ($second && !isset($this->customScriptBuilder[$first][$second]))) + { + // check if the script first key is set + if ($second && !isset($this->customScriptBuilder[$first])) + { + $this->customScriptBuilder[$first] = array(); + } + elseif ($add && !$second && !isset($this->customScriptBuilder[$first])) + { + $this->customScriptBuilder[$first] = ''; + } + // check if the script second key is set + if ($second && $third && !isset($this->customScriptBuilder[$first][$second])) + { + $this->customScriptBuilder[$first][$second] = array(); + } + elseif ($add && $second && !$third && !isset($this->customScriptBuilder[$first][$second])) + { + $this->customScriptBuilder[$first][$second] = ''; + } + // check if the script third key is set + if ($add && $second && $third && !isset($this->customScriptBuilder[$first][$second][$third])) + { + $this->customScriptBuilder[$first][$second][$third] = ''; + } + } + // prep the script string + if ($base64 && $dynamic) + { + $script = $this->setDynamicValues(base64_decode($script)); + } + elseif ($base64) + { + $script = base64_decode($script); + } + elseif ($dynamic) // this does not happen (just incase) + { + $script = $this->setDynamicValues($script); + } + // check if we still hava a string + if (ComponentbuilderHelper::checkString($script)) + { + // now load the placeholder snippet if needed + if ($base64 || $dynamic) + { + $script = $this->setGuiCodePlaceholder($script, $config); + } + // load the script + if ($first && $second && $third) + { + // now act on loading option + if ($add) + { + $this->customScriptBuilder[$first][$second][$third] .= $script; + } + else + { + $this->customScriptBuilder[$first][$second][$third] = $script; + } + } + elseif ($first && $second) + { + // now act on loading option + if ($add) + { + $this->customScriptBuilder[$first][$second] .= $script; + } + else + { + $this->customScriptBuilder[$first][$second] = $script; + } + } + else + { + // now act on loading option + if ($add) + { + $this->customScriptBuilder[$first] .= $script; + } + else + { + $this->customScriptBuilder[$first] = $script; + } + } + return true; + } + return false; + } + /** * To limit the SQL Demo date build in the views * @@ -3961,9 +4326,23 @@ class Get $php_view = ''; if ($row->add_php_view == 1 && ComponentbuilderHelper::checkString($row->php_view)) { - $php_view = $this->setDynamicValues(base64_decode($row->php_view)); + $php_view = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($row->php_view)), + array( + 'table' => $table, + 'field' => 'php_view', + 'id' => (int) $row->id, + 'type' => 'php') + ); } - $contnent = $this->setDynamicValues(base64_decode($row->{$table})); + $contnent = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($row->{$table})), + array( + 'table' => $table, + 'field' => $table, + 'id' => (int) $row->id, + 'type' => 'html') + ); // load the library if (!isset($this->libManager[$this->target])) { @@ -4046,7 +4425,27 @@ class Get $this->getModule[$this->target][$view] = true; } } - return array('id' => $row->id, 'html' => $contnent, 'php_view' => $php_view); + return array( + 'id' => $row->id, + 'html' => $this->setGuiCodePlaceholder( + $contnent, + array( + 'table' => $table, + 'field' => $table, + 'id' => $row->id, + 'type' => 'html' + ) + ), + 'php_view' => $this->setGuiCodePlaceholder( + $php_view, + array( + 'table' => $table, + 'field' => 'php_view', + 'id' => $row->id, + 'type' => 'php' + ) + ) + ); } } return false; @@ -4219,7 +4618,14 @@ class Get // set Needed PHP if (isset($library->php_setdocument) && ComponentbuilderHelper::checkString($library->php_setdocument)) { - $library->document = $this->setDynamicValues(base64_decode($library->php_setdocument)); + $library->document = $this->setGuiCodePlaceholder( + $this->setDynamicValues(base64_decode($library->php_setdocument)), + array( + 'table' => 'library', + 'field' => 'php_setdocument', + 'id' => (int) $id, + 'type' => 'php') + ); } } // if this lib is controlled by conditions @@ -5753,6 +6159,330 @@ class Get return false; } + /** + * get the plugins linked to a component + * + * @return void + * + */ + protected function getPlugins($id, &$component) + { + // Create a new query object. + $query = $this->db->getQuery(true); + + $query->select('a.*'); + $query->select( + $this->db->quoteName( + array( + 'g.name', + 'e.name', + 'e.head', + 'e.comment', + 'e.id', + 'f.addfiles', + 'f.addfolders', + 'f.addfilesfullpath', + 'f.addfoldersfullpath', + 'f.addurls', + 'u.version_update', + 'u.id' + ), array( + 'group', + 'extends', + 'class_head', + 'comment', + 'class_id', + 'addfiles', + 'addfolders', + 'addfilesfullpath', + 'addfoldersfullpath', + 'addurls', + 'version_update', + 'version_update_id' + ) + ) + ); + // from these tables + $query->from('#__componentbuilder_joomla_plugin AS a'); + $query->join('LEFT', $this->db->quoteName('#__componentbuilder_joomla_plugin_group', 'g') . ' ON (' . $this->db->quoteName('a.joomla_plugin_group') . ' = ' . $this->db->quoteName('g.id') . ')'); + $query->join('LEFT', $this->db->quoteName('#__componentbuilder_class_extends', 'e') . ' ON (' . $this->db->quoteName('a.class_extends') . ' = ' . $this->db->quoteName('e.id') . ')'); + $query->join('LEFT', $this->db->quoteName('#__componentbuilder_joomla_plugin_updates', 'u') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('u.joomla_plugin') . ')'); + $query->join('LEFT', $this->db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls', 'f') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('f.joomla_plugin') . ')'); + $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); + $query->where($this->db->quoteName('a.published') . ' >= 1'); + $this->db->setQuery($query); + $this->db->execute(); + if ($this->db->getNumRows()) + { + // get the plugin data + $plugin = $this->db->loadObject(); + // tweak system to set stuff to the plugin domain + $_backup_target = $this->target; + $_backup_lang = $this->lang; + $_backup_langPrefix = $this->langPrefix; + // set some keys + $plugin->target_type = 'P|uG!n'; + $plugin->key = $plugin->id . '_' . $plugin->target_type; + // update to point to plugin + $this->target = $plugin->key; + $this->lang = $plugin->key; + // set version if not set + if (empty($plugin->plugin_version)) + { + $plugin->plugin_version = '1.0.0'; + } + // set GUI mapper + $guiMapper = array( 'table' => 'joomla_plugin', 'id' => (int) $id, 'type' => 'php'); + // update the name if it has dynamic values + $plugin->name = $this->setPlaceholders($this->setDynamicValues($plugin->name), $this->placeholders); + // set official name + $plugin->official_name = ucwords($plugin->group . ' - ' . $plugin->name); + // set langPrefix + $this->langPrefix = 'PLG_' . strtoupper($plugin->group) . '_' . strtoupper($plugin->name); + // set lang prefix + $plugin->lang_prefix = $this->langPrefix; + // set plugin class name + $plugin->class_name = 'Plg' . ucfirst($plugin->group) . ucfirst($plugin->name); + // set plugin install class name + $plugin->installer_class_name = 'plg' . ucfirst($plugin->group) . ucfirst($plugin->name) . 'InstallerScript'; + // set plugin folder name + $plugin->folder_name = 'plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name); + // set the zip name + $plugin->zip_name = $plugin->folder_name . '_v' . str_replace('.', '_', $plugin->plugin_version). '__J' . $this->joomlaVersion; + // set plugin file name + $plugin->file_name = strtolower($plugin->name); + // set official_name lang strings + $this->setLangContent($plugin->key, $this->langPrefix, $plugin->official_name); + // set description (TODO) add description field to plugin + if (!isset($plugin->description) || !ComponentbuilderHelper::checkString($plugin->description)) + { + $plugin->description = ''; + } + else + { + $plugin->description = $this->setPlaceholders($this->setDynamicValues($plugin->description), $this->placeholders); + $this->setLangContent($plugin->key, $plugin->lang_prefix . '_DESCRIPTION', $plugin->description); + $plugin->description = '

    ' . $plugin->description . '

    '; + } + $plugin->xml_description = "

    " . $plugin->official_name . " (v." . $plugin->plugin_version . ")

    " . $plugin->description . "

    Created by " . trim(JFilterOutput::cleanText($component->author)) . "
    Development started " . JFactory::getDate($plugin->created)->format("jS F, Y") . "

    "; + // set xml discription + $this->setLangContent($plugin->key, $plugin->lang_prefix . '_XML_DESCRIPTION', $plugin->xml_description); + // update the readme if set + if ($plugin->addreadme == 1 && !empty($plugin->readme)) + { + $plugin->readme = $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->readme)), $this->placeholders); + } + else + { + $plugin->addreadme = 0; + unset($plugin->readme); + } + // open some base64 strings + if (!empty($plugin->main_class_code)) + { + // set GUI mapper field + $guiMapper['field'] = 'main_class_code'; + // base64 Decode main_class_code. + $plugin->main_class_code = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->main_class_code)), $this->placeholders), + $guiMapper + ); + } + // set the head :) + if ($plugin->add_head == 1 && !empty($plugin->head)) + { + // set GUI mapper field + $guiMapper['field'] = 'head'; + // base64 Decode head. + $plugin->head = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->head)), $this->placeholders), + $guiMapper + ); + } + elseif (!empty($plugin->class_head)) + { + // base64 Decode head. + $plugin->head = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->class_head)), $this->placeholders), + array( + 'table' => 'class_extends', + 'field' => 'head', + 'id' => (int) $plugin->class_id, + 'type' => 'php') + ); + } + unset($plugin->class_head); + // set the comment + if (!empty($plugin->comment)) + { + // base64 Decode comment. + $plugin->comment = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->comment)), $this->placeholders), + array( + 'table' => 'class_extends', + 'field' => 'comment', + 'id' => (int) $plugin->class_id, + 'type' => 'php') + ); + } + // set the fields data + $plugin->fields = (isset($plugin->fields) && ComponentbuilderHelper::checkJson($plugin->fields)) ? json_decode($plugin->fields, true) : null; + if (ComponentbuilderHelper::checkArray($plugin->fields)) + { + $key = $plugin->key; + $plugin->config_fields = array_map(function($field) use ($key){ + // make sure the alias and title is 0 + $field['alias'] = 0; + $field['title'] = 0; + // set the field details + $this->setFieldDetails($field, $key); + // set unique name counter + $this->setUniqueNameCounter($field['base_name'], $key); + // return field + return $field; + }, array_values($plugin->fields)); + + // do some house cleaning (for fields) + foreach ($plugin->config_fields as $field) + { + // so first we lock the field name in + $this->getFieldName($field, $plugin->key); + } + // unset original value + unset($plugin->fields); + } + // set the add targets + $addArray = array('files' => 'files', 'folders' => 'folders', 'urls' => 'urls', 'filesfullpath' => 'files', 'foldersfullpath' => 'folders'); + foreach ($addArray as $addTarget => $targetHere) + { + // set the add target data + $plugin->{'add' . $addTarget} = (isset($plugin->{'add' . $addTarget}) && ComponentbuilderHelper::checkJson($plugin->{'add' . $addTarget})) ? json_decode($plugin->{'add' . $addTarget}, true) : null; + if (ComponentbuilderHelper::checkArray($plugin->{'add' . $addTarget})) + { + if (isset($plugin->{$targetHere}) && ComponentbuilderHelper::checkArray($plugin->{$targetHere})) + { + foreach ($plugin->{'add' . $addTarget} as $taget) + { + $plugin->{$targetHere}[] = $taget; + } + } + else + { + $plugin->{$targetHere} = array_values($plugin->{'add' . $addTarget}); + } + } + unset($plugin->{'add' . $addTarget}); + } + // add PHP in plugin install + $plugin->add_install_script = false; + $addScriptMethods = array('php_preflight', 'php_postflight', 'php_method'); + $addScriptTypes = array('install', 'update', 'uninstall'); + foreach ($addScriptMethods as $scriptMethod) + { + foreach ($addScriptTypes as $scriptType) + { + if (isset($plugin->{'add_' . $scriptMethod . '_' . $scriptType}) && $plugin->{'add_' . $scriptMethod . '_' . $scriptType} == 1 && ComponentbuilderHelper::checkString($plugin->{$scriptMethod . '_' . $scriptType})) + { + // set GUI mapper field + $guiMapper['field'] = $scriptMethod . '_' . $scriptType; + $plugin->{$scriptMethod . '_' . $scriptType} = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->{$scriptMethod . '_' . $scriptType})), $this->placeholders), + $guiMapper + ); + $plugin->add_install_script = true; + } + else + { + unset($plugin->{$scriptMethod . '_' . $scriptType}); + $plugin->{'add_' . $scriptMethod . '_' . $scriptType} = 0; + } + } + } + // add_sql + if ($plugin->add_sql == 1 && ComponentbuilderHelper::checkString($plugin->sql)) + { + $plugin->sql = $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->sql)), $this->placeholders); + } + else + { + unset($plugin->sql); + $plugin->add_sql = 0; + } + // add_sql_uninstall + if ($plugin->add_sql_uninstall == 1 && ComponentbuilderHelper::checkString($plugin->sql_uninstall)) + { + $plugin->sql_uninstall = $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->sql_uninstall)), $this->placeholders); + } + else + { + unset($plugin->sql_uninstall); + $plugin->add_sql_uninstall = 0; + } + // update the URL of the update_server if set + if ($plugin->add_update_server == 1 && ComponentbuilderHelper::checkString($plugin->update_server_url)) + { + $plugin->update_server_url = $this->setPlaceholders($this->setDynamicValues($plugin->update_server_url), $this->placeholders); + } + // add the update/sales server FTP details if that is the expected protocol + $serverArray = array('update_server', 'sales_server'); + foreach ($serverArray as $server) + { + if ($plugin->{'add_' . $server} == 1 && is_numeric($plugin->{$server}) && $plugin->{$server} > 0) + { + // get the server protocol + $plugin->{$server . '_protocol'} = ComponentbuilderHelper::getVar('server', (int) $plugin->{$server}, 'id', 'protocol'); + } + else + { + $plugin->{$server} = 0; + // only change this for sales server (update server can be added loacaly to the zip file) + if ('sales_server' === $server) + { + $plugin->{'add_' . $server} = 0; + } + $plugin->{$server . '_protocol'} = 0; + } + } + // set the update server stuff (TODO) + // update_server_xml_path + // update_server_xml_file_name + + // rest globals + $this->target = $_backup_target; + $this->lang = $_backup_lang; + $this->langPrefix = $_backup_langPrefix; + + return $plugin; + } + return false; + } + + /** + * get the plugin xml template + * + * @return string + * + */ + public function getPluginXMLTemplate(&$plugin) + { + $xml = ''; + $xml .= PHP_EOL . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $plugin->lang_prefix . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'BUILDDATE' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'AUTHOR' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'AUTHOREMAIL' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'AUTHORWEBSITE' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'COPYRIGHT' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'LICENSE' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $plugin->plugin_version . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $plugin->lang_prefix . '_XML_DESCRIPTION'; + $xml .= $this->hhh . 'MAINXML' . $this->hhh; + $xml .= PHP_EOL . ''; + $dates = array(); + + return $xml; + } + /** * check if we already have these ids in local memory * @@ -5866,11 +6596,14 @@ class Get $counter = array(1 => 0, 2 => 0); // file types to get $fileTypes = array('\.php', '\.js', '\.xml'); + // set some local placeholders - $placeholders = array(); + $placeholders = array_flip($this->globalPlaceholders); $placeholders[ComponentbuilderHelper::safeString($this->componentCodeName, 'F') . 'Helper::'] = $this->bbb . 'Component' . $this->ddd . 'Helper::'; $placeholders['COM_' . ComponentbuilderHelper::safeString($this->componentCodeName, 'U')] = 'COM_' . $this->bbb . 'COMPONENT' . $this->ddd; $placeholders['com_' . $this->componentCodeName] = 'com_' . $this->bbb . 'component' . $this->ddd; + // putt the last first + $placeholders = array_reverse($placeholders, true); foreach ($paths as $target => $path) { @@ -5928,6 +6661,8 @@ class Get */ protected function searchFileContent(&$counter, &$file, &$target, &$searchArray, &$placeholders, &$today) { + // we add a new search for the GUI CODE Blocks + $this->guiCodeSearch($file, $placeholders, $today); // reset each time per file $loadEndFingerPrint = false; $endFingerPrint = array(); @@ -6197,6 +6932,140 @@ class Get } } + /** + * Set the JCB GUI code placeholder + * + * @param string $string The code string + * @param array $config The placeholder config values + * + * @return void + * + */ + public function setGuiCodePlaceholder($string, $config) + { + if (ComponentbuilderHelper::checkString($string)) + { + if ($this->addPlaceholders && $this->canAddGuiCodePlaceholder($string) + && ComponentbuilderHelper::checkArray($config) + && isset($config['table']) && ComponentbuilderHelper::checkString($config['table']) + && isset($config['field']) && ComponentbuilderHelper::checkString($config['field']) + && isset($config['type']) && ComponentbuilderHelper::checkString($config['type']) + && isset($config['id']) && is_numeric($config['id'])) + { + // if we have a key we must get the ID + if (isset($config['key']) && ComponentbuilderHelper::checkString($config['key']) && $config['key'] !== 'id') + { + if (($id = ComponentbuilderHelper::getVar($config['table'], $config['id'], $config['key'], 'id')) !== false && is_numeric($id)) + { + $config['id'] = $id; + } + else + { + // we must give a error message to inform the user of this issue. (should never happen) + $this->app->enqueueMessage(JText::sprintf('ID mismatch was detected with the %s.%s.%s.%s GUI code field. So the placeholder was not set.', $config['table'], $config['field'], $config['key'], $config['id']), 'Error'); + // check some config + if (!isset($config['prefix'])) + { + $config['prefix'] = ''; + } + return $config['prefix'] . $string; + } + } + // check some config + if (!isset($config['prefix'])) + { + $config['prefix'] = PHP_EOL; + } + // add placheolder based on type of code + switch (strtolower($config['type'])) + { + // adding with html commenting + case 'html': + $front = $config['prefix'] . '' . PHP_EOL; + $back = ''); + + if (($guiCode = ComponentbuilderHelper::mergeArrays($guiCode)) !== false && ComponentbuilderHelper::checkArray($guiCode, true)) + { + foreach ($guiCode as $code) + { + $first_line = strtok($code, PHP_EOL); + // get the GUI target details + $target = explode('.', trim($first_line, '.')); + // cleanup the newlines around the code + $code = trim(str_replace($first_line, '', $code), PHP_EOL) . PHP_EOL; + // reverse placeholder as much as we can + $code = $this->reversePlaceholders($code, $placeholders, $target[2], $target[1], $target[0]); + // update the GUI/Tables/Database + $object = new stdClass(); + $object->id = (int) $target[2]; + $object->{$target[1]} = base64_encode($code); // (TODO) this may not always work... + // update the value in GUI + $this->db->updateObject('#__componentbuilder_' . (string) $target[0], $object, 'id'); + } + } + } + /** * Check if this line should be added * @@ -6293,16 +7162,18 @@ class Get * Reverse Engineer the dynamic placeholders (TODO hmmmm this is not ideal) * * @param string $string The string to revers - * @param int $id The custom code id * @param array $placeholders The values to search for + * @param int $id The custom code id + * @param string $field The field name + * @param string $table The table name * * @return string * */ - protected function reversePlaceholders($string, &$placeholders, $id = null) + protected function reversePlaceholders($string, &$placeholders, $id = null, $field = 'code', $table = 'custom_code') { // get local code if set - if ($id > 0 && $code = base64_decode(ComponentbuilderHelper::getVar('custom_code', $id, 'id', 'code'))) + if ($id > 0 && $code = base64_decode(ComponentbuilderHelper::getVar($table, $id, 'id', $field))) { $string = $this->setReverseLangPlaceholders($string, $code); } @@ -6539,6 +7410,8 @@ class Get $localPaths['site'] = JPATH_ROOT . '/components/com_' . $this->componentCodeName; // TODO later to include the JS and CSS $localPaths['media'] = JPATH_ROOT . '/media/com_' . $this->componentCodeName; + // TODO plugin paths (just those linked to this component) + // $localPaths['plugin'] = JPATH_ROOT . '/plugins'; // check if the local install is found foreach ($localPaths as $key => $localPath) { diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index d8ef5e2ef..7519a0d6d 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -200,13 +200,6 @@ class Structure extends Get */ public $projectMonthTime = 0; - /** - * The Joomla Version - * - * @var string - */ - public $joomlaVersion; - /** * The template path * @@ -242,6 +235,13 @@ class Structure extends Get */ public $stdFolders = array('site', 'admin', 'media'); + /** + * The standard root files + * + * @var array + */ + public $stdRootFiles = array('access.xml', 'config.xml', 'controller.php', 'index.html', 'README.txt'); + /** * Dynamic File Content * @@ -277,6 +277,13 @@ class Structure extends Get */ public $componentPath; + /** + * The Dynamic paths + * + * @var array + */ + public $dynamicPaths = array(); + /** * The not new static items * @@ -334,6 +341,8 @@ class Structure extends Get // first we run the perent constructor if (parent::__construct($config)) { + // set the standard admin file + $this->stdRootFiles[] = $this->componentData->name_code . '.php'; // set incase no extra admin folder are loaded $this->fileContentStatic[$this->hhh . 'EXSTRA_ADMIN_FOLDERS' . $this->hhh] = ''; // set incase no extra site folder are loaded @@ -348,15 +357,12 @@ class Structure extends Get $this->fileContentStatic[$this->hhh . 'EXSTRA_MEDIA_FILES' . $this->hhh] = ''; // run global updater ComponentbuilderHelper::runGlobalUpdater(); - // set the Joomla version - $this->joomlaVersion = $config['version']; // set the template path $this->templatePath = $this->compilerPath . '/joomla_' . $config['version']; // set some default names $this->componentSalesName = 'com_' . $this->componentData->sales_name . '__J' . $this->joomlaVersion; $this->componentBackupName = 'com_' . $this->componentData->sales_name . '_v' . str_replace('.', '_', $this->componentData->component_version) . '__J' . $this->joomlaVersion; $this->componentFolderName = 'com_' . $this->componentData->name_code . '_v' . str_replace('.', '_', $this->componentData->component_version) . '__J' . $this->joomlaVersion; - // set component folder path $this->componentPath = $this->compilerPath . '/' . $this->componentFolderName; // set the template path for custom @@ -364,7 +370,9 @@ class Structure extends Get // make sure there is no old build $this->removeFolder($this->componentPath); // load the libraries files/folders and url's - $this->setLibaries(); + $this->setLibraries(); + // load the plugin files/folders and url's + $this->setPlugins(); // set the Joomla Version Data $this->joomlaVersionData = $this->setJoomlaVersionData(); // Trigger Event: jcb_ce_onAfterSetJoomlaVersionData @@ -408,18 +416,214 @@ class Structure extends Get return ''; } + /** + * Build the Plugins files, folders, url's and config + * + * @return void + * + */ + private function setPlugins() + { + if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins)) + { + // Trigger Event: jcb_ce_onBeforeSetPlugins + $this->triggerEvent('jcb_ce_onBeforeSetPlugins', array(&$this->componentContext, &$this->componentData->joomla_plugins)); + foreach ($this->componentData->joomla_plugins as $plugin) + { + if (ComponentbuilderHelper::checkObject($plugin) && isset($plugin->folder_name) + && ComponentbuilderHelper::checkString($plugin->folder_name)) + { + // plugin path + $plugin->folder_path = $this->compilerPath . '/' . $plugin->folder_name; + // set the plugin paths + $this->dynamicPaths[$plugin->key] = $plugin->folder_path; + // make sure there is no old build + $this->removeFolder($plugin->folder_path); + // creat the main component folder + if (!JFolder::exists($plugin->folder_path)) + { + JFolder::create($plugin->folder_path); + // count the folder created + $this->folderCount++; + $this->indexHTML($plugin->folder_name, $this->compilerPath); + } + // set main class file + $fileDetails = array('path' => $plugin->folder_path . '/' . $plugin->file_name . '.php', + 'name' => $plugin->file_name . '.php', 'zip' => $plugin->file_name . '.php'); + $this->writeFile($fileDetails['path'], + 'hhh . 'BOM' . $this->hhh . PHP_EOL . + PHP_EOL . '// No direct access to this file' . PHP_EOL . + "defined('_JEXEC') or die('Restricted access');" . PHP_EOL . + $this->hhh . 'MAINCLASS' . $this->hhh); + $this->newFiles[$plugin->key][] = $fileDetails; + // count the file created + $this->fileCount++; + // set main xml file + $fileDetails = array('path' => $plugin->folder_path . '/' . $plugin->file_name . '.xml', + 'name' => $plugin->file_name . '.xml', 'zip' => $plugin->file_name . '.xml'); + $this->writeFile($fileDetails['path'], $this->getPluginXMLTemplate($plugin)); + $this->newFiles[$plugin->key][] = $fileDetails; + // count the file created + $this->fileCount++; + // set install script if needed + if ($plugin->add_install_script) + { + $fileDetails = array('path' => $plugin->folder_path . '/script.php', + 'name' => 'script.php', 'zip' => 'script.php'); + $this->writeFile($fileDetails['path'], + 'hhh . 'BOM' . $this->hhh . PHP_EOL . + PHP_EOL . '// No direct access to this file' . PHP_EOL . + "defined('_JEXEC') or die('Restricted access');" . PHP_EOL . + $this->hhh . 'INSTALLCLASS' . $this->hhh); + $this->newFiles[$plugin->key][] = $fileDetails; + // count the file created + $this->fileCount++; + } + // set readme if found + if ($plugin->addreadme) + { + $fileDetails = array('path' => $plugin->folder_path . '/README.md', + 'name' => 'README.md', 'zip' => 'README.md'); + $this->writeFile($fileDetails['path'], $plugin->readme); + $this->newFiles[$plugin->key][] = $fileDetails; + // count the file created + $this->fileCount++; + } + // set SQL stuff if needed + if ($plugin->add_sql || $plugin->add_sql_uninstall) + { + // create SQL folder + if (!JFolder::exists($plugin->folder_path . '/sql')) + { + JFolder::create($plugin->folder_path . '/sql'); + // count the folder created + $this->folderCount++; + $this->indexHTML($plugin->folder_name . '/sql', $this->compilerPath); + } + // create mysql folder + if (!JFolder::exists($plugin->folder_path . '/sql/mysql')) + { + JFolder::create($plugin->folder_path . '/sql/mysql'); + // count the folder created + $this->folderCount++; + $this->indexHTML($plugin->folder_name . '/sql/mysql', $this->compilerPath); + } + // now set the install file + if ($plugin->add_sql) + { + $this->writeFile($plugin->folder_path . '/sql/mysql/install.sql', $plugin->sql); + // count the file created + $this->fileCount++; + } + // now set the uninstall file + if ($plugin->add_sql_uninstall) + { + $this->writeFile($plugin->folder_path . '/sql/mysql/uninstall.sql', $plugin->sql_uninstall); + // count the file created + $this->fileCount++; + } + } + // creat the language folder + if (!JFolder::exists($plugin->folder_path . '/language')) + { + JFolder::create($plugin->folder_path . '/language'); + // count the folder created + $this->folderCount++; + // also the lang tag + if (!JFolder::exists($plugin->folder_path . '/language/' . $this->langTag)) + { + JFolder::create($plugin->folder_path . '/language/' . $this->langTag); + // count the folder created + $this->folderCount++; + } + } + // check if this lib has files + if (isset($plugin->files) && ComponentbuilderHelper::checkArray($plugin->files)) + { + // add to component files + foreach ($plugin->files as $file) + { + // set the path finder + $file['target_type'] = $plugin->target_type; + $file['target_id'] = $plugin->id; + $this->componentData->files[] = $file; + } + } + // check if this lib has folders + if (isset($plugin->folders) && ComponentbuilderHelper::checkArray($plugin->folders)) + { + // add to component folders + foreach ($plugin->folders as $folder) + { + // set the path finder + $folder['target_type'] = $plugin->target_type; + $folder['target_id'] = $plugin->id; + $this->componentData->folders[] = $folder; + } + } + // check if this plugin has urls + if (isset($plugin->urls) && ComponentbuilderHelper::checkArray($plugin->urls)) + { + // add to component urls + foreach ($plugin->urls as $n => &$url) + { + // should we add the local folder + if (isset($url['type']) && $url['type'] > 1 && isset($url['url']) + && ComponentbuilderHelper::checkString($url['url'])) + { + // set file name + $fileName = basename($url['url']); + // get the file contents + $data = ComponentbuilderHelper::getFileContents($url['url']); + // build sub path + if (strpos($fileName, '.js') !== false) + { + $path = '/js'; + } + elseif (strpos($fileName, '.css') !== false) + { + $path = '/css'; + } + else + { + $path = ''; + } + // create sub media path if not set + if (!JFolder::exists($plugin->folder_path .$path)) + { + JFolder::create($plugin->folder_path . $path); + // count the folder created + $this->folderCount++; + $this->indexHTML($plugin->folder_name . $path, $this->compilerPath); + } + // set the path to plugin file + $url['path'] = $plugin->folder_path . $path . '/' . $fileName; // we need this for later + // write data to path + $this->writeFile($url['path'], $data); + // count the file created + $this->fileCount++; + } + } + } + } + } + } + } + /** * Build the Libraries files, folders, url's and config * * @return void * */ - private function setLibaries() + private function setLibraries() { if (ComponentbuilderHelper::checkArray($this->libraries)) { - // Trigger Event: jcb_ce_onBeforeSetLibaries - $this->triggerEvent('jcb_ce_onBeforeSetLibaries', array(&$this->componentContext, &$this->libraries)); + // Trigger Event: jcb_ce_onBeforeSetLibraries + $this->triggerEvent('jcb_ce_onBeforeSetLibraries', array(&$this->componentContext, &$this->libraries)); // creat the main component folder if (!JFolder::exists($this->componentPath)) { @@ -519,7 +723,7 @@ class Structure extends Get // only add if local if ($addLocalFolder) { - // add folder to ml of media folders + // add folder to xml of media folders $this->fileContentStatic[$this->hhh . 'EXSTRA_MEDIA_FOLDERS' . $this->hhh] .= PHP_EOL . $this->_t(2) . "" . $libFolder . ""; } } @@ -828,9 +1032,19 @@ class Structure extends Get { continue; } - // set destination path - $zipPath = str_replace('c0mp0n3nt/', '', $details->path); - $path = str_replace('c0mp0n3nt/', $this->componentPath . '/', $details->path); + // check if we have a target value + if (isset($details->_target)) + { + // set destination path + $zipPath = str_replace($details->_target['type'] . '/', '', $details->path); + $path = str_replace($details->_target['type'] . '/', $this->dynamicPaths[$details->_target['key']] . '/', $details->path); + } + else + { + // set destination path + $zipPath = str_replace('c0mp0n3nt/', '', $details->path); + $path = str_replace('c0mp0n3nt/', $this->componentPath . '/', $details->path); + } // set the template folder path $templatePath = (isset($details->custom) && $details->custom) ? (($details->custom !== 'full') ? $this->templatePathCustom . '/' : '') : $this->templatePath . '/'; // set the final paths @@ -862,7 +1076,14 @@ class Structure extends Get // store the new files if (!in_array($ftem, $this->notNew)) { - $this->newFiles['static'][] = array('path' => $packageFullPath, 'name' => $new, 'zip' => $zipFullPath); + if (isset($details->_target)) + { + $this->newFiles[$details->_target['key']][] = array('path' => $packageFullPath, 'name' => $new, 'zip' => $zipFullPath); + } + else + { + $this->newFiles['static'][] = array('path' => $packageFullPath, 'name' => $new, 'zip' => $zipFullPath); + } } // ensure we update this file if needed if (isset($this->updateFileContent[$ftem]) && $this->updateFileContent[$ftem]) @@ -889,40 +1110,59 @@ class Structure extends Get $this->folderCount++; } } - // check if we should add the dynamic folder moving script to the installer script - $checker = array_values((array) explode('/', $zipFullPath)); - // TODO <-- this may not be the best way, will keep an eye on this. - // We basicly only want to check if a folder is added that is not in the stdFolders array - if (isset($checker[0]) && ComponentbuilderHelper::checkString($checker[0]) && !in_array($checker[0], $this->stdFolders)) + // only add if no target found since those belong to plugins and modules + if (!isset($details->_target)) { // check if we should add the dynamic folder moving script to the installer script - if (!$this->setMoveFolders) + $checker = array_values((array) explode('/', $zipFullPath)); + // TODO <-- this may not be the best way, will keep an eye on this. + // We basicly only want to check if a folder is added that is not in the stdFolders array + if (isset($checker[0]) && ComponentbuilderHelper::checkString($checker[0]) + && !in_array($checker[0], $this->stdFolders)) { - // add the setDynamicF0ld3rs() method to the install scipt.php file - $this->setMoveFolders = true; - // set message that this was done (will still add a tutorial link later) - $this->app->enqueueMessage(JText::_('

    Dynamic folder/s were detected.

    '), 'Notice'); - $this->app->enqueueMessage(JText::sprintf('A method (setDynamicF0ld3rs) was added to the install script.php of this package to insure that the folder/s are copied into the correct place when this componet is installed!'), 'Notice'); + // check if we should add the dynamic folder moving script to the installer script + if (!$this->setMoveFolders) + { + // add the setDynamicF0ld3rs() method to the install scipt.php file + $this->setMoveFolders = true; + // set message that this was done (will still add a tutorial link later) + $this->app->enqueueMessage(JText::_('

    Dynamic folder/s were detected.

    '), 'Notice'); + $this->app->enqueueMessage(JText::sprintf('A method (setDynamicF0ld3rs) was added to the install script.php of this package to insure that the folder/s are copied into the correct place when this componet is installed!'), 'Notice'); + } } - } - elseif (count($checker) == 2 && ComponentbuilderHelper::checkString($checker[0]) && in_array($checker[0], $this->stdFolders)) - { - // set the target - $eNAME = 'FILES'; - $ename = 'filename'; - if ($details->type === 'folder') + elseif (count($checker) == 2 && ComponentbuilderHelper::checkString($checker[0])) { - $eNAME = 'FOLDERS'; - $ename = 'folder'; + $add_to_extra = false; + // set the target + $eNAME = 'FILES'; + $ename = 'filename'; + // this should not happen and must have been caught by the above if statment + if ($details->type === 'folder') + { + // only folders outside the standard folder are added + $eNAME = 'FOLDERS'; + $ename = 'folder'; + $add_to_extra = true; + } + // if this is a file, it can only be added to the admin/site/media folders + // all other folders are moved as a whole so their files do not need to be declared + elseif (in_array($checker[0], $this->stdFolders) && !in_array($checker[1], $this->stdRootFiles)) + { + $add_to_extra = true; + } + // add if valid folder/file + if ($add_to_extra) + { + // set the tab + $eTab = $this->_t(2); + if ('admin' === $checker[0]) + { + $eTab = $this->_t(3); + } + // set the xml file + $this->fileContentStatic[$this->hhh . 'EXSTRA_' . ComponentbuilderHelper::safeString($checker[0], 'U') . '_' . $eNAME . $this->hhh] .= PHP_EOL . $eTab . "<" . $ename . ">" . $checker[1] . ""; + } } - // set the tab - $eTab = $this->_t(2); - if ('admin' === $checker[0]) - { - $eTab = $this->_t(3); - } - // set the xml file - $this->fileContentStatic[$this->hhh . 'EXSTRA_' . ComponentbuilderHelper::safeString($checker[0], 'U') . '_' . $eNAME . $this->hhh] .= PHP_EOL . $eTab . "<" . $ename . ">" . $checker[1] . ""; } } return true; @@ -1297,6 +1537,12 @@ class Structure extends Get $pointer_tracker = 'h'; foreach ($this->componentData->folders as $custom) { + // check type of target type + $_target_type = 'c0mp0n3nt'; + if (isset($custom['target_type'])) + { + $_target_type = $custom['target_type']; + } // for good practice ComponentbuilderHelper::fixPath($custom, array('path', 'folder', 'folderpath')); // fix custom path @@ -1353,11 +1599,16 @@ class Structure extends Get // set new folder to object $versionData->move->static->{$key_pointer} = new stdClass(); $versionData->move->static->{$key_pointer}->naam = str_replace('//','/', $custom['folder']); - $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; + $versionData->move->static->{$key_pointer}->path = $_target_type. '/' . $custom['path']; $versionData->move->static->{$key_pointer}->rename = $rename; $versionData->move->static->{$key_pointer}->newName = $newname; $versionData->move->static->{$key_pointer}->type = 'folder'; $versionData->move->static->{$key_pointer}->custom = $customPath; + // set the target if type and id is found + if (isset($custom['target_id']) && isset($custom['target_type'])) + { + $versionData->move->static->{$key_pointer}->_target = array('key' => $custom['target_id'] . '_' . $custom['target_type'], 'type' => $custom['target_type']); + } } unset($this->componentData->folders); unset($custom); @@ -1384,6 +1635,12 @@ class Structure extends Get $pointer_tracker = 'h'; foreach ($this->componentData->files as $custom) { + // check type of target type + $_target_type = 'c0mp0n3nt'; + if (isset($custom['target_type'])) + { + $_target_type = $custom['target_type']; + } // for good practice ComponentbuilderHelper::fixPath($custom, array('path', 'file', 'filepath')); // by default custom path is true @@ -1402,7 +1659,7 @@ class Structure extends Get // triget fullpath $customPath = 'full'; } - // make we have not duplicates + // make sure we have not duplicates $key_pointer = ComponentbuilderHelper::safeString($custom['file']) . '_g' . $pointer_tracker; $pointer_tracker++; // set new file to object @@ -1416,7 +1673,7 @@ class Structure extends Get { $pathInfo['dirname'] = trim($pathInfo['dirname'], '/'); // set the info - $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $pathInfo['dirname']; + $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $pathInfo['dirname']; $versionData->move->static->{$key_pointer}->rename = 'new'; $versionData->move->static->{$key_pointer}->newName = $pathInfo['basename']; } @@ -1427,7 +1684,7 @@ class Structure extends Get // get file array $fileArray = (array) explode('/', $custom['file']); // set the info - $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; + $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path']; $versionData->move->static->{$key_pointer}->rename = 'new'; $versionData->move->static->{$key_pointer}->newName = end($fileArray); } @@ -1436,11 +1693,16 @@ class Structure extends Get // fix custom path $custom['path'] = ltrim($custom['path'], '/'); // set the info - $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; + $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path']; $versionData->move->static->{$key_pointer}->rename = false; } $versionData->move->static->{$key_pointer}->type = 'file'; $versionData->move->static->{$key_pointer}->custom = $customPath; + // set the target if type and id is found + if (isset($custom['target_id']) && isset($custom['target_type'])) + { + $versionData->move->static->{$key_pointer}->_target = array('key' => $custom['target_id'] . '_' . $custom['target_type'], 'type' => $custom['target_type']); + } // check if file should be updated if (!isset($custom['notnew']) || $custom['notnew'] == 0 || $custom['notnew'] != 1) { @@ -1466,17 +1728,22 @@ class Structure extends Get * @return void * */ - private function indexHTML($path) + private function indexHTML($path, $root = 'component') { + if ('component' === $root) + { + $root = $this->componentPath; + } + // use path if exist if (strlen($path) > 0) { - JFile::copy($this->templatePath . '/index.html', $this->componentPath . '/' . $path . '/index.html'); + JFile::copy($this->templatePath . '/index.html', $root . '/' . $path . '/index.html'); // count the file created $this->fileCount++; } else { - JFile::copy($this->templatePath . '/index.html', $this->componentPath . '/index.html'); + JFile::copy($this->templatePath . '/index.html', $root . '/index.html'); // count the file created $this->fileCount++; } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 4eb73f5cd..d3a3eb53c 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -1089,16 +1089,6 @@ class Fields extends Structure $this->setBuilders($langLabel, $langView, $view_name_single, $view_name_list, $name, $view, $field, $typeName, $multiple, false, $optionArray); } } - elseif (ComponentbuilderHelper::fieldCheck($typeName, 'plain')) - { - if ($build) - { - // set builders - $this->setBuilders($langLabel, $langView, $view_name_single, $view_name_list, $name, $view, $field, $typeName, $multiple); - } - // now add to the field set - $dynamicField = $this->setField('plain', $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray); - } elseif (ComponentbuilderHelper::fieldCheck($typeName, 'spacer')) { if ($build) @@ -1133,7 +1123,7 @@ class Fields extends Structure $dynamicField = $this->setField('special', $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray); } } - elseif (ComponentbuilderHelper::checkArray($fieldAttributes['custom'])) + elseif (isset($fieldAttributes['custom']) && ComponentbuilderHelper::checkArray($fieldAttributes['custom'])) { // set the custom array $custom = $fieldAttributes['custom']; @@ -1150,6 +1140,16 @@ class Fields extends Structure // now add to the field set $dynamicField = $this->setField('custom', $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray, $custom); } + else + { + if ($build) + { + // set builders + $this->setBuilders($langLabel, $langView, $view_name_single, $view_name_list, $name, $view, $field, $typeName, $multiple); + } + // now add to the field set + $dynamicField = $this->setField('plain', $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray); + } } } return $dynamicField; @@ -1226,7 +1226,102 @@ class Fields extends Structure elseif ($property === 'option') { $optionSet = ''; - if (strpos($value, ',') !== false) + if (strtolower($typeName) === 'groupedlist' && strpos($value, ',') !== false && strpos($value, '@@') !== false) + { + // reset the group temp arrays + $groups_ = array(); + $grouped_ = array('group' => array(), 'option' => array()); + $order_ = array(); + // mulitpal options + $options = explode(',', $value); + foreach ($options as $option) + { + if (strpos($option, '@@') !== false) + { + // set the group label + $valueKeyArray = explode('@@', $option); + if (count((array) $valueKeyArray) == 2) + { + $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($valueKeyArray[0], true); + // add to lang array + $this->setLangContent($this->lang, $langValue, $valueKeyArray[0]); + // now add group label + $groups_[$valueKeyArray[1]] = PHP_EOL . $this->_t(1) . $taber . $this->_t(2) . ''; + // set order + $order_['group' . $valueKeyArray[1]] = $valueKeyArray[1]; + } + } + elseif (strpos($option, '|') !== false) + { + // has other value then text + $valueKeyArray = explode('|', $option); + if (count((array) $valueKeyArray) == 3) + { + $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($valueKeyArray[1], true); + // add to lang array + $this->setLangContent($this->lang, $langValue, $valueKeyArray[1]); + // now add to option set + $grouped_['group'][$valueKeyArray[2]][] = PHP_EOL . $this->_t(1) . $taber . $this->_t(3) . ''; + $optionArray[$valueKeyArray[0]] = $langValue; + // set order + $order_['group' . $valueKeyArray[2]] = $valueKeyArray[2]; + } + else + { + $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($valueKeyArray[1], true); + // add to lang array + $this->setLangContent($this->lang, $langValue, $valueKeyArray[1]); + // now add to option set + $grouped_['option'][$valueKeyArray[0]] = PHP_EOL . $this->_t(1) . $taber . $this->_t(2) . ''; + $optionArray[$valueKeyArray[0]] = $langValue; + // set order + $order_['option' . $valueKeyArray[0]] = $valueKeyArray[0]; + } + } + else + { + // text is also the value + $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($option, true); + // add to lang array + $this->setLangContent($this->lang, $langValue, $option); + // now add to option set + $grouped_['option'][$option] = PHP_EOL . $this->_t(1) . $taber . $this->_t(2) . ''; + $optionArray[$option] = $langValue; + // set order + $order_['option' . $option] = $option; + } + } + // now build the groups + foreach ($order_ as $pointer_ => $_id) + { + // load the default key + $key_ = 'group'; + if (strpos($pointer_, 'option') !== false) + { + // load the option field + $key_ = 'option'; + } + // check if this is a group loader + if ('group' === $key_ && isset($groups_[$_id]) && isset($grouped_[$key_][$_id]) && ComponentbuilderHelper::checkArray($grouped_[$key_][$_id])) + { + // set group label + $optionSet .= $groups_[$_id]; + foreach ($grouped_[$key_][$_id] as $option_) + { + $optionSet .= $option_; + } + unset($groups_[$_id]); + unset($grouped_[$key_][$_id]); + // close the group + $optionSet .= PHP_EOL . $this->_t(1) . $taber . $this->_t(2) . ''; + } + elseif (isset($grouped_[$key_][$_id]) && ComponentbuilderHelper::checkString($grouped_[$key_][$_id])) + { + $optionSet .= $grouped_[$key_][$_id]; + } + } + } + elseif (strpos($value, ',') !== false) { // mulitpal options $options = explode(',', $value); @@ -1239,7 +1334,7 @@ class Fields extends Structure $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($t, true); // add to lang array $this->setLangContent($this->lang, $langValue, $t); - // no add to option set + // now add to option set $optionSet .= PHP_EOL . $this->_t(1) . $taber . $this->_t(2) . ''; $optionArray[$v] = $langValue; } @@ -1249,7 +1344,7 @@ class Fields extends Structure $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($option, true); // add to lang array $this->setLangContent($this->lang, $langValue, $option); - // no add to option set + // now add to option set $optionSet .= PHP_EOL . $this->_t(2) . $taber . $this->_t(1) . ''; $optionArray[$option] = $langValue; } @@ -1265,7 +1360,7 @@ class Fields extends Structure $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($t, true); // add to lang array $this->setLangContent($this->lang, $langValue, $t); - // no add to option set + // now add to option set $optionSet .= PHP_EOL . $this->_t(2) . $taber . $this->_t(1) . ''; $optionArray[$v] = $langValue; } @@ -1275,7 +1370,7 @@ class Fields extends Structure $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($value, true); // add to lang array $this->setLangContent($this->lang, $langValue, $value); - // no add to option set + // now add to option set $optionSet .= PHP_EOL . $this->_t(2) . $taber . $this->_t(1) . ''; $optionArray[$value] = $langValue; } @@ -1399,12 +1494,7 @@ class Fields extends Structure // now add to the field set $field .= $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber); } - elseif (ComponentbuilderHelper::fieldCheck($r_typeName, 'plain')) - { - // now add to the field set - $field .= $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber); - } - elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) + elseif (isset($r_fieldValues['custom']) && ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) { // add to custom $custom = $r_fieldValues['custom']; @@ -1425,6 +1515,11 @@ class Fields extends Structure // set the custom field file $this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single); } + else + { + // now add to the field set + $field .= $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber); + } } } } @@ -1498,11 +1593,6 @@ class Fields extends Structure // now add to the field set $field .= $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber); } - elseif (ComponentbuilderHelper::fieldCheck($r_typeName, 'plain')) - { - // now add to the field set - $field .= $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber); - } elseif ($r_typeName === 'subform') { // set nested depth @@ -1521,7 +1611,7 @@ class Fields extends Structure $field .= $this->setField('special', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber); } } - elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) + elseif (isset($r_fieldValues['custom']) && ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) { // add to custom $custom = $r_fieldValues['custom']; @@ -1542,6 +1632,11 @@ class Fields extends Structure // set the custom field file $this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single); } + else + { + // now add to the field set + $field .= $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber); + } } } } @@ -1613,7 +1708,106 @@ class Fields extends Structure elseif ($property === 'option') { ComponentbuilderHelper::xmlComment($field->fieldXML, $this->setLine(__LINE__) . " Option Set."); - if (strpos($value, ',') !== false) + if (strtolower($typeName) === 'groupedlist' && strpos($value, ',') !== false && strpos($value, '@@') !== false) + { + // reset the group temp arrays + $groups_ = array(); + $grouped_ = array('group' => array(), 'option' => array()); + $order_ = array(); + // mulitpal options + $options = explode(',', $value); + foreach ($options as $option) + { + if (strpos($option, '@@') !== false) + { + // set the group label + $valueKeyArray = explode('@@', $option); + if (count((array) $valueKeyArray) == 2) + { + $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($valueKeyArray[0], true); + // add to lang array + $this->setLangContent($this->lang, $langValue, $valueKeyArray[0]); + // now add group label + $groups_[$valueKeyArray[1]] = $langValue; + // set order + $order_['group' . $valueKeyArray[1]] = $valueKeyArray[1]; + } + } + elseif (strpos($option, '|') !== false) + { + // has other value then text + $valueKeyArray = explode('|', $option); + if (count((array) $valueKeyArray) == 3) + { + $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($valueKeyArray[1], true); + // add to lang array + $this->setLangContent($this->lang, $langValue, $valueKeyArray[1]); + // now add to option set + $grouped_['group'][$valueKeyArray[2]][] = array('value' => $valueKeyArray[0], 'text' => $langValue); + $optionArray[$valueKeyArray[0]] = $langValue; + // set order + $order_['group' . $valueKeyArray[2]] = $valueKeyArray[2]; + } + else + { + $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($valueKeyArray[1], true); + // add to lang array + $this->setLangContent($this->lang, $langValue, $valueKeyArray[1]); + // now add to option set + $grouped_['option'][$valueKeyArray[0]] = array('value' => $valueKeyArray[0], 'text' => $langValue); + $optionArray[$valueKeyArray[0]] = $langValue; + // set order + $order_['option' . $valueKeyArray[0]] = $valueKeyArray[0]; + } + } + else + { + // text is also the value + $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($option, true); + // add to lang array + $this->setLangContent($this->lang, $langValue, $option); + // now add to option set + $grouped_['option'][$option] = array('value' => $valueKeyArray[0], 'text' => $langValue); + $optionArray[$option] = $langValue; + // set order + $order_['option' . $option] = $option; + } + } + // now build the groups + foreach ($order_ as $pointer_ => $_id) + { + // load the default key + $key_ = 'group'; + if (strpos($pointer_, 'option') !== false) + { + // load the option field + $key_ = 'option'; + } + // check if this is a group loader + if ('group' === $key_ && isset($groups_[$_id]) && isset($grouped_[$key_][$_id]) && ComponentbuilderHelper::checkArray($grouped_[$key_][$_id])) + { + // set group label + $groupXML = $field->fieldXML->addChild('group'); + $groupXML->addAttribute('label', $groups_[$_id]); + + foreach ($grouped_[$key_][$_id] as $option_) + { + $groupOptionXML = $groupXML->fieldXML->addChild('option'); + $groupOptionXML->addAttribute('value', $option_['value']); + $groupOptionXML[] = $option_['text']; + } + unset($groups_[$_id]); + unset($grouped_[$key_][$_id]); + } + elseif (isset($grouped_[$key_][$_id]) && ComponentbuilderHelper::checkString($grouped_[$key_][$_id])) + { + $optionXML = $field->fieldXML->addChild('option'); + $optionXML->addAttribute('value', $grouped_[$key_][$_id]['value']); + $optionXML[] = $grouped_[$key_][$_id]['text']; + } + } + } + elseif (strpos($value, ',') !== false) { // mulitpal options $options = explode(',', $value); @@ -1627,7 +1821,7 @@ class Fields extends Structure $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($t, true); // add to lang array $this->setLangContent($this->lang, $langValue, $t); - // no add to option set + // now add to option set $optionXML->addAttribute('value', $v); $optionArray[$v] = $langValue; } @@ -1637,7 +1831,7 @@ class Fields extends Structure $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($option, true); // add to lang array $this->setLangContent($this->lang, $langValue, $option); - // no add to option set + // now add to option set $optionXML->addAttribute('value', $option); $optionArray[$option] = $langValue; } @@ -1655,7 +1849,7 @@ class Fields extends Structure $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($t, true); // add to lang array $this->setLangContent($this->lang, $langValue, $t); - // no add to option set + // now add to option set $optionXML->addAttribute('value', $v); $optionArray[$v] = $langValue; } @@ -1665,7 +1859,7 @@ class Fields extends Structure $langValue = $langView . '_' . ComponentbuilderHelper::safeFieldName($value, true); // add to lang array $this->setLangContent($this->lang, $langValue, $value); - // no add to option set + // now add to option set $optionXML->addAttribute('value', $value); $optionArray[$value] = $langValue; } @@ -1778,12 +1972,7 @@ class Fields extends Structure // now add to the field set ComponentbuilderHelper::xmlAppend($fieldSetXML, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); } - elseif (ComponentbuilderHelper::fieldCheck($r_typeName, 'plain')) - { - // now add to the field set - ComponentbuilderHelper::xmlAppend($fieldSetXML, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); - } - elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) + elseif (isset($r_fieldValues['custom']) && ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) { // add to custom $custom = $r_fieldValues['custom']; @@ -1804,6 +1993,11 @@ class Fields extends Structure // set the custom field file $this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single); } + else + { + // now add to the field set + ComponentbuilderHelper::xmlAppend($fieldSetXML, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); + } } } } @@ -1886,11 +2080,6 @@ class Fields extends Structure // now add to the field set ComponentbuilderHelper::xmlAppend($form, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); } - elseif (ComponentbuilderHelper::fieldCheck($r_typeName, 'plain')) - { - // now add to the field set - ComponentbuilderHelper::xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); - } elseif ($r_typeName === 'subform') { // set nested depth @@ -1910,7 +2099,7 @@ class Fields extends Structure } } - elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) + elseif (isset($r_fieldValues['custom']) && ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) { // add to custom $custom = $r_fieldValues['custom']; @@ -1931,6 +2120,11 @@ class Fields extends Structure // set the custom field file $this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single); } + else + { + // now add to the field set + ComponentbuilderHelper::xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); + } } } } @@ -2862,6 +3056,22 @@ class Fields extends Structure // make sure it is not already been build or if it is prime if (isset($data['custom']) && isset($data['custom']['extends']) && ((isset($data['custom']['prime_php']) && $data['custom']['prime_php'] == 1) || !isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']]))) { + // set J prefix + $jprefix = 'J'; + // check if this field has a dot in field type name + if (strpos($data['type'], '.') !== false) + { + // so we have name spacing in custom field type name + $dotTypeArray = explode('.', $data['type']); + // set the J prefix + if (count($dotTypeArray) > 1) + { + $jprefix = strtoupper(array_shift($dotTypeArray)); + } + // update the type name now + $data['type'] = implode('', $dotTypeArray); + $data['custom']['type'] = $data['type']; + } // set tab and break replacements $tabBreak = array( '\t' => $this->_t(1), @@ -2869,6 +3079,7 @@ class Fields extends Structure ); // set the [[[PLACEHOLDER]]] options $replace = array( + $this->bbb . 'JPREFIX' . $this->ddd => $jprefix, $this->bbb . 'TABLE' . $this->ddd => $data['custom']['table'], $this->bbb . 'ID' . $this->ddd => $data['custom']['id'], $this->bbb . 'TEXT' . $this->ddd => $data['custom']['text'], @@ -2901,6 +3112,8 @@ class Fields extends Structure } // start loading the field type $this->fileContentDynamic['customfield_' . $data['type']] = array(); + // JPREFIX <>> + $this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JPREFIX' . $this->hhh] = $jprefix; // Type <<>> $this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'Type' . $this->hhh] = ComponentbuilderHelper::safeString($data['custom']['type'], 'F'); // type <<>> diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index cc60884ad..8fc70e878 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -5218,7 +5218,7 @@ class Interpretation extends Fields $script[] = $this->_t(2) . "\$folders = JFolder::folders(\$installPath);"; $script[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " check if we have folders we may want to copy"; $script[] = $this->_t(2) . "\$doNotCopy = array('media','admin','site'); // Joomla already deals with these"; - $script[] = $this->_t(2) . "if (count(\$folders) > 1)"; + $script[] = $this->_t(2) . "if (count((array) \$folders) > 1)"; $script[] = $this->_t(2) . "{"; $script[] = $this->_t(3) . "foreach (\$folders as \$folder)"; $script[] = $this->_t(3) . "{"; @@ -5419,7 +5419,7 @@ class Interpretation extends Fields { // load the custom script for the switch based on dynamic get $routerSwitch[] = PHP_EOL . $this->_t(3) . "case '" . $view . "':"; - $routerSwitch[] = $this->setPlaceholders($this->setDynamicValues(base64_decode($viewArray['settings']->main_get->php_router_parse)), $this->placeholders); + $routerSwitch[] = $this->setPlaceholders($viewArray['settings']->main_get->php_router_parse, $this->placeholders); $routerSwitch[] = $this->_t(4) . "break;"; return implode(PHP_EOL, $routerSwitch); @@ -10807,7 +10807,7 @@ class Interpretation extends Fields $function[] = $this->_t(2) . "\$query->from(\$db->quoteName('" . $filter['custom']['table'] . "', 'a'));"; $function[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " get the targeted groups"; $function[] = $this->_t(2) . "\$groups= JComponentHelper::getParams('com_" . $component . "')->get('" . $filter['type'] . "');"; - $function[] = $this->_t(2) . "if (count(\$groups) > 0)"; + $function[] = $this->_t(2) . "if (!empty(\$groups) && count((array) \$groups) > 0)"; $function[] = $this->_t(2) . "{"; $function[] = $this->_t(3) . "\$query->join('LEFT', \$db->quoteName('#__user_usergroup_map', 'group') . ' ON (' . \$db->quoteName('group.user_id') . ' = ' . \$db->quoteName('a.id') . ')');"; $function[] = $this->_t(3) . "\$query->where('group.group_id IN (' . implode(',', \$groups) . ')');"; @@ -14040,7 +14040,7 @@ class Interpretation extends Fields if (isset($newxmlField->fieldXML)) { $xmlField = dom_import_simplexml($newxmlField->fieldXML); - $xmlField = PHP_EOL . $this->_t(1) . "' . PHP_EOL . $this->_t(1) . $this->xmlPrettyPrint($xmlField, 'field'); + $xmlField = PHP_EOL . $this->_t(1) . "' . PHP_EOL . $this->_t(1) . $this->xmlPrettyPrint($xmlField, 'field'); } } // make sure the xml is set and a string @@ -16293,4 +16293,352 @@ function vdm_dkim() { return $matches[1]; } + public function getPluginMainClass(&$plugin) + { + return + PHP_EOL . $plugin->head . PHP_EOL . + $plugin->comment . PHP_EOL . 'class ' . + $plugin->class_name . ' extends ' . + $plugin->extends . PHP_EOL . '{' . PHP_EOL . + $plugin->main_class_code . PHP_EOL . + "}" . PHP_EOL; + } + + public function getPluginMainXML(&$plugin) + { + // tweak system to set stuff to the plugin domain + $_backup_target = $this->target; + $_backup_lang = $this->lang; + $_backup_langPrefix = $this->langPrefix; + $this->target = $plugin->key; + $this->lang = $plugin->key; + $this->langPrefix = $plugin->lang_prefix; + $view = ''; + $viewType = 0; + // set the custom table key + $dbkey = 'yy'; + // build the xml + $xml = ''; + // build the config fields + $config_field = ''; + if (isset($plugin->config_fields) && ComponentbuilderHelper::checkArray($plugin->config_fields)) + { + foreach ($plugin->config_fields as $field) + { + // check the field builder type + if ($this->fieldBuilderType == 1) + { + // string manipulation + $xmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false); + } + else + { + // simpleXMLElement class + $newxmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false); + if (isset($newxmlField->fieldXML)) + { + $xmlField = dom_import_simplexml($newxmlField->fieldXML); + $xmlField = PHP_EOL . $this->_t(2) . "' . PHP_EOL . $this->_t(1) . $this->xmlPrettyPrint($xmlField, 'field'); + } + } + // make sure the xml is set and a string + if (isset($xmlField) && ComponentbuilderHelper::checkString($xmlField)) + { + $config_field .= $xmlField; + } + } + } + // switch to add the xml + $addLang = false; + // now build the language files + if (isset($this->langContent[$plugin->key])) + { + $lang = array_map(function ($langstring, $placeholder) + { + return $placeholder . '="' . $langstring . '"'; + }, $this->langContent[$plugin->key], array_keys($this->langContent[$plugin->key])); + // add to language file + $this->writeFile($plugin->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.ini', implode(PHP_EOL, $lang)); + $this->writeFile($plugin->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.sys.ini', implode(PHP_EOL, $lang)); + // set the line counter + $this->lineCount = $this->lineCount + count((array) $lang); + unset($lang); + // trigger the xml + $addLang = true; + } + // get all files and folders in plugin folder + $files = JFolder::files($plugin->folder_path); + $folders = JFolder::folders($plugin->folder_path); + // the files/folders to ignore + $ignore = array('sql', 'language', 'script.php', $plugin->file_name . '.xml', $plugin->file_name . '.php'); + // should the scriptfile be added + if ($plugin->add_install_script) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . 'script.php'; + } + // should the sql install be added + if ($plugin->add_sql) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(3) . 'sql/mysql/install.sql'; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // should the sql uninstall be added + if ($plugin->add_sql_uninstall) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(3) . 'sql/mysql/uninstall.sql'; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // should the language xml be added + if ($addLang) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . '' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.ini'; + $xml .= PHP_EOL . $this->_t(2) . '' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.sys.ini'; + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // add the plugin files + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . '' . $plugin->file_name . '.php'; + // add other files found + if (ComponentbuilderHelper::checkArray($files)) + { + foreach ($files as $file) + { + // only add what is not ignored + if (!in_array($file, $ignore)) + { + $xml .= PHP_EOL . $this->_t(2) . '' . $file . ''; + } + } + } + // add language folder + if ($addLang) + { + $xml .= PHP_EOL . $this->_t(2) . 'language'; + } + // add sql folder + if ($plugin->add_sql || $plugin->add_sql_uninstall) + { + $xml .= PHP_EOL . $this->_t(2) . 'sql'; + } + // add other files found + if (ComponentbuilderHelper::checkArray($folders)) + { + foreach ($folders as $folder) + { + // only add what is not ignored + if (!in_array($folder, $ignore)) + { + $xml .= PHP_EOL . $this->_t(2) . '' . $folder . ''; + } + } + } + $xml .= PHP_EOL . $this->_t(1) . ''; + // now add the Config Params if needed + if (ComponentbuilderHelper::checkString($config_field)) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . '
    '; + $xml .= $config_field; + $xml .= PHP_EOL . $this->_t(1) . '
    '; + $xml .= PHP_EOL . $this->_t(1) . '
    '; + $xml .= PHP_EOL . $this->_t(1) . '
    '; + } + // set update server if found + if ($plugin->add_update_server) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . '' . $plugin->update_server_url . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // rest globals + $this->target = $_backup_target; + $this->lang = $_backup_lang; + $this->langPrefix = $_backup_langPrefix; + + return $xml; + } + + public function getPluginInstallClass(&$plugin) + { + // yes we are adding it + $script = PHP_EOL . '/**'; + $script .= PHP_EOL . ' * ' . $plugin->official_name . ' script file.'; + $script .= PHP_EOL . ' *'; + $script .= PHP_EOL . ' * @package ' . $plugin->class_name; + $script .= PHP_EOL . ' */'; + $script .= PHP_EOL . 'class ' . $plugin->installer_class_name; + $script .= PHP_EOL . '{'; + // set constructor + if (isset($plugin->add_php_script_construct) + && $plugin->add_php_script_construct == 1 + && ComponentbuilderHelper::checkString($plugin->php_script_construct)) + { + $script .= $this->setInstallMethodScript('construct', $plugin->php_script_construct); + } + // add PHP in plugin install + $addScriptMethods = array('php_preflight', 'php_postflight', 'php_method'); + $addScriptTypes = array('install', 'update', 'uninstall', 'discover_install'); + // set some buckets for sorting + $function_install = array(); + $function_update = array(); + $function_uninstall = array(); + $has_php_preflight = false; + $function_php_preflight = array('install' => array(), 'uninstall' => array(), 'discover_install' => array(), 'update' => array()); + $has_php_postflight = false; + $function_php_postflight = array('install' => array(), 'uninstall' => array(), 'discover_install' => array(), 'update' => array()); + // the function sorter + foreach ($addScriptMethods as $scriptMethod) + { + foreach ($addScriptTypes as $scriptType) + { + if (isset($plugin->{'add_' . $scriptMethod . '_' . $scriptType}) + && $plugin->{'add_' . $scriptMethod . '_' . $scriptType} == 1 + && ComponentbuilderHelper::checkString($plugin->{$scriptMethod . '_' . $scriptType})) + { + // add to the main methods + if ('php_method' === $scriptMethod) + { + ${'function_' . $scriptType}[] = $plugin->{$scriptMethod . '_' . $scriptType}; + } + else + { + ${'function_' . $scriptMethod}[$scriptType][] = $plugin->{$scriptMethod . '_' . $scriptType}; + ${'has_' . $scriptMethod} = true; + } + } + } + } + // now add the install script. + if (ComponentbuilderHelper::checkArray($function_install)) + { + $script .= $this->setInstallMethodScript('install', $function_install); + } + // now add the update script. + if (ComponentbuilderHelper::checkArray($function_update)) + { + $script .= $this->setInstallMethodScript('update', $function_update); + } + // now add the uninstall script. + if (ComponentbuilderHelper::checkArray($function_uninstall)) + { + $script .= $this->setInstallMethodScript('uninstall', $function_uninstall); + } + // now add the preflight script. + if ($has_php_preflight) + { + $script .= $this->setInstallMethodScript('preflight', $function_php_preflight); + } + // now add the postflight script. + if ($has_php_postflight) + { + $script .= $this->setInstallMethodScript('postflight', $function_php_postflight); + } + $script .= PHP_EOL . '}' . PHP_EOL; + + return $script; + } + + protected function setInstallMethodScript($function_name, &$scripts) + { + $script = ''; + // build function + switch($function_name) + { + case 'install': + case 'update': + case 'uninstall': + // the main function types + $script = PHP_EOL . PHP_EOL . $this->_t(1) .'/**'; + $script .= PHP_EOL . $this->_t(1) .' * Called on ' . $function_name; + $script .= PHP_EOL . $this->_t(1) .' *'; + $script .= PHP_EOL . $this->_t(1) .' * @param JAdapterInstance $adapter The object responsible for running this script'; + $script .= PHP_EOL . $this->_t(1) .' *'; + $script .= PHP_EOL . $this->_t(1) .' * @return boolean True on success'; + $script .= PHP_EOL . $this->_t(1) .' */'; + $script .= PHP_EOL . $this->_t(1) .'public function ' . $function_name . '(JAdapterInstance $adapter)'; + $script .= PHP_EOL . $this->_t(1) .'{'; + $script .= PHP_EOL . implode(PHP_EOL . PHP_EOL, $scripts); + // return true + if ('uninstall' !== $function_name) + { + $script .= PHP_EOL . $this->_t(2) . 'return true;'; + } + break; + case 'preflight': + case 'postflight': + // the pre/post function types + $script = PHP_EOL . PHP_EOL . $this->_t(1) .'/**'; + $script .= PHP_EOL . $this->_t(1) .' * Called before any type of action'; + $script .= PHP_EOL . $this->_t(1) .' *'; + $script .= PHP_EOL . $this->_t(1) .' * @param string $route Which action is happening (install|uninstall|discover_install|update)'; + $script .= PHP_EOL . $this->_t(1) .' * @param JAdapterInstance $adapter The object responsible for running this script'; + $script .= PHP_EOL . $this->_t(1) .' *'; + $script .= PHP_EOL . $this->_t(1) .' * @return boolean True on success'; + $script .= PHP_EOL . $this->_t(1) .' */'; + $script .= PHP_EOL . $this->_t(1) .'public function ' . $function_name . '($route, JAdapterInstance $adapter)'; + $script .= PHP_EOL . $this->_t(1) .'{'; + $script .= PHP_EOL . $this->_t(2) . '//' . $this->setLine(__LINE__) . ' get application'; + $script .= PHP_EOL . $this->_t(2) . '$app = JFactory::getApplication();' . PHP_EOL; + // add the default version check (TODO) must make this dynamic + if ('preflight' === $function_name) + { + $script .= PHP_EOL . $this->_t(2) . '//' . $this->setLine(__LINE__) . ' the default for both install and update'; + $script .= PHP_EOL . $this->_t(2) . '$jversion = new JVersion();'; + $script .= PHP_EOL . $this->_t(2) . "if (!\$jversion->isCompatible('3.8.0'))"; + $script .= PHP_EOL . $this->_t(2) . '{'; + $script .= PHP_EOL . $this->_t(3) . "\$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');"; + $script .= PHP_EOL . $this->_t(3) . 'return false;'; + $script .= PHP_EOL . $this->_t(2) . '}' . PHP_EOL; + } + // now add the scripts + foreach ($scripts as $route => $_script) + { + if (ComponentbuilderHelper::checkArray($_script)) + { + // set the if and script + $script .= PHP_EOL . $this->_t(2) . "if ('" . $route . "' === \$route)"; + $script .= PHP_EOL . $this->_t(2) . '{'; + $script .= PHP_EOL . implode(PHP_EOL . PHP_EOL, $_script); + $script .= PHP_EOL . $this->_t(2) . '}' . PHP_EOL; + } + } + // return true + $script .= PHP_EOL . $this->_t(2) . 'return true;'; + break; + case 'construct': + // the __construct script + $script = PHP_EOL . PHP_EOL . $this->_t(1) .'/**'; + $script .= PHP_EOL . $this->_t(1) .' * Constructor'; + $script .= PHP_EOL . $this->_t(1) .' *'; + $script .= PHP_EOL . $this->_t(1) .' * @param JAdapterInstance $adapter The object responsible for running this script'; + $script .= PHP_EOL . $this->_t(1) .' */'; + $script .= PHP_EOL . $this->_t(1) .'public function __construct(JAdapterInstance $adapter)'; + $script .= PHP_EOL . $this->_t(1) .'{'; + $script .= PHP_EOL . $scripts; + break; + default: + // oops error + return ''; + } + // close the function + $script .= PHP_EOL . $this->_t(1) . '}'; + + return $script; + } + } diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 61e1c5041..32d568c9d 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -1032,6 +1032,27 @@ class Infusion extends Interpretation $this->fileContentStatic[$this->hhh . 'README' . $this->hhh] = $this->componentData->readme; } + // infuze plugin data if set + if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins)) + { + foreach ($this->componentData->joomla_plugins as $plugin) + { + if (ComponentbuilderHelper::checkObject($plugin)) + { + // MAINCLASS + $this->fileContentDynamic[$plugin->key][$this->hhh . 'MAINCLASS' . $this->hhh] = $this->getPluginMainClass($plugin); + // only add install script if needed + if ($plugin->add_install_script) + { + // INSTALLCLASS + $this->fileContentDynamic[$plugin->key][$this->hhh . 'INSTALLCLASS' . $this->hhh] = $this->getPluginInstallClass($plugin); + } + // MAINXML + $this->fileContentDynamic[$plugin->key][$this->hhh . 'MAINXML' . $this->hhh] = $this->getPluginMainXML($plugin); + } + } + } + // Trigger Event: jcb_ce_onAfterBuildFilesContent $this->triggerEvent('jcb_ce_onAfterBuildFilesContent', array(&$this->componentContext, &$this->componentData, &$this->fileContentStatic, &$this->fileContentDynamic, &$this->placeholders, &$this->hhh)); diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 67182ca26..cff883ed2 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -70,6 +70,12 @@ abstract class ComponentbuilderHelper public static $jcbGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Community-Packages/git/trees/master"; public static $jcbGithubPackageUrl = "https://github.com/vdm-io/JCB-Community-Packages/raw/master/"; + /** + * The bolerplate paths + **/ + public static $bolerplatePath = 'https://raw.githubusercontent.com/vdm-io/boilerplate/jcb/'; + public static $bolerplateAPI = 'https://api.github.com/repos/vdm-io/boilerplate/git/trees/jcb'; + // not needed at this time (maybe latter) public static $accessToken = ""; @@ -124,6 +130,510 @@ abstract class ComponentbuilderHelper 'JPATH_THEMES' => JPATH_THEMES ); + /** + * get the class method or property + * + * @input int The method/property ID + * @input string The target type + * + * @returns string on success + **/ + public static function getClassCode($id, $type) + { + if ('property' === $type || 'method' === $type) + { + // Get a db connection. + $db = JFactory::getDbo(); + // Get user object + $user = JFactory::getUser(); + // Create a new query object. + $query = $db->getQuery(true); + // get method + if ('method' === $type) + { + $query->select($db->quoteName(array('a.comment','a.name','a.visibility','a.arguments','a.code'))); + } + // get property + elseif ('property' === $type) + { + $query->select($db->quoteName(array('a.comment','a.name','a.visibility','a.default'))); + } + $query->from($db->quoteName('#__componentbuilder_class_' . $type,'a')); + $query->where($db->quoteName('a.id') . ' = ' . (int) $id); + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $columns = $db->getTableColumns('#__componentbuilder_class_' . $type); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // get the code + $code = $db->loadObject(); + // combine method values + $combinded = array(); + // add comment if set + if (self::checkString($code->comment)) + { + $comment = array_map('trim', (array) explode(PHP_EOL, base64_decode($code->comment))); + $combinded[] = "\t" . implode(PHP_EOL . "\t ", $comment); + } + // build method + if ('method' === $type) + { + // set the method signature + if (self::checkString($code->arguments)) + { + $combinded[] = "\t" . $code->visibility . ' function ' . $code->name . '(' . base64_decode($code->arguments) . ')'; + } + else + { + $combinded[] = "\t" . $code->visibility . ' function ' . $code->name . '()'; + } + // set the method code + $combinded[] = "\t" . "{"; + // add code if set + if (self::checkString(trim($code->code))) + { + $combinded[] = base64_decode($code->code); + } + else + { + $combinded[] = "\t\t// add your code here"; + } + $combinded[] = "\t" . "}"; + } + else + { + if (self::checkString($code->default)) + { + $code->default = base64_decode($code->default); + if (is_int($code->default)) + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = ' . (int) $code->default . ';'; + } + elseif (is_float($code->default)) + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = ' . (float) $code->default . ';'; + } + elseif (('false' === $code->default || 'true' === $code->default) + || (self::checkString($code->default) && (strpos($code->default, 'array(') !== false || strpos($code->default, '"') !== false))) + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = ' . $code->default . ';'; + } + elseif (self::checkString($code->default) && strpos($code->default, '"') === false) + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = "' . $code->default . '";'; + } + else + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ';'; + } + } + else + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ';'; + } + } + // return the code + return implode(PHP_EOL, $combinded); + } + } + return false; + } + + /** + * extract Boilerplate Class Extends + * + * @input string The class as a string + * @input string The type of class/extension + * + * @returns string on success + **/ + public static function extractBoilerplateClassExtends(&$class, $type) + { + if (($strings = self::getAllBetween($class, 'class ', '}')) !== false && self::checkArray($strings)) + { + foreach ($strings as $string) + { + if (($extends = self::getBetween($string, 'extends ', '{')) !== false && self::checkString($extends)) + { + return trim($extends); + } + } + } + return false; + } + + /** + * extract Boilerplate Class Header + * + * @input string The class as a string + * @input string The class being extended + * @input string The type of class/extension + * + * @returns string on success + **/ + public static function extractBoilerplateClassHeader(&$class, $extends, $type) + { + if (($string = self::getBetween($class, "defined('_JEXEC')", 'extends ' . $extends)) !== false && self::checkString($string)) + { + $headArray = explode(PHP_EOL, $string); + if (self::checkArray($headArray) && count($headArray) > 3) + { + // remove first since it still has the [or die;] string in it + array_shift($headArray); + // remove the last since it has the class declaration + array_pop($headArray); + // at this point we have the class comment still in as part of the header, lets remove that + $last = count($headArray); + while ($last > 0) + { + $last--; + if (isset($headArray[$last]) && strpos($headArray[$last], '*') !== false) + { + unset($headArray[$last]); + } + else + { + // moment the comment stops, we break out + $last = 0; + } + } + // make sure we only return if we have values + if (self::checkArray($headArray)) + { + return implode(PHP_EOL, $headArray); + } + } + } + return false; + } + + /** + * extract Boilerplate Class Comment + * + * @input string The class as a string + * @input string The class being extended + * @input string The type of class/extension + * + * @returns string on success + **/ + public static function extractBoilerplateClassComment(&$class, $extends, $type) + { + if (($string = self::getBetween($class, "defined('_JEXEC')", 'extends ' . $extends)) !== false && self::checkString($string)) + { + $headArray = explode(PHP_EOL, $string); + if (self::checkArray($headArray) && count($headArray) > 3) + { + $comment = array(); + // remove the last since it has the class declaration + array_pop($headArray); + // at this point we have the class comment still in as part of the header, lets remove that + $last = count($headArray); + while ($last > 0) + { + $last--; + if (isset($headArray[$last]) && strpos($headArray[$last], '*') !== false) + { + $comment[$last] = $headArray[$last]; + } + else + { + // moment the comment stops, we break out + $last = 0; + } + } + // make sure we only return if we have values + if (self::checkArray($comment)) + { + // set the correct order + ksort($comment); + return implode(PHP_EOL, $comment); + } + } + } + return false; + } + + /** + * extract Boilerplate Class Properties & Methods + * + * @input string The class as a string + * @input string The class being extended + * @input string The type of class/extension + * @input int The plugin groups + * + * @returns string on success + **/ + public static function extractBoilerplateClassPropertiesMethods(&$class, $extends, $type, $plugin_group = null) + { + $bucket = array('property' => array(), 'method' => array()); + // get the class code, and remove the head + $codeArrayTmp = explode('extends ' . $extends, $class); + // make sure we have the correct result + if (self::checkArray($codeArrayTmp) && count($codeArrayTmp) == 2) + { + // the triggers + $triggers = array('public' => 1, 'protected' => 2, 'private' => 3); + $codeArray = explode(PHP_EOL, $codeArrayTmp[1]); + unset($codeArrayTmp); + // clean the code + self::cleanBoilerplateCode($codeArray); + // temp bucket + $name = null; + $arg = null; + $target = null; + $visibility = null; + $tmp = array(); + $comment = array(); + // load method + $loadCode = function (&$bucket, &$target, &$name, &$arg, &$visibility, &$tmp, &$comment) use($type, $plugin_group){ + $_tmp = array( + 'name' => $name, + 'visibility' => $visibility, + 'extension_type' => $type + ); + // build filter + $filters = array('extension_type' => $type); + // add more data based on target + if ('method' === $target && self::checkArray($tmp)) + { + // clean the code + self::cleanBoilerplateCode($tmp); + // only load if there are values + if (self::checkArray($tmp, true)) + { + $_tmp['code'] = implode(PHP_EOL, $tmp); + } + else + { + $_tmp['code'] = ''; + } + // load arguments only if set + if (self::checkString($arg)) + { + $_tmp['arguments'] = $arg; + } + } + elseif ('property' === $target) + { + // load default only if set + if (self::checkString($arg)) + { + $_tmp['default'] = $arg; + } + } + // load comment only if set + if (self::checkArray($comment, true)) + { + $_tmp['comment'] = implode(PHP_EOL, $comment); + } + // load the group target + if ($plugin_group) + { + $_tmp['joomla_plugin_group'] = $plugin_group; + $filters['joomla_plugin_group'] = $plugin_group; + } + // load the local values + if (($locals = self::getLocalBoilerplate($name, $target, $type, $filters)) !== false) + { + foreach ($locals as $key => $value) + { + $_tmp[$key] = $value; + } + } + else + { + $_tmp['id'] = 0; + $_tmp['published'] = 1; + $_tmp['version'] = 1; + } + // store the data based on target + $bucket[$target][] = $_tmp; + }; + // now we start loading + foreach($codeArray as $line) + { + if ($visibility && $target && $name && strpos($line, '/**') !== false) + { + $loadCode($bucket, $target, $name, $arg, $visibility, $tmp, $comment); + // reset loop buckets + $name = null; + $arg = null; + $target = null; + $visibility = null; + $tmp = array(); + $comment = array(); + } + // load the comment before method/property + if (!$visibility && !$target && !$name && strpos($line, '*') !== false) + { + $comment[] = rtrim($line); + } + else + { + if (!$visibility && !$target && !$name) + { + // get the line values + $lineArray = array_values(array_map('trim', preg_split('/\s+/', trim($line)))); + // check if we are at the main line + if (isset($lineArray[0]) && isset($triggers[$lineArray[0]])) + { + $visibility = $lineArray[0]; + if (strpos($line, 'function') !== false) + { + $target = 'method'; + // get the name + $name = trim(self::getBetween($line, 'function ', '(')); + // get the arguments + $arg = trim(self::getBetween($line, ' ' . $name . '(', ')')); + } + else + { + $target = 'property'; + if (strpos($line, '=') !== false) + { + // get the name + $name = trim(self::getBetween($line, '$', '=')); + // get the default + $arg = trim(self::getBetween($line, '=', ';')); + } + else + { + // get the name + $name = trim(self::getBetween($line, '$', ';')); + } + } + } + } + else + { + $tmp[] = rtrim($line); + } + } + } + // check if a last method is still around + if ($visibility && $target && $name) + { + $loadCode($bucket, $target, $name, $arg, $visibility, $tmp, $comment); + // reset loop buckets + $name = null; + $arg = null; + $target = null; + $visibility = null; + $tmp = array(); + $comment = array(); + } + return $bucket; + } + return false; + } + + protected static function getLocalBoilerplate($name, $table, $extension_type, $filters = array()) + { + if ('property' === $table || 'method' === $table) + { + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + // get method + $query->select($db->quoteName(array('a.id','a.published','a.version'))); + $query->from($db->quoteName('#__componentbuilder_class_' . $table,'a')); + $query->where($db->quoteName('a.name') . ' = ' . $db->quote($name)); + $query->where($db->quoteName('a.extension_type') . ' = ' . $db->quote($extension_type)); + // add more filters + if (self::checkArray($filters)) + { + foreach($filters as $where => $value) + { + if (is_numeric($value)) + { + $query->where($db->quoteName('a.' . $where) . ' = ' . $value); + } + else + { + $query->where($db->quoteName('a.' . $where) . ' = ' . $db->quote($value)); + } + } + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // get the code + return $db->loadAssoc(); + } + } + return false; + } + + protected static function cleanBoilerplateCode(&$code) + { + // remove the first lines until a { is found + $key = 0; + $found = false; + while (!$found) + { + if (isset($code[$key])) + { + if (strpos($code[$key], '{') !== false) + { + unset($code[$key]); + // only remove the first } found + $found = true; + } + // remove empty lines + elseif (!self::checkString(trim($code[$key]))) + { + unset($code[$key]); + } + } + // check next line + $key++; + // stop loop at line 30 (really this should never happen) + if ($key > 30) + { + $found = true; + } + } + // reset all keys + $code = array_values($code); + // remove last lines until } + $last = count($code); + while ($last > 0) + { + $last--; + if (isset($code[$last])) + { + if (strpos($code[$last], '}') !== false) + { + unset($code[$last]); + // only remove the first } found + $last = 0; + } + // remove empty lines + elseif (!self::checkString(trim($code[$last]))) + { + unset($code[$last]); + } + } + } + } + /** * Making class or function name safe * @@ -139,7 +649,7 @@ abstract class ComponentbuilderHelper $name = self::replaceNumbers($name); } // remove all spaces and strange characters - return trim(reg_replace("/[^A-Za-z0-9]/", '', $name)); + return trim(preg_replace("/[^A-Za-z0-9_-]/", '', $name)); } /** @@ -202,6 +712,48 @@ abstract class ComponentbuilderHelper return self::safeString($string); } + /** + * The type builder switch + **/ + protected static $typeNameBuilder = false; + + /** + * Making field type name safe + * + * @input string The you would like to make safe + * + * @returns string on success + **/ + public static function safeTypeName($string) + { + // get global value + if (self::$typeNameBuilder === false) + { + self::$typeNameBuilder = JComponentHelper::getParams('com_componentbuilder')->get('type_name_builder', 1); + } + // use the new convention + if (2 == self::$typeNameBuilder) + { + // 0nly continue if we have a string + if (self::checkString($string)) + { + // check that the first character is not a number + if (is_numeric(substr($string, 0, 1))) + { + $string = self::replaceNumbers($string); + } + // remove all and keep only characters and numbers and point (TODO just one point) + $string = trim(preg_replace("/[^A-Za-z0-9\.]/", '', $string)); + // best is to return lower (for all string equality in compiler) + return strtolower($string); + } + // not a string + return ''; + } + // use the default (original behaviour/convention) + return self::safeString($string); + } + /* * Get the Array of Existing Validation Rule Names * @@ -529,7 +1081,7 @@ abstract class ComponentbuilderHelper * @return void * */ - public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less')) + public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true) { if (JFolder::exists($folder)) { @@ -537,11 +1089,25 @@ abstract class ComponentbuilderHelper $joomla = getcwd(); // we are changing the working directory to the componet path chdir($folder); - // get the files - foreach ($fileTypes as $type) + // make sure we have file type filter + if (self::checkArray($fileTypes)) + { + // get the files + foreach ($fileTypes as $type) + { + // get a list of files in the current directory tree + $files[] = JFolder::files('.', $type, $recurse, $full); + } + } + elseif (self::checkString($fileTypes)) { // get a list of files in the current directory tree - $files[] = JFolder::files('.', $type, true, true); + $files[] = JFolder::files('.', $fileTypes, $recurse, $full); + } + else + { + // get a list of files in the current directory tree + $files[] = JFolder::files('.', '.', $recurse, $full); } // change back to Joomla working directory chdir($joomla); @@ -2698,13 +3264,13 @@ abstract class ComponentbuilderHelper ), 'option' => array( 'accesslevel', 'category', 'checkboxes', 'combo', 'contentlanguage', 'databaseconnection', // 'components', (TODO) must be added but still in use as a custom field in JCB - 'filelist', 'folderlist', 'imagelist', 'list', 'plugins', 'predefinedlist', 'radio', 'sessionhandler', 'sql' + 'filelist', 'folderlist', 'imagelist', 'list', 'plugins', 'predefinedlist', 'radio', 'sessionhandler', 'sql', 'groupedlist' ), 'text' => array( 'calendar', 'color', 'editor', 'email', 'number', 'password', 'range', 'tel', 'text', 'textarea', 'url' ), 'list' => array( - 'checkbox', 'checkboxes', 'list', 'radio' + 'checkbox', 'checkboxes', 'list', 'radio', 'groupedlist' ), 'dynamic' => array( 'category', 'file', 'filelist', 'folderlist', 'headertag', 'imagelist', 'integer', 'media', 'meter', 'rules', 'tag', 'timezone', 'user' @@ -2713,7 +3279,7 @@ abstract class ComponentbuilderHelper 'note', 'spacer' ), 'special' => array( - 'contentlanguage', 'groupedlist', 'moduleposition', 'plugin', 'repeatable', 'subform', 'templatestyle' + 'contentlanguage', 'moduleposition', 'plugin', 'repeatable', 'subform', 'templatestyle' ) ); @@ -4803,6 +5369,10 @@ abstract class ComponentbuilderHelper { JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_COMPONENTS'), 'index.php?option=com_componentbuilder&view=joomla_components', $submenu === 'joomla_components'); } + if ($user->authorise('joomla_plugin.access', 'com_componentbuilder') && $user->authorise('joomla_plugin.submenu', 'com_componentbuilder')) + { + JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_PLUGINS'), 'index.php?option=com_componentbuilder&view=joomla_plugins', $submenu === 'joomla_plugins'); + } if ($user->authorise('admin_view.access', 'com_componentbuilder') && $user->authorise('admin_view.submenu', 'com_componentbuilder')) { JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=admin_views', $submenu === 'admin_views'); diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 3968e9ea5..0c0f74f62 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -189,7 +189,11 @@ COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_CREATED_DATE_DESC="The date this Admin Cu COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_EDIT="Editing the Admin Custom Tabs" COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_ERROR_UNIQUE_ALIAS="Another Admin Custom Tabs has the same alias." -COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_HTML_HINT="// Add the tab HTML here. To access php values methodname->value; ?>" +COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_HTML_HINT="// Add the tab HTML here. +// To access php values MethodName->value; ?> +// Note the convention, if in the PHP area above you added a method called getMethodName() +// Then [MethodName] becomes a class variable called $this->MethodName +// Which will hold the value/s your method returned." COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_HTML_LABEL="HTML" COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_ID="Id" COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_MODIFIED_BY_DESC="The last user that modified this Admin Custom Tabs." @@ -1370,6 +1374,7 @@ COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME="All is good, t COM_COMPONENTBUILDER_ALL_OF_THESE_PACKAGES_ARE_A_FULLY_DEVELOPEDMAPPED_COMPONENTS_FOR_JCB_THEY_CAN_BE_SEEN_AS_DEMO_CONTENT_OR_BASE_IMAGES_FROM_WHICH_TO_START_YOUR_PROJECTBR_ALWAYS_MAKE_SURE_YOU_ARE_ON_THE_LATEST_VERSION_OF_JCB_BEFORE_IMPORTING_ANY_OF_THESE_PACKAGES_SHOULD_ANY_OF_THEM_FAIL_TO_IMPORT_A_S_PLEASE_LET_US_KNOWA="All of these packages are a fully developed/mapped components for JCB. They can be seen as demo content, or base images from which to start your project.
    Always make sure you are on the latest version of JCB before importing any of these packages, should any of them fail to import please let us know." COM_COMPONENTBUILDER_ALL_THE_LANGUAGES_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED="All the languages found in Joomla were successfully imported." COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?" +COM_COMPONENTBUILDER_ALREADY_SELECTED_TRY_ANOTHER="Already selected, try another." COM_COMPONENTBUILDER_ALWAYS_ADD="Always Add" COM_COMPONENTBUILDER_ALWAYS_INSURE_THAT_YOU_HAVE_YOUR_LOCAL_COMPONENTS_BACKED_UP_BY_MAKING_AN_EXPORT_OF_ALL_YOUR_LOCAL_COMPONENTS_BEFORE_IMPORTING_ANY_NEW_COMPONENTS_SMALLMAKE_BSUREB_TO_MOVE_THIS_ZIPPED_BACKUP_PACKAGE_OUT_OF_THE_TMP_FOLDER_BEFORE_DOING_AN_IMPORTSMALLBR_IF_YOU_ARE_IMPORTING_A_PACKAGE_OF_A_THREERD_PARTY_JCB_PACKAGE_DEVELOPER_BMAKE_SURE_IT_IS_A_REPUTABLE_JCB_PACKAGE_DEVELOPERSB_A_SFIND_OUT_WHYA="Always insure that you have your local components backed up, by making an export of all your local components before importing any new components. (Make SURE to move this zipped backup package out of the tmp folder before doing an import)
    If you are importing a package of a 3rd party JCB package developer, make sure it is a reputable JCB package developers! Find out why!" COM_COMPONENTBUILDER_ANY_SELECTION_ONLY_FOUR_LISTRADIOCHECKBOXESDYNAMIC_LIST="Any Selection (only 4 list/radio/checkboxes/dynamic_list)" @@ -1410,6 +1415,7 @@ COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_SSA="Get the key from %s< COM_COMPONENTBUILDER_BGET_THE_KEY_FROM_SB_FOR_A_SSA="Get the key from %s for %s" COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVED_TO_CORRECT_LOCATION="Images not moved to correct location!" COM_COMPONENTBUILDER_BMULTIPLE_FIELD_REPEATABLE_MODEB_IDS_MISMATCH_IN_BFIELDSB_AND_WAS_EMREMOVEDEM_FROM_THE_FIELD="Multiple Field (repeatable mode) id:%s mismatch in field:%s, and was removed from the field." +COM_COMPONENTBUILDER_BOILERPLATE_PLUGIN_S_DATA_COULD_NOT_BE_SAVED="Boilerplate (plugin - %s) data could not be saved" COM_COMPONENTBUILDER_BSBS_IN_BSB_HAS_ID_MISMATCH_SO_THE_BSB_WAS_REMOVED="%s->%s in %s has id mismatch. So the %s was removed!" COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS="%s could not be imported%s" COM_COMPONENTBUILDER_BSB_HAS_BEEN_IMPORTED="%s has been imported!" @@ -1430,6 +1436,290 @@ COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_ COM_COMPONENTBUILDER_CANCEL="Cancel" 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" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_ACCESS="Class Extendings Access" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_ACCESS_DESC="Allows the users in this group to access access class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_OPTIONS="Batch process the selected Class Extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_TIP="All changes will be applied to all selected Class Extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE="Class Extendings Batch Use" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_CREATE="Class Extendings Create" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_CREATE_DESC="Allows the users in this group to create create class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_DELETE="Class Extendings Delete" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_DELETE_DESC="Allows the users in this group to delete delete class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT="Class Extendings Edit" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_CREATED_BY="Class Extendings Edit Created By" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_CREATED_DATE="Class Extendings Edit Created Date" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_DESC="Allows the users in this group to edit the class extends" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_OWN="Class Extendings Edit Own" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_OWN_DESC="Allows the users in this group to edit edit own class extendings created by them" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_STATE="Class Extendings Edit State" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_STATE_DESC="Allows the users in this group to update the state of the class extends" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION="Class Extendings Edit Version" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_ARCHIVED="%s Class Extendings archived." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_ARCHIVED_1="%s Class Extends archived." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_CHECKED_IN_0="No Class Extends successfully checked in." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_CHECKED_IN_1="%d Class Extends successfully checked in." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_CHECKED_IN_MORE="%d Class Extendings successfully checked in." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_DELETED="%s Class Extendings deleted." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_DELETED_1="%s Class Extends deleted." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_FEATURED="%s Class Extendings featured." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_FEATURED_1="%s Class Extends featured." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_PUBLISHED="%s Class Extendings published." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_PUBLISHED_1="%s Class Extends published." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_TRASHED="%s Class Extendings trashed." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_TRASHED_1="%s Class Extends trashed." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_UNFEATURED="%s Class Extendings unfeatured." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_UNFEATURED_1="%s Class Extends unfeatured." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_UNPUBLISHED="%s Class Extendings unpublished." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_UNPUBLISHED_1="%s Class Extends unpublished." +COM_COMPONENTBUILDER_CLASS_EXTENDS="Class Extends" +COM_COMPONENTBUILDER_CLASS_EXTENDS_COMMENT="Comment" +COM_COMPONENTBUILDER_CLASS_EXTENDS_COMMENT_DESCRIPTION="The class comment" +COM_COMPONENTBUILDER_CLASS_EXTENDS_COMMENT_HINT="/** + * [NAME] + * + * @package [COMPONENT_NAME] + */" +COM_COMPONENTBUILDER_CLASS_EXTENDS_COMMENT_LABEL="Class Comment" +COM_COMPONENTBUILDER_CLASS_EXTENDS_COMPONENTS="components" +COM_COMPONENTBUILDER_CLASS_EXTENDS_CREATED_BY_DESC="The user that created this Class Extends." +COM_COMPONENTBUILDER_CLASS_EXTENDS_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_CLASS_EXTENDS_CREATED_DATE_DESC="The date this Class Extends was created." +COM_COMPONENTBUILDER_CLASS_EXTENDS_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_CLASS_EXTENDS_DETAILS="Details" +COM_COMPONENTBUILDER_CLASS_EXTENDS_EDIT="Editing the Class Extends" +COM_COMPONENTBUILDER_CLASS_EXTENDS_ERROR_UNIQUE_ALIAS="Another Class Extends has the same alias." +COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE="Extension Type" +COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_DESCRIPTION="Extension type this class_extends belongs to." +COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL="Extension Type" +COM_COMPONENTBUILDER_CLASS_EXTENDS_HEAD="Head" +COM_COMPONENTBUILDER_CLASS_EXTENDS_HEAD_DESCRIPTION="The class head, where JLoader, namespace and use is added, so that class being extended will work." +COM_COMPONENTBUILDER_CLASS_EXTENDS_HEAD_LABEL="Class Head" +COM_COMPONENTBUILDER_CLASS_EXTENDS_ID="Id" +COM_COMPONENTBUILDER_CLASS_EXTENDS_MODIFIED_BY_DESC="The last user that modified this Class Extends." +COM_COMPONENTBUILDER_CLASS_EXTENDS_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_CLASS_EXTENDS_MODIFIED_DATE_DESC="The date this Class Extends was modified." +COM_COMPONENTBUILDER_CLASS_EXTENDS_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_CLASS_EXTENDS_MODULES="modules" +COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME="Name" +COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_DESCRIPTION="Enter Name Here" +COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_HINT="Name Here" +COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_LABEL="Name" +COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_MESSAGE="Error! Please add name here." +COM_COMPONENTBUILDER_CLASS_EXTENDS_NEW="A New Class Extends" +COM_COMPONENTBUILDER_CLASS_EXTENDS_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_CLASS_EXTENDS_PERMISSION="Permissions" +COM_COMPONENTBUILDER_CLASS_EXTENDS_PLUGINS="plugins" +COM_COMPONENTBUILDER_CLASS_EXTENDS_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_CLASS_EXTENDS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Class Extends to customise the alias." +COM_COMPONENTBUILDER_CLASS_EXTENDS_SELECT_AN_OPTION="Select an option" +COM_COMPONENTBUILDER_CLASS_EXTENDS_STATUS="Status" +COM_COMPONENTBUILDER_CLASS_EXTENDS_VERSION_DESC="A count of the number of times this Class Extends has been revised." +COM_COMPONENTBUILDER_CLASS_EXTENDS_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_CLASS_METHOD="Class Method" +COM_COMPONENTBUILDER_CLASS_METHODS="Class Methods" +COM_COMPONENTBUILDER_CLASS_METHODS_ACCESS="Class Methods Access" +COM_COMPONENTBUILDER_CLASS_METHODS_ACCESS_DESC="Allows the users in this group to access access class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_OPTIONS="Batch process the selected Class Methods" +COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_TIP="All changes will be applied to all selected Class Methods" +COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE="Class Methods Batch Use" +COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_CREATE="Class Methods Create" +COM_COMPONENTBUILDER_CLASS_METHODS_CREATE_DESC="Allows the users in this group to create create class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_DELETE="Class Methods Delete" +COM_COMPONENTBUILDER_CLASS_METHODS_DELETE_DESC="Allows the users in this group to delete delete class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT="Class Methods Edit" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_CREATED_BY="Class Methods Edit Created By" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_CREATED_DATE="Class Methods Edit Created Date" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_DESC="Allows the users in this group to edit the class method" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_OWN="Class Methods Edit Own" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_OWN_DESC="Allows the users in this group to edit edit own class methods created by them" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_STATE="Class Methods Edit State" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_STATE_DESC="Allows the users in this group to update the state of the class method" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION="Class Methods Edit Version" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EXPORT="Class Methods Export" +COM_COMPONENTBUILDER_CLASS_METHODS_EXPORT_DESC="Allows the users in this group to export export class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_IMPORT="Class Methods Import" +COM_COMPONENTBUILDER_CLASS_METHODS_IMPORT_DESC="Allows the users in this group to import import class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_ARCHIVED="%s Class Methods archived." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_ARCHIVED_1="%s Class Method archived." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_CHECKED_IN_0="No Class Method successfully checked in." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_CHECKED_IN_1="%d Class Method successfully checked in." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_CHECKED_IN_MORE="%d Class Methods successfully checked in." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_DELETED="%s Class Methods deleted." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_DELETED_1="%s Class Method deleted." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_FEATURED="%s Class Methods featured." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_FEATURED_1="%s Class Method featured." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_PUBLISHED="%s Class Methods published." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_PUBLISHED_1="%s Class Method published." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_TRASHED="%s Class Methods trashed." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_TRASHED_1="%s Class Method trashed." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_UNFEATURED="%s Class Methods unfeatured." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_UNFEATURED_1="%s Class Method unfeatured." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_UNPUBLISHED="%s Class Methods unpublished." +COM_COMPONENTBUILDER_CLASS_METHODS_N_ITEMS_UNPUBLISHED_1="%s Class Method unpublished." +COM_COMPONENTBUILDER_CLASS_METHOD_ARGUMENTS="Arguments" +COM_COMPONENTBUILDER_CLASS_METHOD_ARGUMENTS_DESCRIPTION="You can add as many as you need, with comma separation." +COM_COMPONENTBUILDER_CLASS_METHOD_ARGUMENTS_HINT="$context, &$value" +COM_COMPONENTBUILDER_CLASS_METHOD_ARGUMENTS_LABEL="Params
    Method Arguments" +COM_COMPONENTBUILDER_CLASS_METHOD_CODE="Code" +COM_COMPONENTBUILDER_CLASS_METHOD_CODE_DESCRIPTION="Add the code here." +COM_COMPONENTBUILDER_CLASS_METHOD_CODE_LABEL="Code" +COM_COMPONENTBUILDER_CLASS_METHOD_COMMENT="Comment" +COM_COMPONENTBUILDER_CLASS_METHOD_COMMENT_DESCRIPTION="The comment" +COM_COMPONENTBUILDER_CLASS_METHOD_COMMENT_HINT="/** + * [NAME] + * + * [PARAMS] + * + */" +COM_COMPONENTBUILDER_CLASS_METHOD_COMMENT_LABEL="DocBlock" +COM_COMPONENTBUILDER_CLASS_METHOD_COMPONENTS="components" +COM_COMPONENTBUILDER_CLASS_METHOD_CREATED_BY_DESC="The user that created this Class Method." +COM_COMPONENTBUILDER_CLASS_METHOD_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_CLASS_METHOD_CREATED_DATE_DESC="The date this Class Method was created." +COM_COMPONENTBUILDER_CLASS_METHOD_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_CLASS_METHOD_DETAILS="Details" +COM_COMPONENTBUILDER_CLASS_METHOD_EDIT="Editing the Class Method" +COM_COMPONENTBUILDER_CLASS_METHOD_ERROR_UNIQUE_ALIAS="Another Class Method has the same alias." +COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE="Extension Type" +COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_DESCRIPTION="Extension type this class_method belongs to." +COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL="Extension Type" +COM_COMPONENTBUILDER_CLASS_METHOD_ID="Id" +COM_COMPONENTBUILDER_CLASS_METHOD_JOOMLA_PLUGIN_GROUP="Joomla Plugin Group" +COM_COMPONENTBUILDER_CLASS_METHOD_JOOMLA_PLUGIN_GROUP_LABEL="Joomla Plugin Group" +COM_COMPONENTBUILDER_CLASS_METHOD_MODIFIED_BY_DESC="The last user that modified this Class Method." +COM_COMPONENTBUILDER_CLASS_METHOD_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_CLASS_METHOD_MODIFIED_DATE_DESC="The date this Class Method was modified." +COM_COMPONENTBUILDER_CLASS_METHOD_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_CLASS_METHOD_MODULES="modules" +COM_COMPONENTBUILDER_CLASS_METHOD_NAME="Name" +COM_COMPONENTBUILDER_CLASS_METHOD_NAME_DESCRIPTION="Enter Name Here" +COM_COMPONENTBUILDER_CLASS_METHOD_NAME_HINT="Name Here" +COM_COMPONENTBUILDER_CLASS_METHOD_NAME_LABEL="Name" +COM_COMPONENTBUILDER_CLASS_METHOD_NAME_MESSAGE="Error! Please add name here." +COM_COMPONENTBUILDER_CLASS_METHOD_NEW="A New Class Method" +COM_COMPONENTBUILDER_CLASS_METHOD_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_CLASS_METHOD_PERMISSION="Permissions" +COM_COMPONENTBUILDER_CLASS_METHOD_PLUGINS="plugins" +COM_COMPONENTBUILDER_CLASS_METHOD_PRIVATE="private" +COM_COMPONENTBUILDER_CLASS_METHOD_PROTECTED="protected" +COM_COMPONENTBUILDER_CLASS_METHOD_PUBLIC="public" +COM_COMPONENTBUILDER_CLASS_METHOD_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_CLASS_METHOD_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Class Method to customise the alias." +COM_COMPONENTBUILDER_CLASS_METHOD_SELECT_AN_OPTION="Select an option" +COM_COMPONENTBUILDER_CLASS_METHOD_STATUS="Status" +COM_COMPONENTBUILDER_CLASS_METHOD_VERSION_DESC="A count of the number of times this Class Method has been revised." +COM_COMPONENTBUILDER_CLASS_METHOD_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY="Visibility" +COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_DESCRIPTION="The visibility of a function/method or property can be defined by prefixing the declaration with the keywords public, protected or private." +COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL="Visibility" +COM_COMPONENTBUILDER_CLASS_PROPERTIES="Class Properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_ACCESS="Class Properties Access" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_ACCESS_DESC="Allows the users in this group to access access class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_OPTIONS="Batch process the selected Class Properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_TIP="All changes will be applied to all selected Class Properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE="Class Properties Batch Use" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_CREATE="Class Properties Create" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_CREATE_DESC="Allows the users in this group to create create class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_DELETE="Class Properties Delete" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_DELETE_DESC="Allows the users in this group to delete delete class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT="Class Properties Edit" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_CREATED_BY="Class Properties Edit Created By" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_CREATED_DATE="Class Properties Edit Created Date" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_DESC="Allows the users in this group to edit the class property" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_OWN="Class Properties Edit Own" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_OWN_DESC="Allows the users in this group to edit edit own class properties created by them" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_STATE="Class Properties Edit State" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the class property" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION="Class Properties Edit Version" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EXPORT="Class Properties Export" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EXPORT_DESC="Allows the users in this group to export export class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_IMPORT="Class Properties Import" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_IMPORT_DESC="Allows the users in this group to import import class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_ARCHIVED="%s Class Properties archived." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_ARCHIVED_1="%s Class Property archived." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_CHECKED_IN_0="No Class Property successfully checked in." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_CHECKED_IN_1="%d Class Property successfully checked in." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_CHECKED_IN_MORE="%d Class Properties successfully checked in." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_DELETED="%s Class Properties deleted." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_DELETED_1="%s Class Property deleted." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_FEATURED="%s Class Properties featured." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_FEATURED_1="%s Class Property featured." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_PUBLISHED="%s Class Properties published." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_PUBLISHED_1="%s Class Property published." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_TRASHED="%s Class Properties trashed." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_TRASHED_1="%s Class Property trashed." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_UNFEATURED="%s Class Properties unfeatured." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_UNFEATURED_1="%s Class Property unfeatured." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_UNPUBLISHED="%s Class Properties unpublished." +COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_UNPUBLISHED_1="%s Class Property unpublished." +COM_COMPONENTBUILDER_CLASS_PROPERTY="Class Property" +COM_COMPONENTBUILDER_CLASS_PROPERTY_COMMENT="Comment" +COM_COMPONENTBUILDER_CLASS_PROPERTY_COMMENT_DESCRIPTION="The comment" +COM_COMPONENTBUILDER_CLASS_PROPERTY_COMMENT_HINT="/** + * [NAME] + * + * [PARAMS] + * + */" +COM_COMPONENTBUILDER_CLASS_PROPERTY_COMMENT_LABEL="DocBlock" +COM_COMPONENTBUILDER_CLASS_PROPERTY_COMPONENTS="components" +COM_COMPONENTBUILDER_CLASS_PROPERTY_CREATED_BY_DESC="The user that created this Class Property." +COM_COMPONENTBUILDER_CLASS_PROPERTY_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_CLASS_PROPERTY_CREATED_DATE_DESC="The date this Class Property was created." +COM_COMPONENTBUILDER_CLASS_PROPERTY_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_CLASS_PROPERTY_DEFAULT="Default" +COM_COMPONENTBUILDER_CLASS_PROPERTY_DEFAULT_DESCRIPTION="Enter default value" +COM_COMPONENTBUILDER_CLASS_PROPERTY_DEFAULT_HINT="Default Value Here" +COM_COMPONENTBUILDER_CLASS_PROPERTY_DEFAULT_LABEL="Default" +COM_COMPONENTBUILDER_CLASS_PROPERTY_DEFAULT_MESSAGE="Error! Please add default value here." +COM_COMPONENTBUILDER_CLASS_PROPERTY_DETAILS="Details" +COM_COMPONENTBUILDER_CLASS_PROPERTY_EDIT="Editing the Class Property" +COM_COMPONENTBUILDER_CLASS_PROPERTY_ERROR_UNIQUE_ALIAS="Another Class Property has the same alias." +COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE="Extension Type" +COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_DESCRIPTION="Extension type this class_property belongs to." +COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL="Extension Type" +COM_COMPONENTBUILDER_CLASS_PROPERTY_ID="Id" +COM_COMPONENTBUILDER_CLASS_PROPERTY_JOOMLA_PLUGIN_GROUP="Joomla Plugin Group" +COM_COMPONENTBUILDER_CLASS_PROPERTY_JOOMLA_PLUGIN_GROUP_LABEL="Joomla Plugin Group" +COM_COMPONENTBUILDER_CLASS_PROPERTY_MODIFIED_BY_DESC="The last user that modified this Class Property." +COM_COMPONENTBUILDER_CLASS_PROPERTY_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_CLASS_PROPERTY_MODIFIED_DATE_DESC="The date this Class Property was modified." +COM_COMPONENTBUILDER_CLASS_PROPERTY_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_CLASS_PROPERTY_MODULES="modules" +COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME="Name" +COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_DESCRIPTION="Enter Name Here" +COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_HINT="Name Here" +COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_LABEL="Name" +COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_MESSAGE="Error! Please add name here." +COM_COMPONENTBUILDER_CLASS_PROPERTY_NEW="A New Class Property" +COM_COMPONENTBUILDER_CLASS_PROPERTY_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_CLASS_PROPERTY_PERMISSION="Permissions" +COM_COMPONENTBUILDER_CLASS_PROPERTY_PLUGINS="plugins" +COM_COMPONENTBUILDER_CLASS_PROPERTY_PRIVATE="private" +COM_COMPONENTBUILDER_CLASS_PROPERTY_PROTECTED="protected" +COM_COMPONENTBUILDER_CLASS_PROPERTY_PUBLIC="public" +COM_COMPONENTBUILDER_CLASS_PROPERTY_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_CLASS_PROPERTY_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Class Property to customise the alias." +COM_COMPONENTBUILDER_CLASS_PROPERTY_SELECT_AN_OPTION="Select an option" +COM_COMPONENTBUILDER_CLASS_PROPERTY_STATUS="Status" +COM_COMPONENTBUILDER_CLASS_PROPERTY_VERSION_DESC="A count of the number of times this Class Property has been revised." +COM_COMPONENTBUILDER_CLASS_PROPERTY_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY="Visibility" +COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_DESCRIPTION="The visibility of a function/method or property can be defined by prefixing the declaration with the keywords public, protected or private." +COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL="Visibility" COM_COMPONENTBUILDER_CLEAR_TMP="Clear tmp" COM_COMPONENTBUILDER_CLONE="Clone" COM_COMPONENTBUILDER_CLONE_FAILED="Clone failed!" @@ -1775,6 +2065,46 @@ COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_UNFEATURED="%s Components P COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_UNFEATURED_1="%s Component Placeholders unfeatured." COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_UNPUBLISHED="%s Components Placeholders unpublished." COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_UNPUBLISHED_1="%s Component Placeholders unpublished." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS="Components Plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS="Components Plugins Access" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS_DESC="Allows the users in this group to access access components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_OPTIONS="Batch process the selected Components Plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_TIP="All changes will be applied to all selected Components Plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE="Components Plugins Batch Use" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE="Components Plugins Create" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE_DESC="Allows the users in this group to create create components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE="Components Plugins Delete" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE_DESC="Allows the users in this group to delete delete components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT="Components Plugins Edit" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY="Components Plugins Edit Created By" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE="Components Plugins Edit Created Date" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_DESC="Allows the users in this group to edit the component plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN="Components Plugins Edit Own" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN_DESC="Allows the users in this group to edit edit own components plugins created by them" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE="Components Plugins Edit State" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION="Components Plugins Edit Version" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_ARCHIVED="%s Components Plugins archived." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_ARCHIVED_1="%s Component Plugins archived." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_CHECKED_IN_0="No Component Plugins successfully checked in." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_CHECKED_IN_1="%d Component Plugins successfully checked in." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_CHECKED_IN_MORE="%d Components Plugins successfully checked in." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_DELETED="%s Components Plugins deleted." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_DELETED_1="%s Component Plugins deleted." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_FEATURED="%s Components Plugins featured." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_FEATURED_1="%s Component Plugins featured." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_PUBLISHED="%s Components Plugins published." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_PUBLISHED_1="%s Component Plugins published." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_TRASHED="%s Components Plugins trashed." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_TRASHED_1="%s Component Plugins trashed." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNFEATURED="%s Components Plugins unfeatured." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNFEATURED_1="%s Component Plugins unfeatured." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNPUBLISHED="%s Components Plugins unpublished." +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNPUBLISHED_1="%s Component Plugins unpublished." COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS="Components Site Views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS="Components Site Views Access" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS_DESC="Allows the users in this group to access access components site views" @@ -2485,7 +2815,11 @@ COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HEADER_DESCRIPTION="Enter Header Here" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HEADER_HINT="Header Here" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HEADER_LABEL="Header" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HEADER_MESSAGE="Error! Please add header here." -COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HTML_HINT="// Add the tab HTML here. To access php values methodname->value; ?>" +COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HTML_HINT="// Add the tab HTML here. +// To access php values MethodName->value; ?> +// Note the convention, if in the PHP area above you added a method called getMethodName() +// Then [MethodName] becomes a class variable called $this->MethodName +// Which will hold the value/s your method returned." COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HTML_LABEL="HTML" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_ID="Id" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_JOOMLA_COMPONENT="Joomla Component" @@ -2500,6 +2834,7 @@ COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NAME_HINT="Name Here" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NAME_LABEL="Name" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NEW="A New Component Dashboard" +COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NOTE_PHP_DASHBOARD_NOTE_DESCRIPTION="Adding custom PHP method to the dashboard model
    use the public function getMethodName() to insure the data is set to the view,
    Note the convention public function get...() replace the ... with the unique method name." COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_PERMISSION="Permissions" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_PHP_DASHBOARD_METHODS="Php Dashboard Methods" @@ -2683,7 +3018,7 @@ COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_PUBLISHING="Publishing" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Component Placeholders to customise the alias." COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_STATUS="Status" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_TARGET_DESCRIPTION="Set the text you would like to target as a placeholder" -COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_TARGET_HINT="[[[core]]]" +COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_TARGET_HINT="coral" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_TARGET_LABEL="Target String Placeholder" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_TARGET_MESSAGE="Error! That target placeholder text already exist. Please add an unique placeholder target." COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VALUE_DESCRIPTION="Set the text you would like to set as the replacement value for the targeted placeholder." @@ -2692,6 +3027,37 @@ COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VALUE_LABEL="Set String Value" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VALUE_MESSAGE="Error! Please add some set target value here." COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VERSION_DESC="A count of the number of times this Component Placeholders has been revised." COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS="Component Plugins" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS="Addjoomla Plugins" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS_DESCRIPTION="Setup the Joomla plugins for this component." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS_LABEL="Joomla Plugins" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_BY_DESC="The user that created this Component Plugins." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_DESC="The date this Component Plugins was created." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT="Editing the Component Plugins" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS="Another Component Plugins has the same alias." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ID="Id" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT="Joomla Component" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_LABEL="Component" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_BY_DESC="The last user that modified this Component Plugins." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_DATE_DESC="The date this Component Plugins was modified." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NEW="A New Component Plugins" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NOTE_ON_JOOMLA_PLUGINS_DESCRIPTION="Do not add the same Joomla plugins twice it will not work." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NOTE_ON_JOOMLA_PLUGINS_LABEL="Setting Joomla Plugins" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PERMISSION="Permissions" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PLUGIN="Plugin" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PLUGINS="Plugins" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PLUGIN_LABEL="Plugins" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Component Plugins to customise the alias." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_STATUS="Status" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_DESC="A count of the number of times this Component Plugins has been revised." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_LABEL="Revision" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS="Component Site Views" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ACCESS_DESCRIPTION="Select if this view
    should use access." COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ACCESS_LABEL="Add Access" @@ -2779,6 +3145,7 @@ COM_COMPONENTBUILDER_CONFIG_ADD_MENU_PREFIX_DESCRIPTION="Would you like to add a COM_COMPONENTBUILDER_CONFIG_ADD_MENU_PREFIX_LABEL="Add Menu Prefix" COM_COMPONENTBUILDER_CONFIG_ALMOST_FLAT_LOAD="Almost Flat" COM_COMPONENTBUILDER_CONFIG_ALPHANUMERIC="Alphanumeric" +COM_COMPONENTBUILDER_CONFIG_ALPHANUMERICDOT="Alphanumeric+dot" COM_COMPONENTBUILDER_CONFIG_API_DESCRIPTION="This User will be used to log the API call." COM_COMPONENTBUILDER_CONFIG_API_LABEL="API User" COM_COMPONENTBUILDER_CONFIG_AUTHOR="Author Info" @@ -3142,6 +3509,8 @@ COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_LABEL="Update Cycle" COM_COMPONENTBUILDER_CONFIG_STRING_MANIPULATION="String Manipulation" COM_COMPONENTBUILDER_CONFIG_TLS="TLS" COM_COMPONENTBUILDER_CONFIG_TRUE="True" +COM_COMPONENTBUILDER_CONFIG_TYPE_NAME_BUILDER_DESCRIPTION="The default option only uses alphabetical characters and converts all numbers in field names to the English equivalent like 1 becomes one.
    Alphanumeric+dot keeps the numbers unconverted unless it is at the beginning of the field name, and allows for a dot (.) to be used in the type name for namespacing." +COM_COMPONENTBUILDER_CONFIG_TYPE_NAME_BUILDER_LABEL="Field Type Name Builder
    (in compiler)" COM_COMPONENTBUILDER_CONFIG_UIKIT_DESC="The Parameters for the uikit are set here.
    Uikit is a lightweight and modular front-end framework for developing fast and powerful web interfaces. For more info visit https://getuikit.com/v2/" COM_COMPONENTBUILDER_CONFIG_UIKIT_LABEL="Uikit2 Settings" @@ -3160,6 +3529,9 @@ COM_COMPONENTBUILDER_CONTRIBUTORS="Contributors" COM_COMPONENTBUILDER_COPYRIGHT="Copyright" COM_COMPONENTBUILDER_COPYRIGHT_S="Copyright: %s" COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER="Could not clear the tmp folder!" +COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT="Could not install component!" +COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENTIONS="Could not install extentions!" +COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN="Could not install plugin!" COM_COMPONENTBUILDER_CREATE="Create" COM_COMPONENTBUILDER_CREATE_A_SNIPPET="create a snippet" COM_COMPONENTBUILDER_CREATE_NEW_S="Create new %s" @@ -3823,6 +4195,10 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION=" + + + + @@ -3885,7 +4261,7 @@ COM_COMPONENTBUILDER_DASHBOARD_GET_SNIPPETS="Get Snippets

    " COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENTS="Help Documents

    " COM_COMPONENTBUILDER_DASHBOARD_IMPORTJCBPACKAGES="Import JCB Packages

    " COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENTS="Joomla Components

    " -COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENT_ADD="Add Joomla Component

    " +COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_PLUGINS="Joomla Plugins

    " COM_COMPONENTBUILDER_DASHBOARD_LANGUAGE_TRANSLATIONS="Language Translations

    " COM_COMPONENTBUILDER_DASHBOARD_LAYOUTS="Layouts

    " COM_COMPONENTBUILDER_DASHBOARD_LAYOUT_ADD="Add Layout

    " @@ -4746,8 +5122,11 @@ COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB="Full Width in Tab" COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN="Function name already taken, please try again." COM_COMPONENTBUILDER_GENERAL_OVERVIEW_OF_HOW_THINGS_WORK_BSB="General overview of how things work: %s" COM_COMPONENTBUILDER_GETTING_AVAILABLE_LIBRARIES="Getting available libraries" +COM_COMPONENTBUILDER_GETTING_JOOMLA_PLUGIN_BOILERPLATE_FAILED_IF_THE_ISSUE_CONTINUES_INFORM_YOUR_SYSTEM_ADMINISTRATOR="Getting joomla_plugin boilerplate failed, if the issue continues, inform your system administrator!" +COM_COMPONENTBUILDER_GETTING_JOOMLA_PLUGIN_BOILERPLATE_WAS_SUCCESSFULLY="Getting joomla_plugin boilerplate was successfully!" COM_COMPONENTBUILDER_GET_ALL_NEW_SNIPPETS="Get All New Snippets" COM_COMPONENTBUILDER_GET_AN_ACCOUNT_WITH_GITHUB_BSB="Get an Account with gitHub: %s" +COM_COMPONENTBUILDER_GET_BOILERPLATE="Get Boilerplate" COM_COMPONENTBUILDER_GET_PACKAGE="Get Package" COM_COMPONENTBUILDER_GET_SNIPPET="Get snippet" COM_COMPONENTBUILDER_GET_SNIPPETS="Get Snippets" @@ -4777,6 +5156,7 @@ COM_COMPONENTBUILDER_GLUECODE="Glue/Code" COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK="Great, this function name will work!" COM_COMPONENTBUILDER_GREAT_THIS_PLACEHOLDER_WILL_WORK="Great, this placeholder will work!" COM_COMPONENTBUILDER_GREAT_THIS_VALIDATION_RULE_NAME_S_WILL_WORK="Great, this validation rule name (%s) will work!" +COM_COMPONENTBUILDER_GROUP="group" COM_COMPONENTBUILDER_HAS_METADATA="Has Metadata" COM_COMPONENTBUILDER_HELP_DOCUMENT="Help Document" COM_COMPONENTBUILDER_HELP_DOCUMENTS="Help Documents" @@ -4933,6 +5313,8 @@ COM_COMPONENTBUILDER_IMPORT_S="Import %s" COM_COMPONENTBUILDER_IMPORT_SELECT_FILE="Select File" COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_DIRECTORY="Set the path to file" COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_ADMIN_VIEWS="Select the file to import data to admin_views." +COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_METHODS="Select the file to import data to class_methods." +COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_PROPERTIES="Select the file to import data to class_properties." COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CUSTOM_ADMIN_VIEWS="Select the file to import data to custom_admin_views." COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CUSTOM_CODES="Select the file to import data to custom_codes." COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_DYNAMIC_GETS="Select the file to import data to dynamic_gets." @@ -4982,8 +5364,6 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CODE_NAME="Code Name" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_COMPANY_DETAILS="Company Details" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE="Joomla Components Create" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE_DESC="Allows the users in this group to create create joomla components" -COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD="Joomla Components Dashboard Add" -COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of joomla component" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST="Joomla Components Dashboard List" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of joomla component" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DELETE="Joomla Components Delete" @@ -5446,7 +5826,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_TARGET_DESCRIPTION="Select t COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_TARGET_LABEL="Update Server Target" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL="Update Server Url" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_DESCRIPTION="Enter Update Server URL" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_HINT="http://www.example.com/update/component.xml" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_HINT="http://www.example.com/update/extension_name.xml" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_LABEL="Update Server" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_MESSAGE="Error! Please add url here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_USE_DESCRIPTION="How should we link to this contributor." @@ -5482,6 +5862,504 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_URL_MESSAGE="Error! Please add websi COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES="Yes" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ZIP="ZIP" COM_COMPONENTBUILDER_JOOMLA_FIELDS="Joomla fields" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN="Joomla Plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS="Joomla Plugins" +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_OPTIONS="Batch process the selected Joomla Plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_TIP="All changes will be applied to all selected Joomla Plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE="Joomla Plugins Batch Use" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE="Joomla Plugins Create" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE_DESC="Allows the users in this group to create create joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DASHBOARD_LIST="Joomla Plugins Dashboard List" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of joomla plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DELETE="Joomla Plugins Delete" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DELETE_DESC="Allows the users in this group to delete delete joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT="Joomla Plugins Edit" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_CREATED_BY="Joomla Plugins Edit Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_CREATED_DATE="Joomla Plugins Edit Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_DESC="Allows the users in this group to edit the joomla plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_OWN="Joomla Plugins Edit Own" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_OWN_DESC="Allows the users in this group to edit edit own joomla plugins created by them" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_STATE="Joomla Plugins Edit State" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION="Joomla Plugins Edit Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS="Joomla Plugins Files, Folders & URLs" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_ACCESS="Joomla Plugins Files Folders Urls Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_ACCESS_DESC="Allows the users in this group to access access joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_OPTIONS="Batch process the selected Joomla Plugins Files, Folders & URLs" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_TIP="All changes will be applied to all selected Joomla Plugins Files, Folders & URLs" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE="Joomla Plugins Files Folders Urls Batch Use" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_CREATE="Joomla Plugins Files Folders Urls Create" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_CREATE_DESC="Allows the users in this group to create create joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_DELETE="Joomla Plugins Files Folders Urls Delete" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_DELETE_DESC="Allows the users in this group to delete delete joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT="Joomla Plugins Files Folders Urls Edit" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_CREATED_BY="Joomla Plugins Files Folders Urls Edit Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_CREATED_DATE="Joomla Plugins Files Folders Urls Edit Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_DESC="Allows the users in this group to edit the joomla plugin files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_OWN="Joomla Plugins Files Folders Urls Edit Own" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_OWN_DESC="Allows the users in this group to edit edit own joomla plugins files folders urls created by them" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE="Joomla Plugins Files Folders Urls Edit State" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION="Joomla Plugins Files Folders Urls Edit Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_ARCHIVED="%s Joomla Plugins Files, Folders & URLs archived." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_ARCHIVED_1="%s Joomla Plugin Files, Folders & URLs archived." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_CHECKED_IN_0="No Joomla Plugin Files, Folders & URLs successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_CHECKED_IN_1="%d Joomla Plugin Files, Folders & URLs successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_CHECKED_IN_MORE="%d Joomla Plugins Files, Folders & URLs successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_DELETED="%s Joomla Plugins Files, Folders & URLs deleted." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_DELETED_1="%s Joomla Plugin Files, Folders & URLs deleted." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_FEATURED="%s Joomla Plugins Files, Folders & URLs featured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_FEATURED_1="%s Joomla Plugin Files, Folders & URLs featured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_PUBLISHED="%s Joomla Plugins Files, Folders & URLs published." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_PUBLISHED_1="%s Joomla Plugin Files, Folders & URLs published." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_TRASHED="%s Joomla Plugins Files, Folders & URLs trashed." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_TRASHED_1="%s Joomla Plugin Files, Folders & URLs trashed." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_UNFEATURED="%s Joomla Plugins Files, Folders & URLs unfeatured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_UNFEATURED_1="%s Joomla Plugin Files, Folders & URLs unfeatured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_UNPUBLISHED="%s Joomla Plugins Files, Folders & URLs unpublished." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_UNPUBLISHED_1="%s Joomla Plugin Files, Folders & URLs unpublished." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_ARCHIVED="%s Joomla Plugins archived." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_ARCHIVED_1="%s Joomla Plugin archived." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_CHECKED_IN_0="No Joomla Plugin successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_CHECKED_IN_1="%d Joomla Plugin successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_CHECKED_IN_MORE="%d Joomla Plugins successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_DELETED="%s Joomla Plugins deleted." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_DELETED_1="%s Joomla Plugin deleted." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_FEATURED="%s Joomla Plugins featured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_FEATURED_1="%s Joomla Plugin featured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_PUBLISHED="%s Joomla Plugins published." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_PUBLISHED_1="%s Joomla Plugin published." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_TRASHED="%s Joomla Plugins trashed." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_TRASHED_1="%s Joomla Plugin trashed." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_UNFEATURED="%s Joomla Plugins unfeatured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_UNFEATURED_1="%s Joomla Plugin unfeatured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_UNPUBLISHED="%s Joomla Plugins unpublished." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_N_ITEMS_UNPUBLISHED_1="%s Joomla Plugin unpublished." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_SUBMENU="Joomla Plugins Submenu" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_SUBMENU_DESC="Allows the users in this group to submenu of joomla plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES="Joomla Plugins Updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS="Joomla Plugins Updates Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS_DESC="Allows the users in this group to access access joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_OPTIONS="Batch process the selected Joomla Plugins Updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_TIP="All changes will be applied to all selected Joomla Plugins Updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE="Joomla Plugins Updates Batch Use" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE="Joomla Plugins Updates Create" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE_DESC="Allows the users in this group to create create joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE="Joomla Plugins Updates Delete" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE_DESC="Allows the users in this group to delete delete joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT="Joomla Plugins Updates Edit" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_BY="Joomla Plugins Updates Edit Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_DATE="Joomla Plugins Updates Edit Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_DESC="Allows the users in this group to edit the joomla plugin updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN="Joomla Plugins Updates Edit Own" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN_DESC="Allows the users in this group to edit edit own joomla plugins updates created by them" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE="Joomla Plugins Updates Edit State" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION="Joomla Plugins Updates Edit Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_ARCHIVED="%s Joomla Plugins Updates archived." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_ARCHIVED_1="%s Joomla Plugin Updates archived." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_CHECKED_IN_0="No Joomla Plugin Updates successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_CHECKED_IN_1="%d Joomla Plugin Updates successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_CHECKED_IN_MORE="%d Joomla Plugins Updates successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_DELETED="%s Joomla Plugins Updates deleted." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_DELETED_1="%s Joomla Plugin Updates deleted." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_FEATURED="%s Joomla Plugins Updates featured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_FEATURED_1="%s Joomla Plugin Updates featured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_PUBLISHED="%s Joomla Plugins Updates published." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_PUBLISHED_1="%s Joomla Plugin Updates published." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_TRASHED="%s Joomla Plugins Updates trashed." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_TRASHED_1="%s Joomla Plugin Updates trashed." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNFEATURED="%s Joomla Plugins Updates unfeatured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNFEATURED_1="%s Joomla Plugin Updates unfeatured." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNPUBLISHED="%s Joomla Plugins Updates unpublished." +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Joomla Plugin Updates unpublished." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDREADME="Addreadme" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDREADME_LABEL="Add README" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD="Add Head" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_DESCRIPTION="You can add your own custom header script, combined with the default header script that make the extended class work." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_LABEL="Add Custom Class Header" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_METHOD_UNINSTALL="Add Php Method Uninstall" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP Method (uninstall)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_INSTALL="Add Php Postflight Install" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_INSTALL_LABEL="Add PHP Postflight (install)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_UPDATE="Add Php Postflight Update" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_UPDATE_LABEL="Add PHP Postflight (update)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_INSTALL="Add Php Preflight Install" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_INSTALL_LABEL="Add PHP Preflight (install)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UNINSTALL="Add Php Preflight Uninstall" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UNINSTALL_LABEL="Add PHP Preflight (uninstall)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UPDATE="Add Php Preflight Update" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UPDATE_LABEL="Add PHP Preflight (update)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_SCRIPT_CONSTRUCT="Add Php Script Construct" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_SCRIPT_CONSTRUCT_LABEL="Add PHP Script Construct" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SALES_SERVER="Add Sales Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SALES_SERVER_LABEL="Add Sales Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SQL="Add Sql" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SQL_LABEL="Add MySQL - (Install)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SQL_UNINSTALL="Add Sql Uninstall" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SQL_UNINSTALL_LABEL="Add MySQL - (Uninstall)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_UPDATE_SERVER="Add Update Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_UPDATE_SERVER_LABEL="Add Update Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS="Class Extends" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL="Extends" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CODE="Code" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CONFIGPARAMS="Config/Params" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CREATED_BY_DESC="The user that created this Joomla Plugin." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CREATED_DATE_DESC="The date this Joomla Plugin was created." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CUSTOM_VALUE_DESCRIPTION="Enter custom value if needed" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CUSTOM_VALUE_HINT="Custom Value Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CUSTOM_VALUE_LABEL="Custom Value" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_DESCRIPTION="Description" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_DESCRIPTION_HINT="Add Description Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_DESCRIPTION_LABEL="Description" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_DYNAMIC_INTEGRATION="Dynamic Integration" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_EDIT="Editing the Joomla Plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ERROR_UNIQUE_ALIAS="Another Joomla Plugin has the same alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELD="Field" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS="Fields" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_LABEL="Fields" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELD_DESCRIPTION="Select a field" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELD_LABEL="Field" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS="Joomla Plugin Files, Folders & URLs" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFILES="Addfiles" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFILESFULLPATH="Addfilesfullpath" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFILESFULLPATH_DESCRIPTION="Add files to this component using the full path." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFILESFULLPATH_LABEL="Files (full path)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFILES_DESCRIPTION="Add custom files to this component from the custom folder. Path: /administrator/components/com_componentbuilder/custom/" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFILES_LABEL="Files (custom folder)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFOLDERS="Addfolders" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFOLDERSFULLPATH="Addfoldersfullpath" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFOLDERSFULLPATH_DESCRIPTION="Add custom folder to this component using the full path." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFOLDERSFULLPATH_LABEL="Folder (full path)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFOLDERS_DESCRIPTION="Add custom folder to this component from the custom folder. Path: /administrator/components/com_componentbuilder/custom/" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFOLDERS_LABEL="Folder (custom folder)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDURLS="Addurls" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDURLS_DESCRIPTION="Add urls for this library." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDURLS_LABEL="URLs" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADVANCE="Advance" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_BASIC="Basic" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_CREATED_BY_DESC="The user that created this Joomla Plugin Files, Folders & URLs." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_CREATED_DATE_DESC="The date this Joomla Plugin Files, Folders & URLs was created." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_DEFAULT_LINK="Default (link)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_EDIT="Editing the Joomla Plugin Files, Folders & URLs" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS="Another Joomla Plugin Files, Folders & URLs has the same alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILE="File" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILEPATH_DESCRIPTION="Full System Path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILEPATH_HINT="/home/user/folder/file.php" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILEPATH_LABEL="File Path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILEPATH_MESSAGE="Error! Please add folder path here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILE_DESCRIPTION="Add the files to custom folder" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILE_LABEL="File" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FOLDER="Folder" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FOLDERPATH_DESCRIPTION="Full System Path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FOLDERPATH_HINT="/home/user/folder" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FOLDERPATH_LABEL="Folder Path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FOLDERPATH_MESSAGE="Error! Please add folder path here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FOLDER_DESCRIPTION="Add the folder to custom folder" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FOLDER_LABEL="Folder" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ID="Id" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_JOOMLA_PLUGIN="Joomla Plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_JOOMLA_PLUGIN_LABEL="Joomla Plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_LINK_LOCAL_DYNAMIC="Link & Local (dynamic)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_LOCAL_GET="Local (get)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_MODIFIED_BY_DESC="The last user that modified this Joomla Plugin Files, Folders & URLs." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_MODIFIED_DATE_DESC="The date this Joomla Plugin Files, Folders & URLs was modified." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NEW="A New Joomla Plugin Files, Folders & URLs" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FILES_DESCRIPTION="You can add custom files to the component, simply add the files to the administrator/components/com_componentbuilder/custom folder and then select them here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FILES_FULLPATH_DESCRIPTION="You can add any files to the component, by using the full system path. Example: /home/user/folder/file.php (make sure that php has permission to read the file)
    Please note that you can also use constant paths in your full path (directly without quotes), this is highly recommended to insure portability.
    To see a list of constant paths please read the notes below. Example: JPATH_ROOT/file.php or JPATH_ROOT/components/com_yourcomponentname/helpers/file.php" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FILES_FULLPATH_LABEL="Adding Files" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FILES_LABEL="Adding Custom Files" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_DESCRIPTION="You can add custom folders to the component, simply add the folders to the administrator/components/com_componentbuilder/custom folder and then select them here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_FULLPATH_DESCRIPTION="You can any folders to the component, by using the full system path. Example: /home/user/folder (make sure that php has permission to read the folder)
    Please note that you can also use constant paths in your full path (directly without quotes), this is highly recommended to insure portability.
    To see a list of constant paths please read the notes below. Example: JPATH_ROOT/folder or JPATH_ROOT/components/com_yourcomponentname/helpers/folder" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_FULLPATH_LABEL="Adding Folders" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_LABEL="Adding Custom Folders" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_URLS_DESCRIPTION="You can add urls here, and it can be used in three ways. As a direct link (default) or to get the file content and add it to the component (get) or as both local and link (dynamic)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_URLS_LABEL="Adding Urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_DESCRIPTION="

    // The path to the administrator folder.
    +JPATH_ADMINISTRATOR
    +// The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
    +JPATH_BASE
    +// The path to the cache folder.
    +JPATH_CACHE
    +// The path to the administration folder of JCB component.
    +JPATH_COMPONENT_ADMINISTRATOR no ideal to use
    +// The path to the site folder of JCB component.
    +JPATH_COMPONENT_SITE no ideal to use
    +// The path to the JCB component.
    +JPATH_COMPONENT no ideal to use
    +// The path to folder containing the configuration.php file.
    +JPATH_CONFIGURATION
    +// The path to the installation folder.
    +JPATH_INSTALLATION
    +// The path to the libraries folder.
    +JPATH_LIBRARIES
    +// The path to the plugins folder.
    +JPATH_PLUGINS
    +// The path to the installed Joomla! site.
    +JPATH_ROOT
    +// The path to the installed Joomla! site.
    +JPATH_SITE
    +// The path to the templates folder.
    +JPATH_THEMES

    + +

    JPATH_SITE is meant to represent the root path of the JSite application,
    +just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
    +JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
    +JPATH_BASE == JPATH_ADMINISTRATOR
    +If you are in the site application:
    +JPATH_BASE == JPATH_SITE
    +If you are in the installation application:
    +JPATH_BASE == JPATH_INSTALLATION.
    +JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

    " +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_LABEL="Constant Paths" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTNEW_DESCRIPTION="Should file be updated." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTNEW_LABEL="Update" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_PATH_DESCRIPTION="Path in relation to the folder structure in the install package, unzip the compiled zip file to see the structure." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_PATH_HINT="Target Path Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_PATH_LABEL="Target Path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_PATH_MESSAGE="Error! Please add target path." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_PERMISSION="Permissions" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_RENAME_LABEL="Rename" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Joomla Plugin Files, Folders & URLs to customise the alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_STATUS="Status" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_TYPE_DESCRIPTION="way url is used" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_TYPE_LABEL="Type" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_DESCRIPTION="Enter URL to file." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_HINT="http://www.example.com/file.js" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_LABEL="URL" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_MESSAGE="Error! Please add url here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_VERSION_DESC="A count of the number of times this Joomla Plugin Files, Folders & URLs has been revised." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GET_BOILERPLATE_BUTTON_ACCESS="Joomla Plugin Get Boilerplate Button Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GET_BOILERPLATE_BUTTON_ACCESS_DESC="Allows the users in this group to access the get boilerplate button." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP="Joomla Plugin Group" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS="Joomla Plugin Groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_ACCESS="Joomla Plugin Groups Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_ACCESS_DESC="Allows the users in this group to access access joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_OPTIONS="Batch process the selected Joomla Plugin Groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_TIP="All changes will be applied to all selected Joomla Plugin Groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE="Joomla Plugin Groups Batch Use" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION="Joomla Plugin Groups Edit Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_ARCHIVED="%s Joomla Plugin Groups archived." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_ARCHIVED_1="%s Joomla Plugin Group archived." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_CHECKED_IN_0="No Joomla Plugin Group successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_CHECKED_IN_1="%d Joomla Plugin Group successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_CHECKED_IN_MORE="%d Joomla Plugin Groups successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_DELETED="%s Joomla Plugin Groups deleted." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_DELETED_1="%s Joomla Plugin Group deleted." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_FEATURED="%s Joomla Plugin Groups featured." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_FEATURED_1="%s Joomla Plugin Group featured." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_PUBLISHED="%s Joomla Plugin Groups published." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_PUBLISHED_1="%s Joomla Plugin Group published." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_TRASHED="%s Joomla Plugin Groups trashed." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_TRASHED_1="%s Joomla Plugin Group trashed." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_UNFEATURED="%s Joomla Plugin Groups unfeatured." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_UNFEATURED_1="%s Joomla Plugin Group unfeatured." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_UNPUBLISHED="%s Joomla Plugin Groups unpublished." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_UNPUBLISHED_1="%s Joomla Plugin Group unpublished." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS="Class Extends" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_LABEL="Extends" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CREATED_BY_DESC="The user that created this Joomla Plugin Group." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CREATED_DATE_DESC="The date this Joomla Plugin Group was created." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_DETAILS="Details" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_EDIT="Editing the Joomla Plugin Group" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ERROR_UNIQUE_ALIAS="Another Joomla Plugin Group has the same alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ID="Id" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_MODIFIED_BY_DESC="The last user that modified this Joomla Plugin Group." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_MODIFIED_DATE_DESC="The date this Joomla Plugin Group was modified." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME="Name" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_DESCRIPTION="Enter Name Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_HINT="Name Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_LABEL="Name" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_MESSAGE="Error! Please add name here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NEW="A New Joomla Plugin Group" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_PERMISSION="Permissions" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Joomla Plugin Group to customise the alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_STATUS="Status" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_VERSION_DESC="A count of the number of times this Joomla Plugin Group has been revised." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_HEAD="Head" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_HEAD_DESCRIPTION="The class head, where JLoader, namespace and use is added, so that class being extended will work." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_HEAD_LABEL="Class Head" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ID="Id" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP="Joomla Plugin Group" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP_LABEL="Joomla Plugin Group" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MAIN_CLASS_CODE="Main Class Code" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MAIN_CLASS_CODE_DESCRIPTION="Add the class properties & methods here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MAIN_CLASS_CODE_LABEL="Class Properties & Methods" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHOD="Method" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS="Joomla Plugin Methods Button Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS_DESC="Allows the users in this group to access the methods button." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHOD_LABEL="Methods" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHOD_SELECTION="Method Selection" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHOD_SELECTION_DESCRIPTION="Select methods you want to use in your plugin class." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHOD_SELECTION_LABEL="Method Selection" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MODIFIED_BY_DESC="The last user that modified this Joomla Plugin." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MODIFIED_DATE_DESC="The date this Joomla Plugin was modified." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MYSQL="MySQL" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME="Name" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_DESCRIPTION="Enter Name Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_HINT="Name Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_LABEL="Name" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_MESSAGE="Error! Please add name here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NEW="A New Joomla Plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NO="No" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_LINKED_TO_NOTICE_DESCRIPTION="
    Searching the database.
    " +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_LINKED_TO_NOTICE_LABEL="Linked To" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_PLUGIN_DESCRIPTION="

    So over here you are able to manually code your plugin methods which usually will be the event name you are targeting.

    We have also added some methods via the boilerplate repo that can serve as a starting point, simple select them and it will be added to your code.

    If you have added any fields in the Config/Params tab, these fields will be available to you in the $this->params object, and can be accessed via the field name $this->params->get('fieldname'); with the get method.

    " +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_PLUGIN_LABEL="Easy Plugin Build Options" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_UPDATE_SERVER_NOTE_FTP_DESCRIPTION="During compilation the file will be moved to the server. You still need to point the above update server url to the xml file location on your server for it to work correctly." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_UPDATE_SERVER_NOTE_FTP_LABEL="Select the server used for your update server." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_UPDATE_SERVER_NOTE_OTHER_DESCRIPTION="Not really sure what other options to add.... so let me know. For now this option does not really do anything except adding the link above to your component as an update server. So it really could be called the manual option, since you will need to set the update server your self. You still need to point the above update server url to the manually created xml file for it to work correctly." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_UPDATE_SERVER_NOTE_OTHER_LABEL="The Other Options" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_UPDATE_SERVER_NOTE_ZIP_DESCRIPTION="The update server XML file will be added to the zipped package during compilation. You still need to point the above update server url to the xml wherever you have placed the files online." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_UPDATE_SERVER_NOTE_ZIP_LABEL="The ZIP Option" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOT_REQUIRED="Not Required" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_OTHER="Other" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PERMISSION="Permissions" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL="Php Method Uninstall" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_DESCRIPTION="PHP script that should run during uninstall." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_LABEL="PHP Method (uninstall)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_INSTALL="Php Postflight Install" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_INSTALL_DESCRIPTION="PHP script that should run postflight during install." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_INSTALL_LABEL="PHP Postflight (install)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_UPDATE="Php Postflight Update" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_UPDATE_DESCRIPTION="PHP script that should run postflight during update." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_UPDATE_LABEL="PHP Postflight (update)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_INSTALL="Php Preflight Install" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_INSTALL_DESCRIPTION="PHP script that should run preflight during install." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_INSTALL_LABEL="PHP Preflight (install)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UNINSTALL="Php Preflight Uninstall" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UNINSTALL_DESCRIPTION="PHP script that should run preflight during uninstall." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UNINSTALL_LABEL="PHP Preflight (uninstall)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UPDATE="Php Preflight Update" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UPDATE_DESCRIPTION="PHP script that should run preflight during update." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UPDATE_LABEL="PHP Preflight (update)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_SCRIPT_CONSTRUCT="Php Script Construct" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_SCRIPT_CONSTRUCT_DESCRIPTION="PHP script that should run in __construct of script." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_SCRIPT_CONSTRUCT_LABEL="PHP Script Construct" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_VERSION="Plugin Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_VERSION_DESCRIPTION="Add Version Number Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_VERSION_HINT="1.0.0" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_VERSION_LABEL="Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_VERSION_MESSAGE="Error! Please add version here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS="Joomla Plugin Properties Button Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS_DESC="Allows the users in this group to access the properties button." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTY="Property" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTY_LABEL="Properties" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTY_SELECTION="Property Selection" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTY_SELECTION_DESCRIPTION="Select properties you want to use in your plugin class." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTY_SELECTION_LABEL="Property Selection" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_README="Readme" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_README_LABEL="README.md" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS="Joomla Plugin Run Expansion Button Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SALES_SERVER="Sales Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SALES_SERVER_DESCRIPTION="Select your sales server for this component" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SALES_SERVER_LABEL="Sales Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Joomla Plugin to customise the alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SCRIPT_FILE="Script File" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SERVER="Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL="Sql" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL_DESCRIPTION="Add your MySQL here!" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL_HINT="// Add MySQL Table Dump Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL_LABEL="MySQL - (Install)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL_UNINSTALL="Sql Uninstall" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL_UNINSTALL_DESCRIPTION="Add your MySQL here for uninstall!" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL_UNINSTALL_HINT="// Add MySQL to uninstall Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL_UNINSTALL_LABEL="MySQL - (Uninstall)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_STATUS="Status" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SYSTEM_NAME="System Name" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SYSTEM_NAME_DESCRIPTION="Used only in the system." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SYSTEM_NAME_HINT="The System Name Here" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SYSTEM_NAME_LABEL="System Name" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SYSTEM_NAME_MESSAGE="Error! Please add some text here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES="Joomla Plugin Updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_CREATED_BY_DESC="The user that created this Joomla Plugin Updates." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_CREATED_DATE_DESC="The date this Joomla Plugin Updates was created." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_EDIT="Editing the Joomla Plugin Updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ERROR_UNIQUE_ALIAS="Another Joomla Plugin Updates has the same alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ID="Id" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_JOOMLA_PLUGIN="Joomla Plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_JOOMLA_PLUGIN_LABEL="Joomla Plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MODIFIED_BY_DESC="The last user that modified this Joomla Plugin Updates." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MODIFIED_DATE_DESC="The date this Joomla Plugin Updates was modified." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MYSQL_DESCRIPTION="Update Dump" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MYSQL_HINT="// MySQL for update or blank for none" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MYSQL_LABEL="MySQL" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_NEW="A New Joomla Plugin Updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_PERMISSION="Permissions" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Joomla Plugin Updates to customise the alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_STATUS="Status" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_UPDATES="Updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_URL_DESCRIPTION="Enter Download Link" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_URL_HINT="http://www.example.com/file.zip" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_URL_LABEL="Version URL" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_URL_MESSAGE="Error! Please add url here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_DESC="A count of the number of times this Joomla Plugin Updates has been revised." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_DESCRIPTION="1.0.0" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_HINT="1.0.0" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_MESSAGE="Error! Please add some text here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_UPDATE="Version Update" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_UPDATE_DESCRIPTION="Add Version Updates Here!" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_UPDATE_LABEL="Version Updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER="Update Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_DESCRIPTION="Select your update server for this component." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_LABEL="Update Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_TARGET="Update Server Target" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_TARGET_DESCRIPTION="Select the type of way you would like the update server to be set." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_TARGET_LABEL="Update Server Target" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_URL="Update Server Url" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_URL_DESCRIPTION="Enter Update Server URL" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_URL_HINT="http://www.example.com/update/extension_name.xml" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_URL_LABEL="Update Server" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_URL_MESSAGE="Error! Please add url here." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_VERSION_DESC="A count of the number of times this Joomla Plugin has been revised." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_YES="Yes" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ZIP="ZIP" COM_COMPONENTBUILDER_JUST_GET_ALL_SNIPPETS="Just Get All Snippets" COM_COMPONENTBUILDER_KEEP_HISTORY="Keep History" COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS="- Keep Original Access -" @@ -6059,8 +6937,8 @@ COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_SAVE_WARNING="Alias already exis COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_STATUS="Status" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_TYPE_DESCRIPTION="way url is used" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_TYPE_LABEL="Type" -COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_DESCRIPTION="Enter URL to library file." -COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_HINT="http://www.example.com/lib.js" +COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_DESCRIPTION="Enter URL to file." +COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_HINT="http://www.example.com/file.js" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_LABEL="URL" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_MESSAGE="Error! Please add url here." COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_VERSION_DESC="A count of the number of times this Library Files, Folders & URLs has been revised." @@ -6162,6 +7040,7 @@ COM_COMPONENTBUILDER_MATCH_FIELD="Match Field" COM_COMPONENTBUILDER_MATCH_OPTIONS="Match Options" COM_COMPONENTBUILDER_MAX_LENGTH_ONLY_FOUR_TEXT_FIELD="Max Length (only 4 text_field)" COM_COMPONENTBUILDER_MERGE="Merge" +COM_COMPONENTBUILDER_METHODS="Methods" COM_COMPONENTBUILDER_MINIFY_JAVASCRIPT="Minify JavaScript" COM_COMPONENTBUILDER_MIN_LENGTH_ONLY_FOUR_TEXT_FIELD="Min Length (only 4 text_field)" COM_COMPONENTBUILDER_MODEL_AFTER_MODELLING="Model (after modelling)" @@ -6203,7 +7082,10 @@ COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_ COM_COMPONENTBUILDER_NO_TYPE="No Type" COM_COMPONENTBUILDER_NO_VALIDATION_RULES_FOUND="No validation rules found." COM_COMPONENTBUILDER_OFFICIAL_VDM_PACKAGES="Official VDM Packages" +COM_COMPONENTBUILDER_ONLY_IN_ADMIN_LIST_VIEW="Only in Admin List View" +COM_COMPONENTBUILDER_ONLY_IN_LINKED_LIST_VIEWS="Only in Linked List Views" COM_COMPONENTBUILDER_ONLY_ONE_COMPONENT_CAN_BE_CLONED_AT_A_TIME_PLEASE_SELECT_ONE_AND_TRY_AGAIN="Only one component can be cloned at a time, please select one and try again!" +COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION="Only (%s.zip) file was removed the from tmp folder during installation!" COM_COMPONENTBUILDER_ONLY_USE_THE_BNONE_DBB_OPTION_IF_YOU_ARE_PLANNING_ON_TARGETING_THIS_FIELD_WITH_JAVASCRIPTCUSTOM_PHP_TO_MOVE_ITS_VALUE_INTO_ANOTHER_FIELD_THAT_DOES_GET_SAVED_TO_THE_DATABASE="Only use the None DB option if you are planning on targeting this field with JavaScript/Custom PHP to move its value into another field that does get saved to the database." COM_COMPONENTBUILDER_ON_GITHUB="on Github" COM_COMPONENTBUILDER_OPEN="Open" @@ -6308,6 +7190,10 @@ COM_COMPONENTBUILDER_PLACEHOLDER_NOTE_PLACEHOLDERS_PLACEDIN_DESCRIPTION=" + + + + @@ -6320,7 +7206,7 @@ COM_COMPONENTBUILDER_PLACEHOLDER_SAVE_WARNING="Alias already existed so a number COM_COMPONENTBUILDER_PLACEHOLDER_STATUS="Status" COM_COMPONENTBUILDER_PLACEHOLDER_TARGET="Target" COM_COMPONENTBUILDER_PLACEHOLDER_TARGET_DESCRIPTION="Set the text you would like to target as a placeholder" -COM_COMPONENTBUILDER_PLACEHOLDER_TARGET_HINT="[[[core]]]" +COM_COMPONENTBUILDER_PLACEHOLDER_TARGET_HINT="coral" COM_COMPONENTBUILDER_PLACEHOLDER_TARGET_LABEL="Target String Placeholder" COM_COMPONENTBUILDER_PLACEHOLDER_TARGET_MESSAGE="Error! That target placeholder text already exist. Please add an unique placeholder target." COM_COMPONENTBUILDER_PLACEHOLDER_VALUE="Value" @@ -6339,6 +7225,7 @@ COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONENT_THAT_YOU_WOULD_LIKE_TO_COMPILE="P COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER="Please try again later" COM_COMPONENTBUILDER_PLEASE_WAIT_CLEARING_THE_TMP_FOLDER="Please wait! Clearing the tmp folder" COM_COMPONENTBUILDER_PLEASE_WAIT_LOADING="Please wait, loading" +COM_COMPONENTBUILDER_PROPERTIES="Properties" COM_COMPONENTBUILDER_PROPERTIESBR_SMALLHERE_YOU_CAN_SET_THE_PROPERTIES_FOR_THIS_FIELDSMALL="Properties
    Here you can set the properties for this field." COM_COMPONENTBUILDER_PROPERTY="Property" COM_COMPONENTBUILDER_PROPERTY_ALREADY_SELECTED_TRY_ANOTHER="Property already selected, try another." @@ -6529,8 +7416,8 @@ COM_COMPONENTBUILDER_SHOULD_THE_ZIPPED_PACKAGE_OF_THE_COMPONENT_BE_MOVED_TO_THE_ COM_COMPONENTBUILDER_SHOULD_THIS_FIELD_BE_ESCAPED_IN_THE_LIST_VIEW="Should this field be escaped in the list view." COM_COMPONENTBUILDER_SHOULD_WE_BE_SHOWING_MORE_ELABORATE_INFORMATION_DURING_IMPORT="Should we be showing more elaborate information during import." COM_COMPONENTBUILDER_SHOULD_WE_FORCE_THE_UPDATE_OF_ALL_LOCAL_DATA_EVEN_IF_IT_IS_NEWER_THEN_THE_DATA_BEING_IMPORTED="Should we force the update of all local data, even if it is newer then the data being imported." -COM_COMPONENTBUILDER_SHOULD_WE_MERGE_THE_COMPONENTS_WITH_SIMILAR_LOCAL_COMPONENTS_MERGING_THE_COMPONENTS_USE_TO_BE_THE_DEFAULT_BEHAVIOUR_BUT_NOW_YOU_CAN_IMPORT_THE_COMPONENTS_AND_FORCE_IT_NOT_TO_MERGE_THE_FOLLOWING_AREAS_VALIDATION_RULE_FIELDTYPE_SNIPPET_LANGUAGE_LANGUAGE_TRANSLATION_BMUST_AND_WILL_STILLB_MERGE_EVEN_OF_YOUR_SELECTION_IS_BNOB_BECAUSE_OF_THE_SINGULAR_NATURE_OF_THOSE_AREAS="Should we merge the component/s with similar local component/s. Merging the component/s use to be the default behaviour, but now you can import the component/s and force it not to merge. The following areas (validation_rule, fieldtype, snippet, language, language_translation) must and will still merge even of your selection is No, because of the singular nature of those areas." -COM_COMPONENTBUILDER_SHOW_IN_LIST_VIEW="Show in list view" +COM_COMPONENTBUILDER_SHOULD_WE_MERGE_THE_COMPONENTS_WITH_SIMILAR_LOCAL_COMPONENTS_MERGING_THE_COMPONENTS_USE_TO_BE_THE_DEFAULT_BEHAVIOUR_BUT_NOW_YOU_CAN_IMPORT_THE_COMPONENTS_AND_FORCE_IT_NOT_TO_MERGE_THE_FOLLOWING_AREAS_VALIDATION_RULE_FIELDTYPE_SNIPPET_LANGUAGE_LANGUAGE_TRANSLATION_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_CLASS_PROPERTY_CLASS_METHOD_BMUST_AND_WILL_STILLB_MERGE_EVEN_OF_YOUR_SELECTION_IS_BNOB_BECAUSE_OF_THE_SINGULAR_NATURE_OF_THOSE_AREAS="Should we merge the component/s with similar local component/s. Merging the component/s use to be the default behaviour, but now you can import the component/s and force it not to merge. The following areas (validation_rule, fieldtype, snippet, language, language_translation, joomla_plugin_group, class_extends, class_property, class_method) must and will still merge even of your selection is No, because of the singular nature of those areas." +COM_COMPONENTBUILDER_SHOW_IN_ALL_LIST_VIEWS="Show in All List Views" COM_COMPONENTBUILDER_SHOW_ONLY="Show Only" COM_COMPONENTBUILDER_SHOW_TOGGLE="Show Toggle" COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB="Since the owner details are displayed during import process before adding the key, this way if the user/dev does not have the key they can see where to get it." @@ -7207,6 +8094,7 @@ COM_COMPONENTBUILDER_SUBMENU_FIELDTYPES="Fieldtypes" COM_COMPONENTBUILDER_SUBMENU_GET_SNIPPETS="Get Snippets" COM_COMPONENTBUILDER_SUBMENU_HELP_DOCUMENTS="Help Documents" COM_COMPONENTBUILDER_SUBMENU_JOOMLA_COMPONENTS="Joomla Components" +COM_COMPONENTBUILDER_SUBMENU_JOOMLA_PLUGINS="Joomla Plugins" COM_COMPONENTBUILDER_SUBMENU_LANGUAGES="Languages" COM_COMPONENTBUILDER_SUBMENU_LANGUAGE_TRANSLATIONS="Language Translations" COM_COMPONENTBUILDER_SUBMENU_LAYOUTS="Layouts" @@ -7220,6 +8108,8 @@ COM_COMPONENTBUILDER_SUBMENU_VALIDATION_RULES="Validation Rules" COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED="Success! The snippet was saved." COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED_BUT_THE_MODIFIED_DATE_COULD_NOT_BE_ADJUSTED_BR_BR_BTHIS_MEANS_THE_SNIPPETS_WILL_CONTINUE_TO_APPEAR_OUT_OF_DATEB="Success! The snippet was saved. But the modified date could not be adjusted.

    This means the snippets will continue to appear out of date." COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM="%szdEQzdmVsMHBtRW50T%sQFlvVXJTM3J2IXM=" +COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED="%s.zip could not be installed!" +COM_COMPONENTBUILDER_SZIP_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION="%s.zip was removed the from tmp folder during installation!" COM_COMPONENTBUILDER_S_BEING_IMPORTED="%s Being Imported" COM_COMPONENTBUILDER_S_NOT_LINKED="%s Not Linked" COM_COMPONENTBUILDER_S_PLEASE_WAIT_THE_COMPONENT_IS_BEING_COMPILED="%s, please wait! The component is being compiled" @@ -7381,6 +8271,7 @@ COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD="The component dashboard" COM_COMPONENTBUILDER_THE_COMPONENT_FILES_FOLDERS="The component files & folders" COM_COMPONENTBUILDER_THE_COMPONENT_MYSQL_TWEAKS="The component mysql tweaks" COM_COMPONENTBUILDER_THE_COMPONENT_PLACEHOLDERS="The component placeholders" +COM_COMPONENTBUILDER_THE_COMPONENT_PLUGINS="The component plugins" COM_COMPONENTBUILDER_THE_COMPONENT_SITE_VIEWS="The component site views" COM_COMPONENTBUILDER_THE_COMPONENT_UPDATES="The component updates" COM_COMPONENTBUILDER_THE_COMPONENT_WITH_ALL_LINKED_ADMIN_VIEWS_FIELDS_LINKED_TO_ADMIN_VIEWS_CUSTOM_ADMIN_VIEWS_SITE_VIEWS_TEMPLATES_AND_LAYOUTS_WERE_CLONED_SUCCESSFUL="The Component with all linked admin views, fields linked to admin views, custom admin views, site views, templates and layouts were cloned successful!" @@ -7394,6 +8285,8 @@ COM_COMPONENTBUILDER_THE_NAME_OF_THIS_LIBRARY_BSB_CAN_NOT_BE_CHANGED_TO_BSB_OR_T COM_COMPONENTBUILDER_THE_NOTICE_BOARD_IS_LOADING="The notice board is loading" COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE="The package key is: %s" COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S="The package key is: %s" +COM_COMPONENTBUILDER_THE_PLUGIN_FILES_FOLDERS="The plugin files & folders" +COM_COMPONENTBUILDER_THE_PLUGIN_UPDATES="The plugin updates" COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER="The private key field could not be loaded for %s server!" COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER="The private key file could not be loaded/found for %s server!" COM_COMPONENTBUILDER_THE_README_IS_LOADING="The readme is loading" @@ -7511,6 +8404,8 @@ COM_COMPONENTBUILDER_VALIDATION_RULE_PHP_DESCRIPTION="Add your PHP here! [Do not COM_COMPONENTBUILDER_VALIDATION_RULE_PHP_HINT="// PHP class methods and fields can be added here" COM_COMPONENTBUILDER_VALIDATION_RULE_PHP_LABEL="PHP (class methods)" COM_COMPONENTBUILDER_VALIDATION_RULE_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_VALIDATION_RULE_RUN_EXPANSION_BUTTON_ACCESS="Validation Rule Run Expansion Button Access" +COM_COMPONENTBUILDER_VALIDATION_RULE_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button." COM_COMPONENTBUILDER_VALIDATION_RULE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Validation Rule to customise the alias." COM_COMPONENTBUILDER_VALIDATION_RULE_SHORT_DESCRIPTION="Short Description" COM_COMPONENTBUILDER_VALIDATION_RULE_SHORT_DESCRIPTION_DESCRIPTION="Enter short description" @@ -7550,7 +8445,11 @@ COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LI 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 (%s - denied), 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_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to import a component, please contact your system administrator for more help." +COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THESE_EXTENSIONS="You do not have permission to install these extensions!" +COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT="You do not have permission to install the component!" +COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN="You do not have permission to install the plugin!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE="You do not have permission to run the expansion module!" +COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE="You do not have permission to run the get boilerplate module!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_TRANSLATOR_MODULE="You do not have permission to run the translator module!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to share the snippets, please contact your system administrator for more help." COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTICE="You have %s %s. Adding more then %s %s is considered bad practice." diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini index 4d342ddc2..82b14321e 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini @@ -111,6 +111,74 @@ COM_COMPONENTBUILDER_ADMIN_VIEWS_SUBMENU="Admin Views Submenu" COM_COMPONENTBUILDER_ADMIN_VIEWS_SUBMENU_DESC="Allows the users in this group to submenu of admin view" COM_COMPONENTBUILDER_ADMIN_VIEW_RUN_EXPANSION_BUTTON_ACCESS="Admin View Run Expansion Button Access" COM_COMPONENTBUILDER_ADMIN_VIEW_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button." +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_ACCESS="Class Extendings Access" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_ACCESS_DESC="Allows the users in this group to access access class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE="Class Extendings Batch Use" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_CREATE="Class Extendings Create" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_CREATE_DESC="Allows the users in this group to create create class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_DELETE="Class Extendings Delete" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_DELETE_DESC="Allows the users in this group to delete delete class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT="Class Extendings Edit" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_CREATED_BY="Class Extendings Edit Created By" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_CREATED_DATE="Class Extendings Edit Created Date" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_DESC="Allows the users in this group to edit the class extends" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_OWN="Class Extendings Edit Own" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_OWN_DESC="Allows the users in this group to edit edit own class extendings created by them" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_STATE="Class Extendings Edit State" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_STATE_DESC="Allows the users in this group to update the state of the class extends" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION="Class Extendings Edit Version" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class extendings" +COM_COMPONENTBUILDER_CLASS_METHODS_ACCESS="Class Methods Access" +COM_COMPONENTBUILDER_CLASS_METHODS_ACCESS_DESC="Allows the users in this group to access access class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE="Class Methods Batch Use" +COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_CREATE="Class Methods Create" +COM_COMPONENTBUILDER_CLASS_METHODS_CREATE_DESC="Allows the users in this group to create create class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_DELETE="Class Methods Delete" +COM_COMPONENTBUILDER_CLASS_METHODS_DELETE_DESC="Allows the users in this group to delete delete class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT="Class Methods Edit" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_CREATED_BY="Class Methods Edit Created By" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_CREATED_DATE="Class Methods Edit Created Date" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_DESC="Allows the users in this group to edit the class method" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_OWN="Class Methods Edit Own" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_OWN_DESC="Allows the users in this group to edit edit own class methods created by them" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_STATE="Class Methods Edit State" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_STATE_DESC="Allows the users in this group to update the state of the class method" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION="Class Methods Edit Version" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EXPORT="Class Methods Export" +COM_COMPONENTBUILDER_CLASS_METHODS_EXPORT_DESC="Allows the users in this group to export export class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_IMPORT="Class Methods Import" +COM_COMPONENTBUILDER_CLASS_METHODS_IMPORT_DESC="Allows the users in this group to import import class methods" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_ACCESS="Class Properties Access" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_ACCESS_DESC="Allows the users in this group to access access class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE="Class Properties Batch Use" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_CREATE="Class Properties Create" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_CREATE_DESC="Allows the users in this group to create create class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_DELETE="Class Properties Delete" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_DELETE_DESC="Allows the users in this group to delete delete class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT="Class Properties Edit" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_CREATED_BY="Class Properties Edit Created By" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_CREATED_DATE="Class Properties Edit Created Date" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_DESC="Allows the users in this group to edit the class property" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_OWN="Class Properties Edit Own" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_OWN_DESC="Allows the users in this group to edit edit own class properties created by them" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_STATE="Class Properties Edit State" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the class property" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION="Class Properties Edit Version" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EXPORT="Class Properties Export" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EXPORT_DESC="Allows the users in this group to export export class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_IMPORT="Class Properties Import" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_IMPORT_DESC="Allows the users in this group to import import class properties" COM_COMPONENTBUILDER_COMPILER_ACCESS="Compiler Access" COM_COMPONENTBUILDER_COMPILER_ACCESS_DESC="Allows the users in this group to access compiler." COM_COMPONENTBUILDER_COMPILER_CLEAR_TMP_BUTTON_ACCESS="Compiler Clear tmp Button Access" @@ -283,6 +351,26 @@ COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE="Components Placeholders COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION="Components Placeholders Edit Version" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components placeholders" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS="Components Plugins Access" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS_DESC="Allows the users in this group to access access components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE="Components Plugins Batch Use" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE="Components Plugins Create" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE_DESC="Allows the users in this group to create create components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE="Components Plugins Delete" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE_DESC="Allows the users in this group to delete delete components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT="Components Plugins Edit" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY="Components Plugins Edit Created By" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE="Components Plugins Edit Created Date" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_DESC="Allows the users in this group to edit the component plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN="Components Plugins Edit Own" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN_DESC="Allows the users in this group to edit edit own components plugins created by them" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE="Components Plugins Edit State" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION="Components Plugins Edit Version" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components plugins" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS="Components Site Views Access" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS_DESC="Allows the users in this group to access access components site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE="Components Site Views Batch Use" @@ -520,8 +608,6 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE="Joomla Components Batch Use" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE="Joomla Components Create" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE_DESC="Allows the users in this group to create create joomla components" -COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD="Joomla Components Dashboard Add" -COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of joomla component" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST="Joomla Components Dashboard List" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of joomla component" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DELETE="Joomla Components Delete" @@ -552,6 +638,84 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC="Allows the users in this group to access the import jcb packages button." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RUN_EXPANSION_BUTTON_ACCESS="Joomla Component Run Expansion Button Access" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion 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" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE="Joomla Plugins Create" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE_DESC="Allows the users in this group to create create joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DASHBOARD_LIST="Joomla Plugins Dashboard List" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of joomla plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DELETE="Joomla Plugins Delete" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DELETE_DESC="Allows the users in this group to delete delete joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT="Joomla Plugins Edit" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_CREATED_BY="Joomla Plugins Edit Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_CREATED_DATE="Joomla Plugins Edit Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_DESC="Allows the users in this group to edit the joomla plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_OWN="Joomla Plugins Edit Own" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_OWN_DESC="Allows the users in this group to edit edit own joomla plugins created by them" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_STATE="Joomla Plugins Edit State" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION="Joomla Plugins Edit Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_ACCESS="Joomla Plugins Files Folders Urls Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_ACCESS_DESC="Allows the users in this group to access access joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE="Joomla Plugins Files Folders Urls Batch Use" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_CREATE="Joomla Plugins Files Folders Urls Create" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_CREATE_DESC="Allows the users in this group to create create joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_DELETE="Joomla Plugins Files Folders Urls Delete" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_DELETE_DESC="Allows the users in this group to delete delete joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT="Joomla Plugins Files Folders Urls Edit" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_CREATED_BY="Joomla Plugins Files Folders Urls Edit Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_CREATED_DATE="Joomla Plugins Files Folders Urls Edit Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_DESC="Allows the users in this group to edit the joomla plugin files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_OWN="Joomla Plugins Files Folders Urls Edit Own" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_OWN_DESC="Allows the users in this group to edit edit own joomla plugins files folders urls created by them" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE="Joomla Plugins Files Folders Urls Edit State" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION="Joomla Plugins Files Folders Urls Edit Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_SUBMENU="Joomla Plugins Submenu" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_SUBMENU_DESC="Allows the users in this group to submenu of joomla plugin" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS="Joomla Plugins Updates Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS_DESC="Allows the users in this group to access access joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE="Joomla Plugins Updates Batch Use" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE="Joomla Plugins Updates Create" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE_DESC="Allows the users in this group to create create joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE="Joomla Plugins Updates Delete" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE_DESC="Allows the users in this group to delete delete joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT="Joomla Plugins Updates Edit" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_BY="Joomla Plugins Updates Edit Created By" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_DATE="Joomla Plugins Updates Edit Created Date" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_DESC="Allows the users in this group to edit the joomla plugin updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN="Joomla Plugins Updates Edit Own" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN_DESC="Allows the users in this group to edit edit own joomla plugins updates created by them" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE="Joomla Plugins Updates Edit State" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION="Joomla Plugins Updates Edit Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GET_BOILERPLATE_BUTTON_ACCESS="Joomla Plugin Get Boilerplate Button Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GET_BOILERPLATE_BUTTON_ACCESS_DESC="Allows the users in this group to access the get boilerplate button." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_ACCESS="Joomla Plugin Groups Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_ACCESS_DESC="Allows the users in this group to access access joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE="Joomla Plugin Groups Batch Use" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION="Joomla Plugin Groups Edit Version" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS="Joomla Plugin Methods Button Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS_DESC="Allows the users in this group to access the methods button." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS="Joomla Plugin Properties Button Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS_DESC="Allows the users in this group to access the properties button." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS="Joomla Plugin Run Expansion Button Access" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button." COM_COMPONENTBUILDER_LANGUAGES_ACCESS="Languages Access" COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC="Allows the users in this group to access access languages" COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE="Languages Batch Use" @@ -700,6 +864,7 @@ COM_COMPONENTBUILDER_MENU_FIELDS="Fields" COM_COMPONENTBUILDER_MENU_FIELDTYPES="Fieldtypes" COM_COMPONENTBUILDER_MENU_HELP_DOCUMENTS="Help Documents" COM_COMPONENTBUILDER_MENU_JOOMLA_COMPONENTS="Joomla Components" +COM_COMPONENTBUILDER_MENU_JOOMLA_PLUGINS="Joomla Plugins" COM_COMPONENTBUILDER_MENU_LANGUAGE_TRANSLATIONS="Language Translations" COM_COMPONENTBUILDER_MENU_LAYOUTS="Layouts" COM_COMPONENTBUILDER_MENU_LIBRARIES="Libraries" @@ -885,4 +1050,6 @@ COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT_DESC="Allows the users in this grou COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT="Validation Rules Import" COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT_DESC="Allows the users in this group to import import validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU="Validation Rules Submenu" -COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU_DESC="Allows the users in this group to submenu of validation rule" \ No newline at end of file +COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU_DESC="Allows the users in this group to submenu of validation rule" +COM_COMPONENTBUILDER_VALIDATION_RULE_RUN_EXPANSION_BUTTON_ACCESS="Validation Rule Run Expansion Button Access" +COM_COMPONENTBUILDER_VALIDATION_RULE_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button." \ No newline at end of file diff --git a/admin/layouts/class_extends/details_fullwidth.php b/admin/layouts/class_extends/details_fullwidth.php new file mode 100644 index 000000000..ea642173e --- /dev/null +++ b/admin/layouts/class_extends/details_fullwidth.php @@ -0,0 +1,44 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'head' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/class_extends/details_left.php b/admin/layouts/class_extends/details_left.php new file mode 100644 index 000000000..58bb36566 --- /dev/null +++ b/admin/layouts/class_extends/details_left.php @@ -0,0 +1,43 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'extension_type' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_extends/details_right.php b/admin/layouts/class_extends/details_right.php new file mode 100644 index 000000000..b8b2905dc --- /dev/null +++ b/admin/layouts/class_extends/details_right.php @@ -0,0 +1,42 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'comment' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_extends/index.html b/admin/layouts/class_extends/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/layouts/class_extends/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/class_extends/publishing.php b/admin/layouts/class_extends/publishing.php new file mode 100644 index 000000000..68e3657ce --- /dev/null +++ b/admin/layouts/class_extends/publishing.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_extends/publlshing.php b/admin/layouts/class_extends/publlshing.php new file mode 100644 index 000000000..a7ff8580c --- /dev/null +++ b/admin/layouts/class_extends/publlshing.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_method/details_fullwidth.php b/admin/layouts/class_method/details_fullwidth.php new file mode 100644 index 000000000..9ca23c02f --- /dev/null +++ b/admin/layouts/class_method/details_fullwidth.php @@ -0,0 +1,44 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'code' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/class_method/details_left.php b/admin/layouts/class_method/details_left.php new file mode 100644 index 000000000..ebfdf3913 --- /dev/null +++ b/admin/layouts/class_method/details_left.php @@ -0,0 +1,46 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'arguments', + 'visibility', + 'extension_type', + 'joomla_plugin_group' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_method/details_right.php b/admin/layouts/class_method/details_right.php new file mode 100644 index 000000000..b8b2905dc --- /dev/null +++ b/admin/layouts/class_method/details_right.php @@ -0,0 +1,42 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'comment' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_method/index.html b/admin/layouts/class_method/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/layouts/class_method/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/class_method/publishing.php b/admin/layouts/class_method/publishing.php new file mode 100644 index 000000000..68e3657ce --- /dev/null +++ b/admin/layouts/class_method/publishing.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_method/publlshing.php b/admin/layouts/class_method/publlshing.php new file mode 100644 index 000000000..a7ff8580c --- /dev/null +++ b/admin/layouts/class_method/publlshing.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_property/details_left.php b/admin/layouts/class_property/details_left.php new file mode 100644 index 000000000..8b5a1db11 --- /dev/null +++ b/admin/layouts/class_property/details_left.php @@ -0,0 +1,46 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'visibility', + 'default', + 'extension_type', + 'joomla_plugin_group' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_property/details_right.php b/admin/layouts/class_property/details_right.php new file mode 100644 index 000000000..b8b2905dc --- /dev/null +++ b/admin/layouts/class_property/details_right.php @@ -0,0 +1,42 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'comment' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_property/index.html b/admin/layouts/class_property/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/layouts/class_property/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/class_property/publishing.php b/admin/layouts/class_property/publishing.php new file mode 100644 index 000000000..68e3657ce --- /dev/null +++ b/admin/layouts/class_property/publishing.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/class_property/publlshing.php b/admin/layouts/class_property/publlshing.php new file mode 100644 index 000000000..a7ff8580c --- /dev/null +++ b/admin/layouts/class_property/publlshing.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/component_dashboard/dashboard_fullwidth.php b/admin/layouts/component_dashboard/dashboard_fullwidth.php index 075cab4d6..86317ad03 100644 --- a/admin/layouts/component_dashboard/dashboard_fullwidth.php +++ b/admin/layouts/component_dashboard/dashboard_fullwidth.php @@ -26,6 +26,7 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( + 'note_php_dashboard_note', 'php_dashboard_methods', 'dashboard_tab' ); diff --git a/admin/layouts/component_plugins/index.html b/admin/layouts/component_plugins/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/layouts/component_plugins/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/component_plugins/plugins_above.php b/admin/layouts/component_plugins/plugins_above.php new file mode 100644 index 000000000..0da7e528d --- /dev/null +++ b/admin/layouts/component_plugins/plugins_above.php @@ -0,0 +1,44 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'joomla_component' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/component_plugins/plugins_fullwidth.php b/admin/layouts/component_plugins/plugins_fullwidth.php new file mode 100644 index 000000000..c08bbb95d --- /dev/null +++ b/admin/layouts/component_plugins/plugins_fullwidth.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'note_on_joomla_plugins', + 'addjoomla_plugins' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/component_plugins/publishing.php b/admin/layouts/component_plugins/publishing.php new file mode 100644 index 000000000..68e3657ce --- /dev/null +++ b/admin/layouts/component_plugins/publishing.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/component_plugins/publlshing.php b/admin/layouts/component_plugins/publlshing.php new file mode 100644 index 000000000..a7ff8580c --- /dev/null +++ b/admin/layouts/component_plugins/publlshing.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/fieldtype/fields_fullwidth.php b/admin/layouts/fieldtype/fields_fullwidth.php index 87f383cbc..32758b02f 100644 --- a/admin/layouts/fieldtype/fields_fullwidth.php +++ b/admin/layouts/fieldtype/fields_fullwidth.php @@ -13,7 +13,7 @@ defined('_JEXEC') or die('Restricted access'); // set the defaults -$items = $displayData->warfields; +$items = $displayData->vxwfields; $user = JFactory::getUser(); $id = $displayData->item->id; // set the edit URL diff --git a/admin/layouts/joomla_plugin/code_above.php b/admin/layouts/joomla_plugin/code_above.php new file mode 100644 index 000000000..09a20fa91 --- /dev/null +++ b/admin/layouts/joomla_plugin/code_above.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'system_name', + 'plugin_version' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_plugin/code_fullwidth.php b/admin/layouts/joomla_plugin/code_fullwidth.php new file mode 100644 index 000000000..7f50a4885 --- /dev/null +++ b/admin/layouts/joomla_plugin/code_fullwidth.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'head', + 'main_class_code', + 'note_linked_to_notice', + 'not_required' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_plugin/code_left.php b/admin/layouts/joomla_plugin/code_left.php new file mode 100644 index 000000000..288731f37 --- /dev/null +++ b/admin/layouts/joomla_plugin/code_left.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'description', + 'class_extends', + 'joomla_plugin_group', + 'add_head', + 'note_plugin' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin/code_right.php b/admin/layouts/joomla_plugin/code_right.php new file mode 100644 index 000000000..3758c5d79 --- /dev/null +++ b/admin/layouts/joomla_plugin/code_right.php @@ -0,0 +1,43 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'property_selection', + 'method_selection' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin/configparams_fullwidth.php b/admin/layouts/joomla_plugin/configparams_fullwidth.php new file mode 100644 index 000000000..c3f86b0bd --- /dev/null +++ b/admin/layouts/joomla_plugin/configparams_fullwidth.php @@ -0,0 +1,44 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'fields' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_plugin/dynamic_integration_left.php b/admin/layouts/joomla_plugin/dynamic_integration_left.php new file mode 100644 index 000000000..45d0c1960 --- /dev/null +++ b/admin/layouts/joomla_plugin/dynamic_integration_left.php @@ -0,0 +1,50 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'add_update_server', + 'update_server_url', + 'update_server_target', + 'note_update_server_note_ftp', + 'note_update_server_note_zip', + 'note_update_server_note_other', + 'update_server', + 'add_sales_server', + 'sales_server' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin/index.html b/admin/layouts/joomla_plugin/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/layouts/joomla_plugin/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/joomla_plugin/mysql_fullwidth.php b/admin/layouts/joomla_plugin/mysql_fullwidth.php new file mode 100644 index 000000000..95a45a88b --- /dev/null +++ b/admin/layouts/joomla_plugin/mysql_fullwidth.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'add_sql', + 'sql', + 'add_sql_uninstall', + 'sql_uninstall' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_plugin/publishing.php b/admin/layouts/joomla_plugin/publishing.php new file mode 100644 index 000000000..68e3657ce --- /dev/null +++ b/admin/layouts/joomla_plugin/publishing.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin/publlshing.php b/admin/layouts/joomla_plugin/publlshing.php new file mode 100644 index 000000000..a7ff8580c --- /dev/null +++ b/admin/layouts/joomla_plugin/publlshing.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin/readme_left.php b/admin/layouts/joomla_plugin/readme_left.php new file mode 100644 index 000000000..bc6fda557 --- /dev/null +++ b/admin/layouts/joomla_plugin/readme_left.php @@ -0,0 +1,43 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'addreadme', + 'readme' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin/script_file_fullwidth.php b/admin/layouts/joomla_plugin/script_file_fullwidth.php new file mode 100644 index 000000000..caacca282 --- /dev/null +++ b/admin/layouts/joomla_plugin/script_file_fullwidth.php @@ -0,0 +1,57 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'add_php_script_construct', + 'php_script_construct', + 'add_php_preflight_install', + 'php_preflight_install', + 'add_php_preflight_update', + 'php_preflight_update', + 'add_php_preflight_uninstall', + 'php_preflight_uninstall', + 'add_php_postflight_install', + 'php_postflight_install', + 'add_php_postflight_update', + 'php_postflight_update', + 'add_php_method_uninstall', + 'php_method_uninstall' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_plugin_files_folders_urls/advance_fullwidth.php b/admin/layouts/joomla_plugin_files_folders_urls/advance_fullwidth.php new file mode 100644 index 000000000..b5112d859 --- /dev/null +++ b/admin/layouts/joomla_plugin_files_folders_urls/advance_fullwidth.php @@ -0,0 +1,48 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'note_add_files_fullpath', + 'addfilesfullpath', + 'note_add_folders_fullpath', + 'addfoldersfullpath', + 'note_constant_paths' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_plugin_files_folders_urls/basic_above.php b/admin/layouts/joomla_plugin_files_folders_urls/basic_above.php new file mode 100644 index 000000000..a5b493763 --- /dev/null +++ b/admin/layouts/joomla_plugin_files_folders_urls/basic_above.php @@ -0,0 +1,44 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'joomla_plugin' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_plugin_files_folders_urls/basic_fullwidth.php b/admin/layouts/joomla_plugin_files_folders_urls/basic_fullwidth.php new file mode 100644 index 000000000..60e54aae2 --- /dev/null +++ b/admin/layouts/joomla_plugin_files_folders_urls/basic_fullwidth.php @@ -0,0 +1,49 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'note_add_urls', + 'addurls', + 'note_add_files', + 'addfiles', + 'note_add_folders', + 'addfolders' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_plugin_files_folders_urls/index.html b/admin/layouts/joomla_plugin_files_folders_urls/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/layouts/joomla_plugin_files_folders_urls/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/joomla_plugin_files_folders_urls/publishing.php b/admin/layouts/joomla_plugin_files_folders_urls/publishing.php new file mode 100644 index 000000000..68e3657ce --- /dev/null +++ b/admin/layouts/joomla_plugin_files_folders_urls/publishing.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin_files_folders_urls/publlshing.php b/admin/layouts/joomla_plugin_files_folders_urls/publlshing.php new file mode 100644 index 000000000..a7ff8580c --- /dev/null +++ b/admin/layouts/joomla_plugin_files_folders_urls/publlshing.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin_group/details_left.php b/admin/layouts/joomla_plugin_group/details_left.php new file mode 100644 index 000000000..18159298f --- /dev/null +++ b/admin/layouts/joomla_plugin_group/details_left.php @@ -0,0 +1,42 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin_group/details_right.php b/admin/layouts/joomla_plugin_group/details_right.php new file mode 100644 index 000000000..897b29793 --- /dev/null +++ b/admin/layouts/joomla_plugin_group/details_right.php @@ -0,0 +1,42 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'class_extends' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin_group/index.html b/admin/layouts/joomla_plugin_group/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/layouts/joomla_plugin_group/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/joomla_plugin_group/publishing.php b/admin/layouts/joomla_plugin_group/publishing.php new file mode 100644 index 000000000..68e3657ce --- /dev/null +++ b/admin/layouts/joomla_plugin_group/publishing.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin_group/publlshing.php b/admin/layouts/joomla_plugin_group/publlshing.php new file mode 100644 index 000000000..a7ff8580c --- /dev/null +++ b/admin/layouts/joomla_plugin_group/publlshing.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin_updates/index.html b/admin/layouts/joomla_plugin_updates/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/layouts/joomla_plugin_updates/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/joomla_plugin_updates/publishing.php b/admin/layouts/joomla_plugin_updates/publishing.php new file mode 100644 index 000000000..68e3657ce --- /dev/null +++ b/admin/layouts/joomla_plugin_updates/publishing.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin_updates/publlshing.php b/admin/layouts/joomla_plugin_updates/publlshing.php new file mode 100644 index 000000000..a7ff8580c --- /dev/null +++ b/admin/layouts/joomla_plugin_updates/publlshing.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_plugin_updates/updates_above.php b/admin/layouts/joomla_plugin_updates/updates_above.php new file mode 100644 index 000000000..a5b493763 --- /dev/null +++ b/admin/layouts/joomla_plugin_updates/updates_above.php @@ -0,0 +1,44 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'joomla_plugin' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_plugin_updates/updates_fullwidth.php b/admin/layouts/joomla_plugin_updates/updates_fullwidth.php new file mode 100644 index 000000000..37710d615 --- /dev/null +++ b/admin/layouts/joomla_plugin_updates/updates_fullwidth.php @@ -0,0 +1,44 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'version_update' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/server/linked_components_fullwidth.php b/admin/layouts/server/linked_components_fullwidth.php index 859a76e18..03920a738 100644 --- a/admin/layouts/server/linked_components_fullwidth.php +++ b/admin/layouts/server/linked_components_fullwidth.php @@ -13,7 +13,7 @@ defined('_JEXEC') or die('Restricted access'); // set the defaults -$items = $displayData->wbblinked_components; +$items = $displayData->vyglinked_components; $user = JFactory::getUser(); $id = $displayData->item->id; // set the edit URL @@ -83,11 +83,7 @@ else - escape($item->component_version); ?> - 'component_dashboard', 'views' => 'components_dashboard', 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD'), - 'icon' => 'dashboard') + 'icon' => 'dashboard'), + array( + 'view' => 'component_plugins', + 'views' => 'components_plugins', + 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_PLUGINS'), + 'icon' => 'power-cord') ); } ?>
    get($_button['view'].'.edit') && ($id = ComponentbuilderHelper::getVar($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?> - + get($_button['view'].'.create')): ?> - +
    @@ -167,9 +168,9 @@ else
    get($_button['view'].'.edit') && ($id = ComponentbuilderHelper::getVar($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?> - + get($_button['view'].'.create')): ?> - +
    @@ -181,9 +182,9 @@ else
    get($_button['view'].'.edit') && ($id = ComponentbuilderHelper::getVar($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?> - + get($_button['view'].'.create')): ?> - +
    diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index 60b101f90..cd22a3bdd 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -540,7 +540,6 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->ajax_input = $ajax_input->toArray(); } - if (empty($item->id)) { $id = 0; @@ -617,6 +616,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin { $item->mysql_table_collate = 'utf8_general_ci'; } + if (!empty($item->id)) { @@ -1414,11 +1414,12 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['metadata'] = (string) $metadata; } - // if system name is empty create from name_single + // if system name is empty create a system name from the name_single if (empty($data['system_name']) || !ComponentbuilderHelper::checkString($data['system_name'])) { $data['system_name'] = $data['name_single']; - } + } + // Set the addtables items to data. if (isset($data['addtables']) && is_array($data['addtables'])) diff --git a/admin/models/ajax.php b/admin/models/ajax.php index c72d9bd91..00e8ac331 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -249,6 +249,35 @@ class ComponentbuilderModelAjax extends JModelList return function_exists('curl_version'); } + // Used in joomla_plugin + public function getClassCode($id, $type) + { + return ComponentbuilderHelper::getClassCode($id, $type); + } + + public function getClassCodeIds($id, $type) + { + if ('property' === $type || 'method' === $type) + { + return ComponentbuilderHelper::getVars('class_' . $type, $id, 'joomla_plugin_group', 'id'); + } + elseif ('joomla_plugin_group' === $type) + { + return ComponentbuilderHelper::getVars($type, $id, 'class_extends', 'id'); + } + return false; + } + + public function getClassHeaderCode($id, $type) + { + if ('extends' === $type && ($head = ComponentbuilderHelper::getVar('class_' . $type, $id, 'id', 'head')) !== false && ComponentbuilderHelper::checkString($head)) + { + return base64_decode($head); + } + return false; + } + + // Used in admin_view protected $viewid = array(); @@ -1022,11 +1051,17 @@ class ComponentbuilderModelAjax extends JModelList switch ($value) { case 1: - return JText::_('COM_COMPONENTBUILDER_SHOW_IN_LIST_VIEW'); + return JText::_('COM_COMPONENTBUILDER_SHOW_IN_ALL_LIST_VIEWS'); break; case 2: return JText::_('COM_COMPONENTBUILDER_NONE_DB'); break; + case 3: + return JText::_('COM_COMPONENTBUILDER_ONLY_IN_ADMIN_LIST_VIEW'); + break; + case 4: + return JText::_('COM_COMPONENTBUILDER_ONLY_IN_LINKED_LIST_VIEWS'); + break; default: return JText::_('COM_COMPONENTBUILDER_DEFAULT'); break; @@ -2381,6 +2416,35 @@ class ComponentbuilderModelAjax extends JModelList 'views' => 'validation_rules', 'not_base64' => array(), 'name' => 'name' + ), + // #__componentbuilder_joomla_plugin (q) + 'joomla_plugin' => array( + 'search' => array('id', 'system_name', 'name', 'main_class_code', 'description', 'php_script_construct', 'php_preflight_install', 'php_preflight_update', + 'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall'), + 'views' => 'joomla_plugins', + 'not_base64' => array('description' => 'string'), + 'name' => 'system_name' + ), + // #__componentbuilder_class_extends (r) + 'class_extends' => array( + 'search' => array('id', 'name', 'head', 'comment'), + 'views' => 'class_extendings', + 'not_base64' => array(), + 'name' => 'name' + ), + // #__componentbuilder_class_property (s) + 'class_property' => array( + 'search' => array('id', 'name', 'default', 'comment'), + 'views' => 'class_properties', + 'not_base64' => array(), + 'name' => 'name' + ), + // #__componentbuilder_class_method (t) + 'class_method' => array( + 'search' => array('id', 'name', 'code', 'comment'), + 'views' => 'class_methods', + 'not_base64' => array(), + 'name' => 'name' ) ); @@ -2721,7 +2785,7 @@ class ComponentbuilderModelAjax extends JModelList foreach($field['php'] as $name => $values) { $value = implode(PHP_EOL, $values['value']); - $textarea = $this->buildFieldTexteara($name, $values['desc'], $value, substr_count( $value, PHP_EOL )); + $textarea = $this->buildFieldTextarea($name, $values['desc'], $value, substr_count( $value, PHP_EOL )); // load the html $field['textarea'][] = '
    '. $textarea->label . '
    ' . $textarea->input . '

    '; } @@ -2761,7 +2825,7 @@ class ComponentbuilderModelAjax extends JModelList return null; } - protected function buildFieldTexteara($name, $desc, $default, $rows) + protected function buildFieldTextarea($name, $desc, $default, $rows) { // get the textarea $textarea = JFormHelper::loadFieldType('textarea', true); diff --git a/admin/models/class_extendings.php b/admin/models/class_extendings.php new file mode 100644 index 000000000..37a3781f0 --- /dev/null +++ b/admin/models/class_extendings.php @@ -0,0 +1,297 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_extendings Model + */ +class ComponentbuilderModelClass_extendings extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.extension_type','extension_type' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + $this->setState('filter.name', $name); + + $extension_type = $this->getUserStateFromRequest($this->context . '.filter.extension_type', 'filter_extension_type'); + $this->setState('filter.extension_type', $extension_type); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + $access = (JFactory::getUser()->authorise('class_extends.access', 'com_componentbuilder.class_extends.' . (int) $item->id) && JFactory::getUser()->authorise('class_extends.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // set selection value to a translatable value + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert extension_type + $item->extension_type = $this->selectionTranslation($item->extension_type, 'extension_type'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of extension_type language strings + if ($name === 'extension_type') + { + $extension_typeArray = array( + 0 => 'COM_COMPONENTBUILDER_CLASS_EXTENDS_SELECT_AN_OPTION', + 'components' => 'COM_COMPONENTBUILDER_CLASS_EXTENDS_COMPONENTS', + 'plugins' => 'COM_COMPONENTBUILDER_CLASS_EXTENDS_PLUGINS', + 'modules' => 'COM_COMPONENTBUILDER_CLASS_EXTENDS_MODULES' + ); + // Now check if value is found in this array + if (isset($extension_typeArray[$value]) && ComponentbuilderHelper::checkString($extension_typeArray[$value])) + { + return $extension_typeArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_class_extends', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.extension_type LIKE '.$search.' OR a.head LIKE '.$search.' OR a.comment LIKE '.$search.')'); + } + } + + // Filter by Extension_type. + if ($extension_type = $this->getState('filter.extension_type')) + { + $query->where('a.extension_type = ' . $db->quote($db->escape($extension_type))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.extension_type'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_class_extends')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__componentbuilder_class_extends'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/class_extends.php b/admin/models/class_extends.php new file mode 100644 index 000000000..e76ee6c01 --- /dev/null +++ b/admin/models/class_extends.php @@ -0,0 +1,945 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Componentbuilder Class_extends Model + */ +class ComponentbuilderModelClass_extends extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'name', + 'extension_type' + ), + 'right' => array( + 'comment' + ), + 'fullwidth' => array( + 'head' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.class_extends'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'class_extends', $prefix = 'ComponentbuilderTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * get VDM session key + * + * @return string the session key + * + */ + public function getVDM() + { + return $this->vastDevMod; + } + + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->head)) + { + // base64 Decode head. + $item->head = base64_decode($item->head); + } + + if (!empty($item->comment)) + { + // base64 Decode comment. + $item->comment = base64_decode($item->comment); + } + + + if (empty($item->id)) + { + $id = 0; + } + else + { + $id = $item->id; + } + // set the id and view name to session + if ($vdm = ComponentbuilderHelper::get('class_extends__'.$id)) + { + $this->vastDevMod = $vdm; + } + else + { + // set the vast development method key + $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + ComponentbuilderHelper::set($this->vastDevMod, 'class_extends__'.$id); + ComponentbuilderHelper::set('class_extends__'.$id, $this->vastDevMod); + // set a return value if found + $jinput = JFactory::getApplication()->input; + $return = $jinput->get('return', null, 'base64'); + ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_componentbuilder.class_extends'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // Get the form. + $form = $this->loadForm('com_componentbuilder.class_extends', 'class_extends', $options); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('class_extends.edit.state', 'com_componentbuilder.class_extends.' . (int) $id)) + || ($id == 0 && !$user->authorise('class_extends.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('class_extends.edit.created_by', 'com_componentbuilder.class_extends.' . (int) $id)) + || ($id == 0 && !$user->authorise('class_extends.edit.created_by', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('class_extends.edit.created', 'com_componentbuilder.class_extends.' . (int) $id)) + || ($id == 0 && !$user->authorise('class_extends.edit.created', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + // update all editors to use this components global editor + $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields + $editors = $form->getXml()->xpath("//field[@type='editor']"); + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) + { + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_componentbuilder/models/forms/class_extends.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('class_extends.delete', 'com_componentbuilder.class_extends.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('class_extends.edit.state', 'com_componentbuilder.class_extends.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('class_extends.edit.state', 'com_componentbuilder'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('class_extends.edit', 'com_componentbuilder'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_class_extends')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.class_extends.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('class_extends'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('class_extends'); + } + + if (!$this->canDo->get('class_extends.create') && !$this->canDo->get('class_extends.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('class_extends.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('class_extends.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + { + $this->table->name = $this->generateUniqe('name',$this->table->name); + } + + // insert all set values + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('class_extends'); + } + + if (!$this->canDo->get('class_extends.edit') && !$this->canDo->get('class_extends.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('class_extends.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('class_extends.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // make sure the name is safe to be used as a class name + $data['name'] = ComponentbuilderHelper::safeClassFunctionName($data['name']); + + // Set the head string to base64 string. + if (isset($data['head'])) + { + $data['head'] = base64_encode($data['head']); + } + + // Set the comment string to base64 string. + if (isset($data['comment'])) + { + $data['comment'] = base64_encode($data['comment']); + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/class_method.php b/admin/models/class_method.php new file mode 100644 index 000000000..d6a4a8f97 --- /dev/null +++ b/admin/models/class_method.php @@ -0,0 +1,996 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Componentbuilder Class_method Model + */ +class ComponentbuilderModelClass_method extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'name', + 'arguments', + 'visibility', + 'extension_type', + 'joomla_plugin_group' + ), + 'right' => array( + 'comment' + ), + 'fullwidth' => array( + 'code' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.class_method'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'class_method', $prefix = 'ComponentbuilderTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * get VDM session key + * + * @return string the session key + * + */ + public function getVDM() + { + return $this->vastDevMod; + } + + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->code)) + { + // base64 Decode code. + $item->code = base64_decode($item->code); + } + + if (!empty($item->comment)) + { + // base64 Decode comment. + $item->comment = base64_decode($item->comment); + } + + if (!empty($item->arguments)) + { + // base64 Decode arguments. + $item->arguments = base64_decode($item->arguments); + } + + + if (empty($item->id)) + { + $id = 0; + } + else + { + $id = $item->id; + } + // set the id and view name to session + if ($vdm = ComponentbuilderHelper::get('class_method__'.$id)) + { + $this->vastDevMod = $vdm; + } + else + { + // set the vast development method key + $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + ComponentbuilderHelper::set($this->vastDevMod, 'class_method__'.$id); + ComponentbuilderHelper::set('class_method__'.$id, $this->vastDevMod); + // set a return value if found + $jinput = JFactory::getApplication()->input; + $return = $jinput->get('return', null, 'base64'); + ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_componentbuilder.class_method'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // Get the form. + $form = $this->loadForm('com_componentbuilder.class_method', 'class_method', $options); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('class_method.edit.state', 'com_componentbuilder.class_method.' . (int) $id)) + || ($id == 0 && !$user->authorise('class_method.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('class_method.edit.created_by', 'com_componentbuilder.class_method.' . (int) $id)) + || ($id == 0 && !$user->authorise('class_method.edit.created_by', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('class_method.edit.created', 'com_componentbuilder.class_method.' . (int) $id)) + || ($id == 0 && !$user->authorise('class_method.edit.created', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + // update all editors to use this components global editor + $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields + $editors = $form->getXml()->xpath("//field[@type='editor']"); + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) + { + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_componentbuilder/models/forms/class_method.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('class_method.delete', 'com_componentbuilder.class_method.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('class_method.edit.state', 'com_componentbuilder.class_method.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('class_method.edit.state', 'com_componentbuilder'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('class_method.edit', 'com_componentbuilder.class_method.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('class_method.edit', 'com_componentbuilder'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_class_method')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.class_method.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to validate the form data. + * + * @param JForm $form The form to validate against. + * @param array $data The data to validate. + * @param string $group The name of the field group to validate. + * + * @return mixed Array of filtered data if valid, false otherwise. + * + * @see JFormRule + * @see JFilterInput + * @since 12.2 + */ + public function validate($form, $data, $group = null) + { + // check if the not_required field is set + if (ComponentbuilderHelper::checkString($data['not_required'])) + { + $requiredFields = (array) explode(',',(string) $data['not_required']); + $requiredFields = array_unique($requiredFields); + // now change the required field attributes value + foreach ($requiredFields as $requiredField) + { + // make sure there is a string value + if (ComponentbuilderHelper::checkString($requiredField)) + { + // change to false + $form->setFieldAttribute($requiredField, 'required', 'false'); + // also clear the data set + $data[$requiredField] = ''; + } + } + } + return parent::validate($form, $data, $group); + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('class_method'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('class_method'); + } + + if (!$this->canDo->get('class_method.create') && !$this->canDo->get('class_method.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('class_method.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('class_method.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + { + $this->table->name = $this->generateUniqe('name',$this->table->name); + } + + // insert all set values + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('class_method'); + } + + if (!$this->canDo->get('class_method.edit') && !$this->canDo->get('class_method.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('class_method.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('class_method.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // make sure the name is safe to be used as a function name + $data['name'] = ComponentbuilderHelper::safeClassFunctionName($data['name']); + + // Set the code string to base64 string. + if (isset($data['code'])) + { + $data['code'] = base64_encode($data['code']); + } + + // Set the comment string to base64 string. + if (isset($data['comment'])) + { + $data['comment'] = base64_encode($data['comment']); + } + + // Set the arguments string to base64 string. + if (isset($data['arguments'])) + { + $data['arguments'] = base64_encode($data['arguments']); + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/class_methods.php b/admin/models/class_methods.php new file mode 100644 index 000000000..fd5ee8b88 --- /dev/null +++ b/admin/models/class_methods.php @@ -0,0 +1,431 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_methods Model + */ +class ComponentbuilderModelClass_methods extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.visibility','visibility', + 'a.extension_type','extension_type' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + $this->setState('filter.name', $name); + + $visibility = $this->getUserStateFromRequest($this->context . '.filter.visibility', 'filter_visibility'); + $this->setState('filter.visibility', $visibility); + + $extension_type = $this->getUserStateFromRequest($this->context . '.filter.extension_type', 'filter_extension_type'); + $this->setState('filter.extension_type', $extension_type); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + $access = (JFactory::getUser()->authorise('class_method.access', 'com_componentbuilder.class_method.' . (int) $item->id) && JFactory::getUser()->authorise('class_method.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // set selection value to a translatable value + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert visibility + $item->visibility = $this->selectionTranslation($item->visibility, 'visibility'); + // convert extension_type + $item->extension_type = $this->selectionTranslation($item->extension_type, 'extension_type'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of visibility language strings + if ($name === 'visibility') + { + $visibilityArray = array( + 'public' => 'COM_COMPONENTBUILDER_CLASS_METHOD_PUBLIC', + 'protected' => 'COM_COMPONENTBUILDER_CLASS_METHOD_PROTECTED', + 'private' => 'COM_COMPONENTBUILDER_CLASS_METHOD_PRIVATE' + ); + // Now check if value is found in this array + if (isset($visibilityArray[$value]) && ComponentbuilderHelper::checkString($visibilityArray[$value])) + { + return $visibilityArray[$value]; + } + } + // Array of extension_type language strings + if ($name === 'extension_type') + { + $extension_typeArray = array( + 0 => 'COM_COMPONENTBUILDER_CLASS_METHOD_SELECT_AN_OPTION', + 'components' => 'COM_COMPONENTBUILDER_CLASS_METHOD_COMPONENTS', + 'plugins' => 'COM_COMPONENTBUILDER_CLASS_METHOD_PLUGINS', + 'modules' => 'COM_COMPONENTBUILDER_CLASS_METHOD_MODULES' + ); + // Now check if value is found in this array + if (isset($extension_typeArray[$value]) && ComponentbuilderHelper::checkString($extension_typeArray[$value])) + { + return $extension_typeArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_class_method', 'a')); + + // From the componentbuilder_joomla_plugin_group table. + $query->select($db->quoteName('g.name','joomla_plugin_group_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_plugin_group', 'g') . ' ON (' . $db->quoteName('a.joomla_plugin_group') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.visibility LIKE '.$search.' OR a.extension_type LIKE '.$search.' OR a.comment LIKE '.$search.' OR a.arguments LIKE '.$search.')'); + } + } + + // Filter by Visibility. + if ($visibility = $this->getState('filter.visibility')) + { + $query->where('a.visibility = ' . $db->quote($db->escape($visibility))); + } + // Filter by Extension_type. + if ($extension_type = $this->getState('filter.extension_type')) + { + $query->where('a.extension_type = ' . $db->quote($db->escape($extension_type))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks) + { + // setup the query + if (ComponentbuilderHelper::checkArray($pks)) + { + // Set a value to know this is exporting method. + $_export = true; + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_class_method table + $query->from($db->quoteName('#__componentbuilder_class_method', 'a')); + $query->where('a.id IN (' . implode(',',$pks) . ')'); + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // set values to display correctly. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + $access = (JFactory::getUser()->authorise('class_method.access', 'com_componentbuilder.class_method.' . (int) $item->id) && JFactory::getUser()->authorise('class_method.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + // decode code + $item->code = base64_decode($item->code); + // decode comment + $item->comment = base64_decode($item->comment); + // decode arguments + $item->arguments = base64_decode($item->arguments); + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (ComponentbuilderHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__componentbuilder_class_method"); + if (ComponentbuilderHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.visibility'); + $id .= ':' . $this->getState('filter.extension_type'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_class_method')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__componentbuilder_class_method'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/class_properties.php b/admin/models/class_properties.php new file mode 100644 index 000000000..e5d157df0 --- /dev/null +++ b/admin/models/class_properties.php @@ -0,0 +1,429 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_properties Model + */ +class ComponentbuilderModelClass_properties extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.visibility','visibility', + 'a.extension_type','extension_type' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + $this->setState('filter.name', $name); + + $visibility = $this->getUserStateFromRequest($this->context . '.filter.visibility', 'filter_visibility'); + $this->setState('filter.visibility', $visibility); + + $extension_type = $this->getUserStateFromRequest($this->context . '.filter.extension_type', 'filter_extension_type'); + $this->setState('filter.extension_type', $extension_type); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + $access = (JFactory::getUser()->authorise('class_property.access', 'com_componentbuilder.class_property.' . (int) $item->id) && JFactory::getUser()->authorise('class_property.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // set selection value to a translatable value + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert visibility + $item->visibility = $this->selectionTranslation($item->visibility, 'visibility'); + // convert extension_type + $item->extension_type = $this->selectionTranslation($item->extension_type, 'extension_type'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of visibility language strings + if ($name === 'visibility') + { + $visibilityArray = array( + 'public' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_PUBLIC', + 'protected' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_PROTECTED', + 'private' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_PRIVATE' + ); + // Now check if value is found in this array + if (isset($visibilityArray[$value]) && ComponentbuilderHelper::checkString($visibilityArray[$value])) + { + return $visibilityArray[$value]; + } + } + // Array of extension_type language strings + if ($name === 'extension_type') + { + $extension_typeArray = array( + 0 => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_SELECT_AN_OPTION', + 'components' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_COMPONENTS', + 'plugins' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_PLUGINS', + 'modules' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_MODULES' + ); + // Now check if value is found in this array + if (isset($extension_typeArray[$value]) && ComponentbuilderHelper::checkString($extension_typeArray[$value])) + { + return $extension_typeArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_class_property', 'a')); + + // From the componentbuilder_joomla_plugin_group table. + $query->select($db->quoteName('g.name','joomla_plugin_group_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_plugin_group', 'g') . ' ON (' . $db->quoteName('a.joomla_plugin_group') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.visibility LIKE '.$search.' OR a.extension_type LIKE '.$search.' OR a.comment LIKE '.$search.')'); + } + } + + // Filter by Visibility. + if ($visibility = $this->getState('filter.visibility')) + { + $query->where('a.visibility = ' . $db->quote($db->escape($visibility))); + } + // Filter by Extension_type. + if ($extension_type = $this->getState('filter.extension_type')) + { + $query->where('a.extension_type = ' . $db->quote($db->escape($extension_type))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks) + { + // setup the query + if (ComponentbuilderHelper::checkArray($pks)) + { + // Set a value to know this is exporting method. + $_export = true; + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_class_property table + $query->from($db->quoteName('#__componentbuilder_class_property', 'a')); + $query->where('a.id IN (' . implode(',',$pks) . ')'); + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // set values to display correctly. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + $access = (JFactory::getUser()->authorise('class_property.access', 'com_componentbuilder.class_property.' . (int) $item->id) && JFactory::getUser()->authorise('class_property.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + // decode comment + $item->comment = base64_decode($item->comment); + // decode default + $item->default = base64_decode($item->default); + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (ComponentbuilderHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__componentbuilder_class_property"); + if (ComponentbuilderHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.visibility'); + $id .= ':' . $this->getState('filter.extension_type'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_class_property')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__componentbuilder_class_property'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/class_property.php b/admin/models/class_property.php new file mode 100644 index 000000000..aa9bb5f1c --- /dev/null +++ b/admin/models/class_property.php @@ -0,0 +1,981 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Componentbuilder Class_property Model + */ +class ComponentbuilderModelClass_property extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'name', + 'visibility', + 'default', + 'extension_type', + 'joomla_plugin_group' + ), + 'right' => array( + 'comment' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.class_property'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'class_property', $prefix = 'ComponentbuilderTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * get VDM session key + * + * @return string the session key + * + */ + public function getVDM() + { + return $this->vastDevMod; + } + + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->comment)) + { + // base64 Decode comment. + $item->comment = base64_decode($item->comment); + } + + if (!empty($item->default)) + { + // base64 Decode default. + $item->default = base64_decode($item->default); + } + + + if (empty($item->id)) + { + $id = 0; + } + else + { + $id = $item->id; + } + // set the id and view name to session + if ($vdm = ComponentbuilderHelper::get('class_property__'.$id)) + { + $this->vastDevMod = $vdm; + } + else + { + // set the vast development method key + $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + ComponentbuilderHelper::set($this->vastDevMod, 'class_property__'.$id); + ComponentbuilderHelper::set('class_property__'.$id, $this->vastDevMod); + // set a return value if found + $jinput = JFactory::getApplication()->input; + $return = $jinput->get('return', null, 'base64'); + ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_componentbuilder.class_property'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // Get the form. + $form = $this->loadForm('com_componentbuilder.class_property', 'class_property', $options); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('class_property.edit.state', 'com_componentbuilder.class_property.' . (int) $id)) + || ($id == 0 && !$user->authorise('class_property.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('class_property.edit.created_by', 'com_componentbuilder.class_property.' . (int) $id)) + || ($id == 0 && !$user->authorise('class_property.edit.created_by', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('class_property.edit.created', 'com_componentbuilder.class_property.' . (int) $id)) + || ($id == 0 && !$user->authorise('class_property.edit.created', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + // update all editors to use this components global editor + $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields + $editors = $form->getXml()->xpath("//field[@type='editor']"); + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) + { + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_componentbuilder/models/forms/class_property.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('class_property.delete', 'com_componentbuilder.class_property.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('class_property.edit.state', 'com_componentbuilder.class_property.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('class_property.edit.state', 'com_componentbuilder'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('class_property.edit', 'com_componentbuilder.class_property.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('class_property.edit', 'com_componentbuilder'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_class_property')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.class_property.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to validate the form data. + * + * @param JForm $form The form to validate against. + * @param array $data The data to validate. + * @param string $group The name of the field group to validate. + * + * @return mixed Array of filtered data if valid, false otherwise. + * + * @see JFormRule + * @see JFilterInput + * @since 12.2 + */ + public function validate($form, $data, $group = null) + { + // check if the not_required field is set + if (ComponentbuilderHelper::checkString($data['not_required'])) + { + $requiredFields = (array) explode(',',(string) $data['not_required']); + $requiredFields = array_unique($requiredFields); + // now change the required field attributes value + foreach ($requiredFields as $requiredField) + { + // make sure there is a string value + if (ComponentbuilderHelper::checkString($requiredField)) + { + // change to false + $form->setFieldAttribute($requiredField, 'required', 'false'); + // also clear the data set + $data[$requiredField] = ''; + } + } + } + return parent::validate($form, $data, $group); + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('class_property'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('class_property'); + } + + if (!$this->canDo->get('class_property.create') && !$this->canDo->get('class_property.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('class_property.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('class_property.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + { + $this->table->name = $this->generateUniqe('name',$this->table->name); + } + + // insert all set values + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('class_property'); + } + + if (!$this->canDo->get('class_property.edit') && !$this->canDo->get('class_property.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('class_property.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('class_property.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // make sure the name is safe to be used as a function name + $data['name'] = ComponentbuilderHelper::safeClassFunctionName($data['name']); + + // Set the comment string to base64 string. + if (isset($data['comment'])) + { + $data['comment'] = base64_encode($data['comment']); + } + + // Set the default string to base64 string. + if (isset($data['default'])) + { + $data['default'] = base64_encode($data['default']); + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/compiler.php b/admin/models/compiler.php index 8de83b0e5..ee5f739b5 100644 --- a/admin/models/compiler.php +++ b/admin/models/compiler.php @@ -163,15 +163,15 @@ class ComponentbuilderModelCompiler extends JModelList $set['placeholders'] = $addPlaceholders; $set['debuglinenr'] = $debugLinenr; $set['minify'] = $minify; - // start up Compiler - $this->compiler = new Compiler($set); + // run compiler + $this->compiler = new Compiler($set); if($this->compiler) { return true; } return false; } - + public function emptyFolder($dir, $removeDir = false) { jimport('joomla.filesystem.folder'); @@ -210,7 +210,7 @@ class ComponentbuilderModelCompiler extends JModelList } return false; } - + public function install($p_file) { $this->setState('action', 'install'); @@ -238,7 +238,7 @@ class ComponentbuilderModelCompiler extends JModelList { return false; } - + $config = JFactory::getConfig(); $tmp_dest = $config->get('tmp_path'); @@ -259,7 +259,7 @@ class ComponentbuilderModelCompiler extends JModelList { return false; } - + // Was the package unpacked? if (!$package || !$package['type']) { @@ -280,7 +280,7 @@ class ComponentbuilderModelCompiler extends JModelList } else { - // Package installed sucessfully. + // Package installed successfully. $msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); $result = true; $msgType = 'message'; diff --git a/admin/models/component_dashboard.php b/admin/models/component_dashboard.php index 3c386aeeb..38d85aca3 100644 --- a/admin/models/component_dashboard.php +++ b/admin/models/component_dashboard.php @@ -27,6 +27,7 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin protected $tabLayoutFields = array( 'dashboard' => array( 'fullwidth' => array( + 'note_php_dashboard_note', 'php_dashboard_methods', 'dashboard_tab' ), diff --git a/admin/models/component_plugins.php b/admin/models/component_plugins.php new file mode 100644 index 000000000..e2f2f116f --- /dev/null +++ b/admin/models/component_plugins.php @@ -0,0 +1,881 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Componentbuilder Component_plugins Model + */ +class ComponentbuilderModelComponent_plugins extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'plugins' => array( + 'fullwidth' => array( + 'note_on_joomla_plugins', + 'addjoomla_plugins' + ), + 'above' => array( + 'joomla_component' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.component_plugins'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'component_plugins', $prefix = 'ComponentbuilderTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->addjoomla_plugins)) + { + // Convert the addjoomla_plugins field to an array. + $addjoomla_plugins = new Registry; + $addjoomla_plugins->loadString($item->addjoomla_plugins); + $item->addjoomla_plugins = $addjoomla_plugins->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_componentbuilder.component_plugins'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // Get the form. + $form = $this->loadForm('com_componentbuilder.component_plugins', 'component_plugins', $options); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('component_plugins.edit.state', 'com_componentbuilder.component_plugins.' . (int) $id)) + || ($id == 0 && !$user->authorise('component_plugins.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('component_plugins.edit.created_by', 'com_componentbuilder.component_plugins.' . (int) $id)) + || ($id == 0 && !$user->authorise('component_plugins.edit.created_by', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('component_plugins.edit.created', 'com_componentbuilder.component_plugins.' . (int) $id)) + || ($id == 0 && !$user->authorise('component_plugins.edit.created', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_componentbuilder/models/forms/component_plugins.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('component_plugins.delete', 'com_componentbuilder.component_plugins.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('component_plugins.edit.state', 'com_componentbuilder.component_plugins.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('component_plugins.edit.state', 'com_componentbuilder'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('component_plugins.edit', 'com_componentbuilder.component_plugins.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_plugins.edit', 'com_componentbuilder'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_component_plugins')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_plugins.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_plugins'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('component_plugins'); + } + + if (!$this->canDo->get('component_plugins.create') && !$this->canDo->get('component_plugins.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('component_plugins.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('component_plugins.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + { + $this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); + } + + // insert all set values + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('component_plugins'); + } + + if (!$this->canDo->get('component_plugins.edit') && !$this->canDo->get('component_plugins.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('component_plugins.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('component_plugins.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the addjoomla_plugins items to data. + if (isset($data['addjoomla_plugins']) && is_array($data['addjoomla_plugins'])) + { + $addjoomla_plugins = new JRegistry; + $addjoomla_plugins->loadArray($data['addjoomla_plugins']); + $data['addjoomla_plugins'] = (string) $addjoomla_plugins; + } + elseif (!isset($data['addjoomla_plugins'])) + { + // Set the empty addjoomla_plugins to data + $data['addjoomla_plugins'] = ''; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index b59609f41..c8eae8d62 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -25,7 +25,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList $icons = array(); // view groups array $viewGroups = array( - 'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=joomla_components&task=joomla_components.smartImport', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_documents') + 'main' => array('png.compiler', 'png.joomla_components', 'png.joomla_plugins', 'png.admin_view.add', 'png.admin_views', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=joomla_components&task=joomla_components.smartImport', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_documents') ); // view access array $viewAccess = array( @@ -38,7 +38,11 @@ class ComponentbuilderModelComponentbuilder extends JModelList 'joomla_component.access' => 'joomla_component.access', 'joomla_components.submenu' => 'joomla_component.submenu', 'joomla_components.dashboard_list' => 'joomla_component.dashboard_list', - 'joomla_component.dashboard_add' => 'joomla_component.dashboard_add', + 'joomla_plugin.create' => 'joomla_plugin.create', + 'joomla_plugins.access' => 'joomla_plugin.access', + 'joomla_plugin.access' => 'joomla_plugin.access', + 'joomla_plugins.submenu' => 'joomla_plugin.submenu', + 'joomla_plugins.dashboard_list' => 'joomla_plugin.dashboard_list', 'admin_view.create' => 'admin_view.create', 'admin_views.access' => 'admin_view.access', 'admin_view.access' => 'admin_view.access', @@ -76,6 +80,12 @@ class ComponentbuilderModelComponentbuilder extends JModelList 'custom_code.access' => 'custom_code.access', 'custom_codes.submenu' => 'custom_code.submenu', 'custom_codes.dashboard_list' => 'custom_code.dashboard_list', + 'class_property.create' => 'class_property.create', + 'class_properties.access' => 'class_property.access', + 'class_property.access' => 'class_property.access', + 'class_method.create' => 'class_method.create', + 'class_methods.access' => 'class_method.access', + 'class_method.access' => 'class_method.access', 'placeholder.create' => 'placeholder.create', 'placeholders.access' => 'placeholder.access', 'placeholder.access' => 'placeholder.access', @@ -167,6 +177,9 @@ class ComponentbuilderModelComponentbuilder extends JModelList 'component_placeholders.create' => 'component_placeholders.create', 'components_placeholders.access' => 'component_placeholders.access', 'component_placeholders.access' => 'component_placeholders.access', + 'component_plugins.create' => 'component_plugins.create', + 'components_plugins.access' => 'component_plugins.access', + 'component_plugins.access' => 'component_plugins.access', 'snippet_type.create' => 'snippet_type.create', 'snippet_types.access' => 'snippet_type.access', 'snippet_type.access' => 'snippet_type.access', @@ -175,7 +188,18 @@ class ComponentbuilderModelComponentbuilder extends JModelList 'library_config.access' => 'library_config.access', 'library_files_folders_urls.create' => 'library_files_folders_urls.create', 'libraries_files_folders_urls.access' => 'library_files_folders_urls.access', - 'library_files_folders_urls.access' => 'library_files_folders_urls.access'); + 'library_files_folders_urls.access' => 'library_files_folders_urls.access', + 'class_extends.create' => 'class_extends.create', + 'class_extendings.access' => 'class_extends.access', + 'class_extends.access' => 'class_extends.access', + 'joomla_plugin_groups.access' => 'joomla_plugin_group.access', + 'joomla_plugin_group.access' => 'joomla_plugin_group.access', + 'joomla_plugin_updates.create' => 'joomla_plugin_updates.create', + 'joomla_plugins_updates.access' => 'joomla_plugin_updates.access', + 'joomla_plugin_updates.access' => 'joomla_plugin_updates.access', + 'joomla_plugin_files_folders_urls.create' => 'joomla_plugin_files_folders_urls.create', + 'joomla_plugins_files_folders_urls.access' => 'joomla_plugin_files_folders_urls.access', + 'joomla_plugin_files_folders_urls.access' => 'joomla_plugin_files_folders_urls.access'); // loop over the $views foreach($viewGroups as $group => $views) { diff --git a/admin/models/components_plugins.php b/admin/models/components_plugins.php new file mode 100644 index 000000000..60ab04568 --- /dev/null +++ b/admin/models/components_plugins.php @@ -0,0 +1,237 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Components_plugins Model + */ +class ComponentbuilderModelComponents_plugins extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + $access = (JFactory::getUser()->authorise('component_plugins.access', 'com_componentbuilder.component_plugins.' . (int) $item->id) && JFactory::getUser()->authorise('component_plugins.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_component_plugins', 'a')); + + // From the componentbuilder_joomla_component table. + $query->select($db->quoteName('g.system_name','joomla_component_system_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_component', 'g') . ' ON (' . $db->quoteName('a.joomla_component') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_component_plugins')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__componentbuilder_component_plugins'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/custom_admin_view.php b/admin/models/custom_admin_view.php index f7cbca17b..f73f7132c 100644 --- a/admin/models/custom_admin_view.php +++ b/admin/models/custom_admin_view.php @@ -604,42 +604,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin return $data; } - /** - * Method to validate the form data. - * - * @param JForm $form The form to validate against. - * @param array $data The data to validate. - * @param string $group The name of the field group to validate. - * - * @return mixed Array of filtered data if valid, false otherwise. - * - * @see JFormRule - * @see JFilterInput - * @since 12.2 - */ - public function validate($form, $data, $group = null) - { - // check if the not_required field is set - if (ComponentbuilderHelper::checkString($data['not_required'])) - { - $requiredFields = (array) explode(',',(string) $data['not_required']); - $requiredFields = array_unique($requiredFields); - // now change the required field attributes value - foreach ($requiredFields as $requiredField) - { - // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) - { - // change to false - $form->setFieldAttribute($requiredField, 'required', 'false'); - // also clear the data set - $data[$requiredField] = ''; - } - } - } - return parent::validate($form, $data, $group); - } - /** * Method to get the unique fields of this table. * diff --git a/admin/models/field.php b/admin/models/field.php index 4ee506d06..26463a098 100644 --- a/admin/models/field.php +++ b/admin/models/field.php @@ -1007,7 +1007,7 @@ class ComponentbuilderModelField extends JModelAdmin } break; case 'type': - $property['value'] = ComponentbuilderHelper::safeString($property['value']); + $property['value'] = ComponentbuilderHelper::safeTypeName($property['value']); break; } // load the property diff --git a/admin/models/fields/classextends.php b/admin/models/fields/classextends.php new file mode 100644 index 000000000..5fdc5bc83 --- /dev/null +++ b/admin/models/fields/classextends.php @@ -0,0 +1,174 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Classextends Form Field class for the Componentbuilder component + */ +class JFormFieldClassextends extends JFormFieldList +{ + /** + * The classextends field type. + * + * @var string + */ + public $type = 'classextends'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create class_extends + if ($user->authorise('class_extends.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit class_extends + if ($user->authorise('class_extends.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for class_extends field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
    ' .$html . implode('',$button).'
    '; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','class_extends_name'))); + $query->from($db->quoteName('#__componentbuilder_class_extends', 'a')); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $columns = $db->getTableColumns('#__componentbuilder_class_extends'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select a class'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->class_extends_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/joomlaplugingroups.php b/admin/models/fields/joomlaplugingroups.php new file mode 100644 index 000000000..92ec0955c --- /dev/null +++ b/admin/models/fields/joomlaplugingroups.php @@ -0,0 +1,174 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Joomlaplugingroups Form Field class for the Componentbuilder component + */ +class JFormFieldJoomlaplugingroups extends JFormFieldList +{ + /** + * The joomlaplugingroups field type. + * + * @var string + */ + public $type = 'joomlaplugingroups'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create joomla_plugin_group + if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit joomla_plugin_group + if ($user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=joomla_plugin_group.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for joomla_plugin_group field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
    ' .$html . implode('',$button).'
    '; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','joomla_plugin_group_name'))); + $query->from($db->quoteName('#__componentbuilder_joomla_plugin_group', 'a')); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $columns = $db->getTableColumns('#__componentbuilder_joomla_plugin_group'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select a group'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->joomla_plugin_group_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/joomlaplugins.php b/admin/models/fields/joomlaplugins.php new file mode 100644 index 000000000..7f626b7d5 --- /dev/null +++ b/admin/models/fields/joomlaplugins.php @@ -0,0 +1,73 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Joomlaplugins Form Field class for the Componentbuilder component + */ +class JFormFieldJoomlaplugins extends JFormFieldList +{ + /** + * The joomlaplugins field type. + * + * @var string + */ + public $type = 'joomlaplugins'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.system_name','a.name','b.name','c.name'),array('id','plugin_system_name','name','class_extends_name','joomla_plugin_group_name'))); + $query->from($db->quoteName('#__componentbuilder_joomla_plugin', 'a')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_class_extends', 'b') . ' ON (' . $db->quoteName('a.class_extends') . ' = ' . $db->quoteName('b.id') . ')'); + $query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_plugin_group', 'c') . ' ON (' . $db->quoteName('a.joomla_plugin_group') . ' = ' . $db->quoteName('c.id') . ')'); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->order('a.system_name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $columns = $db->getTableColumns('#__componentbuilder_joomla_plugin'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select a plugin'); + foreach($items as $item) + { + // set a full class name + $options[] = JHtml::_('select.option', $item->id, '( ' . $item->plugin_system_name . ' ) class Plg' . ucfirst($item->joomla_plugin_group_name) . $item->name . ' extends ' . $item->class_extends_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/pluginsclassmethods.php b/admin/models/fields/pluginsclassmethods.php new file mode 100644 index 000000000..c59817bbe --- /dev/null +++ b/admin/models/fields/pluginsclassmethods.php @@ -0,0 +1,81 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Pluginsclassmethods Form Field class for the Componentbuilder component + */ +class JFormFieldPluginsclassmethods extends JFormFieldList +{ + /** + * The pluginsclassmethods field type. + * + * @var string + */ + public $type = 'pluginsclassmethods'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + +// Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name','a.visibility'),array('id','method_name','visibility'))); + $query->from($db->quoteName('#__componentbuilder_class_method', 'a')); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->where($db->quoteName('a.extension_type') . ' = ' . $db->quote('plugins')); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $columns = $db->getTableColumns('#__componentbuilder_class_method'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select a method'); + foreach($items as $item) + { + // we are using this code in more then one field JCB custom_code + if ('method' === 'method') + { + $select = $item->visibility . ' function ' . $item->method_name . '()'; + } + else + { + $select = $item->visibility . ' $' . $item->method_name; + } + $options[] = JHtml::_('select.option', $item->id, $select); + } + } + return $options; + } +} diff --git a/admin/models/fields/pluginsclassproperties.php b/admin/models/fields/pluginsclassproperties.php new file mode 100644 index 000000000..6aa830d64 --- /dev/null +++ b/admin/models/fields/pluginsclassproperties.php @@ -0,0 +1,81 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Pluginsclassproperties Form Field class for the Componentbuilder component + */ +class JFormFieldPluginsclassproperties extends JFormFieldList +{ + /** + * The pluginsclassproperties field type. + * + * @var string + */ + public $type = 'pluginsclassproperties'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + +// Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name','a.visibility'),array('id','property_name','visibility'))); + $query->from($db->quoteName('#__componentbuilder_class_property', 'a')); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->where($db->quoteName('a.extension_type') . ' = ' . $db->quote('plugins')); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $columns = $db->getTableColumns('#__componentbuilder_class_property'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select a property'); + foreach($items as $item) + { + // we are using this code in more then one field JCB custom_code + if ('method' === 'property') + { + $select = $item->visibility . ' function ' . $item->property_name . '()'; + } + else + { + $select = $item->visibility . ' $' . $item->property_name; + } + $options[] = JHtml::_('select.option', $item->id, $select); + } + } + return $options; + } +} diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index 8e12d7c13..3e025683c 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -203,7 +203,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin * * @return mixed An array of data items on success, false on failure. */ - public function getWarfields() + public function getVxwfields() { // Get the user object. $user = JFactory::getUser(); @@ -285,13 +285,13 @@ class ComponentbuilderModelFieldtype extends JModelAdmin foreach ($items as $nr => &$item) { // convert datatype - $item->datatype = $this->selectionTranslationWarfields($item->datatype, 'datatype'); + $item->datatype = $this->selectionTranslationVxwfields($item->datatype, 'datatype'); // convert indexes - $item->indexes = $this->selectionTranslationWarfields($item->indexes, 'indexes'); + $item->indexes = $this->selectionTranslationVxwfields($item->indexes, 'indexes'); // convert null_switch - $item->null_switch = $this->selectionTranslationWarfields($item->null_switch, 'null_switch'); + $item->null_switch = $this->selectionTranslationVxwfields($item->null_switch, 'null_switch'); // convert store - $item->store = $this->selectionTranslationWarfields($item->store, 'store'); + $item->store = $this->selectionTranslationVxwfields($item->store, 'store'); } } @@ -305,7 +305,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin * * @return translatable string */ - public function selectionTranslationWarfields($value,$name) + public function selectionTranslationVxwfields($value,$name) { // Array of datatype language strings if ($name === 'datatype') diff --git a/admin/models/forms/admin_fields_conditions.js b/admin/models/forms/admin_fields_conditions.js index 4c71df68c..a14c15d39 100644 --- a/admin/models/forms/admin_fields_conditions.js +++ b/admin/models/forms/admin_fields_conditions.js @@ -12,9 +12,9 @@ function getFieldSelectOptions_server(fieldId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json"); if(token.length > 0 && fieldId > 0){ - var request = 'token='+token+'&id='+fieldId; + var request = token+'=1&id='+fieldId; } return jQuery.ajax({ type: 'GET', @@ -24,7 +24,6 @@ function getFieldSelectOptions_server(fieldId){ jsonp: 'callback' }); } - function getFieldSelectOptions(fieldKey){ // first check if the field is set if(jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field").length) { diff --git a/admin/models/forms/admin_fields_relations.js b/admin/models/forms/admin_fields_relations.js index dd027678a..2876e864a 100644 --- a/admin/models/forms/admin_fields_relations.js +++ b/admin/models/forms/admin_fields_relations.js @@ -47,13 +47,13 @@ function getCodeGlueOptions(field) { } function getCodeGlueOptions_server(listfield, joinfields, type, area){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getCodeGlueOptions&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getCodeGlueOptions&format=json"); // make sure the joinfields are set if (!_isSet(joinfields)) { joinfields = 'none'; } if(token.length > 0 && listfield > 0 && type > 0 && area > 0) { - var request = 'token='+token+'&listfield='+listfield+'&type='+type+'&area='+area+'&joinfields='+joinfields; + var request = token+'=1&listfield='+listfield+'&type='+type+'&area='+area+'&joinfields='+joinfields; } return jQuery.ajax({ type: 'GET', @@ -74,9 +74,9 @@ function _isSet(val) } function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/admin_view.js b/admin/models/forms/admin_view.js index a6c59cb6e..d4670ad9d 100644 --- a/admin/models/forms/admin_view.js +++ b/admin/models/forms/admin_view.js @@ -9,1051 +9,553 @@ */ // Some Global Values -jform_vvvvvxbvwr_required = false; -jform_vvvvvxcvws_required = false; -jform_vvvvvxdvwt_required = false; -jform_vvvvvxevwu_required = false; -jform_vvvvvxfvwv_required = false; -jform_vvvvvxgvww_required = false; -jform_vvvvvxhvwx_required = false; -jform_vvvvvxivwy_required = false; -jform_vvvvvxjvwz_required = false; -jform_vvvvvxkvxa_required = false; -jform_vvvvvxlvxb_required = false; -jform_vvvvvxmvxc_required = false; -jform_vvvvvxnvxd_required = false; -jform_vvvvvxovxe_required = false; -jform_vvvvvxpvxf_required = false; -jform_vvvvvxqvxg_required = false; -jform_vvvvvxrvxh_required = false; -jform_vvvvvxsvxi_required = false; -jform_vvvvvxtvxj_required = false; -jform_vvvvvxuvxk_required = false; -jform_vvvvvxvvxl_required = false; -jform_vvvvvxwvxm_required = false; -jform_vvvvvxxvxn_required = false; -jform_vvvvvxyvxo_required = false; -jform_vvvvvxzvxp_required = false; -jform_vvvvvyavxq_required = false; -jform_vvvvvybvxr_required = false; -jform_vvvvvycvxs_required = false; -jform_vvvvvygvxt_required = false; -jform_vvvvvygvxu_required = false; -jform_vvvvvygvxv_required = false; -jform_vvvvvygvxw_required = false; -jform_vvvvvygvxx_required = false; -jform_vvvvvygvxy_required = false; -jform_vvvvvygvxz_required = false; -jform_vvvvvyivya_required = false; -jform_vvvvvyivyb_required = false; -jform_vvvvvyivyc_required = false; -jform_vvvvvyivyd_required = false; +jform_vvvvvyzvwh_required = false; +jform_vvvvvzavwi_required = false; +jform_vvvvvzevwj_required = false; +jform_vvvvvzevwk_required = false; +jform_vvvvvzevwl_required = false; +jform_vvvvvzevwm_required = false; +jform_vvvvvzevwn_required = false; +jform_vvvvvzevwo_required = false; +jform_vvvvvzevwp_required = false; // Initial Script jQuery(document).ready(function() { - var add_css_view_vvvvvxb = jQuery("#jform_add_css_view input[type='radio']:checked").val(); - vvvvvxb(add_css_view_vvvvvxb); + var add_css_view_vvvvvxz = jQuery("#jform_add_css_view input[type='radio']:checked").val(); + vvvvvxz(add_css_view_vvvvvxz); - var add_css_views_vvvvvxc = jQuery("#jform_add_css_views input[type='radio']:checked").val(); - vvvvvxc(add_css_views_vvvvvxc); + var add_css_views_vvvvvya = jQuery("#jform_add_css_views input[type='radio']:checked").val(); + vvvvvya(add_css_views_vvvvvya); - var add_javascript_view_file_vvvvvxd = jQuery("#jform_add_javascript_view_file input[type='radio']:checked").val(); - vvvvvxd(add_javascript_view_file_vvvvvxd); + var add_javascript_view_file_vvvvvyb = jQuery("#jform_add_javascript_view_file input[type='radio']:checked").val(); + vvvvvyb(add_javascript_view_file_vvvvvyb); - var add_javascript_views_file_vvvvvxe = jQuery("#jform_add_javascript_views_file input[type='radio']:checked").val(); - vvvvvxe(add_javascript_views_file_vvvvvxe); + var add_javascript_views_file_vvvvvyc = jQuery("#jform_add_javascript_views_file input[type='radio']:checked").val(); + vvvvvyc(add_javascript_views_file_vvvvvyc); - var add_javascript_view_footer_vvvvvxf = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val(); - vvvvvxf(add_javascript_view_footer_vvvvvxf); + var add_javascript_view_footer_vvvvvyd = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val(); + vvvvvyd(add_javascript_view_footer_vvvvvyd); - var add_javascript_views_footer_vvvvvxg = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val(); - vvvvvxg(add_javascript_views_footer_vvvvvxg); + var add_javascript_views_footer_vvvvvye = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val(); + vvvvvye(add_javascript_views_footer_vvvvvye); - var add_php_ajax_vvvvvxh = jQuery("#jform_add_php_ajax input[type='radio']:checked").val(); - vvvvvxh(add_php_ajax_vvvvvxh); + var add_php_ajax_vvvvvyf = jQuery("#jform_add_php_ajax input[type='radio']:checked").val(); + vvvvvyf(add_php_ajax_vvvvvyf); - var add_php_getitem_vvvvvxi = jQuery("#jform_add_php_getitem input[type='radio']:checked").val(); - vvvvvxi(add_php_getitem_vvvvvxi); + var add_php_getitem_vvvvvyg = jQuery("#jform_add_php_getitem input[type='radio']:checked").val(); + vvvvvyg(add_php_getitem_vvvvvyg); - var add_php_getitems_vvvvvxj = jQuery("#jform_add_php_getitems input[type='radio']:checked").val(); - vvvvvxj(add_php_getitems_vvvvvxj); + var add_php_getitems_vvvvvyh = jQuery("#jform_add_php_getitems input[type='radio']:checked").val(); + vvvvvyh(add_php_getitems_vvvvvyh); - var add_php_getitems_after_all_vvvvvxk = jQuery("#jform_add_php_getitems_after_all input[type='radio']:checked").val(); - vvvvvxk(add_php_getitems_after_all_vvvvvxk); + var add_php_getitems_after_all_vvvvvyi = jQuery("#jform_add_php_getitems_after_all input[type='radio']:checked").val(); + vvvvvyi(add_php_getitems_after_all_vvvvvyi); - var add_php_getlistquery_vvvvvxl = jQuery("#jform_add_php_getlistquery input[type='radio']:checked").val(); - vvvvvxl(add_php_getlistquery_vvvvvxl); + var add_php_getlistquery_vvvvvyj = jQuery("#jform_add_php_getlistquery input[type='radio']:checked").val(); + vvvvvyj(add_php_getlistquery_vvvvvyj); - var add_php_getform_vvvvvxm = jQuery("#jform_add_php_getform input[type='radio']:checked").val(); - vvvvvxm(add_php_getform_vvvvvxm); + var add_php_getform_vvvvvyk = jQuery("#jform_add_php_getform input[type='radio']:checked").val(); + vvvvvyk(add_php_getform_vvvvvyk); - var add_php_before_save_vvvvvxn = jQuery("#jform_add_php_before_save input[type='radio']:checked").val(); - vvvvvxn(add_php_before_save_vvvvvxn); + var add_php_before_save_vvvvvyl = jQuery("#jform_add_php_before_save input[type='radio']:checked").val(); + vvvvvyl(add_php_before_save_vvvvvyl); - var add_php_save_vvvvvxo = jQuery("#jform_add_php_save input[type='radio']:checked").val(); - vvvvvxo(add_php_save_vvvvvxo); + var add_php_save_vvvvvym = jQuery("#jform_add_php_save input[type='radio']:checked").val(); + vvvvvym(add_php_save_vvvvvym); - var add_php_postsavehook_vvvvvxp = jQuery("#jform_add_php_postsavehook input[type='radio']:checked").val(); - vvvvvxp(add_php_postsavehook_vvvvvxp); + var add_php_postsavehook_vvvvvyn = jQuery("#jform_add_php_postsavehook input[type='radio']:checked").val(); + vvvvvyn(add_php_postsavehook_vvvvvyn); - var add_php_allowadd_vvvvvxq = jQuery("#jform_add_php_allowadd input[type='radio']:checked").val(); - vvvvvxq(add_php_allowadd_vvvvvxq); + var add_php_allowadd_vvvvvyo = jQuery("#jform_add_php_allowadd input[type='radio']:checked").val(); + vvvvvyo(add_php_allowadd_vvvvvyo); - var add_php_allowedit_vvvvvxr = jQuery("#jform_add_php_allowedit input[type='radio']:checked").val(); - vvvvvxr(add_php_allowedit_vvvvvxr); + var add_php_allowedit_vvvvvyp = jQuery("#jform_add_php_allowedit input[type='radio']:checked").val(); + vvvvvyp(add_php_allowedit_vvvvvyp); - var add_php_before_cancel_vvvvvxs = jQuery("#jform_add_php_before_cancel input[type='radio']:checked").val(); - vvvvvxs(add_php_before_cancel_vvvvvxs); + var add_php_before_cancel_vvvvvyq = jQuery("#jform_add_php_before_cancel input[type='radio']:checked").val(); + vvvvvyq(add_php_before_cancel_vvvvvyq); - var add_php_after_cancel_vvvvvxt = jQuery("#jform_add_php_after_cancel input[type='radio']:checked").val(); - vvvvvxt(add_php_after_cancel_vvvvvxt); + var add_php_after_cancel_vvvvvyr = jQuery("#jform_add_php_after_cancel input[type='radio']:checked").val(); + vvvvvyr(add_php_after_cancel_vvvvvyr); - var add_php_batchcopy_vvvvvxu = jQuery("#jform_add_php_batchcopy input[type='radio']:checked").val(); - vvvvvxu(add_php_batchcopy_vvvvvxu); + var add_php_batchcopy_vvvvvys = jQuery("#jform_add_php_batchcopy input[type='radio']:checked").val(); + vvvvvys(add_php_batchcopy_vvvvvys); - var add_php_batchmove_vvvvvxv = jQuery("#jform_add_php_batchmove input[type='radio']:checked").val(); - vvvvvxv(add_php_batchmove_vvvvvxv); + var add_php_batchmove_vvvvvyt = jQuery("#jform_add_php_batchmove input[type='radio']:checked").val(); + vvvvvyt(add_php_batchmove_vvvvvyt); - var add_php_before_publish_vvvvvxw = jQuery("#jform_add_php_before_publish input[type='radio']:checked").val(); - vvvvvxw(add_php_before_publish_vvvvvxw); + var add_php_before_publish_vvvvvyu = jQuery("#jform_add_php_before_publish input[type='radio']:checked").val(); + vvvvvyu(add_php_before_publish_vvvvvyu); - var add_php_after_publish_vvvvvxx = jQuery("#jform_add_php_after_publish input[type='radio']:checked").val(); - vvvvvxx(add_php_after_publish_vvvvvxx); + var add_php_after_publish_vvvvvyv = jQuery("#jform_add_php_after_publish input[type='radio']:checked").val(); + vvvvvyv(add_php_after_publish_vvvvvyv); - var add_php_before_delete_vvvvvxy = jQuery("#jform_add_php_before_delete input[type='radio']:checked").val(); - vvvvvxy(add_php_before_delete_vvvvvxy); + var add_php_before_delete_vvvvvyw = jQuery("#jform_add_php_before_delete input[type='radio']:checked").val(); + vvvvvyw(add_php_before_delete_vvvvvyw); - var add_php_after_delete_vvvvvxz = jQuery("#jform_add_php_after_delete input[type='radio']:checked").val(); - vvvvvxz(add_php_after_delete_vvvvvxz); + var add_php_after_delete_vvvvvyx = jQuery("#jform_add_php_after_delete input[type='radio']:checked").val(); + vvvvvyx(add_php_after_delete_vvvvvyx); - var add_php_document_vvvvvya = jQuery("#jform_add_php_document input[type='radio']:checked").val(); - vvvvvya(add_php_document_vvvvvya); + var add_php_document_vvvvvyy = jQuery("#jform_add_php_document input[type='radio']:checked").val(); + vvvvvyy(add_php_document_vvvvvyy); - var add_sql_vvvvvyb = jQuery("#jform_add_sql input[type='radio']:checked").val(); - vvvvvyb(add_sql_vvvvvyb); + var add_sql_vvvvvyz = jQuery("#jform_add_sql input[type='radio']:checked").val(); + vvvvvyz(add_sql_vvvvvyz); - var source_vvvvvyc = jQuery("#jform_source input[type='radio']:checked").val(); - var add_sql_vvvvvyc = jQuery("#jform_add_sql input[type='radio']:checked").val(); - vvvvvyc(source_vvvvvyc,add_sql_vvvvvyc); + var source_vvvvvza = jQuery("#jform_source input[type='radio']:checked").val(); + var add_sql_vvvvvza = jQuery("#jform_add_sql input[type='radio']:checked").val(); + vvvvvza(source_vvvvvza,add_sql_vvvvvza); - var source_vvvvvye = jQuery("#jform_source input[type='radio']:checked").val(); - var add_sql_vvvvvye = jQuery("#jform_add_sql input[type='radio']:checked").val(); - vvvvvye(source_vvvvvye,add_sql_vvvvvye); + var source_vvvvvzc = jQuery("#jform_source input[type='radio']:checked").val(); + var add_sql_vvvvvzc = jQuery("#jform_add_sql input[type='radio']:checked").val(); + vvvvvzc(source_vvvvvzc,add_sql_vvvvvzc); - var add_custom_import_vvvvvyg = jQuery("#jform_add_custom_import input[type='radio']:checked").val(); - vvvvvyg(add_custom_import_vvvvvyg); + var add_custom_import_vvvvvze = jQuery("#jform_add_custom_import input[type='radio']:checked").val(); + vvvvvze(add_custom_import_vvvvvze); - var add_custom_import_vvvvvyh = jQuery("#jform_add_custom_import input[type='radio']:checked").val(); - vvvvvyh(add_custom_import_vvvvvyh); + var add_custom_import_vvvvvzf = jQuery("#jform_add_custom_import input[type='radio']:checked").val(); + vvvvvzf(add_custom_import_vvvvvzf); - var add_custom_button_vvvvvyi = jQuery("#jform_add_custom_button input[type='radio']:checked").val(); - vvvvvyi(add_custom_button_vvvvvyi); + var add_custom_button_vvvvvzg = jQuery("#jform_add_custom_button input[type='radio']:checked").val(); + vvvvvzg(add_custom_button_vvvvvzg); }); -// the vvvvvxb function -function vvvvvxb(add_css_view_vvvvvxb) +// the vvvvvxz function +function vvvvvxz(add_css_view_vvvvvxz) { // set the function logic - if (add_css_view_vvvvvxb == 1) + if (add_css_view_vvvvvxz == 1) { jQuery('#jform_css_view-lbl').closest('.control-group').show(); - // add required attribute to css_view field - if (jform_vvvvvxbvwr_required) - { - updateFieldRequired('css_view',0); - jQuery('#jform_css_view').prop('required','required'); - jQuery('#jform_css_view').attr('aria-required',true); - jQuery('#jform_css_view').addClass('required'); - jform_vvvvvxbvwr_required = false; - } } else { jQuery('#jform_css_view-lbl').closest('.control-group').hide(); - // remove required attribute from css_view field - if (!jform_vvvvvxbvwr_required) - { - updateFieldRequired('css_view',1); - jQuery('#jform_css_view').removeAttr('required'); - jQuery('#jform_css_view').removeAttr('aria-required'); - jQuery('#jform_css_view').removeClass('required'); - jform_vvvvvxbvwr_required = true; - } } } -// the vvvvvxc function -function vvvvvxc(add_css_views_vvvvvxc) +// the vvvvvya function +function vvvvvya(add_css_views_vvvvvya) { // set the function logic - if (add_css_views_vvvvvxc == 1) + if (add_css_views_vvvvvya == 1) { jQuery('#jform_css_views-lbl').closest('.control-group').show(); - // add required attribute to css_views field - if (jform_vvvvvxcvws_required) - { - updateFieldRequired('css_views',0); - jQuery('#jform_css_views').prop('required','required'); - jQuery('#jform_css_views').attr('aria-required',true); - jQuery('#jform_css_views').addClass('required'); - jform_vvvvvxcvws_required = false; - } } else { jQuery('#jform_css_views-lbl').closest('.control-group').hide(); - // remove required attribute from css_views field - if (!jform_vvvvvxcvws_required) - { - updateFieldRequired('css_views',1); - jQuery('#jform_css_views').removeAttr('required'); - jQuery('#jform_css_views').removeAttr('aria-required'); - jQuery('#jform_css_views').removeClass('required'); - jform_vvvvvxcvws_required = true; - } } } -// the vvvvvxd function -function vvvvvxd(add_javascript_view_file_vvvvvxd) +// the vvvvvyb function +function vvvvvyb(add_javascript_view_file_vvvvvyb) { // set the function logic - if (add_javascript_view_file_vvvvvxd == 1) + if (add_javascript_view_file_vvvvvyb == 1) { jQuery('#jform_javascript_view_file-lbl').closest('.control-group').show(); - // add required attribute to javascript_view_file field - if (jform_vvvvvxdvwt_required) - { - updateFieldRequired('javascript_view_file',0); - jQuery('#jform_javascript_view_file').prop('required','required'); - jQuery('#jform_javascript_view_file').attr('aria-required',true); - jQuery('#jform_javascript_view_file').addClass('required'); - jform_vvvvvxdvwt_required = false; - } } else { jQuery('#jform_javascript_view_file-lbl').closest('.control-group').hide(); - // remove required attribute from javascript_view_file field - if (!jform_vvvvvxdvwt_required) - { - updateFieldRequired('javascript_view_file',1); - jQuery('#jform_javascript_view_file').removeAttr('required'); - jQuery('#jform_javascript_view_file').removeAttr('aria-required'); - jQuery('#jform_javascript_view_file').removeClass('required'); - jform_vvvvvxdvwt_required = true; - } } } -// the vvvvvxe function -function vvvvvxe(add_javascript_views_file_vvvvvxe) +// the vvvvvyc function +function vvvvvyc(add_javascript_views_file_vvvvvyc) { // set the function logic - if (add_javascript_views_file_vvvvvxe == 1) + if (add_javascript_views_file_vvvvvyc == 1) { jQuery('#jform_javascript_views_file-lbl').closest('.control-group').show(); - // add required attribute to javascript_views_file field - if (jform_vvvvvxevwu_required) - { - updateFieldRequired('javascript_views_file',0); - jQuery('#jform_javascript_views_file').prop('required','required'); - jQuery('#jform_javascript_views_file').attr('aria-required',true); - jQuery('#jform_javascript_views_file').addClass('required'); - jform_vvvvvxevwu_required = false; - } } else { jQuery('#jform_javascript_views_file-lbl').closest('.control-group').hide(); - // remove required attribute from javascript_views_file field - if (!jform_vvvvvxevwu_required) - { - updateFieldRequired('javascript_views_file',1); - jQuery('#jform_javascript_views_file').removeAttr('required'); - jQuery('#jform_javascript_views_file').removeAttr('aria-required'); - jQuery('#jform_javascript_views_file').removeClass('required'); - jform_vvvvvxevwu_required = true; - } } } -// the vvvvvxf function -function vvvvvxf(add_javascript_view_footer_vvvvvxf) +// the vvvvvyd function +function vvvvvyd(add_javascript_view_footer_vvvvvyd) { // set the function logic - if (add_javascript_view_footer_vvvvvxf == 1) + if (add_javascript_view_footer_vvvvvyd == 1) { jQuery('#jform_javascript_view_footer-lbl').closest('.control-group').show(); - // add required attribute to javascript_view_footer field - if (jform_vvvvvxfvwv_required) - { - updateFieldRequired('javascript_view_footer',0); - jQuery('#jform_javascript_view_footer').prop('required','required'); - jQuery('#jform_javascript_view_footer').attr('aria-required',true); - jQuery('#jform_javascript_view_footer').addClass('required'); - jform_vvvvvxfvwv_required = false; - } } else { jQuery('#jform_javascript_view_footer-lbl').closest('.control-group').hide(); - // remove required attribute from javascript_view_footer field - if (!jform_vvvvvxfvwv_required) - { - updateFieldRequired('javascript_view_footer',1); - jQuery('#jform_javascript_view_footer').removeAttr('required'); - jQuery('#jform_javascript_view_footer').removeAttr('aria-required'); - jQuery('#jform_javascript_view_footer').removeClass('required'); - jform_vvvvvxfvwv_required = true; - } } } -// the vvvvvxg function -function vvvvvxg(add_javascript_views_footer_vvvvvxg) +// the vvvvvye function +function vvvvvye(add_javascript_views_footer_vvvvvye) { // set the function logic - if (add_javascript_views_footer_vvvvvxg == 1) + if (add_javascript_views_footer_vvvvvye == 1) { jQuery('#jform_javascript_views_footer-lbl').closest('.control-group').show(); - // add required attribute to javascript_views_footer field - if (jform_vvvvvxgvww_required) - { - updateFieldRequired('javascript_views_footer',0); - jQuery('#jform_javascript_views_footer').prop('required','required'); - jQuery('#jform_javascript_views_footer').attr('aria-required',true); - jQuery('#jform_javascript_views_footer').addClass('required'); - jform_vvvvvxgvww_required = false; - } } else { jQuery('#jform_javascript_views_footer-lbl').closest('.control-group').hide(); - // remove required attribute from javascript_views_footer field - if (!jform_vvvvvxgvww_required) - { - updateFieldRequired('javascript_views_footer',1); - jQuery('#jform_javascript_views_footer').removeAttr('required'); - jQuery('#jform_javascript_views_footer').removeAttr('aria-required'); - jQuery('#jform_javascript_views_footer').removeClass('required'); - jform_vvvvvxgvww_required = true; - } } } -// the vvvvvxh function -function vvvvvxh(add_php_ajax_vvvvvxh) +// the vvvvvyf function +function vvvvvyf(add_php_ajax_vvvvvyf) { // set the function logic - if (add_php_ajax_vvvvvxh == 1) + if (add_php_ajax_vvvvvyf == 1) { jQuery('#jform_ajax_input-lbl').closest('.control-group').show(); jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').show(); - // add required attribute to php_ajaxmethod field - if (jform_vvvvvxhvwx_required) - { - updateFieldRequired('php_ajaxmethod',0); - jQuery('#jform_php_ajaxmethod').prop('required','required'); - jQuery('#jform_php_ajaxmethod').attr('aria-required',true); - jQuery('#jform_php_ajaxmethod').addClass('required'); - jform_vvvvvxhvwx_required = false; - } } else { jQuery('#jform_ajax_input-lbl').closest('.control-group').hide(); jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').hide(); - // remove required attribute from php_ajaxmethod field - if (!jform_vvvvvxhvwx_required) - { - updateFieldRequired('php_ajaxmethod',1); - jQuery('#jform_php_ajaxmethod').removeAttr('required'); - jQuery('#jform_php_ajaxmethod').removeAttr('aria-required'); - jQuery('#jform_php_ajaxmethod').removeClass('required'); - jform_vvvvvxhvwx_required = true; - } } } -// the vvvvvxi function -function vvvvvxi(add_php_getitem_vvvvvxi) +// the vvvvvyg function +function vvvvvyg(add_php_getitem_vvvvvyg) { // set the function logic - if (add_php_getitem_vvvvvxi == 1) + if (add_php_getitem_vvvvvyg == 1) { jQuery('#jform_php_getitem-lbl').closest('.control-group').show(); - // add required attribute to php_getitem field - if (jform_vvvvvxivwy_required) - { - updateFieldRequired('php_getitem',0); - jQuery('#jform_php_getitem').prop('required','required'); - jQuery('#jform_php_getitem').attr('aria-required',true); - jQuery('#jform_php_getitem').addClass('required'); - jform_vvvvvxivwy_required = false; - } } else { jQuery('#jform_php_getitem-lbl').closest('.control-group').hide(); - // remove required attribute from php_getitem field - if (!jform_vvvvvxivwy_required) - { - updateFieldRequired('php_getitem',1); - jQuery('#jform_php_getitem').removeAttr('required'); - jQuery('#jform_php_getitem').removeAttr('aria-required'); - jQuery('#jform_php_getitem').removeClass('required'); - jform_vvvvvxivwy_required = true; - } } } -// the vvvvvxj function -function vvvvvxj(add_php_getitems_vvvvvxj) +// the vvvvvyh function +function vvvvvyh(add_php_getitems_vvvvvyh) { // set the function logic - if (add_php_getitems_vvvvvxj == 1) + if (add_php_getitems_vvvvvyh == 1) { jQuery('#jform_php_getitems-lbl').closest('.control-group').show(); - // add required attribute to php_getitems field - if (jform_vvvvvxjvwz_required) - { - updateFieldRequired('php_getitems',0); - jQuery('#jform_php_getitems').prop('required','required'); - jQuery('#jform_php_getitems').attr('aria-required',true); - jQuery('#jform_php_getitems').addClass('required'); - jform_vvvvvxjvwz_required = false; - } } else { jQuery('#jform_php_getitems-lbl').closest('.control-group').hide(); - // remove required attribute from php_getitems field - if (!jform_vvvvvxjvwz_required) - { - updateFieldRequired('php_getitems',1); - jQuery('#jform_php_getitems').removeAttr('required'); - jQuery('#jform_php_getitems').removeAttr('aria-required'); - jQuery('#jform_php_getitems').removeClass('required'); - jform_vvvvvxjvwz_required = true; - } } } -// the vvvvvxk function -function vvvvvxk(add_php_getitems_after_all_vvvvvxk) +// the vvvvvyi function +function vvvvvyi(add_php_getitems_after_all_vvvvvyi) { // set the function logic - if (add_php_getitems_after_all_vvvvvxk == 1) + if (add_php_getitems_after_all_vvvvvyi == 1) { jQuery('#jform_php_getitems_after_all-lbl').closest('.control-group').show(); - // add required attribute to php_getitems_after_all field - if (jform_vvvvvxkvxa_required) - { - updateFieldRequired('php_getitems_after_all',0); - jQuery('#jform_php_getitems_after_all').prop('required','required'); - jQuery('#jform_php_getitems_after_all').attr('aria-required',true); - jQuery('#jform_php_getitems_after_all').addClass('required'); - jform_vvvvvxkvxa_required = false; - } } else { jQuery('#jform_php_getitems_after_all-lbl').closest('.control-group').hide(); - // remove required attribute from php_getitems_after_all field - if (!jform_vvvvvxkvxa_required) - { - updateFieldRequired('php_getitems_after_all',1); - jQuery('#jform_php_getitems_after_all').removeAttr('required'); - jQuery('#jform_php_getitems_after_all').removeAttr('aria-required'); - jQuery('#jform_php_getitems_after_all').removeClass('required'); - jform_vvvvvxkvxa_required = true; - } } } -// the vvvvvxl function -function vvvvvxl(add_php_getlistquery_vvvvvxl) +// the vvvvvyj function +function vvvvvyj(add_php_getlistquery_vvvvvyj) { // set the function logic - if (add_php_getlistquery_vvvvvxl == 1) + if (add_php_getlistquery_vvvvvyj == 1) { jQuery('#jform_php_getlistquery-lbl').closest('.control-group').show(); - // add required attribute to php_getlistquery field - if (jform_vvvvvxlvxb_required) - { - updateFieldRequired('php_getlistquery',0); - jQuery('#jform_php_getlistquery').prop('required','required'); - jQuery('#jform_php_getlistquery').attr('aria-required',true); - jQuery('#jform_php_getlistquery').addClass('required'); - jform_vvvvvxlvxb_required = false; - } } else { jQuery('#jform_php_getlistquery-lbl').closest('.control-group').hide(); - // remove required attribute from php_getlistquery field - if (!jform_vvvvvxlvxb_required) - { - updateFieldRequired('php_getlistquery',1); - jQuery('#jform_php_getlistquery').removeAttr('required'); - jQuery('#jform_php_getlistquery').removeAttr('aria-required'); - jQuery('#jform_php_getlistquery').removeClass('required'); - jform_vvvvvxlvxb_required = true; - } } } -// the vvvvvxm function -function vvvvvxm(add_php_getform_vvvvvxm) +// the vvvvvyk function +function vvvvvyk(add_php_getform_vvvvvyk) { // set the function logic - if (add_php_getform_vvvvvxm == 1) + if (add_php_getform_vvvvvyk == 1) { jQuery('#jform_php_getform-lbl').closest('.control-group').show(); - // add required attribute to php_getform field - if (jform_vvvvvxmvxc_required) - { - updateFieldRequired('php_getform',0); - jQuery('#jform_php_getform').prop('required','required'); - jQuery('#jform_php_getform').attr('aria-required',true); - jQuery('#jform_php_getform').addClass('required'); - jform_vvvvvxmvxc_required = false; - } } else { jQuery('#jform_php_getform-lbl').closest('.control-group').hide(); - // remove required attribute from php_getform field - if (!jform_vvvvvxmvxc_required) - { - updateFieldRequired('php_getform',1); - jQuery('#jform_php_getform').removeAttr('required'); - jQuery('#jform_php_getform').removeAttr('aria-required'); - jQuery('#jform_php_getform').removeClass('required'); - jform_vvvvvxmvxc_required = true; - } } } -// the vvvvvxn function -function vvvvvxn(add_php_before_save_vvvvvxn) +// the vvvvvyl function +function vvvvvyl(add_php_before_save_vvvvvyl) { // set the function logic - if (add_php_before_save_vvvvvxn == 1) + if (add_php_before_save_vvvvvyl == 1) { jQuery('#jform_php_before_save-lbl').closest('.control-group').show(); - // add required attribute to php_before_save field - if (jform_vvvvvxnvxd_required) - { - updateFieldRequired('php_before_save',0); - jQuery('#jform_php_before_save').prop('required','required'); - jQuery('#jform_php_before_save').attr('aria-required',true); - jQuery('#jform_php_before_save').addClass('required'); - jform_vvvvvxnvxd_required = false; - } } else { jQuery('#jform_php_before_save-lbl').closest('.control-group').hide(); - // remove required attribute from php_before_save field - if (!jform_vvvvvxnvxd_required) - { - updateFieldRequired('php_before_save',1); - jQuery('#jform_php_before_save').removeAttr('required'); - jQuery('#jform_php_before_save').removeAttr('aria-required'); - jQuery('#jform_php_before_save').removeClass('required'); - jform_vvvvvxnvxd_required = true; - } } } -// the vvvvvxo function -function vvvvvxo(add_php_save_vvvvvxo) +// the vvvvvym function +function vvvvvym(add_php_save_vvvvvym) { // set the function logic - if (add_php_save_vvvvvxo == 1) + if (add_php_save_vvvvvym == 1) { jQuery('#jform_php_save-lbl').closest('.control-group').show(); - // add required attribute to php_save field - if (jform_vvvvvxovxe_required) - { - updateFieldRequired('php_save',0); - jQuery('#jform_php_save').prop('required','required'); - jQuery('#jform_php_save').attr('aria-required',true); - jQuery('#jform_php_save').addClass('required'); - jform_vvvvvxovxe_required = false; - } } else { jQuery('#jform_php_save-lbl').closest('.control-group').hide(); - // remove required attribute from php_save field - if (!jform_vvvvvxovxe_required) - { - updateFieldRequired('php_save',1); - jQuery('#jform_php_save').removeAttr('required'); - jQuery('#jform_php_save').removeAttr('aria-required'); - jQuery('#jform_php_save').removeClass('required'); - jform_vvvvvxovxe_required = true; - } } } -// the vvvvvxp function -function vvvvvxp(add_php_postsavehook_vvvvvxp) +// the vvvvvyn function +function vvvvvyn(add_php_postsavehook_vvvvvyn) { // set the function logic - if (add_php_postsavehook_vvvvvxp == 1) + if (add_php_postsavehook_vvvvvyn == 1) { jQuery('#jform_php_postsavehook-lbl').closest('.control-group').show(); - // add required attribute to php_postsavehook field - if (jform_vvvvvxpvxf_required) - { - updateFieldRequired('php_postsavehook',0); - jQuery('#jform_php_postsavehook').prop('required','required'); - jQuery('#jform_php_postsavehook').attr('aria-required',true); - jQuery('#jform_php_postsavehook').addClass('required'); - jform_vvvvvxpvxf_required = false; - } } else { jQuery('#jform_php_postsavehook-lbl').closest('.control-group').hide(); - // remove required attribute from php_postsavehook field - if (!jform_vvvvvxpvxf_required) - { - updateFieldRequired('php_postsavehook',1); - jQuery('#jform_php_postsavehook').removeAttr('required'); - jQuery('#jform_php_postsavehook').removeAttr('aria-required'); - jQuery('#jform_php_postsavehook').removeClass('required'); - jform_vvvvvxpvxf_required = true; - } } } -// the vvvvvxq function -function vvvvvxq(add_php_allowadd_vvvvvxq) +// the vvvvvyo function +function vvvvvyo(add_php_allowadd_vvvvvyo) { // set the function logic - if (add_php_allowadd_vvvvvxq == 1) + if (add_php_allowadd_vvvvvyo == 1) { jQuery('#jform_php_allowadd-lbl').closest('.control-group').show(); - // add required attribute to php_allowadd field - if (jform_vvvvvxqvxg_required) - { - updateFieldRequired('php_allowadd',0); - jQuery('#jform_php_allowadd').prop('required','required'); - jQuery('#jform_php_allowadd').attr('aria-required',true); - jQuery('#jform_php_allowadd').addClass('required'); - jform_vvvvvxqvxg_required = false; - } } else { jQuery('#jform_php_allowadd-lbl').closest('.control-group').hide(); - // remove required attribute from php_allowadd field - if (!jform_vvvvvxqvxg_required) - { - updateFieldRequired('php_allowadd',1); - jQuery('#jform_php_allowadd').removeAttr('required'); - jQuery('#jform_php_allowadd').removeAttr('aria-required'); - jQuery('#jform_php_allowadd').removeClass('required'); - jform_vvvvvxqvxg_required = true; - } } } -// the vvvvvxr function -function vvvvvxr(add_php_allowedit_vvvvvxr) +// the vvvvvyp function +function vvvvvyp(add_php_allowedit_vvvvvyp) { // set the function logic - if (add_php_allowedit_vvvvvxr == 1) + if (add_php_allowedit_vvvvvyp == 1) { jQuery('#jform_php_allowedit-lbl').closest('.control-group').show(); - // add required attribute to php_allowedit field - if (jform_vvvvvxrvxh_required) - { - updateFieldRequired('php_allowedit',0); - jQuery('#jform_php_allowedit').prop('required','required'); - jQuery('#jform_php_allowedit').attr('aria-required',true); - jQuery('#jform_php_allowedit').addClass('required'); - jform_vvvvvxrvxh_required = false; - } } else { jQuery('#jform_php_allowedit-lbl').closest('.control-group').hide(); - // remove required attribute from php_allowedit field - if (!jform_vvvvvxrvxh_required) - { - updateFieldRequired('php_allowedit',1); - jQuery('#jform_php_allowedit').removeAttr('required'); - jQuery('#jform_php_allowedit').removeAttr('aria-required'); - jQuery('#jform_php_allowedit').removeClass('required'); - jform_vvvvvxrvxh_required = true; - } } } -// the vvvvvxs function -function vvvvvxs(add_php_before_cancel_vvvvvxs) +// the vvvvvyq function +function vvvvvyq(add_php_before_cancel_vvvvvyq) { // set the function logic - if (add_php_before_cancel_vvvvvxs == 1) + if (add_php_before_cancel_vvvvvyq == 1) { jQuery('#jform_php_before_cancel-lbl').closest('.control-group').show(); - // add required attribute to php_before_cancel field - if (jform_vvvvvxsvxi_required) - { - updateFieldRequired('php_before_cancel',0); - jQuery('#jform_php_before_cancel').prop('required','required'); - jQuery('#jform_php_before_cancel').attr('aria-required',true); - jQuery('#jform_php_before_cancel').addClass('required'); - jform_vvvvvxsvxi_required = false; - } } else { jQuery('#jform_php_before_cancel-lbl').closest('.control-group').hide(); - // remove required attribute from php_before_cancel field - if (!jform_vvvvvxsvxi_required) - { - updateFieldRequired('php_before_cancel',1); - jQuery('#jform_php_before_cancel').removeAttr('required'); - jQuery('#jform_php_before_cancel').removeAttr('aria-required'); - jQuery('#jform_php_before_cancel').removeClass('required'); - jform_vvvvvxsvxi_required = true; - } } } -// the vvvvvxt function -function vvvvvxt(add_php_after_cancel_vvvvvxt) +// the vvvvvyr function +function vvvvvyr(add_php_after_cancel_vvvvvyr) { // set the function logic - if (add_php_after_cancel_vvvvvxt == 1) + if (add_php_after_cancel_vvvvvyr == 1) { jQuery('#jform_php_after_cancel-lbl').closest('.control-group').show(); - // add required attribute to php_after_cancel field - if (jform_vvvvvxtvxj_required) - { - updateFieldRequired('php_after_cancel',0); - jQuery('#jform_php_after_cancel').prop('required','required'); - jQuery('#jform_php_after_cancel').attr('aria-required',true); - jQuery('#jform_php_after_cancel').addClass('required'); - jform_vvvvvxtvxj_required = false; - } } else { jQuery('#jform_php_after_cancel-lbl').closest('.control-group').hide(); - // remove required attribute from php_after_cancel field - if (!jform_vvvvvxtvxj_required) - { - updateFieldRequired('php_after_cancel',1); - jQuery('#jform_php_after_cancel').removeAttr('required'); - jQuery('#jform_php_after_cancel').removeAttr('aria-required'); - jQuery('#jform_php_after_cancel').removeClass('required'); - jform_vvvvvxtvxj_required = true; - } } } -// the vvvvvxu function -function vvvvvxu(add_php_batchcopy_vvvvvxu) +// the vvvvvys function +function vvvvvys(add_php_batchcopy_vvvvvys) { // set the function logic - if (add_php_batchcopy_vvvvvxu == 1) + if (add_php_batchcopy_vvvvvys == 1) { jQuery('#jform_php_batchcopy-lbl').closest('.control-group').show(); - // add required attribute to php_batchcopy field - if (jform_vvvvvxuvxk_required) - { - updateFieldRequired('php_batchcopy',0); - jQuery('#jform_php_batchcopy').prop('required','required'); - jQuery('#jform_php_batchcopy').attr('aria-required',true); - jQuery('#jform_php_batchcopy').addClass('required'); - jform_vvvvvxuvxk_required = false; - } } else { jQuery('#jform_php_batchcopy-lbl').closest('.control-group').hide(); - // remove required attribute from php_batchcopy field - if (!jform_vvvvvxuvxk_required) - { - updateFieldRequired('php_batchcopy',1); - jQuery('#jform_php_batchcopy').removeAttr('required'); - jQuery('#jform_php_batchcopy').removeAttr('aria-required'); - jQuery('#jform_php_batchcopy').removeClass('required'); - jform_vvvvvxuvxk_required = true; - } } } -// the vvvvvxv function -function vvvvvxv(add_php_batchmove_vvvvvxv) +// the vvvvvyt function +function vvvvvyt(add_php_batchmove_vvvvvyt) { // set the function logic - if (add_php_batchmove_vvvvvxv == 1) + if (add_php_batchmove_vvvvvyt == 1) { jQuery('#jform_php_batchmove-lbl').closest('.control-group').show(); - // add required attribute to php_batchmove field - if (jform_vvvvvxvvxl_required) - { - updateFieldRequired('php_batchmove',0); - jQuery('#jform_php_batchmove').prop('required','required'); - jQuery('#jform_php_batchmove').attr('aria-required',true); - jQuery('#jform_php_batchmove').addClass('required'); - jform_vvvvvxvvxl_required = false; - } } else { jQuery('#jform_php_batchmove-lbl').closest('.control-group').hide(); - // remove required attribute from php_batchmove field - if (!jform_vvvvvxvvxl_required) - { - updateFieldRequired('php_batchmove',1); - jQuery('#jform_php_batchmove').removeAttr('required'); - jQuery('#jform_php_batchmove').removeAttr('aria-required'); - jQuery('#jform_php_batchmove').removeClass('required'); - jform_vvvvvxvvxl_required = true; - } } } -// the vvvvvxw function -function vvvvvxw(add_php_before_publish_vvvvvxw) +// the vvvvvyu function +function vvvvvyu(add_php_before_publish_vvvvvyu) { // set the function logic - if (add_php_before_publish_vvvvvxw == 1) + if (add_php_before_publish_vvvvvyu == 1) { jQuery('#jform_php_before_publish-lbl').closest('.control-group').show(); - // add required attribute to php_before_publish field - if (jform_vvvvvxwvxm_required) - { - updateFieldRequired('php_before_publish',0); - jQuery('#jform_php_before_publish').prop('required','required'); - jQuery('#jform_php_before_publish').attr('aria-required',true); - jQuery('#jform_php_before_publish').addClass('required'); - jform_vvvvvxwvxm_required = false; - } } else { jQuery('#jform_php_before_publish-lbl').closest('.control-group').hide(); - // remove required attribute from php_before_publish field - if (!jform_vvvvvxwvxm_required) - { - updateFieldRequired('php_before_publish',1); - jQuery('#jform_php_before_publish').removeAttr('required'); - jQuery('#jform_php_before_publish').removeAttr('aria-required'); - jQuery('#jform_php_before_publish').removeClass('required'); - jform_vvvvvxwvxm_required = true; - } } } -// the vvvvvxx function -function vvvvvxx(add_php_after_publish_vvvvvxx) +// the vvvvvyv function +function vvvvvyv(add_php_after_publish_vvvvvyv) { // set the function logic - if (add_php_after_publish_vvvvvxx == 1) + if (add_php_after_publish_vvvvvyv == 1) { jQuery('#jform_php_after_publish-lbl').closest('.control-group').show(); - // add required attribute to php_after_publish field - if (jform_vvvvvxxvxn_required) - { - updateFieldRequired('php_after_publish',0); - jQuery('#jform_php_after_publish').prop('required','required'); - jQuery('#jform_php_after_publish').attr('aria-required',true); - jQuery('#jform_php_after_publish').addClass('required'); - jform_vvvvvxxvxn_required = false; - } } else { jQuery('#jform_php_after_publish-lbl').closest('.control-group').hide(); - // remove required attribute from php_after_publish field - if (!jform_vvvvvxxvxn_required) - { - updateFieldRequired('php_after_publish',1); - jQuery('#jform_php_after_publish').removeAttr('required'); - jQuery('#jform_php_after_publish').removeAttr('aria-required'); - jQuery('#jform_php_after_publish').removeClass('required'); - jform_vvvvvxxvxn_required = true; - } } } -// the vvvvvxy function -function vvvvvxy(add_php_before_delete_vvvvvxy) +// the vvvvvyw function +function vvvvvyw(add_php_before_delete_vvvvvyw) { // set the function logic - if (add_php_before_delete_vvvvvxy == 1) + if (add_php_before_delete_vvvvvyw == 1) { jQuery('#jform_php_before_delete-lbl').closest('.control-group').show(); - // add required attribute to php_before_delete field - if (jform_vvvvvxyvxo_required) - { - updateFieldRequired('php_before_delete',0); - jQuery('#jform_php_before_delete').prop('required','required'); - jQuery('#jform_php_before_delete').attr('aria-required',true); - jQuery('#jform_php_before_delete').addClass('required'); - jform_vvvvvxyvxo_required = false; - } } else { jQuery('#jform_php_before_delete-lbl').closest('.control-group').hide(); - // remove required attribute from php_before_delete field - if (!jform_vvvvvxyvxo_required) - { - updateFieldRequired('php_before_delete',1); - jQuery('#jform_php_before_delete').removeAttr('required'); - jQuery('#jform_php_before_delete').removeAttr('aria-required'); - jQuery('#jform_php_before_delete').removeClass('required'); - jform_vvvvvxyvxo_required = true; - } } } -// the vvvvvxz function -function vvvvvxz(add_php_after_delete_vvvvvxz) +// the vvvvvyx function +function vvvvvyx(add_php_after_delete_vvvvvyx) { // set the function logic - if (add_php_after_delete_vvvvvxz == 1) + if (add_php_after_delete_vvvvvyx == 1) { jQuery('#jform_php_after_delete-lbl').closest('.control-group').show(); - // add required attribute to php_after_delete field - if (jform_vvvvvxzvxp_required) - { - updateFieldRequired('php_after_delete',0); - jQuery('#jform_php_after_delete').prop('required','required'); - jQuery('#jform_php_after_delete').attr('aria-required',true); - jQuery('#jform_php_after_delete').addClass('required'); - jform_vvvvvxzvxp_required = false; - } } else { jQuery('#jform_php_after_delete-lbl').closest('.control-group').hide(); - // remove required attribute from php_after_delete field - if (!jform_vvvvvxzvxp_required) - { - updateFieldRequired('php_after_delete',1); - jQuery('#jform_php_after_delete').removeAttr('required'); - jQuery('#jform_php_after_delete').removeAttr('aria-required'); - jQuery('#jform_php_after_delete').removeClass('required'); - jform_vvvvvxzvxp_required = true; - } } } -// the vvvvvya function -function vvvvvya(add_php_document_vvvvvya) +// the vvvvvyy function +function vvvvvyy(add_php_document_vvvvvyy) { // set the function logic - if (add_php_document_vvvvvya == 1) + if (add_php_document_vvvvvyy == 1) { jQuery('#jform_php_document-lbl').closest('.control-group').show(); - // add required attribute to php_document field - if (jform_vvvvvyavxq_required) - { - updateFieldRequired('php_document',0); - jQuery('#jform_php_document').prop('required','required'); - jQuery('#jform_php_document').attr('aria-required',true); - jQuery('#jform_php_document').addClass('required'); - jform_vvvvvyavxq_required = false; - } } else { jQuery('#jform_php_document-lbl').closest('.control-group').hide(); - // remove required attribute from php_document field - if (!jform_vvvvvyavxq_required) - { - updateFieldRequired('php_document',1); - jQuery('#jform_php_document').removeAttr('required'); - jQuery('#jform_php_document').removeAttr('aria-required'); - jQuery('#jform_php_document').removeClass('required'); - jform_vvvvvyavxq_required = true; - } } } -// the vvvvvyb function -function vvvvvyb(add_sql_vvvvvyb) +// the vvvvvyz function +function vvvvvyz(add_sql_vvvvvyz) { // set the function logic - if (add_sql_vvvvvyb == 1) + if (add_sql_vvvvvyz == 1) { jQuery('#jform_source').closest('.control-group').show(); // add required attribute to source field - if (jform_vvvvvybvxr_required) + if (jform_vvvvvyzvwh_required) { updateFieldRequired('source',0); jQuery('#jform_source').prop('required','required'); jQuery('#jform_source').attr('aria-required',true); jQuery('#jform_source').addClass('required'); - jform_vvvvvybvxr_required = false; + jform_vvvvvyzvwh_required = false; } } else { jQuery('#jform_source').closest('.control-group').hide(); // remove required attribute from source field - if (!jform_vvvvvybvxr_required) + if (!jform_vvvvvyzvwh_required) { updateFieldRequired('source',1); jQuery('#jform_source').removeAttr('required'); jQuery('#jform_source').removeAttr('aria-required'); jQuery('#jform_source').removeClass('required'); - jform_vvvvvybvxr_required = true; + jform_vvvvvyzvwh_required = true; } } } -// the vvvvvyc function -function vvvvvyc(source_vvvvvyc,add_sql_vvvvvyc) +// the vvvvvza function +function vvvvvza(source_vvvvvza,add_sql_vvvvvza) { // set the function logic - if (source_vvvvvyc == 2 && add_sql_vvvvvyc == 1) + if (source_vvvvvza == 2 && add_sql_vvvvvza == 1) { jQuery('#jform_sql').closest('.control-group').show(); // add required attribute to sql field - if (jform_vvvvvycvxs_required) + if (jform_vvvvvzavwi_required) { updateFieldRequired('sql',0); jQuery('#jform_sql').prop('required','required'); jQuery('#jform_sql').attr('aria-required',true); jQuery('#jform_sql').addClass('required'); - jform_vvvvvycvxs_required = false; + jform_vvvvvzavwi_required = false; } } else { jQuery('#jform_sql').closest('.control-group').hide(); // remove required attribute from sql field - if (!jform_vvvvvycvxs_required) + if (!jform_vvvvvzavwi_required) { updateFieldRequired('sql',1); jQuery('#jform_sql').removeAttr('required'); jQuery('#jform_sql').removeAttr('aria-required'); jQuery('#jform_sql').removeClass('required'); - jform_vvvvvycvxs_required = true; + jform_vvvvvzavwi_required = true; } } } -// the vvvvvye function -function vvvvvye(source_vvvvvye,add_sql_vvvvvye) +// the vvvvvzc function +function vvvvvzc(source_vvvvvzc,add_sql_vvvvvzc) { // set the function logic - if (source_vvvvvye == 1 && add_sql_vvvvvye == 1) + if (source_vvvvvzc == 1 && add_sql_vvvvvzc == 1) { jQuery('#jform_addtables-lbl').closest('.control-group').show(); } @@ -1063,165 +565,165 @@ function vvvvvye(source_vvvvvye,add_sql_vvvvvye) } } -// the vvvvvyg function -function vvvvvyg(add_custom_import_vvvvvyg) +// the vvvvvze function +function vvvvvze(add_custom_import_vvvvvze) { // set the function logic - if (add_custom_import_vvvvvyg == 1) + if (add_custom_import_vvvvvze == 1) { jQuery('#jform_html_import_view').closest('.control-group').show(); // add required attribute to html_import_view field - if (jform_vvvvvygvxt_required) + if (jform_vvvvvzevwj_required) { updateFieldRequired('html_import_view',0); jQuery('#jform_html_import_view').prop('required','required'); jQuery('#jform_html_import_view').attr('aria-required',true); jQuery('#jform_html_import_view').addClass('required'); - jform_vvvvvygvxt_required = false; + jform_vvvvvzevwj_required = false; } jQuery('.note_advanced_import').closest('.control-group').show(); jQuery('#jform_php_import_display').closest('.control-group').show(); // add required attribute to php_import_display field - if (jform_vvvvvygvxu_required) + if (jform_vvvvvzevwk_required) { updateFieldRequired('php_import_display',0); jQuery('#jform_php_import_display').prop('required','required'); jQuery('#jform_php_import_display').attr('aria-required',true); jQuery('#jform_php_import_display').addClass('required'); - jform_vvvvvygvxu_required = false; + jform_vvvvvzevwk_required = false; } jQuery('#jform_php_import_ext').closest('.control-group').show(); // add required attribute to php_import_ext field - if (jform_vvvvvygvxv_required) + if (jform_vvvvvzevwl_required) { updateFieldRequired('php_import_ext',0); jQuery('#jform_php_import_ext').prop('required','required'); jQuery('#jform_php_import_ext').attr('aria-required',true); jQuery('#jform_php_import_ext').addClass('required'); - jform_vvvvvygvxv_required = false; + jform_vvvvvzevwl_required = false; } jQuery('#jform_php_import_headers').closest('.control-group').show(); // add required attribute to php_import_headers field - if (jform_vvvvvygvxw_required) + if (jform_vvvvvzevwm_required) { updateFieldRequired('php_import_headers',0); jQuery('#jform_php_import_headers').prop('required','required'); jQuery('#jform_php_import_headers').attr('aria-required',true); jQuery('#jform_php_import_headers').addClass('required'); - jform_vvvvvygvxw_required = false; + jform_vvvvvzevwm_required = false; } jQuery('#jform_php_import').closest('.control-group').show(); // add required attribute to php_import field - if (jform_vvvvvygvxx_required) + if (jform_vvvvvzevwn_required) { updateFieldRequired('php_import',0); jQuery('#jform_php_import').prop('required','required'); jQuery('#jform_php_import').attr('aria-required',true); jQuery('#jform_php_import').addClass('required'); - jform_vvvvvygvxx_required = false; + jform_vvvvvzevwn_required = false; } jQuery('#jform_php_import_save').closest('.control-group').show(); // add required attribute to php_import_save field - if (jform_vvvvvygvxy_required) + if (jform_vvvvvzevwo_required) { updateFieldRequired('php_import_save',0); jQuery('#jform_php_import_save').prop('required','required'); jQuery('#jform_php_import_save').attr('aria-required',true); jQuery('#jform_php_import_save').addClass('required'); - jform_vvvvvygvxy_required = false; + jform_vvvvvzevwo_required = false; } jQuery('#jform_php_import_setdata').closest('.control-group').show(); // add required attribute to php_import_setdata field - if (jform_vvvvvygvxz_required) + if (jform_vvvvvzevwp_required) { updateFieldRequired('php_import_setdata',0); jQuery('#jform_php_import_setdata').prop('required','required'); jQuery('#jform_php_import_setdata').attr('aria-required',true); jQuery('#jform_php_import_setdata').addClass('required'); - jform_vvvvvygvxz_required = false; + jform_vvvvvzevwp_required = false; } } else { jQuery('#jform_html_import_view').closest('.control-group').hide(); // remove required attribute from html_import_view field - if (!jform_vvvvvygvxt_required) + if (!jform_vvvvvzevwj_required) { updateFieldRequired('html_import_view',1); jQuery('#jform_html_import_view').removeAttr('required'); jQuery('#jform_html_import_view').removeAttr('aria-required'); jQuery('#jform_html_import_view').removeClass('required'); - jform_vvvvvygvxt_required = true; + jform_vvvvvzevwj_required = true; } jQuery('.note_advanced_import').closest('.control-group').hide(); jQuery('#jform_php_import_display').closest('.control-group').hide(); // remove required attribute from php_import_display field - if (!jform_vvvvvygvxu_required) + if (!jform_vvvvvzevwk_required) { updateFieldRequired('php_import_display',1); jQuery('#jform_php_import_display').removeAttr('required'); jQuery('#jform_php_import_display').removeAttr('aria-required'); jQuery('#jform_php_import_display').removeClass('required'); - jform_vvvvvygvxu_required = true; + jform_vvvvvzevwk_required = true; } jQuery('#jform_php_import_ext').closest('.control-group').hide(); // remove required attribute from php_import_ext field - if (!jform_vvvvvygvxv_required) + if (!jform_vvvvvzevwl_required) { updateFieldRequired('php_import_ext',1); jQuery('#jform_php_import_ext').removeAttr('required'); jQuery('#jform_php_import_ext').removeAttr('aria-required'); jQuery('#jform_php_import_ext').removeClass('required'); - jform_vvvvvygvxv_required = true; + jform_vvvvvzevwl_required = true; } jQuery('#jform_php_import_headers').closest('.control-group').hide(); // remove required attribute from php_import_headers field - if (!jform_vvvvvygvxw_required) + if (!jform_vvvvvzevwm_required) { updateFieldRequired('php_import_headers',1); jQuery('#jform_php_import_headers').removeAttr('required'); jQuery('#jform_php_import_headers').removeAttr('aria-required'); jQuery('#jform_php_import_headers').removeClass('required'); - jform_vvvvvygvxw_required = true; + jform_vvvvvzevwm_required = true; } jQuery('#jform_php_import').closest('.control-group').hide(); // remove required attribute from php_import field - if (!jform_vvvvvygvxx_required) + if (!jform_vvvvvzevwn_required) { updateFieldRequired('php_import',1); jQuery('#jform_php_import').removeAttr('required'); jQuery('#jform_php_import').removeAttr('aria-required'); jQuery('#jform_php_import').removeClass('required'); - jform_vvvvvygvxx_required = true; + jform_vvvvvzevwn_required = true; } jQuery('#jform_php_import_save').closest('.control-group').hide(); // remove required attribute from php_import_save field - if (!jform_vvvvvygvxy_required) + if (!jform_vvvvvzevwo_required) { updateFieldRequired('php_import_save',1); jQuery('#jform_php_import_save').removeAttr('required'); jQuery('#jform_php_import_save').removeAttr('aria-required'); jQuery('#jform_php_import_save').removeClass('required'); - jform_vvvvvygvxy_required = true; + jform_vvvvvzevwo_required = true; } jQuery('#jform_php_import_setdata').closest('.control-group').hide(); // remove required attribute from php_import_setdata field - if (!jform_vvvvvygvxz_required) + if (!jform_vvvvvzevwp_required) { updateFieldRequired('php_import_setdata',1); jQuery('#jform_php_import_setdata').removeAttr('required'); jQuery('#jform_php_import_setdata').removeAttr('aria-required'); jQuery('#jform_php_import_setdata').removeClass('required'); - jform_vvvvvygvxz_required = true; + jform_vvvvvzevwp_required = true; } } } -// the vvvvvyh function -function vvvvvyh(add_custom_import_vvvvvyh) +// the vvvvvzf function +function vvvvvzf(add_custom_import_vvvvvzf) { // set the function logic - if (add_custom_import_vvvvvyh == 0) + if (add_custom_import_vvvvvzf == 0) { jQuery('.note_beginner_import').closest('.control-group').show(); } @@ -1231,97 +733,25 @@ function vvvvvyh(add_custom_import_vvvvvyh) } } -// the vvvvvyi function -function vvvvvyi(add_custom_button_vvvvvyi) +// the vvvvvzg function +function vvvvvzg(add_custom_button_vvvvvzg) { // set the function logic - if (add_custom_button_vvvvvyi == 1) + if (add_custom_button_vvvvvzg == 1) { jQuery('#jform_custom_button-lbl').closest('.control-group').show(); jQuery('#jform_php_controller-lbl').closest('.control-group').show(); - // add required attribute to php_controller field - if (jform_vvvvvyivya_required) - { - updateFieldRequired('php_controller',0); - jQuery('#jform_php_controller').prop('required','required'); - jQuery('#jform_php_controller').attr('aria-required',true); - jQuery('#jform_php_controller').addClass('required'); - jform_vvvvvyivya_required = false; - } jQuery('#jform_php_controller_list-lbl').closest('.control-group').show(); - // add required attribute to php_controller_list field - if (jform_vvvvvyivyb_required) - { - updateFieldRequired('php_controller_list',0); - jQuery('#jform_php_controller_list').prop('required','required'); - jQuery('#jform_php_controller_list').attr('aria-required',true); - jQuery('#jform_php_controller_list').addClass('required'); - jform_vvvvvyivyb_required = false; - } jQuery('#jform_php_model-lbl').closest('.control-group').show(); - // add required attribute to php_model field - if (jform_vvvvvyivyc_required) - { - updateFieldRequired('php_model',0); - jQuery('#jform_php_model').prop('required','required'); - jQuery('#jform_php_model').attr('aria-required',true); - jQuery('#jform_php_model').addClass('required'); - jform_vvvvvyivyc_required = false; - } jQuery('#jform_php_model_list-lbl').closest('.control-group').show(); - // add required attribute to php_model_list field - if (jform_vvvvvyivyd_required) - { - updateFieldRequired('php_model_list',0); - jQuery('#jform_php_model_list').prop('required','required'); - jQuery('#jform_php_model_list').attr('aria-required',true); - jQuery('#jform_php_model_list').addClass('required'); - jform_vvvvvyivyd_required = false; - } } else { jQuery('#jform_custom_button-lbl').closest('.control-group').hide(); jQuery('#jform_php_controller-lbl').closest('.control-group').hide(); - // remove required attribute from php_controller field - if (!jform_vvvvvyivya_required) - { - updateFieldRequired('php_controller',1); - jQuery('#jform_php_controller').removeAttr('required'); - jQuery('#jform_php_controller').removeAttr('aria-required'); - jQuery('#jform_php_controller').removeClass('required'); - jform_vvvvvyivya_required = true; - } jQuery('#jform_php_controller_list-lbl').closest('.control-group').hide(); - // remove required attribute from php_controller_list field - if (!jform_vvvvvyivyb_required) - { - updateFieldRequired('php_controller_list',1); - jQuery('#jform_php_controller_list').removeAttr('required'); - jQuery('#jform_php_controller_list').removeAttr('aria-required'); - jQuery('#jform_php_controller_list').removeClass('required'); - jform_vvvvvyivyb_required = true; - } jQuery('#jform_php_model-lbl').closest('.control-group').hide(); - // remove required attribute from php_model field - if (!jform_vvvvvyivyc_required) - { - updateFieldRequired('php_model',1); - jQuery('#jform_php_model').removeAttr('required'); - jQuery('#jform_php_model').removeAttr('aria-required'); - jQuery('#jform_php_model').removeClass('required'); - jform_vvvvvyivyc_required = true; - } jQuery('#jform_php_model_list-lbl').closest('.control-group').hide(); - // remove required attribute from php_model_list field - if (!jform_vvvvvyivyd_required) - { - updateFieldRequired('php_model_list',1); - jQuery('#jform_php_model_list').removeAttr('required'); - jQuery('#jform_php_model_list').removeAttr('aria-required'); - jQuery('#jform_php_model_list').removeClass('required'); - jform_vvvvvyivyd_required = true; - } } } @@ -1404,9 +834,9 @@ function checkAliasField() { } function checkAliasField_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.checkAliasField&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.checkAliasField&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type > 0){ - var request = 'token='+token+'&type=' + type; + var request = token+'=1&type=' + type; } return jQuery.ajax({ type: 'GET', @@ -1428,9 +858,9 @@ function getAjaxDisplay(type){ } function getAjaxDisplay_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type=' + type; + var request = token+'=1&type=' + type; } return jQuery.ajax({ type: 'GET', @@ -1446,9 +876,9 @@ function addData(result,where){ } function getTableColumns_server(tableName){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.tableColumns&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.tableColumns&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && tableName.length > 0){ - var request = 'token='+token+'&table='+tableName; + var request = token+'=1&table='+tableName; } return jQuery.ajax({ type: 'GET', @@ -1477,9 +907,9 @@ function getTableColumns(fieldKey, table_, nr_){ } function getDynamicScripts_server(typpe){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getDynamicScripts&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicScripts&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && typpe.length > 0){ - var request = 'token='+token+'&type='+typpe; + var request = token+'=1&type='+typpe; } return jQuery.ajax({ type: 'GET', @@ -1560,9 +990,9 @@ function getDynamicScripts(id){ } function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', @@ -1601,7 +1031,7 @@ function isObject(obj) { function addButtonID_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0 && size > 0){ - var request = 'token='+token+'&type='+type+'&size='+size; + var request = token+'=1&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -1626,7 +1056,7 @@ function addButtonID(type, where, size){ function addButton_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type='+type+'&size='+size; + var request = token+'=1&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -1651,9 +1081,9 @@ function addButton(type, where, size){ } function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type > 0){ - var request = 'token='+token+'&type='+type; + var request = token+'=1&type='+type; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/admin_view.xml b/admin/models/forms/admin_view.xml index b2c2bdd88..41b154bc2 100644 --- a/admin/models/forms/admin_view.xml +++ b/admin/models/forms/admin_view.xml @@ -1094,7 +1094,7 @@ readonly="false" disabled="false" required="true" - filter="WORD" + filter="STRING" message="COM_COMPONENTBUILDER_ADMIN_VIEW_KEY_MESSAGE" hint="COM_COMPONENTBUILDER_ADMIN_VIEW_KEY_HINT" /> @@ -1277,7 +1277,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1308,7 +1307,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1325,7 +1323,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1342,7 +1339,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1373,7 +1369,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1390,7 +1385,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1407,7 +1401,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1438,7 +1431,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1455,7 +1447,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1472,7 +1463,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1503,7 +1493,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1520,7 +1509,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1537,7 +1525,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1568,7 +1555,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1585,7 +1571,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1602,7 +1587,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1633,7 +1617,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1650,7 +1633,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1667,7 +1649,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1698,7 +1679,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -2223,7 +2203,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -2240,7 +2219,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="false" validate="code" /> @@ -2257,7 +2235,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -2274,7 +2251,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="false" validate="code" /> @@ -2291,7 +2267,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -2308,7 +2283,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="false" validate="code" /> @@ -2420,7 +2394,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="false" validate="code" /> @@ -2487,7 +2460,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -2686,7 +2658,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -2743,7 +2714,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> diff --git a/admin/models/forms/class_extends.js b/admin/models/forms/class_extends.js new file mode 100644 index 000000000..bb3404a02 --- /dev/null +++ b/admin/models/forms/class_extends.js @@ -0,0 +1,59 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + + + + +jQuery(document).ready(function() +{ + // load the used in div + // jQuery('#usedin').show(); + // check and load all the customcode edit buttons + setTimeout(getEditCustomCodeButtons, 300); +}); + +function getEditCustomCodeButtons_server(id){ + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); + if(token.length > 0 && id > 0){ + var request = token+'=1&id='+id+'&return_here='+return_here; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'json', + data: request, + jsonp: false + }); +} + +function getEditCustomCodeButtons(){ + // get the id + id = jQuery("#jform_id").val(); + getEditCustomCodeButtons_server(id).done(function(result) { + if(isObject(result)){ + jQuery.each(result, function( field, buttons ) { + jQuery('
    ').insertBefore(".control-wrapper-"+ field); + jQuery.each(buttons, function( name, button ) { + jQuery(".control-customcode-buttons-"+field).append(button); + }); + }); + } + }) +} + +// check object is not empty +function isObject(obj) { + for(var prop in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop)) { + return true; + } + } + return false; +} diff --git a/admin/models/forms/class_extends.xml b/admin/models/forms/class_extends.xml new file mode 100644 index 000000000..7fa36c691 --- /dev/null +++ b/admin/models/forms/class_extends.xml @@ -0,0 +1,176 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    +
    \ No newline at end of file diff --git a/admin/models/forms/class_method.js b/admin/models/forms/class_method.js new file mode 100644 index 000000000..3cfc64fa8 --- /dev/null +++ b/admin/models/forms/class_method.js @@ -0,0 +1,159 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// Some Global Values +jform_vvvvwbkvxi_required = false; + +// Initial Script +jQuery(document).ready(function() +{ + var extension_type_vvvvwbk = jQuery("#jform_extension_type").val(); + vvvvwbk(extension_type_vvvvwbk); +}); + +// the vvvvwbk function +function vvvvwbk(extension_type_vvvvwbk) +{ + if (isSet(extension_type_vvvvwbk) && extension_type_vvvvwbk.constructor !== Array) + { + var temp_vvvvwbk = extension_type_vvvvwbk; + var extension_type_vvvvwbk = []; + extension_type_vvvvwbk.push(temp_vvvvwbk); + } + else if (!isSet(extension_type_vvvvwbk)) + { + var extension_type_vvvvwbk = []; + } + var extension_type = extension_type_vvvvwbk.some(extension_type_vvvvwbk_SomeFunc); + + + // set this function logic + if (extension_type) + { + jQuery('#jform_joomla_plugin_group').closest('.control-group').show(); + // add required attribute to joomla_plugin_group field + if (jform_vvvvwbkvxi_required) + { + updateFieldRequired('joomla_plugin_group',0); + jQuery('#jform_joomla_plugin_group').prop('required','required'); + jQuery('#jform_joomla_plugin_group').attr('aria-required',true); + jQuery('#jform_joomla_plugin_group').addClass('required'); + jform_vvvvwbkvxi_required = false; + } + } + else + { + jQuery('#jform_joomla_plugin_group').closest('.control-group').hide(); + // remove required attribute from joomla_plugin_group field + if (!jform_vvvvwbkvxi_required) + { + updateFieldRequired('joomla_plugin_group',1); + jQuery('#jform_joomla_plugin_group').removeAttr('required'); + jQuery('#jform_joomla_plugin_group').removeAttr('aria-required'); + jQuery('#jform_joomla_plugin_group').removeClass('required'); + jform_vvvvwbkvxi_required = true; + } + } +} + +// the vvvvwbk Some function +function extension_type_vvvvwbk_SomeFunc(extension_type_vvvvwbk) +{ + // set the function logic + if (extension_type_vvvvwbk == 'plugins' || extension_type_vvvvwbk == 'plugin') + { + return true; + } + return false; +} + +// update required fields +function updateFieldRequired(name,status) +{ + var not_required = jQuery('#jform_not_required').val(); + + if(status == 1) + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required+','+name; + } + else + { + not_required = ','+name; + } + } + else + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required.replace(','+name,''); + } + } + + jQuery('#jform_not_required').val(not_required); +} + +// the isSet function +function isSet(val) +{ + if ((val != undefined) && (val != null) && 0 !== val.length){ + return true; + } + return false; +} + + +jQuery(document).ready(function() +{ + // load the used in div + // jQuery('#usedin').show(); + // check and load all the customcode edit buttons + setTimeout(getEditCustomCodeButtons, 300); +}); + +function getEditCustomCodeButtons_server(id){ + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); + if(token.length > 0 && id > 0){ + var request = token+'=1&id='+id+'&return_here='+return_here; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'json', + data: request, + jsonp: false + }); +} + +function getEditCustomCodeButtons(){ + // get the id + id = jQuery("#jform_id").val(); + getEditCustomCodeButtons_server(id).done(function(result) { + if(isObject(result)){ + jQuery.each(result, function( field, buttons ) { + jQuery('
    ').insertBefore(".control-wrapper-"+ field); + jQuery.each(buttons, function( name, button ) { + jQuery(".control-customcode-buttons-"+field).append(button); + }); + }); + } + }) +} + +// check object is not empty +function isObject(obj) { + for(var prop in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop)) { + return true; + } + } + return false; +} diff --git a/admin/models/forms/class_method.xml b/admin/models/forms/class_method.xml new file mode 100644 index 000000000..9c65bf583 --- /dev/null +++ b/admin/models/forms/class_method.xml @@ -0,0 +1,217 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    +
    \ No newline at end of file diff --git a/admin/models/forms/class_property.js b/admin/models/forms/class_property.js new file mode 100644 index 000000000..380cd414a --- /dev/null +++ b/admin/models/forms/class_property.js @@ -0,0 +1,159 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// Some Global Values +jform_vvvvwbjvxh_required = false; + +// Initial Script +jQuery(document).ready(function() +{ + var extension_type_vvvvwbj = jQuery("#jform_extension_type").val(); + vvvvwbj(extension_type_vvvvwbj); +}); + +// the vvvvwbj function +function vvvvwbj(extension_type_vvvvwbj) +{ + if (isSet(extension_type_vvvvwbj) && extension_type_vvvvwbj.constructor !== Array) + { + var temp_vvvvwbj = extension_type_vvvvwbj; + var extension_type_vvvvwbj = []; + extension_type_vvvvwbj.push(temp_vvvvwbj); + } + else if (!isSet(extension_type_vvvvwbj)) + { + var extension_type_vvvvwbj = []; + } + var extension_type = extension_type_vvvvwbj.some(extension_type_vvvvwbj_SomeFunc); + + + // set this function logic + if (extension_type) + { + jQuery('#jform_joomla_plugin_group').closest('.control-group').show(); + // add required attribute to joomla_plugin_group field + if (jform_vvvvwbjvxh_required) + { + updateFieldRequired('joomla_plugin_group',0); + jQuery('#jform_joomla_plugin_group').prop('required','required'); + jQuery('#jform_joomla_plugin_group').attr('aria-required',true); + jQuery('#jform_joomla_plugin_group').addClass('required'); + jform_vvvvwbjvxh_required = false; + } + } + else + { + jQuery('#jform_joomla_plugin_group').closest('.control-group').hide(); + // remove required attribute from joomla_plugin_group field + if (!jform_vvvvwbjvxh_required) + { + updateFieldRequired('joomla_plugin_group',1); + jQuery('#jform_joomla_plugin_group').removeAttr('required'); + jQuery('#jform_joomla_plugin_group').removeAttr('aria-required'); + jQuery('#jform_joomla_plugin_group').removeClass('required'); + jform_vvvvwbjvxh_required = true; + } + } +} + +// the vvvvwbj Some function +function extension_type_vvvvwbj_SomeFunc(extension_type_vvvvwbj) +{ + // set the function logic + if (extension_type_vvvvwbj == 'plugins' || extension_type_vvvvwbj == 'plugin') + { + return true; + } + return false; +} + +// update required fields +function updateFieldRequired(name,status) +{ + var not_required = jQuery('#jform_not_required').val(); + + if(status == 1) + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required+','+name; + } + else + { + not_required = ','+name; + } + } + else + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required.replace(','+name,''); + } + } + + jQuery('#jform_not_required').val(not_required); +} + +// the isSet function +function isSet(val) +{ + if ((val != undefined) && (val != null) && 0 !== val.length){ + return true; + } + return false; +} + + +jQuery(document).ready(function() +{ + // load the used in div + // jQuery('#usedin').show(); + // check and load all the customcode edit buttons + setTimeout(getEditCustomCodeButtons, 300); +}); + +function getEditCustomCodeButtons_server(id){ + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); + if(token.length > 0 && id > 0){ + var request = token+'=1&id='+id+'&return_here='+return_here; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'json', + data: request, + jsonp: false + }); +} + +function getEditCustomCodeButtons(){ + // get the id + id = jQuery("#jform_id").val(); + getEditCustomCodeButtons_server(id).done(function(result) { + if(isObject(result)){ + jQuery.each(result, function( field, buttons ) { + jQuery('
    ').insertBefore(".control-wrapper-"+ field); + jQuery.each(buttons, function( name, button ) { + jQuery(".control-customcode-buttons-"+field).append(button); + }); + }); + } + }) +} + +// check object is not empty +function isObject(obj) { + for(var prop in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop)) { + return true; + } + } + return false; +} diff --git a/admin/models/forms/class_property.xml b/admin/models/forms/class_property.xml new file mode 100644 index 000000000..f72397049 --- /dev/null +++ b/admin/models/forms/class_property.xml @@ -0,0 +1,201 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    +
    \ No newline at end of file diff --git a/admin/models/forms/component_dashboard.js b/admin/models/forms/component_dashboard.js index 70dd5c103..e6c741404 100644 --- a/admin/models/forms/component_dashboard.js +++ b/admin/models/forms/component_dashboard.js @@ -18,9 +18,9 @@ jQuery(document).ready(function() }); function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/component_dashboard.xml b/admin/models/forms/component_dashboard.xml index cc70427cd..c9df3de30 100644 --- a/admin/models/forms/component_dashboard.xml +++ b/admin/models/forms/component_dashboard.xml @@ -98,6 +98,19 @@ readonly="true" button="false" /> + + - - + + diff --git a/admin/models/forms/component_plugins.js b/admin/models/forms/component_plugins.js new file mode 100644 index 000000000..406de38ba --- /dev/null +++ b/admin/models/forms/component_plugins.js @@ -0,0 +1,11 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + + diff --git a/admin/models/forms/component_plugins.xml b/admin/models/forms/component_plugins.xml new file mode 100644 index 000000000..64feb0324 --- /dev/null +++ b/admin/models/forms/component_plugins.xml @@ -0,0 +1,150 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    + \ No newline at end of file diff --git a/admin/models/forms/custom_admin_view.js b/admin/models/forms/custom_admin_view.js index 892068a37..ebc8517c7 100644 --- a/admin/models/forms/custom_admin_view.js +++ b/admin/models/forms/custom_admin_view.js @@ -8,424 +8,186 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -// Some Global Values -jform_vvvvvyjvye_required = false; -jform_vvvvvykvyf_required = false; -jform_vvvvvylvyg_required = false; -jform_vvvvvymvyh_required = false; -jform_vvvvvynvyi_required = false; -jform_vvvvvyovyj_required = false; -jform_vvvvvypvyk_required = false; -jform_vvvvvyqvyl_required = false; -jform_vvvvvyqvym_required = false; -jform_vvvvvyrvyn_required = false; -jform_vvvvvysvyo_required = false; - // Initial Script jQuery(document).ready(function() { - var add_php_view_vvvvvyj = jQuery("#jform_add_php_view input[type='radio']:checked").val(); - vvvvvyj(add_php_view_vvvvvyj); + var add_php_view_vvvvvzh = jQuery("#jform_add_php_view input[type='radio']:checked").val(); + vvvvvzh(add_php_view_vvvvvzh); - var add_php_jview_display_vvvvvyk = jQuery("#jform_add_php_jview_display input[type='radio']:checked").val(); - vvvvvyk(add_php_jview_display_vvvvvyk); + var add_php_jview_display_vvvvvzi = jQuery("#jform_add_php_jview_display input[type='radio']:checked").val(); + vvvvvzi(add_php_jview_display_vvvvvzi); - var add_php_jview_vvvvvyl = jQuery("#jform_add_php_jview input[type='radio']:checked").val(); - vvvvvyl(add_php_jview_vvvvvyl); + var add_php_jview_vvvvvzj = jQuery("#jform_add_php_jview input[type='radio']:checked").val(); + vvvvvzj(add_php_jview_vvvvvzj); - var add_php_document_vvvvvym = jQuery("#jform_add_php_document input[type='radio']:checked").val(); - vvvvvym(add_php_document_vvvvvym); + var add_php_document_vvvvvzk = jQuery("#jform_add_php_document input[type='radio']:checked").val(); + vvvvvzk(add_php_document_vvvvvzk); - var add_css_document_vvvvvyn = jQuery("#jform_add_css_document input[type='radio']:checked").val(); - vvvvvyn(add_css_document_vvvvvyn); + var add_css_document_vvvvvzl = jQuery("#jform_add_css_document input[type='radio']:checked").val(); + vvvvvzl(add_css_document_vvvvvzl); - var add_javascript_file_vvvvvyo = jQuery("#jform_add_javascript_file input[type='radio']:checked").val(); - vvvvvyo(add_javascript_file_vvvvvyo); + var add_javascript_file_vvvvvzm = jQuery("#jform_add_javascript_file input[type='radio']:checked").val(); + vvvvvzm(add_javascript_file_vvvvvzm); - var add_js_document_vvvvvyp = jQuery("#jform_add_js_document input[type='radio']:checked").val(); - vvvvvyp(add_js_document_vvvvvyp); + var add_js_document_vvvvvzn = jQuery("#jform_add_js_document input[type='radio']:checked").val(); + vvvvvzn(add_js_document_vvvvvzn); - var add_custom_button_vvvvvyq = jQuery("#jform_add_custom_button input[type='radio']:checked").val(); - vvvvvyq(add_custom_button_vvvvvyq); + var add_custom_button_vvvvvzo = jQuery("#jform_add_custom_button input[type='radio']:checked").val(); + vvvvvzo(add_custom_button_vvvvvzo); - var add_css_vvvvvyr = jQuery("#jform_add_css input[type='radio']:checked").val(); - vvvvvyr(add_css_vvvvvyr); + var add_css_vvvvvzp = jQuery("#jform_add_css input[type='radio']:checked").val(); + vvvvvzp(add_css_vvvvvzp); - var add_php_ajax_vvvvvys = jQuery("#jform_add_php_ajax input[type='radio']:checked").val(); - vvvvvys(add_php_ajax_vvvvvys); + var add_php_ajax_vvvvvzq = jQuery("#jform_add_php_ajax input[type='radio']:checked").val(); + vvvvvzq(add_php_ajax_vvvvvzq); }); -// the vvvvvyj function -function vvvvvyj(add_php_view_vvvvvyj) +// the vvvvvzh function +function vvvvvzh(add_php_view_vvvvvzh) { // set the function logic - if (add_php_view_vvvvvyj == 1) + if (add_php_view_vvvvvzh == 1) { jQuery('#jform_php_view-lbl').closest('.control-group').show(); - // add required attribute to php_view field - if (jform_vvvvvyjvye_required) - { - updateFieldRequired('php_view',0); - jQuery('#jform_php_view').prop('required','required'); - jQuery('#jform_php_view').attr('aria-required',true); - jQuery('#jform_php_view').addClass('required'); - jform_vvvvvyjvye_required = false; - } } else { jQuery('#jform_php_view-lbl').closest('.control-group').hide(); - // remove required attribute from php_view field - if (!jform_vvvvvyjvye_required) - { - updateFieldRequired('php_view',1); - jQuery('#jform_php_view').removeAttr('required'); - jQuery('#jform_php_view').removeAttr('aria-required'); - jQuery('#jform_php_view').removeClass('required'); - jform_vvvvvyjvye_required = true; - } } } -// the vvvvvyk function -function vvvvvyk(add_php_jview_display_vvvvvyk) +// the vvvvvzi function +function vvvvvzi(add_php_jview_display_vvvvvzi) { // set the function logic - if (add_php_jview_display_vvvvvyk == 1) + if (add_php_jview_display_vvvvvzi == 1) { jQuery('#jform_php_jview_display-lbl').closest('.control-group').show(); - // add required attribute to php_jview_display field - if (jform_vvvvvykvyf_required) - { - updateFieldRequired('php_jview_display',0); - jQuery('#jform_php_jview_display').prop('required','required'); - jQuery('#jform_php_jview_display').attr('aria-required',true); - jQuery('#jform_php_jview_display').addClass('required'); - jform_vvvvvykvyf_required = false; - } } else { jQuery('#jform_php_jview_display-lbl').closest('.control-group').hide(); - // remove required attribute from php_jview_display field - if (!jform_vvvvvykvyf_required) - { - updateFieldRequired('php_jview_display',1); - jQuery('#jform_php_jview_display').removeAttr('required'); - jQuery('#jform_php_jview_display').removeAttr('aria-required'); - jQuery('#jform_php_jview_display').removeClass('required'); - jform_vvvvvykvyf_required = true; - } } } -// the vvvvvyl function -function vvvvvyl(add_php_jview_vvvvvyl) +// the vvvvvzj function +function vvvvvzj(add_php_jview_vvvvvzj) { // set the function logic - if (add_php_jview_vvvvvyl == 1) + if (add_php_jview_vvvvvzj == 1) { jQuery('#jform_php_jview-lbl').closest('.control-group').show(); - // add required attribute to php_jview field - if (jform_vvvvvylvyg_required) - { - updateFieldRequired('php_jview',0); - jQuery('#jform_php_jview').prop('required','required'); - jQuery('#jform_php_jview').attr('aria-required',true); - jQuery('#jform_php_jview').addClass('required'); - jform_vvvvvylvyg_required = false; - } } else { jQuery('#jform_php_jview-lbl').closest('.control-group').hide(); - // remove required attribute from php_jview field - if (!jform_vvvvvylvyg_required) - { - updateFieldRequired('php_jview',1); - jQuery('#jform_php_jview').removeAttr('required'); - jQuery('#jform_php_jview').removeAttr('aria-required'); - jQuery('#jform_php_jview').removeClass('required'); - jform_vvvvvylvyg_required = true; - } } } -// the vvvvvym function -function vvvvvym(add_php_document_vvvvvym) +// the vvvvvzk function +function vvvvvzk(add_php_document_vvvvvzk) { // set the function logic - if (add_php_document_vvvvvym == 1) + if (add_php_document_vvvvvzk == 1) { jQuery('#jform_php_document-lbl').closest('.control-group').show(); - // add required attribute to php_document field - if (jform_vvvvvymvyh_required) - { - updateFieldRequired('php_document',0); - jQuery('#jform_php_document').prop('required','required'); - jQuery('#jform_php_document').attr('aria-required',true); - jQuery('#jform_php_document').addClass('required'); - jform_vvvvvymvyh_required = false; - } } else { jQuery('#jform_php_document-lbl').closest('.control-group').hide(); - // remove required attribute from php_document field - if (!jform_vvvvvymvyh_required) - { - updateFieldRequired('php_document',1); - jQuery('#jform_php_document').removeAttr('required'); - jQuery('#jform_php_document').removeAttr('aria-required'); - jQuery('#jform_php_document').removeClass('required'); - jform_vvvvvymvyh_required = true; - } } } -// the vvvvvyn function -function vvvvvyn(add_css_document_vvvvvyn) +// the vvvvvzl function +function vvvvvzl(add_css_document_vvvvvzl) { // set the function logic - if (add_css_document_vvvvvyn == 1) + if (add_css_document_vvvvvzl == 1) { jQuery('#jform_css_document-lbl').closest('.control-group').show(); - // add required attribute to css_document field - if (jform_vvvvvynvyi_required) - { - updateFieldRequired('css_document',0); - jQuery('#jform_css_document').prop('required','required'); - jQuery('#jform_css_document').attr('aria-required',true); - jQuery('#jform_css_document').addClass('required'); - jform_vvvvvynvyi_required = false; - } } else { jQuery('#jform_css_document-lbl').closest('.control-group').hide(); - // remove required attribute from css_document field - if (!jform_vvvvvynvyi_required) - { - updateFieldRequired('css_document',1); - jQuery('#jform_css_document').removeAttr('required'); - jQuery('#jform_css_document').removeAttr('aria-required'); - jQuery('#jform_css_document').removeClass('required'); - jform_vvvvvynvyi_required = true; - } } } -// the vvvvvyo function -function vvvvvyo(add_javascript_file_vvvvvyo) +// the vvvvvzm function +function vvvvvzm(add_javascript_file_vvvvvzm) { // set the function logic - if (add_javascript_file_vvvvvyo == 1) + if (add_javascript_file_vvvvvzm == 1) { jQuery('#jform_javascript_file-lbl').closest('.control-group').show(); - // add required attribute to javascript_file field - if (jform_vvvvvyovyj_required) - { - updateFieldRequired('javascript_file',0); - jQuery('#jform_javascript_file').prop('required','required'); - jQuery('#jform_javascript_file').attr('aria-required',true); - jQuery('#jform_javascript_file').addClass('required'); - jform_vvvvvyovyj_required = false; - } } else { jQuery('#jform_javascript_file-lbl').closest('.control-group').hide(); - // remove required attribute from javascript_file field - if (!jform_vvvvvyovyj_required) - { - updateFieldRequired('javascript_file',1); - jQuery('#jform_javascript_file').removeAttr('required'); - jQuery('#jform_javascript_file').removeAttr('aria-required'); - jQuery('#jform_javascript_file').removeClass('required'); - jform_vvvvvyovyj_required = true; - } } } -// the vvvvvyp function -function vvvvvyp(add_js_document_vvvvvyp) +// the vvvvvzn function +function vvvvvzn(add_js_document_vvvvvzn) { // set the function logic - if (add_js_document_vvvvvyp == 1) + if (add_js_document_vvvvvzn == 1) { jQuery('#jform_js_document-lbl').closest('.control-group').show(); - // add required attribute to js_document field - if (jform_vvvvvypvyk_required) - { - updateFieldRequired('js_document',0); - jQuery('#jform_js_document').prop('required','required'); - jQuery('#jform_js_document').attr('aria-required',true); - jQuery('#jform_js_document').addClass('required'); - jform_vvvvvypvyk_required = false; - } } else { jQuery('#jform_js_document-lbl').closest('.control-group').hide(); - // remove required attribute from js_document field - if (!jform_vvvvvypvyk_required) - { - updateFieldRequired('js_document',1); - jQuery('#jform_js_document').removeAttr('required'); - jQuery('#jform_js_document').removeAttr('aria-required'); - jQuery('#jform_js_document').removeClass('required'); - jform_vvvvvypvyk_required = true; - } } } -// the vvvvvyq function -function vvvvvyq(add_custom_button_vvvvvyq) +// the vvvvvzo function +function vvvvvzo(add_custom_button_vvvvvzo) { // set the function logic - if (add_custom_button_vvvvvyq == 1) + if (add_custom_button_vvvvvzo == 1) { jQuery('#jform_custom_button-lbl').closest('.control-group').show(); jQuery('#jform_php_controller-lbl').closest('.control-group').show(); - // add required attribute to php_controller field - if (jform_vvvvvyqvyl_required) - { - updateFieldRequired('php_controller',0); - jQuery('#jform_php_controller').prop('required','required'); - jQuery('#jform_php_controller').attr('aria-required',true); - jQuery('#jform_php_controller').addClass('required'); - jform_vvvvvyqvyl_required = false; - } jQuery('#jform_php_model-lbl').closest('.control-group').show(); - // add required attribute to php_model field - if (jform_vvvvvyqvym_required) - { - updateFieldRequired('php_model',0); - jQuery('#jform_php_model').prop('required','required'); - jQuery('#jform_php_model').attr('aria-required',true); - jQuery('#jform_php_model').addClass('required'); - jform_vvvvvyqvym_required = false; - } } else { jQuery('#jform_custom_button-lbl').closest('.control-group').hide(); jQuery('#jform_php_controller-lbl').closest('.control-group').hide(); - // remove required attribute from php_controller field - if (!jform_vvvvvyqvyl_required) - { - updateFieldRequired('php_controller',1); - jQuery('#jform_php_controller').removeAttr('required'); - jQuery('#jform_php_controller').removeAttr('aria-required'); - jQuery('#jform_php_controller').removeClass('required'); - jform_vvvvvyqvyl_required = true; - } jQuery('#jform_php_model-lbl').closest('.control-group').hide(); - // remove required attribute from php_model field - if (!jform_vvvvvyqvym_required) - { - updateFieldRequired('php_model',1); - jQuery('#jform_php_model').removeAttr('required'); - jQuery('#jform_php_model').removeAttr('aria-required'); - jQuery('#jform_php_model').removeClass('required'); - jform_vvvvvyqvym_required = true; - } } } -// the vvvvvyr function -function vvvvvyr(add_css_vvvvvyr) +// the vvvvvzp function +function vvvvvzp(add_css_vvvvvzp) { // set the function logic - if (add_css_vvvvvyr == 1) + if (add_css_vvvvvzp == 1) { jQuery('#jform_css-lbl').closest('.control-group').show(); - // add required attribute to css field - if (jform_vvvvvyrvyn_required) - { - updateFieldRequired('css',0); - jQuery('#jform_css').prop('required','required'); - jQuery('#jform_css').attr('aria-required',true); - jQuery('#jform_css').addClass('required'); - jform_vvvvvyrvyn_required = false; - } } else { jQuery('#jform_css-lbl').closest('.control-group').hide(); - // remove required attribute from css field - if (!jform_vvvvvyrvyn_required) - { - updateFieldRequired('css',1); - jQuery('#jform_css').removeAttr('required'); - jQuery('#jform_css').removeAttr('aria-required'); - jQuery('#jform_css').removeClass('required'); - jform_vvvvvyrvyn_required = true; - } } } -// the vvvvvys function -function vvvvvys(add_php_ajax_vvvvvys) +// the vvvvvzq function +function vvvvvzq(add_php_ajax_vvvvvzq) { // set the function logic - if (add_php_ajax_vvvvvys == 1) + if (add_php_ajax_vvvvvzq == 1) { jQuery('#jform_ajax_input-lbl').closest('.control-group').show(); jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').show(); - // add required attribute to php_ajaxmethod field - if (jform_vvvvvysvyo_required) - { - updateFieldRequired('php_ajaxmethod',0); - jQuery('#jform_php_ajaxmethod').prop('required','required'); - jQuery('#jform_php_ajaxmethod').attr('aria-required',true); - jQuery('#jform_php_ajaxmethod').addClass('required'); - jform_vvvvvysvyo_required = false; - } } else { jQuery('#jform_ajax_input-lbl').closest('.control-group').hide(); jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').hide(); - // remove required attribute from php_ajaxmethod field - if (!jform_vvvvvysvyo_required) - { - updateFieldRequired('php_ajaxmethod',1); - jQuery('#jform_php_ajaxmethod').removeAttr('required'); - jQuery('#jform_php_ajaxmethod').removeAttr('aria-required'); - jQuery('#jform_php_ajaxmethod').removeClass('required'); - jform_vvvvvysvyo_required = true; - } } } -// update required fields -function updateFieldRequired(name,status) -{ - var not_required = jQuery('#jform_not_required').val(); - - if(status == 1) - { - if (isSet(not_required) && not_required != 0) - { - not_required = not_required+','+name; - } - else - { - not_required = ','+name; - } - } - else - { - if (isSet(not_required) && not_required != 0) - { - not_required = not_required.replace(','+name,''); - } - } - - jQuery('#jform_not_required').val(not_required); -} - // the isSet function function isSet(val) { @@ -445,9 +207,9 @@ jQuery(document).ready(function() }); function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type > 0){ - var request = 'token='+token+'&type='+type; + var request = token+'=1&type='+type; } return jQuery.ajax({ type: 'GET', @@ -467,9 +229,9 @@ function getLinked(){ } function getSnippetDetails_server(snippetId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"); if(token.length > 0 && snippetId > 0){ - var request = 'token='+token+'&id='+snippetId; + var request = token+'=1&id='+snippetId; } return jQuery.ajax({ type: 'GET', @@ -516,9 +278,9 @@ function getSnippetDetails(id){ } function getDynamicValues_server(dynamicId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json"); if(token.length > 0 && dynamicId > 0){ - var request = 'token='+token+'&view=custom_admin_view&id='+dynamicId; + var request = token+'=1&view=custom_admin_view&id='+dynamicId; } return jQuery.ajax({ type: 'GET', @@ -543,9 +305,9 @@ function getDynamicValues(id){ } function getLayoutDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id; + var request = token+'=1&id='+id; } return jQuery.ajax({ type: 'GET', @@ -569,9 +331,9 @@ function getLayoutDetails(id){ } function getTemplateDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id; + var request = token+'=1&id='+id; } return jQuery.ajax({ type: 'GET', @@ -614,7 +376,7 @@ jQuery(document).ready(function($) function getSnippets_server(libraries){ var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&raw=true&format=json"; if(token.length > 0 && libraries.length > 0){ - var request = 'token='+token+'&libraries='+JSON.stringify(libraries); + var request = token+'=1&libraries='+JSON.stringify(libraries); } return jQuery.ajax({ type: 'GET', @@ -667,9 +429,9 @@ function setSnippets(array){ } function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/custom_admin_view.xml b/admin/models/forms/custom_admin_view.xml index a358eef46..8a7ab1274 100644 --- a/admin/models/forms/custom_admin_view.xml +++ b/admin/models/forms/custom_admin_view.xml @@ -156,7 +156,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -175,7 +174,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -266,7 +264,6 @@ syntax="html" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -304,7 +301,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -350,7 +346,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -381,7 +376,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -538,7 +532,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -555,7 +548,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -572,7 +564,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -601,7 +592,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1208,7 +1198,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="false" validate="code" /> @@ -1227,7 +1216,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="false" validate="code" /> diff --git a/admin/models/forms/custom_code.js b/admin/models/forms/custom_code.js index cafa094a3..81d09a518 100644 --- a/admin/models/forms/custom_code.js +++ b/admin/models/forms/custom_code.js @@ -9,44 +9,44 @@ */ // Some Global Values -jform_vvvvwahvzw_required = false; -jform_vvvvwaivzx_required = false; -jform_vvvvwaivzy_required = false; -jform_vvvvwaivzz_required = false; +jform_vvvvwbfvxd_required = false; +jform_vvvvwbgvxe_required = false; +jform_vvvvwbgvxf_required = false; +jform_vvvvwbgvxg_required = false; // Initial Script jQuery(document).ready(function() { - var target_vvvvwah = jQuery("#jform_target input[type='radio']:checked").val(); - vvvvwah(target_vvvvwah); + var target_vvvvwbf = jQuery("#jform_target input[type='radio']:checked").val(); + vvvvwbf(target_vvvvwbf); - var target_vvvvwai = jQuery("#jform_target input[type='radio']:checked").val(); - vvvvwai(target_vvvvwai); + var target_vvvvwbg = jQuery("#jform_target input[type='radio']:checked").val(); + vvvvwbg(target_vvvvwbg); - var target_vvvvwaj = jQuery("#jform_target input[type='radio']:checked").val(); - var type_vvvvwaj = jQuery("#jform_type input[type='radio']:checked").val(); - vvvvwaj(target_vvvvwaj,type_vvvvwaj); + var target_vvvvwbh = jQuery("#jform_target input[type='radio']:checked").val(); + var type_vvvvwbh = jQuery("#jform_type input[type='radio']:checked").val(); + vvvvwbh(target_vvvvwbh,type_vvvvwbh); - var type_vvvvwak = jQuery("#jform_type input[type='radio']:checked").val(); - var target_vvvvwak = jQuery("#jform_target input[type='radio']:checked").val(); - vvvvwak(type_vvvvwak,target_vvvvwak); + var type_vvvvwbi = jQuery("#jform_type input[type='radio']:checked").val(); + var target_vvvvwbi = jQuery("#jform_target input[type='radio']:checked").val(); + vvvvwbi(type_vvvvwbi,target_vvvvwbi); }); -// the vvvvwah function -function vvvvwah(target_vvvvwah) +// the vvvvwbf function +function vvvvwbf(target_vvvvwbf) { // set the function logic - if (target_vvvvwah == 2) + if (target_vvvvwbf == 2) { jQuery('#jform_function_name').closest('.control-group').show(); // add required attribute to function_name field - if (jform_vvvvwahvzw_required) + if (jform_vvvvwbfvxd_required) { updateFieldRequired('function_name',0); jQuery('#jform_function_name').prop('required','required'); jQuery('#jform_function_name').attr('aria-required',true); jQuery('#jform_function_name').addClass('required'); - jform_vvvvwahvzw_required = false; + jform_vvvvwbfvxd_required = false; } jQuery('.note_jcb_placeholder').closest('.control-group').show(); jQuery('#jform_system_name').closest('.control-group').show(); @@ -55,102 +55,102 @@ function vvvvwah(target_vvvvwah) { jQuery('#jform_function_name').closest('.control-group').hide(); // remove required attribute from function_name field - if (!jform_vvvvwahvzw_required) + if (!jform_vvvvwbfvxd_required) { updateFieldRequired('function_name',1); jQuery('#jform_function_name').removeAttr('required'); jQuery('#jform_function_name').removeAttr('aria-required'); jQuery('#jform_function_name').removeClass('required'); - jform_vvvvwahvzw_required = true; + jform_vvvvwbfvxd_required = true; } jQuery('.note_jcb_placeholder').closest('.control-group').hide(); jQuery('#jform_system_name').closest('.control-group').hide(); } } -// the vvvvwai function -function vvvvwai(target_vvvvwai) +// the vvvvwbg function +function vvvvwbg(target_vvvvwbg) { // set the function logic - if (target_vvvvwai == 1) + if (target_vvvvwbg == 1) { jQuery('#jform_component').closest('.control-group').show(); // add required attribute to component field - if (jform_vvvvwaivzx_required) + if (jform_vvvvwbgvxe_required) { updateFieldRequired('component',0); jQuery('#jform_component').prop('required','required'); jQuery('#jform_component').attr('aria-required',true); jQuery('#jform_component').addClass('required'); - jform_vvvvwaivzx_required = false; + jform_vvvvwbgvxe_required = false; } jQuery('#jform_path').closest('.control-group').show(); // add required attribute to path field - if (jform_vvvvwaivzy_required) + if (jform_vvvvwbgvxf_required) { updateFieldRequired('path',0); jQuery('#jform_path').prop('required','required'); jQuery('#jform_path').attr('aria-required',true); jQuery('#jform_path').addClass('required'); - jform_vvvvwaivzy_required = false; + jform_vvvvwbgvxf_required = false; } jQuery('#jform_from_line').closest('.control-group').show(); jQuery('#jform_hashtarget').closest('.control-group').show(); jQuery('#jform_to_line').closest('.control-group').show(); jQuery('#jform_type').closest('.control-group').show(); // add required attribute to type field - if (jform_vvvvwaivzz_required) + if (jform_vvvvwbgvxg_required) { updateFieldRequired('type',0); jQuery('#jform_type').prop('required','required'); jQuery('#jform_type').attr('aria-required',true); jQuery('#jform_type').addClass('required'); - jform_vvvvwaivzz_required = false; + jform_vvvvwbgvxg_required = false; } } else { jQuery('#jform_component').closest('.control-group').hide(); // remove required attribute from component field - if (!jform_vvvvwaivzx_required) + if (!jform_vvvvwbgvxe_required) { updateFieldRequired('component',1); jQuery('#jform_component').removeAttr('required'); jQuery('#jform_component').removeAttr('aria-required'); jQuery('#jform_component').removeClass('required'); - jform_vvvvwaivzx_required = true; + jform_vvvvwbgvxe_required = true; } jQuery('#jform_path').closest('.control-group').hide(); // remove required attribute from path field - if (!jform_vvvvwaivzy_required) + if (!jform_vvvvwbgvxf_required) { updateFieldRequired('path',1); jQuery('#jform_path').removeAttr('required'); jQuery('#jform_path').removeAttr('aria-required'); jQuery('#jform_path').removeClass('required'); - jform_vvvvwaivzy_required = true; + jform_vvvvwbgvxf_required = true; } jQuery('#jform_from_line').closest('.control-group').hide(); jQuery('#jform_hashtarget').closest('.control-group').hide(); jQuery('#jform_to_line').closest('.control-group').hide(); jQuery('#jform_type').closest('.control-group').hide(); // remove required attribute from type field - if (!jform_vvvvwaivzz_required) + if (!jform_vvvvwbgvxg_required) { updateFieldRequired('type',1); jQuery('#jform_type').removeAttr('required'); jQuery('#jform_type').removeAttr('aria-required'); jQuery('#jform_type').removeClass('required'); - jform_vvvvwaivzz_required = true; + jform_vvvvwbgvxg_required = true; } } } -// the vvvvwaj function -function vvvvwaj(target_vvvvwaj,type_vvvvwaj) +// the vvvvwbh function +function vvvvwbh(target_vvvvwbh,type_vvvvwbh) { // set the function logic - if (target_vvvvwaj == 1 && type_vvvvwaj == 1) + if (target_vvvvwbh == 1 && type_vvvvwbh == 1) { jQuery('#jform_hashendtarget').closest('.control-group').show(); jQuery('#jform_to_line').closest('.control-group').show(); @@ -162,11 +162,11 @@ function vvvvwaj(target_vvvvwaj,type_vvvvwaj) } } -// the vvvvwak function -function vvvvwak(type_vvvvwak,target_vvvvwak) +// the vvvvwbi function +function vvvvwbi(type_vvvvwbi,target_vvvvwbi) { // set the function logic - if (type_vvvvwak == 1 && target_vvvvwak == 1) + if (type_vvvvwbi == 1 && target_vvvvwbi == 1) { jQuery('#jform_hashendtarget').closest('.control-group').show(); jQuery('#jform_to_line').closest('.control-group').show(); @@ -313,8 +313,8 @@ function usedin(functioName, ide) { jQuery('#note-usedin-not').hide(); jQuery('#note-usedin-found').hide(); jQuery('#loading-usedin').show(); - var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p']; // if you update this, also update (below 15) & [customcode-codeUsedInHtmlNote]! - var targetNumber = 15; + var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t']; // if you update this, also update (below 19) & [customcode-codeUsedInHtmlNote]! + var targetNumber = 19; var run = 0; var usedinChecker = setInterval(function(){ var target = targets[run]; @@ -358,9 +358,9 @@ function usedin_server(functioName, ide, target){ function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/custom_code.xml b/admin/models/forms/custom_code.xml index a3b09b2da..9f5c1f643 100644 --- a/admin/models/forms/custom_code.xml +++ b/admin/models/forms/custom_code.xml @@ -200,7 +200,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> diff --git a/admin/models/forms/dynamic_get.js b/admin/models/forms/dynamic_get.js index a4e776f6d..75a38bf23 100644 --- a/admin/models/forms/dynamic_get.js +++ b/admin/models/forms/dynamic_get.js @@ -9,119 +9,112 @@ */ // Some Global Values -jform_vvvvvzgvzc_required = false; -jform_vvvvvzivzd_required = false; -jform_vvvvvzjvze_required = false; -jform_vvvvvzkvzf_required = false; -jform_vvvvvzlvzg_required = false; -jform_vvvvvzmvzh_required = false; -jform_vvvvvzrvzi_required = false; -jform_vvvvvztvzj_required = false; -jform_vvvvvzuvzk_required = false; -jform_vvvvvzwvzl_required = false; -jform_vvvvvzwvzm_required = false; -jform_vvvvvzxvzn_required = false; -jform_vvvvvzyvzo_required = false; -jform_vvvvvzzvzp_required = false; -jform_vvvvwabvzq_required = false; -jform_vvvvwabvzr_required = false; -jform_vvvvwabvzs_required = false; -jform_vvvvwacvzt_required = false; -jform_vvvvwadvzu_required = false; -jform_vvvvwaevzv_required = false; +jform_vvvvwaevwq_required = false; +jform_vvvvwagvwr_required = false; +jform_vvvvwahvws_required = false; +jform_vvvvwaivwt_required = false; +jform_vvvvwajvwu_required = false; +jform_vvvvwauvwv_required = false; +jform_vvvvwauvww_required = false; +jform_vvvvwazvwx_required = false; +jform_vvvvwazvwy_required = false; +jform_vvvvwazvwz_required = false; +jform_vvvvwbavxa_required = false; +jform_vvvvwbbvxb_required = false; +jform_vvvvwbcvxc_required = false; // Initial Script jQuery(document).ready(function() { - var gettype_vvvvvzg = jQuery("#jform_gettype").val(); - vvvvvzg(gettype_vvvvvzg); - - var main_source_vvvvvzh = jQuery("#jform_main_source").val(); - vvvvvzh(main_source_vvvvvzh); - - var main_source_vvvvvzi = jQuery("#jform_main_source").val(); - vvvvvzi(main_source_vvvvvzi); - - var main_source_vvvvvzj = jQuery("#jform_main_source").val(); - vvvvvzj(main_source_vvvvvzj); - - var main_source_vvvvvzk = jQuery("#jform_main_source").val(); - vvvvvzk(main_source_vvvvvzk); - - var main_source_vvvvvzl = jQuery("#jform_main_source").val(); - vvvvvzl(main_source_vvvvvzl); - - var addcalculation_vvvvvzm = jQuery("#jform_addcalculation input[type='radio']:checked").val(); - vvvvvzm(addcalculation_vvvvvzm); - - var addcalculation_vvvvvzn = jQuery("#jform_addcalculation input[type='radio']:checked").val(); - var gettype_vvvvvzn = jQuery("#jform_gettype").val(); - vvvvvzn(addcalculation_vvvvvzn,gettype_vvvvvzn); - - var addcalculation_vvvvvzo = jQuery("#jform_addcalculation input[type='radio']:checked").val(); - var gettype_vvvvvzo = jQuery("#jform_gettype").val(); - vvvvvzo(addcalculation_vvvvvzo,gettype_vvvvvzo); - - var main_source_vvvvvzr = jQuery("#jform_main_source").val(); - vvvvvzr(main_source_vvvvvzr); - - var main_source_vvvvvzs = jQuery("#jform_main_source").val(); - vvvvvzs(main_source_vvvvvzs); - - var add_php_before_getitem_vvvvvzt = jQuery("#jform_add_php_before_getitem input[type='radio']:checked").val(); - var gettype_vvvvvzt = jQuery("#jform_gettype").val(); - vvvvvzt(add_php_before_getitem_vvvvvzt,gettype_vvvvvzt); - - var add_php_after_getitem_vvvvvzu = jQuery("#jform_add_php_after_getitem input[type='radio']:checked").val(); - var gettype_vvvvvzu = jQuery("#jform_gettype").val(); - vvvvvzu(add_php_after_getitem_vvvvvzu,gettype_vvvvvzu); - - var gettype_vvvvvzw = jQuery("#jform_gettype").val(); - vvvvvzw(gettype_vvvvvzw); - - var add_php_getlistquery_vvvvvzx = jQuery("#jform_add_php_getlistquery input[type='radio']:checked").val(); - var gettype_vvvvvzx = jQuery("#jform_gettype").val(); - vvvvvzx(add_php_getlistquery_vvvvvzx,gettype_vvvvvzx); - - var add_php_before_getitems_vvvvvzy = jQuery("#jform_add_php_before_getitems input[type='radio']:checked").val(); - var gettype_vvvvvzy = jQuery("#jform_gettype").val(); - vvvvvzy(add_php_before_getitems_vvvvvzy,gettype_vvvvvzy); - - var add_php_after_getitems_vvvvvzz = jQuery("#jform_add_php_after_getitems input[type='radio']:checked").val(); - var gettype_vvvvvzz = jQuery("#jform_gettype").val(); - vvvvvzz(add_php_after_getitems_vvvvvzz,gettype_vvvvvzz); - - var gettype_vvvvwab = jQuery("#jform_gettype").val(); - vvvvwab(gettype_vvvvwab); - - var gettype_vvvvwac = jQuery("#jform_gettype").val(); - vvvvwac(gettype_vvvvwac); - - var gettype_vvvvwad = jQuery("#jform_gettype").val(); - vvvvwad(gettype_vvvvwad); - var gettype_vvvvwae = jQuery("#jform_gettype").val(); - var add_php_router_parse_vvvvwae = jQuery("#jform_add_php_router_parse input[type='radio']:checked").val(); - vvvvwae(gettype_vvvvwae,add_php_router_parse_vvvvwae); + vvvvwae(gettype_vvvvwae); - var gettype_vvvvwag = jQuery("#jform_gettype").val(); - vvvvwag(gettype_vvvvwag); + var main_source_vvvvwaf = jQuery("#jform_main_source").val(); + vvvvwaf(main_source_vvvvwaf); + + var main_source_vvvvwag = jQuery("#jform_main_source").val(); + vvvvwag(main_source_vvvvwag); + + var main_source_vvvvwah = jQuery("#jform_main_source").val(); + vvvvwah(main_source_vvvvwah); + + var main_source_vvvvwai = jQuery("#jform_main_source").val(); + vvvvwai(main_source_vvvvwai); + + var main_source_vvvvwaj = jQuery("#jform_main_source").val(); + vvvvwaj(main_source_vvvvwaj); + + var addcalculation_vvvvwak = jQuery("#jform_addcalculation input[type='radio']:checked").val(); + vvvvwak(addcalculation_vvvvwak); + + var addcalculation_vvvvwal = jQuery("#jform_addcalculation input[type='radio']:checked").val(); + var gettype_vvvvwal = jQuery("#jform_gettype").val(); + vvvvwal(addcalculation_vvvvwal,gettype_vvvvwal); + + var addcalculation_vvvvwam = jQuery("#jform_addcalculation input[type='radio']:checked").val(); + var gettype_vvvvwam = jQuery("#jform_gettype").val(); + vvvvwam(addcalculation_vvvvwam,gettype_vvvvwam); + + var main_source_vvvvwap = jQuery("#jform_main_source").val(); + vvvvwap(main_source_vvvvwap); + + var main_source_vvvvwaq = jQuery("#jform_main_source").val(); + vvvvwaq(main_source_vvvvwaq); + + var add_php_before_getitem_vvvvwar = jQuery("#jform_add_php_before_getitem input[type='radio']:checked").val(); + var gettype_vvvvwar = jQuery("#jform_gettype").val(); + vvvvwar(add_php_before_getitem_vvvvwar,gettype_vvvvwar); + + var add_php_after_getitem_vvvvwas = jQuery("#jform_add_php_after_getitem input[type='radio']:checked").val(); + var gettype_vvvvwas = jQuery("#jform_gettype").val(); + vvvvwas(add_php_after_getitem_vvvvwas,gettype_vvvvwas); + + var gettype_vvvvwau = jQuery("#jform_gettype").val(); + vvvvwau(gettype_vvvvwau); + + var add_php_getlistquery_vvvvwav = jQuery("#jform_add_php_getlistquery input[type='radio']:checked").val(); + var gettype_vvvvwav = jQuery("#jform_gettype").val(); + vvvvwav(add_php_getlistquery_vvvvwav,gettype_vvvvwav); + + var add_php_before_getitems_vvvvwaw = jQuery("#jform_add_php_before_getitems input[type='radio']:checked").val(); + var gettype_vvvvwaw = jQuery("#jform_gettype").val(); + vvvvwaw(add_php_before_getitems_vvvvwaw,gettype_vvvvwaw); + + var add_php_after_getitems_vvvvwax = jQuery("#jform_add_php_after_getitems input[type='radio']:checked").val(); + var gettype_vvvvwax = jQuery("#jform_gettype").val(); + vvvvwax(add_php_after_getitems_vvvvwax,gettype_vvvvwax); + + var gettype_vvvvwaz = jQuery("#jform_gettype").val(); + vvvvwaz(gettype_vvvvwaz); + + var gettype_vvvvwba = jQuery("#jform_gettype").val(); + vvvvwba(gettype_vvvvwba); + + var gettype_vvvvwbb = jQuery("#jform_gettype").val(); + vvvvwbb(gettype_vvvvwbb); + + var gettype_vvvvwbc = jQuery("#jform_gettype").val(); + var add_php_router_parse_vvvvwbc = jQuery("#jform_add_php_router_parse input[type='radio']:checked").val(); + vvvvwbc(gettype_vvvvwbc,add_php_router_parse_vvvvwbc); + + var gettype_vvvvwbe = jQuery("#jform_gettype").val(); + vvvvwbe(gettype_vvvvwbe); }); -// the vvvvvzg function -function vvvvvzg(gettype_vvvvvzg) +// the vvvvwae function +function vvvvwae(gettype_vvvvwae) { - if (isSet(gettype_vvvvvzg) && gettype_vvvvvzg.constructor !== Array) + if (isSet(gettype_vvvvwae) && gettype_vvvvwae.constructor !== Array) { - var temp_vvvvvzg = gettype_vvvvvzg; - var gettype_vvvvvzg = []; - gettype_vvvvvzg.push(temp_vvvvvzg); + var temp_vvvvwae = gettype_vvvvwae; + var gettype_vvvvwae = []; + gettype_vvvvwae.push(temp_vvvvwae); } - else if (!isSet(gettype_vvvvvzg)) + else if (!isSet(gettype_vvvvwae)) { - var gettype_vvvvvzg = []; + var gettype_vvvvwae = []; } - var gettype = gettype_vvvvvzg.some(gettype_vvvvvzg_SomeFunc); + var gettype = gettype_vvvvwae.some(gettype_vvvvwae_SomeFunc); // set this function logic @@ -129,55 +122,55 @@ function vvvvvzg(gettype_vvvvvzg) { jQuery('#jform_getcustom').closest('.control-group').show(); // add required attribute to getcustom field - if (jform_vvvvvzgvzc_required) + if (jform_vvvvwaevwq_required) { updateFieldRequired('getcustom',0); jQuery('#jform_getcustom').prop('required','required'); jQuery('#jform_getcustom').attr('aria-required',true); jQuery('#jform_getcustom').addClass('required'); - jform_vvvvvzgvzc_required = false; + jform_vvvvwaevwq_required = false; } } else { jQuery('#jform_getcustom').closest('.control-group').hide(); // remove required attribute from getcustom field - if (!jform_vvvvvzgvzc_required) + if (!jform_vvvvwaevwq_required) { updateFieldRequired('getcustom',1); jQuery('#jform_getcustom').removeAttr('required'); jQuery('#jform_getcustom').removeAttr('aria-required'); jQuery('#jform_getcustom').removeClass('required'); - jform_vvvvvzgvzc_required = true; + jform_vvvvwaevwq_required = true; } } } -// the vvvvvzg Some function -function gettype_vvvvvzg_SomeFunc(gettype_vvvvvzg) +// the vvvvwae Some function +function gettype_vvvvwae_SomeFunc(gettype_vvvvwae) { // set the function logic - if (gettype_vvvvvzg == 3 || gettype_vvvvvzg == 4) + if (gettype_vvvvwae == 3 || gettype_vvvvwae == 4) { return true; } return false; } -// the vvvvvzh function -function vvvvvzh(main_source_vvvvvzh) +// the vvvvwaf function +function vvvvwaf(main_source_vvvvwaf) { - if (isSet(main_source_vvvvvzh) && main_source_vvvvvzh.constructor !== Array) + if (isSet(main_source_vvvvwaf) && main_source_vvvvwaf.constructor !== Array) { - var temp_vvvvvzh = main_source_vvvvvzh; - var main_source_vvvvvzh = []; - main_source_vvvvvzh.push(temp_vvvvvzh); + var temp_vvvvwaf = main_source_vvvvwaf; + var main_source_vvvvwaf = []; + main_source_vvvvwaf.push(temp_vvvvwaf); } - else if (!isSet(main_source_vvvvvzh)) + else if (!isSet(main_source_vvvvwaf)) { - var main_source_vvvvvzh = []; + var main_source_vvvvwaf = []; } - var main_source = main_source_vvvvvzh.some(main_source_vvvvvzh_SomeFunc); + var main_source = main_source_vvvvwaf.some(main_source_vvvvwaf_SomeFunc); // set this function logic @@ -191,31 +184,31 @@ function vvvvvzh(main_source_vvvvvzh) } } -// the vvvvvzh Some function -function main_source_vvvvvzh_SomeFunc(main_source_vvvvvzh) +// the vvvvwaf Some function +function main_source_vvvvwaf_SomeFunc(main_source_vvvvwaf) { // set the function logic - if (main_source_vvvvvzh == 1 || main_source_vvvvvzh == 2) + if (main_source_vvvvwaf == 1 || main_source_vvvvwaf == 2) { return true; } return false; } -// the vvvvvzi function -function vvvvvzi(main_source_vvvvvzi) +// the vvvvwag function +function vvvvwag(main_source_vvvvwag) { - if (isSet(main_source_vvvvvzi) && main_source_vvvvvzi.constructor !== Array) + if (isSet(main_source_vvvvwag) && main_source_vvvvwag.constructor !== Array) { - var temp_vvvvvzi = main_source_vvvvvzi; - var main_source_vvvvvzi = []; - main_source_vvvvvzi.push(temp_vvvvvzi); + var temp_vvvvwag = main_source_vvvvwag; + var main_source_vvvvwag = []; + main_source_vvvvwag.push(temp_vvvvwag); } - else if (!isSet(main_source_vvvvvzi)) + else if (!isSet(main_source_vvvvwag)) { - var main_source_vvvvvzi = []; + var main_source_vvvvwag = []; } - var main_source = main_source_vvvvvzi.some(main_source_vvvvvzi_SomeFunc); + var main_source = main_source_vvvvwag.some(main_source_vvvvwag_SomeFunc); // set this function logic @@ -223,55 +216,55 @@ function vvvvvzi(main_source_vvvvvzi) { jQuery('#jform_view_table_main').closest('.control-group').show(); // add required attribute to view_table_main field - if (jform_vvvvvzivzd_required) + if (jform_vvvvwagvwr_required) { updateFieldRequired('view_table_main',0); jQuery('#jform_view_table_main').prop('required','required'); jQuery('#jform_view_table_main').attr('aria-required',true); jQuery('#jform_view_table_main').addClass('required'); - jform_vvvvvzivzd_required = false; + jform_vvvvwagvwr_required = false; } } else { jQuery('#jform_view_table_main').closest('.control-group').hide(); // remove required attribute from view_table_main field - if (!jform_vvvvvzivzd_required) + if (!jform_vvvvwagvwr_required) { updateFieldRequired('view_table_main',1); jQuery('#jform_view_table_main').removeAttr('required'); jQuery('#jform_view_table_main').removeAttr('aria-required'); jQuery('#jform_view_table_main').removeClass('required'); - jform_vvvvvzivzd_required = true; + jform_vvvvwagvwr_required = true; } } } -// the vvvvvzi Some function -function main_source_vvvvvzi_SomeFunc(main_source_vvvvvzi) +// the vvvvwag Some function +function main_source_vvvvwag_SomeFunc(main_source_vvvvwag) { // set the function logic - if (main_source_vvvvvzi == 1) + if (main_source_vvvvwag == 1) { return true; } return false; } -// the vvvvvzj function -function vvvvvzj(main_source_vvvvvzj) +// the vvvvwah function +function vvvvwah(main_source_vvvvwah) { - if (isSet(main_source_vvvvvzj) && main_source_vvvvvzj.constructor !== Array) + if (isSet(main_source_vvvvwah) && main_source_vvvvwah.constructor !== Array) { - var temp_vvvvvzj = main_source_vvvvvzj; - var main_source_vvvvvzj = []; - main_source_vvvvvzj.push(temp_vvvvvzj); + var temp_vvvvwah = main_source_vvvvwah; + var main_source_vvvvwah = []; + main_source_vvvvwah.push(temp_vvvvwah); } - else if (!isSet(main_source_vvvvvzj)) + else if (!isSet(main_source_vvvvwah)) { - var main_source_vvvvvzj = []; + var main_source_vvvvwah = []; } - var main_source = main_source_vvvvvzj.some(main_source_vvvvvzj_SomeFunc); + var main_source = main_source_vvvvwah.some(main_source_vvvvwah_SomeFunc); // set this function logic @@ -279,55 +272,55 @@ function vvvvvzj(main_source_vvvvvzj) { jQuery('#jform_view_selection').closest('.control-group').show(); // add required attribute to view_selection field - if (jform_vvvvvzjvze_required) + if (jform_vvvvwahvws_required) { updateFieldRequired('view_selection',0); jQuery('#jform_view_selection').prop('required','required'); jQuery('#jform_view_selection').attr('aria-required',true); jQuery('#jform_view_selection').addClass('required'); - jform_vvvvvzjvze_required = false; + jform_vvvvwahvws_required = false; } } else { jQuery('#jform_view_selection').closest('.control-group').hide(); // remove required attribute from view_selection field - if (!jform_vvvvvzjvze_required) + if (!jform_vvvvwahvws_required) { updateFieldRequired('view_selection',1); jQuery('#jform_view_selection').removeAttr('required'); jQuery('#jform_view_selection').removeAttr('aria-required'); jQuery('#jform_view_selection').removeClass('required'); - jform_vvvvvzjvze_required = true; + jform_vvvvwahvws_required = true; } } } -// the vvvvvzj Some function -function main_source_vvvvvzj_SomeFunc(main_source_vvvvvzj) +// the vvvvwah Some function +function main_source_vvvvwah_SomeFunc(main_source_vvvvwah) { // set the function logic - if (main_source_vvvvvzj == 1) + if (main_source_vvvvwah == 1) { return true; } return false; } -// the vvvvvzk function -function vvvvvzk(main_source_vvvvvzk) +// the vvvvwai function +function vvvvwai(main_source_vvvvwai) { - if (isSet(main_source_vvvvvzk) && main_source_vvvvvzk.constructor !== Array) + if (isSet(main_source_vvvvwai) && main_source_vvvvwai.constructor !== Array) { - var temp_vvvvvzk = main_source_vvvvvzk; - var main_source_vvvvvzk = []; - main_source_vvvvvzk.push(temp_vvvvvzk); + var temp_vvvvwai = main_source_vvvvwai; + var main_source_vvvvwai = []; + main_source_vvvvwai.push(temp_vvvvwai); } - else if (!isSet(main_source_vvvvvzk)) + else if (!isSet(main_source_vvvvwai)) { - var main_source_vvvvvzk = []; + var main_source_vvvvwai = []; } - var main_source = main_source_vvvvvzk.some(main_source_vvvvvzk_SomeFunc); + var main_source = main_source_vvvvwai.some(main_source_vvvvwai_SomeFunc); // set this function logic @@ -335,55 +328,55 @@ function vvvvvzk(main_source_vvvvvzk) { jQuery('#jform_db_table_main').closest('.control-group').show(); // add required attribute to db_table_main field - if (jform_vvvvvzkvzf_required) + if (jform_vvvvwaivwt_required) { updateFieldRequired('db_table_main',0); jQuery('#jform_db_table_main').prop('required','required'); jQuery('#jform_db_table_main').attr('aria-required',true); jQuery('#jform_db_table_main').addClass('required'); - jform_vvvvvzkvzf_required = false; + jform_vvvvwaivwt_required = false; } } else { jQuery('#jform_db_table_main').closest('.control-group').hide(); // remove required attribute from db_table_main field - if (!jform_vvvvvzkvzf_required) + if (!jform_vvvvwaivwt_required) { updateFieldRequired('db_table_main',1); jQuery('#jform_db_table_main').removeAttr('required'); jQuery('#jform_db_table_main').removeAttr('aria-required'); jQuery('#jform_db_table_main').removeClass('required'); - jform_vvvvvzkvzf_required = true; + jform_vvvvwaivwt_required = true; } } } -// the vvvvvzk Some function -function main_source_vvvvvzk_SomeFunc(main_source_vvvvvzk) +// the vvvvwai Some function +function main_source_vvvvwai_SomeFunc(main_source_vvvvwai) { // set the function logic - if (main_source_vvvvvzk == 2) + if (main_source_vvvvwai == 2) { return true; } return false; } -// the vvvvvzl function -function vvvvvzl(main_source_vvvvvzl) +// the vvvvwaj function +function vvvvwaj(main_source_vvvvwaj) { - if (isSet(main_source_vvvvvzl) && main_source_vvvvvzl.constructor !== Array) + if (isSet(main_source_vvvvwaj) && main_source_vvvvwaj.constructor !== Array) { - var temp_vvvvvzl = main_source_vvvvvzl; - var main_source_vvvvvzl = []; - main_source_vvvvvzl.push(temp_vvvvvzl); + var temp_vvvvwaj = main_source_vvvvwaj; + var main_source_vvvvwaj = []; + main_source_vvvvwaj.push(temp_vvvvwaj); } - else if (!isSet(main_source_vvvvvzl)) + else if (!isSet(main_source_vvvvwaj)) { - var main_source_vvvvvzl = []; + var main_source_vvvvwaj = []; } - var main_source = main_source_vvvvvzl.some(main_source_vvvvvzl_SomeFunc); + var main_source = main_source_vvvvwaj.some(main_source_vvvvwaj_SomeFunc); // set this function logic @@ -391,99 +384,81 @@ function vvvvvzl(main_source_vvvvvzl) { jQuery('#jform_db_selection').closest('.control-group').show(); // add required attribute to db_selection field - if (jform_vvvvvzlvzg_required) + if (jform_vvvvwajvwu_required) { updateFieldRequired('db_selection',0); jQuery('#jform_db_selection').prop('required','required'); jQuery('#jform_db_selection').attr('aria-required',true); jQuery('#jform_db_selection').addClass('required'); - jform_vvvvvzlvzg_required = false; + jform_vvvvwajvwu_required = false; } } else { jQuery('#jform_db_selection').closest('.control-group').hide(); // remove required attribute from db_selection field - if (!jform_vvvvvzlvzg_required) + if (!jform_vvvvwajvwu_required) { updateFieldRequired('db_selection',1); jQuery('#jform_db_selection').removeAttr('required'); jQuery('#jform_db_selection').removeAttr('aria-required'); jQuery('#jform_db_selection').removeClass('required'); - jform_vvvvvzlvzg_required = true; + jform_vvvvwajvwu_required = true; } } } -// the vvvvvzl Some function -function main_source_vvvvvzl_SomeFunc(main_source_vvvvvzl) +// the vvvvwaj Some function +function main_source_vvvvwaj_SomeFunc(main_source_vvvvwaj) { // set the function logic - if (main_source_vvvvvzl == 2) + if (main_source_vvvvwaj == 2) { return true; } return false; } -// the vvvvvzm function -function vvvvvzm(addcalculation_vvvvvzm) +// the vvvvwak function +function vvvvwak(addcalculation_vvvvwak) { // set the function logic - if (addcalculation_vvvvvzm == 1) + if (addcalculation_vvvvwak == 1) { jQuery('#jform_php_calculation-lbl').closest('.control-group').show(); - // add required attribute to php_calculation field - if (jform_vvvvvzmvzh_required) - { - updateFieldRequired('php_calculation',0); - jQuery('#jform_php_calculation').prop('required','required'); - jQuery('#jform_php_calculation').attr('aria-required',true); - jQuery('#jform_php_calculation').addClass('required'); - jform_vvvvvzmvzh_required = false; - } } else { jQuery('#jform_php_calculation-lbl').closest('.control-group').hide(); - // remove required attribute from php_calculation field - if (!jform_vvvvvzmvzh_required) - { - updateFieldRequired('php_calculation',1); - jQuery('#jform_php_calculation').removeAttr('required'); - jQuery('#jform_php_calculation').removeAttr('aria-required'); - jQuery('#jform_php_calculation').removeClass('required'); - jform_vvvvvzmvzh_required = true; - } } } -// the vvvvvzn function -function vvvvvzn(addcalculation_vvvvvzn,gettype_vvvvvzn) +// the vvvvwal function +function vvvvwal(addcalculation_vvvvwal,gettype_vvvvwal) { - if (isSet(addcalculation_vvvvvzn) && addcalculation_vvvvvzn.constructor !== Array) + if (isSet(addcalculation_vvvvwal) && addcalculation_vvvvwal.constructor !== Array) { - var temp_vvvvvzn = addcalculation_vvvvvzn; - var addcalculation_vvvvvzn = []; - addcalculation_vvvvvzn.push(temp_vvvvvzn); + var temp_vvvvwal = addcalculation_vvvvwal; + var addcalculation_vvvvwal = []; + addcalculation_vvvvwal.push(temp_vvvvwal); } - else if (!isSet(addcalculation_vvvvvzn)) + else if (!isSet(addcalculation_vvvvwal)) { - var addcalculation_vvvvvzn = []; + var addcalculation_vvvvwal = []; } - var addcalculation = addcalculation_vvvvvzn.some(addcalculation_vvvvvzn_SomeFunc); + var addcalculation = addcalculation_vvvvwal.some(addcalculation_vvvvwal_SomeFunc); - if (isSet(gettype_vvvvvzn) && gettype_vvvvvzn.constructor !== Array) + if (isSet(gettype_vvvvwal) && gettype_vvvvwal.constructor !== Array) { - var temp_vvvvvzn = gettype_vvvvvzn; - var gettype_vvvvvzn = []; - gettype_vvvvvzn.push(temp_vvvvvzn); + var temp_vvvvwal = gettype_vvvvwal; + var gettype_vvvvwal = []; + gettype_vvvvwal.push(temp_vvvvwal); } - else if (!isSet(gettype_vvvvvzn)) + else if (!isSet(gettype_vvvvwal)) { - var gettype_vvvvvzn = []; + var gettype_vvvvwal = []; } - var gettype = gettype_vvvvvzn.some(gettype_vvvvvzn_SomeFunc); + var gettype = gettype_vvvvwal.some(gettype_vvvvwal_SomeFunc); // set this function logic @@ -497,54 +472,54 @@ function vvvvvzn(addcalculation_vvvvvzn,gettype_vvvvvzn) } } -// the vvvvvzn Some function -function addcalculation_vvvvvzn_SomeFunc(addcalculation_vvvvvzn) +// the vvvvwal Some function +function addcalculation_vvvvwal_SomeFunc(addcalculation_vvvvwal) { // set the function logic - if (addcalculation_vvvvvzn == 1) + if (addcalculation_vvvvwal == 1) { return true; } return false; } -// the vvvvvzn Some function -function gettype_vvvvvzn_SomeFunc(gettype_vvvvvzn) +// the vvvvwal Some function +function gettype_vvvvwal_SomeFunc(gettype_vvvvwal) { // set the function logic - if (gettype_vvvvvzn == 1 || gettype_vvvvvzn == 3) + if (gettype_vvvvwal == 1 || gettype_vvvvwal == 3) { return true; } return false; } -// the vvvvvzo function -function vvvvvzo(addcalculation_vvvvvzo,gettype_vvvvvzo) +// the vvvvwam function +function vvvvwam(addcalculation_vvvvwam,gettype_vvvvwam) { - if (isSet(addcalculation_vvvvvzo) && addcalculation_vvvvvzo.constructor !== Array) + if (isSet(addcalculation_vvvvwam) && addcalculation_vvvvwam.constructor !== Array) { - var temp_vvvvvzo = addcalculation_vvvvvzo; - var addcalculation_vvvvvzo = []; - addcalculation_vvvvvzo.push(temp_vvvvvzo); + var temp_vvvvwam = addcalculation_vvvvwam; + var addcalculation_vvvvwam = []; + addcalculation_vvvvwam.push(temp_vvvvwam); } - else if (!isSet(addcalculation_vvvvvzo)) + else if (!isSet(addcalculation_vvvvwam)) { - var addcalculation_vvvvvzo = []; + var addcalculation_vvvvwam = []; } - var addcalculation = addcalculation_vvvvvzo.some(addcalculation_vvvvvzo_SomeFunc); + var addcalculation = addcalculation_vvvvwam.some(addcalculation_vvvvwam_SomeFunc); - if (isSet(gettype_vvvvvzo) && gettype_vvvvvzo.constructor !== Array) + if (isSet(gettype_vvvvwam) && gettype_vvvvwam.constructor !== Array) { - var temp_vvvvvzo = gettype_vvvvvzo; - var gettype_vvvvvzo = []; - gettype_vvvvvzo.push(temp_vvvvvzo); + var temp_vvvvwam = gettype_vvvvwam; + var gettype_vvvvwam = []; + gettype_vvvvwam.push(temp_vvvvwam); } - else if (!isSet(gettype_vvvvvzo)) + else if (!isSet(gettype_vvvvwam)) { - var gettype_vvvvvzo = []; + var gettype_vvvvwam = []; } - var gettype = gettype_vvvvvzo.some(gettype_vvvvvzo_SomeFunc); + var gettype = gettype_vvvvwam.some(gettype_vvvvwam_SomeFunc); // set this function logic @@ -558,98 +533,80 @@ function vvvvvzo(addcalculation_vvvvvzo,gettype_vvvvvzo) } } -// the vvvvvzo Some function -function addcalculation_vvvvvzo_SomeFunc(addcalculation_vvvvvzo) +// the vvvvwam Some function +function addcalculation_vvvvwam_SomeFunc(addcalculation_vvvvwam) { // set the function logic - if (addcalculation_vvvvvzo == 1) + if (addcalculation_vvvvwam == 1) { return true; } return false; } -// the vvvvvzo Some function -function gettype_vvvvvzo_SomeFunc(gettype_vvvvvzo) +// the vvvvwam Some function +function gettype_vvvvwam_SomeFunc(gettype_vvvvwam) { // set the function logic - if (gettype_vvvvvzo == 2 || gettype_vvvvvzo == 4) + if (gettype_vvvvwam == 2 || gettype_vvvvwam == 4) { return true; } return false; } -// the vvvvvzr function -function vvvvvzr(main_source_vvvvvzr) +// the vvvvwap function +function vvvvwap(main_source_vvvvwap) { - if (isSet(main_source_vvvvvzr) && main_source_vvvvvzr.constructor !== Array) + if (isSet(main_source_vvvvwap) && main_source_vvvvwap.constructor !== Array) { - var temp_vvvvvzr = main_source_vvvvvzr; - var main_source_vvvvvzr = []; - main_source_vvvvvzr.push(temp_vvvvvzr); + var temp_vvvvwap = main_source_vvvvwap; + var main_source_vvvvwap = []; + main_source_vvvvwap.push(temp_vvvvwap); } - else if (!isSet(main_source_vvvvvzr)) + else if (!isSet(main_source_vvvvwap)) { - var main_source_vvvvvzr = []; + var main_source_vvvvwap = []; } - var main_source = main_source_vvvvvzr.some(main_source_vvvvvzr_SomeFunc); + var main_source = main_source_vvvvwap.some(main_source_vvvvwap_SomeFunc); // set this function logic if (main_source) { jQuery('#jform_php_custom_get-lbl').closest('.control-group').show(); - // add required attribute to php_custom_get field - if (jform_vvvvvzrvzi_required) - { - updateFieldRequired('php_custom_get',0); - jQuery('#jform_php_custom_get').prop('required','required'); - jQuery('#jform_php_custom_get').attr('aria-required',true); - jQuery('#jform_php_custom_get').addClass('required'); - jform_vvvvvzrvzi_required = false; - } } else { jQuery('#jform_php_custom_get-lbl').closest('.control-group').hide(); - // remove required attribute from php_custom_get field - if (!jform_vvvvvzrvzi_required) - { - updateFieldRequired('php_custom_get',1); - jQuery('#jform_php_custom_get').removeAttr('required'); - jQuery('#jform_php_custom_get').removeAttr('aria-required'); - jQuery('#jform_php_custom_get').removeClass('required'); - jform_vvvvvzrvzi_required = true; - } } } -// the vvvvvzr Some function -function main_source_vvvvvzr_SomeFunc(main_source_vvvvvzr) +// the vvvvwap Some function +function main_source_vvvvwap_SomeFunc(main_source_vvvvwap) { // set the function logic - if (main_source_vvvvvzr == 3) + if (main_source_vvvvwap == 3) { return true; } return false; } -// the vvvvvzs function -function vvvvvzs(main_source_vvvvvzs) +// the vvvvwaq function +function vvvvwaq(main_source_vvvvwaq) { - if (isSet(main_source_vvvvvzs) && main_source_vvvvvzs.constructor !== Array) + if (isSet(main_source_vvvvwaq) && main_source_vvvvwaq.constructor !== Array) { - var temp_vvvvvzs = main_source_vvvvvzs; - var main_source_vvvvvzs = []; - main_source_vvvvvzs.push(temp_vvvvvzs); + var temp_vvvvwaq = main_source_vvvvwaq; + var main_source_vvvvwaq = []; + main_source_vvvvwaq.push(temp_vvvvwaq); } - else if (!isSet(main_source_vvvvvzs)) + else if (!isSet(main_source_vvvvwaq)) { - var main_source_vvvvvzs = []; + var main_source_vvvvwaq = []; } - var main_source = main_source_vvvvvzs.some(main_source_vvvvvzs_SomeFunc); + var main_source = main_source_vvvvwaq.some(main_source_vvvvwaq_SomeFunc); // set this function logic @@ -675,189 +632,153 @@ function vvvvvzs(main_source_vvvvvzs) } } -// the vvvvvzs Some function -function main_source_vvvvvzs_SomeFunc(main_source_vvvvvzs) +// the vvvvwaq Some function +function main_source_vvvvwaq_SomeFunc(main_source_vvvvwaq) { // set the function logic - if (main_source_vvvvvzs == 1 || main_source_vvvvvzs == 2) + if (main_source_vvvvwaq == 1 || main_source_vvvvwaq == 2) { return true; } return false; } -// the vvvvvzt function -function vvvvvzt(add_php_before_getitem_vvvvvzt,gettype_vvvvvzt) +// the vvvvwar function +function vvvvwar(add_php_before_getitem_vvvvwar,gettype_vvvvwar) { - if (isSet(add_php_before_getitem_vvvvvzt) && add_php_before_getitem_vvvvvzt.constructor !== Array) + if (isSet(add_php_before_getitem_vvvvwar) && add_php_before_getitem_vvvvwar.constructor !== Array) { - var temp_vvvvvzt = add_php_before_getitem_vvvvvzt; - var add_php_before_getitem_vvvvvzt = []; - add_php_before_getitem_vvvvvzt.push(temp_vvvvvzt); + var temp_vvvvwar = add_php_before_getitem_vvvvwar; + var add_php_before_getitem_vvvvwar = []; + add_php_before_getitem_vvvvwar.push(temp_vvvvwar); } - else if (!isSet(add_php_before_getitem_vvvvvzt)) + else if (!isSet(add_php_before_getitem_vvvvwar)) { - var add_php_before_getitem_vvvvvzt = []; + var add_php_before_getitem_vvvvwar = []; } - var add_php_before_getitem = add_php_before_getitem_vvvvvzt.some(add_php_before_getitem_vvvvvzt_SomeFunc); + var add_php_before_getitem = add_php_before_getitem_vvvvwar.some(add_php_before_getitem_vvvvwar_SomeFunc); - if (isSet(gettype_vvvvvzt) && gettype_vvvvvzt.constructor !== Array) + if (isSet(gettype_vvvvwar) && gettype_vvvvwar.constructor !== Array) { - var temp_vvvvvzt = gettype_vvvvvzt; - var gettype_vvvvvzt = []; - gettype_vvvvvzt.push(temp_vvvvvzt); + var temp_vvvvwar = gettype_vvvvwar; + var gettype_vvvvwar = []; + gettype_vvvvwar.push(temp_vvvvwar); } - else if (!isSet(gettype_vvvvvzt)) + else if (!isSet(gettype_vvvvwar)) { - var gettype_vvvvvzt = []; + var gettype_vvvvwar = []; } - var gettype = gettype_vvvvvzt.some(gettype_vvvvvzt_SomeFunc); + var gettype = gettype_vvvvwar.some(gettype_vvvvwar_SomeFunc); // set this function logic if (add_php_before_getitem && gettype) { jQuery('#jform_php_before_getitem-lbl').closest('.control-group').show(); - // add required attribute to php_before_getitem field - if (jform_vvvvvztvzj_required) - { - updateFieldRequired('php_before_getitem',0); - jQuery('#jform_php_before_getitem').prop('required','required'); - jQuery('#jform_php_before_getitem').attr('aria-required',true); - jQuery('#jform_php_before_getitem').addClass('required'); - jform_vvvvvztvzj_required = false; - } } else { jQuery('#jform_php_before_getitem-lbl').closest('.control-group').hide(); - // remove required attribute from php_before_getitem field - if (!jform_vvvvvztvzj_required) - { - updateFieldRequired('php_before_getitem',1); - jQuery('#jform_php_before_getitem').removeAttr('required'); - jQuery('#jform_php_before_getitem').removeAttr('aria-required'); - jQuery('#jform_php_before_getitem').removeClass('required'); - jform_vvvvvztvzj_required = true; - } } } -// the vvvvvzt Some function -function add_php_before_getitem_vvvvvzt_SomeFunc(add_php_before_getitem_vvvvvzt) +// the vvvvwar Some function +function add_php_before_getitem_vvvvwar_SomeFunc(add_php_before_getitem_vvvvwar) { // set the function logic - if (add_php_before_getitem_vvvvvzt == 1) + if (add_php_before_getitem_vvvvwar == 1) { return true; } return false; } -// the vvvvvzt Some function -function gettype_vvvvvzt_SomeFunc(gettype_vvvvvzt) +// the vvvvwar Some function +function gettype_vvvvwar_SomeFunc(gettype_vvvvwar) { // set the function logic - if (gettype_vvvvvzt == 1 || gettype_vvvvvzt == 3) + if (gettype_vvvvwar == 1 || gettype_vvvvwar == 3) { return true; } return false; } -// the vvvvvzu function -function vvvvvzu(add_php_after_getitem_vvvvvzu,gettype_vvvvvzu) +// the vvvvwas function +function vvvvwas(add_php_after_getitem_vvvvwas,gettype_vvvvwas) { - if (isSet(add_php_after_getitem_vvvvvzu) && add_php_after_getitem_vvvvvzu.constructor !== Array) + if (isSet(add_php_after_getitem_vvvvwas) && add_php_after_getitem_vvvvwas.constructor !== Array) { - var temp_vvvvvzu = add_php_after_getitem_vvvvvzu; - var add_php_after_getitem_vvvvvzu = []; - add_php_after_getitem_vvvvvzu.push(temp_vvvvvzu); + var temp_vvvvwas = add_php_after_getitem_vvvvwas; + var add_php_after_getitem_vvvvwas = []; + add_php_after_getitem_vvvvwas.push(temp_vvvvwas); } - else if (!isSet(add_php_after_getitem_vvvvvzu)) + else if (!isSet(add_php_after_getitem_vvvvwas)) { - var add_php_after_getitem_vvvvvzu = []; + var add_php_after_getitem_vvvvwas = []; } - var add_php_after_getitem = add_php_after_getitem_vvvvvzu.some(add_php_after_getitem_vvvvvzu_SomeFunc); + var add_php_after_getitem = add_php_after_getitem_vvvvwas.some(add_php_after_getitem_vvvvwas_SomeFunc); - if (isSet(gettype_vvvvvzu) && gettype_vvvvvzu.constructor !== Array) + if (isSet(gettype_vvvvwas) && gettype_vvvvwas.constructor !== Array) { - var temp_vvvvvzu = gettype_vvvvvzu; - var gettype_vvvvvzu = []; - gettype_vvvvvzu.push(temp_vvvvvzu); + var temp_vvvvwas = gettype_vvvvwas; + var gettype_vvvvwas = []; + gettype_vvvvwas.push(temp_vvvvwas); } - else if (!isSet(gettype_vvvvvzu)) + else if (!isSet(gettype_vvvvwas)) { - var gettype_vvvvvzu = []; + var gettype_vvvvwas = []; } - var gettype = gettype_vvvvvzu.some(gettype_vvvvvzu_SomeFunc); + var gettype = gettype_vvvvwas.some(gettype_vvvvwas_SomeFunc); // set this function logic if (add_php_after_getitem && gettype) { jQuery('#jform_php_after_getitem-lbl').closest('.control-group').show(); - // add required attribute to php_after_getitem field - if (jform_vvvvvzuvzk_required) - { - updateFieldRequired('php_after_getitem',0); - jQuery('#jform_php_after_getitem').prop('required','required'); - jQuery('#jform_php_after_getitem').attr('aria-required',true); - jQuery('#jform_php_after_getitem').addClass('required'); - jform_vvvvvzuvzk_required = false; - } } else { jQuery('#jform_php_after_getitem-lbl').closest('.control-group').hide(); - // remove required attribute from php_after_getitem field - if (!jform_vvvvvzuvzk_required) - { - updateFieldRequired('php_after_getitem',1); - jQuery('#jform_php_after_getitem').removeAttr('required'); - jQuery('#jform_php_after_getitem').removeAttr('aria-required'); - jQuery('#jform_php_after_getitem').removeClass('required'); - jform_vvvvvzuvzk_required = true; - } } } -// the vvvvvzu Some function -function add_php_after_getitem_vvvvvzu_SomeFunc(add_php_after_getitem_vvvvvzu) +// the vvvvwas Some function +function add_php_after_getitem_vvvvwas_SomeFunc(add_php_after_getitem_vvvvwas) { // set the function logic - if (add_php_after_getitem_vvvvvzu == 1) + if (add_php_after_getitem_vvvvwas == 1) { return true; } return false; } -// the vvvvvzu Some function -function gettype_vvvvvzu_SomeFunc(gettype_vvvvvzu) +// the vvvvwas Some function +function gettype_vvvvwas_SomeFunc(gettype_vvvvwas) { // set the function logic - if (gettype_vvvvvzu == 1 || gettype_vvvvvzu == 3) + if (gettype_vvvvwas == 1 || gettype_vvvvwas == 3) { return true; } return false; } -// the vvvvvzw function -function vvvvvzw(gettype_vvvvvzw) +// the vvvvwau function +function vvvvwau(gettype_vvvvwau) { - if (isSet(gettype_vvvvvzw) && gettype_vvvvvzw.constructor !== Array) + if (isSet(gettype_vvvvwau) && gettype_vvvvwau.constructor !== Array) { - var temp_vvvvvzw = gettype_vvvvvzw; - var gettype_vvvvvzw = []; - gettype_vvvvvzw.push(temp_vvvvvzw); + var temp_vvvvwau = gettype_vvvvwau; + var gettype_vvvvwau = []; + gettype_vvvvwau.push(temp_vvvvwau); } - else if (!isSet(gettype_vvvvvzw)) + else if (!isSet(gettype_vvvvwau)) { - var gettype_vvvvvzw = []; + var gettype_vvvvwau = []; } - var gettype = gettype_vvvvvzw.some(gettype_vvvvvzw_SomeFunc); + var gettype = gettype_vvvvwau.some(gettype_vvvvwau_SomeFunc); // set this function logic @@ -865,312 +786,258 @@ function vvvvvzw(gettype_vvvvvzw) { jQuery('#jform_add_php_after_getitem').closest('.control-group').show(); // add required attribute to add_php_after_getitem field - if (jform_vvvvvzwvzl_required) + if (jform_vvvvwauvwv_required) { updateFieldRequired('add_php_after_getitem',0); jQuery('#jform_add_php_after_getitem').prop('required','required'); jQuery('#jform_add_php_after_getitem').attr('aria-required',true); jQuery('#jform_add_php_after_getitem').addClass('required'); - jform_vvvvvzwvzl_required = false; + jform_vvvvwauvwv_required = false; } jQuery('#jform_add_php_before_getitem').closest('.control-group').show(); // add required attribute to add_php_before_getitem field - if (jform_vvvvvzwvzm_required) + if (jform_vvvvwauvww_required) { updateFieldRequired('add_php_before_getitem',0); jQuery('#jform_add_php_before_getitem').prop('required','required'); jQuery('#jform_add_php_before_getitem').attr('aria-required',true); jQuery('#jform_add_php_before_getitem').addClass('required'); - jform_vvvvvzwvzm_required = false; + jform_vvvvwauvww_required = false; } } else { jQuery('#jform_add_php_after_getitem').closest('.control-group').hide(); // remove required attribute from add_php_after_getitem field - if (!jform_vvvvvzwvzl_required) + if (!jform_vvvvwauvwv_required) { updateFieldRequired('add_php_after_getitem',1); jQuery('#jform_add_php_after_getitem').removeAttr('required'); jQuery('#jform_add_php_after_getitem').removeAttr('aria-required'); jQuery('#jform_add_php_after_getitem').removeClass('required'); - jform_vvvvvzwvzl_required = true; + jform_vvvvwauvwv_required = true; } jQuery('#jform_add_php_before_getitem').closest('.control-group').hide(); // remove required attribute from add_php_before_getitem field - if (!jform_vvvvvzwvzm_required) + if (!jform_vvvvwauvww_required) { updateFieldRequired('add_php_before_getitem',1); jQuery('#jform_add_php_before_getitem').removeAttr('required'); jQuery('#jform_add_php_before_getitem').removeAttr('aria-required'); jQuery('#jform_add_php_before_getitem').removeClass('required'); - jform_vvvvvzwvzm_required = true; + jform_vvvvwauvww_required = true; } } } -// the vvvvvzw Some function -function gettype_vvvvvzw_SomeFunc(gettype_vvvvvzw) +// the vvvvwau Some function +function gettype_vvvvwau_SomeFunc(gettype_vvvvwau) { // set the function logic - if (gettype_vvvvvzw == 1 || gettype_vvvvvzw == 3) + if (gettype_vvvvwau == 1 || gettype_vvvvwau == 3) { return true; } return false; } -// the vvvvvzx function -function vvvvvzx(add_php_getlistquery_vvvvvzx,gettype_vvvvvzx) +// the vvvvwav function +function vvvvwav(add_php_getlistquery_vvvvwav,gettype_vvvvwav) { - if (isSet(add_php_getlistquery_vvvvvzx) && add_php_getlistquery_vvvvvzx.constructor !== Array) + if (isSet(add_php_getlistquery_vvvvwav) && add_php_getlistquery_vvvvwav.constructor !== Array) { - var temp_vvvvvzx = add_php_getlistquery_vvvvvzx; - var add_php_getlistquery_vvvvvzx = []; - add_php_getlistquery_vvvvvzx.push(temp_vvvvvzx); + var temp_vvvvwav = add_php_getlistquery_vvvvwav; + var add_php_getlistquery_vvvvwav = []; + add_php_getlistquery_vvvvwav.push(temp_vvvvwav); } - else if (!isSet(add_php_getlistquery_vvvvvzx)) + else if (!isSet(add_php_getlistquery_vvvvwav)) { - var add_php_getlistquery_vvvvvzx = []; + var add_php_getlistquery_vvvvwav = []; } - var add_php_getlistquery = add_php_getlistquery_vvvvvzx.some(add_php_getlistquery_vvvvvzx_SomeFunc); + var add_php_getlistquery = add_php_getlistquery_vvvvwav.some(add_php_getlistquery_vvvvwav_SomeFunc); - if (isSet(gettype_vvvvvzx) && gettype_vvvvvzx.constructor !== Array) + if (isSet(gettype_vvvvwav) && gettype_vvvvwav.constructor !== Array) { - var temp_vvvvvzx = gettype_vvvvvzx; - var gettype_vvvvvzx = []; - gettype_vvvvvzx.push(temp_vvvvvzx); + var temp_vvvvwav = gettype_vvvvwav; + var gettype_vvvvwav = []; + gettype_vvvvwav.push(temp_vvvvwav); } - else if (!isSet(gettype_vvvvvzx)) + else if (!isSet(gettype_vvvvwav)) { - var gettype_vvvvvzx = []; + var gettype_vvvvwav = []; } - var gettype = gettype_vvvvvzx.some(gettype_vvvvvzx_SomeFunc); + var gettype = gettype_vvvvwav.some(gettype_vvvvwav_SomeFunc); // set this function logic if (add_php_getlistquery && gettype) { jQuery('#jform_php_getlistquery-lbl').closest('.control-group').show(); - // add required attribute to php_getlistquery field - if (jform_vvvvvzxvzn_required) - { - updateFieldRequired('php_getlistquery',0); - jQuery('#jform_php_getlistquery').prop('required','required'); - jQuery('#jform_php_getlistquery').attr('aria-required',true); - jQuery('#jform_php_getlistquery').addClass('required'); - jform_vvvvvzxvzn_required = false; - } } else { jQuery('#jform_php_getlistquery-lbl').closest('.control-group').hide(); - // remove required attribute from php_getlistquery field - if (!jform_vvvvvzxvzn_required) - { - updateFieldRequired('php_getlistquery',1); - jQuery('#jform_php_getlistquery').removeAttr('required'); - jQuery('#jform_php_getlistquery').removeAttr('aria-required'); - jQuery('#jform_php_getlistquery').removeClass('required'); - jform_vvvvvzxvzn_required = true; - } } } -// the vvvvvzx Some function -function add_php_getlistquery_vvvvvzx_SomeFunc(add_php_getlistquery_vvvvvzx) +// the vvvvwav Some function +function add_php_getlistquery_vvvvwav_SomeFunc(add_php_getlistquery_vvvvwav) { // set the function logic - if (add_php_getlistquery_vvvvvzx == 1) + if (add_php_getlistquery_vvvvwav == 1) { return true; } return false; } -// the vvvvvzx Some function -function gettype_vvvvvzx_SomeFunc(gettype_vvvvvzx) +// the vvvvwav Some function +function gettype_vvvvwav_SomeFunc(gettype_vvvvwav) { // set the function logic - if (gettype_vvvvvzx == 2 || gettype_vvvvvzx == 4) + if (gettype_vvvvwav == 2 || gettype_vvvvwav == 4) { return true; } return false; } -// the vvvvvzy function -function vvvvvzy(add_php_before_getitems_vvvvvzy,gettype_vvvvvzy) +// the vvvvwaw function +function vvvvwaw(add_php_before_getitems_vvvvwaw,gettype_vvvvwaw) { - if (isSet(add_php_before_getitems_vvvvvzy) && add_php_before_getitems_vvvvvzy.constructor !== Array) + if (isSet(add_php_before_getitems_vvvvwaw) && add_php_before_getitems_vvvvwaw.constructor !== Array) { - var temp_vvvvvzy = add_php_before_getitems_vvvvvzy; - var add_php_before_getitems_vvvvvzy = []; - add_php_before_getitems_vvvvvzy.push(temp_vvvvvzy); + var temp_vvvvwaw = add_php_before_getitems_vvvvwaw; + var add_php_before_getitems_vvvvwaw = []; + add_php_before_getitems_vvvvwaw.push(temp_vvvvwaw); } - else if (!isSet(add_php_before_getitems_vvvvvzy)) + else if (!isSet(add_php_before_getitems_vvvvwaw)) { - var add_php_before_getitems_vvvvvzy = []; + var add_php_before_getitems_vvvvwaw = []; } - var add_php_before_getitems = add_php_before_getitems_vvvvvzy.some(add_php_before_getitems_vvvvvzy_SomeFunc); + var add_php_before_getitems = add_php_before_getitems_vvvvwaw.some(add_php_before_getitems_vvvvwaw_SomeFunc); - if (isSet(gettype_vvvvvzy) && gettype_vvvvvzy.constructor !== Array) + if (isSet(gettype_vvvvwaw) && gettype_vvvvwaw.constructor !== Array) { - var temp_vvvvvzy = gettype_vvvvvzy; - var gettype_vvvvvzy = []; - gettype_vvvvvzy.push(temp_vvvvvzy); + var temp_vvvvwaw = gettype_vvvvwaw; + var gettype_vvvvwaw = []; + gettype_vvvvwaw.push(temp_vvvvwaw); } - else if (!isSet(gettype_vvvvvzy)) + else if (!isSet(gettype_vvvvwaw)) { - var gettype_vvvvvzy = []; + var gettype_vvvvwaw = []; } - var gettype = gettype_vvvvvzy.some(gettype_vvvvvzy_SomeFunc); + var gettype = gettype_vvvvwaw.some(gettype_vvvvwaw_SomeFunc); // set this function logic if (add_php_before_getitems && gettype) { jQuery('#jform_php_before_getitems-lbl').closest('.control-group').show(); - // add required attribute to php_before_getitems field - if (jform_vvvvvzyvzo_required) - { - updateFieldRequired('php_before_getitems',0); - jQuery('#jform_php_before_getitems').prop('required','required'); - jQuery('#jform_php_before_getitems').attr('aria-required',true); - jQuery('#jform_php_before_getitems').addClass('required'); - jform_vvvvvzyvzo_required = false; - } } else { jQuery('#jform_php_before_getitems-lbl').closest('.control-group').hide(); - // remove required attribute from php_before_getitems field - if (!jform_vvvvvzyvzo_required) - { - updateFieldRequired('php_before_getitems',1); - jQuery('#jform_php_before_getitems').removeAttr('required'); - jQuery('#jform_php_before_getitems').removeAttr('aria-required'); - jQuery('#jform_php_before_getitems').removeClass('required'); - jform_vvvvvzyvzo_required = true; - } } } -// the vvvvvzy Some function -function add_php_before_getitems_vvvvvzy_SomeFunc(add_php_before_getitems_vvvvvzy) +// the vvvvwaw Some function +function add_php_before_getitems_vvvvwaw_SomeFunc(add_php_before_getitems_vvvvwaw) { // set the function logic - if (add_php_before_getitems_vvvvvzy == 1) + if (add_php_before_getitems_vvvvwaw == 1) { return true; } return false; } -// the vvvvvzy Some function -function gettype_vvvvvzy_SomeFunc(gettype_vvvvvzy) +// the vvvvwaw Some function +function gettype_vvvvwaw_SomeFunc(gettype_vvvvwaw) { // set the function logic - if (gettype_vvvvvzy == 2 || gettype_vvvvvzy == 4) + if (gettype_vvvvwaw == 2 || gettype_vvvvwaw == 4) { return true; } return false; } -// the vvvvvzz function -function vvvvvzz(add_php_after_getitems_vvvvvzz,gettype_vvvvvzz) +// the vvvvwax function +function vvvvwax(add_php_after_getitems_vvvvwax,gettype_vvvvwax) { - if (isSet(add_php_after_getitems_vvvvvzz) && add_php_after_getitems_vvvvvzz.constructor !== Array) + if (isSet(add_php_after_getitems_vvvvwax) && add_php_after_getitems_vvvvwax.constructor !== Array) { - var temp_vvvvvzz = add_php_after_getitems_vvvvvzz; - var add_php_after_getitems_vvvvvzz = []; - add_php_after_getitems_vvvvvzz.push(temp_vvvvvzz); + var temp_vvvvwax = add_php_after_getitems_vvvvwax; + var add_php_after_getitems_vvvvwax = []; + add_php_after_getitems_vvvvwax.push(temp_vvvvwax); } - else if (!isSet(add_php_after_getitems_vvvvvzz)) + else if (!isSet(add_php_after_getitems_vvvvwax)) { - var add_php_after_getitems_vvvvvzz = []; + var add_php_after_getitems_vvvvwax = []; } - var add_php_after_getitems = add_php_after_getitems_vvvvvzz.some(add_php_after_getitems_vvvvvzz_SomeFunc); + var add_php_after_getitems = add_php_after_getitems_vvvvwax.some(add_php_after_getitems_vvvvwax_SomeFunc); - if (isSet(gettype_vvvvvzz) && gettype_vvvvvzz.constructor !== Array) + if (isSet(gettype_vvvvwax) && gettype_vvvvwax.constructor !== Array) { - var temp_vvvvvzz = gettype_vvvvvzz; - var gettype_vvvvvzz = []; - gettype_vvvvvzz.push(temp_vvvvvzz); + var temp_vvvvwax = gettype_vvvvwax; + var gettype_vvvvwax = []; + gettype_vvvvwax.push(temp_vvvvwax); } - else if (!isSet(gettype_vvvvvzz)) + else if (!isSet(gettype_vvvvwax)) { - var gettype_vvvvvzz = []; + var gettype_vvvvwax = []; } - var gettype = gettype_vvvvvzz.some(gettype_vvvvvzz_SomeFunc); + var gettype = gettype_vvvvwax.some(gettype_vvvvwax_SomeFunc); // set this function logic if (add_php_after_getitems && gettype) { jQuery('#jform_php_after_getitems-lbl').closest('.control-group').show(); - // add required attribute to php_after_getitems field - if (jform_vvvvvzzvzp_required) - { - updateFieldRequired('php_after_getitems',0); - jQuery('#jform_php_after_getitems').prop('required','required'); - jQuery('#jform_php_after_getitems').attr('aria-required',true); - jQuery('#jform_php_after_getitems').addClass('required'); - jform_vvvvvzzvzp_required = false; - } } else { jQuery('#jform_php_after_getitems-lbl').closest('.control-group').hide(); - // remove required attribute from php_after_getitems field - if (!jform_vvvvvzzvzp_required) - { - updateFieldRequired('php_after_getitems',1); - jQuery('#jform_php_after_getitems').removeAttr('required'); - jQuery('#jform_php_after_getitems').removeAttr('aria-required'); - jQuery('#jform_php_after_getitems').removeClass('required'); - jform_vvvvvzzvzp_required = true; - } } } -// the vvvvvzz Some function -function add_php_after_getitems_vvvvvzz_SomeFunc(add_php_after_getitems_vvvvvzz) +// the vvvvwax Some function +function add_php_after_getitems_vvvvwax_SomeFunc(add_php_after_getitems_vvvvwax) { // set the function logic - if (add_php_after_getitems_vvvvvzz == 1) + if (add_php_after_getitems_vvvvwax == 1) { return true; } return false; } -// the vvvvvzz Some function -function gettype_vvvvvzz_SomeFunc(gettype_vvvvvzz) +// the vvvvwax Some function +function gettype_vvvvwax_SomeFunc(gettype_vvvvwax) { // set the function logic - if (gettype_vvvvvzz == 2 || gettype_vvvvvzz == 4) + if (gettype_vvvvwax == 2 || gettype_vvvvwax == 4) { return true; } return false; } -// the vvvvwab function -function vvvvwab(gettype_vvvvwab) +// the vvvvwaz function +function vvvvwaz(gettype_vvvvwaz) { - if (isSet(gettype_vvvvwab) && gettype_vvvvwab.constructor !== Array) + if (isSet(gettype_vvvvwaz) && gettype_vvvvwaz.constructor !== Array) { - var temp_vvvvwab = gettype_vvvvwab; - var gettype_vvvvwab = []; - gettype_vvvvwab.push(temp_vvvvwab); + var temp_vvvvwaz = gettype_vvvvwaz; + var gettype_vvvvwaz = []; + gettype_vvvvwaz.push(temp_vvvvwaz); } - else if (!isSet(gettype_vvvvwab)) + else if (!isSet(gettype_vvvvwaz)) { - var gettype_vvvvwab = []; + var gettype_vvvvwaz = []; } - var gettype = gettype_vvvvwab.some(gettype_vvvvwab_SomeFunc); + var gettype = gettype_vvvvwaz.some(gettype_vvvvwaz_SomeFunc); // set this function logic @@ -1178,95 +1045,95 @@ function vvvvwab(gettype_vvvvwab) { jQuery('#jform_add_php_after_getitems').closest('.control-group').show(); // add required attribute to add_php_after_getitems field - if (jform_vvvvwabvzq_required) + if (jform_vvvvwazvwx_required) { updateFieldRequired('add_php_after_getitems',0); jQuery('#jform_add_php_after_getitems').prop('required','required'); jQuery('#jform_add_php_after_getitems').attr('aria-required',true); jQuery('#jform_add_php_after_getitems').addClass('required'); - jform_vvvvwabvzq_required = false; + jform_vvvvwazvwx_required = false; } jQuery('#jform_add_php_before_getitems').closest('.control-group').show(); // add required attribute to add_php_before_getitems field - if (jform_vvvvwabvzr_required) + if (jform_vvvvwazvwy_required) { updateFieldRequired('add_php_before_getitems',0); jQuery('#jform_add_php_before_getitems').prop('required','required'); jQuery('#jform_add_php_before_getitems').attr('aria-required',true); jQuery('#jform_add_php_before_getitems').addClass('required'); - jform_vvvvwabvzr_required = false; + jform_vvvvwazvwy_required = false; } jQuery('#jform_add_php_getlistquery').closest('.control-group').show(); // add required attribute to add_php_getlistquery field - if (jform_vvvvwabvzs_required) + if (jform_vvvvwazvwz_required) { updateFieldRequired('add_php_getlistquery',0); jQuery('#jform_add_php_getlistquery').prop('required','required'); jQuery('#jform_add_php_getlistquery').attr('aria-required',true); jQuery('#jform_add_php_getlistquery').addClass('required'); - jform_vvvvwabvzs_required = false; + jform_vvvvwazvwz_required = false; } } else { jQuery('#jform_add_php_after_getitems').closest('.control-group').hide(); // remove required attribute from add_php_after_getitems field - if (!jform_vvvvwabvzq_required) + if (!jform_vvvvwazvwx_required) { updateFieldRequired('add_php_after_getitems',1); jQuery('#jform_add_php_after_getitems').removeAttr('required'); jQuery('#jform_add_php_after_getitems').removeAttr('aria-required'); jQuery('#jform_add_php_after_getitems').removeClass('required'); - jform_vvvvwabvzq_required = true; + jform_vvvvwazvwx_required = true; } jQuery('#jform_add_php_before_getitems').closest('.control-group').hide(); // remove required attribute from add_php_before_getitems field - if (!jform_vvvvwabvzr_required) + if (!jform_vvvvwazvwy_required) { updateFieldRequired('add_php_before_getitems',1); jQuery('#jform_add_php_before_getitems').removeAttr('required'); jQuery('#jform_add_php_before_getitems').removeAttr('aria-required'); jQuery('#jform_add_php_before_getitems').removeClass('required'); - jform_vvvvwabvzr_required = true; + jform_vvvvwazvwy_required = true; } jQuery('#jform_add_php_getlistquery').closest('.control-group').hide(); // remove required attribute from add_php_getlistquery field - if (!jform_vvvvwabvzs_required) + if (!jform_vvvvwazvwz_required) { updateFieldRequired('add_php_getlistquery',1); jQuery('#jform_add_php_getlistquery').removeAttr('required'); jQuery('#jform_add_php_getlistquery').removeAttr('aria-required'); jQuery('#jform_add_php_getlistquery').removeClass('required'); - jform_vvvvwabvzs_required = true; + jform_vvvvwazvwz_required = true; } } } -// the vvvvwab Some function -function gettype_vvvvwab_SomeFunc(gettype_vvvvwab) +// the vvvvwaz Some function +function gettype_vvvvwaz_SomeFunc(gettype_vvvvwaz) { // set the function logic - if (gettype_vvvvwab == 2 || gettype_vvvvwab == 4) + if (gettype_vvvvwaz == 2 || gettype_vvvvwaz == 4) { return true; } return false; } -// the vvvvwac function -function vvvvwac(gettype_vvvvwac) +// the vvvvwba function +function vvvvwba(gettype_vvvvwba) { - if (isSet(gettype_vvvvwac) && gettype_vvvvwac.constructor !== Array) + if (isSet(gettype_vvvvwba) && gettype_vvvvwba.constructor !== Array) { - var temp_vvvvwac = gettype_vvvvwac; - var gettype_vvvvwac = []; - gettype_vvvvwac.push(temp_vvvvwac); + var temp_vvvvwba = gettype_vvvvwba; + var gettype_vvvvwba = []; + gettype_vvvvwba.push(temp_vvvvwba); } - else if (!isSet(gettype_vvvvwac)) + else if (!isSet(gettype_vvvvwba)) { - var gettype_vvvvwac = []; + var gettype_vvvvwba = []; } - var gettype = gettype_vvvvwac.some(gettype_vvvvwac_SomeFunc); + var gettype = gettype_vvvvwba.some(gettype_vvvvwba_SomeFunc); // set this function logic @@ -1274,55 +1141,55 @@ function vvvvwac(gettype_vvvvwac) { jQuery('#jform_pagination').closest('.control-group').show(); // add required attribute to pagination field - if (jform_vvvvwacvzt_required) + if (jform_vvvvwbavxa_required) { updateFieldRequired('pagination',0); jQuery('#jform_pagination').prop('required','required'); jQuery('#jform_pagination').attr('aria-required',true); jQuery('#jform_pagination').addClass('required'); - jform_vvvvwacvzt_required = false; + jform_vvvvwbavxa_required = false; } } else { jQuery('#jform_pagination').closest('.control-group').hide(); // remove required attribute from pagination field - if (!jform_vvvvwacvzt_required) + if (!jform_vvvvwbavxa_required) { updateFieldRequired('pagination',1); jQuery('#jform_pagination').removeAttr('required'); jQuery('#jform_pagination').removeAttr('aria-required'); jQuery('#jform_pagination').removeClass('required'); - jform_vvvvwacvzt_required = true; + jform_vvvvwbavxa_required = true; } } } -// the vvvvwac Some function -function gettype_vvvvwac_SomeFunc(gettype_vvvvwac) +// the vvvvwba Some function +function gettype_vvvvwba_SomeFunc(gettype_vvvvwba) { // set the function logic - if (gettype_vvvvwac == 2) + if (gettype_vvvvwba == 2) { return true; } return false; } -// the vvvvwad function -function vvvvwad(gettype_vvvvwad) +// the vvvvwbb function +function vvvvwbb(gettype_vvvvwbb) { - if (isSet(gettype_vvvvwad) && gettype_vvvvwad.constructor !== Array) + if (isSet(gettype_vvvvwbb) && gettype_vvvvwbb.constructor !== Array) { - var temp_vvvvwad = gettype_vvvvwad; - var gettype_vvvvwad = []; - gettype_vvvvwad.push(temp_vvvvwad); + var temp_vvvvwbb = gettype_vvvvwbb; + var gettype_vvvvwbb = []; + gettype_vvvvwbb.push(temp_vvvvwbb); } - else if (!isSet(gettype_vvvvwad)) + else if (!isSet(gettype_vvvvwbb)) { - var gettype_vvvvwad = []; + var gettype_vvvvwbb = []; } - var gettype = gettype_vvvvwad.some(gettype_vvvvwad_SomeFunc); + var gettype = gettype_vvvvwbb.some(gettype_vvvvwbb_SomeFunc); // set this function logic @@ -1330,67 +1197,67 @@ function vvvvwad(gettype_vvvvwad) { jQuery('#jform_add_php_router_parse').closest('.control-group').show(); // add required attribute to add_php_router_parse field - if (jform_vvvvwadvzu_required) + if (jform_vvvvwbbvxb_required) { updateFieldRequired('add_php_router_parse',0); jQuery('#jform_add_php_router_parse').prop('required','required'); jQuery('#jform_add_php_router_parse').attr('aria-required',true); jQuery('#jform_add_php_router_parse').addClass('required'); - jform_vvvvwadvzu_required = false; + jform_vvvvwbbvxb_required = false; } } else { jQuery('#jform_add_php_router_parse').closest('.control-group').hide(); // remove required attribute from add_php_router_parse field - if (!jform_vvvvwadvzu_required) + if (!jform_vvvvwbbvxb_required) { updateFieldRequired('add_php_router_parse',1); jQuery('#jform_add_php_router_parse').removeAttr('required'); jQuery('#jform_add_php_router_parse').removeAttr('aria-required'); jQuery('#jform_add_php_router_parse').removeClass('required'); - jform_vvvvwadvzu_required = true; + jform_vvvvwbbvxb_required = true; } } } -// the vvvvwad Some function -function gettype_vvvvwad_SomeFunc(gettype_vvvvwad) +// the vvvvwbb Some function +function gettype_vvvvwbb_SomeFunc(gettype_vvvvwbb) { // set the function logic - if (gettype_vvvvwad == 1 || gettype_vvvvwad == 2) + if (gettype_vvvvwbb == 1 || gettype_vvvvwbb == 2) { return true; } return false; } -// the vvvvwae function -function vvvvwae(gettype_vvvvwae,add_php_router_parse_vvvvwae) +// the vvvvwbc function +function vvvvwbc(gettype_vvvvwbc,add_php_router_parse_vvvvwbc) { - if (isSet(gettype_vvvvwae) && gettype_vvvvwae.constructor !== Array) + if (isSet(gettype_vvvvwbc) && gettype_vvvvwbc.constructor !== Array) { - var temp_vvvvwae = gettype_vvvvwae; - var gettype_vvvvwae = []; - gettype_vvvvwae.push(temp_vvvvwae); + var temp_vvvvwbc = gettype_vvvvwbc; + var gettype_vvvvwbc = []; + gettype_vvvvwbc.push(temp_vvvvwbc); } - else if (!isSet(gettype_vvvvwae)) + else if (!isSet(gettype_vvvvwbc)) { - var gettype_vvvvwae = []; + var gettype_vvvvwbc = []; } - var gettype = gettype_vvvvwae.some(gettype_vvvvwae_SomeFunc); + var gettype = gettype_vvvvwbc.some(gettype_vvvvwbc_SomeFunc); - if (isSet(add_php_router_parse_vvvvwae) && add_php_router_parse_vvvvwae.constructor !== Array) + if (isSet(add_php_router_parse_vvvvwbc) && add_php_router_parse_vvvvwbc.constructor !== Array) { - var temp_vvvvwae = add_php_router_parse_vvvvwae; - var add_php_router_parse_vvvvwae = []; - add_php_router_parse_vvvvwae.push(temp_vvvvwae); + var temp_vvvvwbc = add_php_router_parse_vvvvwbc; + var add_php_router_parse_vvvvwbc = []; + add_php_router_parse_vvvvwbc.push(temp_vvvvwbc); } - else if (!isSet(add_php_router_parse_vvvvwae)) + else if (!isSet(add_php_router_parse_vvvvwbc)) { - var add_php_router_parse_vvvvwae = []; + var add_php_router_parse_vvvvwbc = []; } - var add_php_router_parse = add_php_router_parse_vvvvwae.some(add_php_router_parse_vvvvwae_SomeFunc); + var add_php_router_parse = add_php_router_parse_vvvvwbc.some(add_php_router_parse_vvvvwbc_SomeFunc); // set this function logic @@ -1398,66 +1265,66 @@ function vvvvwae(gettype_vvvvwae,add_php_router_parse_vvvvwae) { jQuery('#jform_php_router_parse').closest('.control-group').show(); // add required attribute to php_router_parse field - if (jform_vvvvwaevzv_required) + if (jform_vvvvwbcvxc_required) { updateFieldRequired('php_router_parse',0); jQuery('#jform_php_router_parse').prop('required','required'); jQuery('#jform_php_router_parse').attr('aria-required',true); jQuery('#jform_php_router_parse').addClass('required'); - jform_vvvvwaevzv_required = false; + jform_vvvvwbcvxc_required = false; } } else { jQuery('#jform_php_router_parse').closest('.control-group').hide(); // remove required attribute from php_router_parse field - if (!jform_vvvvwaevzv_required) + if (!jform_vvvvwbcvxc_required) { updateFieldRequired('php_router_parse',1); jQuery('#jform_php_router_parse').removeAttr('required'); jQuery('#jform_php_router_parse').removeAttr('aria-required'); jQuery('#jform_php_router_parse').removeClass('required'); - jform_vvvvwaevzv_required = true; + jform_vvvvwbcvxc_required = true; } } } -// the vvvvwae Some function -function gettype_vvvvwae_SomeFunc(gettype_vvvvwae) +// the vvvvwbc Some function +function gettype_vvvvwbc_SomeFunc(gettype_vvvvwbc) { // set the function logic - if (gettype_vvvvwae == 1 || gettype_vvvvwae == 2) + if (gettype_vvvvwbc == 1 || gettype_vvvvwbc == 2) { return true; } return false; } -// the vvvvwae Some function -function add_php_router_parse_vvvvwae_SomeFunc(add_php_router_parse_vvvvwae) +// the vvvvwbc Some function +function add_php_router_parse_vvvvwbc_SomeFunc(add_php_router_parse_vvvvwbc) { // set the function logic - if (add_php_router_parse_vvvvwae == 1) + if (add_php_router_parse_vvvvwbc == 1) { return true; } return false; } -// the vvvvwag function -function vvvvwag(gettype_vvvvwag) +// the vvvvwbe function +function vvvvwbe(gettype_vvvvwbe) { - if (isSet(gettype_vvvvwag) && gettype_vvvvwag.constructor !== Array) + if (isSet(gettype_vvvvwbe) && gettype_vvvvwbe.constructor !== Array) { - var temp_vvvvwag = gettype_vvvvwag; - var gettype_vvvvwag = []; - gettype_vvvvwag.push(temp_vvvvwag); + var temp_vvvvwbe = gettype_vvvvwbe; + var gettype_vvvvwbe = []; + gettype_vvvvwbe.push(temp_vvvvwbe); } - else if (!isSet(gettype_vvvvwag)) + else if (!isSet(gettype_vvvvwbe)) { - var gettype_vvvvwag = []; + var gettype_vvvvwbe = []; } - var gettype = gettype_vvvvwag.some(gettype_vvvvwag_SomeFunc); + var gettype = gettype_vvvvwbe.some(gettype_vvvvwbe_SomeFunc); // set this function logic @@ -1471,11 +1338,11 @@ function vvvvwag(gettype_vvvvwag) } } -// the vvvvwag Some function -function gettype_vvvvwag_SomeFunc(gettype_vvvvwag) +// the vvvvwbe Some function +function gettype_vvvvwbe_SomeFunc(gettype_vvvvwbe) { // set the function logic - if (gettype_vvvvwag == 1) + if (gettype_vvvvwbe == 1) { return true; } @@ -1560,10 +1427,10 @@ function setSelectAll(select_all){ } function getViewTableColumns_server(viewId,asKey,rowType){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.viewTableColumns&format=json&raw=true"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.viewTableColumns&format=json&raw=true"); if (token.length > 0 && viewId > 0 && asKey.length > 0) { - var request = 'token='+token+'&as='+asKey+'&type='+rowType+'&id='+viewId; + var request = token+'=1&as='+asKey+'&type='+rowType+'&id='+viewId; } return jQuery.ajax({ type: 'GET', @@ -1598,10 +1465,10 @@ function getViewTableColumns(id, asKey, key, rowType, main, table_, nr_){ function getDbTableColumns_server(name,asKey,rowType) { - var getUrl = "index.php?option=com_componentbuilder&task=ajax.dbTableColumns&format=json&raw=true"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.dbTableColumns&format=json&raw=true"); if (token.length > 0 && name.length > 0 && asKey.length > 0) { - var request = 'token='+token+'&as='+asKey+'&type='+rowType+'&name='+name; + var request = token+'=1&as='+asKey+'&type='+rowType+'&name='+name; } return jQuery.ajax({ type: 'GET', @@ -1696,9 +1563,9 @@ function updateSubItems(fieldName, fieldNr, table_, nr_) { } function getDynamicScripts_server(typpe){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getDynamicScripts&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicScripts&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && typpe.length > 0){ - var request = 'token='+token+'&type='+typpe; + var request = token+'=1&type='+typpe; } return jQuery.ajax({ type: 'GET', @@ -1725,9 +1592,9 @@ function getDynamicScripts(id){ } function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', @@ -1764,9 +1631,9 @@ function isObject(obj) { } function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type > 0){ - var request = 'token='+token+'&type='+type; + var request = token+'=1&type='+type; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/dynamic_get.xml b/admin/models/forms/dynamic_get.xml index 3edb290cd..bcaeadfd3 100644 --- a/admin/models/forms/dynamic_get.xml +++ b/admin/models/forms/dynamic_get.xml @@ -281,7 +281,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -867,7 +866,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -900,7 +898,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -932,7 +929,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -955,7 +951,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1086,7 +1081,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1271,7 +1265,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> diff --git a/admin/models/forms/field.js b/admin/models/forms/field.js index 8791d8d4f..2da271b04 100644 --- a/admin/models/forms/field.js +++ b/admin/models/forms/field.js @@ -9,61 +9,57 @@ */ // Some Global Values -jform_vvvvwatwac_required = false; -jform_vvvvwauwad_required = false; -jform_vvvvwavwae_required = false; -jform_vvvvwawwaf_required = false; -jform_vvvvwazwag_required = false; -jform_vvvvwbawah_required = false; -jform_vvvvwbbwai_required = false; -jform_vvvvwbcwaj_required = false; +jform_vvvvwbtvxl_required = false; +jform_vvvvwbuvxm_required = false; +jform_vvvvwbvvxn_required = false; +jform_vvvvwbwvxo_required = false; // Initial Script jQuery(document).ready(function() { - var datalenght_vvvvwat = jQuery("#jform_datalenght").val(); - vvvvwat(datalenght_vvvvwat); + var datalenght_vvvvwbt = jQuery("#jform_datalenght").val(); + vvvvwbt(datalenght_vvvvwbt); - var datadefault_vvvvwau = jQuery("#jform_datadefault").val(); - vvvvwau(datadefault_vvvvwau); + var datadefault_vvvvwbu = jQuery("#jform_datadefault").val(); + vvvvwbu(datadefault_vvvvwbu); - var datatype_vvvvwav = jQuery("#jform_datatype").val(); - vvvvwav(datatype_vvvvwav); + var datatype_vvvvwbv = jQuery("#jform_datatype").val(); + vvvvwbv(datatype_vvvvwbv); - var datatype_vvvvwaw = jQuery("#jform_datatype").val(); - vvvvwaw(datatype_vvvvwaw); + var datatype_vvvvwbw = jQuery("#jform_datatype").val(); + vvvvwbw(datatype_vvvvwbw); - var store_vvvvwax = jQuery("#jform_store").val(); - var datatype_vvvvwax = jQuery("#jform_datatype").val(); - vvvvwax(store_vvvvwax,datatype_vvvvwax); + var store_vvvvwbx = jQuery("#jform_store").val(); + var datatype_vvvvwbx = jQuery("#jform_datatype").val(); + vvvvwbx(store_vvvvwbx,datatype_vvvvwbx); - var add_css_view_vvvvwaz = jQuery("#jform_add_css_view input[type='radio']:checked").val(); - vvvvwaz(add_css_view_vvvvwaz); + var add_css_view_vvvvwbz = jQuery("#jform_add_css_view input[type='radio']:checked").val(); + vvvvwbz(add_css_view_vvvvwbz); - var add_css_views_vvvvwba = jQuery("#jform_add_css_views input[type='radio']:checked").val(); - vvvvwba(add_css_views_vvvvwba); + var add_css_views_vvvvwca = jQuery("#jform_add_css_views input[type='radio']:checked").val(); + vvvvwca(add_css_views_vvvvwca); - var add_javascript_view_footer_vvvvwbb = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val(); - vvvvwbb(add_javascript_view_footer_vvvvwbb); + var add_javascript_view_footer_vvvvwcb = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val(); + vvvvwcb(add_javascript_view_footer_vvvvwcb); - var add_javascript_views_footer_vvvvwbc = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val(); - vvvvwbc(add_javascript_views_footer_vvvvwbc); + var add_javascript_views_footer_vvvvwcc = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val(); + vvvvwcc(add_javascript_views_footer_vvvvwcc); }); -// the vvvvwat function -function vvvvwat(datalenght_vvvvwat) +// the vvvvwbt function +function vvvvwbt(datalenght_vvvvwbt) { - if (isSet(datalenght_vvvvwat) && datalenght_vvvvwat.constructor !== Array) + if (isSet(datalenght_vvvvwbt) && datalenght_vvvvwbt.constructor !== Array) { - var temp_vvvvwat = datalenght_vvvvwat; - var datalenght_vvvvwat = []; - datalenght_vvvvwat.push(temp_vvvvwat); + var temp_vvvvwbt = datalenght_vvvvwbt; + var datalenght_vvvvwbt = []; + datalenght_vvvvwbt.push(temp_vvvvwbt); } - else if (!isSet(datalenght_vvvvwat)) + else if (!isSet(datalenght_vvvvwbt)) { - var datalenght_vvvvwat = []; + var datalenght_vvvvwbt = []; } - var datalenght = datalenght_vvvvwat.some(datalenght_vvvvwat_SomeFunc); + var datalenght = datalenght_vvvvwbt.some(datalenght_vvvvwbt_SomeFunc); // set this function logic @@ -71,55 +67,55 @@ function vvvvwat(datalenght_vvvvwat) { jQuery('#jform_datalenght_other').closest('.control-group').show(); // add required attribute to datalenght_other field - if (jform_vvvvwatwac_required) + if (jform_vvvvwbtvxl_required) { updateFieldRequired('datalenght_other',0); jQuery('#jform_datalenght_other').prop('required','required'); jQuery('#jform_datalenght_other').attr('aria-required',true); jQuery('#jform_datalenght_other').addClass('required'); - jform_vvvvwatwac_required = false; + jform_vvvvwbtvxl_required = false; } } else { jQuery('#jform_datalenght_other').closest('.control-group').hide(); // remove required attribute from datalenght_other field - if (!jform_vvvvwatwac_required) + if (!jform_vvvvwbtvxl_required) { updateFieldRequired('datalenght_other',1); jQuery('#jform_datalenght_other').removeAttr('required'); jQuery('#jform_datalenght_other').removeAttr('aria-required'); jQuery('#jform_datalenght_other').removeClass('required'); - jform_vvvvwatwac_required = true; + jform_vvvvwbtvxl_required = true; } } } -// the vvvvwat Some function -function datalenght_vvvvwat_SomeFunc(datalenght_vvvvwat) +// the vvvvwbt Some function +function datalenght_vvvvwbt_SomeFunc(datalenght_vvvvwbt) { // set the function logic - if (datalenght_vvvvwat == 'Other') + if (datalenght_vvvvwbt == 'Other') { return true; } return false; } -// the vvvvwau function -function vvvvwau(datadefault_vvvvwau) +// the vvvvwbu function +function vvvvwbu(datadefault_vvvvwbu) { - if (isSet(datadefault_vvvvwau) && datadefault_vvvvwau.constructor !== Array) + if (isSet(datadefault_vvvvwbu) && datadefault_vvvvwbu.constructor !== Array) { - var temp_vvvvwau = datadefault_vvvvwau; - var datadefault_vvvvwau = []; - datadefault_vvvvwau.push(temp_vvvvwau); + var temp_vvvvwbu = datadefault_vvvvwbu; + var datadefault_vvvvwbu = []; + datadefault_vvvvwbu.push(temp_vvvvwbu); } - else if (!isSet(datadefault_vvvvwau)) + else if (!isSet(datadefault_vvvvwbu)) { - var datadefault_vvvvwau = []; + var datadefault_vvvvwbu = []; } - var datadefault = datadefault_vvvvwau.some(datadefault_vvvvwau_SomeFunc); + var datadefault = datadefault_vvvvwbu.some(datadefault_vvvvwbu_SomeFunc); // set this function logic @@ -127,55 +123,55 @@ function vvvvwau(datadefault_vvvvwau) { jQuery('#jform_datadefault_other').closest('.control-group').show(); // add required attribute to datadefault_other field - if (jform_vvvvwauwad_required) + if (jform_vvvvwbuvxm_required) { updateFieldRequired('datadefault_other',0); jQuery('#jform_datadefault_other').prop('required','required'); jQuery('#jform_datadefault_other').attr('aria-required',true); jQuery('#jform_datadefault_other').addClass('required'); - jform_vvvvwauwad_required = false; + jform_vvvvwbuvxm_required = false; } } else { jQuery('#jform_datadefault_other').closest('.control-group').hide(); // remove required attribute from datadefault_other field - if (!jform_vvvvwauwad_required) + if (!jform_vvvvwbuvxm_required) { updateFieldRequired('datadefault_other',1); jQuery('#jform_datadefault_other').removeAttr('required'); jQuery('#jform_datadefault_other').removeAttr('aria-required'); jQuery('#jform_datadefault_other').removeClass('required'); - jform_vvvvwauwad_required = true; + jform_vvvvwbuvxm_required = true; } } } -// the vvvvwau Some function -function datadefault_vvvvwau_SomeFunc(datadefault_vvvvwau) +// the vvvvwbu Some function +function datadefault_vvvvwbu_SomeFunc(datadefault_vvvvwbu) { // set the function logic - if (datadefault_vvvvwau == 'Other') + if (datadefault_vvvvwbu == 'Other') { return true; } return false; } -// the vvvvwav function -function vvvvwav(datatype_vvvvwav) +// the vvvvwbv function +function vvvvwbv(datatype_vvvvwbv) { - if (isSet(datatype_vvvvwav) && datatype_vvvvwav.constructor !== Array) + if (isSet(datatype_vvvvwbv) && datatype_vvvvwbv.constructor !== Array) { - var temp_vvvvwav = datatype_vvvvwav; - var datatype_vvvvwav = []; - datatype_vvvvwav.push(temp_vvvvwav); + var temp_vvvvwbv = datatype_vvvvwbv; + var datatype_vvvvwbv = []; + datatype_vvvvwbv.push(temp_vvvvwbv); } - else if (!isSet(datatype_vvvvwav)) + else if (!isSet(datatype_vvvvwbv)) { - var datatype_vvvvwav = []; + var datatype_vvvvwbv = []; } - var datatype = datatype_vvvvwav.some(datatype_vvvvwav_SomeFunc); + var datatype = datatype_vvvvwbv.some(datatype_vvvvwbv_SomeFunc); // set this function logic @@ -185,13 +181,13 @@ function vvvvwav(datatype_vvvvwav) jQuery('#jform_datalenght').closest('.control-group').show(); jQuery('#jform_indexes').closest('.control-group').show(); // add required attribute to indexes field - if (jform_vvvvwavwae_required) + if (jform_vvvvwbvvxn_required) { updateFieldRequired('indexes',0); jQuery('#jform_indexes').prop('required','required'); jQuery('#jform_indexes').attr('aria-required',true); jQuery('#jform_indexes').addClass('required'); - jform_vvvvwavwae_required = false; + jform_vvvvwbvvxn_required = false; } } else @@ -200,42 +196,42 @@ function vvvvwav(datatype_vvvvwav) jQuery('#jform_datalenght').closest('.control-group').hide(); jQuery('#jform_indexes').closest('.control-group').hide(); // remove required attribute from indexes field - if (!jform_vvvvwavwae_required) + if (!jform_vvvvwbvvxn_required) { updateFieldRequired('indexes',1); jQuery('#jform_indexes').removeAttr('required'); jQuery('#jform_indexes').removeAttr('aria-required'); jQuery('#jform_indexes').removeClass('required'); - jform_vvvvwavwae_required = true; + jform_vvvvwbvvxn_required = true; } } } -// the vvvvwav Some function -function datatype_vvvvwav_SomeFunc(datatype_vvvvwav) +// the vvvvwbv Some function +function datatype_vvvvwbv_SomeFunc(datatype_vvvvwbv) { // set the function logic - if (datatype_vvvvwav == 'CHAR' || datatype_vvvvwav == 'VARCHAR' || datatype_vvvvwav == 'DATETIME' || datatype_vvvvwav == 'DATE' || datatype_vvvvwav == 'TIME' || datatype_vvvvwav == 'INT' || datatype_vvvvwav == 'TINYINT' || datatype_vvvvwav == 'BIGINT' || datatype_vvvvwav == 'FLOAT' || datatype_vvvvwav == 'DECIMAL' || datatype_vvvvwav == 'DOUBLE') + if (datatype_vvvvwbv == 'CHAR' || datatype_vvvvwbv == 'VARCHAR' || datatype_vvvvwbv == 'DATETIME' || datatype_vvvvwbv == 'DATE' || datatype_vvvvwbv == 'TIME' || datatype_vvvvwbv == 'INT' || datatype_vvvvwbv == 'TINYINT' || datatype_vvvvwbv == 'BIGINT' || datatype_vvvvwbv == 'FLOAT' || datatype_vvvvwbv == 'DECIMAL' || datatype_vvvvwbv == 'DOUBLE') { return true; } return false; } -// the vvvvwaw function -function vvvvwaw(datatype_vvvvwaw) +// the vvvvwbw function +function vvvvwbw(datatype_vvvvwbw) { - if (isSet(datatype_vvvvwaw) && datatype_vvvvwaw.constructor !== Array) + if (isSet(datatype_vvvvwbw) && datatype_vvvvwbw.constructor !== Array) { - var temp_vvvvwaw = datatype_vvvvwaw; - var datatype_vvvvwaw = []; - datatype_vvvvwaw.push(temp_vvvvwaw); + var temp_vvvvwbw = datatype_vvvvwbw; + var datatype_vvvvwbw = []; + datatype_vvvvwbw.push(temp_vvvvwbw); } - else if (!isSet(datatype_vvvvwaw)) + else if (!isSet(datatype_vvvvwbw)) { - var datatype_vvvvwaw = []; + var datatype_vvvvwbw = []; } - var datatype = datatype_vvvvwaw.some(datatype_vvvvwaw_SomeFunc); + var datatype = datatype_vvvvwbw.some(datatype_vvvvwbw_SomeFunc); // set this function logic @@ -243,67 +239,67 @@ function vvvvwaw(datatype_vvvvwaw) { jQuery('#jform_store').closest('.control-group').show(); // add required attribute to store field - if (jform_vvvvwawwaf_required) + if (jform_vvvvwbwvxo_required) { updateFieldRequired('store',0); jQuery('#jform_store').prop('required','required'); jQuery('#jform_store').attr('aria-required',true); jQuery('#jform_store').addClass('required'); - jform_vvvvwawwaf_required = false; + jform_vvvvwbwvxo_required = false; } } else { jQuery('#jform_store').closest('.control-group').hide(); // remove required attribute from store field - if (!jform_vvvvwawwaf_required) + if (!jform_vvvvwbwvxo_required) { updateFieldRequired('store',1); jQuery('#jform_store').removeAttr('required'); jQuery('#jform_store').removeAttr('aria-required'); jQuery('#jform_store').removeClass('required'); - jform_vvvvwawwaf_required = true; + jform_vvvvwbwvxo_required = true; } } } -// the vvvvwaw Some function -function datatype_vvvvwaw_SomeFunc(datatype_vvvvwaw) +// the vvvvwbw Some function +function datatype_vvvvwbw_SomeFunc(datatype_vvvvwbw) { // set the function logic - if (datatype_vvvvwaw == 'CHAR' || datatype_vvvvwaw == 'VARCHAR' || datatype_vvvvwaw == 'TEXT' || datatype_vvvvwaw == 'MEDIUMTEXT' || datatype_vvvvwaw == 'LONGTEXT' || datatype_vvvvwaw == 'BLOB' || datatype_vvvvwaw == 'TINYBLOB' || datatype_vvvvwaw == 'MEDIUMBLOB' || datatype_vvvvwaw == 'LONGBLOB') + if (datatype_vvvvwbw == 'CHAR' || datatype_vvvvwbw == 'VARCHAR' || datatype_vvvvwbw == 'TEXT' || datatype_vvvvwbw == 'MEDIUMTEXT' || datatype_vvvvwbw == 'LONGTEXT' || datatype_vvvvwbw == 'BLOB' || datatype_vvvvwbw == 'TINYBLOB' || datatype_vvvvwbw == 'MEDIUMBLOB' || datatype_vvvvwbw == 'LONGBLOB') { return true; } return false; } -// the vvvvwax function -function vvvvwax(store_vvvvwax,datatype_vvvvwax) +// the vvvvwbx function +function vvvvwbx(store_vvvvwbx,datatype_vvvvwbx) { - if (isSet(store_vvvvwax) && store_vvvvwax.constructor !== Array) + if (isSet(store_vvvvwbx) && store_vvvvwbx.constructor !== Array) { - var temp_vvvvwax = store_vvvvwax; - var store_vvvvwax = []; - store_vvvvwax.push(temp_vvvvwax); + var temp_vvvvwbx = store_vvvvwbx; + var store_vvvvwbx = []; + store_vvvvwbx.push(temp_vvvvwbx); } - else if (!isSet(store_vvvvwax)) + else if (!isSet(store_vvvvwbx)) { - var store_vvvvwax = []; + var store_vvvvwbx = []; } - var store = store_vvvvwax.some(store_vvvvwax_SomeFunc); + var store = store_vvvvwbx.some(store_vvvvwbx_SomeFunc); - if (isSet(datatype_vvvvwax) && datatype_vvvvwax.constructor !== Array) + if (isSet(datatype_vvvvwbx) && datatype_vvvvwbx.constructor !== Array) { - var temp_vvvvwax = datatype_vvvvwax; - var datatype_vvvvwax = []; - datatype_vvvvwax.push(temp_vvvvwax); + var temp_vvvvwbx = datatype_vvvvwbx; + var datatype_vvvvwbx = []; + datatype_vvvvwbx.push(temp_vvvvwbx); } - else if (!isSet(datatype_vvvvwax)) + else if (!isSet(datatype_vvvvwbx)) { - var datatype_vvvvwax = []; + var datatype_vvvvwbx = []; } - var datatype = datatype_vvvvwax.some(datatype_vvvvwax_SomeFunc); + var datatype = datatype_vvvvwbx.some(datatype_vvvvwbx_SomeFunc); // set this function logic @@ -317,153 +313,81 @@ function vvvvwax(store_vvvvwax,datatype_vvvvwax) } } -// the vvvvwax Some function -function store_vvvvwax_SomeFunc(store_vvvvwax) +// the vvvvwbx Some function +function store_vvvvwbx_SomeFunc(store_vvvvwbx) { // set the function logic - if (store_vvvvwax == 4) + if (store_vvvvwbx == 4) { return true; } return false; } -// the vvvvwax Some function -function datatype_vvvvwax_SomeFunc(datatype_vvvvwax) +// the vvvvwbx Some function +function datatype_vvvvwbx_SomeFunc(datatype_vvvvwbx) { // set the function logic - if (datatype_vvvvwax == 'CHAR' || datatype_vvvvwax == 'VARCHAR' || datatype_vvvvwax == 'TEXT' || datatype_vvvvwax == 'MEDIUMTEXT' || datatype_vvvvwax == 'LONGTEXT' || datatype_vvvvwax == 'BLOB' || datatype_vvvvwax == 'TINYBLOB' || datatype_vvvvwax == 'MEDIUMBLOB' || datatype_vvvvwax == 'LONGBLOB') + if (datatype_vvvvwbx == 'CHAR' || datatype_vvvvwbx == 'VARCHAR' || datatype_vvvvwbx == 'TEXT' || datatype_vvvvwbx == 'MEDIUMTEXT' || datatype_vvvvwbx == 'LONGTEXT' || datatype_vvvvwbx == 'BLOB' || datatype_vvvvwbx == 'TINYBLOB' || datatype_vvvvwbx == 'MEDIUMBLOB' || datatype_vvvvwbx == 'LONGBLOB') { return true; } return false; } -// the vvvvwaz function -function vvvvwaz(add_css_view_vvvvwaz) +// the vvvvwbz function +function vvvvwbz(add_css_view_vvvvwbz) { // set the function logic - if (add_css_view_vvvvwaz == 1) + if (add_css_view_vvvvwbz == 1) { jQuery('#jform_css_view-lbl').closest('.control-group').show(); - // add required attribute to css_view field - if (jform_vvvvwazwag_required) - { - updateFieldRequired('css_view',0); - jQuery('#jform_css_view').prop('required','required'); - jQuery('#jform_css_view').attr('aria-required',true); - jQuery('#jform_css_view').addClass('required'); - jform_vvvvwazwag_required = false; - } } else { jQuery('#jform_css_view-lbl').closest('.control-group').hide(); - // remove required attribute from css_view field - if (!jform_vvvvwazwag_required) - { - updateFieldRequired('css_view',1); - jQuery('#jform_css_view').removeAttr('required'); - jQuery('#jform_css_view').removeAttr('aria-required'); - jQuery('#jform_css_view').removeClass('required'); - jform_vvvvwazwag_required = true; - } } } -// the vvvvwba function -function vvvvwba(add_css_views_vvvvwba) +// the vvvvwca function +function vvvvwca(add_css_views_vvvvwca) { // set the function logic - if (add_css_views_vvvvwba == 1) + if (add_css_views_vvvvwca == 1) { jQuery('#jform_css_views-lbl').closest('.control-group').show(); - // add required attribute to css_views field - if (jform_vvvvwbawah_required) - { - updateFieldRequired('css_views',0); - jQuery('#jform_css_views').prop('required','required'); - jQuery('#jform_css_views').attr('aria-required',true); - jQuery('#jform_css_views').addClass('required'); - jform_vvvvwbawah_required = false; - } } else { jQuery('#jform_css_views-lbl').closest('.control-group').hide(); - // remove required attribute from css_views field - if (!jform_vvvvwbawah_required) - { - updateFieldRequired('css_views',1); - jQuery('#jform_css_views').removeAttr('required'); - jQuery('#jform_css_views').removeAttr('aria-required'); - jQuery('#jform_css_views').removeClass('required'); - jform_vvvvwbawah_required = true; - } } } -// the vvvvwbb function -function vvvvwbb(add_javascript_view_footer_vvvvwbb) +// the vvvvwcb function +function vvvvwcb(add_javascript_view_footer_vvvvwcb) { // set the function logic - if (add_javascript_view_footer_vvvvwbb == 1) + if (add_javascript_view_footer_vvvvwcb == 1) { jQuery('#jform_javascript_view_footer-lbl').closest('.control-group').show(); - // add required attribute to javascript_view_footer field - if (jform_vvvvwbbwai_required) - { - updateFieldRequired('javascript_view_footer',0); - jQuery('#jform_javascript_view_footer').prop('required','required'); - jQuery('#jform_javascript_view_footer').attr('aria-required',true); - jQuery('#jform_javascript_view_footer').addClass('required'); - jform_vvvvwbbwai_required = false; - } } else { jQuery('#jform_javascript_view_footer-lbl').closest('.control-group').hide(); - // remove required attribute from javascript_view_footer field - if (!jform_vvvvwbbwai_required) - { - updateFieldRequired('javascript_view_footer',1); - jQuery('#jform_javascript_view_footer').removeAttr('required'); - jQuery('#jform_javascript_view_footer').removeAttr('aria-required'); - jQuery('#jform_javascript_view_footer').removeClass('required'); - jform_vvvvwbbwai_required = true; - } } } -// the vvvvwbc function -function vvvvwbc(add_javascript_views_footer_vvvvwbc) +// the vvvvwcc function +function vvvvwcc(add_javascript_views_footer_vvvvwcc) { // set the function logic - if (add_javascript_views_footer_vvvvwbc == 1) + if (add_javascript_views_footer_vvvvwcc == 1) { jQuery('#jform_javascript_views_footer-lbl').closest('.control-group').show(); - // add required attribute to javascript_views_footer field - if (jform_vvvvwbcwaj_required) - { - updateFieldRequired('javascript_views_footer',0); - jQuery('#jform_javascript_views_footer').prop('required','required'); - jQuery('#jform_javascript_views_footer').attr('aria-required',true); - jQuery('#jform_javascript_views_footer').addClass('required'); - jform_vvvvwbcwaj_required = false; - } } else { jQuery('#jform_javascript_views_footer-lbl').closest('.control-group').hide(); - // remove required attribute from javascript_views_footer field - if (!jform_vvvvwbcwaj_required) - { - updateFieldRequired('javascript_views_footer',1); - jQuery('#jform_javascript_views_footer').removeAttr('required'); - jQuery('#jform_javascript_views_footer').removeAttr('aria-required'); - jQuery('#jform_javascript_views_footer').removeClass('required'); - jform_vvvvwbcwaj_required = true; - } } } @@ -527,9 +451,9 @@ jQuery(document).ready(function() var rowIdKey = 'properties'; function getFieldOptions_server(fieldtype){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldOptions&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.fieldOptions&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && fieldtype > 0){ - var request = 'token='+token+'&id='+fieldtype; + var request = token+'=1&id='+fieldtype; } return jQuery.ajax({ type: 'GET', @@ -721,9 +645,9 @@ function propertyIsSet(prop, id, targetForm) { } function getFieldPropertyDesc_server(fieldtype, property){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getFieldPropertyDesc&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getFieldPropertyDesc&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && (fieldtype > 0 || fieldtype.length > 0)&& property.length > 0){ - var request = 'token='+token+'&fieldtype='+fieldtype+'&property='+property; + var request = token+'=1&fieldtype='+fieldtype+'&property='+property; } return jQuery.ajax({ type: 'GET', @@ -736,9 +660,9 @@ function getFieldPropertyDesc_server(fieldtype, property){ function getValidationRulesTable_server(){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getValidationRulesTable&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getValidationRulesTable&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0){ - var request = 'token='+token+'&id=1'; + var request = token+'=1&id=1'; } return jQuery.ajax({ type: 'GET', @@ -805,9 +729,9 @@ function dbChecker(type){ } function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type > 0){ - var request = 'token='+token+'&type='+type; + var request = token+'=1&type='+type; } return jQuery.ajax({ type: 'GET', @@ -829,7 +753,7 @@ function getLinked(){ function addButton_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type='+type+'&size='+size; + var request = token+'=1&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -854,9 +778,9 @@ function addButton(type, where, size){ } function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/field.xml b/admin/models/forms/field.xml index 24b41e53b..05f4c885c 100644 --- a/admin/models/forms/field.xml +++ b/admin/models/forms/field.xml @@ -244,7 +244,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -275,7 +274,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -432,7 +430,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -451,7 +448,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> diff --git a/admin/models/forms/fieldtype.js b/admin/models/forms/fieldtype.js index 1c20f92c3..3dcab48f6 100644 --- a/admin/models/forms/fieldtype.js +++ b/admin/models/forms/fieldtype.js @@ -9,82 +9,82 @@ */ // Some Global Values -jform_vvvvwbdwak_required = false; -jform_vvvvwbfwal_required = false; -jform_vvvvwbhwam_required = false; -jform_vvvvwbiwan_required = false; -jform_vvvvwbjwao_required = false; -jform_vvvvwbowap_required = false; -jform_vvvvwbowaq_required = false; +jform_vvvvwcdvxp_required = false; +jform_vvvvwcfvxq_required = false; +jform_vvvvwchvxr_required = false; +jform_vvvvwcivxs_required = false; +jform_vvvvwcjvxt_required = false; +jform_vvvvwcovxu_required = false; +jform_vvvvwcovxv_required = false; // Initial Script jQuery(document).ready(function() { - var datalenght_vvvvwbd = jQuery("#jform_datalenght").val(); - var has_defaults_vvvvwbd = jQuery("#jform_has_defaults input[type='radio']:checked").val(); - vvvvwbd(datalenght_vvvvwbd,has_defaults_vvvvwbd); + var datalenght_vvvvwcd = jQuery("#jform_datalenght").val(); + var has_defaults_vvvvwcd = jQuery("#jform_has_defaults input[type='radio']:checked").val(); + vvvvwcd(datalenght_vvvvwcd,has_defaults_vvvvwcd); - var datadefault_vvvvwbf = jQuery("#jform_datadefault").val(); - var has_defaults_vvvvwbf = jQuery("#jform_has_defaults input[type='radio']:checked").val(); - vvvvwbf(datadefault_vvvvwbf,has_defaults_vvvvwbf); + var datadefault_vvvvwcf = jQuery("#jform_datadefault").val(); + var has_defaults_vvvvwcf = jQuery("#jform_has_defaults input[type='radio']:checked").val(); + vvvvwcf(datadefault_vvvvwcf,has_defaults_vvvvwcf); - var datatype_vvvvwbh = jQuery("#jform_datatype").val(); - var has_defaults_vvvvwbh = jQuery("#jform_has_defaults input[type='radio']:checked").val(); - vvvvwbh(datatype_vvvvwbh,has_defaults_vvvvwbh); + var datatype_vvvvwch = jQuery("#jform_datatype").val(); + var has_defaults_vvvvwch = jQuery("#jform_has_defaults input[type='radio']:checked").val(); + vvvvwch(datatype_vvvvwch,has_defaults_vvvvwch); - var has_defaults_vvvvwbi = jQuery("#jform_has_defaults input[type='radio']:checked").val(); - var datatype_vvvvwbi = jQuery("#jform_datatype").val(); - vvvvwbi(has_defaults_vvvvwbi,datatype_vvvvwbi); + var has_defaults_vvvvwci = jQuery("#jform_has_defaults input[type='radio']:checked").val(); + var datatype_vvvvwci = jQuery("#jform_datatype").val(); + vvvvwci(has_defaults_vvvvwci,datatype_vvvvwci); - var datatype_vvvvwbj = jQuery("#jform_datatype").val(); - var has_defaults_vvvvwbj = jQuery("#jform_has_defaults input[type='radio']:checked").val(); - vvvvwbj(datatype_vvvvwbj,has_defaults_vvvvwbj); + var datatype_vvvvwcj = jQuery("#jform_datatype").val(); + var has_defaults_vvvvwcj = jQuery("#jform_has_defaults input[type='radio']:checked").val(); + vvvvwcj(datatype_vvvvwcj,has_defaults_vvvvwcj); - var store_vvvvwbl = jQuery("#jform_store").val(); - var datatype_vvvvwbl = jQuery("#jform_datatype").val(); - var has_defaults_vvvvwbl = jQuery("#jform_has_defaults input[type='radio']:checked").val(); - vvvvwbl(store_vvvvwbl,datatype_vvvvwbl,has_defaults_vvvvwbl); + var store_vvvvwcl = jQuery("#jform_store").val(); + var datatype_vvvvwcl = jQuery("#jform_datatype").val(); + var has_defaults_vvvvwcl = jQuery("#jform_has_defaults input[type='radio']:checked").val(); + vvvvwcl(store_vvvvwcl,datatype_vvvvwcl,has_defaults_vvvvwcl); - var datatype_vvvvwbm = jQuery("#jform_datatype").val(); - var store_vvvvwbm = jQuery("#jform_store").val(); - var has_defaults_vvvvwbm = jQuery("#jform_has_defaults input[type='radio']:checked").val(); - vvvvwbm(datatype_vvvvwbm,store_vvvvwbm,has_defaults_vvvvwbm); + var datatype_vvvvwcm = jQuery("#jform_datatype").val(); + var store_vvvvwcm = jQuery("#jform_store").val(); + var has_defaults_vvvvwcm = jQuery("#jform_has_defaults input[type='radio']:checked").val(); + vvvvwcm(datatype_vvvvwcm,store_vvvvwcm,has_defaults_vvvvwcm); - var has_defaults_vvvvwbn = jQuery("#jform_has_defaults input[type='radio']:checked").val(); - var store_vvvvwbn = jQuery("#jform_store").val(); - var datatype_vvvvwbn = jQuery("#jform_datatype").val(); - vvvvwbn(has_defaults_vvvvwbn,store_vvvvwbn,datatype_vvvvwbn); + var has_defaults_vvvvwcn = jQuery("#jform_has_defaults input[type='radio']:checked").val(); + var store_vvvvwcn = jQuery("#jform_store").val(); + var datatype_vvvvwcn = jQuery("#jform_datatype").val(); + vvvvwcn(has_defaults_vvvvwcn,store_vvvvwcn,datatype_vvvvwcn); - var has_defaults_vvvvwbo = jQuery("#jform_has_defaults input[type='radio']:checked").val(); - vvvvwbo(has_defaults_vvvvwbo); + var has_defaults_vvvvwco = jQuery("#jform_has_defaults input[type='radio']:checked").val(); + vvvvwco(has_defaults_vvvvwco); }); -// the vvvvwbd function -function vvvvwbd(datalenght_vvvvwbd,has_defaults_vvvvwbd) +// the vvvvwcd function +function vvvvwcd(datalenght_vvvvwcd,has_defaults_vvvvwcd) { - if (isSet(datalenght_vvvvwbd) && datalenght_vvvvwbd.constructor !== Array) + if (isSet(datalenght_vvvvwcd) && datalenght_vvvvwcd.constructor !== Array) { - var temp_vvvvwbd = datalenght_vvvvwbd; - var datalenght_vvvvwbd = []; - datalenght_vvvvwbd.push(temp_vvvvwbd); + var temp_vvvvwcd = datalenght_vvvvwcd; + var datalenght_vvvvwcd = []; + datalenght_vvvvwcd.push(temp_vvvvwcd); } - else if (!isSet(datalenght_vvvvwbd)) + else if (!isSet(datalenght_vvvvwcd)) { - var datalenght_vvvvwbd = []; + var datalenght_vvvvwcd = []; } - var datalenght = datalenght_vvvvwbd.some(datalenght_vvvvwbd_SomeFunc); + var datalenght = datalenght_vvvvwcd.some(datalenght_vvvvwcd_SomeFunc); - if (isSet(has_defaults_vvvvwbd) && has_defaults_vvvvwbd.constructor !== Array) + if (isSet(has_defaults_vvvvwcd) && has_defaults_vvvvwcd.constructor !== Array) { - var temp_vvvvwbd = has_defaults_vvvvwbd; - var has_defaults_vvvvwbd = []; - has_defaults_vvvvwbd.push(temp_vvvvwbd); + var temp_vvvvwcd = has_defaults_vvvvwcd; + var has_defaults_vvvvwcd = []; + has_defaults_vvvvwcd.push(temp_vvvvwcd); } - else if (!isSet(has_defaults_vvvvwbd)) + else if (!isSet(has_defaults_vvvvwcd)) { - var has_defaults_vvvvwbd = []; + var has_defaults_vvvvwcd = []; } - var has_defaults = has_defaults_vvvvwbd.some(has_defaults_vvvvwbd_SomeFunc); + var has_defaults = has_defaults_vvvvwcd.some(has_defaults_vvvvwcd_SomeFunc); // set this function logic @@ -92,78 +92,78 @@ function vvvvwbd(datalenght_vvvvwbd,has_defaults_vvvvwbd) { jQuery('#jform_datalenght_other').closest('.control-group').show(); // add required attribute to datalenght_other field - if (jform_vvvvwbdwak_required) + if (jform_vvvvwcdvxp_required) { updateFieldRequired('datalenght_other',0); jQuery('#jform_datalenght_other').prop('required','required'); jQuery('#jform_datalenght_other').attr('aria-required',true); jQuery('#jform_datalenght_other').addClass('required'); - jform_vvvvwbdwak_required = false; + jform_vvvvwcdvxp_required = false; } } else { jQuery('#jform_datalenght_other').closest('.control-group').hide(); // remove required attribute from datalenght_other field - if (!jform_vvvvwbdwak_required) + if (!jform_vvvvwcdvxp_required) { updateFieldRequired('datalenght_other',1); jQuery('#jform_datalenght_other').removeAttr('required'); jQuery('#jform_datalenght_other').removeAttr('aria-required'); jQuery('#jform_datalenght_other').removeClass('required'); - jform_vvvvwbdwak_required = true; + jform_vvvvwcdvxp_required = true; } } } -// the vvvvwbd Some function -function datalenght_vvvvwbd_SomeFunc(datalenght_vvvvwbd) +// the vvvvwcd Some function +function datalenght_vvvvwcd_SomeFunc(datalenght_vvvvwcd) { // set the function logic - if (datalenght_vvvvwbd == 'Other') + if (datalenght_vvvvwcd == 'Other') { return true; } return false; } -// the vvvvwbd Some function -function has_defaults_vvvvwbd_SomeFunc(has_defaults_vvvvwbd) +// the vvvvwcd Some function +function has_defaults_vvvvwcd_SomeFunc(has_defaults_vvvvwcd) { // set the function logic - if (has_defaults_vvvvwbd == 1) + if (has_defaults_vvvvwcd == 1) { return true; } return false; } -// the vvvvwbf function -function vvvvwbf(datadefault_vvvvwbf,has_defaults_vvvvwbf) +// the vvvvwcf function +function vvvvwcf(datadefault_vvvvwcf,has_defaults_vvvvwcf) { - if (isSet(datadefault_vvvvwbf) && datadefault_vvvvwbf.constructor !== Array) + if (isSet(datadefault_vvvvwcf) && datadefault_vvvvwcf.constructor !== Array) { - var temp_vvvvwbf = datadefault_vvvvwbf; - var datadefault_vvvvwbf = []; - datadefault_vvvvwbf.push(temp_vvvvwbf); + var temp_vvvvwcf = datadefault_vvvvwcf; + var datadefault_vvvvwcf = []; + datadefault_vvvvwcf.push(temp_vvvvwcf); } - else if (!isSet(datadefault_vvvvwbf)) + else if (!isSet(datadefault_vvvvwcf)) { - var datadefault_vvvvwbf = []; + var datadefault_vvvvwcf = []; } - var datadefault = datadefault_vvvvwbf.some(datadefault_vvvvwbf_SomeFunc); + var datadefault = datadefault_vvvvwcf.some(datadefault_vvvvwcf_SomeFunc); - if (isSet(has_defaults_vvvvwbf) && has_defaults_vvvvwbf.constructor !== Array) + if (isSet(has_defaults_vvvvwcf) && has_defaults_vvvvwcf.constructor !== Array) { - var temp_vvvvwbf = has_defaults_vvvvwbf; - var has_defaults_vvvvwbf = []; - has_defaults_vvvvwbf.push(temp_vvvvwbf); + var temp_vvvvwcf = has_defaults_vvvvwcf; + var has_defaults_vvvvwcf = []; + has_defaults_vvvvwcf.push(temp_vvvvwcf); } - else if (!isSet(has_defaults_vvvvwbf)) + else if (!isSet(has_defaults_vvvvwcf)) { - var has_defaults_vvvvwbf = []; + var has_defaults_vvvvwcf = []; } - var has_defaults = has_defaults_vvvvwbf.some(has_defaults_vvvvwbf_SomeFunc); + var has_defaults = has_defaults_vvvvwcf.some(has_defaults_vvvvwcf_SomeFunc); // set this function logic @@ -171,78 +171,78 @@ function vvvvwbf(datadefault_vvvvwbf,has_defaults_vvvvwbf) { jQuery('#jform_datadefault_other').closest('.control-group').show(); // add required attribute to datadefault_other field - if (jform_vvvvwbfwal_required) + if (jform_vvvvwcfvxq_required) { updateFieldRequired('datadefault_other',0); jQuery('#jform_datadefault_other').prop('required','required'); jQuery('#jform_datadefault_other').attr('aria-required',true); jQuery('#jform_datadefault_other').addClass('required'); - jform_vvvvwbfwal_required = false; + jform_vvvvwcfvxq_required = false; } } else { jQuery('#jform_datadefault_other').closest('.control-group').hide(); // remove required attribute from datadefault_other field - if (!jform_vvvvwbfwal_required) + if (!jform_vvvvwcfvxq_required) { updateFieldRequired('datadefault_other',1); jQuery('#jform_datadefault_other').removeAttr('required'); jQuery('#jform_datadefault_other').removeAttr('aria-required'); jQuery('#jform_datadefault_other').removeClass('required'); - jform_vvvvwbfwal_required = true; + jform_vvvvwcfvxq_required = true; } } } -// the vvvvwbf Some function -function datadefault_vvvvwbf_SomeFunc(datadefault_vvvvwbf) +// the vvvvwcf Some function +function datadefault_vvvvwcf_SomeFunc(datadefault_vvvvwcf) { // set the function logic - if (datadefault_vvvvwbf == 'Other') + if (datadefault_vvvvwcf == 'Other') { return true; } return false; } -// the vvvvwbf Some function -function has_defaults_vvvvwbf_SomeFunc(has_defaults_vvvvwbf) +// the vvvvwcf Some function +function has_defaults_vvvvwcf_SomeFunc(has_defaults_vvvvwcf) { // set the function logic - if (has_defaults_vvvvwbf == 1) + if (has_defaults_vvvvwcf == 1) { return true; } return false; } -// the vvvvwbh function -function vvvvwbh(datatype_vvvvwbh,has_defaults_vvvvwbh) +// the vvvvwch function +function vvvvwch(datatype_vvvvwch,has_defaults_vvvvwch) { - if (isSet(datatype_vvvvwbh) && datatype_vvvvwbh.constructor !== Array) + if (isSet(datatype_vvvvwch) && datatype_vvvvwch.constructor !== Array) { - var temp_vvvvwbh = datatype_vvvvwbh; - var datatype_vvvvwbh = []; - datatype_vvvvwbh.push(temp_vvvvwbh); + var temp_vvvvwch = datatype_vvvvwch; + var datatype_vvvvwch = []; + datatype_vvvvwch.push(temp_vvvvwch); } - else if (!isSet(datatype_vvvvwbh)) + else if (!isSet(datatype_vvvvwch)) { - var datatype_vvvvwbh = []; + var datatype_vvvvwch = []; } - var datatype = datatype_vvvvwbh.some(datatype_vvvvwbh_SomeFunc); + var datatype = datatype_vvvvwch.some(datatype_vvvvwch_SomeFunc); - if (isSet(has_defaults_vvvvwbh) && has_defaults_vvvvwbh.constructor !== Array) + if (isSet(has_defaults_vvvvwch) && has_defaults_vvvvwch.constructor !== Array) { - var temp_vvvvwbh = has_defaults_vvvvwbh; - var has_defaults_vvvvwbh = []; - has_defaults_vvvvwbh.push(temp_vvvvwbh); + var temp_vvvvwch = has_defaults_vvvvwch; + var has_defaults_vvvvwch = []; + has_defaults_vvvvwch.push(temp_vvvvwch); } - else if (!isSet(has_defaults_vvvvwbh)) + else if (!isSet(has_defaults_vvvvwch)) { - var has_defaults_vvvvwbh = []; + var has_defaults_vvvvwch = []; } - var has_defaults = has_defaults_vvvvwbh.some(has_defaults_vvvvwbh_SomeFunc); + var has_defaults = has_defaults_vvvvwch.some(has_defaults_vvvvwch_SomeFunc); // set this function logic @@ -252,13 +252,13 @@ function vvvvwbh(datatype_vvvvwbh,has_defaults_vvvvwbh) jQuery('#jform_datalenght').closest('.control-group').show(); jQuery('#jform_indexes').closest('.control-group').show(); // add required attribute to indexes field - if (jform_vvvvwbhwam_required) + if (jform_vvvvwchvxr_required) { updateFieldRequired('indexes',0); jQuery('#jform_indexes').prop('required','required'); jQuery('#jform_indexes').attr('aria-required',true); jQuery('#jform_indexes').addClass('required'); - jform_vvvvwbhwam_required = false; + jform_vvvvwchvxr_required = false; } } else @@ -267,65 +267,65 @@ function vvvvwbh(datatype_vvvvwbh,has_defaults_vvvvwbh) jQuery('#jform_datalenght').closest('.control-group').hide(); jQuery('#jform_indexes').closest('.control-group').hide(); // remove required attribute from indexes field - if (!jform_vvvvwbhwam_required) + if (!jform_vvvvwchvxr_required) { updateFieldRequired('indexes',1); jQuery('#jform_indexes').removeAttr('required'); jQuery('#jform_indexes').removeAttr('aria-required'); jQuery('#jform_indexes').removeClass('required'); - jform_vvvvwbhwam_required = true; + jform_vvvvwchvxr_required = true; } } } -// the vvvvwbh Some function -function datatype_vvvvwbh_SomeFunc(datatype_vvvvwbh) +// the vvvvwch Some function +function datatype_vvvvwch_SomeFunc(datatype_vvvvwch) { // set the function logic - if (datatype_vvvvwbh == 'CHAR' || datatype_vvvvwbh == 'VARCHAR' || datatype_vvvvwbh == 'DATETIME' || datatype_vvvvwbh == 'DATE' || datatype_vvvvwbh == 'TIME' || datatype_vvvvwbh == 'INT' || datatype_vvvvwbh == 'TINYINT' || datatype_vvvvwbh == 'BIGINT' || datatype_vvvvwbh == 'FLOAT' || datatype_vvvvwbh == 'DECIMAL' || datatype_vvvvwbh == 'DOUBLE') + if (datatype_vvvvwch == 'CHAR' || datatype_vvvvwch == 'VARCHAR' || datatype_vvvvwch == 'DATETIME' || datatype_vvvvwch == 'DATE' || datatype_vvvvwch == 'TIME' || datatype_vvvvwch == 'INT' || datatype_vvvvwch == 'TINYINT' || datatype_vvvvwch == 'BIGINT' || datatype_vvvvwch == 'FLOAT' || datatype_vvvvwch == 'DECIMAL' || datatype_vvvvwch == 'DOUBLE') { return true; } return false; } -// the vvvvwbh Some function -function has_defaults_vvvvwbh_SomeFunc(has_defaults_vvvvwbh) +// the vvvvwch Some function +function has_defaults_vvvvwch_SomeFunc(has_defaults_vvvvwch) { // set the function logic - if (has_defaults_vvvvwbh == 1) + if (has_defaults_vvvvwch == 1) { return true; } return false; } -// the vvvvwbi function -function vvvvwbi(has_defaults_vvvvwbi,datatype_vvvvwbi) +// the vvvvwci function +function vvvvwci(has_defaults_vvvvwci,datatype_vvvvwci) { - if (isSet(has_defaults_vvvvwbi) && has_defaults_vvvvwbi.constructor !== Array) + if (isSet(has_defaults_vvvvwci) && has_defaults_vvvvwci.constructor !== Array) { - var temp_vvvvwbi = has_defaults_vvvvwbi; - var has_defaults_vvvvwbi = []; - has_defaults_vvvvwbi.push(temp_vvvvwbi); + var temp_vvvvwci = has_defaults_vvvvwci; + var has_defaults_vvvvwci = []; + has_defaults_vvvvwci.push(temp_vvvvwci); } - else if (!isSet(has_defaults_vvvvwbi)) + else if (!isSet(has_defaults_vvvvwci)) { - var has_defaults_vvvvwbi = []; + var has_defaults_vvvvwci = []; } - var has_defaults = has_defaults_vvvvwbi.some(has_defaults_vvvvwbi_SomeFunc); + var has_defaults = has_defaults_vvvvwci.some(has_defaults_vvvvwci_SomeFunc); - if (isSet(datatype_vvvvwbi) && datatype_vvvvwbi.constructor !== Array) + if (isSet(datatype_vvvvwci) && datatype_vvvvwci.constructor !== Array) { - var temp_vvvvwbi = datatype_vvvvwbi; - var datatype_vvvvwbi = []; - datatype_vvvvwbi.push(temp_vvvvwbi); + var temp_vvvvwci = datatype_vvvvwci; + var datatype_vvvvwci = []; + datatype_vvvvwci.push(temp_vvvvwci); } - else if (!isSet(datatype_vvvvwbi)) + else if (!isSet(datatype_vvvvwci)) { - var datatype_vvvvwbi = []; + var datatype_vvvvwci = []; } - var datatype = datatype_vvvvwbi.some(datatype_vvvvwbi_SomeFunc); + var datatype = datatype_vvvvwci.some(datatype_vvvvwci_SomeFunc); // set this function logic @@ -335,13 +335,13 @@ function vvvvwbi(has_defaults_vvvvwbi,datatype_vvvvwbi) jQuery('#jform_datalenght').closest('.control-group').show(); jQuery('#jform_indexes').closest('.control-group').show(); // add required attribute to indexes field - if (jform_vvvvwbiwan_required) + if (jform_vvvvwcivxs_required) { updateFieldRequired('indexes',0); jQuery('#jform_indexes').prop('required','required'); jQuery('#jform_indexes').attr('aria-required',true); jQuery('#jform_indexes').addClass('required'); - jform_vvvvwbiwan_required = false; + jform_vvvvwcivxs_required = false; } } else @@ -350,65 +350,65 @@ function vvvvwbi(has_defaults_vvvvwbi,datatype_vvvvwbi) jQuery('#jform_datalenght').closest('.control-group').hide(); jQuery('#jform_indexes').closest('.control-group').hide(); // remove required attribute from indexes field - if (!jform_vvvvwbiwan_required) + if (!jform_vvvvwcivxs_required) { updateFieldRequired('indexes',1); jQuery('#jform_indexes').removeAttr('required'); jQuery('#jform_indexes').removeAttr('aria-required'); jQuery('#jform_indexes').removeClass('required'); - jform_vvvvwbiwan_required = true; + jform_vvvvwcivxs_required = true; } } } -// the vvvvwbi Some function -function has_defaults_vvvvwbi_SomeFunc(has_defaults_vvvvwbi) +// the vvvvwci Some function +function has_defaults_vvvvwci_SomeFunc(has_defaults_vvvvwci) { // set the function logic - if (has_defaults_vvvvwbi == 1) + if (has_defaults_vvvvwci == 1) { return true; } return false; } -// the vvvvwbi Some function -function datatype_vvvvwbi_SomeFunc(datatype_vvvvwbi) +// the vvvvwci Some function +function datatype_vvvvwci_SomeFunc(datatype_vvvvwci) { // set the function logic - if (datatype_vvvvwbi == 'CHAR' || datatype_vvvvwbi == 'VARCHAR' || datatype_vvvvwbi == 'DATETIME' || datatype_vvvvwbi == 'DATE' || datatype_vvvvwbi == 'TIME' || datatype_vvvvwbi == 'INT' || datatype_vvvvwbi == 'TINYINT' || datatype_vvvvwbi == 'BIGINT' || datatype_vvvvwbi == 'FLOAT' || datatype_vvvvwbi == 'DECIMAL' || datatype_vvvvwbi == 'DOUBLE') + if (datatype_vvvvwci == 'CHAR' || datatype_vvvvwci == 'VARCHAR' || datatype_vvvvwci == 'DATETIME' || datatype_vvvvwci == 'DATE' || datatype_vvvvwci == 'TIME' || datatype_vvvvwci == 'INT' || datatype_vvvvwci == 'TINYINT' || datatype_vvvvwci == 'BIGINT' || datatype_vvvvwci == 'FLOAT' || datatype_vvvvwci == 'DECIMAL' || datatype_vvvvwci == 'DOUBLE') { return true; } return false; } -// the vvvvwbj function -function vvvvwbj(datatype_vvvvwbj,has_defaults_vvvvwbj) +// the vvvvwcj function +function vvvvwcj(datatype_vvvvwcj,has_defaults_vvvvwcj) { - if (isSet(datatype_vvvvwbj) && datatype_vvvvwbj.constructor !== Array) + if (isSet(datatype_vvvvwcj) && datatype_vvvvwcj.constructor !== Array) { - var temp_vvvvwbj = datatype_vvvvwbj; - var datatype_vvvvwbj = []; - datatype_vvvvwbj.push(temp_vvvvwbj); + var temp_vvvvwcj = datatype_vvvvwcj; + var datatype_vvvvwcj = []; + datatype_vvvvwcj.push(temp_vvvvwcj); } - else if (!isSet(datatype_vvvvwbj)) + else if (!isSet(datatype_vvvvwcj)) { - var datatype_vvvvwbj = []; + var datatype_vvvvwcj = []; } - var datatype = datatype_vvvvwbj.some(datatype_vvvvwbj_SomeFunc); + var datatype = datatype_vvvvwcj.some(datatype_vvvvwcj_SomeFunc); - if (isSet(has_defaults_vvvvwbj) && has_defaults_vvvvwbj.constructor !== Array) + if (isSet(has_defaults_vvvvwcj) && has_defaults_vvvvwcj.constructor !== Array) { - var temp_vvvvwbj = has_defaults_vvvvwbj; - var has_defaults_vvvvwbj = []; - has_defaults_vvvvwbj.push(temp_vvvvwbj); + var temp_vvvvwcj = has_defaults_vvvvwcj; + var has_defaults_vvvvwcj = []; + has_defaults_vvvvwcj.push(temp_vvvvwcj); } - else if (!isSet(has_defaults_vvvvwbj)) + else if (!isSet(has_defaults_vvvvwcj)) { - var has_defaults_vvvvwbj = []; + var has_defaults_vvvvwcj = []; } - var has_defaults = has_defaults_vvvvwbj.some(has_defaults_vvvvwbj_SomeFunc); + var has_defaults = has_defaults_vvvvwcj.some(has_defaults_vvvvwcj_SomeFunc); // set this function logic @@ -416,90 +416,90 @@ function vvvvwbj(datatype_vvvvwbj,has_defaults_vvvvwbj) { jQuery('#jform_store').closest('.control-group').show(); // add required attribute to store field - if (jform_vvvvwbjwao_required) + if (jform_vvvvwcjvxt_required) { updateFieldRequired('store',0); jQuery('#jform_store').prop('required','required'); jQuery('#jform_store').attr('aria-required',true); jQuery('#jform_store').addClass('required'); - jform_vvvvwbjwao_required = false; + jform_vvvvwcjvxt_required = false; } } else { jQuery('#jform_store').closest('.control-group').hide(); // remove required attribute from store field - if (!jform_vvvvwbjwao_required) + if (!jform_vvvvwcjvxt_required) { updateFieldRequired('store',1); jQuery('#jform_store').removeAttr('required'); jQuery('#jform_store').removeAttr('aria-required'); jQuery('#jform_store').removeClass('required'); - jform_vvvvwbjwao_required = true; + jform_vvvvwcjvxt_required = true; } } } -// the vvvvwbj Some function -function datatype_vvvvwbj_SomeFunc(datatype_vvvvwbj) +// the vvvvwcj Some function +function datatype_vvvvwcj_SomeFunc(datatype_vvvvwcj) { // set the function logic - if (datatype_vvvvwbj == 'CHAR' || datatype_vvvvwbj == 'VARCHAR' || datatype_vvvvwbj == 'TEXT' || datatype_vvvvwbj == 'MEDIUMTEXT' || datatype_vvvvwbj == 'LONGTEXT' || datatype_vvvvwbj == 'BLOB' || datatype_vvvvwbj == 'TINYBLOB' || datatype_vvvvwbj == 'MEDIUMBLOB' || datatype_vvvvwbj == 'LONGBLOB') + if (datatype_vvvvwcj == 'CHAR' || datatype_vvvvwcj == 'VARCHAR' || datatype_vvvvwcj == 'TEXT' || datatype_vvvvwcj == 'MEDIUMTEXT' || datatype_vvvvwcj == 'LONGTEXT' || datatype_vvvvwcj == 'BLOB' || datatype_vvvvwcj == 'TINYBLOB' || datatype_vvvvwcj == 'MEDIUMBLOB' || datatype_vvvvwcj == 'LONGBLOB') { return true; } return false; } -// the vvvvwbj Some function -function has_defaults_vvvvwbj_SomeFunc(has_defaults_vvvvwbj) +// the vvvvwcj Some function +function has_defaults_vvvvwcj_SomeFunc(has_defaults_vvvvwcj) { // set the function logic - if (has_defaults_vvvvwbj == 1) + if (has_defaults_vvvvwcj == 1) { return true; } return false; } -// the vvvvwbl function -function vvvvwbl(store_vvvvwbl,datatype_vvvvwbl,has_defaults_vvvvwbl) +// the vvvvwcl function +function vvvvwcl(store_vvvvwcl,datatype_vvvvwcl,has_defaults_vvvvwcl) { - if (isSet(store_vvvvwbl) && store_vvvvwbl.constructor !== Array) + if (isSet(store_vvvvwcl) && store_vvvvwcl.constructor !== Array) { - var temp_vvvvwbl = store_vvvvwbl; - var store_vvvvwbl = []; - store_vvvvwbl.push(temp_vvvvwbl); + var temp_vvvvwcl = store_vvvvwcl; + var store_vvvvwcl = []; + store_vvvvwcl.push(temp_vvvvwcl); } - else if (!isSet(store_vvvvwbl)) + else if (!isSet(store_vvvvwcl)) { - var store_vvvvwbl = []; + var store_vvvvwcl = []; } - var store = store_vvvvwbl.some(store_vvvvwbl_SomeFunc); + var store = store_vvvvwcl.some(store_vvvvwcl_SomeFunc); - if (isSet(datatype_vvvvwbl) && datatype_vvvvwbl.constructor !== Array) + if (isSet(datatype_vvvvwcl) && datatype_vvvvwcl.constructor !== Array) { - var temp_vvvvwbl = datatype_vvvvwbl; - var datatype_vvvvwbl = []; - datatype_vvvvwbl.push(temp_vvvvwbl); + var temp_vvvvwcl = datatype_vvvvwcl; + var datatype_vvvvwcl = []; + datatype_vvvvwcl.push(temp_vvvvwcl); } - else if (!isSet(datatype_vvvvwbl)) + else if (!isSet(datatype_vvvvwcl)) { - var datatype_vvvvwbl = []; + var datatype_vvvvwcl = []; } - var datatype = datatype_vvvvwbl.some(datatype_vvvvwbl_SomeFunc); + var datatype = datatype_vvvvwcl.some(datatype_vvvvwcl_SomeFunc); - if (isSet(has_defaults_vvvvwbl) && has_defaults_vvvvwbl.constructor !== Array) + if (isSet(has_defaults_vvvvwcl) && has_defaults_vvvvwcl.constructor !== Array) { - var temp_vvvvwbl = has_defaults_vvvvwbl; - var has_defaults_vvvvwbl = []; - has_defaults_vvvvwbl.push(temp_vvvvwbl); + var temp_vvvvwcl = has_defaults_vvvvwcl; + var has_defaults_vvvvwcl = []; + has_defaults_vvvvwcl.push(temp_vvvvwcl); } - else if (!isSet(has_defaults_vvvvwbl)) + else if (!isSet(has_defaults_vvvvwcl)) { - var has_defaults_vvvvwbl = []; + var has_defaults_vvvvwcl = []; } - var has_defaults = has_defaults_vvvvwbl.some(has_defaults_vvvvwbl_SomeFunc); + var has_defaults = has_defaults_vvvvwcl.some(has_defaults_vvvvwcl_SomeFunc); // set this function logic @@ -513,77 +513,77 @@ function vvvvwbl(store_vvvvwbl,datatype_vvvvwbl,has_defaults_vvvvwbl) } } -// the vvvvwbl Some function -function store_vvvvwbl_SomeFunc(store_vvvvwbl) +// the vvvvwcl Some function +function store_vvvvwcl_SomeFunc(store_vvvvwcl) { // set the function logic - if (store_vvvvwbl == 4) + if (store_vvvvwcl == 4) { return true; } return false; } -// the vvvvwbl Some function -function datatype_vvvvwbl_SomeFunc(datatype_vvvvwbl) +// the vvvvwcl Some function +function datatype_vvvvwcl_SomeFunc(datatype_vvvvwcl) { // set the function logic - if (datatype_vvvvwbl == 'CHAR' || datatype_vvvvwbl == 'VARCHAR' || datatype_vvvvwbl == 'TEXT' || datatype_vvvvwbl == 'MEDIUMTEXT' || datatype_vvvvwbl == 'LONGTEXT' || datatype_vvvvwbl == 'BLOB' || datatype_vvvvwbl == 'TINYBLOB' || datatype_vvvvwbl == 'MEDIUMBLOB' || datatype_vvvvwbl == 'LONGBLOB') + if (datatype_vvvvwcl == 'CHAR' || datatype_vvvvwcl == 'VARCHAR' || datatype_vvvvwcl == 'TEXT' || datatype_vvvvwcl == 'MEDIUMTEXT' || datatype_vvvvwcl == 'LONGTEXT' || datatype_vvvvwcl == 'BLOB' || datatype_vvvvwcl == 'TINYBLOB' || datatype_vvvvwcl == 'MEDIUMBLOB' || datatype_vvvvwcl == 'LONGBLOB') { return true; } return false; } -// the vvvvwbl Some function -function has_defaults_vvvvwbl_SomeFunc(has_defaults_vvvvwbl) +// the vvvvwcl Some function +function has_defaults_vvvvwcl_SomeFunc(has_defaults_vvvvwcl) { // set the function logic - if (has_defaults_vvvvwbl == 1) + if (has_defaults_vvvvwcl == 1) { return true; } return false; } -// the vvvvwbm function -function vvvvwbm(datatype_vvvvwbm,store_vvvvwbm,has_defaults_vvvvwbm) +// the vvvvwcm function +function vvvvwcm(datatype_vvvvwcm,store_vvvvwcm,has_defaults_vvvvwcm) { - if (isSet(datatype_vvvvwbm) && datatype_vvvvwbm.constructor !== Array) + if (isSet(datatype_vvvvwcm) && datatype_vvvvwcm.constructor !== Array) { - var temp_vvvvwbm = datatype_vvvvwbm; - var datatype_vvvvwbm = []; - datatype_vvvvwbm.push(temp_vvvvwbm); + var temp_vvvvwcm = datatype_vvvvwcm; + var datatype_vvvvwcm = []; + datatype_vvvvwcm.push(temp_vvvvwcm); } - else if (!isSet(datatype_vvvvwbm)) + else if (!isSet(datatype_vvvvwcm)) { - var datatype_vvvvwbm = []; + var datatype_vvvvwcm = []; } - var datatype = datatype_vvvvwbm.some(datatype_vvvvwbm_SomeFunc); + var datatype = datatype_vvvvwcm.some(datatype_vvvvwcm_SomeFunc); - if (isSet(store_vvvvwbm) && store_vvvvwbm.constructor !== Array) + if (isSet(store_vvvvwcm) && store_vvvvwcm.constructor !== Array) { - var temp_vvvvwbm = store_vvvvwbm; - var store_vvvvwbm = []; - store_vvvvwbm.push(temp_vvvvwbm); + var temp_vvvvwcm = store_vvvvwcm; + var store_vvvvwcm = []; + store_vvvvwcm.push(temp_vvvvwcm); } - else if (!isSet(store_vvvvwbm)) + else if (!isSet(store_vvvvwcm)) { - var store_vvvvwbm = []; + var store_vvvvwcm = []; } - var store = store_vvvvwbm.some(store_vvvvwbm_SomeFunc); + var store = store_vvvvwcm.some(store_vvvvwcm_SomeFunc); - if (isSet(has_defaults_vvvvwbm) && has_defaults_vvvvwbm.constructor !== Array) + if (isSet(has_defaults_vvvvwcm) && has_defaults_vvvvwcm.constructor !== Array) { - var temp_vvvvwbm = has_defaults_vvvvwbm; - var has_defaults_vvvvwbm = []; - has_defaults_vvvvwbm.push(temp_vvvvwbm); + var temp_vvvvwcm = has_defaults_vvvvwcm; + var has_defaults_vvvvwcm = []; + has_defaults_vvvvwcm.push(temp_vvvvwcm); } - else if (!isSet(has_defaults_vvvvwbm)) + else if (!isSet(has_defaults_vvvvwcm)) { - var has_defaults_vvvvwbm = []; + var has_defaults_vvvvwcm = []; } - var has_defaults = has_defaults_vvvvwbm.some(has_defaults_vvvvwbm_SomeFunc); + var has_defaults = has_defaults_vvvvwcm.some(has_defaults_vvvvwcm_SomeFunc); // set this function logic @@ -597,77 +597,77 @@ function vvvvwbm(datatype_vvvvwbm,store_vvvvwbm,has_defaults_vvvvwbm) } } -// the vvvvwbm Some function -function datatype_vvvvwbm_SomeFunc(datatype_vvvvwbm) +// the vvvvwcm Some function +function datatype_vvvvwcm_SomeFunc(datatype_vvvvwcm) { // set the function logic - if (datatype_vvvvwbm == 'CHAR' || datatype_vvvvwbm == 'VARCHAR' || datatype_vvvvwbm == 'TEXT' || datatype_vvvvwbm == 'MEDIUMTEXT' || datatype_vvvvwbm == 'LONGTEXT' || datatype_vvvvwbm == 'BLOB' || datatype_vvvvwbm == 'TINYBLOB' || datatype_vvvvwbm == 'MEDIUMBLOB' || datatype_vvvvwbm == 'LONGBLOB') + if (datatype_vvvvwcm == 'CHAR' || datatype_vvvvwcm == 'VARCHAR' || datatype_vvvvwcm == 'TEXT' || datatype_vvvvwcm == 'MEDIUMTEXT' || datatype_vvvvwcm == 'LONGTEXT' || datatype_vvvvwcm == 'BLOB' || datatype_vvvvwcm == 'TINYBLOB' || datatype_vvvvwcm == 'MEDIUMBLOB' || datatype_vvvvwcm == 'LONGBLOB') { return true; } return false; } -// the vvvvwbm Some function -function store_vvvvwbm_SomeFunc(store_vvvvwbm) +// the vvvvwcm Some function +function store_vvvvwcm_SomeFunc(store_vvvvwcm) { // set the function logic - if (store_vvvvwbm == 4) + if (store_vvvvwcm == 4) { return true; } return false; } -// the vvvvwbm Some function -function has_defaults_vvvvwbm_SomeFunc(has_defaults_vvvvwbm) +// the vvvvwcm Some function +function has_defaults_vvvvwcm_SomeFunc(has_defaults_vvvvwcm) { // set the function logic - if (has_defaults_vvvvwbm == 1) + if (has_defaults_vvvvwcm == 1) { return true; } return false; } -// the vvvvwbn function -function vvvvwbn(has_defaults_vvvvwbn,store_vvvvwbn,datatype_vvvvwbn) +// the vvvvwcn function +function vvvvwcn(has_defaults_vvvvwcn,store_vvvvwcn,datatype_vvvvwcn) { - if (isSet(has_defaults_vvvvwbn) && has_defaults_vvvvwbn.constructor !== Array) + if (isSet(has_defaults_vvvvwcn) && has_defaults_vvvvwcn.constructor !== Array) { - var temp_vvvvwbn = has_defaults_vvvvwbn; - var has_defaults_vvvvwbn = []; - has_defaults_vvvvwbn.push(temp_vvvvwbn); + var temp_vvvvwcn = has_defaults_vvvvwcn; + var has_defaults_vvvvwcn = []; + has_defaults_vvvvwcn.push(temp_vvvvwcn); } - else if (!isSet(has_defaults_vvvvwbn)) + else if (!isSet(has_defaults_vvvvwcn)) { - var has_defaults_vvvvwbn = []; + var has_defaults_vvvvwcn = []; } - var has_defaults = has_defaults_vvvvwbn.some(has_defaults_vvvvwbn_SomeFunc); + var has_defaults = has_defaults_vvvvwcn.some(has_defaults_vvvvwcn_SomeFunc); - if (isSet(store_vvvvwbn) && store_vvvvwbn.constructor !== Array) + if (isSet(store_vvvvwcn) && store_vvvvwcn.constructor !== Array) { - var temp_vvvvwbn = store_vvvvwbn; - var store_vvvvwbn = []; - store_vvvvwbn.push(temp_vvvvwbn); + var temp_vvvvwcn = store_vvvvwcn; + var store_vvvvwcn = []; + store_vvvvwcn.push(temp_vvvvwcn); } - else if (!isSet(store_vvvvwbn)) + else if (!isSet(store_vvvvwcn)) { - var store_vvvvwbn = []; + var store_vvvvwcn = []; } - var store = store_vvvvwbn.some(store_vvvvwbn_SomeFunc); + var store = store_vvvvwcn.some(store_vvvvwcn_SomeFunc); - if (isSet(datatype_vvvvwbn) && datatype_vvvvwbn.constructor !== Array) + if (isSet(datatype_vvvvwcn) && datatype_vvvvwcn.constructor !== Array) { - var temp_vvvvwbn = datatype_vvvvwbn; - var datatype_vvvvwbn = []; - datatype_vvvvwbn.push(temp_vvvvwbn); + var temp_vvvvwcn = datatype_vvvvwcn; + var datatype_vvvvwcn = []; + datatype_vvvvwcn.push(temp_vvvvwcn); } - else if (!isSet(datatype_vvvvwbn)) + else if (!isSet(datatype_vvvvwcn)) { - var datatype_vvvvwbn = []; + var datatype_vvvvwcn = []; } - var datatype = datatype_vvvvwbn.some(datatype_vvvvwbn_SomeFunc); + var datatype = datatype_vvvvwcn.some(datatype_vvvvwcn_SomeFunc); // set this function logic @@ -681,87 +681,87 @@ function vvvvwbn(has_defaults_vvvvwbn,store_vvvvwbn,datatype_vvvvwbn) } } -// the vvvvwbn Some function -function has_defaults_vvvvwbn_SomeFunc(has_defaults_vvvvwbn) +// the vvvvwcn Some function +function has_defaults_vvvvwcn_SomeFunc(has_defaults_vvvvwcn) { // set the function logic - if (has_defaults_vvvvwbn == 1) + if (has_defaults_vvvvwcn == 1) { return true; } return false; } -// the vvvvwbn Some function -function store_vvvvwbn_SomeFunc(store_vvvvwbn) +// the vvvvwcn Some function +function store_vvvvwcn_SomeFunc(store_vvvvwcn) { // set the function logic - if (store_vvvvwbn == 4) + if (store_vvvvwcn == 4) { return true; } return false; } -// the vvvvwbn Some function -function datatype_vvvvwbn_SomeFunc(datatype_vvvvwbn) +// the vvvvwcn Some function +function datatype_vvvvwcn_SomeFunc(datatype_vvvvwcn) { // set the function logic - if (datatype_vvvvwbn == 'CHAR' || datatype_vvvvwbn == 'VARCHAR' || datatype_vvvvwbn == 'TEXT' || datatype_vvvvwbn == 'MEDIUMTEXT' || datatype_vvvvwbn == 'LONGTEXT' || datatype_vvvvwbn == 'BLOB' || datatype_vvvvwbn == 'TINYBLOB' || datatype_vvvvwbn == 'MEDIUMBLOB' || datatype_vvvvwbn == 'LONGBLOB') + if (datatype_vvvvwcn == 'CHAR' || datatype_vvvvwcn == 'VARCHAR' || datatype_vvvvwcn == 'TEXT' || datatype_vvvvwcn == 'MEDIUMTEXT' || datatype_vvvvwcn == 'LONGTEXT' || datatype_vvvvwcn == 'BLOB' || datatype_vvvvwcn == 'TINYBLOB' || datatype_vvvvwcn == 'MEDIUMBLOB' || datatype_vvvvwcn == 'LONGBLOB') { return true; } return false; } -// the vvvvwbo function -function vvvvwbo(has_defaults_vvvvwbo) +// the vvvvwco function +function vvvvwco(has_defaults_vvvvwco) { // set the function logic - if (has_defaults_vvvvwbo == 1) + if (has_defaults_vvvvwco == 1) { jQuery('#jform_datatype').closest('.control-group').show(); // add required attribute to datatype field - if (jform_vvvvwbowap_required) + if (jform_vvvvwcovxu_required) { updateFieldRequired('datatype',0); jQuery('#jform_datatype').prop('required','required'); jQuery('#jform_datatype').attr('aria-required',true); jQuery('#jform_datatype').addClass('required'); - jform_vvvvwbowap_required = false; + jform_vvvvwcovxu_required = false; } jQuery('#jform_null_switch').closest('.control-group').show(); // add required attribute to null_switch field - if (jform_vvvvwbowaq_required) + if (jform_vvvvwcovxv_required) { updateFieldRequired('null_switch',0); jQuery('#jform_null_switch').prop('required','required'); jQuery('#jform_null_switch').attr('aria-required',true); jQuery('#jform_null_switch').addClass('required'); - jform_vvvvwbowaq_required = false; + jform_vvvvwcovxv_required = false; } } else { jQuery('#jform_datatype').closest('.control-group').hide(); // remove required attribute from datatype field - if (!jform_vvvvwbowap_required) + if (!jform_vvvvwcovxu_required) { updateFieldRequired('datatype',1); jQuery('#jform_datatype').removeAttr('required'); jQuery('#jform_datatype').removeAttr('aria-required'); jQuery('#jform_datatype').removeClass('required'); - jform_vvvvwbowap_required = true; + jform_vvvvwcovxu_required = true; } jQuery('#jform_null_switch').closest('.control-group').hide(); // remove required attribute from null_switch field - if (!jform_vvvvwbowaq_required) + if (!jform_vvvvwcovxv_required) { updateFieldRequired('null_switch',1); jQuery('#jform_null_switch').removeAttr('required'); jQuery('#jform_null_switch').removeAttr('aria-required'); jQuery('#jform_null_switch').removeClass('required'); - jform_vvvvwbowaq_required = true; + jform_vvvvwcovxv_required = true; } } } @@ -810,9 +810,9 @@ jQuery(document).ready(function($) }); function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/help_document.js b/admin/models/forms/help_document.js index 71a6b21b1..399b56d1e 100644 --- a/admin/models/forms/help_document.js +++ b/admin/models/forms/help_document.js @@ -9,113 +9,112 @@ */ // Some Global Values -jform_vvvvwbzwbc_required = false; -jform_vvvvwcawbd_required = false; -jform_vvvvwcbwbe_required = false; -jform_vvvvwccwbf_required = false; -jform_vvvvwcdwbg_required = false; -jform_vvvvwcewbh_required = false; +jform_vvvvwczvyh_required = false; +jform_vvvvwdavyi_required = false; +jform_vvvvwdbvyj_required = false; +jform_vvvvwdcvyk_required = false; +jform_vvvvwdevyl_required = false; // Initial Script jQuery(document).ready(function() { - var location_vvvvwbz = jQuery("#jform_location input[type='radio']:checked").val(); - vvvvwbz(location_vvvvwbz); + var location_vvvvwcz = jQuery("#jform_location input[type='radio']:checked").val(); + vvvvwcz(location_vvvvwcz); - var location_vvvvwca = jQuery("#jform_location input[type='radio']:checked").val(); - vvvvwca(location_vvvvwca); + var location_vvvvwda = jQuery("#jform_location input[type='radio']:checked").val(); + vvvvwda(location_vvvvwda); - var type_vvvvwcb = jQuery("#jform_type").val(); - vvvvwcb(type_vvvvwcb); + var type_vvvvwdb = jQuery("#jform_type").val(); + vvvvwdb(type_vvvvwdb); - var type_vvvvwcc = jQuery("#jform_type").val(); - vvvvwcc(type_vvvvwcc); + var type_vvvvwdc = jQuery("#jform_type").val(); + vvvvwdc(type_vvvvwdc); - var type_vvvvwcd = jQuery("#jform_type").val(); - vvvvwcd(type_vvvvwcd); + var type_vvvvwdd = jQuery("#jform_type").val(); + vvvvwdd(type_vvvvwdd); - var target_vvvvwce = jQuery("#jform_target input[type='radio']:checked").val(); - vvvvwce(target_vvvvwce); + var target_vvvvwde = jQuery("#jform_target input[type='radio']:checked").val(); + vvvvwde(target_vvvvwde); }); -// the vvvvwbz function -function vvvvwbz(location_vvvvwbz) +// the vvvvwcz function +function vvvvwcz(location_vvvvwcz) { // set the function logic - if (location_vvvvwbz == 1) + if (location_vvvvwcz == 1) { jQuery('#jform_admin_view').closest('.control-group').show(); // add required attribute to admin_view field - if (jform_vvvvwbzwbc_required) + if (jform_vvvvwczvyh_required) { updateFieldRequired('admin_view',0); jQuery('#jform_admin_view').prop('required','required'); jQuery('#jform_admin_view').attr('aria-required',true); jQuery('#jform_admin_view').addClass('required'); - jform_vvvvwbzwbc_required = false; + jform_vvvvwczvyh_required = false; } } else { jQuery('#jform_admin_view').closest('.control-group').hide(); // remove required attribute from admin_view field - if (!jform_vvvvwbzwbc_required) + if (!jform_vvvvwczvyh_required) { updateFieldRequired('admin_view',1); jQuery('#jform_admin_view').removeAttr('required'); jQuery('#jform_admin_view').removeAttr('aria-required'); jQuery('#jform_admin_view').removeClass('required'); - jform_vvvvwbzwbc_required = true; + jform_vvvvwczvyh_required = true; } } } -// the vvvvwca function -function vvvvwca(location_vvvvwca) +// the vvvvwda function +function vvvvwda(location_vvvvwda) { // set the function logic - if (location_vvvvwca == 2) + if (location_vvvvwda == 2) { jQuery('#jform_site_view').closest('.control-group').show(); // add required attribute to site_view field - if (jform_vvvvwcawbd_required) + if (jform_vvvvwdavyi_required) { updateFieldRequired('site_view',0); jQuery('#jform_site_view').prop('required','required'); jQuery('#jform_site_view').attr('aria-required',true); jQuery('#jform_site_view').addClass('required'); - jform_vvvvwcawbd_required = false; + jform_vvvvwdavyi_required = false; } } else { jQuery('#jform_site_view').closest('.control-group').hide(); // remove required attribute from site_view field - if (!jform_vvvvwcawbd_required) + if (!jform_vvvvwdavyi_required) { updateFieldRequired('site_view',1); jQuery('#jform_site_view').removeAttr('required'); jQuery('#jform_site_view').removeAttr('aria-required'); jQuery('#jform_site_view').removeClass('required'); - jform_vvvvwcawbd_required = true; + jform_vvvvwdavyi_required = true; } } } -// the vvvvwcb function -function vvvvwcb(type_vvvvwcb) +// the vvvvwdb function +function vvvvwdb(type_vvvvwdb) { - if (isSet(type_vvvvwcb) && type_vvvvwcb.constructor !== Array) + if (isSet(type_vvvvwdb) && type_vvvvwdb.constructor !== Array) { - var temp_vvvvwcb = type_vvvvwcb; - var type_vvvvwcb = []; - type_vvvvwcb.push(temp_vvvvwcb); + var temp_vvvvwdb = type_vvvvwdb; + var type_vvvvwdb = []; + type_vvvvwdb.push(temp_vvvvwdb); } - else if (!isSet(type_vvvvwcb)) + else if (!isSet(type_vvvvwdb)) { - var type_vvvvwcb = []; + var type_vvvvwdb = []; } - var type = type_vvvvwcb.some(type_vvvvwcb_SomeFunc); + var type = type_vvvvwdb.some(type_vvvvwdb_SomeFunc); // set this function logic @@ -123,55 +122,55 @@ function vvvvwcb(type_vvvvwcb) { jQuery('#jform_url').closest('.control-group').show(); // add required attribute to url field - if (jform_vvvvwcbwbe_required) + if (jform_vvvvwdbvyj_required) { updateFieldRequired('url',0); jQuery('#jform_url').prop('required','required'); jQuery('#jform_url').attr('aria-required',true); jQuery('#jform_url').addClass('required'); - jform_vvvvwcbwbe_required = false; + jform_vvvvwdbvyj_required = false; } } else { jQuery('#jform_url').closest('.control-group').hide(); // remove required attribute from url field - if (!jform_vvvvwcbwbe_required) + if (!jform_vvvvwdbvyj_required) { updateFieldRequired('url',1); jQuery('#jform_url').removeAttr('required'); jQuery('#jform_url').removeAttr('aria-required'); jQuery('#jform_url').removeClass('required'); - jform_vvvvwcbwbe_required = true; + jform_vvvvwdbvyj_required = true; } } } -// the vvvvwcb Some function -function type_vvvvwcb_SomeFunc(type_vvvvwcb) +// the vvvvwdb Some function +function type_vvvvwdb_SomeFunc(type_vvvvwdb) { // set the function logic - if (type_vvvvwcb == 3) + if (type_vvvvwdb == 3) { return true; } return false; } -// the vvvvwcc function -function vvvvwcc(type_vvvvwcc) +// the vvvvwdc function +function vvvvwdc(type_vvvvwdc) { - if (isSet(type_vvvvwcc) && type_vvvvwcc.constructor !== Array) + if (isSet(type_vvvvwdc) && type_vvvvwdc.constructor !== Array) { - var temp_vvvvwcc = type_vvvvwcc; - var type_vvvvwcc = []; - type_vvvvwcc.push(temp_vvvvwcc); + var temp_vvvvwdc = type_vvvvwdc; + var type_vvvvwdc = []; + type_vvvvwdc.push(temp_vvvvwdc); } - else if (!isSet(type_vvvvwcc)) + else if (!isSet(type_vvvvwdc)) { - var type_vvvvwcc = []; + var type_vvvvwdc = []; } - var type = type_vvvvwcc.some(type_vvvvwcc_SomeFunc); + var type = type_vvvvwdc.some(type_vvvvwdc_SomeFunc); // set this function logic @@ -179,125 +178,107 @@ function vvvvwcc(type_vvvvwcc) { jQuery('#jform_article').closest('.control-group').show(); // add required attribute to article field - if (jform_vvvvwccwbf_required) + if (jform_vvvvwdcvyk_required) { updateFieldRequired('article',0); jQuery('#jform_article').prop('required','required'); jQuery('#jform_article').attr('aria-required',true); jQuery('#jform_article').addClass('required'); - jform_vvvvwccwbf_required = false; + jform_vvvvwdcvyk_required = false; } } else { jQuery('#jform_article').closest('.control-group').hide(); // remove required attribute from article field - if (!jform_vvvvwccwbf_required) + if (!jform_vvvvwdcvyk_required) { updateFieldRequired('article',1); jQuery('#jform_article').removeAttr('required'); jQuery('#jform_article').removeAttr('aria-required'); jQuery('#jform_article').removeClass('required'); - jform_vvvvwccwbf_required = true; + jform_vvvvwdcvyk_required = true; } } } -// the vvvvwcc Some function -function type_vvvvwcc_SomeFunc(type_vvvvwcc) +// the vvvvwdc Some function +function type_vvvvwdc_SomeFunc(type_vvvvwdc) { // set the function logic - if (type_vvvvwcc == 1) + if (type_vvvvwdc == 1) { return true; } return false; } -// the vvvvwcd function -function vvvvwcd(type_vvvvwcd) +// the vvvvwdd function +function vvvvwdd(type_vvvvwdd) { - if (isSet(type_vvvvwcd) && type_vvvvwcd.constructor !== Array) + if (isSet(type_vvvvwdd) && type_vvvvwdd.constructor !== Array) { - var temp_vvvvwcd = type_vvvvwcd; - var type_vvvvwcd = []; - type_vvvvwcd.push(temp_vvvvwcd); + var temp_vvvvwdd = type_vvvvwdd; + var type_vvvvwdd = []; + type_vvvvwdd.push(temp_vvvvwdd); } - else if (!isSet(type_vvvvwcd)) + else if (!isSet(type_vvvvwdd)) { - var type_vvvvwcd = []; + var type_vvvvwdd = []; } - var type = type_vvvvwcd.some(type_vvvvwcd_SomeFunc); + var type = type_vvvvwdd.some(type_vvvvwdd_SomeFunc); // set this function logic if (type) { jQuery('#jform_content-lbl').closest('.control-group').show(); - // add required attribute to content field - if (jform_vvvvwcdwbg_required) - { - updateFieldRequired('content',0); - jQuery('#jform_content').prop('required','required'); - jQuery('#jform_content').attr('aria-required',true); - jQuery('#jform_content').addClass('required'); - jform_vvvvwcdwbg_required = false; - } } else { jQuery('#jform_content-lbl').closest('.control-group').hide(); - // remove required attribute from content field - if (!jform_vvvvwcdwbg_required) - { - updateFieldRequired('content',1); - jQuery('#jform_content').removeAttr('required'); - jQuery('#jform_content').removeAttr('aria-required'); - jQuery('#jform_content').removeClass('required'); - jform_vvvvwcdwbg_required = true; - } } } -// the vvvvwcd Some function -function type_vvvvwcd_SomeFunc(type_vvvvwcd) +// the vvvvwdd Some function +function type_vvvvwdd_SomeFunc(type_vvvvwdd) { // set the function logic - if (type_vvvvwcd == 2) + if (type_vvvvwdd == 2) { return true; } return false; } -// the vvvvwce function -function vvvvwce(target_vvvvwce) +// the vvvvwde function +function vvvvwde(target_vvvvwde) { // set the function logic - if (target_vvvvwce == 1) + if (target_vvvvwde == 1) { jQuery('#jform_groups').closest('.control-group').show(); // add required attribute to groups field - if (jform_vvvvwcewbh_required) + if (jform_vvvvwdevyl_required) { updateFieldRequired('groups',0); jQuery('#jform_groups').prop('required','required'); jQuery('#jform_groups').attr('aria-required',true); jQuery('#jform_groups').addClass('required'); - jform_vvvvwcewbh_required = false; + jform_vvvvwdevyl_required = false; } } else { jQuery('#jform_groups').closest('.control-group').hide(); // remove required attribute from groups field - if (!jform_vvvvwcewbh_required) + if (!jform_vvvvwdevyl_required) { updateFieldRequired('groups',1); jQuery('#jform_groups').removeAttr('required'); jQuery('#jform_groups').removeAttr('aria-required'); jQuery('#jform_groups').removeClass('required'); - jform_vvvvwcewbh_required = true; + jform_vvvvwdevyl_required = true; } } } diff --git a/admin/models/forms/help_document.xml b/admin/models/forms/help_document.xml index 1aafa6873..f6a9bf71e 100644 --- a/admin/models/forms/help_document.xml +++ b/admin/models/forms/help_document.xml @@ -176,7 +176,6 @@ height="300 px" buttons="false" filter="safehtml" - required="true" /> 0 && identifier.length > 0 && key.length > 0){ - var request = 'token='+token+'&identifier='+identifier+'&key='+key; + var request = token+'=1&identifier='+identifier+'&key='+key; } return jQuery.ajax({ type: 'GET', @@ -1132,9 +866,9 @@ function getAjaxDisplay(type){ } function getAjaxDisplay_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type=' + type; + var request = token+'=1&type=' + type; } return jQuery.ajax({ type: 'GET', @@ -1165,9 +899,9 @@ function dasboardSwitch(value){ function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', @@ -1206,7 +940,7 @@ function isObject(obj) { function addButtonID_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0 && size > 0){ - var request = 'token='+token+'&type='+type+'&size='+size; + var request = token+'=1&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -1231,7 +965,7 @@ function addButtonID(type, where, size){ function addButton_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type='+type+'&size='+size; + var request = token+'=1&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/joomla_component.xml b/admin/models/forms/joomla_component.xml index 2eeedcb3a..8cabf38ab 100644 --- a/admin/models/forms/joomla_component.xml +++ b/admin/models/forms/joomla_component.xml @@ -176,7 +176,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -229,7 +228,6 @@ buttons="false" editor="none" filter="raw" - required="true" /> @@ -318,7 +315,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -335,7 +331,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -366,7 +361,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -461,7 +455,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -509,7 +502,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -541,7 +533,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -579,7 +570,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -598,7 +588,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -645,7 +634,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -677,7 +665,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -708,7 +695,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> diff --git a/admin/models/forms/joomla_plugin.js b/admin/models/forms/joomla_plugin.js new file mode 100644 index 000000000..029daacab --- /dev/null +++ b/admin/models/forms/joomla_plugin.js @@ -0,0 +1,1115 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// Some Global Values +jform_vvvvvxevwd_required = false; +jform_vvvvvxtvwe_required = false; +jform_vvvvvxuvwf_required = false; +jform_vvvvvxvvwg_required = false; + +// Initial Script +jQuery(document).ready(function() +{ + var class_extends_vvvvvxb = jQuery("#jform_class_extends").val(); + var joomla_plugin_group_vvvvvxb = jQuery("#jform_joomla_plugin_group").val(); + vvvvvxb(class_extends_vvvvvxb,joomla_plugin_group_vvvvvxb); + + var joomla_plugin_group_vvvvvxc = jQuery("#jform_joomla_plugin_group").val(); + var class_extends_vvvvvxc = jQuery("#jform_class_extends").val(); + vvvvvxc(joomla_plugin_group_vvvvvxc,class_extends_vvvvvxc); + + var class_extends_vvvvvxd = jQuery("#jform_class_extends").val(); + vvvvvxd(class_extends_vvvvvxd); + + var add_head_vvvvvxe = jQuery("#jform_add_head input[type='radio']:checked").val(); + var class_extends_vvvvvxe = jQuery("#jform_class_extends").val(); + vvvvvxe(add_head_vvvvvxe,class_extends_vvvvvxe); + + var add_php_script_construct_vvvvvxg = jQuery("#jform_add_php_script_construct input[type='radio']:checked").val(); + vvvvvxg(add_php_script_construct_vvvvvxg); + + var add_php_preflight_install_vvvvvxh = jQuery("#jform_add_php_preflight_install input[type='radio']:checked").val(); + vvvvvxh(add_php_preflight_install_vvvvvxh); + + var add_php_preflight_update_vvvvvxi = jQuery("#jform_add_php_preflight_update input[type='radio']:checked").val(); + vvvvvxi(add_php_preflight_update_vvvvvxi); + + var add_php_preflight_uninstall_vvvvvxj = jQuery("#jform_add_php_preflight_uninstall input[type='radio']:checked").val(); + vvvvvxj(add_php_preflight_uninstall_vvvvvxj); + + var add_php_postflight_install_vvvvvxk = jQuery("#jform_add_php_postflight_install input[type='radio']:checked").val(); + vvvvvxk(add_php_postflight_install_vvvvvxk); + + var add_php_postflight_update_vvvvvxl = jQuery("#jform_add_php_postflight_update input[type='radio']:checked").val(); + vvvvvxl(add_php_postflight_update_vvvvvxl); + + var add_php_method_uninstall_vvvvvxm = jQuery("#jform_add_php_method_uninstall input[type='radio']:checked").val(); + vvvvvxm(add_php_method_uninstall_vvvvvxm); + + var update_server_target_vvvvvxn = jQuery("#jform_update_server_target input[type='radio']:checked").val(); + var add_update_server_vvvvvxn = jQuery("#jform_add_update_server input[type='radio']:checked").val(); + vvvvvxn(update_server_target_vvvvvxn,add_update_server_vvvvvxn); + + var add_update_server_vvvvvxo = jQuery("#jform_add_update_server input[type='radio']:checked").val(); + var update_server_target_vvvvvxo = jQuery("#jform_update_server_target input[type='radio']:checked").val(); + vvvvvxo(add_update_server_vvvvvxo,update_server_target_vvvvvxo); + + var update_server_target_vvvvvxp = jQuery("#jform_update_server_target input[type='radio']:checked").val(); + var add_update_server_vvvvvxp = jQuery("#jform_add_update_server input[type='radio']:checked").val(); + vvvvvxp(update_server_target_vvvvvxp,add_update_server_vvvvvxp); + + var update_server_target_vvvvvxr = jQuery("#jform_update_server_target input[type='radio']:checked").val(); + var add_update_server_vvvvvxr = jQuery("#jform_add_update_server input[type='radio']:checked").val(); + vvvvvxr(update_server_target_vvvvvxr,add_update_server_vvvvvxr); + + var add_update_server_vvvvvxt = jQuery("#jform_add_update_server input[type='radio']:checked").val(); + vvvvvxt(add_update_server_vvvvvxt); + + var add_sql_vvvvvxu = jQuery("#jform_add_sql input[type='radio']:checked").val(); + vvvvvxu(add_sql_vvvvvxu); + + var add_sql_uninstall_vvvvvxv = jQuery("#jform_add_sql_uninstall input[type='radio']:checked").val(); + vvvvvxv(add_sql_uninstall_vvvvvxv); + + var add_update_server_vvvvvxw = jQuery("#jform_add_update_server input[type='radio']:checked").val(); + vvvvvxw(add_update_server_vvvvvxw); + + var add_sales_server_vvvvvxx = jQuery("#jform_add_sales_server input[type='radio']:checked").val(); + vvvvvxx(add_sales_server_vvvvvxx); + + var addreadme_vvvvvxy = jQuery("#jform_addreadme input[type='radio']:checked").val(); + vvvvvxy(addreadme_vvvvvxy); +}); + +// the vvvvvxb function +function vvvvvxb(class_extends_vvvvvxb,joomla_plugin_group_vvvvvxb) +{ + if (isSet(class_extends_vvvvvxb) && class_extends_vvvvvxb.constructor !== Array) + { + var temp_vvvvvxb = class_extends_vvvvvxb; + var class_extends_vvvvvxb = []; + class_extends_vvvvvxb.push(temp_vvvvvxb); + } + else if (!isSet(class_extends_vvvvvxb)) + { + var class_extends_vvvvvxb = []; + } + var class_extends = class_extends_vvvvvxb.some(class_extends_vvvvvxb_SomeFunc); + + if (isSet(joomla_plugin_group_vvvvvxb) && joomla_plugin_group_vvvvvxb.constructor !== Array) + { + var temp_vvvvvxb = joomla_plugin_group_vvvvvxb; + var joomla_plugin_group_vvvvvxb = []; + joomla_plugin_group_vvvvvxb.push(temp_vvvvvxb); + } + else if (!isSet(joomla_plugin_group_vvvvvxb)) + { + var joomla_plugin_group_vvvvvxb = []; + } + var joomla_plugin_group = joomla_plugin_group_vvvvvxb.some(joomla_plugin_group_vvvvvxb_SomeFunc); + + + // set this function logic + if (class_extends && joomla_plugin_group) + { + jQuery('#jform_main_class_code-lbl').closest('.control-group').show(); + jQuery('#jform_method_selection-lbl').closest('.control-group').show(); + jQuery('#jform_property_selection-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_main_class_code-lbl').closest('.control-group').hide(); + jQuery('#jform_method_selection-lbl').closest('.control-group').hide(); + jQuery('#jform_property_selection-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxb Some function +function class_extends_vvvvvxb_SomeFunc(class_extends_vvvvvxb) +{ + // set the function logic + if (isSet(class_extends_vvvvvxb)) + { + return true; + } + return false; +} + +// the vvvvvxb Some function +function joomla_plugin_group_vvvvvxb_SomeFunc(joomla_plugin_group_vvvvvxb) +{ + // set the function logic + if (isSet(joomla_plugin_group_vvvvvxb)) + { + return true; + } + return false; +} + +// the vvvvvxc function +function vvvvvxc(joomla_plugin_group_vvvvvxc,class_extends_vvvvvxc) +{ + if (isSet(joomla_plugin_group_vvvvvxc) && joomla_plugin_group_vvvvvxc.constructor !== Array) + { + var temp_vvvvvxc = joomla_plugin_group_vvvvvxc; + var joomla_plugin_group_vvvvvxc = []; + joomla_plugin_group_vvvvvxc.push(temp_vvvvvxc); + } + else if (!isSet(joomla_plugin_group_vvvvvxc)) + { + var joomla_plugin_group_vvvvvxc = []; + } + var joomla_plugin_group = joomla_plugin_group_vvvvvxc.some(joomla_plugin_group_vvvvvxc_SomeFunc); + + if (isSet(class_extends_vvvvvxc) && class_extends_vvvvvxc.constructor !== Array) + { + var temp_vvvvvxc = class_extends_vvvvvxc; + var class_extends_vvvvvxc = []; + class_extends_vvvvvxc.push(temp_vvvvvxc); + } + else if (!isSet(class_extends_vvvvvxc)) + { + var class_extends_vvvvvxc = []; + } + var class_extends = class_extends_vvvvvxc.some(class_extends_vvvvvxc_SomeFunc); + + + // set this function logic + if (joomla_plugin_group && class_extends) + { + jQuery('#jform_main_class_code-lbl').closest('.control-group').show(); + jQuery('#jform_method_selection-lbl').closest('.control-group').show(); + jQuery('#jform_property_selection-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_main_class_code-lbl').closest('.control-group').hide(); + jQuery('#jform_method_selection-lbl').closest('.control-group').hide(); + jQuery('#jform_property_selection-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxc Some function +function joomla_plugin_group_vvvvvxc_SomeFunc(joomla_plugin_group_vvvvvxc) +{ + // set the function logic + if (isSet(joomla_plugin_group_vvvvvxc)) + { + return true; + } + return false; +} + +// the vvvvvxc Some function +function class_extends_vvvvvxc_SomeFunc(class_extends_vvvvvxc) +{ + // set the function logic + if (isSet(class_extends_vvvvvxc)) + { + return true; + } + return false; +} + +// the vvvvvxd function +function vvvvvxd(class_extends_vvvvvxd) +{ + if (isSet(class_extends_vvvvvxd) && class_extends_vvvvvxd.constructor !== Array) + { + var temp_vvvvvxd = class_extends_vvvvvxd; + var class_extends_vvvvvxd = []; + class_extends_vvvvvxd.push(temp_vvvvvxd); + } + else if (!isSet(class_extends_vvvvvxd)) + { + var class_extends_vvvvvxd = []; + } + var class_extends = class_extends_vvvvvxd.some(class_extends_vvvvvxd_SomeFunc); + + + // set this function logic + if (class_extends) + { + jQuery('#jform_add_head').closest('.control-group').show(); + } + else + { + jQuery('#jform_add_head').closest('.control-group').hide(); + } +} + +// the vvvvvxd Some function +function class_extends_vvvvvxd_SomeFunc(class_extends_vvvvvxd) +{ + // set the function logic + if (isSet(class_extends_vvvvvxd)) + { + return true; + } + return false; +} + +// the vvvvvxe function +function vvvvvxe(add_head_vvvvvxe,class_extends_vvvvvxe) +{ + if (isSet(add_head_vvvvvxe) && add_head_vvvvvxe.constructor !== Array) + { + var temp_vvvvvxe = add_head_vvvvvxe; + var add_head_vvvvvxe = []; + add_head_vvvvvxe.push(temp_vvvvvxe); + } + else if (!isSet(add_head_vvvvvxe)) + { + var add_head_vvvvvxe = []; + } + var add_head = add_head_vvvvvxe.some(add_head_vvvvvxe_SomeFunc); + + if (isSet(class_extends_vvvvvxe) && class_extends_vvvvvxe.constructor !== Array) + { + var temp_vvvvvxe = class_extends_vvvvvxe; + var class_extends_vvvvvxe = []; + class_extends_vvvvvxe.push(temp_vvvvvxe); + } + else if (!isSet(class_extends_vvvvvxe)) + { + var class_extends_vvvvvxe = []; + } + var class_extends = class_extends_vvvvvxe.some(class_extends_vvvvvxe_SomeFunc); + + + // set this function logic + if (add_head && class_extends) + { + jQuery('#jform_head-lbl').closest('.control-group').show(); + // add required attribute to head field + if (jform_vvvvvxevwd_required) + { + updateFieldRequired('head',0); + jQuery('#jform_head').prop('required','required'); + jQuery('#jform_head').attr('aria-required',true); + jQuery('#jform_head').addClass('required'); + jform_vvvvvxevwd_required = false; + } + } + else + { + jQuery('#jform_head-lbl').closest('.control-group').hide(); + // remove required attribute from head field + if (!jform_vvvvvxevwd_required) + { + updateFieldRequired('head',1); + jQuery('#jform_head').removeAttr('required'); + jQuery('#jform_head').removeAttr('aria-required'); + jQuery('#jform_head').removeClass('required'); + jform_vvvvvxevwd_required = true; + } + } +} + +// the vvvvvxe Some function +function add_head_vvvvvxe_SomeFunc(add_head_vvvvvxe) +{ + // set the function logic + if (add_head_vvvvvxe == 1) + { + return true; + } + return false; +} + +// the vvvvvxe Some function +function class_extends_vvvvvxe_SomeFunc(class_extends_vvvvvxe) +{ + // set the function logic + if (isSet(class_extends_vvvvvxe)) + { + return true; + } + return false; +} + +// the vvvvvxg function +function vvvvvxg(add_php_script_construct_vvvvvxg) +{ + // set the function logic + if (add_php_script_construct_vvvvvxg == 1) + { + jQuery('#jform_php_script_construct-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_php_script_construct-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxh function +function vvvvvxh(add_php_preflight_install_vvvvvxh) +{ + // set the function logic + if (add_php_preflight_install_vvvvvxh == 1) + { + jQuery('#jform_php_preflight_install-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_php_preflight_install-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxi function +function vvvvvxi(add_php_preflight_update_vvvvvxi) +{ + // set the function logic + if (add_php_preflight_update_vvvvvxi == 1) + { + jQuery('#jform_php_preflight_update-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_php_preflight_update-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxj function +function vvvvvxj(add_php_preflight_uninstall_vvvvvxj) +{ + // set the function logic + if (add_php_preflight_uninstall_vvvvvxj == 1) + { + jQuery('#jform_php_preflight_uninstall-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_php_preflight_uninstall-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxk function +function vvvvvxk(add_php_postflight_install_vvvvvxk) +{ + // set the function logic + if (add_php_postflight_install_vvvvvxk == 1) + { + jQuery('#jform_php_postflight_install-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_php_postflight_install-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxl function +function vvvvvxl(add_php_postflight_update_vvvvvxl) +{ + // set the function logic + if (add_php_postflight_update_vvvvvxl == 1) + { + jQuery('#jform_php_postflight_update-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_php_postflight_update-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxm function +function vvvvvxm(add_php_method_uninstall_vvvvvxm) +{ + // set the function logic + if (add_php_method_uninstall_vvvvvxm == 1) + { + jQuery('#jform_php_method_uninstall-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_php_method_uninstall-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxn function +function vvvvvxn(update_server_target_vvvvvxn,add_update_server_vvvvvxn) +{ + // set the function logic + if (update_server_target_vvvvvxn == 1 && add_update_server_vvvvvxn == 1) + { + jQuery('#jform_update_server').closest('.control-group').show(); + jQuery('.note_update_server_note_ftp').closest('.control-group').show(); + } + else + { + jQuery('#jform_update_server').closest('.control-group').hide(); + jQuery('.note_update_server_note_ftp').closest('.control-group').hide(); + } +} + +// the vvvvvxo function +function vvvvvxo(add_update_server_vvvvvxo,update_server_target_vvvvvxo) +{ + // set the function logic + if (add_update_server_vvvvvxo == 1 && update_server_target_vvvvvxo == 1) + { + jQuery('#jform_update_server').closest('.control-group').show(); + jQuery('.note_update_server_note_ftp').closest('.control-group').show(); + } + else + { + jQuery('#jform_update_server').closest('.control-group').hide(); + jQuery('.note_update_server_note_ftp').closest('.control-group').hide(); + } +} + +// the vvvvvxp function +function vvvvvxp(update_server_target_vvvvvxp,add_update_server_vvvvvxp) +{ + // set the function logic + if (update_server_target_vvvvvxp == 2 && add_update_server_vvvvvxp == 1) + { + jQuery('.note_update_server_note_zip').closest('.control-group').show(); + } + else + { + jQuery('.note_update_server_note_zip').closest('.control-group').hide(); + } +} + +// the vvvvvxr function +function vvvvvxr(update_server_target_vvvvvxr,add_update_server_vvvvvxr) +{ + // set the function logic + if (update_server_target_vvvvvxr == 3 && add_update_server_vvvvvxr == 1) + { + jQuery('.note_update_server_note_other').closest('.control-group').show(); + } + else + { + jQuery('.note_update_server_note_other').closest('.control-group').hide(); + } +} + +// the vvvvvxt function +function vvvvvxt(add_update_server_vvvvvxt) +{ + // set the function logic + if (add_update_server_vvvvvxt == 1) + { + jQuery('#jform_update_server_target').closest('.control-group').show(); + // add required attribute to update_server_target field + if (jform_vvvvvxtvwe_required) + { + updateFieldRequired('update_server_target',0); + jQuery('#jform_update_server_target').prop('required','required'); + jQuery('#jform_update_server_target').attr('aria-required',true); + jQuery('#jform_update_server_target').addClass('required'); + jform_vvvvvxtvwe_required = false; + } + } + else + { + jQuery('#jform_update_server_target').closest('.control-group').hide(); + // remove required attribute from update_server_target field + if (!jform_vvvvvxtvwe_required) + { + updateFieldRequired('update_server_target',1); + jQuery('#jform_update_server_target').removeAttr('required'); + jQuery('#jform_update_server_target').removeAttr('aria-required'); + jQuery('#jform_update_server_target').removeClass('required'); + jform_vvvvvxtvwe_required = true; + } + } +} + +// the vvvvvxu function +function vvvvvxu(add_sql_vvvvvxu) +{ + // set the function logic + if (add_sql_vvvvvxu == 1) + { + jQuery('#jform_sql').closest('.control-group').show(); + // add required attribute to sql field + if (jform_vvvvvxuvwf_required) + { + updateFieldRequired('sql',0); + jQuery('#jform_sql').prop('required','required'); + jQuery('#jform_sql').attr('aria-required',true); + jQuery('#jform_sql').addClass('required'); + jform_vvvvvxuvwf_required = false; + } + } + else + { + jQuery('#jform_sql').closest('.control-group').hide(); + // remove required attribute from sql field + if (!jform_vvvvvxuvwf_required) + { + updateFieldRequired('sql',1); + jQuery('#jform_sql').removeAttr('required'); + jQuery('#jform_sql').removeAttr('aria-required'); + jQuery('#jform_sql').removeClass('required'); + jform_vvvvvxuvwf_required = true; + } + } +} + +// the vvvvvxv function +function vvvvvxv(add_sql_uninstall_vvvvvxv) +{ + // set the function logic + if (add_sql_uninstall_vvvvvxv == 1) + { + jQuery('#jform_sql_uninstall').closest('.control-group').show(); + // add required attribute to sql_uninstall field + if (jform_vvvvvxvvwg_required) + { + updateFieldRequired('sql_uninstall',0); + jQuery('#jform_sql_uninstall').prop('required','required'); + jQuery('#jform_sql_uninstall').attr('aria-required',true); + jQuery('#jform_sql_uninstall').addClass('required'); + jform_vvvvvxvvwg_required = false; + } + } + else + { + jQuery('#jform_sql_uninstall').closest('.control-group').hide(); + // remove required attribute from sql_uninstall field + if (!jform_vvvvvxvvwg_required) + { + updateFieldRequired('sql_uninstall',1); + jQuery('#jform_sql_uninstall').removeAttr('required'); + jQuery('#jform_sql_uninstall').removeAttr('aria-required'); + jQuery('#jform_sql_uninstall').removeClass('required'); + jform_vvvvvxvvwg_required = true; + } + } +} + +// the vvvvvxw function +function vvvvvxw(add_update_server_vvvvvxw) +{ + // set the function logic + if (add_update_server_vvvvvxw == 1) + { + jQuery('#jform_update_server_url').closest('.control-group').show(); + } + else + { + jQuery('#jform_update_server_url').closest('.control-group').hide(); + } +} + +// the vvvvvxx function +function vvvvvxx(add_sales_server_vvvvvxx) +{ + // set the function logic + if (add_sales_server_vvvvvxx == 1) + { + jQuery('#jform_sales_server').closest('.control-group').show(); + } + else + { + jQuery('#jform_sales_server').closest('.control-group').hide(); + } +} + +// the vvvvvxy function +function vvvvvxy(addreadme_vvvvvxy) +{ + // set the function logic + if (addreadme_vvvvvxy == 1) + { + jQuery('#jform_readme-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_readme-lbl').closest('.control-group').hide(); + } +} + +// update required fields +function updateFieldRequired(name,status) +{ + var not_required = jQuery('#jform_not_required').val(); + + if(status == 1) + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required+','+name; + } + else + { + not_required = ','+name; + } + } + else + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required.replace(','+name,''); + } + } + + jQuery('#jform_not_required').val(not_required); +} + +// the isSet function +function isSet(val) +{ + if ((val != undefined) && (val != null) && 0 !== val.length){ + return true; + } + return false; +} + + +jQuery(document).ready(function() +{ + // get the linked details + getLinked(); + // load the active array values + buildSelectionMemory('property'); + buildSelectionMemory('method'); + // load the active selection array values + getClassCodeIds('joomla_plugin_group', 'jform_class_extends', false); + getClassCodeIds('property', 'jform_joomla_plugin_group', false); + getClassCodeIds('method', 'jform_joomla_plugin_group', false); + // check and load all the customcode edit buttons + setTimeout(getEditCustomCodeButtons, 300); + // trigger the row watcher + rowWatcher(); +}); + +// set selection the options +selectionMemory = {'property':{},'method':{}}; +selectionActiveArray = {'property':{},'method':{}}; +selectedIdRemoved = {'property':'not','method':'not'}; + +function buildSelectionMemory(type) { + var i; + for (i = 0; i < 70; i++) { + // build ID + var id_check = 'jform_'+type+'_selection'+'__'+type+'_selection'+i+'__'+type; + // set memory + if (jQuery("#"+id_check).length) { + selectionMemory[type][id_check] = jQuery("#"+id_check+" option:selected").val(); + } + } +} + +function getClassStuff_server(id, type, callingName){ + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax."+callingName+"&format=json&raw=true"); + if(token.length > 0 && id > 0 && type.length > 0){ + var request = token+'=1&type=' + type + '&id=' + id; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'json', + data: request, + jsonp: false + }); +} + +function getClassHeaderCode(){ + // now get the values + var value = jQuery("#jform_class_extends option:selected").val(); + var add_value = jQuery("#jform_add_head input[type='radio']:checked").val(); + if (add_value == 1 && value > 0){ + // we first check local memory + var _result = jQuery.jStorage.get('extends_header_'+value, null); + if (_result) { + // now set the code + addCodeToEditor(_result, "jform_head", false); + } else { + // now get the code + getClassStuff_server(value, 'extends', 'getClassHeaderCode').done(function(result) { + if(result){ + // now set the code + addCodeToEditor(result, "jform_head", false); + // add result to local memory + jQuery.jStorage.set('extends_header_'+value, result, {TTL: expire}); + } + }); + } + } +} + +function getClassCodeIds(type, target_field, reset_all){ + // now get the value + var value = jQuery('#'+target_field).val(); + // now get the code + getClassStuff_server(value, type, 'getClassCodeIds').done(function(result) { + if(result){ + // reset the selection + selectionActiveArray[type] = {}; + // update the active array + jQuery.each(result, function(i, prop) { + selectionActiveArray[type][prop] = selectionArray[type][prop]; + }); + // update the active field selection + updateActiveFieldSelection(type, reset_all); + } + }); +} + +function updateActiveFieldSelection(type, reset_all){ + // update the selection options + if ('joomla_plugin_group' === type) { + // get value if not going to reset all + if (!reset_all){ + // get the active values + var activeValue = jQuery("#jform_"+type+" option:selected").val(); + var activeText = jQuery("#jform_"+type+" option:selected").text(); + // clear the options out + jQuery("#jform_"+type).find('option').remove().end(); + // add the active selection back (must be what is available) + jQuery("#jform_"+type).append(''); + // now add the lists back + jQuery.each( selectionActiveArray[type], function(aValue, aText ) { + if (activeValue !== aValue) { + jQuery("#jform_"+type).append(''); + } + }); + jQuery("#jform_"+type).val(activeValue); + } else { + // clear the options out + jQuery("#jform_"+type).find('option').remove().end(); + // now add the lists back + jQuery.each( selectionActiveArray[type], function(aValue, aText ) { + jQuery("#jform_"+type).append(''); + }); + jQuery("#jform_"+type).val(''); + } + jQuery("#jform_"+type).trigger('liszt:updated'); + // reset all when global update is made + if (reset_all) { + resetAll('method'); + resetAll('property'); + } + } else { + selectionDynamicUpdate(type); + // reset all when global update is made + if (reset_all) { + resetAll(type); + } + } +} + +function resetAll(type) { + var i; + for (i = 0; i < 10; i++) { + // build ID + var id_check = 'jform_'+type+'_selection'+'__'+type+'_selection'+i+'__'+type; + // first check if Id is on page as that not the same as the one currently calling + if (jQuery("#"+id_check).length) { + if (i == 0) { + jQuery('#'+id_check).val(''); + jQuery('#'+id_check).trigger('liszt:updated'); + } else { + // remove the row + jQuery('#'+id_check).closest('tr').remove(); + } + } + } + Joomla.editors.instances['jform_main_class_code'].setValue(''); + selectionMemory = {'property':{},'method':{}}; +} + +function getClassCode(field, type){ + // get the ID + var id = jQuery(field).attr('id'); + // now get the value + var value = jQuery('#' + id).val(); + // check if we have a memory for this field, if true remove code of old selection and clear memory + if (selectionMemory[type].hasOwnProperty(id) && selectionMemory[type][id] > 0) { + // the old id to remove + var old_value = selectionMemory[type][id]; + // remove the code // we first check local memory + var _result = jQuery.jStorage.get('code_4_'+type+'_'+old_value, null); + if (_result) { + // now remove the code + if (removeCodeFromEditor(_result)) { + selectionMemory[type][id] = 0; + } + } else { + // now get the code + getClassStuff_server(old_value, type, 'getClassCode').done(function(result) { + if(result){ + // now remove the code + if (removeCodeFromEditor(result)) { + selectionMemory[type][id] = 0; + } + // add result to local memory + jQuery.jStorage.set('code_4_'+type+'_'+old_value, result, {TTL: expire}); + } + }); + } + } + if (propertyIsSet(value, id, type)) { + // reset the selection + jQuery('#'+id).val(''); + jQuery('#'+id).trigger("liszt:updated"); + // give out a notice + jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_ALREADY_SELECTED_TRY_ANOTHER'), timeout: 5000, status: 'warning', pos: 'top-center'}); + } else { + // set the active removed value + selectedIdRemoved[type] = id; + // do a dynamic update (to remove what was already used) + selectionDynamicUpdate(type); + // we first check local memory + var _result = jQuery.jStorage.get('code_4_'+type+'_'+value, null); + if (_result) { + // now set the code + if (addCodeToEditor(_result, "jform_main_class_code", true)) { + selectionMemory[type][id] = value; + } + } else { + // now get the code + getClassStuff_server(value, type, 'getClassCode').done(function(result) { + if(result){ + // now set the code + if (addCodeToEditor(result, "jform_main_class_code", true)) { + selectionMemory[type][id] = value; + } + // add result to local memory + jQuery.jStorage.set('code_4_'+type+'_'+value, result, {TTL: expire}); + } + }); + } + } +} + +function addCodeToEditor(code_string, editor_id, merge){ + if (Joomla.editors.instances.hasOwnProperty(editor_id)) { + var old_code_string = Joomla.editors.instances[editor_id].getValue(); + if (merge && old_code_string.length > 0) { + // make sure not to load the same string twice + if (old_code_string.indexOf(code_string) == -1) { + Joomla.editors.instances[editor_id].setValue(old_code_string + "\n\n" + code_string); + return true; + } + } else { + Joomla.editors.instances[editor_id].setValue(code_string); + return true; + } + } else { + var old_code_string = jQuery('textarea#'+editor_id).val(); + if (merge && old_code_string.length > 0) { + // make sure not to load the same string twice + if (old_code_string.indexOf(code_string) == -1) { + jQuery('textarea#'+editor_id).val(old_code_string + "\n\n" + code_string); + return true; + } + } else { + jQuery('textarea#'+editor_id).val(code_string); + return true; + } + } + return false; +} + +function removeCodeFromEditor(code_string){ + if (Joomla.editors.instances.hasOwnProperty("jform_main_class_code")) { + var old_code_string = Joomla.editors.instances['jform_main_class_code'].getValue(); + if (old_code_string.length > 0) { + // make sure not to load the same string twice + if (old_code_string.indexOf(code_string) !== -1) { + // remove the code + Joomla.editors.instances['jform_main_class_code'].setValue(old_code_string.replace(code_string+"\n\n",'').replace("\n\n"+code_string,'').replace(code_string,'')); + return true; + } + } + } else { + var old_code_string = jQuery('textarea#jform_main_class_code').val(); + if (old_code_string.length > 0) { + // make sure not to load the same string twice + if (old_code_string.indexOf(code_string) !== -1) { + // remove the code + jQuery('textarea#jform_main_class_code').val(old_code_string.replace(code_string+"\n\n",'').replace("\n\n"+code_string,'').replace(code_string,'')); + return true; + } + } + } + return false; +} + +function selectionDynamicUpdate(type) { + selectionAvailable = {}; + selectionSelectedArray = {}; + selectionTrackerArray = {}; + var i; + for (i = 0; i < 70; i++) { // for now this is the number of field we should check + // build ID + var id_check = 'jform_'+type+'_selection'+'__'+type+'_selection'+i+'__'+type; + // first check if Id is on page as that not the same as the one currently calling + if (jQuery("#"+id_check).length && selectedIdRemoved[type] !== id_check) { + // build the selected array + var key = jQuery("#"+id_check+" option:selected").val(); + var text = jQuery("#"+id_check+" option:selected").text(); + selectionSelectedArray[key] = text; + // keep track of the value set + selectionTrackerArray[id_check] = key; + // clear the options out + jQuery("#"+id_check).find('option').remove().end(); + } + } + // now build the list to keep + jQuery.each( selectionActiveArray[type], function( prop, name ) { + if (!selectionSelectedArray.hasOwnProperty(prop)) { + selectionAvailable[prop] = name; + } + }); + // now add the lists back + jQuery.each( selectionTrackerArray, function( tId, tKey ) { + if (jQuery('#'+tId).length) { + jQuery('#'+tId).append(''); + jQuery.each( selectionAvailable, function( aKey, aValue ) { + jQuery('#'+tId).append(''); + }); + jQuery('#'+tId).val(tKey); + jQuery('#'+tId).trigger('liszt:updated'); + } + }); +} + +function rowWatcher() { + jQuery(document).on('subform-row-remove', function(event, row){ + // we first chck if this is a method call + var valid_call = jQuery(row.innerHTML).find('.method_selection_list').attr('id'); + var type_call = 'method'; + if (!isSet(valid_call)){ + // now lets see if this is a property call + var valid_call = jQuery(row.innerHTML).find('.property_selection_list').attr('id'); + var type_call = 'property'; + } + // so lets update selection if call valid + if (isSet(valid_call)){ + selectedIdRemoved[type_call] = valid_call; + selectionDynamicUpdate(type_call); + // also remove from code + var valid_value = jQuery(row.innerHTML).find('#' + valid_call + ' option:selected').val(); + if (valid_value === '') { + valid_value = selectionMemory[type_call][valid_call]; + } + // remove the code // we first check local memory + var _result = jQuery.jStorage.get('code_4_'+type_call+'_'+valid_value, null); + if (_result) { + // now remove the code + if (removeCodeFromEditor(_result)) { + selectionMemory[type_call][valid_call] = 0; + } + } else { + // now get the code + getClassStuff_server(valid_value, type_call, 'getClassCode').done(function(result) { + if(result){ + if (removeCodeFromEditor(result)) { + selectionMemory[type_call][valid_call] = 0;; + } + // add result to local memory + jQuery.jStorage.set('code_4_'+type_call+'_'+valid_value, result, {TTL: expire}); + } + }); + } + } + }); + jQuery(document).on('subform-row-add', function(event, row){ + // we first chck if this is a method call + var valid_call = jQuery(row.innerHTML).find('.method_selection_list').attr('id'); + var type_call = 'method'; + if (!isSet(valid_call)){ + // now lets see if this is a property call + var valid_call = jQuery(row.innerHTML).find('.property_selection_list').attr('id'); + var type_call = 'property'; + } + // so lets update selection if call valid + if (isSet(valid_call)){ + selectedIdRemoved[type_call] = 'not'; + selectionDynamicUpdate(type_call); + } + }); +} + +function propertyIsSet(prop, id, type) { + var i; + for (i = 0; i < 70; i++) { // for now this is the number of field we should check + // build ID + var id_check = 'jform_'+type+'_selection'+'__'+type+'_selection'+i+'__'+type; + // first check if Id is on page as that not the same as the one currently calling + if (jQuery("#"+id_check).length && id_check != id) { + // get the property value + var tmp = jQuery("#"+id_check+" option:selected").val(); + // now validate + if (tmp === prop) { + return true; + } + } + } + return false; +} + +function getLinked_server(type){ + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod); + if(token.length > 0 && type > 0){ + var request = token+'=1&type='+type; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'json', + data: request, + jsonp: false + }); +} + +function getLinked(){ + getLinked_server(1).done(function(result) { + if(result){ + jQuery('#display_linked_to').html(result); + } + }); +} + +function getEditCustomCodeButtons_server(id){ + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); + if(token.length > 0 && id > 0){ + var request = token+'=1&id='+id+'&return_here='+return_here; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'json', + data: request, + jsonp: false + }); +} + +function getEditCustomCodeButtons(){ + // get the id + id = jQuery("#jform_id").val(); + getEditCustomCodeButtons_server(id).done(function(result) { + if(isObject(result)){ + jQuery.each(result, function( field, buttons ) { + jQuery('
    ').insertBefore(".control-wrapper-"+ field); + jQuery.each(buttons, function( name, button ) { + jQuery(".control-customcode-buttons-"+field).append(button); + }); + }); + } + }) +} + +// check object is not empty +function isObject(obj) { + for(var prop in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop)) { + return true; + } + } + return false; +} diff --git a/admin/models/forms/joomla_plugin.xml b/admin/models/forms/joomla_plugin.xml new file mode 100644 index 000000000..0c5450730 --- /dev/null +++ b/admin/models/forms/joomla_plugin.xml @@ -0,0 +1,715 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    + \ No newline at end of file diff --git a/admin/models/forms/joomla_plugin_files_folders_urls.js b/admin/models/forms/joomla_plugin_files_folders_urls.js new file mode 100644 index 000000000..406de38ba --- /dev/null +++ b/admin/models/forms/joomla_plugin_files_folders_urls.js @@ -0,0 +1,11 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + + diff --git a/admin/models/forms/joomla_plugin_files_folders_urls.xml b/admin/models/forms/joomla_plugin_files_folders_urls.xml new file mode 100644 index 000000000..3361dce7a --- /dev/null +++ b/admin/models/forms/joomla_plugin_files_folders_urls.xml @@ -0,0 +1,390 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    + \ No newline at end of file diff --git a/admin/models/forms/joomla_plugin_group.js b/admin/models/forms/joomla_plugin_group.js new file mode 100644 index 000000000..406de38ba --- /dev/null +++ b/admin/models/forms/joomla_plugin_group.js @@ -0,0 +1,11 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + + diff --git a/admin/models/forms/joomla_plugin_group.xml b/admin/models/forms/joomla_plugin_group.xml new file mode 100644 index 000000000..2612c8858 --- /dev/null +++ b/admin/models/forms/joomla_plugin_group.xml @@ -0,0 +1,138 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    +
    \ No newline at end of file diff --git a/admin/models/forms/joomla_plugin_updates.js b/admin/models/forms/joomla_plugin_updates.js new file mode 100644 index 000000000..406de38ba --- /dev/null +++ b/admin/models/forms/joomla_plugin_updates.js @@ -0,0 +1,11 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + + diff --git a/admin/models/forms/joomla_plugin_updates.xml b/admin/models/forms/joomla_plugin_updates.xml new file mode 100644 index 000000000..0d8e6f710 --- /dev/null +++ b/admin/models/forms/joomla_plugin_updates.xml @@ -0,0 +1,181 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    + \ No newline at end of file diff --git a/admin/models/forms/language_translation.js b/admin/models/forms/language_translation.js index 393b31333..26c4bcace 100644 --- a/admin/models/forms/language_translation.js +++ b/admin/models/forms/language_translation.js @@ -23,7 +23,7 @@ function addData(result,where){ function addButton_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type='+type+'&size='+size; + var request = token+'=1&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/layout.js b/admin/models/forms/layout.js index 182ca629e..0144a82b9 100644 --- a/admin/models/forms/layout.js +++ b/admin/models/forms/layout.js @@ -8,75 +8,27 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -// Some Global Values -jform_vvvvvzfvzb_required = false; - // Initial Script jQuery(document).ready(function() { - var add_php_view_vvvvvzf = jQuery("#jform_add_php_view input[type='radio']:checked").val(); - vvvvvzf(add_php_view_vvvvvzf); + var add_php_view_vvvvwad = jQuery("#jform_add_php_view input[type='radio']:checked").val(); + vvvvwad(add_php_view_vvvvwad); }); -// the vvvvvzf function -function vvvvvzf(add_php_view_vvvvvzf) +// the vvvvwad function +function vvvvwad(add_php_view_vvvvwad) { // set the function logic - if (add_php_view_vvvvvzf == 1) + if (add_php_view_vvvvwad == 1) { jQuery('#jform_php_view-lbl').closest('.control-group').show(); - // add required attribute to php_view field - if (jform_vvvvvzfvzb_required) - { - updateFieldRequired('php_view',0); - jQuery('#jform_php_view').prop('required','required'); - jQuery('#jform_php_view').attr('aria-required',true); - jQuery('#jform_php_view').addClass('required'); - jform_vvvvvzfvzb_required = false; - } } else { jQuery('#jform_php_view-lbl').closest('.control-group').hide(); - // remove required attribute from php_view field - if (!jform_vvvvvzfvzb_required) - { - updateFieldRequired('php_view',1); - jQuery('#jform_php_view').removeAttr('required'); - jQuery('#jform_php_view').removeAttr('aria-required'); - jQuery('#jform_php_view').removeClass('required'); - jform_vvvvvzfvzb_required = true; - } } } -// update required fields -function updateFieldRequired(name,status) -{ - var not_required = jQuery('#jform_not_required').val(); - - if(status == 1) - { - if (isSet(not_required) && not_required != 0) - { - not_required = not_required+','+name; - } - else - { - not_required = ','+name; - } - } - else - { - if (isSet(not_required) && not_required != 0) - { - not_required = not_required.replace(','+name,''); - } - } - - jQuery('#jform_not_required').val(not_required); -} - // the isSet function function isSet(val) { @@ -94,9 +46,9 @@ jQuery(document).ready(function($) }); function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', @@ -133,9 +85,9 @@ function isObject(obj) { } function getSnippetDetails_server(snippetId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"); if(token.length > 0 && snippetId > 0){ - var request = 'token='+token+'&id='+snippetId; + var request = token+'=1&id='+snippetId; } return jQuery.ajax({ type: 'GET', @@ -182,9 +134,9 @@ function getSnippetDetails(id){ } function getDynamicValues_server(dynamicId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json"); if(token.length > 0 && dynamicId > 0){ - var request = 'token='+token+'&view=layout&id='+dynamicId; + var request = token+'=1&view=layout&id='+dynamicId; } return jQuery.ajax({ type: 'GET', @@ -209,9 +161,9 @@ function getDynamicValues(id){ } function getLayoutDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id; + var request = token+'=1&id='+id; } return jQuery.ajax({ type: 'GET', @@ -254,7 +206,7 @@ jQuery(document).ready(function($) function getSnippets_server(libraries){ var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&raw=true&format=json"; if(token.length > 0 && libraries.length > 0){ - var request = 'token='+token+'&libraries='+JSON.stringify(libraries); + var request = token+'=1&libraries='+JSON.stringify(libraries); } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/layout.xml b/admin/models/forms/layout.xml index 501f0fa0e..fc260118f 100644 --- a/admin/models/forms/layout.xml +++ b/admin/models/forms/layout.xml @@ -153,7 +153,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -192,7 +191,6 @@ syntax="html" editor="codemirror|none" filter="raw" - required="true" validate="code" /> diff --git a/admin/models/forms/library.js b/admin/models/forms/library.js index 6c3d5b0da..7208caba1 100644 --- a/admin/models/forms/library.js +++ b/admin/models/forms/library.js @@ -9,51 +9,51 @@ */ // Some Global Values -jform_vvvvwamwaa_required = false; -jform_vvvvwaswab_required = false; +jform_vvvvwbmvxj_required = false; +jform_vvvvwbsvxk_required = false; // Initial Script jQuery(document).ready(function() { - var how_vvvvwal = jQuery("#jform_how").val(); - vvvvwal(how_vvvvwal); + var how_vvvvwbl = jQuery("#jform_how").val(); + vvvvwbl(how_vvvvwbl); - var how_vvvvwam = jQuery("#jform_how").val(); - vvvvwam(how_vvvvwam); + var how_vvvvwbm = jQuery("#jform_how").val(); + vvvvwbm(how_vvvvwbm); - var how_vvvvwan = jQuery("#jform_how").val(); - vvvvwan(how_vvvvwan); + var how_vvvvwbn = jQuery("#jform_how").val(); + vvvvwbn(how_vvvvwbn); - var how_vvvvwao = jQuery("#jform_how").val(); - vvvvwao(how_vvvvwao); + var how_vvvvwbo = jQuery("#jform_how").val(); + vvvvwbo(how_vvvvwbo); - var how_vvvvwap = jQuery("#jform_how").val(); - vvvvwap(how_vvvvwap); + var how_vvvvwbp = jQuery("#jform_how").val(); + vvvvwbp(how_vvvvwbp); - var how_vvvvwaq = jQuery("#jform_how").val(); - vvvvwaq(how_vvvvwaq); + var how_vvvvwbq = jQuery("#jform_how").val(); + vvvvwbq(how_vvvvwbq); - var how_vvvvwar = jQuery("#jform_how").val(); - vvvvwar(how_vvvvwar); + var how_vvvvwbr = jQuery("#jform_how").val(); + vvvvwbr(how_vvvvwbr); - var type_vvvvwas = jQuery("#jform_type input[type='radio']:checked").val(); - vvvvwas(type_vvvvwas); + var type_vvvvwbs = jQuery("#jform_type input[type='radio']:checked").val(); + vvvvwbs(type_vvvvwbs); }); -// the vvvvwal function -function vvvvwal(how_vvvvwal) +// the vvvvwbl function +function vvvvwbl(how_vvvvwbl) { - if (isSet(how_vvvvwal) && how_vvvvwal.constructor !== Array) + if (isSet(how_vvvvwbl) && how_vvvvwbl.constructor !== Array) { - var temp_vvvvwal = how_vvvvwal; - var how_vvvvwal = []; - how_vvvvwal.push(temp_vvvvwal); + var temp_vvvvwbl = how_vvvvwbl; + var how_vvvvwbl = []; + how_vvvvwbl.push(temp_vvvvwbl); } - else if (!isSet(how_vvvvwal)) + else if (!isSet(how_vvvvwbl)) { - var how_vvvvwal = []; + var how_vvvvwbl = []; } - var how = how_vvvvwal.some(how_vvvvwal_SomeFunc); + var how = how_vvvvwbl.some(how_vvvvwbl_SomeFunc); // set this function logic @@ -67,31 +67,31 @@ function vvvvwal(how_vvvvwal) } } -// the vvvvwal Some function -function how_vvvvwal_SomeFunc(how_vvvvwal) +// the vvvvwbl Some function +function how_vvvvwbl_SomeFunc(how_vvvvwbl) { // set the function logic - if (how_vvvvwal == 2) + if (how_vvvvwbl == 2) { return true; } return false; } -// the vvvvwam function -function vvvvwam(how_vvvvwam) +// the vvvvwbm function +function vvvvwbm(how_vvvvwbm) { - if (isSet(how_vvvvwam) && how_vvvvwam.constructor !== Array) + if (isSet(how_vvvvwbm) && how_vvvvwbm.constructor !== Array) { - var temp_vvvvwam = how_vvvvwam; - var how_vvvvwam = []; - how_vvvvwam.push(temp_vvvvwam); + var temp_vvvvwbm = how_vvvvwbm; + var how_vvvvwbm = []; + how_vvvvwbm.push(temp_vvvvwbm); } - else if (!isSet(how_vvvvwam)) + else if (!isSet(how_vvvvwbm)) { - var how_vvvvwam = []; + var how_vvvvwbm = []; } - var how = how_vvvvwam.some(how_vvvvwam_SomeFunc); + var how = how_vvvvwbm.some(how_vvvvwbm_SomeFunc); // set this function logic @@ -99,55 +99,55 @@ function vvvvwam(how_vvvvwam) { jQuery('#jform_php_setdocument').closest('.control-group').show(); // add required attribute to php_setdocument field - if (jform_vvvvwamwaa_required) + if (jform_vvvvwbmvxj_required) { updateFieldRequired('php_setdocument',0); jQuery('#jform_php_setdocument').prop('required','required'); jQuery('#jform_php_setdocument').attr('aria-required',true); jQuery('#jform_php_setdocument').addClass('required'); - jform_vvvvwamwaa_required = false; + jform_vvvvwbmvxj_required = false; } } else { jQuery('#jform_php_setdocument').closest('.control-group').hide(); // remove required attribute from php_setdocument field - if (!jform_vvvvwamwaa_required) + if (!jform_vvvvwbmvxj_required) { updateFieldRequired('php_setdocument',1); jQuery('#jform_php_setdocument').removeAttr('required'); jQuery('#jform_php_setdocument').removeAttr('aria-required'); jQuery('#jform_php_setdocument').removeClass('required'); - jform_vvvvwamwaa_required = true; + jform_vvvvwbmvxj_required = true; } } } -// the vvvvwam Some function -function how_vvvvwam_SomeFunc(how_vvvvwam) +// the vvvvwbm Some function +function how_vvvvwbm_SomeFunc(how_vvvvwbm) { // set the function logic - if (how_vvvvwam == 3) + if (how_vvvvwbm == 3) { return true; } return false; } -// the vvvvwan function -function vvvvwan(how_vvvvwan) +// the vvvvwbn function +function vvvvwbn(how_vvvvwbn) { - if (isSet(how_vvvvwan) && how_vvvvwan.constructor !== Array) + if (isSet(how_vvvvwbn) && how_vvvvwbn.constructor !== Array) { - var temp_vvvvwan = how_vvvvwan; - var how_vvvvwan = []; - how_vvvvwan.push(temp_vvvvwan); + var temp_vvvvwbn = how_vvvvwbn; + var how_vvvvwbn = []; + how_vvvvwbn.push(temp_vvvvwbn); } - else if (!isSet(how_vvvvwan)) + else if (!isSet(how_vvvvwbn)) { - var how_vvvvwan = []; + var how_vvvvwbn = []; } - var how = how_vvvvwan.some(how_vvvvwan_SomeFunc); + var how = how_vvvvwbn.some(how_vvvvwbn_SomeFunc); // set this function logic @@ -161,31 +161,31 @@ function vvvvwan(how_vvvvwan) } } -// the vvvvwan Some function -function how_vvvvwan_SomeFunc(how_vvvvwan) +// the vvvvwbn Some function +function how_vvvvwbn_SomeFunc(how_vvvvwbn) { // set the function logic - if (how_vvvvwan == 2 || how_vvvvwan == 3) + if (how_vvvvwbn == 2 || how_vvvvwbn == 3) { return true; } return false; } -// the vvvvwao function -function vvvvwao(how_vvvvwao) +// the vvvvwbo function +function vvvvwbo(how_vvvvwbo) { - if (isSet(how_vvvvwao) && how_vvvvwao.constructor !== Array) + if (isSet(how_vvvvwbo) && how_vvvvwbo.constructor !== Array) { - var temp_vvvvwao = how_vvvvwao; - var how_vvvvwao = []; - how_vvvvwao.push(temp_vvvvwao); + var temp_vvvvwbo = how_vvvvwbo; + var how_vvvvwbo = []; + how_vvvvwbo.push(temp_vvvvwbo); } - else if (!isSet(how_vvvvwao)) + else if (!isSet(how_vvvvwbo)) { - var how_vvvvwao = []; + var how_vvvvwbo = []; } - var how = how_vvvvwao.some(how_vvvvwao_SomeFunc); + var how = how_vvvvwbo.some(how_vvvvwbo_SomeFunc); // set this function logic @@ -199,31 +199,31 @@ function vvvvwao(how_vvvvwao) } } -// the vvvvwao Some function -function how_vvvvwao_SomeFunc(how_vvvvwao) +// the vvvvwbo Some function +function how_vvvvwbo_SomeFunc(how_vvvvwbo) { // set the function logic - if (how_vvvvwao == 1 || how_vvvvwao == 2 || how_vvvvwao == 3) + if (how_vvvvwbo == 1 || how_vvvvwbo == 2 || how_vvvvwbo == 3) { return true; } return false; } -// the vvvvwap function -function vvvvwap(how_vvvvwap) +// the vvvvwbp function +function vvvvwbp(how_vvvvwbp) { - if (isSet(how_vvvvwap) && how_vvvvwap.constructor !== Array) + if (isSet(how_vvvvwbp) && how_vvvvwbp.constructor !== Array) { - var temp_vvvvwap = how_vvvvwap; - var how_vvvvwap = []; - how_vvvvwap.push(temp_vvvvwap); + var temp_vvvvwbp = how_vvvvwbp; + var how_vvvvwbp = []; + how_vvvvwbp.push(temp_vvvvwbp); } - else if (!isSet(how_vvvvwap)) + else if (!isSet(how_vvvvwbp)) { - var how_vvvvwap = []; + var how_vvvvwbp = []; } - var how = how_vvvvwap.some(how_vvvvwap_SomeFunc); + var how = how_vvvvwbp.some(how_vvvvwbp_SomeFunc); // set this function logic @@ -241,31 +241,31 @@ function vvvvwap(how_vvvvwap) } } -// the vvvvwap Some function -function how_vvvvwap_SomeFunc(how_vvvvwap) +// the vvvvwbp Some function +function how_vvvvwbp_SomeFunc(how_vvvvwbp) { // set the function logic - if (how_vvvvwap == 0) + if (how_vvvvwbp == 0) { return true; } return false; } -// the vvvvwaq function -function vvvvwaq(how_vvvvwaq) +// the vvvvwbq function +function vvvvwbq(how_vvvvwbq) { - if (isSet(how_vvvvwaq) && how_vvvvwaq.constructor !== Array) + if (isSet(how_vvvvwbq) && how_vvvvwbq.constructor !== Array) { - var temp_vvvvwaq = how_vvvvwaq; - var how_vvvvwaq = []; - how_vvvvwaq.push(temp_vvvvwaq); + var temp_vvvvwbq = how_vvvvwbq; + var how_vvvvwbq = []; + how_vvvvwbq.push(temp_vvvvwbq); } - else if (!isSet(how_vvvvwaq)) + else if (!isSet(how_vvvvwbq)) { - var how_vvvvwaq = []; + var how_vvvvwbq = []; } - var how = how_vvvvwaq.some(how_vvvvwaq_SomeFunc); + var how = how_vvvvwbq.some(how_vvvvwbq_SomeFunc); // set this function logic @@ -281,31 +281,31 @@ function vvvvwaq(how_vvvvwaq) } } -// the vvvvwaq Some function -function how_vvvvwaq_SomeFunc(how_vvvvwaq) +// the vvvvwbq Some function +function how_vvvvwbq_SomeFunc(how_vvvvwbq) { // set the function logic - if (how_vvvvwaq == 1) + if (how_vvvvwbq == 1) { return true; } return false; } -// the vvvvwar function -function vvvvwar(how_vvvvwar) +// the vvvvwbr function +function vvvvwbr(how_vvvvwbr) { - if (isSet(how_vvvvwar) && how_vvvvwar.constructor !== Array) + if (isSet(how_vvvvwbr) && how_vvvvwbr.constructor !== Array) { - var temp_vvvvwar = how_vvvvwar; - var how_vvvvwar = []; - how_vvvvwar.push(temp_vvvvwar); + var temp_vvvvwbr = how_vvvvwbr; + var how_vvvvwbr = []; + how_vvvvwbr.push(temp_vvvvwbr); } - else if (!isSet(how_vvvvwar)) + else if (!isSet(how_vvvvwbr)) { - var how_vvvvwar = []; + var how_vvvvwbr = []; } - var how = how_vvvvwar.some(how_vvvvwar_SomeFunc); + var how = how_vvvvwbr.some(how_vvvvwbr_SomeFunc); // set this function logic @@ -323,45 +323,45 @@ function vvvvwar(how_vvvvwar) } } -// the vvvvwar Some function -function how_vvvvwar_SomeFunc(how_vvvvwar) +// the vvvvwbr Some function +function how_vvvvwbr_SomeFunc(how_vvvvwbr) { // set the function logic - if (how_vvvvwar == 4) + if (how_vvvvwbr == 4) { return true; } return false; } -// the vvvvwas function -function vvvvwas(type_vvvvwas) +// the vvvvwbs function +function vvvvwbs(type_vvvvwbs) { // set the function logic - if (type_vvvvwas == 2) + if (type_vvvvwbs == 2) { jQuery('#jform_libraries').closest('.control-group').show(); // add required attribute to libraries field - if (jform_vvvvwaswab_required) + if (jform_vvvvwbsvxk_required) { updateFieldRequired('libraries',0); jQuery('#jform_libraries').prop('required','required'); jQuery('#jform_libraries').attr('aria-required',true); jQuery('#jform_libraries').addClass('required'); - jform_vvvvwaswab_required = false; + jform_vvvvwbsvxk_required = false; } } else { jQuery('#jform_libraries').closest('.control-group').hide(); // remove required attribute from libraries field - if (!jform_vvvvwaswab_required) + if (!jform_vvvvwbsvxk_required) { updateFieldRequired('libraries',1); jQuery('#jform_libraries').removeAttr('required'); jQuery('#jform_libraries').removeAttr('aria-required'); jQuery('#jform_libraries').removeClass('required'); - jform_vvvvwaswab_required = true; + jform_vvvvwbsvxk_required = true; } } } @@ -430,9 +430,9 @@ function getAjaxDisplay(type){ } function getAjaxDisplay_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&raw=true&vdm="+vastDevMod); if (token.length > 0 && type.length > 0) { - var request = 'token='+token+'&type=' + type; + var request = token+'=1&type=' + type; } return jQuery.ajax({ type: 'GET', @@ -444,9 +444,9 @@ function getAjaxDisplay_server(type){ } function getFieldSelectOptions_server(fieldId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json&raw=true"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json&raw=true"); if (token.length > 0 && fieldId > 0) { - var request = 'token='+token+'&id='+fieldId; + var request = token+'=1&id='+fieldId; } return jQuery.ajax({ type: 'GET', @@ -472,9 +472,9 @@ function getFieldSelectOptions(fieldKey){ } function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', @@ -513,7 +513,7 @@ function isObject(obj) { function addButtonID_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0 && size > 0){ - var request = 'token='+token+'&type='+type+'&size='+size; + var request = token+'=1&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -538,7 +538,7 @@ function addButtonID(type, where, size){ function addButton_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type='+type+'&size='+size; + var request = token+'=1&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -563,9 +563,9 @@ function addButton(type, where, size){ } function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type > 0){ - var request = 'token='+token+'&type='+type; + var request = token+'=1&type='+type; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/placeholder.js b/admin/models/forms/placeholder.js index 871f1b71d..a36ec605d 100644 --- a/admin/models/forms/placeholder.js +++ b/admin/models/forms/placeholder.js @@ -18,7 +18,6 @@ jQuery(document).ready(function() // check if this function name is taken checkPlaceholderName(placeholderName); }); - function setPlaceholderName(){ // noting for now (we may add more functionality later) } @@ -79,8 +78,8 @@ function placedin(placeholder, ide) { jQuery('#note-placedin-not').hide(); jQuery('#note-placedin-found').hide(); jQuery('#loading-placedin').show(); - var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p']; // if you update this, also update (below 15) & [customcode-codeUsedInHtmlNote]! - var targetNumber = 15; + var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t']; // if you update this, also update (below 19) & [customcode-codeUsedInHtmlNote]! + var targetNumber = 19; var run = 0; var placedinChecker = setInterval(function(){ var target = targets[run]; diff --git a/admin/models/forms/server.js b/admin/models/forms/server.js index 0a0f955ac..8eb578083 100644 --- a/admin/models/forms/server.js +++ b/admin/models/forms/server.js @@ -9,56 +9,56 @@ */ // Some Global Values -jform_vvvvwbpwas_required = false; -jform_vvvvwbpwat_required = false; -jform_vvvvwbpwau_required = false; -jform_vvvvwbpwav_required = false; -jform_vvvvwbpwaw_required = false; -jform_vvvvwbqwax_required = false; -jform_vvvvwbrway_required = false; -jform_vvvvwbtwaz_required = false; -jform_vvvvwbvwba_required = false; +jform_vvvvwcpvxx_required = false; +jform_vvvvwcpvxy_required = false; +jform_vvvvwcpvxz_required = false; +jform_vvvvwcpvya_required = false; +jform_vvvvwcpvyb_required = false; +jform_vvvvwcqvyc_required = false; +jform_vvvvwcrvyd_required = false; +jform_vvvvwctvye_required = false; +jform_vvvvwcvvyf_required = false; // Initial Script jQuery(document).ready(function() { - var protocol_vvvvwbp = jQuery("#jform_protocol").val(); - vvvvwbp(protocol_vvvvwbp); + var protocol_vvvvwcp = jQuery("#jform_protocol").val(); + vvvvwcp(protocol_vvvvwcp); - var protocol_vvvvwbq = jQuery("#jform_protocol").val(); - vvvvwbq(protocol_vvvvwbq); + var protocol_vvvvwcq = jQuery("#jform_protocol").val(); + vvvvwcq(protocol_vvvvwcq); - var protocol_vvvvwbr = jQuery("#jform_protocol").val(); - var authentication_vvvvwbr = jQuery("#jform_authentication").val(); - vvvvwbr(protocol_vvvvwbr,authentication_vvvvwbr); + var protocol_vvvvwcr = jQuery("#jform_protocol").val(); + var authentication_vvvvwcr = jQuery("#jform_authentication").val(); + vvvvwcr(protocol_vvvvwcr,authentication_vvvvwcr); - var protocol_vvvvwbt = jQuery("#jform_protocol").val(); - var authentication_vvvvwbt = jQuery("#jform_authentication").val(); - vvvvwbt(protocol_vvvvwbt,authentication_vvvvwbt); + var protocol_vvvvwct = jQuery("#jform_protocol").val(); + var authentication_vvvvwct = jQuery("#jform_authentication").val(); + vvvvwct(protocol_vvvvwct,authentication_vvvvwct); - var protocol_vvvvwbv = jQuery("#jform_protocol").val(); - var authentication_vvvvwbv = jQuery("#jform_authentication").val(); - vvvvwbv(protocol_vvvvwbv,authentication_vvvvwbv); + var protocol_vvvvwcv = jQuery("#jform_protocol").val(); + var authentication_vvvvwcv = jQuery("#jform_authentication").val(); + vvvvwcv(protocol_vvvvwcv,authentication_vvvvwcv); - var protocol_vvvvwbx = jQuery("#jform_protocol").val(); - var authentication_vvvvwbx = jQuery("#jform_authentication").val(); - vvvvwbx(protocol_vvvvwbx,authentication_vvvvwbx); + var protocol_vvvvwcx = jQuery("#jform_protocol").val(); + var authentication_vvvvwcx = jQuery("#jform_authentication").val(); + vvvvwcx(protocol_vvvvwcx,authentication_vvvvwcx); }); -// the vvvvwbp function -function vvvvwbp(protocol_vvvvwbp) +// the vvvvwcp function +function vvvvwcp(protocol_vvvvwcp) { - if (isSet(protocol_vvvvwbp) && protocol_vvvvwbp.constructor !== Array) + if (isSet(protocol_vvvvwcp) && protocol_vvvvwcp.constructor !== Array) { - var temp_vvvvwbp = protocol_vvvvwbp; - var protocol_vvvvwbp = []; - protocol_vvvvwbp.push(temp_vvvvwbp); + var temp_vvvvwcp = protocol_vvvvwcp; + var protocol_vvvvwcp = []; + protocol_vvvvwcp.push(temp_vvvvwcp); } - else if (!isSet(protocol_vvvvwbp)) + else if (!isSet(protocol_vvvvwcp)) { - var protocol_vvvvwbp = []; + var protocol_vvvvwcp = []; } - var protocol = protocol_vvvvwbp.some(protocol_vvvvwbp_SomeFunc); + var protocol = protocol_vvvvwcp.some(protocol_vvvvwcp_SomeFunc); // set this function logic @@ -66,137 +66,137 @@ function vvvvwbp(protocol_vvvvwbp) { jQuery('#jform_authentication').closest('.control-group').show(); // add required attribute to authentication field - if (jform_vvvvwbpwas_required) + if (jform_vvvvwcpvxx_required) { updateFieldRequired('authentication',0); jQuery('#jform_authentication').prop('required','required'); jQuery('#jform_authentication').attr('aria-required',true); jQuery('#jform_authentication').addClass('required'); - jform_vvvvwbpwas_required = false; + jform_vvvvwcpvxx_required = false; } jQuery('#jform_host').closest('.control-group').show(); // add required attribute to host field - if (jform_vvvvwbpwat_required) + if (jform_vvvvwcpvxy_required) { updateFieldRequired('host',0); jQuery('#jform_host').prop('required','required'); jQuery('#jform_host').attr('aria-required',true); jQuery('#jform_host').addClass('required'); - jform_vvvvwbpwat_required = false; + jform_vvvvwcpvxy_required = false; } jQuery('#jform_port').closest('.control-group').show(); // add required attribute to port field - if (jform_vvvvwbpwau_required) + if (jform_vvvvwcpvxz_required) { updateFieldRequired('port',0); jQuery('#jform_port').prop('required','required'); jQuery('#jform_port').attr('aria-required',true); jQuery('#jform_port').addClass('required'); - jform_vvvvwbpwau_required = false; + jform_vvvvwcpvxz_required = false; } jQuery('#jform_path').closest('.control-group').show(); // add required attribute to path field - if (jform_vvvvwbpwav_required) + if (jform_vvvvwcpvya_required) { updateFieldRequired('path',0); jQuery('#jform_path').prop('required','required'); jQuery('#jform_path').attr('aria-required',true); jQuery('#jform_path').addClass('required'); - jform_vvvvwbpwav_required = false; + jform_vvvvwcpvya_required = false; } jQuery('.note_ssh_security').closest('.control-group').show(); jQuery('#jform_username').closest('.control-group').show(); // add required attribute to username field - if (jform_vvvvwbpwaw_required) + if (jform_vvvvwcpvyb_required) { updateFieldRequired('username',0); jQuery('#jform_username').prop('required','required'); jQuery('#jform_username').attr('aria-required',true); jQuery('#jform_username').addClass('required'); - jform_vvvvwbpwaw_required = false; + jform_vvvvwcpvyb_required = false; } } else { jQuery('#jform_authentication').closest('.control-group').hide(); // remove required attribute from authentication field - if (!jform_vvvvwbpwas_required) + if (!jform_vvvvwcpvxx_required) { updateFieldRequired('authentication',1); jQuery('#jform_authentication').removeAttr('required'); jQuery('#jform_authentication').removeAttr('aria-required'); jQuery('#jform_authentication').removeClass('required'); - jform_vvvvwbpwas_required = true; + jform_vvvvwcpvxx_required = true; } jQuery('#jform_host').closest('.control-group').hide(); // remove required attribute from host field - if (!jform_vvvvwbpwat_required) + if (!jform_vvvvwcpvxy_required) { updateFieldRequired('host',1); jQuery('#jform_host').removeAttr('required'); jQuery('#jform_host').removeAttr('aria-required'); jQuery('#jform_host').removeClass('required'); - jform_vvvvwbpwat_required = true; + jform_vvvvwcpvxy_required = true; } jQuery('#jform_port').closest('.control-group').hide(); // remove required attribute from port field - if (!jform_vvvvwbpwau_required) + if (!jform_vvvvwcpvxz_required) { updateFieldRequired('port',1); jQuery('#jform_port').removeAttr('required'); jQuery('#jform_port').removeAttr('aria-required'); jQuery('#jform_port').removeClass('required'); - jform_vvvvwbpwau_required = true; + jform_vvvvwcpvxz_required = true; } jQuery('#jform_path').closest('.control-group').hide(); // remove required attribute from path field - if (!jform_vvvvwbpwav_required) + if (!jform_vvvvwcpvya_required) { updateFieldRequired('path',1); jQuery('#jform_path').removeAttr('required'); jQuery('#jform_path').removeAttr('aria-required'); jQuery('#jform_path').removeClass('required'); - jform_vvvvwbpwav_required = true; + jform_vvvvwcpvya_required = true; } jQuery('.note_ssh_security').closest('.control-group').hide(); jQuery('#jform_username').closest('.control-group').hide(); // remove required attribute from username field - if (!jform_vvvvwbpwaw_required) + if (!jform_vvvvwcpvyb_required) { updateFieldRequired('username',1); jQuery('#jform_username').removeAttr('required'); jQuery('#jform_username').removeAttr('aria-required'); jQuery('#jform_username').removeClass('required'); - jform_vvvvwbpwaw_required = true; + jform_vvvvwcpvyb_required = true; } } } -// the vvvvwbp Some function -function protocol_vvvvwbp_SomeFunc(protocol_vvvvwbp) +// the vvvvwcp Some function +function protocol_vvvvwcp_SomeFunc(protocol_vvvvwcp) { // set the function logic - if (protocol_vvvvwbp == 2) + if (protocol_vvvvwcp == 2) { return true; } return false; } -// the vvvvwbq function -function vvvvwbq(protocol_vvvvwbq) +// the vvvvwcq function +function vvvvwcq(protocol_vvvvwcq) { - if (isSet(protocol_vvvvwbq) && protocol_vvvvwbq.constructor !== Array) + if (isSet(protocol_vvvvwcq) && protocol_vvvvwcq.constructor !== Array) { - var temp_vvvvwbq = protocol_vvvvwbq; - var protocol_vvvvwbq = []; - protocol_vvvvwbq.push(temp_vvvvwbq); + var temp_vvvvwcq = protocol_vvvvwcq; + var protocol_vvvvwcq = []; + protocol_vvvvwcq.push(temp_vvvvwcq); } - else if (!isSet(protocol_vvvvwbq)) + else if (!isSet(protocol_vvvvwcq)) { - var protocol_vvvvwbq = []; + var protocol_vvvvwcq = []; } - var protocol = protocol_vvvvwbq.some(protocol_vvvvwbq_SomeFunc); + var protocol = protocol_vvvvwcq.some(protocol_vvvvwcq_SomeFunc); // set this function logic @@ -205,13 +205,13 @@ function vvvvwbq(protocol_vvvvwbq) jQuery('.note_ftp_signature').closest('.control-group').show(); jQuery('#jform_signature').closest('.control-group').show(); // add required attribute to signature field - if (jform_vvvvwbqwax_required) + if (jform_vvvvwcqvyc_required) { updateFieldRequired('signature',0); jQuery('#jform_signature').prop('required','required'); jQuery('#jform_signature').attr('aria-required',true); jQuery('#jform_signature').addClass('required'); - jform_vvvvwbqwax_required = false; + jform_vvvvwcqvyc_required = false; } } else @@ -219,54 +219,54 @@ function vvvvwbq(protocol_vvvvwbq) jQuery('.note_ftp_signature').closest('.control-group').hide(); jQuery('#jform_signature').closest('.control-group').hide(); // remove required attribute from signature field - if (!jform_vvvvwbqwax_required) + if (!jform_vvvvwcqvyc_required) { updateFieldRequired('signature',1); jQuery('#jform_signature').removeAttr('required'); jQuery('#jform_signature').removeAttr('aria-required'); jQuery('#jform_signature').removeClass('required'); - jform_vvvvwbqwax_required = true; + jform_vvvvwcqvyc_required = true; } } } -// the vvvvwbq Some function -function protocol_vvvvwbq_SomeFunc(protocol_vvvvwbq) +// the vvvvwcq Some function +function protocol_vvvvwcq_SomeFunc(protocol_vvvvwcq) { // set the function logic - if (protocol_vvvvwbq == 1) + if (protocol_vvvvwcq == 1) { return true; } return false; } -// the vvvvwbr function -function vvvvwbr(protocol_vvvvwbr,authentication_vvvvwbr) +// the vvvvwcr function +function vvvvwcr(protocol_vvvvwcr,authentication_vvvvwcr) { - if (isSet(protocol_vvvvwbr) && protocol_vvvvwbr.constructor !== Array) + if (isSet(protocol_vvvvwcr) && protocol_vvvvwcr.constructor !== Array) { - var temp_vvvvwbr = protocol_vvvvwbr; - var protocol_vvvvwbr = []; - protocol_vvvvwbr.push(temp_vvvvwbr); + var temp_vvvvwcr = protocol_vvvvwcr; + var protocol_vvvvwcr = []; + protocol_vvvvwcr.push(temp_vvvvwcr); } - else if (!isSet(protocol_vvvvwbr)) + else if (!isSet(protocol_vvvvwcr)) { - var protocol_vvvvwbr = []; + var protocol_vvvvwcr = []; } - var protocol = protocol_vvvvwbr.some(protocol_vvvvwbr_SomeFunc); + var protocol = protocol_vvvvwcr.some(protocol_vvvvwcr_SomeFunc); - if (isSet(authentication_vvvvwbr) && authentication_vvvvwbr.constructor !== Array) + if (isSet(authentication_vvvvwcr) && authentication_vvvvwcr.constructor !== Array) { - var temp_vvvvwbr = authentication_vvvvwbr; - var authentication_vvvvwbr = []; - authentication_vvvvwbr.push(temp_vvvvwbr); + var temp_vvvvwcr = authentication_vvvvwcr; + var authentication_vvvvwcr = []; + authentication_vvvvwcr.push(temp_vvvvwcr); } - else if (!isSet(authentication_vvvvwbr)) + else if (!isSet(authentication_vvvvwcr)) { - var authentication_vvvvwbr = []; + var authentication_vvvvwcr = []; } - var authentication = authentication_vvvvwbr.some(authentication_vvvvwbr_SomeFunc); + var authentication = authentication_vvvvwcr.some(authentication_vvvvwcr_SomeFunc); // set this function logic @@ -274,78 +274,78 @@ function vvvvwbr(protocol_vvvvwbr,authentication_vvvvwbr) { jQuery('#jform_password').closest('.control-group').show(); // add required attribute to password field - if (jform_vvvvwbrway_required) + if (jform_vvvvwcrvyd_required) { updateFieldRequired('password',0); jQuery('#jform_password').prop('required','required'); jQuery('#jform_password').attr('aria-required',true); jQuery('#jform_password').addClass('required'); - jform_vvvvwbrway_required = false; + jform_vvvvwcrvyd_required = false; } } else { jQuery('#jform_password').closest('.control-group').hide(); // remove required attribute from password field - if (!jform_vvvvwbrway_required) + if (!jform_vvvvwcrvyd_required) { updateFieldRequired('password',1); jQuery('#jform_password').removeAttr('required'); jQuery('#jform_password').removeAttr('aria-required'); jQuery('#jform_password').removeClass('required'); - jform_vvvvwbrway_required = true; + jform_vvvvwcrvyd_required = true; } } } -// the vvvvwbr Some function -function protocol_vvvvwbr_SomeFunc(protocol_vvvvwbr) +// the vvvvwcr Some function +function protocol_vvvvwcr_SomeFunc(protocol_vvvvwcr) { // set the function logic - if (protocol_vvvvwbr == 2) + if (protocol_vvvvwcr == 2) { return true; } return false; } -// the vvvvwbr Some function -function authentication_vvvvwbr_SomeFunc(authentication_vvvvwbr) +// the vvvvwcr Some function +function authentication_vvvvwcr_SomeFunc(authentication_vvvvwcr) { // set the function logic - if (authentication_vvvvwbr == 1 || authentication_vvvvwbr == 3 || authentication_vvvvwbr == 5) + if (authentication_vvvvwcr == 1 || authentication_vvvvwcr == 3 || authentication_vvvvwcr == 5) { return true; } return false; } -// the vvvvwbt function -function vvvvwbt(protocol_vvvvwbt,authentication_vvvvwbt) +// the vvvvwct function +function vvvvwct(protocol_vvvvwct,authentication_vvvvwct) { - if (isSet(protocol_vvvvwbt) && protocol_vvvvwbt.constructor !== Array) + if (isSet(protocol_vvvvwct) && protocol_vvvvwct.constructor !== Array) { - var temp_vvvvwbt = protocol_vvvvwbt; - var protocol_vvvvwbt = []; - protocol_vvvvwbt.push(temp_vvvvwbt); + var temp_vvvvwct = protocol_vvvvwct; + var protocol_vvvvwct = []; + protocol_vvvvwct.push(temp_vvvvwct); } - else if (!isSet(protocol_vvvvwbt)) + else if (!isSet(protocol_vvvvwct)) { - var protocol_vvvvwbt = []; + var protocol_vvvvwct = []; } - var protocol = protocol_vvvvwbt.some(protocol_vvvvwbt_SomeFunc); + var protocol = protocol_vvvvwct.some(protocol_vvvvwct_SomeFunc); - if (isSet(authentication_vvvvwbt) && authentication_vvvvwbt.constructor !== Array) + if (isSet(authentication_vvvvwct) && authentication_vvvvwct.constructor !== Array) { - var temp_vvvvwbt = authentication_vvvvwbt; - var authentication_vvvvwbt = []; - authentication_vvvvwbt.push(temp_vvvvwbt); + var temp_vvvvwct = authentication_vvvvwct; + var authentication_vvvvwct = []; + authentication_vvvvwct.push(temp_vvvvwct); } - else if (!isSet(authentication_vvvvwbt)) + else if (!isSet(authentication_vvvvwct)) { - var authentication_vvvvwbt = []; + var authentication_vvvvwct = []; } - var authentication = authentication_vvvvwbt.some(authentication_vvvvwbt_SomeFunc); + var authentication = authentication_vvvvwct.some(authentication_vvvvwct_SomeFunc); // set this function logic @@ -353,78 +353,78 @@ function vvvvwbt(protocol_vvvvwbt,authentication_vvvvwbt) { jQuery('#jform_private').closest('.control-group').show(); // add required attribute to private field - if (jform_vvvvwbtwaz_required) + if (jform_vvvvwctvye_required) { updateFieldRequired('private',0); jQuery('#jform_private').prop('required','required'); jQuery('#jform_private').attr('aria-required',true); jQuery('#jform_private').addClass('required'); - jform_vvvvwbtwaz_required = false; + jform_vvvvwctvye_required = false; } } else { jQuery('#jform_private').closest('.control-group').hide(); // remove required attribute from private field - if (!jform_vvvvwbtwaz_required) + if (!jform_vvvvwctvye_required) { updateFieldRequired('private',1); jQuery('#jform_private').removeAttr('required'); jQuery('#jform_private').removeAttr('aria-required'); jQuery('#jform_private').removeClass('required'); - jform_vvvvwbtwaz_required = true; + jform_vvvvwctvye_required = true; } } } -// the vvvvwbt Some function -function protocol_vvvvwbt_SomeFunc(protocol_vvvvwbt) +// the vvvvwct Some function +function protocol_vvvvwct_SomeFunc(protocol_vvvvwct) { // set the function logic - if (protocol_vvvvwbt == 2) + if (protocol_vvvvwct == 2) { return true; } return false; } -// the vvvvwbt Some function -function authentication_vvvvwbt_SomeFunc(authentication_vvvvwbt) +// the vvvvwct Some function +function authentication_vvvvwct_SomeFunc(authentication_vvvvwct) { // set the function logic - if (authentication_vvvvwbt == 2 || authentication_vvvvwbt == 3) + if (authentication_vvvvwct == 2 || authentication_vvvvwct == 3) { return true; } return false; } -// the vvvvwbv function -function vvvvwbv(protocol_vvvvwbv,authentication_vvvvwbv) +// the vvvvwcv function +function vvvvwcv(protocol_vvvvwcv,authentication_vvvvwcv) { - if (isSet(protocol_vvvvwbv) && protocol_vvvvwbv.constructor !== Array) + if (isSet(protocol_vvvvwcv) && protocol_vvvvwcv.constructor !== Array) { - var temp_vvvvwbv = protocol_vvvvwbv; - var protocol_vvvvwbv = []; - protocol_vvvvwbv.push(temp_vvvvwbv); + var temp_vvvvwcv = protocol_vvvvwcv; + var protocol_vvvvwcv = []; + protocol_vvvvwcv.push(temp_vvvvwcv); } - else if (!isSet(protocol_vvvvwbv)) + else if (!isSet(protocol_vvvvwcv)) { - var protocol_vvvvwbv = []; + var protocol_vvvvwcv = []; } - var protocol = protocol_vvvvwbv.some(protocol_vvvvwbv_SomeFunc); + var protocol = protocol_vvvvwcv.some(protocol_vvvvwcv_SomeFunc); - if (isSet(authentication_vvvvwbv) && authentication_vvvvwbv.constructor !== Array) + if (isSet(authentication_vvvvwcv) && authentication_vvvvwcv.constructor !== Array) { - var temp_vvvvwbv = authentication_vvvvwbv; - var authentication_vvvvwbv = []; - authentication_vvvvwbv.push(temp_vvvvwbv); + var temp_vvvvwcv = authentication_vvvvwcv; + var authentication_vvvvwcv = []; + authentication_vvvvwcv.push(temp_vvvvwcv); } - else if (!isSet(authentication_vvvvwbv)) + else if (!isSet(authentication_vvvvwcv)) { - var authentication_vvvvwbv = []; + var authentication_vvvvwcv = []; } - var authentication = authentication_vvvvwbv.some(authentication_vvvvwbv_SomeFunc); + var authentication = authentication_vvvvwcv.some(authentication_vvvvwcv_SomeFunc); // set this function logic @@ -432,78 +432,78 @@ function vvvvwbv(protocol_vvvvwbv,authentication_vvvvwbv) { jQuery('#jform_private_key').closest('.control-group').show(); // add required attribute to private_key field - if (jform_vvvvwbvwba_required) + if (jform_vvvvwcvvyf_required) { updateFieldRequired('private_key',0); jQuery('#jform_private_key').prop('required','required'); jQuery('#jform_private_key').attr('aria-required',true); jQuery('#jform_private_key').addClass('required'); - jform_vvvvwbvwba_required = false; + jform_vvvvwcvvyf_required = false; } } else { jQuery('#jform_private_key').closest('.control-group').hide(); // remove required attribute from private_key field - if (!jform_vvvvwbvwba_required) + if (!jform_vvvvwcvvyf_required) { updateFieldRequired('private_key',1); jQuery('#jform_private_key').removeAttr('required'); jQuery('#jform_private_key').removeAttr('aria-required'); jQuery('#jform_private_key').removeClass('required'); - jform_vvvvwbvwba_required = true; + jform_vvvvwcvvyf_required = true; } } } -// the vvvvwbv Some function -function protocol_vvvvwbv_SomeFunc(protocol_vvvvwbv) +// the vvvvwcv Some function +function protocol_vvvvwcv_SomeFunc(protocol_vvvvwcv) { // set the function logic - if (protocol_vvvvwbv == 2) + if (protocol_vvvvwcv == 2) { return true; } return false; } -// the vvvvwbv Some function -function authentication_vvvvwbv_SomeFunc(authentication_vvvvwbv) +// the vvvvwcv Some function +function authentication_vvvvwcv_SomeFunc(authentication_vvvvwcv) { // set the function logic - if (authentication_vvvvwbv == 4 || authentication_vvvvwbv == 5) + if (authentication_vvvvwcv == 4 || authentication_vvvvwcv == 5) { return true; } return false; } -// the vvvvwbx function -function vvvvwbx(protocol_vvvvwbx,authentication_vvvvwbx) +// the vvvvwcx function +function vvvvwcx(protocol_vvvvwcx,authentication_vvvvwcx) { - if (isSet(protocol_vvvvwbx) && protocol_vvvvwbx.constructor !== Array) + if (isSet(protocol_vvvvwcx) && protocol_vvvvwcx.constructor !== Array) { - var temp_vvvvwbx = protocol_vvvvwbx; - var protocol_vvvvwbx = []; - protocol_vvvvwbx.push(temp_vvvvwbx); + var temp_vvvvwcx = protocol_vvvvwcx; + var protocol_vvvvwcx = []; + protocol_vvvvwcx.push(temp_vvvvwcx); } - else if (!isSet(protocol_vvvvwbx)) + else if (!isSet(protocol_vvvvwcx)) { - var protocol_vvvvwbx = []; + var protocol_vvvvwcx = []; } - var protocol = protocol_vvvvwbx.some(protocol_vvvvwbx_SomeFunc); + var protocol = protocol_vvvvwcx.some(protocol_vvvvwcx_SomeFunc); - if (isSet(authentication_vvvvwbx) && authentication_vvvvwbx.constructor !== Array) + if (isSet(authentication_vvvvwcx) && authentication_vvvvwcx.constructor !== Array) { - var temp_vvvvwbx = authentication_vvvvwbx; - var authentication_vvvvwbx = []; - authentication_vvvvwbx.push(temp_vvvvwbx); + var temp_vvvvwcx = authentication_vvvvwcx; + var authentication_vvvvwcx = []; + authentication_vvvvwcx.push(temp_vvvvwcx); } - else if (!isSet(authentication_vvvvwbx)) + else if (!isSet(authentication_vvvvwcx)) { - var authentication_vvvvwbx = []; + var authentication_vvvvwcx = []; } - var authentication = authentication_vvvvwbx.some(authentication_vvvvwbx_SomeFunc); + var authentication = authentication_vvvvwcx.some(authentication_vvvvwcx_SomeFunc); // set this function logic @@ -517,22 +517,22 @@ function vvvvwbx(protocol_vvvvwbx,authentication_vvvvwbx) } } -// the vvvvwbx Some function -function protocol_vvvvwbx_SomeFunc(protocol_vvvvwbx) +// the vvvvwcx Some function +function protocol_vvvvwcx_SomeFunc(protocol_vvvvwcx) { // set the function logic - if (protocol_vvvvwbx == 2) + if (protocol_vvvvwcx == 2) { return true; } return false; } -// the vvvvwbx Some function -function authentication_vvvvwbx_SomeFunc(authentication_vvvvwbx) +// the vvvvwcx Some function +function authentication_vvvvwcx_SomeFunc(authentication_vvvvwcx) { // set the function logic - if (authentication_vvvvwbx == 2 || authentication_vvvvwbx == 3 || authentication_vvvvwbx == 4 || authentication_vvvvwbx == 5) + if (authentication_vvvvwcx == 2 || authentication_vvvvwcx == 3 || authentication_vvvvwcx == 4 || authentication_vvvvwcx == 5) { return true; } diff --git a/admin/models/forms/site_view.js b/admin/models/forms/site_view.js index 815d76d84..a21c99b01 100644 --- a/admin/models/forms/site_view.js +++ b/admin/models/forms/site_view.js @@ -8,414 +8,203 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -// Some Global Values -jform_vvvvvytvyp_required = false; -jform_vvvvvyuvyq_required = false; -jform_vvvvvyvvyr_required = false; -jform_vvvvvywvys_required = false; -jform_vvvvvyxvyt_required = false; -jform_vvvvvyyvyu_required = false; -jform_vvvvvyzvyv_required = false; -jform_vvvvvzavyw_required = false; -jform_vvvvvzbvyx_required = false; -jform_vvvvvzcvyy_required = false; -jform_vvvvvzcvyz_required = false; - // Initial Script jQuery(document).ready(function() { - var add_php_view_vvvvvyt = jQuery("#jform_add_php_view input[type='radio']:checked").val(); - vvvvvyt(add_php_view_vvvvvyt); + var add_php_view_vvvvvzr = jQuery("#jform_add_php_view input[type='radio']:checked").val(); + vvvvvzr(add_php_view_vvvvvzr); - var add_php_jview_display_vvvvvyu = jQuery("#jform_add_php_jview_display input[type='radio']:checked").val(); - vvvvvyu(add_php_jview_display_vvvvvyu); + var add_php_jview_display_vvvvvzs = jQuery("#jform_add_php_jview_display input[type='radio']:checked").val(); + vvvvvzs(add_php_jview_display_vvvvvzs); - var add_php_jview_vvvvvyv = jQuery("#jform_add_php_jview input[type='radio']:checked").val(); - vvvvvyv(add_php_jview_vvvvvyv); + var add_php_jview_vvvvvzt = jQuery("#jform_add_php_jview input[type='radio']:checked").val(); + vvvvvzt(add_php_jview_vvvvvzt); - var add_php_document_vvvvvyw = jQuery("#jform_add_php_document input[type='radio']:checked").val(); - vvvvvyw(add_php_document_vvvvvyw); + var add_php_document_vvvvvzu = jQuery("#jform_add_php_document input[type='radio']:checked").val(); + vvvvvzu(add_php_document_vvvvvzu); - var add_css_document_vvvvvyx = jQuery("#jform_add_css_document input[type='radio']:checked").val(); - vvvvvyx(add_css_document_vvvvvyx); + var add_css_document_vvvvvzv = jQuery("#jform_add_css_document input[type='radio']:checked").val(); + vvvvvzv(add_css_document_vvvvvzv); - var add_javascript_file_vvvvvyy = jQuery("#jform_add_javascript_file input[type='radio']:checked").val(); - vvvvvyy(add_javascript_file_vvvvvyy); + var add_javascript_file_vvvvvzw = jQuery("#jform_add_javascript_file input[type='radio']:checked").val(); + vvvvvzw(add_javascript_file_vvvvvzw); - var add_js_document_vvvvvyz = jQuery("#jform_add_js_document input[type='radio']:checked").val(); - vvvvvyz(add_js_document_vvvvvyz); + var add_js_document_vvvvvzx = jQuery("#jform_add_js_document input[type='radio']:checked").val(); + vvvvvzx(add_js_document_vvvvvzx); - var add_css_vvvvvza = jQuery("#jform_add_css input[type='radio']:checked").val(); - vvvvvza(add_css_vvvvvza); + var add_css_vvvvvzy = jQuery("#jform_add_css input[type='radio']:checked").val(); + vvvvvzy(add_css_vvvvvzy); - var add_php_ajax_vvvvvzb = jQuery("#jform_add_php_ajax input[type='radio']:checked").val(); - vvvvvzb(add_php_ajax_vvvvvzb); + var add_php_ajax_vvvvvzz = jQuery("#jform_add_php_ajax input[type='radio']:checked").val(); + vvvvvzz(add_php_ajax_vvvvvzz); - var add_custom_button_vvvvvzc = jQuery("#jform_add_custom_button input[type='radio']:checked").val(); - vvvvvzc(add_custom_button_vvvvvzc); + var add_custom_button_vvvvwaa = jQuery("#jform_add_custom_button input[type='radio']:checked").val(); + vvvvwaa(add_custom_button_vvvvwaa); - var button_position_vvvvvzd = jQuery("#jform_button_position").val(); - vvvvvzd(button_position_vvvvvzd); + var button_position_vvvvwab = jQuery("#jform_button_position").val(); + vvvvwab(button_position_vvvvwab); }); -// the vvvvvyt function -function vvvvvyt(add_php_view_vvvvvyt) +// the vvvvvzr function +function vvvvvzr(add_php_view_vvvvvzr) { // set the function logic - if (add_php_view_vvvvvyt == 1) + if (add_php_view_vvvvvzr == 1) { jQuery('#jform_php_view-lbl').closest('.control-group').show(); - // add required attribute to php_view field - if (jform_vvvvvytvyp_required) - { - updateFieldRequired('php_view',0); - jQuery('#jform_php_view').prop('required','required'); - jQuery('#jform_php_view').attr('aria-required',true); - jQuery('#jform_php_view').addClass('required'); - jform_vvvvvytvyp_required = false; - } } else { jQuery('#jform_php_view-lbl').closest('.control-group').hide(); - // remove required attribute from php_view field - if (!jform_vvvvvytvyp_required) - { - updateFieldRequired('php_view',1); - jQuery('#jform_php_view').removeAttr('required'); - jQuery('#jform_php_view').removeAttr('aria-required'); - jQuery('#jform_php_view').removeClass('required'); - jform_vvvvvytvyp_required = true; - } } } -// the vvvvvyu function -function vvvvvyu(add_php_jview_display_vvvvvyu) +// the vvvvvzs function +function vvvvvzs(add_php_jview_display_vvvvvzs) { // set the function logic - if (add_php_jview_display_vvvvvyu == 1) + if (add_php_jview_display_vvvvvzs == 1) { jQuery('#jform_php_jview_display-lbl').closest('.control-group').show(); - // add required attribute to php_jview_display field - if (jform_vvvvvyuvyq_required) - { - updateFieldRequired('php_jview_display',0); - jQuery('#jform_php_jview_display').prop('required','required'); - jQuery('#jform_php_jview_display').attr('aria-required',true); - jQuery('#jform_php_jview_display').addClass('required'); - jform_vvvvvyuvyq_required = false; - } } else { jQuery('#jform_php_jview_display-lbl').closest('.control-group').hide(); - // remove required attribute from php_jview_display field - if (!jform_vvvvvyuvyq_required) - { - updateFieldRequired('php_jview_display',1); - jQuery('#jform_php_jview_display').removeAttr('required'); - jQuery('#jform_php_jview_display').removeAttr('aria-required'); - jQuery('#jform_php_jview_display').removeClass('required'); - jform_vvvvvyuvyq_required = true; - } } } -// the vvvvvyv function -function vvvvvyv(add_php_jview_vvvvvyv) +// the vvvvvzt function +function vvvvvzt(add_php_jview_vvvvvzt) { // set the function logic - if (add_php_jview_vvvvvyv == 1) + if (add_php_jview_vvvvvzt == 1) { jQuery('#jform_php_jview-lbl').closest('.control-group').show(); - // add required attribute to php_jview field - if (jform_vvvvvyvvyr_required) - { - updateFieldRequired('php_jview',0); - jQuery('#jform_php_jview').prop('required','required'); - jQuery('#jform_php_jview').attr('aria-required',true); - jQuery('#jform_php_jview').addClass('required'); - jform_vvvvvyvvyr_required = false; - } } else { jQuery('#jform_php_jview-lbl').closest('.control-group').hide(); - // remove required attribute from php_jview field - if (!jform_vvvvvyvvyr_required) - { - updateFieldRequired('php_jview',1); - jQuery('#jform_php_jview').removeAttr('required'); - jQuery('#jform_php_jview').removeAttr('aria-required'); - jQuery('#jform_php_jview').removeClass('required'); - jform_vvvvvyvvyr_required = true; - } } } -// the vvvvvyw function -function vvvvvyw(add_php_document_vvvvvyw) +// the vvvvvzu function +function vvvvvzu(add_php_document_vvvvvzu) { // set the function logic - if (add_php_document_vvvvvyw == 1) + if (add_php_document_vvvvvzu == 1) { jQuery('#jform_php_document-lbl').closest('.control-group').show(); - // add required attribute to php_document field - if (jform_vvvvvywvys_required) - { - updateFieldRequired('php_document',0); - jQuery('#jform_php_document').prop('required','required'); - jQuery('#jform_php_document').attr('aria-required',true); - jQuery('#jform_php_document').addClass('required'); - jform_vvvvvywvys_required = false; - } } else { jQuery('#jform_php_document-lbl').closest('.control-group').hide(); - // remove required attribute from php_document field - if (!jform_vvvvvywvys_required) - { - updateFieldRequired('php_document',1); - jQuery('#jform_php_document').removeAttr('required'); - jQuery('#jform_php_document').removeAttr('aria-required'); - jQuery('#jform_php_document').removeClass('required'); - jform_vvvvvywvys_required = true; - } } } -// the vvvvvyx function -function vvvvvyx(add_css_document_vvvvvyx) +// the vvvvvzv function +function vvvvvzv(add_css_document_vvvvvzv) { // set the function logic - if (add_css_document_vvvvvyx == 1) + if (add_css_document_vvvvvzv == 1) { jQuery('#jform_css_document-lbl').closest('.control-group').show(); - // add required attribute to css_document field - if (jform_vvvvvyxvyt_required) - { - updateFieldRequired('css_document',0); - jQuery('#jform_css_document').prop('required','required'); - jQuery('#jform_css_document').attr('aria-required',true); - jQuery('#jform_css_document').addClass('required'); - jform_vvvvvyxvyt_required = false; - } } else { jQuery('#jform_css_document-lbl').closest('.control-group').hide(); - // remove required attribute from css_document field - if (!jform_vvvvvyxvyt_required) - { - updateFieldRequired('css_document',1); - jQuery('#jform_css_document').removeAttr('required'); - jQuery('#jform_css_document').removeAttr('aria-required'); - jQuery('#jform_css_document').removeClass('required'); - jform_vvvvvyxvyt_required = true; - } } } -// the vvvvvyy function -function vvvvvyy(add_javascript_file_vvvvvyy) +// the vvvvvzw function +function vvvvvzw(add_javascript_file_vvvvvzw) { // set the function logic - if (add_javascript_file_vvvvvyy == 1) + if (add_javascript_file_vvvvvzw == 1) { jQuery('#jform_javascript_file-lbl').closest('.control-group').show(); - // add required attribute to javascript_file field - if (jform_vvvvvyyvyu_required) - { - updateFieldRequired('javascript_file',0); - jQuery('#jform_javascript_file').prop('required','required'); - jQuery('#jform_javascript_file').attr('aria-required',true); - jQuery('#jform_javascript_file').addClass('required'); - jform_vvvvvyyvyu_required = false; - } } else { jQuery('#jform_javascript_file-lbl').closest('.control-group').hide(); - // remove required attribute from javascript_file field - if (!jform_vvvvvyyvyu_required) - { - updateFieldRequired('javascript_file',1); - jQuery('#jform_javascript_file').removeAttr('required'); - jQuery('#jform_javascript_file').removeAttr('aria-required'); - jQuery('#jform_javascript_file').removeClass('required'); - jform_vvvvvyyvyu_required = true; - } } } -// the vvvvvyz function -function vvvvvyz(add_js_document_vvvvvyz) +// the vvvvvzx function +function vvvvvzx(add_js_document_vvvvvzx) { // set the function logic - if (add_js_document_vvvvvyz == 1) + if (add_js_document_vvvvvzx == 1) { jQuery('#jform_js_document-lbl').closest('.control-group').show(); - // add required attribute to js_document field - if (jform_vvvvvyzvyv_required) - { - updateFieldRequired('js_document',0); - jQuery('#jform_js_document').prop('required','required'); - jQuery('#jform_js_document').attr('aria-required',true); - jQuery('#jform_js_document').addClass('required'); - jform_vvvvvyzvyv_required = false; - } } else { jQuery('#jform_js_document-lbl').closest('.control-group').hide(); - // remove required attribute from js_document field - if (!jform_vvvvvyzvyv_required) - { - updateFieldRequired('js_document',1); - jQuery('#jform_js_document').removeAttr('required'); - jQuery('#jform_js_document').removeAttr('aria-required'); - jQuery('#jform_js_document').removeClass('required'); - jform_vvvvvyzvyv_required = true; - } } } -// the vvvvvza function -function vvvvvza(add_css_vvvvvza) +// the vvvvvzy function +function vvvvvzy(add_css_vvvvvzy) { // set the function logic - if (add_css_vvvvvza == 1) + if (add_css_vvvvvzy == 1) { jQuery('#jform_css-lbl').closest('.control-group').show(); - // add required attribute to css field - if (jform_vvvvvzavyw_required) - { - updateFieldRequired('css',0); - jQuery('#jform_css').prop('required','required'); - jQuery('#jform_css').attr('aria-required',true); - jQuery('#jform_css').addClass('required'); - jform_vvvvvzavyw_required = false; - } } else { jQuery('#jform_css-lbl').closest('.control-group').hide(); - // remove required attribute from css field - if (!jform_vvvvvzavyw_required) - { - updateFieldRequired('css',1); - jQuery('#jform_css').removeAttr('required'); - jQuery('#jform_css').removeAttr('aria-required'); - jQuery('#jform_css').removeClass('required'); - jform_vvvvvzavyw_required = true; - } } } -// the vvvvvzb function -function vvvvvzb(add_php_ajax_vvvvvzb) +// the vvvvvzz function +function vvvvvzz(add_php_ajax_vvvvvzz) { // set the function logic - if (add_php_ajax_vvvvvzb == 1) + if (add_php_ajax_vvvvvzz == 1) { jQuery('#jform_ajax_input-lbl').closest('.control-group').show(); jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').show(); - // add required attribute to php_ajaxmethod field - if (jform_vvvvvzbvyx_required) - { - updateFieldRequired('php_ajaxmethod',0); - jQuery('#jform_php_ajaxmethod').prop('required','required'); - jQuery('#jform_php_ajaxmethod').attr('aria-required',true); - jQuery('#jform_php_ajaxmethod').addClass('required'); - jform_vvvvvzbvyx_required = false; - } } else { jQuery('#jform_ajax_input-lbl').closest('.control-group').hide(); jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').hide(); - // remove required attribute from php_ajaxmethod field - if (!jform_vvvvvzbvyx_required) - { - updateFieldRequired('php_ajaxmethod',1); - jQuery('#jform_php_ajaxmethod').removeAttr('required'); - jQuery('#jform_php_ajaxmethod').removeAttr('aria-required'); - jQuery('#jform_php_ajaxmethod').removeClass('required'); - jform_vvvvvzbvyx_required = true; - } } } -// the vvvvvzc function -function vvvvvzc(add_custom_button_vvvvvzc) +// the vvvvwaa function +function vvvvwaa(add_custom_button_vvvvwaa) { // set the function logic - if (add_custom_button_vvvvvzc == 1) + if (add_custom_button_vvvvwaa == 1) { jQuery('#jform_custom_button-lbl').closest('.control-group').show(); jQuery('#jform_php_controller-lbl').closest('.control-group').show(); - // add required attribute to php_controller field - if (jform_vvvvvzcvyy_required) - { - updateFieldRequired('php_controller',0); - jQuery('#jform_php_controller').prop('required','required'); - jQuery('#jform_php_controller').attr('aria-required',true); - jQuery('#jform_php_controller').addClass('required'); - jform_vvvvvzcvyy_required = false; - } jQuery('#jform_php_model-lbl').closest('.control-group').show(); - // add required attribute to php_model field - if (jform_vvvvvzcvyz_required) - { - updateFieldRequired('php_model',0); - jQuery('#jform_php_model').prop('required','required'); - jQuery('#jform_php_model').attr('aria-required',true); - jQuery('#jform_php_model').addClass('required'); - jform_vvvvvzcvyz_required = false; - } } else { jQuery('#jform_custom_button-lbl').closest('.control-group').hide(); jQuery('#jform_php_controller-lbl').closest('.control-group').hide(); - // remove required attribute from php_controller field - if (!jform_vvvvvzcvyy_required) - { - updateFieldRequired('php_controller',1); - jQuery('#jform_php_controller').removeAttr('required'); - jQuery('#jform_php_controller').removeAttr('aria-required'); - jQuery('#jform_php_controller').removeClass('required'); - jform_vvvvvzcvyy_required = true; - } jQuery('#jform_php_model-lbl').closest('.control-group').hide(); - // remove required attribute from php_model field - if (!jform_vvvvvzcvyz_required) - { - updateFieldRequired('php_model',1); - jQuery('#jform_php_model').removeAttr('required'); - jQuery('#jform_php_model').removeAttr('aria-required'); - jQuery('#jform_php_model').removeClass('required'); - jform_vvvvvzcvyz_required = true; - } } } -// the vvvvvzd function -function vvvvvzd(button_position_vvvvvzd) +// the vvvvwab function +function vvvvwab(button_position_vvvvwab) { - if (isSet(button_position_vvvvvzd) && button_position_vvvvvzd.constructor !== Array) + if (isSet(button_position_vvvvwab) && button_position_vvvvwab.constructor !== Array) { - var temp_vvvvvzd = button_position_vvvvvzd; - var button_position_vvvvvzd = []; - button_position_vvvvvzd.push(temp_vvvvvzd); + var temp_vvvvwab = button_position_vvvvwab; + var button_position_vvvvwab = []; + button_position_vvvvwab.push(temp_vvvvwab); } - else if (!isSet(button_position_vvvvvzd)) + else if (!isSet(button_position_vvvvwab)) { - var button_position_vvvvvzd = []; + var button_position_vvvvwab = []; } - var button_position = button_position_vvvvvzd.some(button_position_vvvvvzd_SomeFunc); + var button_position = button_position_vvvvwab.some(button_position_vvvvwab_SomeFunc); // set this function logic @@ -429,44 +218,17 @@ function vvvvvzd(button_position_vvvvvzd) } } -// the vvvvvzd Some function -function button_position_vvvvvzd_SomeFunc(button_position_vvvvvzd) +// the vvvvwab Some function +function button_position_vvvvwab_SomeFunc(button_position_vvvvwab) { // set the function logic - if (button_position_vvvvvzd == 5) + if (button_position_vvvvwab == 5) { return true; } return false; } -// update required fields -function updateFieldRequired(name,status) -{ - var not_required = jQuery('#jform_not_required').val(); - - if(status == 1) - { - if (isSet(not_required) && not_required != 0) - { - not_required = not_required+','+name; - } - else - { - not_required = ','+name; - } - } - else - { - if (isSet(not_required) && not_required != 0) - { - not_required = not_required.replace(','+name,''); - } - } - - jQuery('#jform_not_required').val(not_required); -} - // the isSet function function isSet(val) { @@ -486,9 +248,9 @@ jQuery(document).ready(function() }); function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && type > 0){ - var request = 'token='+token+'&type='+type; + var request = token+'=1&type='+type; } return jQuery.ajax({ type: 'GET', @@ -508,9 +270,9 @@ function getLinked(){ } function getSnippetDetails_server(snippetId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"); if(token.length > 0 && snippetId > 0){ - var request = 'token='+token+'&id='+snippetId; + var request = token+'=1&id='+snippetId; } return jQuery.ajax({ type: 'GET', @@ -557,9 +319,9 @@ function getSnippetDetails(id){ } function getDynamicValues_server(dynamicId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json"); if(token.length > 0 && dynamicId > 0){ - var request = 'token='+token+'&view=site_view&id='+dynamicId; + var request = token+'=1&view=site_view&id='+dynamicId; } return jQuery.ajax({ type: 'GET', @@ -584,9 +346,9 @@ function getDynamicValues(id){ } function getLayoutDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id; + var request = token+'=1&id='+id; } return jQuery.ajax({ type: 'GET', @@ -610,9 +372,9 @@ function getLayoutDetails(id){ } function getTemplateDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id; + var request = token+'=1&id='+id; } return jQuery.ajax({ type: 'GET', @@ -655,7 +417,7 @@ jQuery(document).ready(function($) function getSnippets_server(libraries){ var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&raw=true&format=json"; if(token.length > 0 && libraries.length > 0){ - var request = 'token='+token+'&libraries='+JSON.stringify(libraries); + var request = token+'=1&libraries='+JSON.stringify(libraries); } return jQuery.ajax({ type: 'GET', @@ -708,9 +470,9 @@ function setSnippets(array){ } function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/site_view.xml b/admin/models/forms/site_view.xml index b9c3f5a57..eff581b52 100644 --- a/admin/models/forms/site_view.xml +++ b/admin/models/forms/site_view.xml @@ -156,7 +156,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -173,7 +172,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -262,7 +260,6 @@ syntax="html" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -296,7 +293,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -319,7 +315,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -345,7 +340,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="false" validate="code" /> @@ -376,7 +370,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -407,7 +400,6 @@ syntax="javascript" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -564,7 +556,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -593,7 +584,6 @@ syntax="css" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -620,7 +610,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -1246,7 +1235,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="false" validate="code" /> diff --git a/admin/models/forms/template.js b/admin/models/forms/template.js index efbc1d633..d0cad88e2 100644 --- a/admin/models/forms/template.js +++ b/admin/models/forms/template.js @@ -8,75 +8,27 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -// Some Global Values -jform_vvvvvzevza_required = false; - // Initial Script jQuery(document).ready(function() { - var add_php_view_vvvvvze = jQuery("#jform_add_php_view input[type='radio']:checked").val(); - vvvvvze(add_php_view_vvvvvze); + var add_php_view_vvvvwac = jQuery("#jform_add_php_view input[type='radio']:checked").val(); + vvvvwac(add_php_view_vvvvwac); }); -// the vvvvvze function -function vvvvvze(add_php_view_vvvvvze) +// the vvvvwac function +function vvvvwac(add_php_view_vvvvwac) { // set the function logic - if (add_php_view_vvvvvze == 1) + if (add_php_view_vvvvwac == 1) { jQuery('#jform_php_view-lbl').closest('.control-group').show(); - // add required attribute to php_view field - if (jform_vvvvvzevza_required) - { - updateFieldRequired('php_view',0); - jQuery('#jform_php_view').prop('required','required'); - jQuery('#jform_php_view').attr('aria-required',true); - jQuery('#jform_php_view').addClass('required'); - jform_vvvvvzevza_required = false; - } } else { jQuery('#jform_php_view-lbl').closest('.control-group').hide(); - // remove required attribute from php_view field - if (!jform_vvvvvzevza_required) - { - updateFieldRequired('php_view',1); - jQuery('#jform_php_view').removeAttr('required'); - jQuery('#jform_php_view').removeAttr('aria-required'); - jQuery('#jform_php_view').removeClass('required'); - jform_vvvvvzevza_required = true; - } } } -// update required fields -function updateFieldRequired(name,status) -{ - var not_required = jQuery('#jform_not_required').val(); - - if(status == 1) - { - if (isSet(not_required) && not_required != 0) - { - not_required = not_required+','+name; - } - else - { - not_required = ','+name; - } - } - else - { - if (isSet(not_required) && not_required != 0) - { - not_required = not_required.replace(','+name,''); - } - } - - jQuery('#jform_not_required').val(not_required); -} - // the isSet function function isSet(val) { @@ -94,9 +46,9 @@ jQuery(document).ready(function($) }); function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', @@ -133,9 +85,9 @@ function isObject(obj) { } function getSnippetDetails_server(snippetId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"); if(token.length > 0 && snippetId > 0){ - var request = 'token='+token+'&id='+snippetId; + var request = token+'=1&id='+snippetId; } return jQuery.ajax({ type: 'GET', @@ -182,9 +134,9 @@ function getSnippetDetails(id){ } function getDynamicValues_server(dynamicId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json"); if(token.length > 0 && dynamicId > 0){ - var request = 'token='+token+'&view=template&id='+dynamicId; + var request = token+'=1&view=template&id='+dynamicId; } return jQuery.ajax({ type: 'GET', @@ -209,9 +161,9 @@ function getDynamicValues(id){ } function getLayoutDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id; + var request = token+'=1&id='+id; } return jQuery.ajax({ type: 'GET', @@ -235,9 +187,9 @@ function getLayoutDetails(id){ } function getTemplateDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id; + var request = token+'=1&id='+id; } return jQuery.ajax({ type: 'GET', @@ -280,7 +232,7 @@ jQuery(document).ready(function($) function getSnippets_server(libraries){ var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&raw=true&format=json"; if(token.length > 0 && libraries.length > 0){ - var request = 'token='+token+'&libraries='+JSON.stringify(libraries); + var request = token+'=1&libraries='+JSON.stringify(libraries); } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/forms/template.xml b/admin/models/forms/template.xml index 81d006e0f..bd1133ec5 100644 --- a/admin/models/forms/template.xml +++ b/admin/models/forms/template.xml @@ -142,7 +142,6 @@ syntax="php" editor="codemirror|none" filter="raw" - required="true" validate="code" /> @@ -181,7 +180,6 @@ syntax="html" editor="codemirror|none" filter="raw" - required="true" validate="code" /> diff --git a/admin/models/forms/validation_rule.js b/admin/models/forms/validation_rule.js index 992c3fdc9..fbd901818 100644 --- a/admin/models/forms/validation_rule.js +++ b/admin/models/forms/validation_rule.js @@ -32,16 +32,16 @@ jQuery(document).ready(function() }); function getExistingValidationRuleCode_server(rulefilename){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getExistingValidationRuleCode&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getExistingValidationRuleCode&format=json&raw=true"); if(token.length > 0 && rulefilename.length > 0){ - var request = 'token='+token+'&name='+rulefilename; + var request = token+'=1&name='+rulefilename; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -84,23 +84,23 @@ function checkRuleName(ruleName) { } // check Function Name function checkRuleName_server(ruleName, ide){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.checkRuleName&format=json"; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.checkRuleName&format=json&raw=true"); if(token.length > 0){ - var request = 'token='+token+'&name='+ruleName+'&id='+ide; + var request = token+'=1&name='+ruleName+'&id='+ide; } return jQuery.ajax({ - type: 'POST', + type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function getEditCustomCodeButtons_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod; + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id+'&return_here='+return_here; + var request = token+'=1&id='+id+'&return_here='+return_here; } return jQuery.ajax({ type: 'GET', diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php index 8923b3cee..bb41bc50e 100644 --- a/admin/models/import_joomla_components.php +++ b/admin/models/import_joomla_components.php @@ -86,7 +86,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy protected $specialValue = false; protected $checksum = null; protected $checksumURLs = array('vdm' => 'https://raw.githubusercontent.com/vdm-io/JCB-Packages/master/', 'jcb' => 'https://raw.githubusercontent.com/vdm-io/JCB-Community-Packages/master/'); - protected $mustMerge = array('validation_rule', 'fieldtype', 'snippet', 'language', 'language_translation'); + protected $mustMerge = array('validation_rule', 'fieldtype', 'snippet', 'language', 'language_translation', 'class_extends', 'class_property', 'class_method', 'joomla_plugin_group'); /** * Import an spreadsheet from either folder, url or upload. @@ -699,11 +699,12 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy // the array of tables to store $tables = array( 'validation_rule', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view', - 'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder', + 'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder', 'class_extends', + 'joomla_plugin_group', 'class_property', 'class_method', 'joomla_plugin', 'joomla_plugin_files_folders_urls', 'joomla_plugin_updates', 'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views', 'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks', 'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders', - 'component_placeholders' + 'component_placeholders', 'component_plugins' ); // get prefix $prefix = $this->_db->getPrefix(); @@ -2065,6 +2066,21 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy $item = $this->setNewID($item, 'joomla_component', 'joomla_component', $type); } break; + case 'component_plugins': + // diverged id already updated + if (!$diverged) + { + // update the joomla_component ID where needed + $item = $this->setNewID($item, 'joomla_component', 'joomla_component', $type); + } + // subform fields to target + $updaterT = array( + // subformfield => array( field => type_value ) + 'addjoomla_plugins' => array('plugin' => 'joomla_plugin') + ); + // update the subform ids + $this->updateSubformsIDs($item, 'component_plugins', $updaterT); + break; case 'component_files_folders': // diverged id already updated if (!$diverged) @@ -2081,6 +2097,56 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy // update the repeatable fields $item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR); break; + case 'joomla_plugin_group': + // diverged id already updated + if (!$diverged) + { + // update the class_extends ID where needed + $item = $this->setNewID($item, 'class_extends', 'class_extends', $type); + } + break; + case 'class_method': + case 'class_property': + // diverged id already updated + if (!$diverged) + { + // update the joomla_plugin_group ID where needed + $item = $this->setNewID($item, 'joomla_plugin_group', 'joomla_plugin_group', $type); + } + break; + case 'joomla_plugin': + // diverged id already updated + if (!$diverged) + { + // update the class_extends ID where needed + $item = $this->setNewID($item, 'class_extends', 'class_extends', $type); + // update the joomla_plugin_group ID where needed + $item = $this->setNewID($item, 'joomla_plugin_group', 'joomla_plugin_group', $type); + } + // if we can't merge add postfix to name + if ($this->postfix) + { + $item->system_name = $item->system_name.$this->postfix; + } + // subform fields to target + $updaterT = array( + // subformfield => array( field => type_value ) + 'fields' => array('field' => 'field'), + 'property_selection' => array('property' => 'class_property'), + 'method_selection' => array('method' => 'class_method') + ); + // update the subform ids + $this->updateSubformsIDs($item, 'joomla_plugin', $updaterT); + break; + case 'joomla_plugin_files_folders_urls': + case 'joomla_plugin_updates': + // diverged id already updated + if (!$diverged) + { + // update the joomla_plugin ID where needed + $item = $this->setNewID($item, 'joomla_plugin', 'joomla_plugin', $type); + } + break; case 'custom_code': // update the component ID where needed $item = $this->setNewID($item, 'component', 'joomla_component', $type); @@ -2860,6 +2926,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy case 'component_dashboard': case 'component_placeholders': case 'component_files_folders': + case 'component_plugins': // get by joomla_component (since there should only be one of each component) $getter = array('joomla_component'); $this->specialValue = array(); @@ -2887,8 +2954,109 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy } break; case 'language': - // get by language tag since there should just be one - $getter = 'langtag'; + // get by language tag since there should just be one + $getter = 'langtag'; + break; + case 'joomla_plugin': + // get + if ($retry == 3) + { + // get by names, exteneded and group only + $getter = array('name', 'system_name', 'class_extends', 'joomla_plugin_group'); + } + elseif ($retry == 2) + { + // get by description + $getter = array('name', 'system_name', 'class_extends', 'joomla_plugin_group', 'description'); + $retryAgain = 3; + } + else + { + // get by id + $getter = array('id', 'name', 'system_name', 'class_extends', 'joomla_plugin_group'); + $retryAgain = 2; + } + $this->specialValue = array(); + // Yet if diverged it makes sense that the ID is updated. + if ($diverged) + { + $this->specialValue['class_extends'] = (int) $item->class_extends; + $this->specialValue['joomla_plugin_group'] = (int) $item->joomla_plugin_group; + } + elseif (isset($this->newID['class_extends'][(int) $item->class_extends]) && isset($this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group])) + { + $this->specialValue['class_extends'] = $this->newID['class_extends'][(int) $item->class_extends]; + $this->specialValue['joomla_plugin_group'] = $this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group]; + } + // (TODO) I have seen this happen, seems dangerous! + else + { + return false; + } + break; + case 'joomla_plugin_files_folders_urls': + case 'joomla_plugin_updates': + // get by admin_view (since there should only be one of each name) + $getter = array('joomla_plugin'); + $this->specialValue = array(); + // Yet if diverged it makes sense that the ID is updated. + if ($diverged) + { + $this->specialValue['joomla_plugin'] = (int) $item->joomla_plugin; + } + elseif (isset($this->newID['joomla_plugin'][(int) $item->joomla_plugin])) + { + $this->specialValue['joomla_plugin'] = $this->newID['joomla_plugin'][(int) $item->joomla_plugin]; + } + // (TODO) I have seen this happen, seems dangerous! + else + { + return false; + } + break; + case 'joomla_plugin_group': + // get by name since there should just be one + $getter = array('name', 'class_extends'); + $this->specialValue = array(); + // Yet if diverged it makes sense that the ID is updated. + if ($diverged) + { + $this->specialValue['class_extends'] = (int) $item->class_extends; + } + elseif (isset($this->newID['class_extends'][(int) $item->class_extends])) + { + $this->specialValue['class_extends'] = $this->newID['class_extends'][(int) $item->class_extends]; + } + // (TODO) I have seen this happen, seems dangerous! + else + { + return false; + } + break; + case 'class_extends': + case 'class_method': + case 'class_property': + // get by name since there should just be one + $getter = array('name', 'extension_type'); + // Yet if diverged it makes sense that the ID is updated. + if ('plugins' === $item->extension_type && isset($item->joomla_plugin_group)) + { + $getter[] = 'joomla_plugin_group'; + $this->specialValue = array(); + if ($diverged) + { + $this->specialValue['joomla_plugin_group'] = (int) $item->joomla_plugin_group; + } + elseif (isset($this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group])) + { + $this->specialValue['joomla_plugin_group'] = $this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group]; + } + // (TODO) I have seen this happen, seems dangerous! + else + { + return false; + } + } break; default: // can't be found so return false diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index 1121e55b0..b47b82d63 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -303,7 +303,8 @@ class ComponentbuilderModelJoomla_components extends JModelList 'component_mysql_tweaks' => 'joomla_component', 'component_custom_admin_menus' => 'joomla_component', 'component_dashboard' => 'joomla_component', - 'component_placeholders' => 'joomla_component' ); + 'component_placeholders' => 'joomla_component', + 'component_plugins' => 'joomla_component'); // load all tables linked to joomla_component foreach($linkedTables as $table => $field) { @@ -317,6 +318,13 @@ class ComponentbuilderModelJoomla_components extends JModelList $this->setData('admin_fields_relations', array_values($this->smartIDs['admin_view']), 'admin_view'); $this->setData('admin_custom_tabs', array_values($this->smartIDs['admin_view']), 'admin_view'); } + // add joomla plugin + if (isset($this->smartIDs['joomla_plugin']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin'])) + { + $this->setData('joomla_plugin', array_values($this->smartIDs['joomla_plugin']), 'id'); + $this->setData('joomla_plugin_updates', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin'); + $this->setData('joomla_plugin_files_folders_urls', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin'); + } // add validation rules if (isset($this->smartIDs['validation_rule']) && ComponentbuilderHelper::checkArray($this->smartIDs['validation_rule'])) { @@ -345,6 +353,26 @@ class ComponentbuilderModelJoomla_components extends JModelList // only if exporting if ('clone' !== $this->activeType) { + // add class_property + if (isset($this->smartIDs['class_property']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_property'])) + { + $this->setData('class_property', array_values($this->smartIDs['class_property']), 'id'); + } + // add class_method + if (isset($this->smartIDs['class_method']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_method'])) + { + $this->setData('class_method', array_values($this->smartIDs['class_method']), 'id'); + } + // add joomla_plugin_group + if (isset($this->smartIDs['joomla_plugin_group']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin_group'])) + { + $this->setData('joomla_plugin_group', array_values($this->smartIDs['joomla_plugin_group']), 'id'); + } + // add class_extends + if (isset($this->smartIDs['class_extends']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_extends'])) + { + $this->setData('class_extends', array_values($this->smartIDs['class_extends']), 'id'); + } // add snippets if (isset($this->smartIDs['snippet']) && ComponentbuilderHelper::checkArray($this->smartIDs['snippet'])) { @@ -612,7 +640,7 @@ class ComponentbuilderModelJoomla_components extends JModelList // set search array if ('site_view' === $table || 'custom_admin_view' === $table) { - $searchArray = array('php_view','php_jview','php_jview_display','php_document','js_document','css_document','css'); + $searchArray = array('php_view', 'php_jview', 'php_jview_display', 'php_document', 'js_document', 'css_document', 'css'); } // reset the global array if ('template' === $table) @@ -683,7 +711,7 @@ class ComponentbuilderModelJoomla_components extends JModelList // set the placeholder ID's $this->setCodePlaceholdersIds($item, $table, 'placeholder'); // actions to take if table is component_files_folders - if ('component_files_folders' === $table && 'clone' !== $this->activeType) + if (('component_files_folders' === $table || 'joomla_plugin_files_folders_urls' === $table) && 'clone' !== $this->activeType) { // build files $this->moveIt($this->getValues($item->addfiles, 'subform', 'file', null), 'file'); @@ -718,6 +746,12 @@ class ComponentbuilderModelJoomla_components extends JModelList // add custom admin views $this->setData('custom_admin_view', $this->getValues($item->addcustom_admin_views, 'subform', 'customadminview'), 'id'); } + // actions to take if table is component_plugins + if ('component_plugins' === $table) + { + // add custom admin views + $this->setData('joomla_plugin', $this->getValues($item->addjoomla_plugins, 'subform', 'plugin'), 'id'); + } // actions to take if table is admin_view if ('admin_view' === $table) { @@ -845,6 +879,34 @@ class ComponentbuilderModelJoomla_components extends JModelList // add dynamic gets $this->setSmartIDs((int) $item->dynamic_get, 'dynamic_get'); } + // actions to take if table is joomla_plugin + if ('joomla_plugin' === $table) + { + // add the updates and folder stuff + $this->setSmartIDs($item->id, 'joomla_plugin'); + // add class_extends + $this->setSmartIDs((int) $item->class_extends, 'class_extends'); + // add joomla_plugin_group + $this->setSmartIDs((int) $item->joomla_plugin_group, 'joomla_plugin_group'); + // add fields + $this->setData('field', $this->getValues($item->fields, 'subform', 'field'), 'id'); + // add property_selection + $this->setData('class_property', $this->getValues($item->property_selection, 'subform', 'property'), 'id'); + // add class_method + $this->setData('class_method', $this->getValues($item->method_selection, 'subform', 'method'), 'id'); + } + // actions to take if table is joomla_plugin_group + if ('joomla_plugin_group' === $table) + { + // add class_extends + $this->setSmartIDs((int) $item->class_extends, 'class_extends'); + } + // actions to take if table is class_method or + if ('class_method' === $table || 'class_property' === $table ) + { + // add joomla_plugin_group + $this->setSmartIDs((int) $item->joomla_plugin_group, 'joomla_plugin_group'); + } } } } @@ -882,10 +944,11 @@ class ComponentbuilderModelJoomla_components extends JModelList $tables = array( 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view', 'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder', + 'joomla_plugin', 'joomla_plugin_files_folders_urls', 'joomla_plugin_updates', 'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views', 'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks', 'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders', - 'component_placeholders' + 'component_placeholders', 'component_plugins' ); // smart table loop foreach ($tables as $table) @@ -1821,6 +1884,35 @@ class ComponentbuilderModelJoomla_components extends JModelList 'views' => 'validation_rules', 'not_base64' => array(), 'name' => 'name' + ), + // #__componentbuilder_joomla_plugin (q) + 'joomla_plugin' => array( + 'search' => array('id', 'system_name', 'name', 'main_class_code', 'description', 'php_script_construct', 'php_preflight_install', 'php_preflight_update', + 'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall'), + 'views' => 'joomla_plugins', + 'not_base64' => array('description' => 'string'), + 'name' => 'system_name' + ), + // #__componentbuilder_class_extends (r) + 'class_extends' => array( + 'search' => array('id', 'name', 'head', 'comment'), + 'views' => 'class_extendings', + 'not_base64' => array(), + 'name' => 'name' + ), + // #__componentbuilder_class_property (s) + 'class_property' => array( + 'search' => array('id', 'name', 'default', 'comment'), + 'views' => 'class_properties', + 'not_base64' => array(), + 'name' => 'name' + ), + // #__componentbuilder_class_method (t) + 'class_method' => array( + 'search' => array('id', 'name', 'code', 'comment'), + 'views' => 'class_methods', + 'not_base64' => array(), + 'name' => 'name' ) ); diff --git a/admin/models/joomla_plugin.php b/admin/models/joomla_plugin.php new file mode 100644 index 000000000..0514b95bb --- /dev/null +++ b/admin/models/joomla_plugin.php @@ -0,0 +1,1274 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Componentbuilder Joomla_plugin Model + */ +class ComponentbuilderModelJoomla_plugin extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'code' => array( + 'left' => array( + 'name', + 'description', + 'class_extends', + 'joomla_plugin_group', + 'add_head', + 'note_plugin' + ), + 'right' => array( + 'property_selection', + 'method_selection' + ), + 'fullwidth' => array( + 'head', + 'main_class_code', + 'note_linked_to_notice', + 'not_required' + ), + 'above' => array( + 'system_name', + 'plugin_version' + ) + ), + 'mysql' => array( + 'fullwidth' => array( + 'add_sql', + 'sql', + 'add_sql_uninstall', + 'sql_uninstall' + ) + ), + 'script_file' => array( + 'fullwidth' => array( + 'add_php_script_construct', + 'php_script_construct', + 'add_php_preflight_install', + 'php_preflight_install', + 'add_php_preflight_update', + 'php_preflight_update', + 'add_php_preflight_uninstall', + 'php_preflight_uninstall', + 'add_php_postflight_install', + 'php_postflight_install', + 'add_php_postflight_update', + 'php_postflight_update', + 'add_php_method_uninstall', + 'php_method_uninstall' + ) + ), + 'dynamic_integration' => array( + 'left' => array( + 'add_update_server', + 'update_server_url', + 'update_server_target', + 'note_update_server_note_ftp', + 'note_update_server_note_zip', + 'note_update_server_note_other', + 'update_server', + 'add_sales_server', + 'sales_server' + ) + ), + 'readme' => array( + 'left' => array( + 'addreadme', + 'readme' + ) + ), + 'configparams' => array( + 'fullwidth' => array( + 'fields' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.joomla_plugin'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'joomla_plugin', $prefix = 'ComponentbuilderTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * get VDM session key + * + * @return string the session key + * + */ + public function getVDM() + { + return $this->vastDevMod; + } + + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->sql)) + { + // base64 Decode sql. + $item->sql = base64_decode($item->sql); + } + + if (!empty($item->php_method_uninstall)) + { + // base64 Decode php_method_uninstall. + $item->php_method_uninstall = base64_decode($item->php_method_uninstall); + } + + if (!empty($item->php_postflight_update)) + { + // base64 Decode php_postflight_update. + $item->php_postflight_update = base64_decode($item->php_postflight_update); + } + + if (!empty($item->php_postflight_install)) + { + // base64 Decode php_postflight_install. + $item->php_postflight_install = base64_decode($item->php_postflight_install); + } + + if (!empty($item->head)) + { + // base64 Decode head. + $item->head = base64_decode($item->head); + } + + if (!empty($item->sql_uninstall)) + { + // base64 Decode sql_uninstall. + $item->sql_uninstall = base64_decode($item->sql_uninstall); + } + + if (!empty($item->readme)) + { + // base64 Decode readme. + $item->readme = base64_decode($item->readme); + } + + if (!empty($item->main_class_code)) + { + // base64 Decode main_class_code. + $item->main_class_code = base64_decode($item->main_class_code); + } + + if (!empty($item->php_script_construct)) + { + // base64 Decode php_script_construct. + $item->php_script_construct = base64_decode($item->php_script_construct); + } + + if (!empty($item->php_preflight_install)) + { + // base64 Decode php_preflight_install. + $item->php_preflight_install = base64_decode($item->php_preflight_install); + } + + if (!empty($item->php_preflight_update)) + { + // base64 Decode php_preflight_update. + $item->php_preflight_update = base64_decode($item->php_preflight_update); + } + + if (!empty($item->php_preflight_uninstall)) + { + // base64 Decode php_preflight_uninstall. + $item->php_preflight_uninstall = base64_decode($item->php_preflight_uninstall); + } + + if (!empty($item->method_selection)) + { + // Convert the method_selection field to an array. + $method_selection = new Registry; + $method_selection->loadString($item->method_selection); + $item->method_selection = $method_selection->toArray(); + } + + if (!empty($item->property_selection)) + { + // Convert the property_selection field to an array. + $property_selection = new Registry; + $property_selection->loadString($item->property_selection); + $item->property_selection = $property_selection->toArray(); + } + + if (!empty($item->fields)) + { + // Convert the fields field to an array. + $fields = new Registry; + $fields->loadString($item->fields); + $item->fields = $fields->toArray(); + } + + + if (empty($item->id)) + { + $id = 0; + } + else + { + $id = $item->id; + } + // set the id and view name to session + if ($vdm = ComponentbuilderHelper::get('joomla_plugin__'.$id)) + { + $this->vastDevMod = $vdm; + } + else + { + // set the vast development method key + $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + ComponentbuilderHelper::set($this->vastDevMod, 'joomla_plugin__'.$id); + ComponentbuilderHelper::set('joomla_plugin__'.$id, $this->vastDevMod); + // set a return value if found + $jinput = JFactory::getApplication()->input; + $return = $jinput->get('return', null, 'base64'); + ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_componentbuilder.joomla_plugin'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // Get the form. + $form = $this->loadForm('com_componentbuilder.joomla_plugin', 'joomla_plugin', $options); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('joomla_plugin.edit.state', 'com_componentbuilder.joomla_plugin.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_plugin.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('joomla_plugin.edit.created_by', 'com_componentbuilder.joomla_plugin.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_plugin.edit.created_by', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('joomla_plugin.edit.created', 'com_componentbuilder.joomla_plugin.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_plugin.edit.created', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + // update all editors to use this components global editor + $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields + $editors = $form->getXml()->xpath("//field[@type='editor']"); + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) + { + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_componentbuilder/models/forms/joomla_plugin.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('joomla_plugin.delete', 'com_componentbuilder.joomla_plugin.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('joomla_plugin.edit.state', 'com_componentbuilder.joomla_plugin.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('joomla_plugin.edit.state', 'com_componentbuilder'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('joomla_plugin.edit', 'com_componentbuilder.joomla_plugin.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_plugin.edit', 'com_componentbuilder'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_joomla_plugin')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to validate the form data. + * + * @param JForm $form The form to validate against. + * @param array $data The data to validate. + * @param string $group The name of the field group to validate. + * + * @return mixed Array of filtered data if valid, false otherwise. + * + * @see JFormRule + * @see JFilterInput + * @since 12.2 + */ + public function validate($form, $data, $group = null) + { + // check if the not_required field is set + if (ComponentbuilderHelper::checkString($data['not_required'])) + { + $requiredFields = (array) explode(',',(string) $data['not_required']); + $requiredFields = array_unique($requiredFields); + // now change the required field attributes value + foreach ($requiredFields as $requiredField) + { + // make sure there is a string value + if (ComponentbuilderHelper::checkString($requiredField)) + { + // change to false + $form->setFieldAttribute($requiredField, 'required', 'false'); + // also clear the data set + $data[$requiredField] = ''; + } + } + } + return parent::validate($form, $data, $group); + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + // we must also delete the linked tables found + if (ComponentbuilderHelper::checkArray($pks)) + { + // linked tables to update + $_tablesArray = array( + 'joomla_plugin_updates' => 'joomla_plugin', + 'joomla_plugin_files_folders_urls' => 'joomla_plugin' + ); + foreach($_tablesArray as $_updateTable => $_key) + { + // get the linked IDs + if ($_pks = ComponentbuilderHelper::getVars($_updateTable, $pks, $_key, 'id')) + { + // load the model + $_Model = ComponentbuilderHelper::getModel($_updateTable); + // change publish state + $_Model->delete($_pks); + } + } + } + + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + // we must also update all linked tables + if (ComponentbuilderHelper::checkArray($pks)) + { + // linked tables to update + $_tablesArray = array( + 'joomla_plugin_updates' => 'joomla_plugin', + 'joomla_plugin_files_folders_urls' => 'joomla_plugin' + ); + foreach($_tablesArray as $_updateTable => $_key) + { + // get the linked IDs + if ($_pks = ComponentbuilderHelper::getVars($_updateTable, $pks, $_key, 'id')) + { + // load the model + $_Model = ComponentbuilderHelper::getModel($_updateTable); + // change publish state + $_Model->publish($_pks, $value); + } + } + } + + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin'); + } + + if (!$this->canDo->get('joomla_plugin.create') && !$this->canDo->get('joomla_plugin.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('joomla_plugin.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('joomla_plugin.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name)) + { + $this->table->system_name = $this->generateUniqe('system_name',$this->table->system_name); + } + + // insert all set values + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin'); + } + + if (!$this->canDo->get('joomla_plugin.edit') && !$this->canDo->get('joomla_plugin.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('joomla_plugin.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('joomla_plugin.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // check if the name has placeholder + if (strpos($data['name'], '[[[') === false && strpos($data['name'], '###') === false) + { + // make sure the name is safe to be used as a function name + $data['name'] = ComponentbuilderHelper::safeClassFunctionName($data['name']); + } + + // Set the method_selection items to data. + if (isset($data['method_selection']) && is_array($data['method_selection'])) + { + $method_selection = new JRegistry; + $method_selection->loadArray($data['method_selection']); + $data['method_selection'] = (string) $method_selection; + } + elseif (!isset($data['method_selection'])) + { + // Set the empty method_selection to data + $data['method_selection'] = ''; + } + + // Set the property_selection items to data. + if (isset($data['property_selection']) && is_array($data['property_selection'])) + { + $property_selection = new JRegistry; + $property_selection->loadArray($data['property_selection']); + $data['property_selection'] = (string) $property_selection; + } + elseif (!isset($data['property_selection'])) + { + // Set the empty property_selection to data + $data['property_selection'] = ''; + } + + // Set the fields items to data. + if (isset($data['fields']) && is_array($data['fields'])) + { + $fields = new JRegistry; + $fields->loadArray($data['fields']); + $data['fields'] = (string) $fields; + } + elseif (!isset($data['fields'])) + { + // Set the empty fields to data + $data['fields'] = ''; + } + + // Set the sql string to base64 string. + if (isset($data['sql'])) + { + $data['sql'] = base64_encode($data['sql']); + } + + // Set the php_method_uninstall string to base64 string. + if (isset($data['php_method_uninstall'])) + { + $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']); + } + + // Set the php_postflight_update string to base64 string. + if (isset($data['php_postflight_update'])) + { + $data['php_postflight_update'] = base64_encode($data['php_postflight_update']); + } + + // Set the php_postflight_install string to base64 string. + if (isset($data['php_postflight_install'])) + { + $data['php_postflight_install'] = base64_encode($data['php_postflight_install']); + } + + // Set the head string to base64 string. + if (isset($data['head'])) + { + $data['head'] = base64_encode($data['head']); + } + + // Set the sql_uninstall string to base64 string. + if (isset($data['sql_uninstall'])) + { + $data['sql_uninstall'] = base64_encode($data['sql_uninstall']); + } + + // Set the readme string to base64 string. + if (isset($data['readme'])) + { + $data['readme'] = base64_encode($data['readme']); + } + + // Set the main_class_code string to base64 string. + if (isset($data['main_class_code'])) + { + $data['main_class_code'] = base64_encode($data['main_class_code']); + } + + // Set the php_script_construct string to base64 string. + if (isset($data['php_script_construct'])) + { + $data['php_script_construct'] = base64_encode($data['php_script_construct']); + } + + // Set the php_preflight_install string to base64 string. + if (isset($data['php_preflight_install'])) + { + $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); + } + + // Set the php_preflight_update string to base64 string. + if (isset($data['php_preflight_update'])) + { + $data['php_preflight_update'] = base64_encode($data['php_preflight_update']); + } + + // Set the php_preflight_uninstall string to base64 string. + if (isset($data['php_preflight_uninstall'])) + { + $data['php_preflight_uninstall'] = base64_encode($data['php_preflight_uninstall']); + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/joomla_plugin_files_folders_urls.php b/admin/models/joomla_plugin_files_folders_urls.php new file mode 100644 index 000000000..638417d60 --- /dev/null +++ b/admin/models/joomla_plugin_files_folders_urls.php @@ -0,0 +1,978 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Componentbuilder Joomla_plugin_files_folders_urls Model + */ +class ComponentbuilderModelJoomla_plugin_files_folders_urls extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'basic' => array( + 'fullwidth' => array( + 'note_add_urls', + 'addurls', + 'note_add_files', + 'addfiles', + 'note_add_folders', + 'addfolders' + ), + 'above' => array( + 'joomla_plugin' + ) + ), + 'advance' => array( + 'fullwidth' => array( + 'note_add_files_fullpath', + 'addfilesfullpath', + 'note_add_folders_fullpath', + 'addfoldersfullpath', + 'note_constant_paths' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.joomla_plugin_files_folders_urls'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'joomla_plugin_files_folders_urls', $prefix = 'ComponentbuilderTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->addfoldersfullpath)) + { + // Convert the addfoldersfullpath field to an array. + $addfoldersfullpath = new Registry; + $addfoldersfullpath->loadString($item->addfoldersfullpath); + $item->addfoldersfullpath = $addfoldersfullpath->toArray(); + } + + if (!empty($item->addfilesfullpath)) + { + // Convert the addfilesfullpath field to an array. + $addfilesfullpath = new Registry; + $addfilesfullpath->loadString($item->addfilesfullpath); + $item->addfilesfullpath = $addfilesfullpath->toArray(); + } + + if (!empty($item->addfolders)) + { + // Convert the addfolders field to an array. + $addfolders = new Registry; + $addfolders->loadString($item->addfolders); + $item->addfolders = $addfolders->toArray(); + } + + if (!empty($item->addfiles)) + { + // Convert the addfiles field to an array. + $addfiles = new Registry; + $addfiles->loadString($item->addfiles); + $item->addfiles = $addfiles->toArray(); + } + + if (!empty($item->addurls)) + { + // Convert the addurls field to an array. + $addurls = new Registry; + $addurls->loadString($item->addurls); + $item->addurls = $addurls->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_componentbuilder.joomla_plugin_files_folders_urls'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // Get the form. + $form = $this->loadForm('com_componentbuilder.joomla_plugin_files_folders_urls', 'joomla_plugin_files_folders_urls', $options); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('joomla_plugin_files_folders_urls.edit.state', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_plugin_files_folders_urls.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('joomla_plugin_files_folders_urls.edit.created_by', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_plugin_files_folders_urls.edit.created_by', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('joomla_plugin_files_folders_urls.edit.created', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_plugin_files_folders_urls.edit.created', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_componentbuilder/models/forms/joomla_plugin_files_folders_urls.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('joomla_plugin_files_folders_urls.delete', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('joomla_plugin_files_folders_urls.edit.state', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('joomla_plugin_files_folders_urls.edit.state', 'com_componentbuilder'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('joomla_plugin_files_folders_urls.edit', 'com_componentbuilder.joomla_plugin_files_folders_urls.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_plugin_files_folders_urls.edit', 'com_componentbuilder'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin_files_folders_urls.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls'); + } + + if (!$this->canDo->get('joomla_plugin_files_folders_urls.create') && !$this->canDo->get('joomla_plugin_files_folders_urls.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('joomla_plugin_files_folders_urls.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('joomla_plugin_files_folders_urls.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (ComponentbuilderHelper::checkString($this->table->joomla_plugin) && !is_numeric($this->table->joomla_plugin)) + { + $this->table->joomla_plugin = $this->generateUniqe('joomla_plugin',$this->table->joomla_plugin); + } + + // insert all set values + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls'); + } + + if (!$this->canDo->get('joomla_plugin_files_folders_urls.edit') && !$this->canDo->get('joomla_plugin_files_folders_urls.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('joomla_plugin_files_folders_urls.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('joomla_plugin_files_folders_urls.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the addfoldersfullpath items to data. + if (isset($data['addfoldersfullpath']) && is_array($data['addfoldersfullpath'])) + { + $addfoldersfullpath = new JRegistry; + $addfoldersfullpath->loadArray($data['addfoldersfullpath']); + $data['addfoldersfullpath'] = (string) $addfoldersfullpath; + } + elseif (!isset($data['addfoldersfullpath'])) + { + // Set the empty addfoldersfullpath to data + $data['addfoldersfullpath'] = ''; + } + + // Set the addfilesfullpath items to data. + if (isset($data['addfilesfullpath']) && is_array($data['addfilesfullpath'])) + { + $addfilesfullpath = new JRegistry; + $addfilesfullpath->loadArray($data['addfilesfullpath']); + $data['addfilesfullpath'] = (string) $addfilesfullpath; + } + elseif (!isset($data['addfilesfullpath'])) + { + // Set the empty addfilesfullpath to data + $data['addfilesfullpath'] = ''; + } + + // Set the addfolders items to data. + if (isset($data['addfolders']) && is_array($data['addfolders'])) + { + $addfolders = new JRegistry; + $addfolders->loadArray($data['addfolders']); + $data['addfolders'] = (string) $addfolders; + } + elseif (!isset($data['addfolders'])) + { + // Set the empty addfolders to data + $data['addfolders'] = ''; + } + + // Set the addfiles items to data. + if (isset($data['addfiles']) && is_array($data['addfiles'])) + { + $addfiles = new JRegistry; + $addfiles->loadArray($data['addfiles']); + $data['addfiles'] = (string) $addfiles; + } + elseif (!isset($data['addfiles'])) + { + // Set the empty addfiles to data + $data['addfiles'] = ''; + } + + // Set the addurls items to data. + if (isset($data['addurls']) && is_array($data['addurls'])) + { + $addurls = new JRegistry; + $addurls->loadArray($data['addurls']); + $data['addurls'] = (string) $addurls; + } + elseif (!isset($data['addurls'])) + { + // Set the empty addurls to data + $data['addurls'] = ''; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/joomla_plugin_group.php b/admin/models/joomla_plugin_group.php new file mode 100644 index 000000000..a7b8a40f7 --- /dev/null +++ b/admin/models/joomla_plugin_group.php @@ -0,0 +1,859 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Componentbuilder Joomla_plugin_group Model + */ +class ComponentbuilderModelJoomla_plugin_group extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'name' + ), + 'right' => array( + 'class_extends' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.joomla_plugin_group'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'joomla_plugin_group', $prefix = 'ComponentbuilderTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_componentbuilder.joomla_plugin_group'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // Get the form. + $form = $this->loadForm('com_componentbuilder.joomla_plugin_group', 'joomla_plugin_group', $options); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_componentbuilder.joomla_plugin_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_componentbuilder')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_componentbuilder')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_componentbuilder/models/forms/joomla_plugin_group.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_componentbuilder.joomla_plugin_group.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_componentbuilder.joomla_plugin_group.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_componentbuilder.joomla_plugin_group.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_joomla_plugin_group')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin_group.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_group'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_group'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + { + $this->table->name = $this->generateUniqe('name',$this->table->name); + } + + // insert all set values + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_group'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // make sure the name is safe to be used as a function name + $data['name'] = ComponentbuilderHelper::safeClassFunctionName($data['name']); + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/joomla_plugin_groups.php b/admin/models/joomla_plugin_groups.php new file mode 100644 index 000000000..8ca72875d --- /dev/null +++ b/admin/models/joomla_plugin_groups.php @@ -0,0 +1,250 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin_groups Model + */ +class ComponentbuilderModelJoomla_plugin_groups extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.class_extends','class_extends' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + $this->setState('filter.name', $name); + + $class_extends = $this->getUserStateFromRequest($this->context . '.filter.class_extends', 'filter_class_extends'); + $this->setState('filter.class_extends', $class_extends); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_joomla_plugin_group', 'a')); + + // From the componentbuilder_class_extends table. + $query->select($db->quoteName('g.name','class_extends_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_class_extends', 'g') . ' ON (' . $db->quoteName('a.class_extends') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.class_extends LIKE '.$search.' OR g.name LIKE '.$search.')'); + } + } + + // Filter by class_extends. + if ($class_extends = $this->getState('filter.class_extends')) + { + $query->where('a.class_extends = ' . $db->quote($db->escape($class_extends))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.class_extends'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_joomla_plugin_group')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__componentbuilder_joomla_plugin_group'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/joomla_plugin_updates.php b/admin/models/joomla_plugin_updates.php new file mode 100644 index 000000000..8a5507600 --- /dev/null +++ b/admin/models/joomla_plugin_updates.php @@ -0,0 +1,880 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Componentbuilder Joomla_plugin_updates Model + */ +class ComponentbuilderModelJoomla_plugin_updates extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'updates' => array( + 'fullwidth' => array( + 'version_update' + ), + 'above' => array( + 'joomla_plugin' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.joomla_plugin_updates'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'joomla_plugin_updates', $prefix = 'ComponentbuilderTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->version_update)) + { + // Convert the version_update field to an array. + $version_update = new Registry; + $version_update->loadString($item->version_update); + $item->version_update = $version_update->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_componentbuilder.joomla_plugin_updates'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // Get the form. + $form = $this->loadForm('com_componentbuilder.joomla_plugin_updates', 'joomla_plugin_updates', $options); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('joomla_plugin_updates.edit.state', 'com_componentbuilder.joomla_plugin_updates.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_plugin_updates.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('joomla_plugin_updates.edit.created_by', 'com_componentbuilder.joomla_plugin_updates.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_plugin_updates.edit.created_by', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('joomla_plugin_updates.edit.created', 'com_componentbuilder.joomla_plugin_updates.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_plugin_updates.edit.created', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_componentbuilder/models/forms/joomla_plugin_updates.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('joomla_plugin_updates.delete', 'com_componentbuilder.joomla_plugin_updates.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('joomla_plugin_updates.edit.state', 'com_componentbuilder.joomla_plugin_updates.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('joomla_plugin_updates.edit.state', 'com_componentbuilder'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('joomla_plugin_updates.edit', 'com_componentbuilder.joomla_plugin_updates.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_plugin_updates.edit', 'com_componentbuilder'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_joomla_plugin_updates')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin_updates.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates'); + } + + if (!$this->canDo->get('joomla_plugin_updates.create') && !$this->canDo->get('joomla_plugin_updates.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('joomla_plugin_updates.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('joomla_plugin_updates.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (ComponentbuilderHelper::checkString($this->table->joomla_plugin) && !is_numeric($this->table->joomla_plugin)) + { + $this->table->joomla_plugin = $this->generateUniqe('joomla_plugin',$this->table->joomla_plugin); + } + + // insert all set values + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates'); + } + + if (!$this->canDo->get('joomla_plugin_updates.edit') && !$this->canDo->get('joomla_plugin_updates.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('joomla_plugin_updates.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('joomla_plugin_updates.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (ComponentbuilderHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the version_update items to data. + if (isset($data['version_update']) && is_array($data['version_update'])) + { + $version_update = new JRegistry; + $version_update->loadArray($data['version_update']); + $data['version_update'] = (string) $version_update; + } + elseif (!isset($data['version_update'])) + { + // Set the empty version_update to data + $data['version_update'] = ''; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (ComponentbuilderHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/joomla_plugins.php b/admin/models/joomla_plugins.php new file mode 100644 index 000000000..86d9d6107 --- /dev/null +++ b/admin/models/joomla_plugins.php @@ -0,0 +1,458 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugins Model + */ +class ComponentbuilderModelJoomla_plugins extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.system_name','system_name', + 'a.class_extends','class_extends', + 'a.joomla_plugin_group','joomla_plugin_group' + ); + } + + parent::__construct($config); + } + + + /** + * get Boilerplate + * + * @return boolean + */ + public function getBoilerplate() + { + // get boilerplate repo root details + if (($result = ComponentbuilderHelper::getFileContents(ComponentbuilderHelper::$bolerplateAPI)) !== false && ComponentbuilderHelper::checkJson($result)) + { + $result = json_decode($result); + // check if we have a three + if (isset($result->tree) && ComponentbuilderHelper::checkArray($result->tree)) + { + $found = array_values(array_filter( + $result->tree, + function($tree) { + if (isset($tree->path) && $tree->path === 'plugins') + { + return true; + } + return false; + } + )); + // make sure we have the correct boilerplate + if (ComponentbuilderHelper::checkArray($found) && count($found) == 1 && method_exists(__CLASS__, 'getPluginsBoilerplate')) + { + // get the plugins boilerplate + return $this->getPluginsBoilerplate($found[0]->url); + } + } + } + return false; + } + + /** + * get Plugin Boilerplate + * + * @return boolean true on success + * + */ + protected function getPluginsBoilerplate($url) + { + // get boilerplate root for plugins + if (($result = ComponentbuilderHelper::getFileContents($url)) !== false && ComponentbuilderHelper::checkJson($result)) + { + $result = json_decode($result); + // check if we have a tree + if (isset($result->tree) && ComponentbuilderHelper::checkArray($result->tree)) + { + // get the app object + $app = JFactory::getApplication(); + // set the table names + $tables = array(); + $tables['e'] = 'class_extends'; + $tables['g'] = 'joomla_plugin_group'; + $tables['m'] = 'class_method'; + $tables['p'] = 'class_property'; + // load the needed models + $models = array(); + $models['e'] = ComponentbuilderHelper::getModel($tables['e']); + $models['g'] = ComponentbuilderHelper::getModel($tables['g']); + $models['p'] = ComponentbuilderHelper::getModel($tables['p']); + $models['m'] = ComponentbuilderHelper::getModel($tables['m']); + // get the needed data of each plugin group + $groups = array_map( + function($tree) use(&$app, &$models, &$tables){ + if (($fooClass = ComponentbuilderHelper::getFileContents(ComponentbuilderHelper::$bolerplatePath . '/plugins/' . $tree->path . '/foo.php')) !== false && ComponentbuilderHelper::checkString($fooClass)) + { + // extract the boilerplate class extends and check if already set + if (($classExtends = ComponentbuilderHelper::extractBoilerplateClassExtends($fooClass, 'plugins')) !== false && + ($classExtendsID = ComponentbuilderHelper::getVar('class_extends', $classExtends, 'name', 'id')) === false) + { + // load the extends class name + $class = array('id' => 0, 'published' => 1, 'version' => 1, 'name' => $classExtends); + // extract the boilerplate class header + $class['head'] = ComponentbuilderHelper::extractBoilerplateClassHeader($fooClass, $classExtends, 'plugins'); + // extract the boilerplate class comment + $class['comment'] = ComponentbuilderHelper::extractBoilerplateClassComment($fooClass, $classExtends, 'plugins'); + // set the extension type + $class['extension_type'] = 'plugins'; + // store the class + $this->storePluginBoilerplate($tables['e'], $models['e'], $class, $app); + // work around + $classExtendsID = ComponentbuilderHelper::getVar('class_extends', $classExtends, 'name', 'id'); + } + // set plugin group if not already set + if (($pluginGroupID = ComponentbuilderHelper::getVar('joomla_plugin_group', $tree->path, 'name', 'id')) === false) + { + // load the plugin group name + $pluginGroup = array('id' => 0, 'published' => 1, 'version' => 1, 'name' => $tree->path, 'class_extends' => $classExtendsID); + // store the group + $this->storePluginBoilerplate($tables['g'], $models['g'], $pluginGroup, $app); + // work around + $pluginGroupID = ComponentbuilderHelper::getVar('joomla_plugin_group', $tree->path, 'name', 'id'); + } + // extract the boilerplate class property and methods + if (($classProperiesMethods = ComponentbuilderHelper::extractBoilerplateClassPropertiesMethods($fooClass, $classExtends, 'plugins', $pluginGroupID)) !== false) + { + // create the properties found + if (isset($classProperiesMethods['property']) && ComponentbuilderHelper::checkArray($classProperiesMethods['property'])) + { + foreach ($classProperiesMethods['property'] as $_property) + { + // force update by default + $this->storePluginBoilerplate($tables['p'], $models['p'], $_property, $app); + } + } + // create the method found (TODO just create for now but we could later add a force update) + if (isset($classProperiesMethods['method']) && ComponentbuilderHelper::checkArray($classProperiesMethods['method'])) + { + foreach ($classProperiesMethods['method'] as $_method) + { + // force update by default + $this->storePluginBoilerplate($tables['m'], $models['m'], $_method, $app); + } + } + } + } + }, + $result->tree + ); + } + } + } + + /** + * store Plugin Boilerplate + * + * @return boolean true on success + * + */ + protected function storePluginBoilerplate(&$table, &$method, &$boilerplate, &$app) + { + // Sometimes the form needs some posted data, such as for plugins and modules. + $form = $method->getForm($boilerplate, false); + if (!$form) + { + $app->enqueueMessage($method->getError(), 'error'); + return false; + } + // Send an object which can be modified through the plugin event + $objData = (object) $boilerplate; + $app->triggerEvent( + 'onContentNormaliseRequestData', + array('com_componentbuilder.' . $table, $objData, $form) + ); + $boilerplate = (array) $objData; + // Test whether the data is valid. + $validData = $method->validate($form, $boilerplate); + // Check for validation errors. + if ($validData === false) + { + // Get the validation messages. + $errors = $method->getErrors(); + // Push up to three validation messages out to the user. + for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) + { + if ($errors[$i] instanceof \Exception) + { + $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); + } + else + { + $app->enqueueMessage($errors[$i], 'warning'); + } + } + return false; + } + // Attempt to save the data. + if (!$method->save($validData)) + { + $app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BOILERPLATE_PLUGIN_S_DATA_COULD_NOT_BE_SAVED', $table), 'error'); + return false; + } + return true; + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); + $this->setState('filter.system_name', $system_name); + + $class_extends = $this->getUserStateFromRequest($this->context . '.filter.class_extends', 'filter_class_extends'); + $this->setState('filter.class_extends', $class_extends); + + $joomla_plugin_group = $this->getUserStateFromRequest($this->context . '.filter.joomla_plugin_group', 'filter_joomla_plugin_group'); + $this->setState('filter.joomla_plugin_group', $joomla_plugin_group); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + $access = (JFactory::getUser()->authorise('joomla_plugin.access', 'com_componentbuilder.joomla_plugin.' . (int) $item->id) && JFactory::getUser()->authorise('joomla_plugin.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_joomla_plugin', 'a')); + + // From the componentbuilder_class_extends table. + $query->select($db->quoteName('g.name','class_extends_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_class_extends', 'g') . ' ON (' . $db->quoteName('a.class_extends') . ' = ' . $db->quoteName('g.id') . ')'); + + // From the componentbuilder_joomla_plugin_group table. + $query->select($db->quoteName('h.name','joomla_plugin_group_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_plugin_group', 'h') . ' ON (' . $db->quoteName('a.joomla_plugin_group') . ' = ' . $db->quoteName('h.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.system_name LIKE '.$search.' OR a.class_extends LIKE '.$search.' OR g.name LIKE '.$search.' OR a.joomla_plugin_group LIKE '.$search.' OR h.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.name LIKE '.$search.')'); + } + } + + // Filter by class_extends. + if ($class_extends = $this->getState('filter.class_extends')) + { + $query->where('a.class_extends = ' . $db->quote($db->escape($class_extends))); + } + // Filter by joomla_plugin_group. + if ($joomla_plugin_group = $this->getState('filter.joomla_plugin_group')) + { + $query->where('a.joomla_plugin_group = ' . $db->quote($db->escape($joomla_plugin_group))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.system_name'); + $id .= ':' . $this->getState('filter.class_extends'); + $id .= ':' . $this->getState('filter.joomla_plugin_group'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_joomla_plugin')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__componentbuilder_joomla_plugin'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/joomla_plugins_files_folders_urls.php b/admin/models/joomla_plugins_files_folders_urls.php new file mode 100644 index 000000000..629c7fe83 --- /dev/null +++ b/admin/models/joomla_plugins_files_folders_urls.php @@ -0,0 +1,237 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugins_files_folders_urls Model + */ +class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + $access = (JFactory::getUser()->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $item->id) && JFactory::getUser()->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls', 'a')); + + // From the componentbuilder_joomla_plugin table. + $query->select($db->quoteName('g.system_name','joomla_plugin_system_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_plugin', 'g') . ' ON (' . $db->quoteName('a.joomla_plugin') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/joomla_plugins_updates.php b/admin/models/joomla_plugins_updates.php new file mode 100644 index 000000000..2e595bd74 --- /dev/null +++ b/admin/models/joomla_plugins_updates.php @@ -0,0 +1,237 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugins_updates Model + */ +class ComponentbuilderModelJoomla_plugins_updates extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + $access = (JFactory::getUser()->authorise('joomla_plugin_updates.access', 'com_componentbuilder.joomla_plugin_updates.' . (int) $item->id) && JFactory::getUser()->authorise('joomla_plugin_updates.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_joomla_plugin_updates', 'a')); + + // From the componentbuilder_joomla_plugin table. + $query->select($db->quoteName('g.system_name','joomla_plugin_system_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_plugin', 'g') . ' ON (' . $db->quoteName('a.joomla_plugin') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_joomla_plugin_updates')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__componentbuilder_joomla_plugin_updates'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/layout.php b/admin/models/layout.php index 76abad48b..135bc4d5a 100644 --- a/admin/models/layout.php +++ b/admin/models/layout.php @@ -456,42 +456,6 @@ class ComponentbuilderModelLayout extends JModelAdmin return $data; } - /** - * Method to validate the form data. - * - * @param JForm $form The form to validate against. - * @param array $data The data to validate. - * @param string $group The name of the field group to validate. - * - * @return mixed Array of filtered data if valid, false otherwise. - * - * @see JFormRule - * @see JFilterInput - * @since 12.2 - */ - public function validate($form, $data, $group = null) - { - // check if the not_required field is set - if (ComponentbuilderHelper::checkString($data['not_required'])) - { - $requiredFields = (array) explode(',',(string) $data['not_required']); - $requiredFields = array_unique($requiredFields); - // now change the required field attributes value - foreach ($requiredFields as $requiredField) - { - // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) - { - // change to false - $form->setFieldAttribute($requiredField, 'required', 'false'); - // also clear the data set - $data[$requiredField] = ''; - } - } - } - return parent::validate($form, $data, $group); - } - /** * Method to get the unique fields of this table. * diff --git a/admin/models/rules/int.php b/admin/models/rules/int.php index 3d2e83c69..fa06a94b2 100644 --- a/admin/models/rules/int.php +++ b/admin/models/rules/int.php @@ -21,5 +21,36 @@ use Joomla\Registry\Registry; */ class JFormRuleInt extends FormRule { + /** + * Method to test that an integer value was added. + * + * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `` tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". + * @param Registry $input An optional Registry object with the entire data set to validate against the entire form. + * @param Form $form The form object for which the field is being tested. + * + * @return boolean True if the value is valid integer, false otherwise. + * + */ + public function test(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null) + { + // Check if the field is required. + $required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required'); + // If the value is empty and the field is not required return True. + if (($value === '' || $value === null) && ! $required) + { + return true; + } + + // now validate the value to be an integer + // we need to validate a string with the integer in it + // since this is how Joomla passes the value to the test method + // so we use type coercion along with is_numeric + return is_numeric($value) && is_int(+$value); + // if you have a better idea... lets hear it. + } } diff --git a/admin/models/server.php b/admin/models/server.php index ce83d23e8..16a14d97e 100644 --- a/admin/models/server.php +++ b/admin/models/server.php @@ -189,7 +189,7 @@ class ComponentbuilderModelServer extends JModelAdmin * * @return mixed An array of data items on success, false on failure. */ - public function getWbblinked_components() + public function getVyglinked_components() { // Get the user object. $user = JFactory::getUser(); diff --git a/admin/models/site_view.php b/admin/models/site_view.php index 8192eefa8..38cf0d417 100644 --- a/admin/models/site_view.php +++ b/admin/models/site_view.php @@ -625,42 +625,6 @@ class ComponentbuilderModelSite_view extends JModelAdmin return $data; } - /** - * Method to validate the form data. - * - * @param JForm $form The form to validate against. - * @param array $data The data to validate. - * @param string $group The name of the field group to validate. - * - * @return mixed Array of filtered data if valid, false otherwise. - * - * @see JFormRule - * @see JFilterInput - * @since 12.2 - */ - public function validate($form, $data, $group = null) - { - // check if the not_required field is set - if (ComponentbuilderHelper::checkString($data['not_required'])) - { - $requiredFields = (array) explode(',',(string) $data['not_required']); - $requiredFields = array_unique($requiredFields); - // now change the required field attributes value - foreach ($requiredFields as $requiredField) - { - // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) - { - // change to false - $form->setFieldAttribute($requiredField, 'required', 'false'); - // also clear the data set - $data[$requiredField] = ''; - } - } - } - return parent::validate($form, $data, $group); - } - /** * Method to get the unique fields of this table. * diff --git a/admin/models/template.php b/admin/models/template.php index 91d6ceabb..82ab2241d 100644 --- a/admin/models/template.php +++ b/admin/models/template.php @@ -456,42 +456,6 @@ class ComponentbuilderModelTemplate extends JModelAdmin return $data; } - /** - * Method to validate the form data. - * - * @param JForm $form The form to validate against. - * @param array $data The data to validate. - * @param string $group The name of the field group to validate. - * - * @return mixed Array of filtered data if valid, false otherwise. - * - * @see JFormRule - * @see JFilterInput - * @since 12.2 - */ - public function validate($form, $data, $group = null) - { - // check if the not_required field is set - if (ComponentbuilderHelper::checkString($data['not_required'])) - { - $requiredFields = (array) explode(',',(string) $data['not_required']); - $requiredFields = array_unique($requiredFields); - // now change the required field attributes value - foreach ($requiredFields as $requiredField) - { - // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) - { - // change to false - $form->setFieldAttribute($requiredField, 'required', 'false'); - // also clear the data set - $data[$requiredField] = ''; - } - } - } - return parent::validate($form, $data, $group); - } - /** * Method to get the unique fields of this table. * diff --git a/admin/models/validation_rule.php b/admin/models/validation_rule.php index 5ac0ca8b3..0f39411b2 100644 --- a/admin/models/validation_rule.php +++ b/admin/models/validation_rule.php @@ -74,10 +74,17 @@ class ComponentbuilderModelValidation_rule extends JModelAdmin return JTable::getInstance($type, $prefix, $config); } + /** + * get VDM session key + * + * @return string the session key + * + */ public function getVDM() { return $this->vastDevMod; } + /** * Method to get a single record. diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 6ad006031..62c520eb1 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -141,6 +141,84 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( KEY `idx_adduikit` (`adduikit`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `add_head` TINYINT(1) NOT NULL DEFAULT 0, + `add_php_method_uninstall` TINYINT(1) NOT NULL DEFAULT 0, + `add_php_postflight_install` TINYINT(1) NOT NULL DEFAULT 0, + `add_php_postflight_update` TINYINT(1) NOT NULL DEFAULT 0, + `add_php_preflight_install` TINYINT(1) NOT NULL DEFAULT 0, + `add_php_preflight_uninstall` TINYINT(1) NOT NULL DEFAULT 0, + `add_php_preflight_update` TINYINT(1) NOT NULL DEFAULT 0, + `add_php_script_construct` TINYINT(1) NOT NULL DEFAULT 0, + `add_sales_server` TINYINT(1) NOT NULL DEFAULT 0, + `add_sql` TINYINT(1) NOT NULL DEFAULT 0, + `add_sql_uninstall` TINYINT(1) NOT NULL DEFAULT 0, + `add_update_server` TINYINT(1) NOT NULL DEFAULT 0, + `addreadme` TINYINT(1) NOT NULL DEFAULT 0, + `class_extends` INT(11) NOT NULL DEFAULT 0, + `description` TEXT NOT NULL, + `fields` TEXT NOT NULL, + `head` TEXT NOT NULL, + `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, + `main_class_code` MEDIUMTEXT NOT NULL, + `method_selection` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `php_method_uninstall` MEDIUMTEXT NOT NULL, + `php_postflight_install` MEDIUMTEXT NOT NULL, + `php_postflight_update` MEDIUMTEXT NOT NULL, + `php_preflight_install` MEDIUMTEXT NOT NULL, + `php_preflight_uninstall` MEDIUMTEXT NOT NULL, + `php_preflight_update` MEDIUMTEXT NOT NULL, + `php_script_construct` MEDIUMTEXT NOT NULL, + `plugin_version` CHAR(64) NOT NULL DEFAULT '', + `property_selection` TEXT NOT NULL, + `readme` TEXT NOT NULL, + `sales_server` INT(11) NOT NULL DEFAULT 0, + `sql` MEDIUMTEXT NOT NULL, + `sql_uninstall` MEDIUMTEXT NOT NULL, + `system_name` VARCHAR(255) NOT NULL DEFAULT '', + `update_server` INT(11) NOT NULL DEFAULT 0, + `update_server_target` TINYINT(1) NOT NULL DEFAULT 0, + `update_server_url` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_system_name` (`system_name`), + KEY `idx_class_extends` (`class_extends`), + KEY `idx_joomla_plugin_group` (`joomla_plugin_group`), + KEY `idx_add_sales_server` (`add_sales_server`), + KEY `idx_add_php_postflight_install` (`add_php_postflight_install`), + KEY `idx_add_php_postflight_update` (`add_php_postflight_update`), + KEY `idx_add_php_method_uninstall` (`add_php_method_uninstall`), + KEY `idx_add_php_script_construct` (`add_php_script_construct`), + KEY `idx_add_sql` (`add_sql`), + KEY `idx_add_sql_uninstall` (`add_sql_uninstall`), + KEY `idx_add_php_preflight_install` (`add_php_preflight_install`), + KEY `idx_addreadme` (`addreadme`), + KEY `idx_add_update_server` (`add_update_server`), + KEY `idx_add_php_preflight_update` (`add_php_preflight_update`), + KEY `idx_update_server_target` (`update_server_target`), + KEY `idx_add_php_preflight_uninstall` (`add_php_preflight_uninstall`), + KEY `idx_name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_view` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', @@ -624,6 +702,71 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_custom_code` ( KEY `idx_from_line` (`from_line`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_property` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `comment` TEXT NOT NULL, + `default` VARCHAR(255) NOT NULL DEFAULT '', + `extension_type` VARCHAR(64) NOT NULL DEFAULT '', + `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `visibility` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_visibility` (`visibility`), + KEY `idx_joomla_plugin_group` (`joomla_plugin_group`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_method` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `arguments` TEXT NOT NULL, + `code` MEDIUMTEXT NOT NULL, + `comment` TEXT NOT NULL, + `extension_type` VARCHAR(64) NOT NULL DEFAULT '', + `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `visibility` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_visibility` (`visibility`), + KEY `idx_joomla_plugin_group` (`joomla_plugin_group`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + CREATE TABLE IF NOT EXISTS `#__componentbuilder_placeholder` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', @@ -1350,6 +1493,32 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_placeholders` ( KEY `idx_joomla_component` (`joomla_component`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_plugins` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `addjoomla_plugins` TEXT NOT NULL, + `joomla_component` INT(11) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_joomla_component` (`joomla_component`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + CREATE TABLE IF NOT EXISTS `#__componentbuilder_snippet_type` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', @@ -1432,6 +1601,117 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_library_files_folders_urls` ( KEY `idx_library` (`library`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_extends` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `comment` TEXT NOT NULL, + `extension_type` VARCHAR(64) NOT NULL DEFAULT '', + `head` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_group` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `class_extends` INT(11) NOT NULL DEFAULT 0, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_class_extends` (`class_extends`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_updates` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `joomla_plugin` INT(11) NOT NULL DEFAULT 0, + `version_update` TEXT NOT NULL, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_joomla_plugin` (`joomla_plugin`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_files_folders_urls` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `addfiles` TEXT NOT NULL, + `addfilesfullpath` TEXT NOT NULL, + `addfolders` TEXT NOT NULL, + `addfoldersfullpath` TEXT NOT NULL, + `addurls` TEXT NOT NULL, + `joomla_plugin` INT(11) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_joomla_plugin` (`joomla_plugin`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + -- -- Dumping data for table `#__componentbuilder_joomla_component` -- @@ -1699,7 +1979,8 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `catid`, `description`, `name (35, '', 'Provides a form with rows of fields that you specify. As many options can be added as desired. Note this form field has a jQuery based javascript file as a dependency.', 'Subform', '{\"properties0\":{\"name\":\"type\",\"example\":\"subform\",\"description\":\"(mandatory) must be subform.\"},\"properties1\":{\"name\":\"name\",\"example\":\"options\",\"adjustable\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter\"},\"properties2\":{\"name\":\"label\",\"example\":\"The Option List\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"layout\",\"example\":\"joomla.form.field.subform.repeatable-table\",\"adjustable\":\"1\",\"description\":\"(mandatory) The layout for the repeatable table.\"},\"properties4\":{\"name\":\"component\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) To change the component where it should search for layout\"},\"properties5\":{\"name\":\"client\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Function to initialise the application client
    Frontend: site<\\/code> or 0<\\/code>
    Backend: admin<\\/code> or 1<\\/code>\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"true\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The rows to be multiple.\"},\"properties7\":{\"name\":\"buttons\",\"example\":\"add,remove,move\",\"adjustable\":\"1\",\"description\":\"(optional) Which buttons to show if multiple mode is true.
    Options: add,remove,move<\\/code>\"},\"properties8\":{\"name\":\"fields\",\"example\":\"1,2,3\",\"adjustable\":\"1\",\"description\":\"(mandatory) The fields to add to the modal. All fields must first be created in component builder as a field before you can add them here, since you must use the id of the field. Separate the field ids with commas. Do not add custom fields that are not also used in this component.\"},\"properties9\":{\"name\":\"formsource\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) you can add a path to a xml file containing the fields.\"},\"properties10\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) description text for the form field. Displays at the top of the modal with the name as well as in the usual position in the form\"},\"properties11\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The default value for the form field if the field is left empty. Note this has to be a json string compatible with the contents of the form field.\"},\"properties12\":{\"name\":\"icon\",\"example\":\"list\",\"adjustable\":\"1\",\"description\":\"(optional) The icon to show on the select button (is prefixed with \\\"icon-\\\").\"},\"properties13\":{\"name\":\"max\",\"example\":\"50\",\"adjustable\":\"1\",\"description\":\"(optional) The maximum number of rows of fields allowed (by default 999 to be effectively infinite)\"},\"properties14\":{\"name\":\"min\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The minimum number of rows of fields required\"},\"properties15\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Use only if you would like to save raw data, since the default is best.\"},\"properties16\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'Allows form fields which can have as many options as the user desires.', '', 1, 13, '', 6), (36, '', 'Provides an input field for an email address.', 'Email', '{\"properties0\":{\"name\":\"type\",\"example\":\"email\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be email.\"},\"properties1\":{\"name\":\"name\",\"example\":\"email\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Email Address\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties4\":{\"name\":\"maxlength\",\"example\":\"50\",\"adjustable\":\"1\",\"description\":\"(optional) limits the number of characters that may be entered.\"},\"properties5\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Enter some description\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties7\":{\"name\":\"class\",\"example\":\"inputbox\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties8\":{\"name\":\"readonly\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties9\":{\"name\":\"disabled\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties10\":{\"name\":\"required\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties11\":{\"name\":\"filter\",\"example\":\"STRING\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties12\":{\"name\":\"validate\",\"example\":\"email\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties13\":{\"name\":\"unique\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) Used in validation, to check if we should test for uniqueness, to insure that this email does not already belong to another user. Check line 99 in \\/libraries\\/src\\/Form\\/Rule\\/EmailRule.php\"},\"properties14\":{\"name\":\"field\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) used in validation of \\\"equals\\\" to link the field to match.\"},\"properties15\":{\"name\":\"message\",\"example\":\"Error! Please add some text here.\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) The error message that will be displayed instead of the default message.\"},\"properties16\":{\"name\":\"hint\",\"example\":\"your@email.com\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) The placeholder to display inside the text box.\"},\"properties17\":{\"name\":\"autocomplete\",\"example\":\"on\",\"adjustable\":\"1\",\"description\":\"(optional) The autocomplete state for the form field. If \'off\' element will not be automatically completed by browser.\"},\"properties18\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"},\"properties19\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'Email form field type', '', 1, 6, '', 7), (37, '', 'Provides a dropdown list of plugin options from the folder.', 'Plugins', '{\"properties0\":{\"name\":\"type\",\"example\":\"plugins\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be editors.\"},\"properties1\":{\"name\":\"name\",\"example\":\"editor\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select an editor\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.\"},\"properties8\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties5\":{\"name\":\"folder\",\"example\":\"editors\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) editors or captcha.\"},\"properties6\":{\"name\":\"filter\",\"example\":\"cmd\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'Provides a dropdown list of plugin options from the folder.', '', 1, 7, '', 8), -(38, '', 'Provides the use of a captcha plugin.', 'Captcha', '{\"properties0\":{\"name\":\"type\",\"example\":\"captcha\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be captcha.\"},\"properties3\":{\"name\":\"name\",\"example\":\"captcha\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"validate\",\"example\":\"captcha\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be captcha.\"},\"properties1\":{\"name\":\"label\",\"example\":\"Captcha\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties4\":{\"name\":\"description\",\"example\":\"We do not like spam, please show us you are human\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties5\":{\"name\":\"namespace\",\"example\":\"componentbuilder\",\"description\":\"(optional) the component name seems to work\"}}', 'Captcha robot check.', '', 1, 2, '', 9); +(38, '', 'Provides the use of a captcha plugin.', 'Captcha', '{\"properties0\":{\"name\":\"type\",\"example\":\"captcha\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be captcha.\"},\"properties3\":{\"name\":\"name\",\"example\":\"captcha\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"validate\",\"example\":\"captcha\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be captcha.\"},\"properties1\":{\"name\":\"label\",\"example\":\"Captcha\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties4\":{\"name\":\"description\",\"example\":\"We do not like spam, please show us you are human\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties5\":{\"name\":\"namespace\",\"example\":\"componentbuilder\",\"description\":\"(optional) the component name seems to work\"}}', 'Captcha robot check.', '', 1, 2, '', 9), +(39, '', 'The list form field type provides a drop down list or a list box of custom-defined entries. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'Groupedlist', '{\"properties0\":{\"name\":\"type\",\"example\":\"groupedlist\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be groupedlist.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mygrouplist\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select an option\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties5\":{\"name\":\"class\",\"example\":\"list_class\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties7\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) filter options\"},\"properties8\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties9\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties10\":{\"name\":\"option\",\"example\":\"Group Name@@1,1|Option 1|1,2|Option 2|1,Group Name 2@@2,3|Option 3|2\",\"adjustable\":\"1\",\"description\":\"(mandatory) set the options of this radio. Separate options with commas and use the pipe symbol to separate value from text.\"},\"properties11\":{\"name\":\"useglobal\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) if set to true, it will show the value that is set in the global configuration if found in the database.\"},\"properties12\":{\"name\":\"default\",\"example\":\"0\",\"adjustable\":\"1\",\"description\":\"(optional) is the default list item value.\"},\"properties13\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"},\"properties14\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a drop down list of custom-defined entries.', '', 1, 1, '', 10); -- -- Dumping data for table `#__componentbuilder_language` diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index 6dbe36b9e..7dc739594 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -1,4 +1,5 @@ DROP TABLE IF EXISTS `#__componentbuilder_joomla_component`; +DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin`; DROP TABLE IF EXISTS `#__componentbuilder_admin_view`; DROP TABLE IF EXISTS `#__componentbuilder_custom_admin_view`; DROP TABLE IF EXISTS `#__componentbuilder_site_view`; @@ -6,6 +7,8 @@ DROP TABLE IF EXISTS `#__componentbuilder_template`; DROP TABLE IF EXISTS `#__componentbuilder_layout`; DROP TABLE IF EXISTS `#__componentbuilder_dynamic_get`; DROP TABLE IF EXISTS `#__componentbuilder_custom_code`; +DROP TABLE IF EXISTS `#__componentbuilder_class_property`; +DROP TABLE IF EXISTS `#__componentbuilder_class_method`; DROP TABLE IF EXISTS `#__componentbuilder_placeholder`; DROP TABLE IF EXISTS `#__componentbuilder_library`; DROP TABLE IF EXISTS `#__componentbuilder_snippet`; @@ -30,7 +33,12 @@ DROP TABLE IF EXISTS `#__componentbuilder_component_config`; DROP TABLE IF EXISTS `#__componentbuilder_component_dashboard`; DROP TABLE IF EXISTS `#__componentbuilder_component_files_folders`; DROP TABLE IF EXISTS `#__componentbuilder_component_placeholders`; +DROP TABLE IF EXISTS `#__componentbuilder_component_plugins`; DROP TABLE IF EXISTS `#__componentbuilder_snippet_type`; DROP TABLE IF EXISTS `#__componentbuilder_library_config`; DROP TABLE IF EXISTS `#__componentbuilder_library_files_folders_urls`; +DROP TABLE IF EXISTS `#__componentbuilder_class_extends`; +DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin_group`; +DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin_updates`; +DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin_files_folders_urls`; DROP TABLE IF EXISTS `#__componentbuilder_external_code`; diff --git a/admin/sql/updates/mysql/2.9.21.sql b/admin/sql/updates/mysql/2.9.21.sql new file mode 100644 index 000000000..bbb847f84 --- /dev/null +++ b/admin/sql/updates/mysql/2.9.21.sql @@ -0,0 +1,59 @@ +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `class_extends` INT(11) NOT NULL DEFAULT 0, + `fields` TEXT NOT NULL, + `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, + `main_class_code` MEDIUMTEXT NOT NULL, + `method_selection` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `property_selection` TEXT NOT NULL, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_class_extends` (`class_extends`), + KEY `idx_joomla_plugin_group` (`joomla_plugin_group`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_group` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `class_extends` INT(11) NOT NULL DEFAULT 0, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_class_extends` (`class_extends`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; diff --git a/admin/sql/updates/mysql/2.9.31.sql b/admin/sql/updates/mysql/2.9.31.sql new file mode 100644 index 000000000..c4c444e5c --- /dev/null +++ b/admin/sql/updates/mysql/2.9.31.sql @@ -0,0 +1,92 @@ +CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_property` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `comment` TEXT NOT NULL, + `default` VARCHAR(255) NOT NULL DEFAULT '', + `extension_type` VARCHAR(64) NOT NULL DEFAULT '', + `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `visibility` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_visibility` (`visibility`), + KEY `idx_joomla_plugin_group` (`joomla_plugin_group`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_method` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `arguments` TEXT NOT NULL, + `code` MEDIUMTEXT NOT NULL, + `comment` TEXT NOT NULL, + `extension_type` VARCHAR(64) NOT NULL DEFAULT '', + `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `visibility` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_visibility` (`visibility`), + KEY `idx_joomla_plugin_group` (`joomla_plugin_group`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_extends` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `comment` TEXT NOT NULL, + `extension_type` VARCHAR(64) NOT NULL DEFAULT '', + `head` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; diff --git a/admin/sql/updates/mysql/2.9.32.sql b/admin/sql/updates/mysql/2.9.32.sql new file mode 100644 index 000000000..284d641a7 --- /dev/null +++ b/admin/sql/updates/mysql/2.9.32.sql @@ -0,0 +1,25 @@ +CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_plugins` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `addjoomla_plugins` TEXT NOT NULL, + `joomla_component` INT(11) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_joomla_component` (`joomla_component`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; diff --git a/admin/sql/updates/mysql/2.9.33.sql b/admin/sql/updates/mysql/2.9.33.sql new file mode 100644 index 000000000..8d911f995 --- /dev/null +++ b/admin/sql/updates/mysql/2.9.33.sql @@ -0,0 +1,5 @@ +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_head` TINYINT(1) NOT NULL DEFAULT 0 AFTER `asset_id`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `head` TEXT NOT NULL AFTER `fields`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `system_name` VARCHAR(255) NOT NULL DEFAULT '' AFTER `property_selection`; diff --git a/admin/sql/updates/mysql/2.9.34.sql b/admin/sql/updates/mysql/2.9.34.sql new file mode 100644 index 000000000..0f61c1fa2 --- /dev/null +++ b/admin/sql/updates/mysql/2.9.34.sql @@ -0,0 +1,77 @@ +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_php_method_uninstall` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_head`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_php_postflight_install` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_php_method_uninstall`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_php_postflight_update` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_php_postflight_install`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_php_preflight_install` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_php_postflight_update`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_php_preflight_uninstall` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_php_preflight_install`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_php_preflight_update` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_php_preflight_uninstall`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_sales_server` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_php_preflight_update`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_sql` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_sales_server`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_sql_uninstall` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_sql`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_update_server` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_sql_uninstall`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `addreadme` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_update_server`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `php_method_uninstall` MEDIUMTEXT NOT NULL AFTER `name`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `php_postflight_install` MEDIUMTEXT NOT NULL AFTER `php_method_uninstall`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `php_postflight_update` MEDIUMTEXT NOT NULL AFTER `php_postflight_install`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `php_preflight_install` MEDIUMTEXT NOT NULL AFTER `php_postflight_update`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `php_preflight_uninstall` MEDIUMTEXT NOT NULL AFTER `php_preflight_install`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `php_preflight_update` MEDIUMTEXT NOT NULL AFTER `php_preflight_uninstall`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `readme` TEXT NOT NULL AFTER `property_selection`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `sales_server` INT(11) NOT NULL DEFAULT 0 AFTER `readme`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `sql` MEDIUMTEXT NOT NULL AFTER `sales_server`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `sql_uninstall` MEDIUMTEXT NOT NULL AFTER `sql`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `update_server` INT(11) NOT NULL DEFAULT 0 AFTER `system_name`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `update_server_target` TINYINT(1) NOT NULL DEFAULT 0 AFTER `update_server`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `update_server_url` VARCHAR(255) NOT NULL DEFAULT '' AFTER `update_server_target`; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_files_folders_urls` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `addfiles` TEXT NOT NULL, + `addfilesfullpath` TEXT NOT NULL, + `addfolders` TEXT NOT NULL, + `addfoldersfullpath` TEXT NOT NULL, + `addurls` TEXT NOT NULL, + `joomla_plugin` INT(11) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_joomla_plugin` (`joomla_plugin`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; diff --git a/admin/sql/updates/mysql/2.9.35.sql b/admin/sql/updates/mysql/2.9.35.sql new file mode 100644 index 000000000..f8732ed31 --- /dev/null +++ b/admin/sql/updates/mysql/2.9.35.sql @@ -0,0 +1,33 @@ +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `add_php_script_construct` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_php_preflight_update`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `description` TEXT NOT NULL AFTER `class_extends`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `php_script_construct` MEDIUMTEXT NOT NULL AFTER `php_preflight_update`; + +ALTER TABLE `#__componentbuilder_joomla_plugin` ADD `plugin_version` CHAR(64) NOT NULL DEFAULT '' AFTER `php_script_construct`; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_updates` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `joomla_plugin` INT(11) NOT NULL DEFAULT 0, + `version_update` TEXT NOT NULL, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_joomla_plugin` (`joomla_plugin`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; diff --git a/admin/tables/class_extends.php b/admin/tables/class_extends.php new file mode 100644 index 000000000..90b312ccc --- /dev/null +++ b/admin/tables/class_extends.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Class_extendings Table class + */ +class ComponentbuilderTableClass_extends extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_class_extends', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.class_extends')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Class_extends table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New class_extends. A class_extends created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('class_extends', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('class_extends', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.class_extends.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.class_extends.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/class_method.php b/admin/tables/class_method.php new file mode 100644 index 000000000..72e836850 --- /dev/null +++ b/admin/tables/class_method.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Class_methods Table class + */ +class ComponentbuilderTableClass_method extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_class_method', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.class_method')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Class_method table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New class_method. A class_method created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('class_method', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('class_method', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.class_method.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.class_method.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/class_property.php b/admin/tables/class_property.php new file mode 100644 index 000000000..6aaf9b3e6 --- /dev/null +++ b/admin/tables/class_property.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Class_properties Table class + */ +class ComponentbuilderTableClass_property extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_class_property', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.class_property')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Class_property table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New class_property. A class_property created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('class_property', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('class_property', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.class_property.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.class_property.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/component_plugins.php b/admin/tables/component_plugins.php new file mode 100644 index 000000000..f3f183ecb --- /dev/null +++ b/admin/tables/component_plugins.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Components_plugins Table class + */ +class ComponentbuilderTableComponent_plugins extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_component_plugins', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_plugins')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Component_plugins table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New component_plugins. A component_plugins created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('component_plugins', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('component_plugins', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.component_plugins.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.component_plugins.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/joomla_plugin.php b/admin/tables/joomla_plugin.php new file mode 100644 index 000000000..9003ccf6a --- /dev/null +++ b/admin/tables/joomla_plugin.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Joomla_plugins Table class + */ +class ComponentbuilderTableJoomla_plugin extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_joomla_plugin', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Joomla_plugin table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New joomla_plugin. A joomla_plugin created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('joomla_plugin', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('joomla_plugin', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_plugin.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.joomla_plugin.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/joomla_plugin_files_folders_urls.php b/admin/tables/joomla_plugin_files_folders_urls.php new file mode 100644 index 000000000..d2cfab6ad --- /dev/null +++ b/admin/tables/joomla_plugin_files_folders_urls.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Joomla_plugins_files_folders_urls Table class + */ +class ComponentbuilderTableJoomla_plugin_files_folders_urls extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_joomla_plugin_files_folders_urls', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin_files_folders_urls')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Joomla_plugin_files_folders_urls table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New joomla_plugin_files_folders_urls. A joomla_plugin_files_folders_urls created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('joomla_plugin_files_folders_urls', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('joomla_plugin_files_folders_urls', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_plugin_files_folders_urls.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.joomla_plugin_files_folders_urls.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/joomla_plugin_group.php b/admin/tables/joomla_plugin_group.php new file mode 100644 index 000000000..e9995623f --- /dev/null +++ b/admin/tables/joomla_plugin_group.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Joomla_plugin_groups Table class + */ +class ComponentbuilderTableJoomla_plugin_group extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_joomla_plugin_group', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin_group')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Joomla_plugin_group table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New joomla_plugin_group. A joomla_plugin_group created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('joomla_plugin_group', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('joomla_plugin_group', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_plugin_group.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.joomla_plugin_group.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/joomla_plugin_updates.php b/admin/tables/joomla_plugin_updates.php new file mode 100644 index 000000000..5cda704b0 --- /dev/null +++ b/admin/tables/joomla_plugin_updates.php @@ -0,0 +1,321 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +/** + * Joomla_plugins_updates Table class + */ +class ComponentbuilderTableJoomla_plugin_updates extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_joomla_plugin_updates', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin_updates')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Joomla_plugin_updates table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New joomla_plugin_updates. A joomla_plugin_updates created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('joomla_plugin_updates', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('joomla_plugin_updates', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_plugin_updates.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.joomla_plugin_updates.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/views/admin_fields_conditions/tmpl/edit.php b/admin/views/admin_fields_conditions/tmpl/edit.php index 35293dbf6..4fa567151 100644 --- a/admin/views/admin_fields_conditions/tmpl/edit.php +++ b/admin/views/admin_fields_conditions/tmpl/edit.php @@ -130,5 +130,22 @@ jQuery(document).ready(function(){ }); } }); -}); +}); + + +function JRouter(link) { +isSite()) + { + echo 'var url = "'.JURI::root().'";'; + } + else + { + echo 'var url = "";'; + } +?> + return url+link; +} diff --git a/admin/views/admin_fields_relations/tmpl/edit.php b/admin/views/admin_fields_relations/tmpl/edit.php index 732d6d559..833e790e8 100644 --- a/admin/views/admin_fields_relations/tmpl/edit.php +++ b/admin/views/admin_fields_relations/tmpl/edit.php @@ -103,4 +103,27 @@ $componentParams = $this->params; // will be removed just use $this->params inst - + + + diff --git a/admin/views/admin_view/tmpl/edit.php b/admin/views/admin_view/tmpl/edit.php index 16f4ebaea..9a7d39db0 100644 --- a/admin/views/admin_view/tmpl/edit.php +++ b/admin/views/admin_view/tmpl/edit.php @@ -208,521 +208,521 @@ $componentParams = $this->params; // will be removed just use $this->params inst +
    +sidebar)): ?> +
    + sidebar; ?> +
    +
    + +
    + +items)): ?> + loadTemplate('toolbar');?> +
    + +
    + + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
    + + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
    + + + + \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/default_batch_body.php b/admin/views/class_extendings/tmpl/default_batch_body.php new file mode 100644 index 000000000..ac5af986b --- /dev/null +++ b/admin/views/class_extendings/tmpl/default_batch_body.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

    +batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/default_batch_footer.php b/admin/views/class_extendings/tmpl/default_batch_footer.php new file mode 100644 index 000000000..05d4c2fd3 --- /dev/null +++ b/admin/views/class_extendings/tmpl/default_batch_footer.php @@ -0,0 +1,23 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/default_body.php b/admin/views/class_extendings/tmpl/default_body.php new file mode 100644 index 000000000..1f0a5343e --- /dev/null +++ b/admin/views/class_extendings/tmpl/default_body.php @@ -0,0 +1,97 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = ComponentbuilderHelper::getActions('class_extends',$item,'class_extendings'); + ?> + + + get('class_extends.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('class_extends.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
    + get('class_extends.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'class_extendings.', $canCheckin); ?> + + + escape($item->name); ?> + +
    + + + extension_type); ?> + + + get('class_extends.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'class_extendings.', true, 'cb'); ?> + + published, $i, 'class_extendings.', false, 'cb'); ?> + + + published, $i, 'class_extendings.', true, 'cb'); ?> + + + published, $i, 'class_extendings.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/default_foot.php b/admin/views/class_extendings/tmpl/default_foot.php new file mode 100644 index 000000000..5d5ceb4bf --- /dev/null +++ b/admin/views/class_extendings/tmpl/default_foot.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/default_head.php b/admin/views/class_extendings/tmpl/default_head.php new file mode 100644 index 000000000..6dd2ebea1 --- /dev/null +++ b/admin/views/class_extendings/tmpl/default_head.php @@ -0,0 +1,50 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/default_toolbar.php b/admin/views/class_extendings/tmpl/default_toolbar.php new file mode 100644 index 000000000..d1859740b --- /dev/null +++ b/admin/views/class_extendings/tmpl/default_toolbar.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/index.html b/admin/views/class_extendings/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/class_extendings/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/class_extendings/view.html.php b/admin/views/class_extendings/view.html.php new file mode 100644 index 000000000..8b29a0412 --- /dev/null +++ b/admin/views/class_extendings/view.html.php @@ -0,0 +1,294 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Componentbuilder View class for the Class_extendings + */ +class ComponentbuilderViewClass_extendings extends JViewLegacy +{ + /** + * Class_extendings view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + ComponentbuilderHelper::addSubmenu('class_extendings'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('class_extends'); + $this->canEdit = $this->canDo->get('class_extends.edit'); + $this->canState = $this->canDo->get('class_extends.edit.state'); + $this->canCreate = $this->canDo->get('class_extends.create'); + $this->canDelete = $this->canDo->get('class_extends.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=class_extendings'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('class_extends.add'); + } + + // Only load if there are items + if (ComponentbuilderHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('class_extends.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('class_extendings.publish'); + JToolBarHelper::unpublishList('class_extendings.unpublish'); + JToolBarHelper::archiveList('class_extendings.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('class_extendings.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'class_extendings.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('class_extendings.trash'); + } + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('class_extendings'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Extension Type Selection + $this->extension_typeOptions = $this->getTheExtension_typeSelections(); + // We do some sanitation for Extension Type filter + if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && + isset($this->extension_typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) + { + unset($this->extension_typeOptions[0]); + } + // Only load Extension Type filter if it has values + if (ComponentbuilderHelper::checkArray($this->extension_typeOptions)) + { + // Extension Type Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL').' -', + 'filter_extension_type', + JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text', $this->state->get('filter.extension_type')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Extension Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL').' -', + 'batch[extension_type]', + JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/class_extendings.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_LABEL'), + 'a.extension_type' => JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } + + protected function getTheExtension_typeSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('extension_type')); + $query->from($db->quoteName('#__componentbuilder_class_extends')); + $query->order($db->quoteName('extension_type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $_filter = array(); + foreach ($results as $extension_type) + { + // Translate the extension_type selection + $text = $model->selectionTranslation($extension_type,'extension_type'); + // Now add the extension_type and its text to the options array + $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); + } + return $_filter; + } + return false; + } +} diff --git a/admin/views/class_extends/submitbutton.js b/admin/views/class_extends/submitbutton.js new file mode 100644 index 000000000..4072e12b8 --- /dev/null +++ b/admin/views/class_extends/submitbutton.js @@ -0,0 +1,25 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('class_extends, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/class_extends/tmpl/edit.php b/admin/views/class_extends/tmpl/edit.php new file mode 100644 index 000000000..e32f5a97b --- /dev/null +++ b/admin/views/class_extends/tmpl/edit.php @@ -0,0 +1,134 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + + + diff --git a/admin/views/class_extends/tmpl/index.html b/admin/views/class_extends/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/class_extends/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/class_extends/view.html.php b/admin/views/class_extends/view.html.php new file mode 100644 index 000000000..8d4ae267c --- /dev/null +++ b/admin/views/class_extends/view.html.php @@ -0,0 +1,210 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_extends View class + */ +class ComponentbuilderViewClass_extends extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ComponentbuilderHelper::getActions('class_extends', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_EXTENDS_NEW' : 'COM_COMPONENTBUILDER_CLASS_EXTENDS_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (ComponentbuilderHelper::checkString($this->referral)) + { + if ($this->canDo->get('class_extends.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('class_extends.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('class_extends.edit')) + { + // We can save the record. + JToolBarHelper::save('class_extends.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('class_extends.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('class_extends.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('class_extends.create')) + { + JToolBarHelper::apply('class_extends.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('class_extends.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('class_extends.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('class_extends.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('class_extends.edit')) + { + // We can save the new record + JToolBarHelper::apply('class_extends.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('class_extends.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('class_extends.create')) + { + JToolBarHelper::custom('class_extends.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('class_extends.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('class_extends.edit') && $canVersion) + { + JToolbarHelper::versions('com_componentbuilder.class_extends', $this->item->id); + } + if ($this->canDo->get('class_extends.create')) + { + JToolBarHelper::custom('class_extends.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('class_extends.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('class_extends'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_EXTENDS_NEW' : 'COM_COMPONENTBUILDER_CLASS_EXTENDS_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/class_extends.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + // Add Ajax Token + $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/class_extends/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + + // add the Uikit v2 style sheets + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + + // add Uikit v2 JavaScripts + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + // add var key + $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); + // add return_here + $this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';"); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/class_method/submitbutton.js b/admin/views/class_method/submitbutton.js new file mode 100644 index 000000000..bd292201b --- /dev/null +++ b/admin/views/class_method/submitbutton.js @@ -0,0 +1,25 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('class_method, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/class_method/tmpl/edit.php b/admin/views/class_method/tmpl/edit.php new file mode 100644 index 000000000..bd20efa59 --- /dev/null +++ b/admin/views/class_method/tmpl/edit.php @@ -0,0 +1,149 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + + + diff --git a/admin/views/class_method/tmpl/index.html b/admin/views/class_method/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/class_method/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/class_method/view.html.php b/admin/views/class_method/view.html.php new file mode 100644 index 000000000..9f5575570 --- /dev/null +++ b/admin/views/class_method/view.html.php @@ -0,0 +1,210 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_method View class + */ +class ComponentbuilderViewClass_method extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ComponentbuilderHelper::getActions('class_method', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_METHOD_NEW' : 'COM_COMPONENTBUILDER_CLASS_METHOD_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (ComponentbuilderHelper::checkString($this->referral)) + { + if ($this->canDo->get('class_method.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('class_method.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('class_method.edit')) + { + // We can save the record. + JToolBarHelper::save('class_method.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('class_method.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('class_method.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('class_method.create')) + { + JToolBarHelper::apply('class_method.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('class_method.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('class_method.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('class_method.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('class_method.edit')) + { + // We can save the new record + JToolBarHelper::apply('class_method.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('class_method.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('class_method.create')) + { + JToolBarHelper::custom('class_method.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('class_method.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('class_method.edit') && $canVersion) + { + JToolbarHelper::versions('com_componentbuilder.class_method', $this->item->id); + } + if ($this->canDo->get('class_method.create')) + { + JToolBarHelper::custom('class_method.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('class_method.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('class_method'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_METHOD_NEW' : 'COM_COMPONENTBUILDER_CLASS_METHOD_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/class_method.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + // Add Ajax Token + $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/class_method/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + + // add the Uikit v2 style sheets + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + + // add Uikit v2 JavaScripts + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + // add var key + $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); + // add return_here + $this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';"); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/class_methods/index.html b/admin/views/class_methods/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/class_methods/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/class_methods/tmpl/default.php b/admin/views/class_methods/tmpl/default.php new file mode 100644 index 000000000..e5feb483a --- /dev/null +++ b/admin/views/class_methods/tmpl/default.php @@ -0,0 +1,85 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=class_methods.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'class_methodList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
    +sidebar)): ?> +
    + sidebar; ?> +
    +
    + +
    + +items)): ?> + loadTemplate('toolbar');?> +
    + +
    + + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
    + + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
    + + + + \ No newline at end of file diff --git a/admin/views/class_methods/tmpl/default_batch_body.php b/admin/views/class_methods/tmpl/default_batch_body.php new file mode 100644 index 000000000..859550295 --- /dev/null +++ b/admin/views/class_methods/tmpl/default_batch_body.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

    +batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/class_methods/tmpl/default_batch_footer.php b/admin/views/class_methods/tmpl/default_batch_footer.php new file mode 100644 index 000000000..aa7259bc5 --- /dev/null +++ b/admin/views/class_methods/tmpl/default_batch_footer.php @@ -0,0 +1,23 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/class_methods/tmpl/default_body.php b/admin/views/class_methods/tmpl/default_body.php new file mode 100644 index 000000000..b3b54501f --- /dev/null +++ b/admin/views/class_methods/tmpl/default_body.php @@ -0,0 +1,108 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_componentbuilder&view=class_methods&task=class_method.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = ComponentbuilderHelper::getActions('class_method',$item,'class_methods'); + ?> + + + get('class_method.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('class_method.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
    + get('class_method.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'class_methods.', $canCheckin); ?> + + + escape($item->name); ?> + +
    + + + visibility); ?> + + +
    joomla_plugin_group) && ComponentbuilderHelper::checkString($item->joomla_plugin_group)): ?> + + extension_type); ?> : + escape($item->joomla_plugin_group_name); ?> + + + extension_type); ?> + +
    + + + get('class_method.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'class_methods.', true, 'cb'); ?> + + published, $i, 'class_methods.', false, 'cb'); ?> + + + published, $i, 'class_methods.', true, 'cb'); ?> + + + published, $i, 'class_methods.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/class_methods/tmpl/default_foot.php b/admin/views/class_methods/tmpl/default_foot.php new file mode 100644 index 000000000..ac9d333a7 --- /dev/null +++ b/admin/views/class_methods/tmpl/default_foot.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/class_methods/tmpl/default_head.php b/admin/views/class_methods/tmpl/default_head.php new file mode 100644 index 000000000..79573ae7c --- /dev/null +++ b/admin/views/class_methods/tmpl/default_head.php @@ -0,0 +1,53 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/class_methods/tmpl/default_toolbar.php b/admin/views/class_methods/tmpl/default_toolbar.php new file mode 100644 index 000000000..b615a0921 --- /dev/null +++ b/admin/views/class_methods/tmpl/default_toolbar.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/admin/views/class_methods/tmpl/index.html b/admin/views/class_methods/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/class_methods/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/class_methods/view.html.php b/admin/views/class_methods/view.html.php new file mode 100644 index 000000000..cb52d7e35 --- /dev/null +++ b/admin/views/class_methods/view.html.php @@ -0,0 +1,371 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Componentbuilder View class for the Class_methods + */ +class ComponentbuilderViewClass_methods extends JViewLegacy +{ + /** + * Class_methods view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + ComponentbuilderHelper::addSubmenu('class_methods'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('class_method'); + $this->canEdit = $this->canDo->get('class_method.edit'); + $this->canState = $this->canDo->get('class_method.edit.state'); + $this->canCreate = $this->canDo->get('class_method.create'); + $this->canDelete = $this->canDo->get('class_method.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_CLASS_METHODS'), 'cube'); + JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=class_methods'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('class_method.add'); + } + + // Only load if there are items + if (ComponentbuilderHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('class_method.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('class_methods.publish'); + JToolBarHelper::unpublishList('class_methods.unpublish'); + JToolBarHelper::archiveList('class_methods.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('class_methods.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'class_methods.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('class_methods.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('class_method.export')) + { + JToolBarHelper::custom('class_methods.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('class_method.import')) + { + JToolBarHelper::custom('class_methods.importData', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('class_methods'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Visibility Selection + $this->visibilityOptions = $this->getTheVisibilitySelections(); + // We do some sanitation for Visibility filter + if (ComponentbuilderHelper::checkArray($this->visibilityOptions) && + isset($this->visibilityOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->visibilityOptions[0]->value)) + { + unset($this->visibilityOptions[0]); + } + // Only load Visibility filter if it has values + if (ComponentbuilderHelper::checkArray($this->visibilityOptions)) + { + // Visibility Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL').' -', + 'filter_visibility', + JHtml::_('select.options', $this->visibilityOptions, 'value', 'text', $this->state->get('filter.visibility')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Visibility Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL').' -', + 'batch[visibility]', + JHtml::_('select.options', $this->visibilityOptions, 'value', 'text') + ); + } + } + + // Set Extension Type Selection + $this->extension_typeOptions = $this->getTheExtension_typeSelections(); + // We do some sanitation for Extension Type filter + if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && + isset($this->extension_typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) + { + unset($this->extension_typeOptions[0]); + } + // Only load Extension Type filter if it has values + if (ComponentbuilderHelper::checkArray($this->extension_typeOptions)) + { + // Extension Type Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL').' -', + 'filter_extension_type', + JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text', $this->state->get('filter.extension_type')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Extension Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL').' -', + 'batch[extension_type]', + JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_CLASS_METHODS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/class_methods.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_NAME_LABEL'), + 'a.visibility' => JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL'), + 'a.extension_type' => JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } + + protected function getTheVisibilitySelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('visibility')); + $query->from($db->quoteName('#__componentbuilder_class_method')); + $query->order($db->quoteName('visibility') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $_filter = array(); + foreach ($results as $visibility) + { + // Translate the visibility selection + $text = $model->selectionTranslation($visibility,'visibility'); + // Now add the visibility and its text to the options array + $_filter[] = JHtml::_('select.option', $visibility, JText::_($text)); + } + return $_filter; + } + return false; + } + + protected function getTheExtension_typeSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('extension_type')); + $query->from($db->quoteName('#__componentbuilder_class_method')); + $query->order($db->quoteName('extension_type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $_filter = array(); + foreach ($results as $extension_type) + { + // Translate the extension_type selection + $text = $model->selectionTranslation($extension_type,'extension_type'); + // Now add the extension_type and its text to the options array + $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); + } + return $_filter; + } + return false; + } +} diff --git a/admin/views/class_properties/index.html b/admin/views/class_properties/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/class_properties/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/class_properties/tmpl/default.php b/admin/views/class_properties/tmpl/default.php new file mode 100644 index 000000000..292fd7243 --- /dev/null +++ b/admin/views/class_properties/tmpl/default.php @@ -0,0 +1,85 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=class_properties.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'class_propertyList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
    +sidebar)): ?> +
    + sidebar; ?> +
    +
    + +
    + +items)): ?> + loadTemplate('toolbar');?> +
    + +
    + + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
    + + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
    + + + + \ No newline at end of file diff --git a/admin/views/class_properties/tmpl/default_batch_body.php b/admin/views/class_properties/tmpl/default_batch_body.php new file mode 100644 index 000000000..79e5c3af1 --- /dev/null +++ b/admin/views/class_properties/tmpl/default_batch_body.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

    +batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/class_properties/tmpl/default_batch_footer.php b/admin/views/class_properties/tmpl/default_batch_footer.php new file mode 100644 index 000000000..da14e979f --- /dev/null +++ b/admin/views/class_properties/tmpl/default_batch_footer.php @@ -0,0 +1,23 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/class_properties/tmpl/default_body.php b/admin/views/class_properties/tmpl/default_body.php new file mode 100644 index 000000000..4e892684d --- /dev/null +++ b/admin/views/class_properties/tmpl/default_body.php @@ -0,0 +1,108 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_componentbuilder&view=class_properties&task=class_property.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = ComponentbuilderHelper::getActions('class_property',$item,'class_properties'); + ?> + + + get('class_property.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('class_property.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
    + get('class_property.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'class_properties.', $canCheckin); ?> + + + escape($item->name); ?> + +
    + + + visibility); ?> + + +
    joomla_plugin_group) && ComponentbuilderHelper::checkString($item->joomla_plugin_group)): ?> + + extension_type); ?> : + escape($item->joomla_plugin_group_name); ?> + + + extension_type); ?> + +
    + + + get('class_property.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'class_properties.', true, 'cb'); ?> + + published, $i, 'class_properties.', false, 'cb'); ?> + + + published, $i, 'class_properties.', true, 'cb'); ?> + + + published, $i, 'class_properties.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/class_properties/tmpl/default_foot.php b/admin/views/class_properties/tmpl/default_foot.php new file mode 100644 index 000000000..ac9d333a7 --- /dev/null +++ b/admin/views/class_properties/tmpl/default_foot.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/class_properties/tmpl/default_head.php b/admin/views/class_properties/tmpl/default_head.php new file mode 100644 index 000000000..4d064445a --- /dev/null +++ b/admin/views/class_properties/tmpl/default_head.php @@ -0,0 +1,53 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/class_properties/tmpl/default_toolbar.php b/admin/views/class_properties/tmpl/default_toolbar.php new file mode 100644 index 000000000..ad3652bcb --- /dev/null +++ b/admin/views/class_properties/tmpl/default_toolbar.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/admin/views/class_properties/tmpl/index.html b/admin/views/class_properties/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/class_properties/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/class_properties/view.html.php b/admin/views/class_properties/view.html.php new file mode 100644 index 000000000..e7c55ac70 --- /dev/null +++ b/admin/views/class_properties/view.html.php @@ -0,0 +1,371 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Componentbuilder View class for the Class_properties + */ +class ComponentbuilderViewClass_properties extends JViewLegacy +{ + /** + * Class_properties view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + ComponentbuilderHelper::addSubmenu('class_properties'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('class_property'); + $this->canEdit = $this->canDo->get('class_property.edit'); + $this->canState = $this->canDo->get('class_property.edit.state'); + $this->canCreate = $this->canDo->get('class_property.create'); + $this->canDelete = $this->canDo->get('class_property.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTIES'), 'cube'); + JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=class_properties'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('class_property.add'); + } + + // Only load if there are items + if (ComponentbuilderHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('class_property.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('class_properties.publish'); + JToolBarHelper::unpublishList('class_properties.unpublish'); + JToolBarHelper::archiveList('class_properties.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('class_properties.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'class_properties.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('class_properties.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('class_property.export')) + { + JToolBarHelper::custom('class_properties.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('class_property.import')) + { + JToolBarHelper::custom('class_properties.importData', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('class_properties'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Visibility Selection + $this->visibilityOptions = $this->getTheVisibilitySelections(); + // We do some sanitation for Visibility filter + if (ComponentbuilderHelper::checkArray($this->visibilityOptions) && + isset($this->visibilityOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->visibilityOptions[0]->value)) + { + unset($this->visibilityOptions[0]); + } + // Only load Visibility filter if it has values + if (ComponentbuilderHelper::checkArray($this->visibilityOptions)) + { + // Visibility Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL').' -', + 'filter_visibility', + JHtml::_('select.options', $this->visibilityOptions, 'value', 'text', $this->state->get('filter.visibility')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Visibility Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL').' -', + 'batch[visibility]', + JHtml::_('select.options', $this->visibilityOptions, 'value', 'text') + ); + } + } + + // Set Extension Type Selection + $this->extension_typeOptions = $this->getTheExtension_typeSelections(); + // We do some sanitation for Extension Type filter + if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && + isset($this->extension_typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) + { + unset($this->extension_typeOptions[0]); + } + // Only load Extension Type filter if it has values + if (ComponentbuilderHelper::checkArray($this->extension_typeOptions)) + { + // Extension Type Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL').' -', + 'filter_extension_type', + JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text', $this->state->get('filter.extension_type')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Extension Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL').' -', + 'batch[extension_type]', + JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTIES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/class_properties.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_LABEL'), + 'a.visibility' => JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL'), + 'a.extension_type' => JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } + + protected function getTheVisibilitySelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('visibility')); + $query->from($db->quoteName('#__componentbuilder_class_property')); + $query->order($db->quoteName('visibility') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $_filter = array(); + foreach ($results as $visibility) + { + // Translate the visibility selection + $text = $model->selectionTranslation($visibility,'visibility'); + // Now add the visibility and its text to the options array + $_filter[] = JHtml::_('select.option', $visibility, JText::_($text)); + } + return $_filter; + } + return false; + } + + protected function getTheExtension_typeSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('extension_type')); + $query->from($db->quoteName('#__componentbuilder_class_property')); + $query->order($db->quoteName('extension_type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $_filter = array(); + foreach ($results as $extension_type) + { + // Translate the extension_type selection + $text = $model->selectionTranslation($extension_type,'extension_type'); + // Now add the extension_type and its text to the options array + $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); + } + return $_filter; + } + return false; + } +} diff --git a/admin/views/class_property/submitbutton.js b/admin/views/class_property/submitbutton.js new file mode 100644 index 000000000..29ce1c823 --- /dev/null +++ b/admin/views/class_property/submitbutton.js @@ -0,0 +1,25 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('class_property, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/class_property/tmpl/edit.php b/admin/views/class_property/tmpl/edit.php new file mode 100644 index 000000000..a5de40087 --- /dev/null +++ b/admin/views/class_property/tmpl/edit.php @@ -0,0 +1,144 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + + + diff --git a/admin/views/class_property/tmpl/index.html b/admin/views/class_property/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/class_property/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/class_property/view.html.php b/admin/views/class_property/view.html.php new file mode 100644 index 000000000..028dd240d --- /dev/null +++ b/admin/views/class_property/view.html.php @@ -0,0 +1,210 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Class_property View class + */ +class ComponentbuilderViewClass_property extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ComponentbuilderHelper::getActions('class_property', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_PROPERTY_NEW' : 'COM_COMPONENTBUILDER_CLASS_PROPERTY_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (ComponentbuilderHelper::checkString($this->referral)) + { + if ($this->canDo->get('class_property.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('class_property.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('class_property.edit')) + { + // We can save the record. + JToolBarHelper::save('class_property.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('class_property.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('class_property.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('class_property.create')) + { + JToolBarHelper::apply('class_property.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('class_property.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('class_property.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('class_property.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('class_property.edit')) + { + // We can save the new record + JToolBarHelper::apply('class_property.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('class_property.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('class_property.create')) + { + JToolBarHelper::custom('class_property.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('class_property.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('class_property.edit') && $canVersion) + { + JToolbarHelper::versions('com_componentbuilder.class_property', $this->item->id); + } + if ($this->canDo->get('class_property.create')) + { + JToolBarHelper::custom('class_property.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('class_property.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('class_property'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_PROPERTY_NEW' : 'COM_COMPONENTBUILDER_CLASS_PROPERTY_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/class_property.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + // Add Ajax Token + $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/class_property/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + + // add the Uikit v2 style sheets + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + + // add Uikit v2 JavaScripts + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + // add var key + $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); + // add return_here + $this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';"); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/compiler/tmpl/default.php b/admin/views/compiler/tmpl/default.php index 4d1a32449..040f84dcb 100644 --- a/admin/views/compiler/tmpl/default.php +++ b/admin/views/compiler/tmpl/default.php @@ -22,13 +22,25 @@ JHtml::_('behavior.formvalidation'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); ?> -canDo->get('compiler.access')): ?> +canDo->get('compiler.access')): ?> +
    sidebar)): ?> @@ -111,6 +129,7 @@ jQuery(document).ready(function($) { + diff --git a/admin/views/compiler/view.html.php b/admin/views/compiler/view.html.php index a814874f9..25579ac97 100644 --- a/admin/views/compiler/view.html.php +++ b/admin/views/compiler/view.html.php @@ -231,16 +231,16 @@ class ComponentbuilderViewCompiler extends JViewLegacy // Set the Custom JS script to view $this->document->addScriptDeclaration(" function getComponentDetails_server(id){ - var getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.getComponentDetails&format=json\"); + var getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.getComponentDetails&format=json&raw=true\"); if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id; + var request = token+'=1&id='+id; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function getComponentDetails(id) { @@ -273,19 +273,19 @@ class ComponentbuilderViewCompiler extends JViewLegacy // to check is READ/NEW function getIS(type,notice){ if (type == 1) { - var getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.isNew&format=json\"); + var getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.isNew&format=json&raw=true\"); } else if (type == 2) { - var getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.isRead&format=json\"); + var getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.isRead&format=json&raw=true\"); } if(token.length > 0 && notice.length){ - var request = \"token=\"+token+\"¬ice=\"+notice; + var request = token+\"=1¬ice=\"+notice; } return jQuery.ajax({ type: \"POST\", url: getUrl, - dataType: \"jsonp\", + dataType: 'json', data: request, - jsonp: \"callback\" + jsonp: false }); } "); diff --git a/admin/views/component_dashboard/tmpl/edit.php b/admin/views/component_dashboard/tmpl/edit.php index 6fbb3b9eb..be38a716d 100644 --- a/admin/views/component_dashboard/tmpl/edit.php +++ b/admin/views/component_dashboard/tmpl/edit.php @@ -103,4 +103,27 @@ $componentParams = $this->params; // will be removed just use $this->params inst
    -
    + + + diff --git a/admin/views/component_plugins/submitbutton.js b/admin/views/component_plugins/submitbutton.js new file mode 100644 index 000000000..2fa7c8d05 --- /dev/null +++ b/admin/views/component_plugins/submitbutton.js @@ -0,0 +1,25 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('component_plugins, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/component_plugins/tmpl/edit.php b/admin/views/component_plugins/tmpl/edit.php new file mode 100644 index 000000000..a216bc398 --- /dev/null +++ b/admin/views/component_plugins/tmpl/edit.php @@ -0,0 +1,122 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + + + diff --git a/admin/views/component_plugins/tmpl/index.html b/admin/views/component_plugins/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/component_plugins/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/component_plugins/view.html.php b/admin/views/component_plugins/view.html.php new file mode 100644 index 000000000..22ab26463 --- /dev/null +++ b/admin/views/component_plugins/view.html.php @@ -0,0 +1,195 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Component_plugins View class + */ +class ComponentbuilderViewComponent_plugins extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ComponentbuilderHelper::getActions('component_plugins', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (ComponentbuilderHelper::checkString($this->referral)) + { + if ($this->canDo->get('component_plugins.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('component_plugins.edit')) + { + // We can save the record. + JToolBarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('component_plugins.create')) + { + JToolBarHelper::apply('component_plugins.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('component_plugins.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('component_plugins.edit')) + { + // We can save the new record + JToolBarHelper::apply('component_plugins.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('component_plugins.create')) + { + JToolBarHelper::custom('component_plugins.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_plugins.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_plugins.edit') && $canVersion) + { + JToolbarHelper::versions('com_componentbuilder.component_plugins', $this->item->id); + } + if ($this->canDo->get('component_plugins.create')) + { + JToolBarHelper::custom('component_plugins.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('component_plugins'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/component_plugins.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/component_plugins/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/components_plugins/index.html b/admin/views/components_plugins/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/components_plugins/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/components_plugins/tmpl/default.php b/admin/views/components_plugins/tmpl/default.php new file mode 100644 index 000000000..fcda40cbe --- /dev/null +++ b/admin/views/components_plugins/tmpl/default.php @@ -0,0 +1,85 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_plugins.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'component_pluginsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
    +sidebar)): ?> +
    + sidebar; ?> +
    +
    + +
    + +items)): ?> + loadTemplate('toolbar');?> +
    + +
    + + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
    + + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
    + + + + \ No newline at end of file diff --git a/admin/views/components_plugins/tmpl/default_batch_body.php b/admin/views/components_plugins/tmpl/default_batch_body.php new file mode 100644 index 000000000..51c9b586d --- /dev/null +++ b/admin/views/components_plugins/tmpl/default_batch_body.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

    +batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/components_plugins/tmpl/default_batch_footer.php b/admin/views/components_plugins/tmpl/default_batch_footer.php new file mode 100644 index 000000000..d6ebacf1a --- /dev/null +++ b/admin/views/components_plugins/tmpl/default_batch_footer.php @@ -0,0 +1,23 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/components_plugins/tmpl/default_body.php b/admin/views/components_plugins/tmpl/default_body.php new file mode 100644 index 000000000..3ba32fc0b --- /dev/null +++ b/admin/views/components_plugins/tmpl/default_body.php @@ -0,0 +1,94 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_componentbuilder&view=components_plugins&task=component_plugins.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = ComponentbuilderHelper::getActions('component_plugins',$item,'components_plugins'); + ?> + + + get('component_plugins.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('component_plugins.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
    + get('component_plugins.edit')): ?> + escape($item->joomla_component_system_name); ?> + checked_out): ?> + name, $item->checked_out_time, 'components_plugins.', $canCheckin); ?> + + + escape($item->joomla_component_system_name); ?> + +
    + + + get('component_plugins.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'components_plugins.', true, 'cb'); ?> + + published, $i, 'components_plugins.', false, 'cb'); ?> + + + published, $i, 'components_plugins.', true, 'cb'); ?> + + + published, $i, 'components_plugins.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/components_plugins/tmpl/default_foot.php b/admin/views/components_plugins/tmpl/default_foot.php new file mode 100644 index 000000000..d020003b6 --- /dev/null +++ b/admin/views/components_plugins/tmpl/default_foot.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/components_plugins/tmpl/default_head.php b/admin/views/components_plugins/tmpl/default_head.php new file mode 100644 index 000000000..6244238d4 --- /dev/null +++ b/admin/views/components_plugins/tmpl/default_head.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/components_plugins/tmpl/default_toolbar.php b/admin/views/components_plugins/tmpl/default_toolbar.php new file mode 100644 index 000000000..feaa464f6 --- /dev/null +++ b/admin/views/components_plugins/tmpl/default_toolbar.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/admin/views/components_plugins/tmpl/index.html b/admin/views/components_plugins/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/components_plugins/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/components_plugins/view.html.php b/admin/views/components_plugins/view.html.php new file mode 100644 index 000000000..e0aa34fab --- /dev/null +++ b/admin/views/components_plugins/view.html.php @@ -0,0 +1,226 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Componentbuilder View class for the Components_plugins + */ +class ComponentbuilderViewComponents_plugins extends JViewLegacy +{ + /** + * Components_plugins view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + ComponentbuilderHelper::addSubmenu('components_plugins'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('component_plugins'); + $this->canEdit = $this->canDo->get('component_plugins.edit'); + $this->canState = $this->canDo->get('component_plugins.edit.state'); + $this->canCreate = $this->canDo->get('component_plugins.create'); + $this->canDelete = $this->canDo->get('component_plugins.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=components_plugins'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('component_plugins.add'); + } + + // Only load if there are items + if (ComponentbuilderHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('component_plugins.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('components_plugins.publish'); + JToolBarHelper::unpublishList('components_plugins.unpublish'); + JToolBarHelper::archiveList('components_plugins.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('components_plugins.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'components_plugins.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('components_plugins.trash'); + } + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('components_plugins'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/components_plugins.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/custom_admin_view/tmpl/edit.php b/admin/views/custom_admin_view/tmpl/edit.php index bfb648fda..43422a68f 100644 --- a/admin/views/custom_admin_view/tmpl/edit.php +++ b/admin/views/custom_admin_view/tmpl/edit.php @@ -163,153 +163,153 @@ $componentParams = $this->params; // will be removed just use $this->params inst diff --git a/admin/views/dynamic_get/tmpl/edit.php b/admin/views/dynamic_get/tmpl/edit.php index 8a35153e3..1b55da98a 100644 --- a/admin/views/dynamic_get/tmpl/edit.php +++ b/admin/views/dynamic_get/tmpl/edit.php @@ -159,485 +159,485 @@ $componentParams = $this->params; // will be removed just use $this->params inst diff --git a/admin/views/fieldtype/view.html.php b/admin/views/fieldtype/view.html.php index c5392c3f2..21c2c6749 100644 --- a/admin/views/fieldtype/view.html.php +++ b/admin/views/fieldtype/view.html.php @@ -57,7 +57,7 @@ class ComponentbuilderViewFieldtype extends JViewLegacy } // Get Linked view data - $this->warfields = $this->get('Warfields'); + $this->vxwfields = $this->get('Vxwfields'); // Set the toolbar $this->addToolBar(); diff --git a/admin/views/get_snippets/tmpl/default.php b/admin/views/get_snippets/tmpl/default.php index 9a032bcdf..7940efa28 100644 --- a/admin/views/get_snippets/tmpl/default.php +++ b/admin/views/get_snippets/tmpl/default.php @@ -226,7 +226,24 @@ jQuery(document).ready( function($) { } $(".loading-dots").text(dots); } , 500); -}); +}); + + +function JRouter(link) { +isSite()) + { + echo 'var url = "'.JURI::root().'";'; + } + else + { + echo 'var url = "";'; + } +?> + return url+link; +}

    diff --git a/admin/views/help_document/tmpl/edit.php b/admin/views/help_document/tmpl/edit.php index 7871eb94b..0f93c9b50 100644 --- a/admin/views/help_document/tmpl/edit.php +++ b/admin/views/help_document/tmpl/edit.php @@ -116,93 +116,93 @@ $componentParams = $this->params; // will be removed just use $this->params inst + + + diff --git a/admin/views/joomla_plugin/tmpl/index.html b/admin/views/joomla_plugin/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugin/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugin/view.html.php b/admin/views/joomla_plugin/view.html.php new file mode 100644 index 000000000..26043dd9e --- /dev/null +++ b/admin/views/joomla_plugin/view.html.php @@ -0,0 +1,287 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin View class + */ +class ComponentbuilderViewJoomla_plugin extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (ComponentbuilderHelper::checkString($this->referral)) + { + if ($this->canDo->get('joomla_plugin.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('joomla_plugin.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('joomla_plugin.edit')) + { + // We can save the record. + JToolBarHelper::save('joomla_plugin.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('joomla_plugin.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('joomla_plugin.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('joomla_plugin.create')) + { + JToolBarHelper::apply('joomla_plugin.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('joomla_plugin.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('joomla_plugin.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('joomla_plugin.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('joomla_plugin.edit')) + { + // We can save the new record + JToolBarHelper::apply('joomla_plugin.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('joomla_plugin.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('joomla_plugin.create')) + { + JToolBarHelper::custom('joomla_plugin.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('joomla_plugin.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('joomla_plugin.edit') && $canVersion) + { + JToolbarHelper::versions('com_componentbuilder.joomla_plugin', $this->item->id); + } + if ($this->canDo->get('joomla_plugin.create')) + { + JToolBarHelper::custom('joomla_plugin.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('joomla_plugin.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/joomla_plugin.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + // Add Ajax Token + $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/joomla_plugin/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + + // add the Uikit v2 style sheets + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + + // add Uikit v2 JavaScripts + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + // Add the JavaScript for JStore + $this->document->addScript(JURI::root() .'media/com_componentbuilder/js/jquery.json.min.js'); + $this->document->addScript(JURI::root() .'media/com_componentbuilder/js/jstorage.min.js'); + $this->document->addScript(JURI::root() .'media/com_componentbuilder/js/strtotime.js'); + // add var key + $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); + // add return_here + $this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';"); + // set some lang + JText::script('COM_COMPONENTBUILDER_ALREADY_SELECTED_TRY_ANOTHER'); + JText::script('COM_COMPONENTBUILDER_TYPE_OR_SELECT_SOME_OPTIONS'); + JText::script('COM_COMPONENTBUILDER_NO_RESULTS_MATCH'); + JText::script('COM_COMPONENTBUILDER_SELECT_A_PROPERTY'); + JText::script('COM_COMPONENTBUILDER_NO_DESCRIPTION_FOUND'); + // check if we should use browser storage + $setBrowserStorage = $this->params->get('set_browser_storage', null); + if ($setBrowserStorage) + { + // check what (Time To Live) show we use + $storageTimeToLive = $this->params->get('storage_time_to_live', 'global'); + if ('global' == $storageTimeToLive) + { + // use the global session time + $session = JFactory::getSession(); + // must have itin milliseconds + $expire = ($session->getExpire()*60)* 1000; + } + else + { + // use the Componentbuilder Global setting + if (0 != $storageTimeToLive) + { + // this will convert the time into milliseconds + $storageTimeToLive = $storageTimeToLive * 1000; + } + $expire = $storageTimeToLive; + } + } + else + { + // set to use no storage + $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':{}};"); + // add a few field options via PHP + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + $tmp_ = JFormHelper::loadFieldType('joomlaplugingroups')->options; + if (ComponentbuilderHelper::checkArray($tmp_)) + { + $_tmp = array(); + foreach ($tmp_ as $item) + { + $_tmp[$item->value] = $item->text; + } + // Set the values to JavaScript + $this->document->addScriptDeclaration("selectionArray['joomla_plugin_group'] = ". json_encode($_tmp) . ";"); + } + $tmp_ = JFormHelper::loadFieldType('pluginsclassproperties')->options; + if (ComponentbuilderHelper::checkArray($tmp_)) + { + $_tmp = array(); + foreach ($tmp_ as $item) + { + $_tmp[$item->value] = $item->text; + } + // Set the values to JavaScript + $this->document->addScriptDeclaration("selectionArray['property'] = ". json_encode($_tmp) . ";"); + } + $tmp_ = JFormHelper::loadFieldType('pluginsclassmethods')->options; + if (ComponentbuilderHelper::checkArray($tmp_)) + { + $_tmp = array(); + foreach ($tmp_ as $item) + { + $_tmp[$item->value] = $item->text; + } + // Set the values to JavaScript + $this->document->addScriptDeclaration("selectionArray['method'] = ". json_encode($_tmp) . ";"); + } + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/joomla_plugin_files_folders_urls/submitbutton.js b/admin/views/joomla_plugin_files_folders_urls/submitbutton.js new file mode 100644 index 000000000..ebc76f219 --- /dev/null +++ b/admin/views/joomla_plugin_files_folders_urls/submitbutton.js @@ -0,0 +1,25 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('joomla_plugin_files_folders_urls, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/joomla_plugin_files_folders_urls/tmpl/edit.php b/admin/views/joomla_plugin_files_folders_urls/tmpl/edit.php new file mode 100644 index 000000000..72798c3f4 --- /dev/null +++ b/admin/views/joomla_plugin_files_folders_urls/tmpl/edit.php @@ -0,0 +1,116 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/joomla_plugin_files_folders_urls/tmpl/index.html b/admin/views/joomla_plugin_files_folders_urls/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugin_files_folders_urls/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugin_files_folders_urls/view.html.php b/admin/views/joomla_plugin_files_folders_urls/view.html.php new file mode 100644 index 000000000..eeae8920d --- /dev/null +++ b/admin/views/joomla_plugin_files_folders_urls/view.html.php @@ -0,0 +1,195 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin_files_folders_urls View class + */ +class ComponentbuilderViewJoomla_plugin_files_folders_urls extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (ComponentbuilderHelper::checkString($this->referral)) + { + if ($this->canDo->get('joomla_plugin_files_folders_urls.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('joomla_plugin_files_folders_urls.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('joomla_plugin_files_folders_urls.edit')) + { + // We can save the record. + JToolBarHelper::save('joomla_plugin_files_folders_urls.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('joomla_plugin_files_folders_urls.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('joomla_plugin_files_folders_urls.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('joomla_plugin_files_folders_urls.create')) + { + JToolBarHelper::apply('joomla_plugin_files_folders_urls.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('joomla_plugin_files_folders_urls.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('joomla_plugin_files_folders_urls.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('joomla_plugin_files_folders_urls.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('joomla_plugin_files_folders_urls.edit')) + { + // We can save the new record + JToolBarHelper::apply('joomla_plugin_files_folders_urls.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('joomla_plugin_files_folders_urls.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('joomla_plugin_files_folders_urls.create')) + { + JToolBarHelper::custom('joomla_plugin_files_folders_urls.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('joomla_plugin_files_folders_urls.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('joomla_plugin_files_folders_urls.edit') && $canVersion) + { + JToolbarHelper::versions('com_componentbuilder.joomla_plugin_files_folders_urls', $this->item->id); + } + if ($this->canDo->get('joomla_plugin_files_folders_urls.create')) + { + JToolBarHelper::custom('joomla_plugin_files_folders_urls.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('joomla_plugin_files_folders_urls.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_files_folders_urls'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/joomla_plugin_files_folders_urls.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/joomla_plugin_files_folders_urls/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/joomla_plugin_group/submitbutton.js b/admin/views/joomla_plugin_group/submitbutton.js new file mode 100644 index 000000000..416ac7411 --- /dev/null +++ b/admin/views/joomla_plugin_group/submitbutton.js @@ -0,0 +1,25 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('joomla_plugin_group, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/joomla_plugin_group/tmpl/edit.php b/admin/views/joomla_plugin_group/tmpl/edit.php new file mode 100644 index 000000000..dfc96bcc4 --- /dev/null +++ b/admin/views/joomla_plugin_group/tmpl/edit.php @@ -0,0 +1,106 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/joomla_plugin_group/tmpl/index.html b/admin/views/joomla_plugin_group/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugin_group/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugin_group/view.html.php b/admin/views/joomla_plugin_group/view.html.php new file mode 100644 index 000000000..31900844b --- /dev/null +++ b/admin/views/joomla_plugin_group/view.html.php @@ -0,0 +1,195 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin_group View class + */ +class ComponentbuilderViewJoomla_plugin_group extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_group', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (ComponentbuilderHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('joomla_plugin_group.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('joomla_plugin_group.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('joomla_plugin_group.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('joomla_plugin_group.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('joomla_plugin_group.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('joomla_plugin_group.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('joomla_plugin_group.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('joomla_plugin_group.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('joomla_plugin_group.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('joomla_plugin_group.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('joomla_plugin_group.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('joomla_plugin_group.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_componentbuilder.joomla_plugin_group', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('joomla_plugin_group.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('joomla_plugin_group.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_group'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/joomla_plugin_group.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/joomla_plugin_group/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/joomla_plugin_groups/index.html b/admin/views/joomla_plugin_groups/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugin_groups/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/tmpl/default.php b/admin/views/joomla_plugin_groups/tmpl/default.php new file mode 100644 index 000000000..740225e17 --- /dev/null +++ b/admin/views/joomla_plugin_groups/tmpl/default.php @@ -0,0 +1,85 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_plugin_groups.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'joomla_plugin_groupList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
    +sidebar)): ?> +
    + sidebar; ?> +
    +
    + +
    + +items)): ?> + loadTemplate('toolbar');?> +
    + +
    + + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
    + + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
    + + + + \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/tmpl/default_batch_body.php b/admin/views/joomla_plugin_groups/tmpl/default_batch_body.php new file mode 100644 index 000000000..04c57dde2 --- /dev/null +++ b/admin/views/joomla_plugin_groups/tmpl/default_batch_body.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

    +batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/tmpl/default_batch_footer.php b/admin/views/joomla_plugin_groups/tmpl/default_batch_footer.php new file mode 100644 index 000000000..600af95e2 --- /dev/null +++ b/admin/views/joomla_plugin_groups/tmpl/default_batch_footer.php @@ -0,0 +1,23 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/tmpl/default_body.php b/admin/views/joomla_plugin_groups/tmpl/default_body.php new file mode 100644 index 000000000..e0d516589 --- /dev/null +++ b/admin/views/joomla_plugin_groups/tmpl/default_body.php @@ -0,0 +1,103 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=joomla_plugin_group.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = ComponentbuilderHelper::getActions('joomla_plugin_group',$item,'joomla_plugin_groups'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
    + get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'joomla_plugin_groups.', $canCheckin); ?> + + + escape($item->name); ?> + +
    + + +
    + user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int)$item->class_extends)): ?> + escape($item->class_extends_name); ?> + + escape($item->class_extends_name); ?> + +
    + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'joomla_plugin_groups.', true, 'cb'); ?> + + published, $i, 'joomla_plugin_groups.', false, 'cb'); ?> + + + published, $i, 'joomla_plugin_groups.', true, 'cb'); ?> + + + published, $i, 'joomla_plugin_groups.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/tmpl/default_foot.php b/admin/views/joomla_plugin_groups/tmpl/default_foot.php new file mode 100644 index 000000000..5d5ceb4bf --- /dev/null +++ b/admin/views/joomla_plugin_groups/tmpl/default_foot.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/tmpl/default_head.php b/admin/views/joomla_plugin_groups/tmpl/default_head.php new file mode 100644 index 000000000..c1ed60a09 --- /dev/null +++ b/admin/views/joomla_plugin_groups/tmpl/default_head.php @@ -0,0 +1,50 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/tmpl/default_toolbar.php b/admin/views/joomla_plugin_groups/tmpl/default_toolbar.php new file mode 100644 index 000000000..bcb6a01a6 --- /dev/null +++ b/admin/views/joomla_plugin_groups/tmpl/default_toolbar.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/tmpl/index.html b/admin/views/joomla_plugin_groups/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugin_groups/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/view.html.php b/admin/views/joomla_plugin_groups/view.html.php new file mode 100644 index 000000000..bccfce0ba --- /dev/null +++ b/admin/views/joomla_plugin_groups/view.html.php @@ -0,0 +1,258 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Componentbuilder View class for the Joomla_plugin_groups + */ +class ComponentbuilderViewJoomla_plugin_groups extends JViewLegacy +{ + /** + * Joomla_plugin_groups view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + ComponentbuilderHelper::addSubmenu('joomla_plugin_groups'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_group'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=joomla_plugin_groups'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('joomla_plugin_group.add'); + } + + // Only load if there are items + if (ComponentbuilderHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('joomla_plugin_group.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('joomla_plugin_groups.publish'); + JToolBarHelper::unpublishList('joomla_plugin_groups.unpublish'); + JToolBarHelper::archiveList('joomla_plugin_groups.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('joomla_plugin_groups.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'joomla_plugin_groups.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('joomla_plugin_groups.trash'); + } + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_groups'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Class Extends Name Selection + $this->class_extendsNameOptions = JFormHelper::loadFieldType('Classextends')->options; + // We do some sanitation for Class Extends Name filter + if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions) && + isset($this->class_extendsNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->class_extendsNameOptions[0]->value)) + { + unset($this->class_extendsNameOptions[0]); + } + // Only load Class Extends Name filter if it has values + if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions)) + { + // Class Extends Name Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_LABEL').' -', + 'filter_class_extends', + JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text', $this->state->get('filter.class_extends')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Class Extends Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_LABEL').' -', + 'batch[class_extends]', + JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/joomla_plugin_groups.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_LABEL'), + 'g.name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/joomla_plugin_updates/submitbutton.js b/admin/views/joomla_plugin_updates/submitbutton.js new file mode 100644 index 000000000..ac3691215 --- /dev/null +++ b/admin/views/joomla_plugin_updates/submitbutton.js @@ -0,0 +1,25 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('joomla_plugin_updates, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/joomla_plugin_updates/tmpl/edit.php b/admin/views/joomla_plugin_updates/tmpl/edit.php new file mode 100644 index 000000000..e911d995e --- /dev/null +++ b/admin/views/joomla_plugin_updates/tmpl/edit.php @@ -0,0 +1,106 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/joomla_plugin_updates/tmpl/index.html b/admin/views/joomla_plugin_updates/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugin_updates/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugin_updates/view.html.php b/admin/views/joomla_plugin_updates/view.html.php new file mode 100644 index 000000000..4fd25bb53 --- /dev/null +++ b/admin/views/joomla_plugin_updates/view.html.php @@ -0,0 +1,195 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Joomla_plugin_updates View class + */ +class ComponentbuilderViewJoomla_plugin_updates extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (ComponentbuilderHelper::checkString($this->referral)) + { + if ($this->canDo->get('joomla_plugin_updates.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('joomla_plugin_updates.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('joomla_plugin_updates.edit')) + { + // We can save the record. + JToolBarHelper::save('joomla_plugin_updates.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('joomla_plugin_updates.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('joomla_plugin_updates.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('joomla_plugin_updates.create')) + { + JToolBarHelper::apply('joomla_plugin_updates.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('joomla_plugin_updates.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('joomla_plugin_updates.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('joomla_plugin_updates.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('joomla_plugin_updates.edit')) + { + // We can save the new record + JToolBarHelper::apply('joomla_plugin_updates.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('joomla_plugin_updates.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('joomla_plugin_updates.create')) + { + JToolBarHelper::custom('joomla_plugin_updates.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('joomla_plugin_updates.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('joomla_plugin_updates.edit') && $canVersion) + { + JToolbarHelper::versions('com_componentbuilder.joomla_plugin_updates', $this->item->id); + } + if ($this->canDo->get('joomla_plugin_updates.create')) + { + JToolBarHelper::custom('joomla_plugin_updates.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('joomla_plugin_updates.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_updates'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/joomla_plugin_updates.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/joomla_plugin_updates/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/joomla_plugins/index.html b/admin/views/joomla_plugins/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugins/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugins/tmpl/default.php b/admin/views/joomla_plugins/tmpl/default.php new file mode 100644 index 000000000..02db0d9c7 --- /dev/null +++ b/admin/views/joomla_plugins/tmpl/default.php @@ -0,0 +1,108 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_plugins.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'joomla_pluginList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
    +sidebar)): ?> +
    + sidebar; ?> +
    +
    + +
    + +items)): ?> + loadTemplate('toolbar');?> +
    + +
    + + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
    + + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
    + + + + + \ No newline at end of file diff --git a/admin/views/joomla_plugins/tmpl/default_batch_body.php b/admin/views/joomla_plugins/tmpl/default_batch_body.php new file mode 100644 index 000000000..9943660cc --- /dev/null +++ b/admin/views/joomla_plugins/tmpl/default_batch_body.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

    +batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/joomla_plugins/tmpl/default_batch_footer.php b/admin/views/joomla_plugins/tmpl/default_batch_footer.php new file mode 100644 index 000000000..b7dd697fb --- /dev/null +++ b/admin/views/joomla_plugins/tmpl/default_batch_footer.php @@ -0,0 +1,23 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/joomla_plugins/tmpl/default_body.php b/admin/views/joomla_plugins/tmpl/default_body.php new file mode 100644 index 000000000..e25d157b6 --- /dev/null +++ b/admin/views/joomla_plugins/tmpl/default_body.php @@ -0,0 +1,141 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_plugin.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = ComponentbuilderHelper::getActions('joomla_plugin',$item,'joomla_plugins'); + ?> + + + get('joomla_plugin.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('joomla_plugin.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
    + get('joomla_plugin.edit')): ?> + escape($item->system_name); ?> + checked_out): ?> + name, $item->checked_out_time, 'joomla_plugins.', $canCheckin); ?> + + + escape($item->system_name); ?> + - + escape($item->plugin_version); ?> +
    + 'joomla_plugin_updates', + 'views' => 'joomla_plugins_updates', + 'title' => JText::_('COM_COMPONENTBUILDER_THE_PLUGIN_UPDATES'), + 'icon' => 'database'), + array( + 'view' => 'joomla_plugin_files_folders_urls', + 'views' => 'joomla_plugins_files_folders_urls', + 'title' => JText::_('COM_COMPONENTBUILDER_THE_PLUGIN_FILES_FOLDERS'), + 'icon' => 'briefcase') + ); + } + ?> +
    + + get($_button['view'].'.edit') && ($id = ComponentbuilderHelper::getVar($_button['view'], $item->id, 'joomla_plugin', 'id')) !== false): ?> + + get($_button['view'].'.create')): ?> + + + +
    + + +
    + user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int)$item->class_extends)): ?> + escape($item->class_extends_name); ?> + + escape($item->class_extends_name); ?> + +
    + + +
    + user->authorise('core.edit', 'com_componentbuilder.joomla_plugin_group.' . (int)$item->joomla_plugin_group)): ?> + escape($item->joomla_plugin_group_name); ?> + + escape($item->joomla_plugin_group_name); ?> + +
    + + + get('joomla_plugin.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'joomla_plugins.', true, 'cb'); ?> + + published, $i, 'joomla_plugins.', false, 'cb'); ?> + + + published, $i, 'joomla_plugins.', true, 'cb'); ?> + + + published, $i, 'joomla_plugins.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/joomla_plugins/tmpl/default_foot.php b/admin/views/joomla_plugins/tmpl/default_foot.php new file mode 100644 index 000000000..ac9d333a7 --- /dev/null +++ b/admin/views/joomla_plugins/tmpl/default_foot.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/joomla_plugins/tmpl/default_head.php b/admin/views/joomla_plugins/tmpl/default_head.php new file mode 100644 index 000000000..b68ee102b --- /dev/null +++ b/admin/views/joomla_plugins/tmpl/default_head.php @@ -0,0 +1,53 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/joomla_plugins/tmpl/default_toolbar.php b/admin/views/joomla_plugins/tmpl/default_toolbar.php new file mode 100644 index 000000000..89614dc35 --- /dev/null +++ b/admin/views/joomla_plugins/tmpl/default_toolbar.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/admin/views/joomla_plugins/tmpl/index.html b/admin/views/joomla_plugins/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugins/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugins/view.html.php b/admin/views/joomla_plugins/view.html.php new file mode 100644 index 000000000..56c9dc864 --- /dev/null +++ b/admin/views/joomla_plugins/view.html.php @@ -0,0 +1,309 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Componentbuilder View class for the Joomla_plugins + */ +class ComponentbuilderViewJoomla_plugins extends JViewLegacy +{ + /** + * Joomla_plugins view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + ComponentbuilderHelper::addSubmenu('joomla_plugins'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin'); + $this->canEdit = $this->canDo->get('joomla_plugin.edit'); + $this->canState = $this->canDo->get('joomla_plugin.edit.state'); + $this->canCreate = $this->canDo->get('joomla_plugin.create'); + $this->canDelete = $this->canDo->get('joomla_plugin.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS'), 'power-cord'); + JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=joomla_plugins'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('joomla_plugin.add'); + } + + // Only load if there are items + if (ComponentbuilderHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('joomla_plugin.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('joomla_plugins.publish'); + JToolBarHelper::unpublishList('joomla_plugins.unpublish'); + JToolBarHelper::archiveList('joomla_plugins.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('joomla_plugins.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'joomla_plugins.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('joomla_plugins.trash'); + } + } + if ($this->user->authorise('joomla_plugin.run_expansion', 'com_componentbuilder')) + { + // add Run Expansion button. + JToolBarHelper::custom('joomla_plugins.runExpansion', 'expand-2', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false); + } + if ($this->user->authorise('joomla_plugin.get_boilerplate', 'com_componentbuilder')) + { + // add Get Boilerplate button. + JToolBarHelper::custom('joomla_plugins.getBoilerplate', 'joomla', '', 'COM_COMPONENTBUILDER_GET_BOILERPLATE', false); + } + if ($this->user->authorise('joomla_plugin.methods', 'com_componentbuilder')) + { + // add Methods button. + JToolBarHelper::custom('joomla_plugins.openClassMethods', 'joomla', '', 'COM_COMPONENTBUILDER_METHODS', false); + } + if ($this->user->authorise('joomla_plugin.properties', 'com_componentbuilder')) + { + // add Properties button. + JToolBarHelper::custom('joomla_plugins.openClassProperties', 'joomla', '', 'COM_COMPONENTBUILDER_PROPERTIES', false); + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugins'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Class Extends Name Selection + $this->class_extendsNameOptions = JFormHelper::loadFieldType('Classextends')->options; + // We do some sanitation for Class Extends Name filter + if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions) && + isset($this->class_extendsNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->class_extendsNameOptions[0]->value)) + { + unset($this->class_extendsNameOptions[0]); + } + // Only load Class Extends Name filter if it has values + if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions)) + { + // Class Extends Name Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL').' -', + 'filter_class_extends', + JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text', $this->state->get('filter.class_extends')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Class Extends Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL').' -', + 'batch[class_extends]', + JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text') + ); + } + } + + // Set Joomla Plugin Group Name Selection + $this->joomla_plugin_groupNameOptions = JFormHelper::loadFieldType('Joomlaplugingroups')->options; + // We do some sanitation for Joomla Plugin Group Name filter + if (ComponentbuilderHelper::checkArray($this->joomla_plugin_groupNameOptions) && + isset($this->joomla_plugin_groupNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->joomla_plugin_groupNameOptions[0]->value)) + { + unset($this->joomla_plugin_groupNameOptions[0]); + } + // Only load Joomla Plugin Group Name filter if it has values + if (ComponentbuilderHelper::checkArray($this->joomla_plugin_groupNameOptions)) + { + // Joomla Plugin Group Name Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP_LABEL').' -', + 'filter_joomla_plugin_group', + JHtml::_('select.options', $this->joomla_plugin_groupNameOptions, 'value', 'text', $this->state->get('filter.joomla_plugin_group')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Joomla Plugin Group Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP_LABEL').' -', + 'batch[joomla_plugin_group]', + JHtml::_('select.options', $this->joomla_plugin_groupNameOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/joomla_plugins.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.system_name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SYSTEM_NAME_LABEL'), + 'g.name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL'), + 'h.name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/joomla_plugins_files_folders_urls/index.html b/admin/views/joomla_plugins_files_folders_urls/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default.php new file mode 100644 index 000000000..b899a2008 --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default.php @@ -0,0 +1,85 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_plugins_files_folders_urls.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'joomla_plugin_files_folders_urlsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
    +sidebar)): ?> +
    + sidebar; ?> +
    +
    + +
    + +items)): ?> + loadTemplate('toolbar');?> +
    + +
    + + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
    + + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
    + + + + \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_batch_body.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_batch_body.php new file mode 100644 index 000000000..b19367ab3 --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_batch_body.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

    +batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_batch_footer.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_batch_footer.php new file mode 100644 index 000000000..5d6ff2d47 --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_batch_footer.php @@ -0,0 +1,23 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_body.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_body.php new file mode 100644 index 000000000..e26c9e453 --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_body.php @@ -0,0 +1,94 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_componentbuilder&view=joomla_plugins_files_folders_urls&task=joomla_plugin_files_folders_urls.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls',$item,'joomla_plugins_files_folders_urls'); + ?> + + + get('joomla_plugin_files_folders_urls.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('joomla_plugin_files_folders_urls.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
    + get('joomla_plugin_files_folders_urls.edit')): ?> + escape($item->joomla_plugin_system_name); ?> + checked_out): ?> + name, $item->checked_out_time, 'joomla_plugins_files_folders_urls.', $canCheckin); ?> + + + escape($item->joomla_plugin_system_name); ?> + +
    + + + get('joomla_plugin_files_folders_urls.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'joomla_plugins_files_folders_urls.', true, 'cb'); ?> + + published, $i, 'joomla_plugins_files_folders_urls.', false, 'cb'); ?> + + + published, $i, 'joomla_plugins_files_folders_urls.', true, 'cb'); ?> + + + published, $i, 'joomla_plugins_files_folders_urls.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_foot.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_foot.php new file mode 100644 index 000000000..d020003b6 --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_foot.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_head.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_head.php new file mode 100644 index 000000000..e3f4a891b --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_head.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_toolbar.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_toolbar.php new file mode 100644 index 000000000..f40efa672 --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_toolbar.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/index.html b/admin/views/joomla_plugins_files_folders_urls/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/view.html.php b/admin/views/joomla_plugins_files_folders_urls/view.html.php new file mode 100644 index 000000000..964af701f --- /dev/null +++ b/admin/views/joomla_plugins_files_folders_urls/view.html.php @@ -0,0 +1,226 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Componentbuilder View class for the Joomla_plugins_files_folders_urls + */ +class ComponentbuilderViewJoomla_plugins_files_folders_urls extends JViewLegacy +{ + /** + * Joomla_plugins_files_folders_urls view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + ComponentbuilderHelper::addSubmenu('joomla_plugins_files_folders_urls'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls'); + $this->canEdit = $this->canDo->get('joomla_plugin_files_folders_urls.edit'); + $this->canState = $this->canDo->get('joomla_plugin_files_folders_urls.edit.state'); + $this->canCreate = $this->canDo->get('joomla_plugin_files_folders_urls.create'); + $this->canDelete = $this->canDo->get('joomla_plugin_files_folders_urls.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=joomla_plugins_files_folders_urls'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('joomla_plugin_files_folders_urls.add'); + } + + // Only load if there are items + if (ComponentbuilderHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('joomla_plugin_files_folders_urls.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('joomla_plugins_files_folders_urls.publish'); + JToolBarHelper::unpublishList('joomla_plugins_files_folders_urls.unpublish'); + JToolBarHelper::archiveList('joomla_plugins_files_folders_urls.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('joomla_plugins_files_folders_urls.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'joomla_plugins_files_folders_urls.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('joomla_plugins_files_folders_urls.trash'); + } + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugins_files_folders_urls'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/joomla_plugins_files_folders_urls.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/joomla_plugins_updates/index.html b/admin/views/joomla_plugins_updates/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugins_updates/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/tmpl/default.php b/admin/views/joomla_plugins_updates/tmpl/default.php new file mode 100644 index 000000000..50c657339 --- /dev/null +++ b/admin/views/joomla_plugins_updates/tmpl/default.php @@ -0,0 +1,85 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_plugins_updates.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'joomla_plugin_updatesList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
    +sidebar)): ?> +
    + sidebar; ?> +
    +
    + +
    + +items)): ?> + loadTemplate('toolbar');?> +
    + +
    + + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
    + + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
    + + + + \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/tmpl/default_batch_body.php b/admin/views/joomla_plugins_updates/tmpl/default_batch_body.php new file mode 100644 index 000000000..5c54e9b4e --- /dev/null +++ b/admin/views/joomla_plugins_updates/tmpl/default_batch_body.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

    +batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/tmpl/default_batch_footer.php b/admin/views/joomla_plugins_updates/tmpl/default_batch_footer.php new file mode 100644 index 000000000..f48dd8742 --- /dev/null +++ b/admin/views/joomla_plugins_updates/tmpl/default_batch_footer.php @@ -0,0 +1,23 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/tmpl/default_body.php b/admin/views/joomla_plugins_updates/tmpl/default_body.php new file mode 100644 index 000000000..875bd1a81 --- /dev/null +++ b/admin/views/joomla_plugins_updates/tmpl/default_body.php @@ -0,0 +1,94 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_componentbuilder&view=joomla_plugins_updates&task=joomla_plugin_updates.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates',$item,'joomla_plugins_updates'); + ?> + + + get('joomla_plugin_updates.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('joomla_plugin_updates.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
    + get('joomla_plugin_updates.edit')): ?> + escape($item->joomla_plugin_system_name); ?> + checked_out): ?> + name, $item->checked_out_time, 'joomla_plugins_updates.', $canCheckin); ?> + + + escape($item->joomla_plugin_system_name); ?> + +
    + + + get('joomla_plugin_updates.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'joomla_plugins_updates.', true, 'cb'); ?> + + published, $i, 'joomla_plugins_updates.', false, 'cb'); ?> + + + published, $i, 'joomla_plugins_updates.', true, 'cb'); ?> + + + published, $i, 'joomla_plugins_updates.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/tmpl/default_foot.php b/admin/views/joomla_plugins_updates/tmpl/default_foot.php new file mode 100644 index 000000000..d020003b6 --- /dev/null +++ b/admin/views/joomla_plugins_updates/tmpl/default_foot.php @@ -0,0 +1,18 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/tmpl/default_head.php b/admin/views/joomla_plugins_updates/tmpl/default_head.php new file mode 100644 index 000000000..f406c2240 --- /dev/null +++ b/admin/views/joomla_plugins_updates/tmpl/default_head.php @@ -0,0 +1,47 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/tmpl/default_toolbar.php b/admin/views/joomla_plugins_updates/tmpl/default_toolbar.php new file mode 100644 index 000000000..7fdc8d775 --- /dev/null +++ b/admin/views/joomla_plugins_updates/tmpl/default_toolbar.php @@ -0,0 +1,45 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/tmpl/index.html b/admin/views/joomla_plugins_updates/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/joomla_plugins_updates/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/view.html.php b/admin/views/joomla_plugins_updates/view.html.php new file mode 100644 index 000000000..e388fa109 --- /dev/null +++ b/admin/views/joomla_plugins_updates/view.html.php @@ -0,0 +1,226 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Componentbuilder View class for the Joomla_plugins_updates + */ +class ComponentbuilderViewJoomla_plugins_updates extends JViewLegacy +{ + /** + * Joomla_plugins_updates view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + ComponentbuilderHelper::addSubmenu('joomla_plugins_updates'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates'); + $this->canEdit = $this->canDo->get('joomla_plugin_updates.edit'); + $this->canState = $this->canDo->get('joomla_plugin_updates.edit.state'); + $this->canCreate = $this->canDo->get('joomla_plugin_updates.create'); + $this->canDelete = $this->canDo->get('joomla_plugin_updates.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=joomla_plugins_updates'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('joomla_plugin_updates.add'); + } + + // Only load if there are items + if (ComponentbuilderHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('joomla_plugin_updates.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('joomla_plugins_updates.publish'); + JToolBarHelper::unpublishList('joomla_plugins_updates.unpublish'); + JToolBarHelper::archiveList('joomla_plugins_updates.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('joomla_plugins_updates.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'joomla_plugins_updates.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('joomla_plugins_updates.trash'); + } + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugins_updates'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/joomla_plugins_updates.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/languages/tmpl/default.php b/admin/views/languages/tmpl/default.php index 8dea911ad..8203eaf96 100644 --- a/admin/views/languages/tmpl/default.php +++ b/admin/views/languages/tmpl/default.php @@ -85,6 +85,7 @@ if ($this->saveOrder) diff --git a/admin/views/library/tmpl/edit.php b/admin/views/library/tmpl/edit.php index 65d34ea39..2f3040c22 100644 --- a/admin/views/library/tmpl/edit.php +++ b/admin/views/library/tmpl/edit.php @@ -146,123 +146,123 @@ $componentParams = $this->params; // will be removed just use $this->params inst diff --git a/admin/views/placeholder/tmpl/edit.php b/admin/views/placeholder/tmpl/edit.php index 86a95b352..a4dfa13be 100644 --- a/admin/views/placeholder/tmpl/edit.php +++ b/admin/views/placeholder/tmpl/edit.php @@ -134,5 +134,22 @@ jQuery(document).ready( function($) { } $(".loading-dots").text(dots); } , 500); -}); +}); + + +function JRouter(link) { +isSite()) + { + echo 'var url = "'.JURI::root().'";'; + } + else + { + echo 'var url = "";'; + } +?> + return url+link; +} diff --git a/admin/views/server/tmpl/edit.php b/admin/views/server/tmpl/edit.php index e75fdb319..32d63a46e 100644 --- a/admin/views/server/tmpl/edit.php +++ b/admin/views/server/tmpl/edit.php @@ -125,169 +125,169 @@ $componentParams = $this->params; // will be removed just use $this->params inst diff --git a/admin/views/validation_rule/tmpl/edit.php b/admin/views/validation_rule/tmpl/edit.php index d12d3b46a..a5bcd9d69 100644 --- a/admin/views/validation_rule/tmpl/edit.php +++ b/admin/views/validation_rule/tmpl/edit.php @@ -121,14 +121,12 @@ jQuery('#componentbuilder_loader').on('change', '#jform_inherit',function (e) { var rulefilename = jQuery("#jform_inherit option:selected").val(); getExistingValidationRuleCode(rulefilename); }); - jQuery('#componentbuilder_loader').on('change', '#jform_name',function (e) { var ruleName = jQuery('#jform_name').val(); // check if this rule name is taken checkRuleName(ruleName); }); - // nice little dot trick :) jQuery(document).ready( function($) { @@ -141,5 +139,22 @@ jQuery(document).ready( function($) { } $(".loading-dots").text(dots); } , 500); -}); +}); + + +function JRouter(link) { +isSite()) + { + echo 'var url = "'.JURI::root().'";'; + } + else + { + echo 'var url = "";'; + } +?> + return url+link; +} diff --git a/admin/views/validation_rules/view.html.php b/admin/views/validation_rules/view.html.php index a5ac46314..a48eeb3cf 100644 --- a/admin/views/validation_rules/view.html.php +++ b/admin/views/validation_rules/view.html.php @@ -134,6 +134,11 @@ class ComponentbuilderViewValidation_rules extends JViewLegacy JToolBarHelper::custom('validation_rules.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); } } + if ($this->user->authorise('validation_rule.run_expansion', 'com_componentbuilder')) + { + // add Run Expansion button. + JToolBarHelper::custom('validation_rules.runExpansion', 'expand-2', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false); + } if ($this->canDo->get('core.import') && $this->canDo->get('validation_rule.import')) { diff --git a/componentbuilder.xml b/componentbuilder.xml index 91d56596e..afb03b075 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,15 +1,15 @@ COM_COMPONENTBUILDER - 6th July, 2019 + 14th August, 2019 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt - 2.9.21 + 2.10.0 Component Builder (v.2.9.21) +

    Component Builder (v.2.10.0)

    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. @@ -55,9 +55,7 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo index.html router.php componentbuilder.php - componentbuilder.php - router.php - controller.php + router.php assets helpers controllers @@ -77,6 +75,7 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo

    COM_COMPONENTBUILDER_MENU_COMPILER COM_COMPONENTBUILDER_MENU_JOOMLA_COMPONENTS + COM_COMPONENTBUILDER_MENU_JOOMLA_PLUGINS COM_COMPONENTBUILDER_MENU_ADMIN_VIEWS COM_COMPONENTBUILDER_MENU_CUSTOM_ADMIN_VIEWS COM_COMPONENTBUILDER_MENU_SITE_VIEWS @@ -99,11 +98,6 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo controller.php index.html componentbuilder.php - access.xml - config.xml - controller.php - componentbuilder.php - README.txt README.txt assets controllers diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml index 6b51e4d31..91f1ddcc8 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -713,4 +713,106 @@ http://www.joomlacomponentbuilder.com + + Component Builder + Builds Complex Joomla Components + com_componentbuilder + component + 2.9.31 + http://www.joomlacomponentbuilder.com + + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.10.0/JCB_v2.10.0.zip + + + stable + + Llewellyn van der Merwe + http://www.joomlacomponentbuilder.com + + + + Component Builder + Builds Complex Joomla Components + com_componentbuilder + component + 2.9.32 + http://www.joomlacomponentbuilder.com + + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.10.0/JCB_v2.10.0.zip + + + stable + + Llewellyn van der Merwe + http://www.joomlacomponentbuilder.com + + + + Component Builder + Builds Complex Joomla Components + com_componentbuilder + component + 2.9.33 + http://www.joomlacomponentbuilder.com + + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.10.0/JCB_v2.10.0.zip + + + stable + + Llewellyn van der Merwe + http://www.joomlacomponentbuilder.com + + + + Component Builder + Builds Complex Joomla Components + com_componentbuilder + component + 2.9.34 + http://www.joomlacomponentbuilder.com + + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.10.0/JCB_v2.10.0.zip + + + stable + + Llewellyn van der Merwe + http://www.joomlacomponentbuilder.com + + + + Component Builder + Builds Complex Joomla Components + com_componentbuilder + component + 2.9.35 + http://www.joomlacomponentbuilder.com + + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.10.0/JCB_v2.10.0.zip + + + stable + + Llewellyn van der Merwe + http://www.joomlacomponentbuilder.com + + + + Component Builder + Builds Complex Joomla Components + com_componentbuilder + component + 2.10.0 + http://www.joomlacomponentbuilder.com + + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.10.0/JCB_v2.10.0.zip + + + stable + + Llewellyn van der Merwe + http://www.joomlacomponentbuilder.com + + \ No newline at end of file diff --git a/libraries/vdm_io/vendor/composer/ClassLoader.php b/libraries/vdm_io/vendor/composer/ClassLoader.php index dc02dfb11..fce8549f0 100644 --- a/libraries/vdm_io/vendor/composer/ClassLoader.php +++ b/libraries/vdm_io/vendor/composer/ClassLoader.php @@ -279,7 +279,7 @@ class ClassLoader */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** @@ -377,7 +377,7 @@ class ClassLoader $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; + $search = $subPath . '\\'; if (isset($this->prefixDirsPsr4[$search])) { $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { diff --git a/libraries/vdm_io/vendor/composer/autoload_classmap.php b/libraries/vdm_io/vendor/composer/autoload_classmap.php index 2f4700ebd..7a91153b0 100644 --- a/libraries/vdm_io/vendor/composer/autoload_classmap.php +++ b/libraries/vdm_io/vendor/composer/autoload_classmap.php @@ -6,28 +6,4 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'phpseclib\\Crypt\\AES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php', - 'phpseclib\\Crypt\\Base' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Base.php', - 'phpseclib\\Crypt\\Blowfish' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php', - 'phpseclib\\Crypt\\DES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php', - 'phpseclib\\Crypt\\Hash' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php', - 'phpseclib\\Crypt\\RC2' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php', - 'phpseclib\\Crypt\\RC4' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php', - 'phpseclib\\Crypt\\RSA' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php', - 'phpseclib\\Crypt\\Random' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php', - 'phpseclib\\Crypt\\Rijndael' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php', - 'phpseclib\\Crypt\\TripleDES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php', - 'phpseclib\\Crypt\\Twofish' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php', - 'phpseclib\\File\\ANSI' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/ANSI.php', - 'phpseclib\\File\\ASN1' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/ASN1.php', - 'phpseclib\\File\\ASN1\\Element' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php', - 'phpseclib\\File\\X509' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/X509.php', - 'phpseclib\\Math\\BigInteger' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php', - 'phpseclib\\Net\\SCP' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SCP.php', - 'phpseclib\\Net\\SFTP' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SFTP.php', - 'phpseclib\\Net\\SFTP\\Stream' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php', - 'phpseclib\\Net\\SSH1' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SSH1.php', - 'phpseclib\\Net\\SSH2' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SSH2.php', - 'phpseclib\\System\\SSH\\Agent' => $vendorDir . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php', - 'phpseclib\\System\\SSH\\Agent\\Identity' => $vendorDir . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php', ); diff --git a/libraries/vdm_io/vendor/composer/autoload_static.php b/libraries/vdm_io/vendor/composer/autoload_static.php index ea6b0d7d3..09b862a0c 100644 --- a/libraries/vdm_io/vendor/composer/autoload_static.php +++ b/libraries/vdm_io/vendor/composer/autoload_static.php @@ -24,39 +24,11 @@ class ComposerStaticInit10d22a526bd476954b93748a871e7ad4 ), ); - public static $classMap = array ( - 'phpseclib\\Crypt\\AES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php', - 'phpseclib\\Crypt\\Base' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Base.php', - 'phpseclib\\Crypt\\Blowfish' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php', - 'phpseclib\\Crypt\\DES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php', - 'phpseclib\\Crypt\\Hash' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php', - 'phpseclib\\Crypt\\RC2' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php', - 'phpseclib\\Crypt\\RC4' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php', - 'phpseclib\\Crypt\\RSA' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php', - 'phpseclib\\Crypt\\Random' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php', - 'phpseclib\\Crypt\\Rijndael' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php', - 'phpseclib\\Crypt\\TripleDES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php', - 'phpseclib\\Crypt\\Twofish' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php', - 'phpseclib\\File\\ANSI' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/ANSI.php', - 'phpseclib\\File\\ASN1' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/ASN1.php', - 'phpseclib\\File\\ASN1\\Element' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php', - 'phpseclib\\File\\X509' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/X509.php', - 'phpseclib\\Math\\BigInteger' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php', - 'phpseclib\\Net\\SCP' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SCP.php', - 'phpseclib\\Net\\SFTP' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SFTP.php', - 'phpseclib\\Net\\SFTP\\Stream' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php', - 'phpseclib\\Net\\SSH1' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SSH1.php', - 'phpseclib\\Net\\SSH2' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SSH2.php', - 'phpseclib\\System\\SSH\\Agent' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php', - 'phpseclib\\System\\SSH\\Agent\\Identity' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php', - ); - public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { $loader->prefixLengthsPsr4 = ComposerStaticInit10d22a526bd476954b93748a871e7ad4::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit10d22a526bd476954b93748a871e7ad4::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit10d22a526bd476954b93748a871e7ad4::$classMap; }, null, ClassLoader::class); } diff --git a/libraries/vdm_io/vendor/composer/installed.json b/libraries/vdm_io/vendor/composer/installed.json index 4ce92974f..d7857e90e 100644 --- a/libraries/vdm_io/vendor/composer/installed.json +++ b/libraries/vdm_io/vendor/composer/installed.json @@ -1,17 +1,17 @@ [ { "name": "phpseclib/phpseclib", - "version": "2.0.10", - "version_normalized": "2.0.10.0", + "version": "2.0.21", + "version_normalized": "2.0.21.0", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "d305b780829ea4252ed9400b3f5937c2c99b51d4" + "reference": "9f1287e68b3f283339a9f98f67515dd619e5bf9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d305b780829ea4252ed9400b3f5937c2c99b51d4", - "reference": "d305b780829ea4252ed9400b3f5937c2c99b51d4", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/9f1287e68b3f283339a9f98f67515dd619e5bf9d", + "reference": "9f1287e68b3f283339a9f98f67515dd619e5bf9d", "shasum": "" }, "require": { @@ -29,7 +29,7 @@ "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." }, - "time": "2018-02-19T04:29:13+00:00", + "time": "2019-07-12T12:53:49+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/LICENSE b/libraries/vdm_io/vendor/phpseclib/phpseclib/LICENSE index a8ec8ebd4..e7214ebbe 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/LICENSE +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/LICENSE @@ -1,5 +1,4 @@ -Copyright 2007-2016 TerraFrost and other contributors -http://phpseclib.sourceforge.net/ +Copyright (c) 2011-2019 TerraFrost and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -18,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/README.md b/libraries/vdm_io/vendor/phpseclib/phpseclib/README.md index 94402bee0..a9e7ebdab 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/README.md +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/README.md @@ -2,6 +2,14 @@ [![Build Status](https://travis-ci.org/phpseclib/phpseclib.svg?branch=2.0)](https://travis-ci.org/phpseclib/phpseclib) +## Supporting phpseclib + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/phpseclib) +- [One-time donation via PayPal or crypto-currencies](http://sourceforge.net/donate/index.php?group_id=198487) +- [Subscribe to Tidelift](https://tidelift.com/subscription/pkg/packagist-phpseclib-phpseclib?utm_source=packagist-phpseclib-phpseclib&utm_medium=referral&utm_campaign=readme) + +## Introduction + MIT-licensed pure-PHP implementations of an arbitrary-precision integer arithmetic library, fully PKCS#1 (v2.1) compliant RSA, DES, 3DES, RC4, Rijndael, AES, Blowfish, Twofish, SSH-1, SSH-2, SFTP, and X.509 @@ -24,19 +32,24 @@ AES, Blowfish, Twofish, SSH-1, SSH-2, SFTP, and X.509 ### 2.0 +* Long term support (LTS) release * Modernized version of 1.0 * Minimum PHP version: 5.3.3 * PSR-4 autoloading with namespace rooted at `\phpseclib` -* Install via Composer: `composer require phpseclib/phpseclib ~2.0` +* Install via Composer: `composer require phpseclib/phpseclib:~2.0` ### 1.0 * Long term support (LTS) release * PHP4 compatible * Composer compatible (PSR-0 autoloading) -* Install using Composer: `composer require phpseclib/phpseclib ~1.0` +* Install using Composer: `composer require phpseclib/phpseclib:~1.0` * Install using PEAR: See [phpseclib PEAR Channel Documentation](http://phpseclib.sourceforge.net/pear.htm) -* [Download 1.0.10 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.10.zip/download) +* [Download 1.0.16 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.16.zip/download) + +## Security contact information + +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. ## Support diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/appveyor.yml b/libraries/vdm_io/vendor/phpseclib/phpseclib/appveyor.yml new file mode 100644 index 000000000..210a90347 --- /dev/null +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/appveyor.yml @@ -0,0 +1,27 @@ +build: false +shallow_clone: false +platform: + - x86 + - x64 +clone_folder: C:\projects\phpseclib + +install: + - cinst -y OpenSSL.Light + - SET PATH=C:\Program Files\OpenSSL;%PATH% + - sc config wuauserv start= auto + - net start wuauserv + - cinst -y php --version 5.6.30 + - cd c:\tools\php56 + - copy php.ini-production php.ini + - echo date.timezone="UTC" >> php.ini + - echo extension_dir=ext >> php.ini + - echo extension=php_openssl.dll >> php.ini + - echo extension=php_gmp.dll >> php.ini + - cd C:\projects\phpseclib + - SET PATH=C:\tools\php56;%PATH% + - php.exe -r "readfile('http://getcomposer.org/installer');" | php.exe + - php.exe composer.phar install --prefer-source --no-interaction + +test_script: + - cd C:\projects\phpseclib + - vendor\bin\phpunit.bat tests/Windows32Test.php \ No newline at end of file diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php index 54a8997ed..03b176e7b 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php @@ -76,6 +76,10 @@ abstract class Base * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29 */ const MODE_CFB = 3; + /** + * Encrypt / decrypt using the Cipher Feedback mode (8bit) + */ + const MODE_CFB8 = 38; /** * Encrypt / decrypt using the Output Feedback mode. * @@ -479,6 +483,7 @@ abstract class Base break; case self::MODE_CTR: case self::MODE_CFB: + case self::MODE_CFB8: case self::MODE_OFB: case self::MODE_STREAM: $this->mode = $mode; @@ -644,10 +649,10 @@ abstract class Base case !function_exists('hash_algos'): case !in_array($hash, hash_algos()): $i = 1; + $hmac = new Hash(); + $hmac->setHash($hash); + $hmac->setKey($password); while (strlen($key) < $dkLen) { - $hmac = new Hash(); - $hmac->setHash($hash); - $hmac->setKey($password); $f = $u = $hmac->hash($salt . pack('N', $i++)); for ($j = 2; $j <= $count; ++$j) { $u = $hmac->hash($u); @@ -702,7 +707,7 @@ abstract class Base case self::MODE_STREAM: return openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options); case self::MODE_ECB: - $result = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options); + $result = @openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options); return !defined('OPENSSL_RAW_DATA') ? substr($result, 0, -$this->block_size) : $result; case self::MODE_CBC: $result = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $this->encryptIV); @@ -762,6 +767,16 @@ abstract class Base $iv = substr($ciphertext, -$this->block_size); } + return $ciphertext; + case self::MODE_CFB8: + $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $this->encryptIV); + if ($this->continuousBuffer) { + if (($len = strlen($ciphertext)) >= $this->block_size) { + $this->encryptIV = substr($ciphertext, -$this->block_size); + } else { + $this->encryptIV = substr($this->encryptIV, $len - $this->block_size) . substr($ciphertext, -$len); + } + } return $ciphertext; case self::MODE_OFB: return $this->_openssl_ofb_process($plaintext, $this->encryptIV, $this->enbuffer); @@ -942,6 +957,24 @@ abstract class Base $pos = $len; } break; + case self::MODE_CFB8: + $ciphertext = ''; + $len = strlen($plaintext); + $iv = $this->encryptIV; + + for ($i = 0; $i < $len; ++$i) { + $ciphertext .= ($c = $plaintext[$i] ^ $this->_encryptBlock($iv)); + $iv = substr($iv, 1) . $c; + } + + if ($this->continuousBuffer) { + if ($len >= $block_size) { + $this->encryptIV = substr($ciphertext, -$block_size); + } else { + $this->encryptIV = substr($this->encryptIV, $len - $block_size) . substr($ciphertext, -$len); + } + } + break; case self::MODE_OFB: $xor = $this->encryptIV; if (strlen($buffer['xor'])) { @@ -1007,14 +1040,14 @@ abstract class Base break; case self::MODE_ECB: if (!defined('OPENSSL_RAW_DATA')) { - $ciphertext.= openssl_encrypt('', $this->cipher_name_openssl_ecb, $this->key, true); + $ciphertext.= @openssl_encrypt('', $this->cipher_name_openssl_ecb, $this->key, true); } $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options); break; case self::MODE_CBC: if (!defined('OPENSSL_RAW_DATA')) { $padding = str_repeat(chr($this->block_size), $this->block_size) ^ substr($ciphertext, -$this->block_size); - $ciphertext.= substr(openssl_encrypt($padding, $this->cipher_name_openssl_ecb, $this->key, true), 0, $this->block_size); + $ciphertext.= substr(@openssl_encrypt($padding, $this->cipher_name_openssl_ecb, $this->key, true), 0, $this->block_size); $offset = 2 * $this->block_size; } else { $offset = $this->block_size; @@ -1072,6 +1105,16 @@ abstract class Base $iv = substr($ciphertext, -$this->block_size); } break; + case self::MODE_CFB8: + $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $this->decryptIV); + if ($this->continuousBuffer) { + if (($len = strlen($ciphertext)) >= $this->block_size) { + $this->decryptIV = substr($ciphertext, -$this->block_size); + } else { + $this->decryptIV = substr($this->decryptIV, $len - $this->block_size) . substr($ciphertext, -$len); + } + } + break; case self::MODE_OFB: $plaintext = $this->_openssl_ofb_process($ciphertext, $this->decryptIV, $this->debuffer); } @@ -1235,6 +1278,24 @@ abstract class Base $pos = $len; } break; + case self::MODE_CFB8: + $plaintext = ''; + $len = strlen($ciphertext); + $iv = $this->decryptIV; + + for ($i = 0; $i < $len; ++$i) { + $plaintext .= $ciphertext[$i] ^ $this->_encryptBlock($iv); + $iv = substr($iv, 1) . $ciphertext[$i]; + } + + if ($this->continuousBuffer) { + if ($len >= $block_size) { + $this->decryptIV = substr($ciphertext, -$block_size); + } else { + $this->decryptIV = substr($this->decryptIV, $len - $block_size) . substr($ciphertext, -$len); + } + } + break; case self::MODE_OFB: $xor = $this->decryptIV; if (strlen($buffer['xor'])) { @@ -1297,7 +1358,7 @@ abstract class Base for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); if (strlen($block) > strlen($buffer['ciphertext'])) { - $result = openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, $this->openssl_options); + $result = @openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, $this->openssl_options); $result = !defined('OPENSSL_RAW_DATA') ? substr($result, 0, -$this->block_size) : $result; $buffer['ciphertext'].= $result; } @@ -1308,7 +1369,7 @@ abstract class Base } else { for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); - $otp = openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, $this->openssl_options); + $otp = @openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, $this->openssl_options); $otp = !defined('OPENSSL_RAW_DATA') ? substr($otp, 0, -$this->block_size) : $otp; $this->_increment_str($xor); $ciphertext.= $block ^ $otp; @@ -1352,7 +1413,7 @@ abstract class Base } if ($this->continuousBuffer) { if (!defined('OPENSSL_RAW_DATA')) { - $encryptIV.= openssl_encrypt('', $this->cipher_name_openssl_ecb, $key, $this->openssl_options); + $encryptIV.= @openssl_encrypt('', $this->cipher_name_openssl_ecb, $key, $this->openssl_options); } $encryptIV = openssl_decrypt($encryptIV, $this->cipher_name_openssl_ecb, $key, $this->openssl_options); if ($overflow) { @@ -1435,6 +1496,8 @@ abstract class Base return 'ctr'; case self::MODE_CFB: return 'cfb'; + case self::MODE_CFB8: + return 'cfb8'; case self::MODE_OFB: return 'ofb'; } @@ -1788,6 +1851,7 @@ abstract class Base self::MODE_ECB => MCRYPT_MODE_ECB, self::MODE_CBC => MCRYPT_MODE_CBC, self::MODE_CFB => 'ncfb', + self::MODE_CFB8 => MCRYPT_MODE_CFB, self::MODE_OFB => MCRYPT_MODE_NOFB, self::MODE_STREAM => MCRYPT_MODE_STREAM, ); @@ -2359,6 +2423,52 @@ abstract class Base $_pos = $_len; } + return $_plaintext; + '; + break; + case self::MODE_CFB8: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_len = strlen($_text); + $_iv = $self->encryptIV; + + for ($_i = 0; $_i < $_len; ++$_i) { + $in = $_iv; + '.$encrypt_block.' + $_ciphertext .= ($_c = $_text[$_i] ^ $in); + $_iv = substr($_iv, 1) . $_c; + } + + if ($self->continuousBuffer) { + if ($_len >= '.$block_size.') { + $self->encryptIV = substr($_ciphertext, -'.$block_size.'); + } else { + $self->encryptIV = substr($self->encryptIV, $_len - '.$block_size.') . substr($_ciphertext, -$_len); + } + } + + return $_ciphertext; + '; + $decrypt = $init_encrypt . ' + $_plaintext = ""; + $_len = strlen($_text); + $_iv = $self->decryptIV; + + for ($_i = 0; $_i < $_len; ++$_i) { + $in = $_iv; + '.$encrypt_block.' + $_plaintext .= $_text[$_i] ^ $in; + $_iv = substr($_iv, 1) . $_text[$_i]; + } + + if ($self->continuousBuffer) { + if ($_len >= '.$block_size.') { + $self->decryptIV = substr($_text, -'.$block_size.'); + } else { + $self->decryptIV = substr($self->decryptIV, $_len - '.$block_size.') . substr($_text, -$_len); + } + } + return $_plaintext; '; break; diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php index 6ae01329e..a61668209 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php @@ -112,6 +112,15 @@ class Hash */ var $key = false; + /** + * Computed Key + * + * @see self::_computeKey() + * @var string + * @access private + */ + var $computedKey = false; + /** * Outer XOR (Internal HMAC) * @@ -130,6 +139,15 @@ class Hash */ var $ipad; + /** + * Engine + * + * @see self::setHash() + * @var string + * @access private + */ + var $engine; + /** * Default Constructor. * @@ -166,6 +184,43 @@ class Hash function setKey($key = false) { $this->key = $key; + $this->_computeKey(); + } + + /** + * Pre-compute the key used by the HMAC + * + * Quoting http://tools.ietf.org/html/rfc2104#section-2, "Applications that use keys longer than B bytes + * will first hash the key using H and then use the resultant L byte string as the actual key to HMAC." + * + * As documented in https://www.reddit.com/r/PHP/comments/9nct2l/symfonypolyfill_hash_pbkdf2_correct_fix_for/ + * when doing an HMAC multiple times it's faster to compute the hash once instead of computing it during + * every call + * + * @access private + */ + function _computeKey() + { + if ($this->key === false) { + $this->computedKey = false; + return; + } + + if (strlen($this->key) <= $this->b) { + $this->computedKey = $this->key; + return; + } + + switch ($this->engine) { + case self::MODE_MHASH: + $this->computedKey = mhash($this->hash, $this->key); + break; + case self::MODE_HASH: + $this->computedKey = hash($this->hash, $this->key, true); + break; + case self::MODE_INTERNAL: + $this->computedKey = call_user_func($this->hash, $this->key); + } } /** @@ -216,19 +271,38 @@ class Hash } switch ($hash) { + case 'md2-96': case 'md2': - $mode = CRYPT_HASH_MODE == self::MODE_HASH && in_array('md2', hash_algos()) ? + $this->b = 16; + case 'md5-96': + case 'sha1-96': + case 'sha224-96': + case 'sha256-96': + case 'md2': + case 'md5': + case 'sha1': + case 'sha224': + case 'sha256': + $this->b = 64; + break; + default: + $this->b = 128; + } + + switch ($hash) { + case 'md2': + $this->engine = CRYPT_HASH_MODE == self::MODE_HASH && in_array('md2', hash_algos()) ? self::MODE_HASH : self::MODE_INTERNAL; break; case 'sha384': case 'sha512': - $mode = CRYPT_HASH_MODE == self::MODE_MHASH ? self::MODE_INTERNAL : CRYPT_HASH_MODE; + $this->engine = CRYPT_HASH_MODE == self::MODE_MHASH ? self::MODE_INTERNAL : CRYPT_HASH_MODE; break; default: - $mode = CRYPT_HASH_MODE; + $this->engine = CRYPT_HASH_MODE; } - switch ($mode) { + switch ($this->engine) { case self::MODE_MHASH: switch ($hash) { case 'md5': @@ -241,6 +315,7 @@ class Hash default: $this->hash = MHASH_SHA1; } + $this->_computeKey(self::MODE_MHASH); return; case self::MODE_HASH: switch ($hash) { @@ -257,35 +332,33 @@ class Hash default: $this->hash = 'sha1'; } + $this->_computeKey(self::MODE_HASH); return; } switch ($hash) { case 'md2': - $this->b = 16; $this->hash = array($this, '_md2'); break; case 'md5': - $this->b = 64; $this->hash = array($this, '_md5'); break; case 'sha256': - $this->b = 64; $this->hash = array($this, '_sha256'); break; case 'sha384': case 'sha512': - $this->b = 128; $this->hash = array($this, '_sha512'); break; case 'sha1': default: - $this->b = 64; $this->hash = array($this, '_sha1'); } $this->ipad = str_repeat(chr(0x36), $this->b); $this->opad = str_repeat(chr(0x5C), $this->b); + + $this->_computeKey(self::MODE_INTERNAL); } /** @@ -297,33 +370,25 @@ class Hash */ function hash($text) { - $mode = is_array($this->hash) ? self::MODE_INTERNAL : CRYPT_HASH_MODE; - if (!empty($this->key) || is_string($this->key)) { - switch ($mode) { + switch ($this->engine) { case self::MODE_MHASH: - $output = mhash($this->hash, $text, $this->key); + $output = mhash($this->hash, $text, $this->computedKey); break; case self::MODE_HASH: - $output = hash_hmac($this->hash, $text, $this->key, true); + $output = hash_hmac($this->hash, $text, $this->computedKey, true); break; case self::MODE_INTERNAL: - /* "Applications that use keys longer than B bytes will first hash the key using H and then use the - resultant L byte string as the actual key to HMAC." - - -- http://tools.ietf.org/html/rfc2104#section-2 */ - $key = strlen($this->key) > $this->b ? call_user_func($this->hash, $this->key) : $this->key; - - $key = str_pad($key, $this->b, chr(0)); // step 1 - $temp = $this->ipad ^ $key; // step 2 - $temp .= $text; // step 3 - $temp = call_user_func($this->hash, $temp); // step 4 - $output = $this->opad ^ $key; // step 5 - $output.= $temp; // step 6 - $output = call_user_func($this->hash, $output); // step 7 + $key = str_pad($this->computedKey, $this->b, chr(0)); // step 1 + $temp = $this->ipad ^ $key; // step 2 + $temp .= $text; // step 3 + $temp = call_user_func($this->hash, $temp); // step 4 + $output = $this->opad ^ $key; // step 5 + $output.= $temp; // step 6 + $output = call_user_func($this->hash, $output); // step 7 } } else { - switch ($mode) { + switch ($this->engine) { case self::MODE_MHASH: $output = mhash($this->hash, $text); break; diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php index cd116b56d..d2c6c7cbe 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php @@ -182,6 +182,10 @@ class RSA * PKCS#8 formatted private key */ const PRIVATE_FORMAT_PKCS8 = 8; + /** + * OpenSSH formatted private key + */ + const PRIVATE_FORMAT_OPENSSH = 9; /**#@-*/ /**#@+ @@ -468,23 +472,27 @@ class RSA break; case extension_loaded('openssl') && file_exists($this->configFile): // some versions of XAMPP have mismatched versions of OpenSSL which causes it not to work - ob_start(); - @phpinfo(); - $content = ob_get_contents(); - ob_end_clean(); - - preg_match_all('#OpenSSL (Header|Library) Version(.*)#im', $content, $matches); - $versions = array(); - if (!empty($matches[1])) { - for ($i = 0; $i < count($matches[1]); $i++) { - $fullVersion = trim(str_replace('=>', '', strip_tags($matches[2][$i]))); - // Remove letter part in OpenSSL version - if (!preg_match('/(\d+\.\d+\.\d+)/i', $fullVersion, $m)) { - $versions[$matches[1][$i]] = $fullVersion; - } else { - $versions[$matches[1][$i]] = $m[0]; + // avoid generating errors (even with suppression) when phpinfo() is disabled (common in production systems) + if (strpos(ini_get('disable_functions'), 'phpinfo') === false) { + ob_start(); + @phpinfo(); + $content = ob_get_contents(); + ob_end_clean(); + + preg_match_all('#OpenSSL (Header|Library) Version(.*)#im', $content, $matches); + + if (!empty($matches[1])) { + for ($i = 0; $i < count($matches[1]); $i++) { + $fullVersion = trim(str_replace('=>', '', strip_tags($matches[2][$i]))); + + // Remove letter part in OpenSSL version + if (!preg_match('/(\d+\.\d+\.\d+)/i', $fullVersion, $m)) { + $versions[$matches[1][$i]] = $fullVersion; + } else { + $versions[$matches[1][$i]] = $m[0]; + } } } } @@ -816,6 +824,58 @@ class RSA $key.= 'Private-MAC: ' . bin2hex($hash->hash($source)) . "\r\n"; return $key; + case self::PRIVATE_FORMAT_OPENSSH: + if ($num_primes != 2) { + return false; + } + $publicKey = pack('Na*Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($raw['publicExponent']), $raw['publicExponent'], strlen($raw['modulus']), $raw['modulus']); + $privateKey = pack( + 'Na*Na*Na*Na*Na*Na*Na*', + strlen('ssh-rsa'), + 'ssh-rsa', + strlen($raw['modulus']), + $raw['modulus'], + strlen($raw['publicExponent']), + $raw['publicExponent'], + strlen($raw['privateExponent']), + $raw['privateExponent'], + strlen($raw['coefficient']), + $raw['coefficient'], + strlen($raw['prime1']), + $raw['prime1'], + strlen($raw['prime2']), + $raw['prime2'] + ); + $checkint = Random::string(4); + $paddedKey = pack( + 'a*Na*', + $checkint . $checkint . $privateKey, + strlen($this->comment), + $this->comment + ); + $paddingLength = (7 * strlen($paddedKey)) % 8; + for ($i = 1; $i <= $paddingLength; $i++) { + $paddedKey.= chr($i); + } + $key = pack( + 'Na*Na*Na*NNa*Na*', + strlen('none'), + 'none', + strlen('none'), + 'none', + 0, + '', + 1, + strlen($publicKey), + $publicKey, + strlen($paddedKey), + $paddedKey + ); + $key = "openssh-key-v1\0$key"; + + return "-----BEGIN OPENSSH PRIVATE KEY-----\r\n" . + chunk_split(base64_encode($key), 70) . + "-----END OPENSSH PRIVATE KEY-----"; default: // eg. self::PRIVATE_FORMAT_PKCS1 $components = array(); foreach ($raw as $name => $value) { @@ -1016,9 +1076,9 @@ class RSA * @access private * @see self::_convertPublicKey() * @see self::_convertPrivateKey() - * @param string $key + * @param string|array $key * @param int $type - * @return array + * @return array|bool */ function _parseKey($key, $type) { @@ -1329,9 +1389,14 @@ class RSA xml_set_character_data_handler($xml, '_data_handler'); // add to account for "dangling" tags like ... that are sometimes added if (!xml_parse($xml, '' . $key . '')) { + xml_parser_free($xml); + unset($xml); return false; } + xml_parser_free($xml); + unset($xml); + return isset($this->components['modulus']) && isset($this->components['publicExponent']) ? $this->components : false; // from PuTTY's SSHPUBK.C case self::PRIVATE_FORMAT_PUTTY: @@ -1403,6 +1468,75 @@ class RSA } $components['coefficients'] = array(2 => new BigInteger($this->_string_shift($private, $length), -256)); + return $components; + case self::PRIVATE_FORMAT_OPENSSH: + $components = array(); + $decoded = $this->_extractBER($key); + $magic = $this->_string_shift($decoded, 15); + if ($magic !== "openssh-key-v1\0") { + return false; + } + $options = $this->_string_shift($decoded, 24); + // \0\0\0\4none = ciphername + // \0\0\0\4none = kdfname + // \0\0\0\0 = kdfoptions + // \0\0\0\1 = numkeys + if ($options != "\0\0\0\4none\0\0\0\4none\0\0\0\0\0\0\0\1") { + return false; + } + extract(unpack('Nlength', $this->_string_shift($decoded, 4))); + if (strlen($decoded) < $length) { + return false; + } + $publicKey = $this->_string_shift($decoded, $length); + extract(unpack('Nlength', $this->_string_shift($decoded, 4))); + if (strlen($decoded) < $length) { + return false; + } + $paddedKey = $this->_string_shift($decoded, $length); + + if ($this->_string_shift($publicKey, 11) !== "\0\0\0\7ssh-rsa") { + return false; + } + + $checkint1 = $this->_string_shift($paddedKey, 4); + $checkint2 = $this->_string_shift($paddedKey, 4); + if (strlen($checkint1) != 4 || $checkint1 !== $checkint2) { + return false; + } + + if ($this->_string_shift($paddedKey, 11) !== "\0\0\0\7ssh-rsa") { + return false; + } + + $values = array( + &$components['modulus'], + &$components['publicExponent'], + &$components['privateExponent'], + &$components['coefficients'][2], + &$components['primes'][1], + &$components['primes'][2] + ); + + foreach ($values as &$value) { + extract(unpack('Nlength', $this->_string_shift($paddedKey, 4))); + if (strlen($paddedKey) < $length) { + return false; + } + $value = new BigInteger($this->_string_shift($paddedKey, $length), -256); + } + + extract(unpack('Nlength', $this->_string_shift($paddedKey, 4))); + if (strlen($paddedKey) < $length) { + return false; + } + $components['comment'] = $this->_string_shift($decoded, $length); + + $temp = $components['primes'][1]->subtract($this->one); + $components['exponents'] = array(1 => $components['publicExponent']->modInverse($temp)); + $temp = $components['primes'][2]->subtract($this->one); + $components['exponents'][] = $components['publicExponent']->modInverse($temp); + return $components; } } @@ -1501,8 +1635,9 @@ class RSA * Returns true on success and false on failure (ie. an incorrect password was provided or the key was malformed) * * @access public - * @param string $key - * @param int $type optional + * @param string|RSA|array $key + * @param bool|int $type optional + * @return bool */ function loadKey($key, $type = false) { @@ -1559,7 +1694,8 @@ class RSA self::PRIVATE_FORMAT_PKCS1, self::PRIVATE_FORMAT_XML, self::PRIVATE_FORMAT_PUTTY, - self::PUBLIC_FORMAT_OPENSSH + self::PUBLIC_FORMAT_OPENSSH, + self::PRIVATE_FORMAT_OPENSSH ); foreach ($types as $type) { $components = $this->_parseKey($key, $type); @@ -2207,16 +2343,21 @@ class RSA */ function _equals($x, $y) { + if (function_exists('hash_equals')) { + return hash_equals($x, $y); + } + if (strlen($x) != strlen($y)) { return false; } - $result = 0; + $result = "\0"; + $x^= $y; for ($i = 0; $i < strlen($x); $i++) { - $result |= ord($x[$i]) ^ ord($y[$i]); + $result|= $x[$i]; } - return $result == 0; + return $result === "\0"; } /** @@ -2423,19 +2564,26 @@ class RSA $db = $maskedDB ^ $dbMask; $lHash2 = substr($db, 0, $this->hLen); $m = substr($db, $this->hLen); - if (!$this->_equals($lHash, $lHash2)) { - user_error('Decryption error'); - return false; + $hashesMatch = $this->_equals($lHash, $lHash2); + $leadingZeros = 1; + $patternMatch = 0; + $offset = 0; + for ($i = 0; $i < strlen($m); $i++) { + $patternMatch|= $leadingZeros & ($m[$i] === "\1"); + $leadingZeros&= $m[$i] === "\0"; + $offset+= $patternMatch ? 0 : 1; } - $m = ltrim($m, chr(0)); - if (ord($m[0]) != 1) { + + // we do & instead of && to avoid https://en.wikipedia.org/wiki/Short-circuit_evaluation + // to protect against timing attacks + if (!$hashesMatch & !$patternMatch) { user_error('Decryption error'); return false; } // Output the message M - return substr($m, 1); + return substr($m, $offset + 1); } /** diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php index 1da046e82..3aaa30900 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php @@ -244,9 +244,10 @@ class ASN1 $tag = 0; // process septets (since the eighth bit is ignored, it's not an octet) do { - $loop = ord($encoded[0]) >> 7; + $temp = ord($encoded[$encoded_pos++]); + $loop = $temp >> 7; $tag <<= 7; - $tag |= ord($encoded[$encoded_pos++]) & 0x7F; + $tag |= $temp & 0x7F; $start++; } while ($loop); } @@ -308,6 +309,9 @@ class ASN1 $remainingLength = $length; while ($remainingLength > 0) { $temp = $this->_decode_ber($content, $start, $content_pos); + if ($temp === false) { + break; + } $length = $temp['length']; // end-of-content octets - see paragraph 8.1.5 if (substr($content, $content_pos + $length, 2) == "\0\0") { @@ -359,6 +363,9 @@ class ASN1 $current['content'] = substr($content, $content_pos); } else { $temp = $this->_decode_ber($content, $start, $content_pos); + if ($temp === false) { + return false; + } $length-= (strlen($content) - $content_pos); $last = count($temp) - 1; for ($i = 0; $i < $last; $i++) { @@ -383,6 +390,9 @@ class ASN1 $length = 0; while (substr($content, $content_pos, 2) != "\0\0") { $temp = $this->_decode_ber($content, $length + $start, $content_pos); + if ($temp === false) { + return false; + } $content_pos += $temp['length']; // all subtags should be octet strings //if ($temp['type'] != self::TYPE_OCTET_STRING) { @@ -415,30 +425,16 @@ class ASN1 break 2; } $temp = $this->_decode_ber($content, $start + $offset, $content_pos); + if ($temp === false) { + return false; + } $content_pos += $temp['length']; $current['content'][] = $temp; $offset+= $temp['length']; } break; case self::TYPE_OBJECT_IDENTIFIER: - $temp = ord($content[$content_pos++]); - $current['content'] = sprintf('%d.%d', floor($temp / 40), $temp % 40); - $valuen = 0; - // process septets - $content_len = strlen($content); - while ($content_pos < $content_len) { - $temp = ord($content[$content_pos++]); - $valuen <<= 7; - $valuen |= $temp & 0x7F; - if (~$temp & 0x80) { - $current['content'].= ".$valuen"; - $valuen = 0; - } - } - // the eighth bit of the last byte should not be 1 - //if ($temp >> 7) { - // return false; - //} + $current['content'] = $this->_decodeOID(substr($content, $content_pos)); break; /* Each character string type shall be encoded as if it had been declared: [UNIVERSAL x] IMPLICIT OCTET STRING @@ -582,7 +578,7 @@ class ASN1 $childClass = $tempClass = self::CLASS_UNIVERSAL; $constant = null; if (isset($temp['constant'])) { - $tempClass = isset($temp['class']) ? $temp['class'] : self::CLASS_CONTEXT_SPECIFIC; + $tempClass = $temp['type']; } if (isset($child['class'])) { $childClass = $child['class']; @@ -645,7 +641,7 @@ class ASN1 $temp = $decoded['content'][$i]; $tempClass = self::CLASS_UNIVERSAL; if (isset($temp['constant'])) { - $tempClass = isset($temp['class']) ? $temp['class'] : self::CLASS_CONTEXT_SPECIFIC; + $tempClass = $temp['type']; } foreach ($mapping['children'] as $key => $child) { @@ -1001,27 +997,7 @@ class ASN1 $value = base64_decode($source); break; case self::TYPE_OBJECT_IDENTIFIER: - $oid = preg_match('#(?:\d+\.)+#', $source) ? $source : array_search($source, $this->oids); - if ($oid === false) { - user_error('Invalid OID'); - return false; - } - $value = ''; - $parts = explode('.', $oid); - $value = chr(40 * $parts[0] + $parts[1]); - for ($i = 2; $i < count($parts); $i++) { - $temp = ''; - if (!$parts[$i]) { - $temp = "\0"; - } else { - while ($parts[$i]) { - $temp = chr(0x80 | ($parts[$i] & 0x7F)) . $temp; - $parts[$i] >>= 7; - } - $temp[strlen($temp) - 1] = $temp[strlen($temp) - 1] & chr(0x7F); - } - $value.= $temp; - } + $value = $this->_encodeOID($source); break; case self::TYPE_ANY: $loc = $this->location; @@ -1120,6 +1096,108 @@ class ASN1 return pack('Ca*', 0x80 | strlen($temp), $temp); } + /** + * BER-decode the OID + * + * Called by _decode_ber() + * + * @access private + * @param string $content + * @return string + */ + function _decodeOID($content) + { + static $eighty; + if (!$eighty) { + $eighty = new BigInteger(80); + } + + $oid = array(); + $pos = 0; + $len = strlen($content); + $n = new BigInteger(); + while ($pos < $len) { + $temp = ord($content[$pos++]); + $n = $n->bitwise_leftShift(7); + $n = $n->bitwise_or(new BigInteger($temp & 0x7F)); + if (~$temp & 0x80) { + $oid[] = $n; + $n = new BigInteger(); + } + } + $part1 = array_shift($oid); + $first = floor(ord($content[0]) / 40); + /* + "This packing of the first two object identifier components recognizes that only three values are allocated from the root + node, and at most 39 subsequent values from nodes reached by X = 0 and X = 1." + + -- https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=22 + */ + if ($first <= 2) { // ie. 0 <= ord($content[0]) < 120 (0x78) + array_unshift($oid, ord($content[0]) % 40); + array_unshift($oid, $first); + } else { + array_unshift($oid, $part1->subtract($eighty)); + array_unshift($oid, 2); + } + + return implode('.', $oid); + } + + /** + * DER-encode the OID + * + * Called by _encode_der() + * + * @access private + * @param string $content + * @return string + */ + function _encodeOID($source) + { + static $mask, $zero, $forty; + if (!$mask) { + $mask = new BigInteger(0x7F); + $zero = new BigInteger(); + $forty = new BigInteger(40); + } + + $oid = preg_match('#(?:\d+\.)+#', $source) ? $source : array_search($source, $this->oids); + if ($oid === false) { + user_error('Invalid OID'); + return false; + } + $parts = explode('.', $oid); + $part1 = array_shift($parts); + $part2 = array_shift($parts); + + $first = new BigInteger($part1); + $first = $first->multiply($forty); + $first = $first->add(new BigInteger($part2)); + + array_unshift($parts, $first->toString()); + + $value = ''; + foreach ($parts as $part) { + if (!$part) { + $temp = "\0"; + } else { + $temp = ''; + $part = new BigInteger($part); + while (!$part->equals($zero)) { + $submask = $part->bitwise_and($mask); + $submask->setPrecision(8); + $temp = (chr(0x80) | $submask->toBytes()) . $temp; + $part = $part->bitwise_rightShift(7); + } + $temp[strlen($temp) - 1] = $temp[strlen($temp) - 1] & chr(0x7F); + } + $value.= $temp; + } + + return $value; + } + /** * BER-decode the time * diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/File/X509.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/File/X509.php index 67317db23..4ebafa171 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/File/X509.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/File/X509.php @@ -305,6 +305,22 @@ class X509 */ var $challenge; + /** + * Recursion Limit + * + * @var int + * @access private + */ + static $recur_limit = 5; + + /** + * URL fetch flag + * + * @var bool + * @access private + */ + static $disable_url_fetch = false; + /** * Default Constructor. * @@ -1912,6 +1928,9 @@ class X509 // "Certificate Transparency" // https://tools.ietf.org/html/rfc6962 case '1.3.6.1.4.1.11129.2.4.2': + // "Qualified Certificate statements" + // https://tools.ietf.org/html/rfc3739#section-3.2.6 + case '1.3.6.1.5.5.7.1.3': return true; // CSR attributes @@ -2076,7 +2095,7 @@ class X509 * * If $date isn't defined it is assumed to be the current date. * - * @param int $date optional + * @param \DateTime|string $date optional * @access public */ function validateDate($date = null) @@ -2086,7 +2105,7 @@ class X509 } if (!isset($date)) { - $date = new DateTime($date, new DateTimeZone(@date_default_timezone_get())); + $date = new DateTime(null, new DateTimeZone(@date_default_timezone_get())); } $notBefore = $this->currentCert['tbsCertificate']['validity']['notBefore']; @@ -2095,15 +2114,133 @@ class X509 $notAfter = $this->currentCert['tbsCertificate']['validity']['notAfter']; $notAfter = isset($notAfter['generalTime']) ? $notAfter['generalTime'] : $notAfter['utcTime']; + if (is_string($date)) { + $date = new DateTime($date, new DateTimeZone(@date_default_timezone_get())); + } + + $notBefore = new DateTime($notBefore, new DateTimeZone(@date_default_timezone_get())); + $notAfter = new DateTime($notAfter, new DateTimeZone(@date_default_timezone_get())); + switch (true) { - case $date < new DateTime($notBefore, new DateTimeZone(@date_default_timezone_get())): - case $date > new DateTime($notAfter, new DateTimeZone(@date_default_timezone_get())): + case $date < $notBefore: + case $date > $notAfter: return false; } return true; } + /** + * Fetches a URL + * + * @param string $url + * @access private + * @return bool|string + */ + static function _fetchURL($url) + { + if (self::$disable_url_fetch) { + return false; + } + + $parts = parse_url($url); + $data = ''; + switch ($parts['scheme']) { + case 'http': + $fsock = @fsockopen($parts['host'], isset($parts['port']) ? $parts['port'] : 80); + if (!$fsock) { + return false; + } + fputs($fsock, "GET $parts[path] HTTP/1.0\r\n"); + fputs($fsock, "Host: $parts[host]\r\n\r\n"); + $line = fgets($fsock, 1024); + if (strlen($line) < 3) { + return false; + } + preg_match('#HTTP/1.\d (\d{3})#', $line, $temp); + if ($temp[1] != '200') { + return false; + } + + // skip the rest of the headers in the http response + while (!feof($fsock) && fgets($fsock, 1024) != "\r\n") { + } + + while (!feof($fsock)) { + $data.= fread($fsock, 1024); + } + + break; + //case 'ftp': + //case 'ldap': + //default: + } + + return $data; + } + + /** + * Validates an intermediate cert as identified via authority info access extension + * + * See https://tools.ietf.org/html/rfc4325 for more info + * + * @param bool $caonly + * @param int $count + * @access private + * @return bool + */ + function _testForIntermediate($caonly, $count) + { + $opts = $this->getExtension('id-pe-authorityInfoAccess'); + if (!is_array($opts)) { + return false; + } + foreach ($opts as $opt) { + if ($opt['accessMethod'] == 'id-ad-caIssuers') { + // accessLocation is a GeneralName. GeneralName fields support stuff like email addresses, IP addresses, LDAP, + // etc, but we're only supporting URI's. URI's and LDAP are the only thing https://tools.ietf.org/html/rfc4325 + // discusses + if (isset($opt['accessLocation']['uniformResourceIdentifier'])) { + $url = $opt['accessLocation']['uniformResourceIdentifier']; + break; + } + } + } + + if (!isset($url)) { + return false; + } + + $cert = static::_fetchURL($url); + if (!is_string($cert)) { + return false; + } + + $parent = new static(); + $parent->CAs = $this->CAs; + /* + "Conforming applications that support HTTP or FTP for accessing + certificates MUST be able to accept .cer files and SHOULD be able + to accept .p7c files." -- https://tools.ietf.org/html/rfc4325 + + A .p7c file is 'a "certs-only" CMS message as specified in RFC 2797" + + These are currently unsupported + */ + if (!is_array($parent->loadX509($cert))) { + return false; + } + + if (!$parent->_validateSignatureCountable($caonly, ++$count)) { + return false; + } + + $this->CAs[] = $parent->currentCert; + //$this->loadCA($cert); + + return true; + } + /** * Validate a signature * @@ -2120,11 +2257,30 @@ class X509 * @return mixed */ function validateSignature($caonly = true) + { + return $this->_validateSignatureCountable($caonly, 0); + } + + /** + * Validate a signature + * + * Performs said validation whilst keeping track of how many times validation method is called + * + * @param bool $caonly + * @param int $count + * @access private + * @return mixed + */ + function _validateSignatureCountable($caonly, $count) { if (!is_array($this->currentCert) || !isset($this->signatureSubject)) { return null; } + if ($count == self::$recur_limit) { + return false; + } + /* TODO: "emailAddress attribute values are not case-sensitive (e.g., "subscriber@example.com" is the same as "SUBSCRIBER@EXAMPLE.COM")." -- http://tools.ietf.org/html/rfc5280#section-4.1.2.6 @@ -2170,10 +2326,10 @@ class X509 } } if (count($this->CAs) == $i && $caonly) { - return false; + return $this->_testForIntermediate($caonly, $count) && $this->validateSignature($caonly); } } elseif (!isset($signingCert) || $caonly) { - return false; + return $this->_testForIntermediate($caonly, $count) && $this->validateSignature($caonly); } return $this->_validateSignature( $signingCert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['algorithm'], @@ -2280,6 +2436,41 @@ class X509 return true; } + /** + * Sets the recursion limit + * + * When validating a signature it may be necessary to download intermediate certs from URI's. + * An intermediate cert that linked to itself would result in an infinite loop so to prevent + * that we set a recursion limit. A negative number means that there is no recursion limit. + * + * @param int $count + * @access public + */ + static function setRecurLimit($count) + { + self::$recur_limit = $count; + } + + /** + * Prevents URIs from being automatically retrieved + * + * @access public + */ + static function disableURLFetch() + { + self::$disable_url_fetch = true; + } + + /** + * Allows URIs to be automatically retrieved + * + * @access public + */ + static function enableURLFetch() + { + self::$disable_url_fetch = false; + } + /** * Reformat public keys * @@ -2739,7 +2930,7 @@ class X509 } $output.= $desc . '=' . $value; $result[$desc] = isset($result[$desc]) ? - array_merge((array) $dn[$prop], array($value)) : + array_merge((array) $result[$desc], array($value)) : $value; $start = false; } @@ -3447,7 +3638,7 @@ class X509 'tbsCertificate' => array( 'version' => 'v3', - 'serialNumber' => $serialNumber, // $this->setserialNumber() + 'serialNumber' => $serialNumber, // $this->setSerialNumber() 'signature' => array('algorithm' => $signatureAlgorithm), 'issuer' => false, // this is going to be overwritten later 'validity' => array( diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php index 2aa39a50a..fe1f43c58 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php @@ -45,7 +45,6 @@ * @author Jim Wigginton * @copyright 2006 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://pear.php.net/package/Math_BigInteger */ namespace phpseclib\Math; @@ -266,23 +265,27 @@ class BigInteger if (extension_loaded('openssl') && !defined('MATH_BIGINTEGER_OPENSSL_DISABLE') && !defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) { // some versions of XAMPP have mismatched versions of OpenSSL which causes it not to work - ob_start(); - @phpinfo(); - $content = ob_get_contents(); - ob_end_clean(); - - preg_match_all('#OpenSSL (Header|Library) Version(.*)#im', $content, $matches); - $versions = array(); - if (!empty($matches[1])) { - for ($i = 0; $i < count($matches[1]); $i++) { - $fullVersion = trim(str_replace('=>', '', strip_tags($matches[2][$i]))); - // Remove letter part in OpenSSL version - if (!preg_match('/(\d+\.\d+\.\d+)/i', $fullVersion, $m)) { - $versions[$matches[1][$i]] = $fullVersion; - } else { - $versions[$matches[1][$i]] = $m[0]; + // avoid generating errors (even with suppression) when phpinfo() is disabled (common in production systems) + if (strpos(ini_get('disable_functions'), 'phpinfo') === false) { + ob_start(); + @phpinfo(); + $content = ob_get_contents(); + ob_end_clean(); + + preg_match_all('#OpenSSL (Header|Library) Version(.*)#im', $content, $matches); + + if (!empty($matches[1])) { + for ($i = 0; $i < count($matches[1]); $i++) { + $fullVersion = trim(str_replace('=>', '', strip_tags($matches[2][$i]))); + + // Remove letter part in OpenSSL version + if (!preg_match('/(\d+\.\d+\.\d+)/i', $fullVersion, $m)) { + $versions[$matches[1][$i]] = $fullVersion; + } else { + $versions[$matches[1][$i]] = $m[0]; + } } } } @@ -442,6 +445,9 @@ class BigInteger // (?<=^|-)0*: find any 0's that are preceded by the start of the string or by a - (ie. octals) // [^-0-9].*: find any non-numeric characters and then any characters that follow that $x = preg_replace('#(?add(new static(1)) : $this->copy(); $bytes = $temp->toBytes(); - if (empty($bytes)) { // eg. if the number we're trying to convert is -1 + if (!strlen($bytes)) { // eg. if the number we're trying to convert is -1 $bytes = chr(0); } @@ -1555,7 +1561,9 @@ class BigInteger $temp_value = array($quotient_value[$q_index]); $temp = $temp->multiply($y); $temp_value = &$temp->value; - $temp_value = array_merge($adjust, $temp_value); + if (count($temp_value)) { + $temp_value = array_merge($adjust, $temp_value); + } $x = $x->subtract($temp); @@ -2688,7 +2696,14 @@ class BigInteger { switch (MATH_BIGINTEGER_MODE) { case self::MODE_GMP: - return gmp_cmp($this->value, $y->value); + $r = gmp_cmp($this->value, $y->value); + if ($r < -1) { + $r = -1; + } + if ($r > 1) { + $r = 1; + } + return $r; case self::MODE_BCMATH: return bccomp($this->value, $y->value, 0); } @@ -3569,6 +3584,7 @@ class BigInteger $value = &$result->value; if (!count($value)) { + $result->is_negative = false; return $result; } diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SCP.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SCP.php index f95bce6df..cf13496cd 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SCP.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SCP.php @@ -144,6 +144,11 @@ class SCP return false; } + if (empty($remote_file)) { + user_error('remote_file cannot be blank', E_USER_NOTICE); + return false; + } + if (!$this->ssh->exec('scp -t ' . escapeshellarg($remote_file), false)) { // -t = to return false; } diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php index 8825f30cf..a248c2581 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php @@ -109,11 +109,11 @@ class SFTP extends SSH2 * The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support * concurrent actions, so it's somewhat academic, here. * - * @var int + * @var boolean * @see self::_send_sftp_packet() * @access private */ - var $request_id = false; + var $use_request_id = false; /** * The Packet Type @@ -250,6 +250,15 @@ class SFTP extends SSH2 */ var $canonicalize_paths = true; + /** + * Request Buffers + * + * @see self::_get_sftp_packet() + * @var array + * @access private + */ + var $requestBuffer = array(); + /** * Default Constructor. * @@ -519,7 +528,7 @@ class SFTP extends SSH2 } */ - $this->request_id = 1; + $this->use_request_id = true; /* A Note on SFTPv4/5/6 support: @@ -833,6 +842,7 @@ class SFTP extends SSH2 } if (is_array($this->_query_stat_cache($this->_realpath($dir . '/' . $value)))) { $temp = $this->_nlist_helper($dir . '/' . $value, true, $relativeDir . $value . '/'); + $temp = is_array($temp) ? $temp : array(); $result = array_merge($result, $temp); } else { $result[] = $relativeDir . $value; @@ -864,7 +874,17 @@ class SFTP extends SSH2 unset($files[$key]); continue; } - if ($key != '.' && $key != '..' && is_array($this->_query_stat_cache($this->_realpath($dir . '/' . $key)))) { + $is_directory = false; + if ($key != '.' && $key != '..') { + if ($this->use_stat_cache) { + $is_directory = is_array($this->_query_stat_cache($this->_realpath($dir . '/' . $key))); + } else { + $stat = $this->lstat($dir . '/' . $key); + $is_directory = $stat && $stat['type'] === NET_SFTP_TYPE_DIRECTORY; + } + } + + if ($is_directory) { $depth++; $files[$key] = $this->rawlist($dir . '/' . $key, true); $depth--; @@ -2128,10 +2148,11 @@ class SFTP extends SSH2 * @param string $local_file * @param int $offset * @param int $length + * @param callable|null $progressCallback * @return mixed * @access public */ - function get($remote_file, $local_file = false, $offset = 0, $length = -1) + function get($remote_file, $local_file = false, $offset = 0, $length = -1, $progressCallback = null) { if (!($this->bitmap & SSH2::MASK_LOGIN)) { return false; @@ -2189,7 +2210,7 @@ class SFTP extends SSH2 $packet_size = $length > 0 ? min($this->max_sftp_packet, $length - $read) : $this->max_sftp_packet; $packet = pack('Na*N3', strlen($handle), $handle, $tempoffset / 4294967296, $tempoffset, $packet_size); - if (!$this->_send_sftp_packet(NET_SFTP_READ, $packet)) { + if (!$this->_send_sftp_packet(NET_SFTP_READ, $packet, $i)) { if ($fclose_check) { fclose($fp); } @@ -2197,6 +2218,9 @@ class SFTP extends SSH2 } $packet = null; $read+= $packet_size; + if (is_callable($progressCallback)) { + call_user_func($progressCallback, $read); + } $i++; } @@ -2204,15 +2228,17 @@ class SFTP extends SSH2 break; } + $packets_sent = $i - 1; + $clear_responses = false; while ($i > 0) { $i--; if ($clear_responses) { - $this->_get_sftp_packet(); + $this->_get_sftp_packet($packets_sent - $i); continue; } else { - $response = $this->_get_sftp_packet(); + $response = $this->_get_sftp_packet($packets_sent - $i); } switch ($this->packet_type) { @@ -2921,10 +2947,10 @@ class SFTP extends SSH2 * @return bool * @access private */ - function _send_sftp_packet($type, $data) + function _send_sftp_packet($type, $data, $request_id = 1) { - $packet = $this->request_id !== false ? - pack('NCNa*', strlen($data) + 5, $type, $this->request_id, $data) : + $packet = $this->use_request_id ? + pack('NCNa*', strlen($data) + 5, $type, $request_id, $data) : pack('NCa*', strlen($data) + 1, $type, $data); $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 @@ -2962,9 +2988,18 @@ class SFTP extends SSH2 * @return string * @access private */ - function _get_sftp_packet() + function _get_sftp_packet($request_id = null) { - $this->curTimeout = false; + if (isset($request_id) && isset($this->requestBuffer[$request_id])) { + $this->packet_type = $this->requestBuffer[$request_id]['packet_type']; + $temp = $this->requestBuffer[$request_id]['packet']; + unset($this->requestBuffer[$request_id]); + return $temp; + } + + // in SSH2.php the timeout is cumulative per function call. eg. exec() will + // timeout after 10s. but for SFTP.php it's cumulative per packet + $this->curTimeout = $this->timeout; $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 @@ -2985,6 +3020,13 @@ class SFTP extends SSH2 $tempLength = $length; $tempLength-= strlen($this->packet_buffer); + + // 256 * 1024 is what SFTP_MAX_MSG_LENGTH is set to in OpenSSH's sftp-common.h + if ($tempLength > 256 * 1024) { + user_error('Invalid SFTP packet size'); + return false; + } + // SFTP packet type and data payload while ($tempLength > 0) { $temp = $this->_get_channel_packet(self::CHANNEL, true); @@ -3001,8 +3043,8 @@ class SFTP extends SSH2 $this->packet_type = ord($this->_string_shift($this->packet_buffer)); - if ($this->request_id !== false) { - $this->_string_shift($this->packet_buffer, 4); // remove the request id + if ($this->use_request_id) { + extract(unpack('Npacket_id', $this->_string_shift($this->packet_buffer, 4))); // remove the request id $length-= 5; // account for the request id and the packet type } else { $length-= 1; // account for the packet type @@ -3025,6 +3067,14 @@ class SFTP extends SSH2 } } + if (isset($request_id) && $this->use_request_id && $packet_id != $request_id) { + $this->requestBuffer[$packet_id] = array( + 'packet_type' => $this->packet_type, + 'packet' => $packet + ); + return $this->_get_sftp_packet($request_id); + } + return $packet; } diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php index cdb7cb39e..817fa165e 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php @@ -104,6 +104,7 @@ class SSH2 const CHANNEL_SHELL = 2; const CHANNEL_SUBSYSTEM = 3; const CHANNEL_AGENT_FORWARD = 4; + const CHANNEL_KEEP_ALIVE = 5; /**#@-*/ /**#@+ @@ -145,7 +146,10 @@ class SSH2 */ const READ_REGEX = 2; /** - * Returns when a string matching the regular expression $expect is found + * Returns whenever a data packet is received. + * + * Some data packets may only contain a single character so it may be necessary + * to call read() multiple times when using this option */ const READ_NEXT = 3; /**#@-*/ @@ -918,6 +922,22 @@ class SSH2 */ var $binary_packet_buffer = false; + /** + * Preferred Signature Format + * + * @var string|false + * @access private + */ + var $preferred_signature_format = false; + + /** + * Authentication Credentials + * + * @var array + * @access private + */ + var $auth = array(); + /** * Default Constructor. * @@ -1124,11 +1144,12 @@ class SSH2 } $elapsed = microtime(true) - $start; - $this->curTimeout-= $elapsed; - - if ($this->curTimeout <= 0) { - $this->is_timeout = true; - return false; + if ($this->curTimeout) { + $this->curTimeout-= $elapsed; + if ($this->curTimeout < 0) { + $this->is_timeout = true; + return false; + } } } @@ -1193,6 +1214,7 @@ class SSH2 } if (feof($this->fsock)) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -1206,7 +1228,7 @@ class SSH2 $this->server_identifier = trim($temp, "\r\n"); if (strlen($extra)) { - $this->errors[] = utf8_decode($data); + $this->errors[] = $data; } if (version_compare($matches[3], '1.99', '<')) { @@ -1221,6 +1243,7 @@ class SSH2 if (!$this->send_kex_first) { $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -1309,6 +1332,8 @@ class SSH2 } $server_host_key_algorithms = array( + 'rsa-sha2-256', // RFC 8332 + 'rsa-sha2-512', // RFC 8332 'ssh-rsa', // RECOMMENDED sign Raw RSA Key 'ssh-dss' // REQUIRED sign Raw DSS Key ); @@ -1459,6 +1484,7 @@ class SSH2 $kexinit_payload_server = $this->_get_binary_packet(); if ($kexinit_payload_server === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -1595,6 +1621,7 @@ class SSH2 $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -1687,12 +1714,14 @@ class SSH2 $data = pack('CNa*', $clientKexInitMessage, strlen($eBytes), $eBytes); if (!$this->_send_binary_packet($data)) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -1782,9 +1811,25 @@ class SSH2 return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); } - if ($public_key_format != $server_host_key_algorithm || $this->signature_format != $server_host_key_algorithm) { - user_error('Server Host Key Algorithm Mismatch'); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + switch ($server_host_key_algorithm) { + case 'ssh-dss': + $expected_key_format = 'ssh-dss'; + break; + //case 'rsa-sha2-256': + //case 'rsa-sha2-512': + //case 'ssh-rsa': + default: + $expected_key_format = 'ssh-rsa'; + } + + if ($public_key_format != $expected_key_format || $this->signature_format != $server_host_key_algorithm) { + switch (true) { + case $this->signature_format == $server_host_key_algorithm: + case $server_host_key_algorithm != 'rsa-sha2-256' && $server_host_key_algorithm != 'rsa-sha2-512': + case $this->signature_format != 'ssh-rsa': + user_error('Server Host Key Algorithm Mismatch'); + return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + } } $packet = pack( @@ -1799,6 +1844,7 @@ class SSH2 $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -1820,7 +1866,7 @@ class SSH2 $this->encrypt = $this->_encryption_algorithm_to_crypt_instance($encrypt); if ($this->encrypt) { if ($this->crypto_engine) { - $this->encrypt->setEngine($this->crypto_engine); + $this->encrypt->setPreferredEngine($this->crypto_engine); } if ($this->encrypt->block_size) { $this->encrypt_block_size = $this->encrypt->block_size; @@ -1844,7 +1890,7 @@ class SSH2 $this->decrypt = $this->_encryption_algorithm_to_crypt_instance($decrypt); if ($this->decrypt) { if ($this->crypto_engine) { - $this->decrypt->setEngine($this->crypto_engine); + $this->decrypt->setPreferredEngine($this->crypto_engine); } if ($this->decrypt->block_size) { $this->decrypt_block_size = $this->decrypt->block_size; @@ -2095,6 +2141,7 @@ class SSH2 function login($username) { $args = func_get_args(); + $this->auth[] = $args; return call_user_func_array(array(&$this, '_login'), $args); } @@ -2166,6 +2213,7 @@ class SSH2 } return $this->_login_helper($username, $password); } + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -2218,6 +2266,7 @@ class SSH2 $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -2276,6 +2325,7 @@ class SSH2 $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -2294,7 +2344,7 @@ class SSH2 return false; } extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->errors[] = 'SSH_MSG_USERAUTH_PASSWD_CHANGEREQ: ' . utf8_decode($this->_string_shift($response, $length)); + $this->errors[] = 'SSH_MSG_USERAUTH_PASSWD_CHANGEREQ: ' . $this->_string_shift($response, $length); return $this->_disconnect(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER); case NET_SSH2_MSG_USERAUTH_FAILURE: // can we use keyboard-interactive authentication? if not then either the login is bad or the server employees @@ -2376,6 +2426,7 @@ class SSH2 } else { $orig = $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -2545,6 +2596,21 @@ class SSH2 $publickey['n'] ); + switch ($this->signature_format) { + case 'rsa-sha2-512': + $hash = 'sha512'; + $signatureType = 'rsa-sha2-512'; + break; + case 'rsa-sha2-256': + $hash = 'sha256'; + $signatureType = 'rsa-sha2-256'; + break; + //case 'ssh-rsa': + default: + $hash = 'sha1'; + $signatureType = 'ssh-rsa'; + } + $part1 = pack( 'CNa*Na*Na*', NET_SSH2_MSG_USERAUTH_REQUEST, @@ -2555,7 +2621,7 @@ class SSH2 strlen('publickey'), 'publickey' ); - $part2 = pack('Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($publickey), $publickey); + $part2 = pack('Na*Na*', strlen($signatureType), $signatureType, strlen($publickey), $publickey); $packet = $part1 . chr(0) . $part2; if (!$this->_send_binary_packet($packet)) { @@ -2564,6 +2630,7 @@ class SSH2 $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -2595,8 +2662,9 @@ class SSH2 $packet = $part1 . chr(1) . $part2; $privatekey->setSignatureMode(RSA::SIGNATURE_PKCS1); + $privatekey->setHash($hash); $signature = $privatekey->sign(pack('Na*a*', strlen($this->session_id), $this->session_id, $packet)); - $signature = pack('Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($signature), $signature); + $signature = pack('Na*Na*', strlen($signatureType), $signatureType, strlen($signature), $signature); $packet.= pack('Na*', strlen($signature), $signature); if (!$this->_send_binary_packet($packet)) { @@ -2605,6 +2673,7 @@ class SSH2 $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -2731,6 +2800,7 @@ class SSH2 $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -2870,6 +2940,7 @@ class SSH2 $response = $this->_get_binary_packet(); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -3184,6 +3255,66 @@ class SSH2 return (bool) ($this->bitmap & self::MASK_LOGIN); } + /** + * Pings a server connection, or tries to reconnect if the connection has gone down + * + * Inspired by http://php.net/manual/en/mysqli.ping.php + * + * @return bool + * @access public + */ + function ping() + { + if (!$this->isAuthenticated()) { + return false; + } + + $this->window_size_server_to_client[self::CHANNEL_KEEP_ALIVE] = $this->window_size; + $packet_size = 0x4000; + $packet = pack( + 'CNa*N3', + NET_SSH2_MSG_CHANNEL_OPEN, + strlen('session'), + 'session', + self::CHANNEL_KEEP_ALIVE, + $this->window_size_server_to_client[self::CHANNEL_KEEP_ALIVE], + $packet_size + ); + + if (!@$this->_send_binary_packet($packet)) { + return $this->_reconnect(); + } + + $this->channel_status[self::CHANNEL_KEEP_ALIVE] = NET_SSH2_MSG_CHANNEL_OPEN; + + $response = @$this->_get_channel_packet(self::CHANNEL_KEEP_ALIVE); + if ($response !== false) { + $this->_close_channel(self::CHANNEL_KEEP_ALIVE); + return true; + } + + return $this->_reconnect(); + } + + /** + * In situ reconnect method + * + * @return boolean + * @access private + */ + function _reconnect() + { + $this->_reset_connection(NET_SSH2_DISCONNECT_CONNECTION_LOST); + $this->retry_connect = true; + if (!$this->_connect()) { + return false; + } + foreach ($this->auth as $auth) { + $result = call_user_func_array(array(&$this, 'login'), $auth); + } + return $result; + } + /** * Resets a connection for re-use * @@ -3214,8 +3345,8 @@ class SSH2 function _get_binary_packet($skip_channel_filter = false) { if (!is_resource($this->fsock) || feof($this->fsock)) { - user_error('Connection closed prematurely'); $this->bitmap = 0; + user_error('Connection closed prematurely'); return false; } @@ -3258,8 +3389,8 @@ class SSH2 while ($remaining_length > 0) { $temp = stream_get_contents($this->fsock, $remaining_length); if ($temp === false || feof($this->fsock)) { - user_error('Error reading from socket'); $this->bitmap = 0; + user_error('Error reading from socket'); return false; } $buffer.= $temp; @@ -3277,8 +3408,8 @@ class SSH2 if ($this->hmac_check !== false) { $hmac = stream_get_contents($this->fsock, $this->hmac_size); if ($hmac === false || strlen($hmac) != $this->hmac_size) { - user_error('Error reading socket'); $this->bitmap = 0; + user_error('Error reading socket'); return false; } elseif ($hmac != $this->hmac_check->hash(pack('NNCa*', $this->get_seq_no, $packet_length, $padding_length, $payload . $padding))) { user_error('Invalid HMAC'); @@ -3322,7 +3453,7 @@ class SSH2 return false; } extract(unpack('Nreason_code/Nlength', $this->_string_shift($payload, 8))); - $this->errors[] = 'SSH_MSG_DISCONNECT: ' . $this->disconnect_reasons[$reason_code] . "\r\n" . utf8_decode($this->_string_shift($payload, $length)); + $this->errors[] = 'SSH_MSG_DISCONNECT: ' . $this->disconnect_reasons[$reason_code] . "\r\n" . $this->_string_shift($payload, $length); $this->bitmap = 0; return false; case NET_SSH2_MSG_IGNORE: @@ -3334,7 +3465,7 @@ class SSH2 return false; } extract(unpack('Nlength', $this->_string_shift($payload, 4))); - $this->errors[] = 'SSH_MSG_DEBUG: ' . utf8_decode($this->_string_shift($payload, $length)); + $this->errors[] = 'SSH_MSG_DEBUG: ' . $this->_string_shift($payload, $length); $payload = $this->_get_binary_packet($skip_channel_filter); break; case NET_SSH2_MSG_UNIMPLEMENTED: @@ -3357,7 +3488,7 @@ class SSH2 return false; } extract(unpack('Nlength', $this->_string_shift($payload, 4))); - $this->banner_message = utf8_decode($this->_string_shift($payload, $length)); + $this->banner_message = $this->_string_shift($payload, $length); $payload = $this->_get_binary_packet(); } @@ -3561,7 +3692,12 @@ class SSH2 $response = $this->binary_packet_buffer; $this->binary_packet_buffer = false; } else { - if ($this->curTimeout) { + $read = array($this->fsock); + $write = $except = null; + + if (!$this->curTimeout) { + @stream_select($read, $write, $except, null); + } else { if ($this->curTimeout < 0) { $this->is_timeout = true; return true; @@ -3576,6 +3712,9 @@ class SSH2 // on windows this returns a "Warning: Invalid CRT parameters detected" error if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) { $this->is_timeout = true; + if ($client_channel == self::CHANNEL_EXEC && !$this->request_pty) { + $this->_close_channel($client_channel); + } return true; } $elapsed = microtime(true) - $start; @@ -3584,6 +3723,7 @@ class SSH2 $response = $this->_get_binary_packet(true); if ($response === false) { + $this->bitmap = 0; user_error('Connection closed by server'); return false; } @@ -3592,10 +3732,6 @@ class SSH2 if ($client_channel == -1 && $response === true) { return true; } - if (!strlen($response)) { - return ''; - } - if (!strlen($response)) { return false; } @@ -3626,7 +3762,7 @@ class SSH2 switch ($type) { case NET_SSH2_MSG_CHANNEL_EXTENDED_DATA: /* - if ($client_channel == NET_SSH2_CHANNEL_EXEC) { + if ($client_channel == self::CHANNEL_EXEC) { $this->_send_channel_packet($client_channel, chr(0)); } */ @@ -3818,8 +3954,8 @@ class SSH2 function _send_binary_packet($data, $logged = null) { if (!is_resource($this->fsock) || feof($this->fsock)) { - user_error('Connection closed prematurely'); $this->bitmap = 0; + user_error('Connection closed prematurely'); return false; } @@ -4480,6 +4616,8 @@ class SSH2 break; case 'ssh-rsa': + case 'rsa-sha2-256': + case 'rsa-sha2-512': if (strlen($server_public_host_key) < 4) { return false; } @@ -4502,8 +4640,21 @@ class SSH2 $signature = $this->_string_shift($signature, $temp['length']); $rsa = new RSA(); + switch ($this->signature_format) { + case 'rsa-sha2-512': + $hash = 'sha512'; + break; + case 'rsa-sha2-256': + $hash = 'sha256'; + break; + //case 'ssh-rsa': + default: + $hash = 'sha1'; + } + $rsa->setHash($hash); $rsa->setSignatureMode(RSA::SIGNATURE_PKCS1); $rsa->loadKey(array('e' => $e, 'n' => $n), RSA::PUBLIC_FORMAT_RAW); + if (!$rsa->verify($this->exchange_hash, $signature)) { user_error('Bad server signature'); return $this->_disconnect(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); @@ -4530,7 +4681,30 @@ class SSH2 $s = $s->modPow($e, $n); $s = $s->toBytes(); - $h = pack('N4H*', 0x00302130, 0x0906052B, 0x0E03021A, 0x05000414, sha1($this->exchange_hash)); + switch ($this->signature_format) { + case 'rsa-sha2-512': + $hash = 'sha512'; + break; + case 'rsa-sha2-256': + $hash = 'sha256'; + break; + //case 'ssh-rsa': + default: + $hash = 'sha1'; + } + $hashObj = new Hash($hash); + switch ($this->signature_format) { + case 'rsa-sha2-512': + $h = pack('N5a*', 0x00305130, 0x0D060960, 0x86480165, 0x03040203, 0x05000440, $hashObj->hash($this->exchange_hash)); + break; + case 'rsa-sha2-256': + $h = pack('N5a*', 0x00303130, 0x0D060960, 0x86480165, 0x03040201, 0x05000420, $hashObj->hash($this->exchange_hash)); + break; + //case 'ssh-rsa': + default: + $hash = 'sha1'; + $h = pack('N4a*', 0x00302130, 0x0906052B, 0x0E03021A, 0x05000414, $hashObj->hash($this->exchange_hash)); + } $h = chr(0x01) . str_repeat(chr(0xFF), $nLength - 2 - strlen($h)) . $h; if ($s != $h) { diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php index a4ff0549d..99dcecfe6 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php @@ -43,7 +43,7 @@ use phpseclib\System\SSH\Agent\Identity; * * @package SSH\Agent * @author Jim Wigginton - * @access internal + * @access public */ class Agent { @@ -117,18 +117,20 @@ class Agent * @return \phpseclib\System\SSH\Agent * @access public */ - function __construct() + function __construct($address = null) { - switch (true) { - case isset($_SERVER['SSH_AUTH_SOCK']): - $address = $_SERVER['SSH_AUTH_SOCK']; - break; - case isset($_ENV['SSH_AUTH_SOCK']): - $address = $_ENV['SSH_AUTH_SOCK']; - break; - default: - user_error('SSH_AUTH_SOCK not found'); - return false; + if (!$address) { + switch (true) { + case isset($_SERVER['SSH_AUTH_SOCK']): + $address = $_SERVER['SSH_AUTH_SOCK']; + break; + case isset($_ENV['SSH_AUTH_SOCK']): + $address = $_ENV['SSH_AUTH_SOCK']; + break; + default: + user_error('SSH_AUTH_SOCK not found'); + return false; + } } $this->fsock = fsockopen('unix://' . $address, 0, $errno, $errstr); @@ -155,12 +157,14 @@ class Agent $packet = pack('NC', 1, self::SSH_AGENTC_REQUEST_IDENTITIES); if (strlen($packet) != fputs($this->fsock, $packet)) { user_error('Connection closed while requesting identities'); + return array(); } $length = current(unpack('N', fread($this->fsock, 4))); $type = ord(fread($this->fsock, 1)); if ($type != self::SSH_AGENT_IDENTITIES_ANSWER) { user_error('Unable to request identities'); + return array(); } $identities = array(); diff --git a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php index b8cc6cded..b4649046a 100644 --- a/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php +++ b/libraries/vdm_io/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php @@ -32,6 +32,17 @@ use phpseclib\System\SSH\Agent; */ class Identity { + /**@+ + * Signature Flags + * + * See https://tools.ietf.org/html/draft-miller-ssh-agent-00#section-5.3 + * + * @access private + */ + const SSH_AGENT_RSA2_256 = 2; + const SSH_AGENT_RSA2_512 = 4; + /**#@-*/ + /** * Key Object * @@ -59,6 +70,16 @@ class Identity */ var $fsock; + /** + * Signature flags + * + * @var int + * @access private + * @see self::sign() + * @see self::setHash() + */ + var $flags = 0; + /** * Default Constructor. * @@ -126,6 +147,31 @@ class Identity { } + /** + * Set Hash + * + * ssh-agent doesn't support using hashes for RSA other than SHA1 + * + * @param string $hash + * @access public + */ + function setHash($hash) + { + $this->flags = 0; + switch ($hash) { + case 'sha1': + break; + case 'sha256': + $this->flags = self::SSH_AGENT_RSA2_256; + break; + case 'sha512': + $this->flags = self::SSH_AGENT_RSA2_512; + break; + default: + user_error('The only supported hashes for RSA are sha1, sha256 and sha512'); + } + } + /** * Create a signature * @@ -138,7 +184,7 @@ class Identity function sign($message) { // the last parameter (currently 0) is for flags and ssh-agent only defines one flag (for ssh-dss): SSH_AGENT_OLD_SIGNATURE - $packet = pack('CNa*Na*N', Agent::SSH_AGENTC_SIGN_REQUEST, strlen($this->key_blob), $this->key_blob, strlen($message), $message, 0); + $packet = pack('CNa*Na*N', Agent::SSH_AGENTC_SIGN_REQUEST, strlen($this->key_blob), $this->key_blob, strlen($message), $message, $this->flags); $packet = pack('Na*', strlen($packet), $packet); if (strlen($packet) != fputs($this->fsock, $packet)) { user_error('Connection closed during signing'); @@ -151,8 +197,34 @@ class Identity } $signature_blob = fread($this->fsock, $length - 1); - // the only other signature format defined - ssh-dss - is the same length as ssh-rsa - // the + 12 is for the other various SSH added length fields - return substr($signature_blob, strlen('ssh-rsa') + 12); + $length = current(unpack('N', $this->_string_shift($signature_blob, 4))); + if ($length != strlen($signature_blob)) { + user_error('Malformed signature blob'); + } + $length = current(unpack('N', $this->_string_shift($signature_blob, 4))); + if ($length > strlen($signature_blob) + 4) { + user_error('Malformed signature blob'); + } + $type = $this->_string_shift($signature_blob, $length); + $this->_string_shift($signature_blob, 4); + + return $signature_blob; + } + + /** + * String Shift + * + * Inspired by array_shift + * + * @param string $string + * @param int $index + * @return string + * @access private + */ + function _string_shift(&$string, $index = 1) + { + $substr = substr($string, 0, $index); + $string = substr($string, $index); + return $substr; } } diff --git a/script.php b/script.php index ddd8f71d3..7ad39a522 100644 --- a/script.php +++ b/script.php @@ -20,21 +20,27 @@ JHTML::_('behavior.modal'); class com_componentbuilderInstallerScript { /** - * method to install the component + * Constructor * - * @return void + * @param JAdapterInstance $parent The object responsible for running this script */ - function install($parent) - { - - } + public function __construct(JAdapterInstance $parent) {} /** - * method to uninstall the component + * Called on installation * - * @return void + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function uninstall($parent) + public function install(JAdapterInstance $parent) {} + + /** + * Called on uninstallation + * + * @param JAdapterInstance $parent The object responsible for running this script + */ + public function uninstall(JAdapterInstance $parent) { // Get Application object $app = JFactory::getApplication(); @@ -128,6 +134,92 @@ class com_componentbuilderInstallerScript } } + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Joomla_plugin alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $joomla_plugin_found = $db->getNumRows(); + // Now check if there were any rows + if ($joomla_plugin_found) + { + // Since there are load the needed joomla_plugin type ids + $joomla_plugin_ids = $db->loadColumn(); + // Remove Joomla_plugin from the content type table + $joomla_plugin_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($joomla_plugin_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin items + $joomla_plugin_done = $db->execute(); + if ($joomla_plugin_done) + { + // If succesfully remove Joomla_plugin add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin) type alias was removed from the #__content_type table')); + } + + // Remove Joomla_plugin items from the contentitem tag map table + $joomla_plugin_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($joomla_plugin_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin items + $joomla_plugin_done = $db->execute(); + if ($joomla_plugin_done) + { + // If succesfully remove Joomla_plugin add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Joomla_plugin items from the ucm content table + $joomla_plugin_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.joomla_plugin') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($joomla_plugin_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin items + $joomla_plugin_done = $db->execute(); + if ($joomla_plugin_done) + { + // If succesfully remove Joomla_plugin add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Joomla_plugin items are cleared from DB + foreach ($joomla_plugin_ids as $joomla_plugin_id) + { + // Remove Joomla_plugin items from the ucm base table + $joomla_plugin_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($joomla_plugin_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin items + $db->execute(); + + // Remove Joomla_plugin items from the ucm history table + $joomla_plugin_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($joomla_plugin_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin items + $db->execute(); + } + } + // Create a new query object. $query = $db->getQuery(true); // Select id from content type table @@ -730,6 +822,178 @@ class com_componentbuilderInstallerScript } } + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Class_property alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_property') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $class_property_found = $db->getNumRows(); + // Now check if there were any rows + if ($class_property_found) + { + // Since there are load the needed class_property type ids + $class_property_ids = $db->loadColumn(); + // Remove Class_property from the content type table + $class_property_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_property') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($class_property_condition); + $db->setQuery($query); + // Execute the query to remove Class_property items + $class_property_done = $db->execute(); + if ($class_property_done) + { + // If succesfully remove Class_property add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.class_property) type alias was removed from the #__content_type table')); + } + + // Remove Class_property items from the contentitem tag map table + $class_property_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_property') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($class_property_condition); + $db->setQuery($query); + // Execute the query to remove Class_property items + $class_property_done = $db->execute(); + if ($class_property_done) + { + // If succesfully remove Class_property add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.class_property) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Class_property items from the ucm content table + $class_property_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.class_property') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($class_property_condition); + $db->setQuery($query); + // Execute the query to remove Class_property items + $class_property_done = $db->execute(); + if ($class_property_done) + { + // If succesfully remove Class_property add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.class_property) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Class_property items are cleared from DB + foreach ($class_property_ids as $class_property_id) + { + // Remove Class_property items from the ucm base table + $class_property_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_property_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($class_property_condition); + $db->setQuery($query); + // Execute the query to remove Class_property items + $db->execute(); + + // Remove Class_property items from the ucm history table + $class_property_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_property_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($class_property_condition); + $db->setQuery($query); + // Execute the query to remove Class_property items + $db->execute(); + } + } + + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Class_method alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_method') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $class_method_found = $db->getNumRows(); + // Now check if there were any rows + if ($class_method_found) + { + // Since there are load the needed class_method type ids + $class_method_ids = $db->loadColumn(); + // Remove Class_method from the content type table + $class_method_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_method') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($class_method_condition); + $db->setQuery($query); + // Execute the query to remove Class_method items + $class_method_done = $db->execute(); + if ($class_method_done) + { + // If succesfully remove Class_method add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.class_method) type alias was removed from the #__content_type table')); + } + + // Remove Class_method items from the contentitem tag map table + $class_method_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_method') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($class_method_condition); + $db->setQuery($query); + // Execute the query to remove Class_method items + $class_method_done = $db->execute(); + if ($class_method_done) + { + // If succesfully remove Class_method add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.class_method) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Class_method items from the ucm content table + $class_method_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.class_method') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($class_method_condition); + $db->setQuery($query); + // Execute the query to remove Class_method items + $class_method_done = $db->execute(); + if ($class_method_done) + { + // If succesfully remove Class_method add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.class_method) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Class_method items are cleared from DB + foreach ($class_method_ids as $class_method_id) + { + // Remove Class_method items from the ucm base table + $class_method_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_method_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($class_method_condition); + $db->setQuery($query); + // Execute the query to remove Class_method items + $db->execute(); + + // Remove Class_method items from the ucm history table + $class_method_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_method_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($class_method_condition); + $db->setQuery($query); + // Execute the query to remove Class_method items + $db->execute(); + } + } + // Create a new query object. $query = $db->getQuery(true); // Select id from content type table @@ -2966,6 +3230,92 @@ class com_componentbuilderInstallerScript } } + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Component_plugins alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.component_plugins') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $component_plugins_found = $db->getNumRows(); + // Now check if there were any rows + if ($component_plugins_found) + { + // Since there are load the needed component_plugins type ids + $component_plugins_ids = $db->loadColumn(); + // Remove Component_plugins from the content type table + $component_plugins_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.component_plugins') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($component_plugins_condition); + $db->setQuery($query); + // Execute the query to remove Component_plugins items + $component_plugins_done = $db->execute(); + if ($component_plugins_done) + { + // If succesfully remove Component_plugins add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.component_plugins) type alias was removed from the #__content_type table')); + } + + // Remove Component_plugins items from the contentitem tag map table + $component_plugins_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.component_plugins') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($component_plugins_condition); + $db->setQuery($query); + // Execute the query to remove Component_plugins items + $component_plugins_done = $db->execute(); + if ($component_plugins_done) + { + // If succesfully remove Component_plugins add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.component_plugins) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Component_plugins items from the ucm content table + $component_plugins_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.component_plugins') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($component_plugins_condition); + $db->setQuery($query); + // Execute the query to remove Component_plugins items + $component_plugins_done = $db->execute(); + if ($component_plugins_done) + { + // If succesfully remove Component_plugins add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.component_plugins) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Component_plugins items are cleared from DB + foreach ($component_plugins_ids as $component_plugins_id) + { + // Remove Component_plugins items from the ucm base table + $component_plugins_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $component_plugins_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($component_plugins_condition); + $db->setQuery($query); + // Execute the query to remove Component_plugins items + $db->execute(); + + // Remove Component_plugins items from the ucm history table + $component_plugins_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $component_plugins_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($component_plugins_condition); + $db->setQuery($query); + // Execute the query to remove Component_plugins items + $db->execute(); + } + } + // Create a new query object. $query = $db->getQuery(true); // Select id from content type table @@ -3224,6 +3574,350 @@ class com_componentbuilderInstallerScript } } + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Class_extends alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_extends') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $class_extends_found = $db->getNumRows(); + // Now check if there were any rows + if ($class_extends_found) + { + // Since there are load the needed class_extends type ids + $class_extends_ids = $db->loadColumn(); + // Remove Class_extends from the content type table + $class_extends_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_extends') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($class_extends_condition); + $db->setQuery($query); + // Execute the query to remove Class_extends items + $class_extends_done = $db->execute(); + if ($class_extends_done) + { + // If succesfully remove Class_extends add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.class_extends) type alias was removed from the #__content_type table')); + } + + // Remove Class_extends items from the contentitem tag map table + $class_extends_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.class_extends') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($class_extends_condition); + $db->setQuery($query); + // Execute the query to remove Class_extends items + $class_extends_done = $db->execute(); + if ($class_extends_done) + { + // If succesfully remove Class_extends add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.class_extends) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Class_extends items from the ucm content table + $class_extends_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.class_extends') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($class_extends_condition); + $db->setQuery($query); + // Execute the query to remove Class_extends items + $class_extends_done = $db->execute(); + if ($class_extends_done) + { + // If succesfully remove Class_extends add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.class_extends) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Class_extends items are cleared from DB + foreach ($class_extends_ids as $class_extends_id) + { + // Remove Class_extends items from the ucm base table + $class_extends_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_extends_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($class_extends_condition); + $db->setQuery($query); + // Execute the query to remove Class_extends items + $db->execute(); + + // Remove Class_extends items from the ucm history table + $class_extends_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $class_extends_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($class_extends_condition); + $db->setQuery($query); + // Execute the query to remove Class_extends items + $db->execute(); + } + } + + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Joomla_plugin_group alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin_group') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $joomla_plugin_group_found = $db->getNumRows(); + // Now check if there were any rows + if ($joomla_plugin_group_found) + { + // Since there are load the needed joomla_plugin_group type ids + $joomla_plugin_group_ids = $db->loadColumn(); + // Remove Joomla_plugin_group from the content type table + $joomla_plugin_group_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin_group') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($joomla_plugin_group_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_group items + $joomla_plugin_group_done = $db->execute(); + if ($joomla_plugin_group_done) + { + // If succesfully remove Joomla_plugin_group add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_group) type alias was removed from the #__content_type table')); + } + + // Remove Joomla_plugin_group items from the contentitem tag map table + $joomla_plugin_group_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin_group') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($joomla_plugin_group_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_group items + $joomla_plugin_group_done = $db->execute(); + if ($joomla_plugin_group_done) + { + // If succesfully remove Joomla_plugin_group add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_group) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Joomla_plugin_group items from the ucm content table + $joomla_plugin_group_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.joomla_plugin_group') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($joomla_plugin_group_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_group items + $joomla_plugin_group_done = $db->execute(); + if ($joomla_plugin_group_done) + { + // If succesfully remove Joomla_plugin_group add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_group) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Joomla_plugin_group items are cleared from DB + foreach ($joomla_plugin_group_ids as $joomla_plugin_group_id) + { + // Remove Joomla_plugin_group items from the ucm base table + $joomla_plugin_group_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_group_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($joomla_plugin_group_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_group items + $db->execute(); + + // Remove Joomla_plugin_group items from the ucm history table + $joomla_plugin_group_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_group_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($joomla_plugin_group_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_group items + $db->execute(); + } + } + + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Joomla_plugin_updates alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin_updates') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $joomla_plugin_updates_found = $db->getNumRows(); + // Now check if there were any rows + if ($joomla_plugin_updates_found) + { + // Since there are load the needed joomla_plugin_updates type ids + $joomla_plugin_updates_ids = $db->loadColumn(); + // Remove Joomla_plugin_updates from the content type table + $joomla_plugin_updates_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin_updates') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($joomla_plugin_updates_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_updates items + $joomla_plugin_updates_done = $db->execute(); + if ($joomla_plugin_updates_done) + { + // If succesfully remove Joomla_plugin_updates add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_updates) type alias was removed from the #__content_type table')); + } + + // Remove Joomla_plugin_updates items from the contentitem tag map table + $joomla_plugin_updates_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin_updates') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($joomla_plugin_updates_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_updates items + $joomla_plugin_updates_done = $db->execute(); + if ($joomla_plugin_updates_done) + { + // If succesfully remove Joomla_plugin_updates add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_updates) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Joomla_plugin_updates items from the ucm content table + $joomla_plugin_updates_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.joomla_plugin_updates') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($joomla_plugin_updates_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_updates items + $joomla_plugin_updates_done = $db->execute(); + if ($joomla_plugin_updates_done) + { + // If succesfully remove Joomla_plugin_updates add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_updates) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Joomla_plugin_updates items are cleared from DB + foreach ($joomla_plugin_updates_ids as $joomla_plugin_updates_id) + { + // Remove Joomla_plugin_updates items from the ucm base table + $joomla_plugin_updates_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_updates_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($joomla_plugin_updates_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_updates items + $db->execute(); + + // Remove Joomla_plugin_updates items from the ucm history table + $joomla_plugin_updates_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_updates_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($joomla_plugin_updates_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_updates items + $db->execute(); + } + } + + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Joomla_plugin_files_folders_urls alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin_files_folders_urls') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $joomla_plugin_files_folders_urls_found = $db->getNumRows(); + // Now check if there were any rows + if ($joomla_plugin_files_folders_urls_found) + { + // Since there are load the needed joomla_plugin_files_folders_urls type ids + $joomla_plugin_files_folders_urls_ids = $db->loadColumn(); + // Remove Joomla_plugin_files_folders_urls from the content type table + $joomla_plugin_files_folders_urls_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin_files_folders_urls') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($joomla_plugin_files_folders_urls_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_files_folders_urls items + $joomla_plugin_files_folders_urls_done = $db->execute(); + if ($joomla_plugin_files_folders_urls_done) + { + // If succesfully remove Joomla_plugin_files_folders_urls add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_files_folders_urls) type alias was removed from the #__content_type table')); + } + + // Remove Joomla_plugin_files_folders_urls items from the contentitem tag map table + $joomla_plugin_files_folders_urls_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_componentbuilder.joomla_plugin_files_folders_urls') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($joomla_plugin_files_folders_urls_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_files_folders_urls items + $joomla_plugin_files_folders_urls_done = $db->execute(); + if ($joomla_plugin_files_folders_urls_done) + { + // If succesfully remove Joomla_plugin_files_folders_urls add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_files_folders_urls) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Joomla_plugin_files_folders_urls items from the ucm content table + $joomla_plugin_files_folders_urls_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_componentbuilder.joomla_plugin_files_folders_urls') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($joomla_plugin_files_folders_urls_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_files_folders_urls items + $joomla_plugin_files_folders_urls_done = $db->execute(); + if ($joomla_plugin_files_folders_urls_done) + { + // If succesfully remove Joomla_plugin_files_folders_urls add queued success message. + $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_files_folders_urls) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Joomla_plugin_files_folders_urls items are cleared from DB + foreach ($joomla_plugin_files_folders_urls_ids as $joomla_plugin_files_folders_urls_id) + { + // Remove Joomla_plugin_files_folders_urls items from the ucm base table + $joomla_plugin_files_folders_urls_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_files_folders_urls_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($joomla_plugin_files_folders_urls_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_files_folders_urls items + $db->execute(); + + // Remove Joomla_plugin_files_folders_urls items from the ucm history table + $joomla_plugin_files_folders_urls_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $joomla_plugin_files_folders_urls_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($joomla_plugin_files_folders_urls_condition); + $db->setQuery($query); + // Execute the query to remove Joomla_plugin_files_folders_urls items + $db->execute(); + } + } + // If All related items was removed queued success message. $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_base table')); $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_history table')); @@ -3236,8 +3930,8 @@ class com_componentbuilderInstallerScript $query->delete($db->quoteName('#__assets')); $query->where($componentbuilder_condition); $db->setQuery($query); - $library_files_folders_urls_done = $db->execute(); - if ($library_files_folders_urls_done) + $joomla_plugin_files_folders_urls_done = $db->execute(); + if ($joomla_plugin_files_folders_urls_done) { // If succesfully remove componentbuilder add queued success message. $app->enqueueMessage(JText::_('All related items was removed from the #__assets table')); @@ -3252,38 +3946,40 @@ class com_componentbuilderInstallerScript } /** - * method to update the component + * Called on update * - * @return void + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function update($parent) - { - - } + public function update(JAdapterInstance $parent){} /** - * method to run before an install/update/uninstall method + * Called before any type of action * - * @return void + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function preflight($type, $parent) + public function preflight($type, JAdapterInstance $parent) { // get application $app = JFactory::getApplication(); - // is redundant ...hmmm - if ($type == 'uninstall') + // is redundant or so it seems ...hmmm let me know if it works again + if ($type === 'uninstall') { return true; } // the default for both install and update $jversion = new JVersion(); - if (!$jversion->isCompatible('3.6.0')) + if (!$jversion->isCompatible('3.8.0')) { - $app->enqueueMessage('Please upgrade to at least Joomla! 3.6.0 before continuing!', 'error'); + $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); return false; } // do any updates needed - if ($type == 'update') + if ($type === 'update') { // load the helper class JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'); @@ -3652,24 +4348,28 @@ class com_componentbuilderInstallerScript } } // do any install needed - if ($type == 'install') + if ($type === 'install') { } + return true; } /** - * method to run after an install/update/uninstall method + * Called after any type of action * - * @return void + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function postflight($type, $parent) + public function postflight($type, JAdapterInstance $parent) { // get application $app = JFactory::getApplication(); // We check if we have dynamic folders to copy $this->setDynamicF0ld3rs($app, $parent); // set the default component settings - if ($type == 'install') + if ($type === 'install') { // Get The Database object @@ -3687,6 +4387,18 @@ class com_componentbuilderInstallerScript // Set the object into the content types table. $joomla_component_Inserted = $db->insertObject('#__content_types', $joomla_component); + // Create the joomla_plugin content type object. + $joomla_plugin = new stdClass(); + $joomla_plugin->type_title = 'Componentbuilder Joomla_plugin'; + $joomla_plugin->type_alias = 'com_componentbuilder.joomla_plugin'; + $joomla_plugin->table = '{"special": {"dbtable": "#__componentbuilder_joomla_plugin","key": "id","type": "Joomla_plugin","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $joomla_plugin->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_method_uninstall","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","class_extends":"class_extends","joomla_plugin_group":"joomla_plugin_group","sql":"sql","php_method_uninstall":"php_method_uninstall","php_postflight_update":"php_postflight_update","php_postflight_install":"php_postflight_install","description":"description","update_server_url":"update_server_url","head":"head","add_head":"add_head","sql_uninstall":"sql_uninstall","readme":"readme","main_class_code":"main_class_code","add_sales_server":"add_sales_server","not_required":"not_required","add_php_postflight_install":"add_php_postflight_install","plugin_version":"plugin_version","add_php_postflight_update":"add_php_postflight_update","add_php_method_uninstall":"add_php_method_uninstall","add_php_script_construct":"add_php_script_construct","add_sql":"add_sql","php_script_construct":"php_script_construct","add_sql_uninstall":"add_sql_uninstall","add_php_preflight_install":"add_php_preflight_install","addreadme":"addreadme","php_preflight_install":"php_preflight_install","add_update_server":"add_update_server","add_php_preflight_update":"add_php_preflight_update","update_server_target":"update_server_target","php_preflight_update":"php_preflight_update","add_php_preflight_uninstall":"add_php_preflight_uninstall","update_server":"update_server","php_preflight_uninstall":"php_preflight_uninstall","sales_server":"sales_server","name":"name"}}'; + $joomla_plugin->router = 'ComponentbuilderHelperRoute::getJoomla_pluginRoute'; + $joomla_plugin->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_plugin.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","class_extends","joomla_plugin_group","add_head","add_sales_server","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_php_script_construct","add_sql","add_sql_uninstall","add_php_preflight_install","addreadme","add_update_server","add_php_preflight_update","update_server_target","add_php_preflight_uninstall","update_server","sales_server"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "class_extends","targetTable": "#__componentbuilder_class_extends","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin_group","targetTable": "#__componentbuilder_joomla_plugin_group","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $joomla_plugin_Inserted = $db->insertObject('#__content_types', $joomla_plugin); + // Create the admin_view content type object. $admin_view = new stdClass(); $admin_view->type_title = 'Componentbuilder Admin_view'; @@ -3771,6 +4483,30 @@ class com_componentbuilderInstallerScript // Set the object into the content types table. $custom_code_Inserted = $db->insertObject('#__content_types', $custom_code); + // Create the class_property content type object. + $class_property = new stdClass(); + $class_property->type_title = 'Componentbuilder Class_property'; + $class_property->type_alias = 'com_componentbuilder.class_property'; + $class_property->table = '{"special": {"dbtable": "#__componentbuilder_class_property","key": "id","type": "Class_property","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $class_property->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","visibility":"visibility","extension_type":"extension_type","comment":"comment","joomla_plugin_group":"joomla_plugin_group","default":"default"}}'; + $class_property->router = 'ComponentbuilderHelperRoute::getClass_propertyRoute'; + $class_property->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/class_property.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_plugin_group"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin_group","targetTable": "#__componentbuilder_joomla_plugin_group","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $class_property_Inserted = $db->insertObject('#__content_types', $class_property); + + // Create the class_method content type object. + $class_method = new stdClass(); + $class_method->type_title = 'Componentbuilder Class_method'; + $class_method->type_alias = 'com_componentbuilder.class_method'; + $class_method->table = '{"special": {"dbtable": "#__componentbuilder_class_method","key": "id","type": "Class_method","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $class_method->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "code","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","visibility":"visibility","extension_type":"extension_type","code":"code","comment":"comment","joomla_plugin_group":"joomla_plugin_group","arguments":"arguments"}}'; + $class_method->router = 'ComponentbuilderHelperRoute::getClass_methodRoute'; + $class_method->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/class_method.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_plugin_group"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin_group","targetTable": "#__componentbuilder_joomla_plugin_group","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $class_method_Inserted = $db->insertObject('#__content_types', $class_method); + // Create the placeholder content type object. $placeholder = new stdClass(); $placeholder->type_title = 'Componentbuilder Placeholder'; @@ -4083,6 +4819,18 @@ class com_componentbuilderInstallerScript // Set the object into the content types table. $component_placeholders_Inserted = $db->insertObject('#__content_types', $component_placeholders); + // Create the component_plugins content type object. + $component_plugins = new stdClass(); + $component_plugins->type_title = 'Componentbuilder Component_plugins'; + $component_plugins->type_alias = 'com_componentbuilder.component_plugins'; + $component_plugins->table = '{"special": {"dbtable": "#__componentbuilder_component_plugins","key": "id","type": "Component_plugins","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $component_plugins->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "joomla_component","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"joomla_component":"joomla_component"}}'; + $component_plugins->router = 'ComponentbuilderHelperRoute::getComponent_pluginsRoute'; + $component_plugins->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/component_plugins.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_component"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_component","targetTable": "#__componentbuilder_joomla_component","targetColumn": "id","displayColumn": "system_name"}]}'; + + // Set the object into the content types table. + $component_plugins_Inserted = $db->insertObject('#__content_types', $component_plugins); + // Create the snippet_type content type object. $snippet_type = new stdClass(); $snippet_type->type_title = 'Componentbuilder Snippet_type'; @@ -4119,12 +4867,60 @@ class com_componentbuilderInstallerScript // Set the object into the content types table. $library_files_folders_urls_Inserted = $db->insertObject('#__content_types', $library_files_folders_urls); + // Create the class_extends content type object. + $class_extends = new stdClass(); + $class_extends->type_title = 'Componentbuilder Class_extends'; + $class_extends->type_alias = 'com_componentbuilder.class_extends'; + $class_extends->table = '{"special": {"dbtable": "#__componentbuilder_class_extends","key": "id","type": "Class_extends","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $class_extends->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "head","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","extension_type":"extension_type","head":"head","comment":"comment"}}'; + $class_extends->router = 'ComponentbuilderHelperRoute::getClass_extendsRoute'; + $class_extends->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/class_extends.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $class_extends_Inserted = $db->insertObject('#__content_types', $class_extends); + + // Create the joomla_plugin_group content type object. + $joomla_plugin_group = new stdClass(); + $joomla_plugin_group->type_title = 'Componentbuilder Joomla_plugin_group'; + $joomla_plugin_group->type_alias = 'com_componentbuilder.joomla_plugin_group'; + $joomla_plugin_group->table = '{"special": {"dbtable": "#__componentbuilder_joomla_plugin_group","key": "id","type": "Joomla_plugin_group","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $joomla_plugin_group->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","class_extends":"class_extends"}}'; + $joomla_plugin_group->router = 'ComponentbuilderHelperRoute::getJoomla_plugin_groupRoute'; + $joomla_plugin_group->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_plugin_group.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","class_extends"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "class_extends","targetTable": "#__componentbuilder_class_extends","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $joomla_plugin_group_Inserted = $db->insertObject('#__content_types', $joomla_plugin_group); + + // Create the joomla_plugin_updates content type object. + $joomla_plugin_updates = new stdClass(); + $joomla_plugin_updates->type_title = 'Componentbuilder Joomla_plugin_updates'; + $joomla_plugin_updates->type_alias = 'com_componentbuilder.joomla_plugin_updates'; + $joomla_plugin_updates->table = '{"special": {"dbtable": "#__componentbuilder_joomla_plugin_updates","key": "id","type": "Joomla_plugin_updates","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $joomla_plugin_updates->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "joomla_plugin","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"joomla_plugin":"joomla_plugin"}}'; + $joomla_plugin_updates->router = 'ComponentbuilderHelperRoute::getJoomla_plugin_updatesRoute'; + $joomla_plugin_updates->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_plugin_updates.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_plugin"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin","targetTable": "#__componentbuilder_joomla_plugin","targetColumn": "id","displayColumn": "system_name"}]}'; + + // Set the object into the content types table. + $joomla_plugin_updates_Inserted = $db->insertObject('#__content_types', $joomla_plugin_updates); + + // Create the joomla_plugin_files_folders_urls content type object. + $joomla_plugin_files_folders_urls = new stdClass(); + $joomla_plugin_files_folders_urls->type_title = 'Componentbuilder Joomla_plugin_files_folders_urls'; + $joomla_plugin_files_folders_urls->type_alias = 'com_componentbuilder.joomla_plugin_files_folders_urls'; + $joomla_plugin_files_folders_urls->table = '{"special": {"dbtable": "#__componentbuilder_joomla_plugin_files_folders_urls","key": "id","type": "Joomla_plugin_files_folders_urls","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $joomla_plugin_files_folders_urls->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "joomla_plugin","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"joomla_plugin":"joomla_plugin"}}'; + $joomla_plugin_files_folders_urls->router = 'ComponentbuilderHelperRoute::getJoomla_plugin_files_folders_urlsRoute'; + $joomla_plugin_files_folders_urls->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_plugin_files_folders_urls.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_plugin"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin","targetTable": "#__componentbuilder_joomla_plugin","targetColumn": "id","displayColumn": "system_name"}]}'; + + // Set the object into the content types table. + $joomla_plugin_files_folders_urls_Inserted = $db->insertObject('#__content_types', $joomla_plugin_files_folders_urls); + // Install the global extenstion params. $query = $db->getQuery(true); // Field to update. $fields = array( - $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","editor":"none","manage_jcb_package_directories":"2","add_menu_prefix":"1","menu_prefix":"»","minify":"0","set_browser_storage":"1","storage_time_to_live":"global","language":"en-GB","percentagelanguageadd":"50","compiler_field_builder_type":"2","field_name_builder":"1","development_method":"1","expansion":"0","return_options_build":"2","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","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","uikit_load":"1","uikit_min":"","uikit_style":""}'), + $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","editor":"none","manage_jcb_package_directories":"2","add_menu_prefix":"1","menu_prefix":"»","minify":"0","set_browser_storage":"1","storage_time_to_live":"global","language":"en-GB","percentagelanguageadd":"50","compiler_field_builder_type":"2","field_name_builder":"1","type_name_builder":"1","development_method":"1","expansion":"0","return_options_build":"2","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","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","uikit_load":"1","uikit_min":"","uikit_style":""}'), ); // Condition. $conditions = array( @@ -4139,7 +4935,7 @@ class com_componentbuilderInstallerScript '; } // do any updates needed - if ($type == 'update') + if ($type === 'update') { // Get The Database object @@ -4174,6 +4970,35 @@ class com_componentbuilderInstallerScript $joomla_component_Inserted = $db->insertObject('#__content_types', $joomla_component); } + // Create the joomla_plugin content type object. + $joomla_plugin = new stdClass(); + $joomla_plugin->type_title = 'Componentbuilder Joomla_plugin'; + $joomla_plugin->type_alias = 'com_componentbuilder.joomla_plugin'; + $joomla_plugin->table = '{"special": {"dbtable": "#__componentbuilder_joomla_plugin","key": "id","type": "Joomla_plugin","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $joomla_plugin->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_method_uninstall","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","class_extends":"class_extends","joomla_plugin_group":"joomla_plugin_group","sql":"sql","php_method_uninstall":"php_method_uninstall","php_postflight_update":"php_postflight_update","php_postflight_install":"php_postflight_install","description":"description","update_server_url":"update_server_url","head":"head","add_head":"add_head","sql_uninstall":"sql_uninstall","readme":"readme","main_class_code":"main_class_code","add_sales_server":"add_sales_server","not_required":"not_required","add_php_postflight_install":"add_php_postflight_install","plugin_version":"plugin_version","add_php_postflight_update":"add_php_postflight_update","add_php_method_uninstall":"add_php_method_uninstall","add_php_script_construct":"add_php_script_construct","add_sql":"add_sql","php_script_construct":"php_script_construct","add_sql_uninstall":"add_sql_uninstall","add_php_preflight_install":"add_php_preflight_install","addreadme":"addreadme","php_preflight_install":"php_preflight_install","add_update_server":"add_update_server","add_php_preflight_update":"add_php_preflight_update","update_server_target":"update_server_target","php_preflight_update":"php_preflight_update","add_php_preflight_uninstall":"add_php_preflight_uninstall","update_server":"update_server","php_preflight_uninstall":"php_preflight_uninstall","sales_server":"sales_server","name":"name"}}'; + $joomla_plugin->router = 'ComponentbuilderHelperRoute::getJoomla_pluginRoute'; + $joomla_plugin->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_plugin.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","class_extends","joomla_plugin_group","add_head","add_sales_server","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_php_script_construct","add_sql","add_sql_uninstall","add_php_preflight_install","addreadme","add_update_server","add_php_preflight_update","update_server_target","add_php_preflight_uninstall","update_server","sales_server"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "class_extends","targetTable": "#__componentbuilder_class_extends","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin_group","targetTable": "#__componentbuilder_joomla_plugin_group","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if joomla_plugin type is already in content_type DB. + $joomla_plugin_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($joomla_plugin->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $joomla_plugin->type_id = $db->loadResult(); + $joomla_plugin_Updated = $db->updateObject('#__content_types', $joomla_plugin, 'type_id'); + } + else + { + $joomla_plugin_Inserted = $db->insertObject('#__content_types', $joomla_plugin); + } + // Create the admin_view content type object. $admin_view = new stdClass(); $admin_view->type_title = 'Componentbuilder Admin_view'; @@ -4377,6 +5202,64 @@ class com_componentbuilderInstallerScript $custom_code_Inserted = $db->insertObject('#__content_types', $custom_code); } + // Create the class_property content type object. + $class_property = new stdClass(); + $class_property->type_title = 'Componentbuilder Class_property'; + $class_property->type_alias = 'com_componentbuilder.class_property'; + $class_property->table = '{"special": {"dbtable": "#__componentbuilder_class_property","key": "id","type": "Class_property","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $class_property->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","visibility":"visibility","extension_type":"extension_type","comment":"comment","joomla_plugin_group":"joomla_plugin_group","default":"default"}}'; + $class_property->router = 'ComponentbuilderHelperRoute::getClass_propertyRoute'; + $class_property->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/class_property.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_plugin_group"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin_group","targetTable": "#__componentbuilder_joomla_plugin_group","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if class_property type is already in content_type DB. + $class_property_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($class_property->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $class_property->type_id = $db->loadResult(); + $class_property_Updated = $db->updateObject('#__content_types', $class_property, 'type_id'); + } + else + { + $class_property_Inserted = $db->insertObject('#__content_types', $class_property); + } + + // Create the class_method content type object. + $class_method = new stdClass(); + $class_method->type_title = 'Componentbuilder Class_method'; + $class_method->type_alias = 'com_componentbuilder.class_method'; + $class_method->table = '{"special": {"dbtable": "#__componentbuilder_class_method","key": "id","type": "Class_method","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $class_method->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "code","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","visibility":"visibility","extension_type":"extension_type","code":"code","comment":"comment","joomla_plugin_group":"joomla_plugin_group","arguments":"arguments"}}'; + $class_method->router = 'ComponentbuilderHelperRoute::getClass_methodRoute'; + $class_method->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/class_method.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_plugin_group"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin_group","targetTable": "#__componentbuilder_joomla_plugin_group","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if class_method type is already in content_type DB. + $class_method_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($class_method->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $class_method->type_id = $db->loadResult(); + $class_method_Updated = $db->updateObject('#__content_types', $class_method, 'type_id'); + } + else + { + $class_method_Inserted = $db->insertObject('#__content_types', $class_method); + } + // Create the placeholder content type object. $placeholder = new stdClass(); $placeholder->type_title = 'Componentbuilder Placeholder'; @@ -5131,6 +6014,35 @@ class com_componentbuilderInstallerScript $component_placeholders_Inserted = $db->insertObject('#__content_types', $component_placeholders); } + // Create the component_plugins content type object. + $component_plugins = new stdClass(); + $component_plugins->type_title = 'Componentbuilder Component_plugins'; + $component_plugins->type_alias = 'com_componentbuilder.component_plugins'; + $component_plugins->table = '{"special": {"dbtable": "#__componentbuilder_component_plugins","key": "id","type": "Component_plugins","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $component_plugins->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "joomla_component","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"joomla_component":"joomla_component"}}'; + $component_plugins->router = 'ComponentbuilderHelperRoute::getComponent_pluginsRoute'; + $component_plugins->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/component_plugins.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_component"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_component","targetTable": "#__componentbuilder_joomla_component","targetColumn": "id","displayColumn": "system_name"}]}'; + + // Check if component_plugins type is already in content_type DB. + $component_plugins_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($component_plugins->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $component_plugins->type_id = $db->loadResult(); + $component_plugins_Updated = $db->updateObject('#__content_types', $component_plugins, 'type_id'); + } + else + { + $component_plugins_Inserted = $db->insertObject('#__content_types', $component_plugins); + } + // Create the snippet_type content type object. $snippet_type = new stdClass(); $snippet_type->type_title = 'Componentbuilder Snippet_type'; @@ -5218,6 +6130,122 @@ class com_componentbuilderInstallerScript $library_files_folders_urls_Inserted = $db->insertObject('#__content_types', $library_files_folders_urls); } + // Create the class_extends content type object. + $class_extends = new stdClass(); + $class_extends->type_title = 'Componentbuilder Class_extends'; + $class_extends->type_alias = 'com_componentbuilder.class_extends'; + $class_extends->table = '{"special": {"dbtable": "#__componentbuilder_class_extends","key": "id","type": "Class_extends","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $class_extends->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "head","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","extension_type":"extension_type","head":"head","comment":"comment"}}'; + $class_extends->router = 'ComponentbuilderHelperRoute::getClass_extendsRoute'; + $class_extends->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/class_extends.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if class_extends type is already in content_type DB. + $class_extends_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($class_extends->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $class_extends->type_id = $db->loadResult(); + $class_extends_Updated = $db->updateObject('#__content_types', $class_extends, 'type_id'); + } + else + { + $class_extends_Inserted = $db->insertObject('#__content_types', $class_extends); + } + + // Create the joomla_plugin_group content type object. + $joomla_plugin_group = new stdClass(); + $joomla_plugin_group->type_title = 'Componentbuilder Joomla_plugin_group'; + $joomla_plugin_group->type_alias = 'com_componentbuilder.joomla_plugin_group'; + $joomla_plugin_group->table = '{"special": {"dbtable": "#__componentbuilder_joomla_plugin_group","key": "id","type": "Joomla_plugin_group","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $joomla_plugin_group->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","class_extends":"class_extends"}}'; + $joomla_plugin_group->router = 'ComponentbuilderHelperRoute::getJoomla_plugin_groupRoute'; + $joomla_plugin_group->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_plugin_group.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","class_extends"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "class_extends","targetTable": "#__componentbuilder_class_extends","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if joomla_plugin_group type is already in content_type DB. + $joomla_plugin_group_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($joomla_plugin_group->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $joomla_plugin_group->type_id = $db->loadResult(); + $joomla_plugin_group_Updated = $db->updateObject('#__content_types', $joomla_plugin_group, 'type_id'); + } + else + { + $joomla_plugin_group_Inserted = $db->insertObject('#__content_types', $joomla_plugin_group); + } + + // Create the joomla_plugin_updates content type object. + $joomla_plugin_updates = new stdClass(); + $joomla_plugin_updates->type_title = 'Componentbuilder Joomla_plugin_updates'; + $joomla_plugin_updates->type_alias = 'com_componentbuilder.joomla_plugin_updates'; + $joomla_plugin_updates->table = '{"special": {"dbtable": "#__componentbuilder_joomla_plugin_updates","key": "id","type": "Joomla_plugin_updates","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $joomla_plugin_updates->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "joomla_plugin","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"joomla_plugin":"joomla_plugin"}}'; + $joomla_plugin_updates->router = 'ComponentbuilderHelperRoute::getJoomla_plugin_updatesRoute'; + $joomla_plugin_updates->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_plugin_updates.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_plugin"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin","targetTable": "#__componentbuilder_joomla_plugin","targetColumn": "id","displayColumn": "system_name"}]}'; + + // Check if joomla_plugin_updates type is already in content_type DB. + $joomla_plugin_updates_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($joomla_plugin_updates->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $joomla_plugin_updates->type_id = $db->loadResult(); + $joomla_plugin_updates_Updated = $db->updateObject('#__content_types', $joomla_plugin_updates, 'type_id'); + } + else + { + $joomla_plugin_updates_Inserted = $db->insertObject('#__content_types', $joomla_plugin_updates); + } + + // Create the joomla_plugin_files_folders_urls content type object. + $joomla_plugin_files_folders_urls = new stdClass(); + $joomla_plugin_files_folders_urls->type_title = 'Componentbuilder Joomla_plugin_files_folders_urls'; + $joomla_plugin_files_folders_urls->type_alias = 'com_componentbuilder.joomla_plugin_files_folders_urls'; + $joomla_plugin_files_folders_urls->table = '{"special": {"dbtable": "#__componentbuilder_joomla_plugin_files_folders_urls","key": "id","type": "Joomla_plugin_files_folders_urls","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $joomla_plugin_files_folders_urls->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "joomla_plugin","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"joomla_plugin":"joomla_plugin"}}'; + $joomla_plugin_files_folders_urls->router = 'ComponentbuilderHelperRoute::getJoomla_plugin_files_folders_urlsRoute'; + $joomla_plugin_files_folders_urls->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_plugin_files_folders_urls.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","joomla_plugin"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "joomla_plugin","targetTable": "#__componentbuilder_joomla_plugin","targetColumn": "id","displayColumn": "system_name"}]}'; + + // Check if joomla_plugin_files_folders_urls type is already in content_type DB. + $joomla_plugin_files_folders_urls_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($joomla_plugin_files_folders_urls->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $joomla_plugin_files_folders_urls->type_id = $db->loadResult(); + $joomla_plugin_files_folders_urls_Updated = $db->updateObject('#__content_types', $joomla_plugin_files_folders_urls, 'type_id'); + } + else + { + $joomla_plugin_files_folders_urls_Inserted = $db->insertObject('#__content_types', $joomla_plugin_files_folders_urls); + } + // target version less then 2.6.5 @@ -5426,8 +6454,9 @@ class com_componentbuilderInstallerScript echo ' -

    Upgrade to Version 2.9.21 Was Successful! Let us know if anything is not working as expected.

    '; +

    Upgrade to Version 2.10.0 Was Successful! Let us know if anything is not working as expected.

    '; } + return true; } /** @@ -5444,7 +6473,7 @@ class com_componentbuilderInstallerScript $folders = JFolder::folders($installPath); // check if we have folders we may want to copy $doNotCopy = array('media','admin','site'); // Joomla already deals with these - if (count($folders) > 1) + if (count((array) $folders) > 1) { foreach ($folders as $folder) { diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 2b4801c52..99f6666b1 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -70,6 +70,12 @@ abstract class ComponentbuilderHelper public static $jcbGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Community-Packages/git/trees/master"; public static $jcbGithubPackageUrl = "https://github.com/vdm-io/JCB-Community-Packages/raw/master/"; + /** + * The bolerplate paths + **/ + public static $bolerplatePath = 'https://raw.githubusercontent.com/vdm-io/boilerplate/jcb/'; + public static $bolerplateAPI = 'https://api.github.com/repos/vdm-io/boilerplate/git/trees/jcb'; + // not needed at this time (maybe latter) public static $accessToken = ""; @@ -124,6 +130,510 @@ abstract class ComponentbuilderHelper 'JPATH_THEMES' => JPATH_THEMES ); + /** + * get the class method or property + * + * @input int The method/property ID + * @input string The target type + * + * @returns string on success + **/ + public static function getClassCode($id, $type) + { + if ('property' === $type || 'method' === $type) + { + // Get a db connection. + $db = JFactory::getDbo(); + // Get user object + $user = JFactory::getUser(); + // Create a new query object. + $query = $db->getQuery(true); + // get method + if ('method' === $type) + { + $query->select($db->quoteName(array('a.comment','a.name','a.visibility','a.arguments','a.code'))); + } + // get property + elseif ('property' === $type) + { + $query->select($db->quoteName(array('a.comment','a.name','a.visibility','a.default'))); + } + $query->from($db->quoteName('#__componentbuilder_class_' . $type,'a')); + $query->where($db->quoteName('a.id') . ' = ' . (int) $id); + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $columns = $db->getTableColumns('#__componentbuilder_class_' . $type); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // get the code + $code = $db->loadObject(); + // combine method values + $combinded = array(); + // add comment if set + if (self::checkString($code->comment)) + { + $comment = array_map('trim', (array) explode(PHP_EOL, base64_decode($code->comment))); + $combinded[] = "\t" . implode(PHP_EOL . "\t ", $comment); + } + // build method + if ('method' === $type) + { + // set the method signature + if (self::checkString($code->arguments)) + { + $combinded[] = "\t" . $code->visibility . ' function ' . $code->name . '(' . base64_decode($code->arguments) . ')'; + } + else + { + $combinded[] = "\t" . $code->visibility . ' function ' . $code->name . '()'; + } + // set the method code + $combinded[] = "\t" . "{"; + // add code if set + if (self::checkString(trim($code->code))) + { + $combinded[] = base64_decode($code->code); + } + else + { + $combinded[] = "\t\t// add your code here"; + } + $combinded[] = "\t" . "}"; + } + else + { + if (self::checkString($code->default)) + { + $code->default = base64_decode($code->default); + if (is_int($code->default)) + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = ' . (int) $code->default . ';'; + } + elseif (is_float($code->default)) + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = ' . (float) $code->default . ';'; + } + elseif (('false' === $code->default || 'true' === $code->default) + || (self::checkString($code->default) && (strpos($code->default, 'array(') !== false || strpos($code->default, '"') !== false))) + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = ' . $code->default . ';'; + } + elseif (self::checkString($code->default) && strpos($code->default, '"') === false) + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = "' . $code->default . '";'; + } + else + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ';'; + } + } + else + { + // set the class property + $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ';'; + } + } + // return the code + return implode(PHP_EOL, $combinded); + } + } + return false; + } + + /** + * extract Boilerplate Class Extends + * + * @input string The class as a string + * @input string The type of class/extension + * + * @returns string on success + **/ + public static function extractBoilerplateClassExtends(&$class, $type) + { + if (($strings = self::getAllBetween($class, 'class ', '}')) !== false && self::checkArray($strings)) + { + foreach ($strings as $string) + { + if (($extends = self::getBetween($string, 'extends ', '{')) !== false && self::checkString($extends)) + { + return trim($extends); + } + } + } + return false; + } + + /** + * extract Boilerplate Class Header + * + * @input string The class as a string + * @input string The class being extended + * @input string The type of class/extension + * + * @returns string on success + **/ + public static function extractBoilerplateClassHeader(&$class, $extends, $type) + { + if (($string = self::getBetween($class, "defined('_JEXEC')", 'extends ' . $extends)) !== false && self::checkString($string)) + { + $headArray = explode(PHP_EOL, $string); + if (self::checkArray($headArray) && count($headArray) > 3) + { + // remove first since it still has the [or die;] string in it + array_shift($headArray); + // remove the last since it has the class declaration + array_pop($headArray); + // at this point we have the class comment still in as part of the header, lets remove that + $last = count($headArray); + while ($last > 0) + { + $last--; + if (isset($headArray[$last]) && strpos($headArray[$last], '*') !== false) + { + unset($headArray[$last]); + } + else + { + // moment the comment stops, we break out + $last = 0; + } + } + // make sure we only return if we have values + if (self::checkArray($headArray)) + { + return implode(PHP_EOL, $headArray); + } + } + } + return false; + } + + /** + * extract Boilerplate Class Comment + * + * @input string The class as a string + * @input string The class being extended + * @input string The type of class/extension + * + * @returns string on success + **/ + public static function extractBoilerplateClassComment(&$class, $extends, $type) + { + if (($string = self::getBetween($class, "defined('_JEXEC')", 'extends ' . $extends)) !== false && self::checkString($string)) + { + $headArray = explode(PHP_EOL, $string); + if (self::checkArray($headArray) && count($headArray) > 3) + { + $comment = array(); + // remove the last since it has the class declaration + array_pop($headArray); + // at this point we have the class comment still in as part of the header, lets remove that + $last = count($headArray); + while ($last > 0) + { + $last--; + if (isset($headArray[$last]) && strpos($headArray[$last], '*') !== false) + { + $comment[$last] = $headArray[$last]; + } + else + { + // moment the comment stops, we break out + $last = 0; + } + } + // make sure we only return if we have values + if (self::checkArray($comment)) + { + // set the correct order + ksort($comment); + return implode(PHP_EOL, $comment); + } + } + } + return false; + } + + /** + * extract Boilerplate Class Properties & Methods + * + * @input string The class as a string + * @input string The class being extended + * @input string The type of class/extension + * @input int The plugin groups + * + * @returns string on success + **/ + public static function extractBoilerplateClassPropertiesMethods(&$class, $extends, $type, $plugin_group = null) + { + $bucket = array('property' => array(), 'method' => array()); + // get the class code, and remove the head + $codeArrayTmp = explode('extends ' . $extends, $class); + // make sure we have the correct result + if (self::checkArray($codeArrayTmp) && count($codeArrayTmp) == 2) + { + // the triggers + $triggers = array('public' => 1, 'protected' => 2, 'private' => 3); + $codeArray = explode(PHP_EOL, $codeArrayTmp[1]); + unset($codeArrayTmp); + // clean the code + self::cleanBoilerplateCode($codeArray); + // temp bucket + $name = null; + $arg = null; + $target = null; + $visibility = null; + $tmp = array(); + $comment = array(); + // load method + $loadCode = function (&$bucket, &$target, &$name, &$arg, &$visibility, &$tmp, &$comment) use($type, $plugin_group){ + $_tmp = array( + 'name' => $name, + 'visibility' => $visibility, + 'extension_type' => $type + ); + // build filter + $filters = array('extension_type' => $type); + // add more data based on target + if ('method' === $target && self::checkArray($tmp)) + { + // clean the code + self::cleanBoilerplateCode($tmp); + // only load if there are values + if (self::checkArray($tmp, true)) + { + $_tmp['code'] = implode(PHP_EOL, $tmp); + } + else + { + $_tmp['code'] = ''; + } + // load arguments only if set + if (self::checkString($arg)) + { + $_tmp['arguments'] = $arg; + } + } + elseif ('property' === $target) + { + // load default only if set + if (self::checkString($arg)) + { + $_tmp['default'] = $arg; + } + } + // load comment only if set + if (self::checkArray($comment, true)) + { + $_tmp['comment'] = implode(PHP_EOL, $comment); + } + // load the group target + if ($plugin_group) + { + $_tmp['joomla_plugin_group'] = $plugin_group; + $filters['joomla_plugin_group'] = $plugin_group; + } + // load the local values + if (($locals = self::getLocalBoilerplate($name, $target, $type, $filters)) !== false) + { + foreach ($locals as $key => $value) + { + $_tmp[$key] = $value; + } + } + else + { + $_tmp['id'] = 0; + $_tmp['published'] = 1; + $_tmp['version'] = 1; + } + // store the data based on target + $bucket[$target][] = $_tmp; + }; + // now we start loading + foreach($codeArray as $line) + { + if ($visibility && $target && $name && strpos($line, '/**') !== false) + { + $loadCode($bucket, $target, $name, $arg, $visibility, $tmp, $comment); + // reset loop buckets + $name = null; + $arg = null; + $target = null; + $visibility = null; + $tmp = array(); + $comment = array(); + } + // load the comment before method/property + if (!$visibility && !$target && !$name && strpos($line, '*') !== false) + { + $comment[] = rtrim($line); + } + else + { + if (!$visibility && !$target && !$name) + { + // get the line values + $lineArray = array_values(array_map('trim', preg_split('/\s+/', trim($line)))); + // check if we are at the main line + if (isset($lineArray[0]) && isset($triggers[$lineArray[0]])) + { + $visibility = $lineArray[0]; + if (strpos($line, 'function') !== false) + { + $target = 'method'; + // get the name + $name = trim(self::getBetween($line, 'function ', '(')); + // get the arguments + $arg = trim(self::getBetween($line, ' ' . $name . '(', ')')); + } + else + { + $target = 'property'; + if (strpos($line, '=') !== false) + { + // get the name + $name = trim(self::getBetween($line, '$', '=')); + // get the default + $arg = trim(self::getBetween($line, '=', ';')); + } + else + { + // get the name + $name = trim(self::getBetween($line, '$', ';')); + } + } + } + } + else + { + $tmp[] = rtrim($line); + } + } + } + // check if a last method is still around + if ($visibility && $target && $name) + { + $loadCode($bucket, $target, $name, $arg, $visibility, $tmp, $comment); + // reset loop buckets + $name = null; + $arg = null; + $target = null; + $visibility = null; + $tmp = array(); + $comment = array(); + } + return $bucket; + } + return false; + } + + protected static function getLocalBoilerplate($name, $table, $extension_type, $filters = array()) + { + if ('property' === $table || 'method' === $table) + { + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + // get method + $query->select($db->quoteName(array('a.id','a.published','a.version'))); + $query->from($db->quoteName('#__componentbuilder_class_' . $table,'a')); + $query->where($db->quoteName('a.name') . ' = ' . $db->quote($name)); + $query->where($db->quoteName('a.extension_type') . ' = ' . $db->quote($extension_type)); + // add more filters + if (self::checkArray($filters)) + { + foreach($filters as $where => $value) + { + if (is_numeric($value)) + { + $query->where($db->quoteName('a.' . $where) . ' = ' . $value); + } + else + { + $query->where($db->quoteName('a.' . $where) . ' = ' . $db->quote($value)); + } + } + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // get the code + return $db->loadAssoc(); + } + } + return false; + } + + protected static function cleanBoilerplateCode(&$code) + { + // remove the first lines until a { is found + $key = 0; + $found = false; + while (!$found) + { + if (isset($code[$key])) + { + if (strpos($code[$key], '{') !== false) + { + unset($code[$key]); + // only remove the first } found + $found = true; + } + // remove empty lines + elseif (!self::checkString(trim($code[$key]))) + { + unset($code[$key]); + } + } + // check next line + $key++; + // stop loop at line 30 (really this should never happen) + if ($key > 30) + { + $found = true; + } + } + // reset all keys + $code = array_values($code); + // remove last lines until } + $last = count($code); + while ($last > 0) + { + $last--; + if (isset($code[$last])) + { + if (strpos($code[$last], '}') !== false) + { + unset($code[$last]); + // only remove the first } found + $last = 0; + } + // remove empty lines + elseif (!self::checkString(trim($code[$last]))) + { + unset($code[$last]); + } + } + } + } + /** * Making class or function name safe * @@ -139,7 +649,7 @@ abstract class ComponentbuilderHelper $name = self::replaceNumbers($name); } // remove all spaces and strange characters - return trim(reg_replace("/[^A-Za-z0-9]/", '', $name)); + return trim(preg_replace("/[^A-Za-z0-9_-]/", '', $name)); } /** @@ -202,6 +712,48 @@ abstract class ComponentbuilderHelper return self::safeString($string); } + /** + * The type builder switch + **/ + protected static $typeNameBuilder = false; + + /** + * Making field type name safe + * + * @input string The you would like to make safe + * + * @returns string on success + **/ + public static function safeTypeName($string) + { + // get global value + if (self::$typeNameBuilder === false) + { + self::$typeNameBuilder = JComponentHelper::getParams('com_componentbuilder')->get('type_name_builder', 1); + } + // use the new convention + if (2 == self::$typeNameBuilder) + { + // 0nly continue if we have a string + if (self::checkString($string)) + { + // check that the first character is not a number + if (is_numeric(substr($string, 0, 1))) + { + $string = self::replaceNumbers($string); + } + // remove all and keep only characters and numbers and point (TODO just one point) + $string = trim(preg_replace("/[^A-Za-z0-9\.]/", '', $string)); + // best is to return lower (for all string equality in compiler) + return strtolower($string); + } + // not a string + return ''; + } + // use the default (original behaviour/convention) + return self::safeString($string); + } + /* * Get the Array of Existing Validation Rule Names * @@ -529,7 +1081,7 @@ abstract class ComponentbuilderHelper * @return void * */ - public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less')) + public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true) { if (JFolder::exists($folder)) { @@ -537,11 +1089,25 @@ abstract class ComponentbuilderHelper $joomla = getcwd(); // we are changing the working directory to the componet path chdir($folder); - // get the files - foreach ($fileTypes as $type) + // make sure we have file type filter + if (self::checkArray($fileTypes)) + { + // get the files + foreach ($fileTypes as $type) + { + // get a list of files in the current directory tree + $files[] = JFolder::files('.', $type, $recurse, $full); + } + } + elseif (self::checkString($fileTypes)) { // get a list of files in the current directory tree - $files[] = JFolder::files('.', $type, true, true); + $files[] = JFolder::files('.', $fileTypes, $recurse, $full); + } + else + { + // get a list of files in the current directory tree + $files[] = JFolder::files('.', '.', $recurse, $full); } // change back to Joomla working directory chdir($joomla); @@ -2698,13 +3264,13 @@ abstract class ComponentbuilderHelper ), 'option' => array( 'accesslevel', 'category', 'checkboxes', 'combo', 'contentlanguage', 'databaseconnection', // 'components', (TODO) must be added but still in use as a custom field in JCB - 'filelist', 'folderlist', 'imagelist', 'list', 'plugins', 'predefinedlist', 'radio', 'sessionhandler', 'sql' + 'filelist', 'folderlist', 'imagelist', 'list', 'plugins', 'predefinedlist', 'radio', 'sessionhandler', 'sql', 'groupedlist' ), 'text' => array( 'calendar', 'color', 'editor', 'email', 'number', 'password', 'range', 'tel', 'text', 'textarea', 'url' ), 'list' => array( - 'checkbox', 'checkboxes', 'list', 'radio' + 'checkbox', 'checkboxes', 'list', 'radio', 'groupedlist' ), 'dynamic' => array( 'category', 'file', 'filelist', 'folderlist', 'headertag', 'imagelist', 'integer', 'media', 'meter', 'rules', 'tag', 'timezone', 'user' @@ -2713,7 +3279,7 @@ abstract class ComponentbuilderHelper 'note', 'spacer' ), 'special' => array( - 'contentlanguage', 'groupedlist', 'moduleposition', 'plugin', 'repeatable', 'subform', 'templatestyle' + 'contentlanguage', 'moduleposition', 'plugin', 'repeatable', 'subform', 'templatestyle' ) );