From 8b4efd640f9e4326bfadfcaa629a607976ac1bfa Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Mon, 30 Apr 2018 14:06:05 +0200 Subject: [PATCH] Fixed the subform to allow encryption of values without data lose. --- README.md | 4 +- admin/README.txt | 4 +- admin/helpers/compiler/c_Fields.php | 27 ++++- admin/helpers/compiler/e_Interpretation.php | 120 ++++++++++---------- admin/helpers/componentbuilder.php | 17 +++ admin/models/admin_view.php | 112 +++++++++--------- admin/models/component_dashboard.php | 12 +- admin/models/custom_admin_view.php | 64 +++++------ admin/models/dynamic_get.php | 96 ++++++++-------- admin/models/field.php | 12 +- admin/models/forms/admin_view.xml | 3 +- admin/models/forms/custom_admin_view.xml | 3 +- admin/models/forms/site_view.xml | 3 +- admin/models/joomla_component.php | 16 +-- admin/models/layout.php | 16 +-- admin/models/library.php | 12 +- admin/models/site_view.php | 64 +++++------ admin/models/template.php | 16 +-- componentbuilder.xml | 2 +- site/helpers/componentbuilder.php | 17 +++ 20 files changed, 340 insertions(+), 280 deletions(-) diff --git a/README.md b/README.md index 77adf52c6..1a69e03c2 100644 --- a/README.md +++ b/README.md @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 27th April, 2018 ++ *Last Build*: 30th April, 2018 + *Version*: 2.7.6 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **193274** ++ *Line count*: **193305** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/README.txt b/admin/README.txt index 77adf52c6..1a69e03c2 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 27th April, 2018 ++ *Last Build*: 30th April, 2018 + *Version*: 2.7.6 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **193274** ++ *Line count*: **193305** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 2b80724fc..f0eb83aac 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -2013,7 +2013,18 @@ class Fields extends Structure // set the decoding methods if (in_array($set, $decode)) { - $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => $set, 'type' => $type); + if (isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]) && + isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'])) + { + if (!in_array($set, $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'])) + { + $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'][] = $set; + } + } + else + { + $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => array($set), 'type' => $type); + } } // set the uikit checker if ((2 == $this->uikit || 1 == $this->uikit) && in_array($type, $textareas)) @@ -2556,6 +2567,7 @@ class Fields extends Structure // setup checkboxes and other json items for this view if ($dbSwitch && (($typeName === 'subform' || $typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && $typeName != 'tag')) { + $subformJsonSwitch = true; switch ($field['settings']->store) { case 1: @@ -2593,6 +2605,8 @@ class Fields extends Structure $this->jsonItemBuilder[$view_name_single][] = $name; // Site settings of each field if needed $this->buildSiteFieldData($view_name_single, $name, 'json', $typeName); + // no londer add the json again (already added) + $subformJsonSwitch = false; break; } // just a heads-up for usergroups set to multiple @@ -2614,10 +2628,19 @@ class Fields extends Structure } } - // if subform the values must revert to array + // subform house keeping if ('subform' === $typeName) { + // the values must revert to array $this->jsonItemBuilderArray[$view_name_single][] = $name; + // should the json builder still be added + if ($subformJsonSwitch) + { + // and insure the if is converted to json + $this->jsonItemBuilder[$view_name_single][] = $name; + // Site settings of each field if needed + $this->buildSiteFieldData($view_name_single, $name, 'json', $typeName); + } } } // build the data for the export & import methods $typeName === 'repeatable' || diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 0776a654d..90dfc205b 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -1686,37 +1686,43 @@ class Interpretation extends Fields $fieldDecode = ''; foreach ($checker as $field => $array) { - if (strpos($get['selection']['select'], $field) !== false) + if (strpos($get['selection']['select'], $field) !== false && ComponentbuilderHelper::checkArray($array['decode'])) { - if ('json' === $array['decode']) + // insure it is unique + $array['decode'] = (array) array_unique(array_reverse((array) $array['decode'])); + // now loop the array + foreach ($array['decode'] as $decode) { - $if = PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(" . $string . "->" . $field . "))" . PHP_EOL . "\t" . $tab . "\t{"; - // json_decode - $decoder = $string . "->" . $field . " = json_decode(" . $string . "->" . $field . ", true);"; - } - elseif ('base64' === $array['decode']) - { - $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ")))" . PHP_EOL . "\t" . $tab . "\t{"; - // base64_decode - $decoder = $string . "->" . $field . " = base64_decode(" . $string . "->" . $field . ");"; - } - elseif (strpos($array['decode'], '_encryption') !== false) - { - foreach ($this->cryptionTypes as $cryptionType) + if ('json' === $decode) { - if ($cryptionType . '_encryption' === $array['decode']) + $if = PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(" . $string . "->" . $field . "))" . PHP_EOL . "\t" . $tab . "\t{"; + // json_decode + $decoder = $string . "->" . $field . " = json_decode(" . $string . "->" . $field . ", true);"; + } + elseif ('base64' === $decode) + { + $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ")))" . PHP_EOL . "\t" . $tab . "\t{"; + // base64_decode + $decoder = $string . "->" . $field . " = base64_decode(" . $string . "->" . $field . ");"; + } + elseif (strpos($decode, '_encryption') !== false) + { + foreach ($this->cryptionTypes as $cryptionType) { - $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$" . $cryptionType . "key && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; - // set decryption - $decoder = $string . "->" . $field . " = rtrim(\$" . $cryptionType . "->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; - $this->siteDecrypt[$cryptionType][$code] = true; + if ($cryptionType . '_encryption' === $decode) + { + $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$" . $cryptionType . "key && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; + // set decryption + $decoder = $string . "->" . $field . " = rtrim(\$" . $cryptionType . "->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; + $this->siteDecrypt[$cryptionType][$code] = true; + } } } - } - // build decoder string - $fieldDecode .= $if . PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Decode " . $field; - $fieldDecode .= PHP_EOL . "\t" . $tab . "\t\t" . $decoder . PHP_EOL . "\t" . $tab . "\t}"; + // build decoder string + $fieldDecode .= $if . PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Decode " . $field; + $fieldDecode .= PHP_EOL . "\t" . $tab . "\t\t" . $decoder . PHP_EOL . "\t" . $tab . "\t}"; + } } } return $fieldDecode; @@ -4246,6 +4252,39 @@ class Interpretation extends Fields public function setMethodGetItem(&$view) { $script = ''; + // get the component name + $Component = $this->fileContentStatic['###Component###']; + // go from base64 to string + if (isset($this->base64Builder[$view]) && ComponentbuilderHelper::checkArray($this->base64Builder[$view])) + { + foreach ($this->base64Builder[$view] as $baseString) + { + $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . "))"; // TODO && base64_encode(base64_decode(\$item->".$baseString.", true)) === \$item->".$baseString.")"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " base64 Decode " . $baseString . "."; + $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = base64_decode(\$item->" . $baseString . ");"; + $script .= PHP_EOL . "\t\t\t}"; + } + } + // decryption + foreach ($this->cryptionTypes as $cryptionType) + { + if (isset($this->{$cryptionType . 'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'EncryptionBuilder'}[$view])) + { + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption."; + $script .= PHP_EOL . "\t\t\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t\t\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);"; + foreach ($this->{$cryptionType . 'EncryptionBuilder'}[$view] as $baseString) + { + $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$" . $cryptionType . "key && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " " . $cryptionType . " decrypt data " . $baseString . "."; + $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$" . $cryptionType . "->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; + $script .= PHP_EOL . "\t\t\t}"; + } + } + } // go from json to array if (isset($this->jsonItemBuilder[$view]) && ComponentbuilderHelper::checkArray($this->jsonItemBuilder[$view])) { @@ -4281,39 +4320,6 @@ class Interpretation extends Fields $script .= PHP_EOL . "\t\t\t}"; } } - // go from base64 to string - if (isset($this->base64Builder[$view]) && ComponentbuilderHelper::checkArray($this->base64Builder[$view])) - { - foreach ($this->base64Builder[$view] as $baseString) - { - $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . "))"; // TODO && base64_encode(base64_decode(\$item->".$baseString.", true)) === \$item->".$baseString.")"; - $script .= PHP_EOL . "\t\t\t{"; - $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " base64 Decode " . $baseString . "."; - $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = base64_decode(\$item->" . $baseString . ");"; - $script .= PHP_EOL . "\t\t\t}"; - } - } - // get the component name - $Component = $this->fileContentStatic['###Component###']; - // decryption - foreach ($this->cryptionTypes as $cryptionType) - { - if (isset($this->{$cryptionType . 'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'EncryptionBuilder'}[$view])) - { - $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption."; - $script .= PHP_EOL . "\t\t\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');"; - $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);"; - foreach ($this->{$cryptionType . 'EncryptionBuilder'}[$view] as $baseString) - { - $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$" . $cryptionType . "key && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))"; - $script .= PHP_EOL . "\t\t\t{"; - $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " " . $cryptionType . " decrypt data " . $baseString . "."; - $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$" . $cryptionType . "->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; - $script .= PHP_EOL . "\t\t\t}"; - } - } - } // add custom php to getitem method $script .= $this->getCustomScriptBuilder('php_getitem', $view, PHP_EOL . PHP_EOL); diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 1825d5d0b..fac68f0dd 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -2650,6 +2650,23 @@ abstract class ComponentbuilderHelper */ protected static $curlErrorLoaded = false; + /** + * check if a worker has more work + * + * @param string $function The function to target to perform the task + * + * @return bool + * + */ + public static function hasWork(&$function) + { + if (isset(self::$worker[$function]) && self::checkArray(self::$worker[$function])) + { + return count( (array) self::$worker[$function]); + } + return false; + } + /** * Set a worker url * diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index d24750335..8fdc2e88f 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -100,62 +100,6 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->addpermissions)) - { - // Convert the addpermissions field to an array. - $addpermissions = new Registry; - $addpermissions->loadString($item->addpermissions); - $item->addpermissions = $addpermissions->toArray(); - } - - if (!empty($item->addtabs)) - { - // Convert the addtabs field to an array. - $addtabs = new Registry; - $addtabs->loadString($item->addtabs); - $item->addtabs = $addtabs->toArray(); - } - - if (!empty($item->addlinked_views)) - { - // Convert the addlinked_views field to an array. - $addlinked_views = new Registry; - $addlinked_views->loadString($item->addlinked_views); - $item->addlinked_views = $addlinked_views->toArray(); - } - - if (!empty($item->addtables)) - { - // Convert the addtables field to an array. - $addtables = new Registry; - $addtables->loadString($item->addtables); - $item->addtables = $addtables->toArray(); - } - - if (!empty($item->alias_builder)) - { - // Convert the alias_builder field to an array. - $alias_builder = new Registry; - $alias_builder->loadString($item->alias_builder); - $item->alias_builder = $alias_builder->toArray(); - } - - if (!empty($item->custom_button)) - { - // Convert the custom_button field to an array. - $custom_button = new Registry; - $custom_button->loadString($item->custom_button); - $item->custom_button = $custom_button->toArray(); - } - - if (!empty($item->ajax_input)) - { - // Convert the ajax_input field to an array. - $ajax_input = new Registry; - $ajax_input->loadString($item->ajax_input); - $item->ajax_input = $ajax_input->toArray(); - } - if (!empty($item->html_import_view)) { // base64 Decode html_import_view. @@ -360,6 +304,62 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_import_ext = base64_decode($item->php_import_ext); } + if (!empty($item->addpermissions)) + { + // Convert the addpermissions field to an array. + $addpermissions = new Registry; + $addpermissions->loadString($item->addpermissions); + $item->addpermissions = $addpermissions->toArray(); + } + + if (!empty($item->addtabs)) + { + // Convert the addtabs field to an array. + $addtabs = new Registry; + $addtabs->loadString($item->addtabs); + $item->addtabs = $addtabs->toArray(); + } + + if (!empty($item->addlinked_views)) + { + // Convert the addlinked_views field to an array. + $addlinked_views = new Registry; + $addlinked_views->loadString($item->addlinked_views); + $item->addlinked_views = $addlinked_views->toArray(); + } + + if (!empty($item->addtables)) + { + // Convert the addtables field to an array. + $addtables = new Registry; + $addtables->loadString($item->addtables); + $item->addtables = $addtables->toArray(); + } + + if (!empty($item->alias_builder)) + { + // Convert the alias_builder field to an array. + $alias_builder = new Registry; + $alias_builder->loadString($item->alias_builder); + $item->alias_builder = $alias_builder->toArray(); + } + + if (!empty($item->custom_button)) + { + // Convert the custom_button field to an array. + $custom_button = new Registry; + $custom_button->loadString($item->custom_button); + $item->custom_button = $custom_button->toArray(); + } + + if (!empty($item->ajax_input)) + { + // Convert the ajax_input field to an array. + $ajax_input = new Registry; + $ajax_input->loadString($item->ajax_input); + $item->ajax_input = $ajax_input->toArray(); + } + if (empty($item->id)) { diff --git a/admin/models/component_dashboard.php b/admin/models/component_dashboard.php index 889291e19..615552311 100644 --- a/admin/models/component_dashboard.php +++ b/admin/models/component_dashboard.php @@ -95,6 +95,12 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin $item->metadata = $registry->toArray(); } + if (!empty($item->php_dashboard_methods)) + { + // base64 Decode php_dashboard_methods. + $item->php_dashboard_methods = base64_decode($item->php_dashboard_methods); + } + if (!empty($item->dashboard_tab)) { // Convert the dashboard_tab field to an array. @@ -103,12 +109,6 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin $item->dashboard_tab = $dashboard_tab->toArray(); } - if (!empty($item->php_dashboard_methods)) - { - // base64 Decode php_dashboard_methods. - $item->php_dashboard_methods = base64_decode($item->php_dashboard_methods); - } - // update the fields $objectUpdate = new stdClass(); $objectUpdate->id = (int) $item->id; diff --git a/admin/models/custom_admin_view.php b/admin/models/custom_admin_view.php index f00df0ba8..0186b21a0 100644 --- a/admin/models/custom_admin_view.php +++ b/admin/models/custom_admin_view.php @@ -100,38 +100,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->ajax_input)) - { - // Convert the ajax_input field to an array. - $ajax_input = new Registry; - $ajax_input->loadString($item->ajax_input); - $item->ajax_input = $ajax_input->toArray(); - } - - if (!empty($item->libraries)) - { - // Convert the libraries field to an array. - $libraries = new Registry; - $libraries->loadString($item->libraries); - $item->libraries = $libraries->toArray(); - } - - if (!empty($item->custom_get)) - { - // Convert the custom_get field to an array. - $custom_get = new Registry; - $custom_get->loadString($item->custom_get); - $item->custom_get = $custom_get->toArray(); - } - - if (!empty($item->custom_button)) - { - // Convert the custom_button field to an array. - $custom_button = new Registry; - $custom_button->loadString($item->custom_button); - $item->custom_button = $custom_button->toArray(); - } - if (!empty($item->php_jview_display)) { // base64 Decode php_jview_display. @@ -204,6 +172,38 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->php_model = base64_decode($item->php_model); } + if (!empty($item->ajax_input)) + { + // Convert the ajax_input field to an array. + $ajax_input = new Registry; + $ajax_input->loadString($item->ajax_input); + $item->ajax_input = $ajax_input->toArray(); + } + + if (!empty($item->libraries)) + { + // Convert the libraries field to an array. + $libraries = new Registry; + $libraries->loadString($item->libraries); + $item->libraries = $libraries->toArray(); + } + + if (!empty($item->custom_get)) + { + // Convert the custom_get field to an array. + $custom_get = new Registry; + $custom_get->loadString($item->custom_get); + $item->custom_get = $custom_get->toArray(); + } + + if (!empty($item->custom_button)) + { + // Convert the custom_button field to an array. + $custom_button = new Registry; + $custom_button->loadString($item->custom_button); + $item->custom_button = $custom_button->toArray(); + } + if (empty($item->id)) { diff --git a/admin/models/dynamic_get.php b/admin/models/dynamic_get.php index 2db109232..334330d1d 100644 --- a/admin/models/dynamic_get.php +++ b/admin/models/dynamic_get.php @@ -100,54 +100,6 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->filter)) - { - // Convert the filter field to an array. - $filter = new Registry; - $filter->loadString($item->filter); - $item->filter = $filter->toArray(); - } - - if (!empty($item->where)) - { - // Convert the where field to an array. - $where = new Registry; - $where->loadString($item->where); - $item->where = $where->toArray(); - } - - if (!empty($item->order)) - { - // Convert the order field to an array. - $order = new Registry; - $order->loadString($item->order); - $item->order = $order->toArray(); - } - - if (!empty($item->global)) - { - // Convert the global field to an array. - $global = new Registry; - $global->loadString($item->global); - $item->global = $global->toArray(); - } - - if (!empty($item->join_view_table)) - { - // Convert the join_view_table field to an array. - $join_view_table = new Registry; - $join_view_table->loadString($item->join_view_table); - $item->join_view_table = $join_view_table->toArray(); - } - - if (!empty($item->join_db_table)) - { - // Convert the join_db_table field to an array. - $join_db_table = new Registry; - $join_db_table->loadString($item->join_db_table); - $item->join_db_table = $join_db_table->toArray(); - } - if (!empty($item->php_custom_get)) { // base64 Decode php_custom_get. @@ -196,6 +148,54 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $item->php_calculation = base64_decode($item->php_calculation); } + if (!empty($item->filter)) + { + // Convert the filter field to an array. + $filter = new Registry; + $filter->loadString($item->filter); + $item->filter = $filter->toArray(); + } + + if (!empty($item->where)) + { + // Convert the where field to an array. + $where = new Registry; + $where->loadString($item->where); + $item->where = $where->toArray(); + } + + if (!empty($item->order)) + { + // Convert the order field to an array. + $order = new Registry; + $order->loadString($item->order); + $item->order = $order->toArray(); + } + + if (!empty($item->global)) + { + // Convert the global field to an array. + $global = new Registry; + $global->loadString($item->global); + $item->global = $global->toArray(); + } + + if (!empty($item->join_view_table)) + { + // Convert the join_view_table field to an array. + $join_view_table = new Registry; + $join_view_table->loadString($item->join_view_table); + $item->join_view_table = $join_view_table->toArray(); + } + + if (!empty($item->join_db_table)) + { + // Convert the join_db_table field to an array. + $join_db_table = new Registry; + $join_db_table->loadString($item->join_db_table); + $item->join_db_table = $join_db_table->toArray(); + } + if (empty($item->id)) { diff --git a/admin/models/field.php b/admin/models/field.php index d6b1041ce..dd158cde9 100644 --- a/admin/models/field.php +++ b/admin/models/field.php @@ -100,12 +100,6 @@ class ComponentbuilderModelField extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->xml)) - { - // JSON Decode xml. - $item->xml = json_decode($item->xml); - } - if (!empty($item->css_views)) { // base64 Decode css_views. @@ -130,6 +124,12 @@ class ComponentbuilderModelField extends JModelAdmin $item->javascript_views_footer = base64_decode($item->javascript_views_footer); } + if (!empty($item->xml)) + { + // JSON Decode xml. + $item->xml = json_decode($item->xml); + } + if (empty($item->id)) { diff --git a/admin/models/forms/admin_view.xml b/admin/models/forms/admin_view.xml index dfc764bad..c11def310 100644 --- a/admin/models/forms/admin_view.xml +++ b/admin/models/forms/admin_view.xml @@ -1141,8 +1141,7 @@ layout="joomla.form.field.subform.repeatable-table" multiple="true" icon="list" - max="20" - min="1"> + max="20">