From b7a5cb72854eec138d35e8be3b050e28c7f2256d Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sat, 29 Dec 2018 16:56:06 +0200 Subject: [PATCH] fixed issue that caused some custom code not to export for a JCB packages if found in anther custom code area. Made some corrections to the router helper class. Added return_here value admin views to improve the return values in url redirection. Improved the open valid base64 method to make use of default string. Update many ajax calls to not use jsonp, and infact be more secure. --- README.md | 4 +- admin/README.txt | 4 +- admin/compiler/joomla_3/JViewLegacy_list.php | 2 + admin/compiler/joomla_3/routeHelper.php | 23 +++++++--- admin/helpers/compiler/e_Interpretation.php | 8 ++-- admin/helpers/componentbuilder.php | 10 ++++- admin/models/forms/admin_view.js | 42 +++++++++---------- admin/models/forms/custom_admin_view.js | 12 +++--- admin/models/forms/dynamic_get.js | 24 +++++------ admin/models/forms/field.js | 30 ++++++------- admin/models/forms/joomla_component.js | 21 +++++----- admin/models/forms/language_translation.js | 6 +-- admin/models/forms/layout.js | 6 +-- admin/models/forms/library.js | 30 ++++++------- admin/models/forms/site_view.js | 12 +++--- admin/models/forms/template.js | 6 +-- admin/models/joomla_components.php | 13 ++++++ admin/views/admin_views/view.html.php | 2 + admin/views/admins_custom_tabs/view.html.php | 2 + admin/views/admins_fields/view.html.php | 2 + .../admins_fields_conditions/view.html.php | 2 + .../admins_fields_relations/view.html.php | 2 + .../components_admin_views/view.html.php | 2 + admin/views/components_config/view.html.php | 2 + .../view.html.php | 2 + .../view.html.php | 2 + .../views/components_dashboard/view.html.php | 2 + .../components_files_folders/view.html.php | 2 + .../components_mysql_tweaks/view.html.php | 2 + .../views/components_site_views/view.html.php | 2 + admin/views/components_updates/view.html.php | 2 + .../custom_admin_views/tmpl/default_body.php | 2 +- admin/views/custom_admin_views/view.html.php | 2 + admin/views/custom_codes/view.html.php | 2 + admin/views/dynamic_gets/view.html.php | 2 + admin/views/fields/tmpl/default_body.php | 2 +- admin/views/fields/view.html.php | 2 + admin/views/fieldtypes/view.html.php | 2 + admin/views/help_documents/view.html.php | 2 + admin/views/joomla_components/view.html.php | 2 + .../views/language_translations/view.html.php | 2 + admin/views/languages/view.html.php | 2 + admin/views/layouts/tmpl/default_body.php | 2 +- admin/views/layouts/view.html.php | 2 + admin/views/libraries/view.html.php | 2 + admin/views/libraries_config/view.html.php | 2 + .../view.html.php | 2 + admin/views/servers/view.html.php | 2 + admin/views/site_views/tmpl/default_body.php | 2 +- admin/views/site_views/view.html.php | 2 + admin/views/snippet_types/view.html.php | 2 + admin/views/snippets/tmpl/default_body.php | 2 +- admin/views/snippets/view.html.php | 2 + admin/views/templates/tmpl/default_body.php | 2 +- admin/views/templates/view.html.php | 2 + admin/views/validation_rules/view.html.php | 2 + componentbuilder.xml | 2 +- site/helpers/componentbuilder.php | 10 ++++- site/helpers/route.php | 29 +++++++++---- 59 files changed, 245 insertions(+), 127 deletions(-) diff --git a/README.md b/README.md index ce15e3cd0..f7b5416f2 100644 --- a/README.md +++ b/README.md @@ -144,11 +144,11 @@ 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*: 19th December, 2018 ++ *Last Build*: 29th December, 2018 + *Version*: 2.9.8 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **195562** ++ *Line count*: **195665** + *Field count*: **1087** + *File count*: **1275** + *Folder count*: **201** diff --git a/admin/README.txt b/admin/README.txt index ce15e3cd0..f7b5416f2 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -144,11 +144,11 @@ 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*: 19th December, 2018 ++ *Last Build*: 29th December, 2018 + *Version*: 2.9.8 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **195562** ++ *Line count*: **195665** + *Field count*: **1087** + *File count*: **1275** + *Folder count*: **201** diff --git a/admin/compiler/joomla_3/JViewLegacy_list.php b/admin/compiler/joomla_3/JViewLegacy_list.php index 60179e2b1..da24aba75 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list.php +++ b/admin/compiler/joomla_3/JViewLegacy_list.php @@ -42,6 +42,8 @@ class ###Component###View###Views### extends JViewLegacy $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 = ###Component###Helper::getActions('###view###');###JVIEWLISTCANDO### diff --git a/admin/compiler/joomla_3/routeHelper.php b/admin/compiler/joomla_3/routeHelper.php index 3486c4562..6b482a4a4 100644 --- a/admin/compiler/joomla_3/routeHelper.php +++ b/admin/compiler/joomla_3/routeHelper.php @@ -108,8 +108,8 @@ abstract class ###Component###HelperRoute } } return $link; - } - + } + protected static function _findItem($needles = null,$type = null) { $app = JFactory::getApplication(); @@ -157,6 +157,10 @@ abstract class ###Component###HelperRoute self::$lookup[$language][$view][$item->query['id']] = $item->id; } } + else + { + self::$lookup[$language][$view][0] = $item->id; + } } } } @@ -167,17 +171,24 @@ abstract class ###Component###HelperRoute { if (isset(self::$lookup[$language][$view])) { - foreach ($ids as $id) + if (###Component###Helper::checkArray($ids)) { - if (isset(self::$lookup[$language][$view][(int) $id])) + foreach ($ids as $id) { - return self::$lookup[$language][$view][(int) $id]; + if (isset(self::$lookup[$language][$view][(int) $id])) + { + return self::$lookup[$language][$view][(int) $id]; + } } } + elseif (isset(self::$lookup[$language][$view][0])) + { + return self::$lookup[$language][$view][0]; + } } } } - + if ($type) { // Check if the global menu item has been set. diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 53191cb53..9f1557b95 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -5270,8 +5270,10 @@ class Interpretation extends Fields $routeHelper[] = $this->_t(2) . "else"; $routeHelper[] = $this->_t(2) . "{"; $routeHelper[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Initialize the needel array."; - $routeHelper[] = $this->_t(3) . "\$needles = array();"; - $routeHelper[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . "Create the link but don't add the id."; + $routeHelper[] = $this->_t(3) . "\$needles = array("; + $routeHelper[] = $this->_t(4) . "'" . $viewName_single . "' => array()"; + $routeHelper[] = $this->_t(3) . ");"; + $routeHelper[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Create the link but don't add the id."; $routeHelper[] = $this->_t(3) . "\$link = 'index.php?option=com_" . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . "&view=" . $viewName_single . "';"; $routeHelper[] = $this->_t(2) . "}"; if ('category' != $viewName_single && 'categories' != $viewName_single) @@ -7110,7 +7112,7 @@ class Interpretation extends Fields $referal = ''; if (!$ref) { - $ref = '&ref=' . $viewName_list; + $ref = '&return=return_here; ?>'; } // in linked tab/view so must add ref to default else diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 06ada1302..ff73ecd9b 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -2356,11 +2356,12 @@ abstract class ComponentbuilderHelper * * @param string $data The base64 string * @param string $key We store the string with that suffix :) + * @param string $default The default switch * * @return string The opened string * */ - public static function openValidBase64($data, $key = '__.o0=base64=Oo.__') + public static function openValidBase64($data, $key = '__.o0=base64=Oo.__', $default = 'string') { // check that we have a string if (self::checkString($data)) @@ -2379,7 +2380,12 @@ abstract class ComponentbuilderHelper return base64_decode($data); } } - return $data; + // check if we should just return the string + if ('string' === $default) + { + return $data; + } + return $default; } diff --git a/admin/models/forms/admin_view.js b/admin/models/forms/admin_view.js index b453fd44f..28ec70746 100644 --- a/admin/models/forms/admin_view.js +++ b/admin/models/forms/admin_view.js @@ -1330,16 +1330,16 @@ function checkAliasField() { } function checkAliasField_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.checkAliasField&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -1354,16 +1354,16 @@ function getAjaxDisplay(type){ } function getAjaxDisplay_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -1372,16 +1372,16 @@ function addData(result,where){ } function addButtonID_server(type, size){ - var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&vdm="+vastDevMod); + 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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function addButtonID(type, where, size){ @@ -1397,16 +1397,16 @@ function addButtonID(type, where, size){ } function addButton_server(type, size){ - var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); + 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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function addButton(type, where, size){ @@ -1424,16 +1424,16 @@ function addButton(type, where, size){ } function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -1446,16 +1446,16 @@ function getLinked(){ } function getTableColumns_server(tableName){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.tableColumns&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -1477,16 +1477,16 @@ function getTableColumns(fieldKey, table_, nr_){ } function getDynamicScripts_server(typpe){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getDynamicScripts&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } diff --git a/admin/models/forms/custom_admin_view.js b/admin/models/forms/custom_admin_view.js index ce6dcc754..c37d18352 100644 --- a/admin/models/forms/custom_admin_view.js +++ b/admin/models/forms/custom_admin_view.js @@ -443,16 +443,16 @@ jQuery(document).ready(function() }); function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -610,16 +610,16 @@ jQuery(document).ready(function($) }); function getSnippets_server(libraries){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&format=json"; + 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); } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function getSnippets(){ diff --git a/admin/models/forms/dynamic_get.js b/admin/models/forms/dynamic_get.js index ec837ff82..af8576f38 100644 --- a/admin/models/forms/dynamic_get.js +++ b/admin/models/forms/dynamic_get.js @@ -1485,16 +1485,16 @@ jQuery(document).ready(function() }); function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -1508,7 +1508,7 @@ function getLinked(){ function getViewTableColumns_server(viewId,asKey,rowType) { - var getUrl = "index.php?option=com_componentbuilder&task=ajax.viewTableColumns&format=json"; + var getUrl = "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; @@ -1516,9 +1516,9 @@ function getViewTableColumns_server(viewId,asKey,rowType) return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -1538,7 +1538,7 @@ 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"; + var getUrl = "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; @@ -1546,9 +1546,9 @@ function getDbTableColumns_server(name,asKey,rowType) return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -1628,16 +1628,16 @@ function updateSubItems(fieldName, fieldNr, table_, nr_){ } function getDynamicScripts_server(typpe){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getDynamicScripts&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } diff --git a/admin/models/forms/field.js b/admin/models/forms/field.js index 52e117a76..d51251d8d 100644 --- a/admin/models/forms/field.js +++ b/admin/models/forms/field.js @@ -522,16 +522,16 @@ jQuery(document).ready(function() }); function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -544,16 +544,16 @@ function getLinked(){ } function addButton_server(type, size){ - var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); + 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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function addButton(type, where, size){ @@ -574,16 +574,16 @@ function addButton(type, where, size){ var rowIdKey = 'properties'; function getFieldOptions_server(fieldtype){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldOptions&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -734,31 +734,31 @@ function propertyIsSet(prop, id, targetForm) { } function getFieldPropertyDesc_server(fieldtype, property){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getFieldPropertyDesc&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function getValidationRulesTable_server(){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getValidationRulesTable&format=json&vdm="+vastDevMod; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.getValidationRulesTable&format=json&raw=true&vdm="+vastDevMod; if(token.length > 0){ var request = 'token='+token+'&id=1'; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } diff --git a/admin/models/forms/joomla_component.js b/admin/models/forms/joomla_component.js index 0533e104c..b3891eebd 100644 --- a/admin/models/forms/joomla_component.js +++ b/admin/models/forms/joomla_component.js @@ -979,16 +979,16 @@ function getAjaxDisplay(type){ } function getAjaxDisplay_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -1012,16 +1012,16 @@ function dasboardSwitch(value){ function addButtonID_server(type, size){ - var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&vdm="+vastDevMod); + 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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function addButtonID(type, where, size){ @@ -1037,16 +1037,16 @@ function addButtonID(type, where, size){ } function addButton_server(type, size){ - var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); + 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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function addButton(type, where, size){ @@ -1061,5 +1061,4 @@ function addButton(type, where, size){ } } }) -} - +} diff --git a/admin/models/forms/language_translation.js b/admin/models/forms/language_translation.js index d3a185301..d4af173bb 100644 --- a/admin/models/forms/language_translation.js +++ b/admin/models/forms/language_translation.js @@ -21,16 +21,16 @@ function addData(result,where){ } function addButton_server(type, size){ - var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); + 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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function addButton(type, where, size){ diff --git a/admin/models/forms/layout.js b/admin/models/forms/layout.js index f9960a44b..2eaa9007f 100644 --- a/admin/models/forms/layout.js +++ b/admin/models/forms/layout.js @@ -208,16 +208,16 @@ jQuery(document).ready(function($) }); function getSnippets_server(libraries){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&format=json"; + 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); } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function getSnippets(){ diff --git a/admin/models/forms/library.js b/admin/models/forms/library.js index d4c51b0d8..6fd79de90 100644 --- a/admin/models/forms/library.js +++ b/admin/models/forms/library.js @@ -417,16 +417,16 @@ function addData(result,where){ } function addButtonID_server(type, size){ - var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&vdm="+vastDevMod); + 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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function addButtonID(type, where, size){ @@ -442,16 +442,16 @@ function addButtonID(type, where, size){ } function addButton_server(type, size){ - var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); + 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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function addButton(type, where, size){ @@ -469,16 +469,16 @@ function addButton(type, where, size){ } function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -501,30 +501,30 @@ function getAjaxDisplay(type){ } function getAjaxDisplay_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function getFieldSelectOptions_server(fieldId){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json"; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json&raw=true"; if (token.length > 0 && fieldId > 0) { var request = 'token='+token+'&id='+fieldId; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } diff --git a/admin/models/forms/site_view.js b/admin/models/forms/site_view.js index 5e1be20e4..19e1c804b 100644 --- a/admin/models/forms/site_view.js +++ b/admin/models/forms/site_view.js @@ -484,16 +484,16 @@ jQuery(document).ready(function() }); function getLinked_server(type){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&vdm="+vastDevMod; + var getUrl = "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; } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } @@ -651,16 +651,16 @@ jQuery(document).ready(function($) }); function getSnippets_server(libraries){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&format=json"; + 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); } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function getSnippets(){ diff --git a/admin/models/forms/template.js b/admin/models/forms/template.js index f37cc830d..0960a91b2 100644 --- a/admin/models/forms/template.js +++ b/admin/models/forms/template.js @@ -234,16 +234,16 @@ jQuery(document).ready(function($) }); function getSnippets_server(libraries){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&format=json"; + 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); } return jQuery.ajax({ type: 'GET', url: getUrl, - dataType: 'jsonp', + dataType: 'json', data: request, - jsonp: 'callback' + jsonp: false }); } function getSnippets(){ diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index 545020345..25ad6b568 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -350,6 +350,15 @@ class ComponentbuilderModelJoomla_components extends JModelList { $this->setData('custom_code', array_values($this->smartIDs['custom_code']), 'id'); } + // set limiter + $limit = 0; + // and add those custom codes found in custom codes + while (isset($this->smartIDs['custom_code']) && ComponentbuilderHelper::checkArray($this->smartIDs['custom_code']) && $limit < 100) + { + $this->setData('custom_code', array_values($this->smartIDs['custom_code']), 'id'); + // make sure we break + $limit++; // just in case (should not be needed) + } } } @@ -604,6 +613,10 @@ class ComponentbuilderModelJoomla_components extends JModelList { $this->smartIDs['layout'] = array(); } + elseif ('custom_code' === $table && 'id' === $key) + { + $this->smartIDs['custom_code'] = array(); + } // start loading the data if (!isset($this->smartBox[$table])) { diff --git a/admin/views/admin_views/view.html.php b/admin/views/admin_views/view.html.php index bb500e454..efad7cf3d 100644 --- a/admin/views/admin_views/view.html.php +++ b/admin/views/admin_views/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewAdmin_views extends JViewLegacy $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('admin_view'); $this->canEdit = $this->canDo->get('admin_view.edit'); diff --git a/admin/views/admins_custom_tabs/view.html.php b/admin/views/admins_custom_tabs/view.html.php index 6a22de723..a07b50237 100644 --- a/admin/views/admins_custom_tabs/view.html.php +++ b/admin/views/admins_custom_tabs/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewAdmins_custom_tabs extends JViewLegacy $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('admin_custom_tabs'); $this->canEdit = $this->canDo->get('admin_custom_tabs.edit'); diff --git a/admin/views/admins_fields/view.html.php b/admin/views/admins_fields/view.html.php index 46a24546a..f9fd5cc73 100644 --- a/admin/views/admins_fields/view.html.php +++ b/admin/views/admins_fields/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewAdmins_fields extends JViewLegacy $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('admin_fields'); $this->canEdit = $this->canDo->get('admin_fields.edit'); diff --git a/admin/views/admins_fields_conditions/view.html.php b/admin/views/admins_fields_conditions/view.html.php index 3ba6c77cd..b2b4f632b 100644 --- a/admin/views/admins_fields_conditions/view.html.php +++ b/admin/views/admins_fields_conditions/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewAdmins_fields_conditions extends JViewLegacy $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('admin_fields_conditions'); $this->canEdit = $this->canDo->get('admin_fields_conditions.edit'); diff --git a/admin/views/admins_fields_relations/view.html.php b/admin/views/admins_fields_relations/view.html.php index 3a4e5da48..b54d57e7a 100644 --- a/admin/views/admins_fields_relations/view.html.php +++ b/admin/views/admins_fields_relations/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewAdmins_fields_relations extends JViewLegacy $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('admin_fields_relations'); $this->canEdit = $this->canDo->get('admin_fields_relations.edit'); diff --git a/admin/views/components_admin_views/view.html.php b/admin/views/components_admin_views/view.html.php index a91cc2086..9e9477937 100644 --- a/admin/views/components_admin_views/view.html.php +++ b/admin/views/components_admin_views/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewComponents_admin_views extends JViewLegacy $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_admin_views'); $this->canEdit = $this->canDo->get('component_admin_views.edit'); diff --git a/admin/views/components_config/view.html.php b/admin/views/components_config/view.html.php index 3846d7e06..6e519e923 100644 --- a/admin/views/components_config/view.html.php +++ b/admin/views/components_config/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewComponents_config extends JViewLegacy $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_config'); $this->canEdit = $this->canDo->get('component_config.edit'); diff --git a/admin/views/components_custom_admin_menus/view.html.php b/admin/views/components_custom_admin_menus/view.html.php index e7cb80d38..cfdd2a8ea 100644 --- a/admin/views/components_custom_admin_menus/view.html.php +++ b/admin/views/components_custom_admin_menus/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewComponents_custom_admin_menus extends JViewLegacy $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_custom_admin_menus'); $this->canEdit = $this->canDo->get('component_custom_admin_menus.edit'); diff --git a/admin/views/components_custom_admin_views/view.html.php b/admin/views/components_custom_admin_views/view.html.php index 5f79b2937..0186d31cf 100644 --- a/admin/views/components_custom_admin_views/view.html.php +++ b/admin/views/components_custom_admin_views/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewComponents_custom_admin_views extends JViewLegacy $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_custom_admin_views'); $this->canEdit = $this->canDo->get('component_custom_admin_views.edit'); diff --git a/admin/views/components_dashboard/view.html.php b/admin/views/components_dashboard/view.html.php index 63a51144f..8ed19d296 100644 --- a/admin/views/components_dashboard/view.html.php +++ b/admin/views/components_dashboard/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewComponents_dashboard extends JViewLegacy $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_dashboard'); $this->canEdit = $this->canDo->get('component_dashboard.edit'); diff --git a/admin/views/components_files_folders/view.html.php b/admin/views/components_files_folders/view.html.php index e7dde81a0..970d8c04f 100644 --- a/admin/views/components_files_folders/view.html.php +++ b/admin/views/components_files_folders/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewComponents_files_folders extends JViewLegacy $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_files_folders'); $this->canEdit = $this->canDo->get('component_files_folders.edit'); diff --git a/admin/views/components_mysql_tweaks/view.html.php b/admin/views/components_mysql_tweaks/view.html.php index 431679930..727a483ed 100644 --- a/admin/views/components_mysql_tweaks/view.html.php +++ b/admin/views/components_mysql_tweaks/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewComponents_mysql_tweaks extends JViewLegacy $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_mysql_tweaks'); $this->canEdit = $this->canDo->get('component_mysql_tweaks.edit'); diff --git a/admin/views/components_site_views/view.html.php b/admin/views/components_site_views/view.html.php index 60aedb446..af6e20779 100644 --- a/admin/views/components_site_views/view.html.php +++ b/admin/views/components_site_views/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewComponents_site_views extends JViewLegacy $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_site_views'); $this->canEdit = $this->canDo->get('component_site_views.edit'); diff --git a/admin/views/components_updates/view.html.php b/admin/views/components_updates/view.html.php index 8b27644d0..6935273cf 100644 --- a/admin/views/components_updates/view.html.php +++ b/admin/views/components_updates/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewComponents_updates extends JViewLegacy $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_updates'); $this->canEdit = $this->canDo->get('component_updates.edit'); diff --git a/admin/views/custom_admin_views/tmpl/default_body.php b/admin/views/custom_admin_views/tmpl/default_body.php index 2fdf1de94..01f572b0e 100644 --- a/admin/views/custom_admin_views/tmpl/default_body.php +++ b/admin/views/custom_admin_views/tmpl/default_body.php @@ -97,7 +97,7 @@ $edit = "index.php?option=com_componentbuilder&view=custom_admin_views&task=cust
user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int)$item->main_get)): ?> - escape($item->main_get_name); ?> + escape($item->main_get_name); ?> escape($item->main_get_name); ?> diff --git a/admin/views/custom_admin_views/view.html.php b/admin/views/custom_admin_views/view.html.php index 59a4b2528..2d52e65ff 100644 --- a/admin/views/custom_admin_views/view.html.php +++ b/admin/views/custom_admin_views/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewCustom_admin_views extends JViewLegacy $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('custom_admin_view'); $this->canEdit = $this->canDo->get('core.edit'); diff --git a/admin/views/custom_codes/view.html.php b/admin/views/custom_codes/view.html.php index 51942c6d2..a22d9b703 100644 --- a/admin/views/custom_codes/view.html.php +++ b/admin/views/custom_codes/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewCustom_codes extends JViewLegacy $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('custom_code'); $this->canEdit = $this->canDo->get('custom_code.edit'); diff --git a/admin/views/dynamic_gets/view.html.php b/admin/views/dynamic_gets/view.html.php index 77161c9b8..1aa632b31 100644 --- a/admin/views/dynamic_gets/view.html.php +++ b/admin/views/dynamic_gets/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewDynamic_gets extends JViewLegacy $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('dynamic_get'); $this->canEdit = $this->canDo->get('dynamic_get.edit'); diff --git a/admin/views/fields/tmpl/default_body.php b/admin/views/fields/tmpl/default_body.php index 845379c85..d4bfe2f12 100644 --- a/admin/views/fields/tmpl/default_body.php +++ b/admin/views/fields/tmpl/default_body.php @@ -75,7 +75,7 @@ $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit";
user->authorise('fieldtype.edit', 'com_componentbuilder.fieldtype.' . (int)$item->fieldtype)): ?> - escape($item->fieldtype_name); ?> + escape($item->fieldtype_name); ?> escape($item->fieldtype_name); ?> diff --git a/admin/views/fields/view.html.php b/admin/views/fields/view.html.php index b54ad6590..40ed36e15 100644 --- a/admin/views/fields/view.html.php +++ b/admin/views/fields/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewFields extends JViewLegacy $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('field'); $this->canEdit = $this->canDo->get('field.edit'); diff --git a/admin/views/fieldtypes/view.html.php b/admin/views/fieldtypes/view.html.php index 1d1d476e3..a53ae05d9 100644 --- a/admin/views/fieldtypes/view.html.php +++ b/admin/views/fieldtypes/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy $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('fieldtype'); $this->canEdit = $this->canDo->get('fieldtype.edit'); diff --git a/admin/views/help_documents/view.html.php b/admin/views/help_documents/view.html.php index 4df4f1faa..46d680fba 100644 --- a/admin/views/help_documents/view.html.php +++ b/admin/views/help_documents/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewHelp_documents extends JViewLegacy $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('help_document'); $this->canEdit = $this->canDo->get('help_document.edit'); diff --git a/admin/views/joomla_components/view.html.php b/admin/views/joomla_components/view.html.php index 984a49fc5..19b86a81a 100644 --- a/admin/views/joomla_components/view.html.php +++ b/admin/views/joomla_components/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewJoomla_components extends JViewLegacy $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_component'); $this->canEdit = $this->canDo->get('joomla_component.edit'); diff --git a/admin/views/language_translations/view.html.php b/admin/views/language_translations/view.html.php index 5ff808802..d7bdbdc73 100644 --- a/admin/views/language_translations/view.html.php +++ b/admin/views/language_translations/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewLanguage_translations extends JViewLegacy $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('language_translation'); $this->canEdit = $this->canDo->get('language_translation.edit'); diff --git a/admin/views/languages/view.html.php b/admin/views/languages/view.html.php index 2308184e6..ae947fc83 100644 --- a/admin/views/languages/view.html.php +++ b/admin/views/languages/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewLanguages extends JViewLegacy $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('language'); $this->canEdit = $this->canDo->get('language.edit'); diff --git a/admin/views/layouts/tmpl/default_body.php b/admin/views/layouts/tmpl/default_body.php index 87d85d29c..942e79d72 100644 --- a/admin/views/layouts/tmpl/default_body.php +++ b/admin/views/layouts/tmpl/default_body.php @@ -85,7 +85,7 @@ $edit = "index.php?option=com_componentbuilder&view=layouts&task=layout.edit";
user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int)$item->dynamic_get)): ?> - escape($item->dynamic_get_name); ?> + escape($item->dynamic_get_name); ?> escape($item->dynamic_get_name); ?> diff --git a/admin/views/layouts/view.html.php b/admin/views/layouts/view.html.php index dc1b35e59..210a8735b 100644 --- a/admin/views/layouts/view.html.php +++ b/admin/views/layouts/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewLayouts extends JViewLegacy $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('layout'); $this->canEdit = $this->canDo->get('core.edit'); diff --git a/admin/views/libraries/view.html.php b/admin/views/libraries/view.html.php index 8160d4fdc..107adfc01 100644 --- a/admin/views/libraries/view.html.php +++ b/admin/views/libraries/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewLibraries extends JViewLegacy $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('library'); $this->canEdit = $this->canDo->get('library.edit'); diff --git a/admin/views/libraries_config/view.html.php b/admin/views/libraries_config/view.html.php index 697a21d5b..3c264ad17 100644 --- a/admin/views/libraries_config/view.html.php +++ b/admin/views/libraries_config/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewLibraries_config extends JViewLegacy $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('library_config'); $this->canEdit = $this->canDo->get('library_config.edit'); diff --git a/admin/views/libraries_files_folders_urls/view.html.php b/admin/views/libraries_files_folders_urls/view.html.php index 7404eb2a1..77d54dea0 100644 --- a/admin/views/libraries_files_folders_urls/view.html.php +++ b/admin/views/libraries_files_folders_urls/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewLibraries_files_folders_urls extends JViewLegacy $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('library_files_folders_urls'); $this->canEdit = $this->canDo->get('library_files_folders_urls.edit'); diff --git a/admin/views/servers/view.html.php b/admin/views/servers/view.html.php index bf3f9ac9e..76de3bd82 100644 --- a/admin/views/servers/view.html.php +++ b/admin/views/servers/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewServers extends JViewLegacy $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('server'); $this->canEdit = $this->canDo->get('server.edit'); diff --git a/admin/views/site_views/tmpl/default_body.php b/admin/views/site_views/tmpl/default_body.php index 596f2421b..c4e856675 100644 --- a/admin/views/site_views/tmpl/default_body.php +++ b/admin/views/site_views/tmpl/default_body.php @@ -97,7 +97,7 @@ $edit = "index.php?option=com_componentbuilder&view=site_views&task=site_view.ed
user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int)$item->main_get)): ?> - escape($item->main_get_name); ?> + escape($item->main_get_name); ?> escape($item->main_get_name); ?> diff --git a/admin/views/site_views/view.html.php b/admin/views/site_views/view.html.php index 23958faba..a34251fc6 100644 --- a/admin/views/site_views/view.html.php +++ b/admin/views/site_views/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewSite_views extends JViewLegacy $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('site_view'); $this->canEdit = $this->canDo->get('core.edit'); diff --git a/admin/views/snippet_types/view.html.php b/admin/views/snippet_types/view.html.php index 7dc9daf83..61fffeef9 100644 --- a/admin/views/snippet_types/view.html.php +++ b/admin/views/snippet_types/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewSnippet_types extends JViewLegacy $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('snippet_type'); $this->canEdit = $this->canDo->get('snippet_type.edit'); diff --git a/admin/views/snippets/tmpl/default_body.php b/admin/views/snippets/tmpl/default_body.php index 66fda6474..42b2528c7 100644 --- a/admin/views/snippets/tmpl/default_body.php +++ b/admin/views/snippets/tmpl/default_body.php @@ -84,7 +84,7 @@ $edit = "index.php?option=com_componentbuilder&view=snippets&task=snippet.edit";
user->authorise('library.edit', 'com_componentbuilder.library.' . (int)$item->library)): ?> - escape($item->library_name); ?> + escape($item->library_name); ?> escape($item->library_name); ?> diff --git a/admin/views/snippets/view.html.php b/admin/views/snippets/view.html.php index fdef0e64f..f2b39b45a 100644 --- a/admin/views/snippets/view.html.php +++ b/admin/views/snippets/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewSnippets extends JViewLegacy $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('snippet'); $this->canEdit = $this->canDo->get('core.edit'); diff --git a/admin/views/templates/tmpl/default_body.php b/admin/views/templates/tmpl/default_body.php index a8733d6d0..cfa103e77 100644 --- a/admin/views/templates/tmpl/default_body.php +++ b/admin/views/templates/tmpl/default_body.php @@ -85,7 +85,7 @@ $edit = "index.php?option=com_componentbuilder&view=templates&task=template.edit
user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int)$item->dynamic_get)): ?> - escape($item->dynamic_get_name); ?> + escape($item->dynamic_get_name); ?> escape($item->dynamic_get_name); ?> diff --git a/admin/views/templates/view.html.php b/admin/views/templates/view.html.php index 1d0af4138..95ecf0d9b 100644 --- a/admin/views/templates/view.html.php +++ b/admin/views/templates/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewTemplates extends JViewLegacy $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('template'); $this->canEdit = $this->canDo->get('core.edit'); diff --git a/admin/views/validation_rules/view.html.php b/admin/views/validation_rules/view.html.php index 450f9e482..3d7c82405 100644 --- a/admin/views/validation_rules/view.html.php +++ b/admin/views/validation_rules/view.html.php @@ -37,6 +37,8 @@ class ComponentbuilderViewValidation_rules extends JViewLegacy $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('validation_rule'); $this->canEdit = $this->canDo->get('validation_rule.edit'); diff --git a/componentbuilder.xml b/componentbuilder.xml index 596dee9a5..9edf53748 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 19th December, 2018 + 29th December, 2018 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 32f0b5417..e6bb2e682 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -2356,11 +2356,12 @@ abstract class ComponentbuilderHelper * * @param string $data The base64 string * @param string $key We store the string with that suffix :) + * @param string $default The default switch * * @return string The opened string * */ - public static function openValidBase64($data, $key = '__.o0=base64=Oo.__') + public static function openValidBase64($data, $key = '__.o0=base64=Oo.__', $default = 'string') { // check that we have a string if (self::checkString($data)) @@ -2379,7 +2380,12 @@ abstract class ComponentbuilderHelper return base64_decode($data); } } - return $data; + // check if we should just return the string + if ('string' === $default) + { + return $data; + } + return $default; } diff --git a/site/helpers/route.php b/site/helpers/route.php index 4abfe8f96..51b32bd5e 100644 --- a/site/helpers/route.php +++ b/site/helpers/route.php @@ -36,8 +36,10 @@ abstract class ComponentbuilderHelperRoute else { // Initialize the needel array. - $needles = array(); - //Create the link but don't add the id. + $needles = array( + 'api' => array() + ); + // Create the link but don't add the id. $link = 'index.php?option=com_componentbuilder&view=api'; } if ($catid > 1) @@ -146,8 +148,8 @@ abstract class ComponentbuilderHelperRoute } } return $link; - } - + } + protected static function _findItem($needles = null,$type = null) { $app = JFactory::getApplication(); @@ -195,6 +197,10 @@ abstract class ComponentbuilderHelperRoute self::$lookup[$language][$view][$item->query['id']] = $item->id; } } + else + { + self::$lookup[$language][$view][0] = $item->id; + } } } } @@ -205,17 +211,24 @@ abstract class ComponentbuilderHelperRoute { if (isset(self::$lookup[$language][$view])) { - foreach ($ids as $id) + if (ComponentbuilderHelper::checkArray($ids)) { - if (isset(self::$lookup[$language][$view][(int) $id])) + foreach ($ids as $id) { - return self::$lookup[$language][$view][(int) $id]; + if (isset(self::$lookup[$language][$view][(int) $id])) + { + return self::$lookup[$language][$view][(int) $id]; + } } } + elseif (isset(self::$lookup[$language][$view][0])) + { + return self::$lookup[$language][$view][0]; + } } } } - + if ($type) { // Check if the global menu item has been set.