From 5b1813db7c8cd9c647bc2a4eefecb70404bd1867 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 9 Sep 2018 22:04:38 +0200 Subject: [PATCH] Update some comments. Fixed some conditional implementation of the show hide fields area in the admin views. --- README.md | 4 +- admin/README.txt | 4 +- admin/compiler/vdm.txt | 14 +-- admin/helpers/compiler/e_Interpretation.php | 43 ++++--- admin/helpers/componentbuilder.php | 112 ++++++++++-------- .../en-GB/en-GB.com_componentbuilder.ini | 12 +- admin/models/ajax.php | 12 +- .../models/forms/admin_fields_conditions.xml | 8 +- admin/sql/install.mysql.utf8.sql | 2 +- componentbuilder.xml | 2 +- site/helpers/componentbuilder.php | 112 ++++++++++-------- 11 files changed, 187 insertions(+), 138 deletions(-) diff --git a/README.md b/README.md index 55fb773f9..7cb4c3d82 100644 --- a/README.md +++ b/README.md @@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *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*: 1st September, 2018 ++ *Last Build*: 8th September, 2018 + *Version*: 2.9.0 + *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*: **192959** ++ *Line count*: **192999** + *Field count*: **1081** + *File count*: **1273** + *Folder count*: **201** diff --git a/admin/README.txt b/admin/README.txt index 55fb773f9..7cb4c3d82 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *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*: 1st September, 2018 ++ *Last Build*: 8th September, 2018 + *Version*: 2.9.0 + *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*: **192959** ++ *Line count*: **192999** + *Field count*: **1081** + *File count*: **1273** + *Folder count*: **201** diff --git a/admin/compiler/vdm.txt b/admin/compiler/vdm.txt index 77d1f00f8..cfb4cd43c 100644 --- a/admin/compiler/vdm.txt +++ b/admin/compiler/vdm.txt @@ -5,8 +5,8 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version ###VERSION### @@ -14,10 +14,10 @@ @created ###CREATIONDATE### @package ###Component_name### @subpackage ###FILENAME### - @author ###AUTHOR### <###AUTHORWEBSITE###>###CONTRIBUTORS### + @author ###AUTHOR### <###AUTHORWEBSITE###>###CONTRIBUTORS### @copyright ###COPYRIGHT### - @license ###LICENSE### - - ###SHORT_DESCRIPTION### - + @license ###LICENSE### + + ###SHORT_DESCRIPTION### + /-----------------------------------------------------------------------------------------------------------------------------*/ \ No newline at end of file diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index a19e3dc80..b9167c524 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -9195,19 +9195,18 @@ class Interpretation extends Fields $ifValue = array(); $targetControls = array(); $functions = array(); + foreach ($viewArray['settings']->conditions as $condition) { if (isset($condition['match_name']) && ComponentbuilderHelper::checkString($condition['match_name'])) { $uniqueVar = $this->uniquekey(7); $matchName = $condition['match_name'] . '_' . $uniqueVar; - $targetBehavior = ($condition['target_behavior'] == 1) ? 'show' : 'hide'; - $targetDefault = ($condition['target_behavior'] == 1) ? 'hide' : 'show'; + $targetBehavior = ($condition['target_behavior'] == 1 || $condition['target_behavior'] == 3) ? 'show' : 'hide'; + $targetDefault = ($condition['target_behavior'] == 1 || $condition['target_behavior'] == 3) ? 'hide' : 'show'; - // make sure only one relation is set - $firstTime = true; // set the realtation if any - if ($condition['target_relation'] && $firstTime) + if ($condition['target_relation']) { // chain to other items of the same target $relations = $this->getTargetRelationScript($viewArray['settings']->conditions, $condition, $viewName); @@ -9216,6 +9215,7 @@ class Interpretation extends Fields // set behavior and default array $behaviors[$matchName] = $targetBehavior; $defaults[$matchName] = $targetDefault; + $toggleSwitch[$matchName] = ($condition['target_behavior'] == 1 || $condition['target_behavior'] == 2) ? true : false; // set the type buket $typeBuket[$matchName] = $condition['match_type']; // set function array @@ -9230,7 +9230,6 @@ class Interpretation extends Fields // set the target controls $targetControls[$matchName] = $this->setTargetControlsScript($condition['target_field'], $targetBehavior, $targetDefault, $uniqueVar, $viewName); - $firstTime = false; foreach ($relations as $relation) { if (ComponentbuilderHelper::checkString($relation['match_name'])) @@ -9254,6 +9253,7 @@ class Interpretation extends Fields // set behavior and default array $behaviors[$matchName] = $targetBehavior; $defaults[$matchName] = $targetDefault; + $toggleSwitch[$matchName] = ($condition['target_behavior'] == 1 || $condition['target_behavior'] == 2) ? true : false; // set the type buket $typeBuket[$matchName] = $condition['match_type']; // set function array @@ -9279,7 +9279,7 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($functions)) { // now build the initial script - $initial .= "// Initial Script" . PHP_EOL . "jQuery(document).ready(function()"; + $initial .= "//" . $this->setLine(__LINE__) . " Initial Script" . PHP_EOL . "jQuery(document).ready(function()"; $initial .= PHP_EOL . "{"; foreach ($functions as $function => $matchKeys) { @@ -9310,7 +9310,7 @@ class Interpretation extends Fields $name = $name . '_id'; } - $listener .= PHP_EOL . "// #jform_" . $name . " listeners for " . $l_matchKey . " function"; + $listener .= PHP_EOL . "//" . $this->setLine(__LINE__) . " #jform_" . $name . " listeners for " . $l_matchKey . " function"; $listener .= PHP_EOL . "jQuery('#jform_" . $name . "').on('keyup',function()"; $listener .= PHP_EOL . "{"; $listener .= $funcCall['code']; @@ -9346,7 +9346,7 @@ class Interpretation extends Fields { $addArray = true; } - $func .= PHP_EOL . "// the " . $f_function . " function"; + $func .= PHP_EOL . "//" . $this->setLine(__LINE__) . " the " . $f_function . " function"; $func .= PHP_EOL . "function " . $f_function . "("; $fucounter = 0; foreach ($f_matchKeys as $fu_matchKey) @@ -9378,7 +9378,7 @@ class Interpretation extends Fields $func .= PHP_EOL . $this->_t(1) . "var " . $name . " = " . $a_matchKey . ".some(" . $a_matchKey . "_SomeFunc);" . PHP_EOL; // setup the map function - $map .= PHP_EOL . "// the " . $f_function . " Some function"; + $map .= PHP_EOL . "//" . $this->setLine(__LINE__) . " the " . $f_function . " Some function"; $map .= PHP_EOL . "function " . $a_matchKey . "_SomeFunc(" . $a_matchKey . ")"; $map .= PHP_EOL . "{"; $map .= PHP_EOL . $this->_t(1) . "//" . $this->setLine(__LINE__) . " set the function logic"; @@ -9434,6 +9434,11 @@ class Interpretation extends Fields } $ifcounter++; } + else + { + var_dump($functions); + var_dump($ifValue);exit; + } } $func .= ")" . PHP_EOL . $this->_t(1) . "{"; } @@ -9452,13 +9457,16 @@ class Interpretation extends Fields $head .= $action['requiredVar']; } } - $func .= PHP_EOL . $this->_t(1) . "}" . PHP_EOL . $this->_t(1) . "else" . PHP_EOL . $this->_t(1) . "{"; - foreach ($controls as $target => $action) + if ($toggleSwitch[$f_matchKeys[0]]) { - $func .= $action['default']; - if (ComponentbuilderHelper::checkString($action['hide'])) + $func .= PHP_EOL . $this->_t(1) . "}" . PHP_EOL . $this->_t(1) . "else" . PHP_EOL . $this->_t(1) . "{"; + foreach ($controls as $target => $action) { - $func .= $action[$targetDefault]; + $func .= $action['default']; + if (ComponentbuilderHelper::checkString($action['hide'])) + { + $func .= $action[$targetDefault]; + } } } $func .= PHP_EOL . $this->_t(1) . "}" . PHP_EOL . "}" . PHP_EOL . $map; @@ -9612,7 +9620,7 @@ class Interpretation extends Fields // convert to name array foreach ($condition['target_field'] as $targetField) { - if (ComponentbuilderHelper::checkArray($targetField)) + if (ComponentbuilderHelper::checkArray($targetField) && isset($targetField['name'])) { $currentTargets[] = $targetField['name']; } @@ -9622,7 +9630,8 @@ class Interpretation extends Fields { // reset found $found = false; - if ($relation['match_field'] != $condition['match_field']) + // chain only none matching fields + if ($relation['match_field'] !== $condition['match_field'] && $relation['target_relation']) // Made this change to see if it improves the expected result (TODO) { if (ComponentbuilderHelper::checkArray($relation['target_field'])) { diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 7e866d494..28ec64457 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -2400,14 +2400,14 @@ abstract class ComponentbuilderHelper /** - * Get the file path or url + * Get the file path or url * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found * - * @return string On success the path or url is returned based on the type requested + * @return string On success the path or url is returned based on the type requested * */ public static function getFolderPath($type = 'path', $target = 'folderpath', $default = '', $createIfNotSet = true) @@ -2448,7 +2448,7 @@ abstract class ComponentbuilderHelper /** * get the content of a file * - * @param string $path The path to the file + * @param string $path The path to the file * @param string/bool $none The return value if no content was found * * @return string On success @@ -2597,34 +2597,37 @@ abstract class ComponentbuilderHelper } /** - * the locker + * the locker * - * @var array + * @var array **/ protected static $locker = array(); /** - * the dynamic replacement salt + * the dynamic replacement salt * - * @var array + * @var array **/ protected static $globalSalt = array(); /** - * the timer + * the timer * - * @var object + * @var object **/ protected static $keytimer; /** - * To Lock string + * To Lock string + * + * @param string $string The string/array to lock + * @param string $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url encoding + * + * @return string Encrypted String * - * @param string $string The string/array to lock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url encoding **/ public static function lock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) { @@ -2638,13 +2641,13 @@ abstract class ComponentbuilderHelper { $timer = $salt; } + // set the default key + $key = self::salt($timer, $dynamic); + // try getting the system key if (method_exists(get_called_class(), "getCryptKey")) { - $key = self::getCryptKey('basic', self::salt($timer, $dynamic)); - } - else - { - $key = self::salt($timer, $dynamic); + // try getting the medium key first the fall back to basic, and then default + $key = self::getCryptKey('medium', self::getCryptKey('basic', $key)); } } // check if we have a salt timer @@ -2663,7 +2666,7 @@ abstract class ComponentbuilderHelper $string = serialize($string); } // prep for url - if ($urlencode) + if ($urlencode && method_exists(get_called_class(), "base64_urlencode")) { return self::base64_urlencode(self::$locker[$key]->encryptString($string)); } @@ -2671,13 +2674,16 @@ abstract class ComponentbuilderHelper } /** - * To un-Lock string + * To un-Lock string + * + * @param string $string The string to unlock + * @param string $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url decoding + * + * @return string Decrypted String * - * @param string $string The string to unlock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url decoding **/ public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) { @@ -2691,14 +2697,13 @@ abstract class ComponentbuilderHelper { $timer = $salt; } - // get secure key + // set the default key + $key = self::salt($timer, $dynamic); + // try getting the system key if (method_exists(get_called_class(), "getCryptKey")) { - $key = self::getCryptKey('basic', self::salt($timer, $dynamic)); - } - else - { - $key = self::salt($timer, $dynamic); + // try getting the medium key first the fall back to basic, and then default + $key = self::getCryptKey('medium', self::getCryptKey('basic', $key)); } } // check if we have a salt timer @@ -2712,7 +2717,7 @@ abstract class ComponentbuilderHelper self::$locker[$key] = new FOFEncryptAes($key, 128); } // make sure we have real base64 - if ($urlencode) + if ($urlencode && method_exists(get_called_class(), "base64_urldecode")) { $string = self::base64_urldecode($string); } @@ -2730,10 +2735,13 @@ abstract class ComponentbuilderHelper } /** - * The Salt + * The Salt + * + * @param int $type The type of length the salt should be valid + * @param int $dynamic The dynamic replacement array of salt build string + * + * @return string * - * @param int $type The type of length the salt should be valid - * @param int $dynamic The dynamic replacement array of salt build string **/ public static function salt($type = 1, $dynamic = null) { @@ -2778,9 +2786,9 @@ abstract class ComponentbuilderHelper } /** - * The function to insure the salt is valid within the given period (third try) + * The function to insure the salt is valid within the given period (third try) * - * @param int $main The main number + * @param int $main The main number */ protected static function periodFix($main) { @@ -2788,8 +2796,12 @@ abstract class ComponentbuilderHelper } /** - * Check if a string is serialized - * @param string $string + * Check if a string is serialized + * + * @param string $string + * + * @return Boolean + * */ public static function is_serial($string) { @@ -2797,7 +2809,7 @@ abstract class ComponentbuilderHelper } /** - * Get dynamic replacement salt + * Get dynamic replacement salt */ public static function getDynamicSalt($dynamic = null) { @@ -2814,7 +2826,7 @@ abstract class ComponentbuilderHelper } /** - * The random or dynamic secret salt + * The random or dynamic secret salt */ public static function getSecretSalt($string = null, $size = 9) { @@ -2837,7 +2849,7 @@ abstract class ComponentbuilderHelper } /** - * Get global replacement salt + * Get global replacement salt */ public static function getGlobalSalt() { @@ -2877,7 +2889,7 @@ abstract class ComponentbuilderHelper } /** - * Close public protocol + * Close public protocol */ public static function closePublicProtocol($id, $public) { @@ -2904,7 +2916,7 @@ abstract class ComponentbuilderHelper } /** - * Open public protocol + * Open public protocol */ public static function openPublicProtocol($SECRET, $ID, $PUBLIC) { diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index bb87da27d..e6cef43f3 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -249,7 +249,8 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_EDIT="Editing the Admin Fields Conditions" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ERROR_UNIQUE_ALIAS="Another Admin Fields Conditions has the same alias." COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_EXACT_LENGTH_ONLY_FOUR_TEXT_FIELD="Exact Length (only 4 text_field)" -COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_HIDE="Hide" +COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_HIDE_ONLY="Hide Only" +COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_HIDE_TOGGLE="Hide Toggle" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ID="Id" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ISOLATE="Isolate" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_IS_NOT_ONLY_FOUR_LISTRADIOCHECKBOXES="Is Not (only 4 list/radio/checkboxes)" @@ -278,7 +279,8 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_PERMISSION="Permissions" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_PUBLISHING="Publishing" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Admin Fields Conditions to customise the alias." -COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_SHOW="Show" +COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_SHOW_ONLY="Show Only" +COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_SHOW_TOGGLE="Show Toggle" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_STATUS="Status" COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_BEHAVIOR_DESCRIPTION="Select the target field/s behavior." COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_BEHAVIOR_LABEL="Target Behavior" @@ -4378,7 +4380,8 @@ COM_COMPONENTBUILDER_HELP_MANAGER="Help" COM_COMPONENTBUILDER_HFOUR_CLASSNAVHEADERCOPYRIGHTHFOURPSP="

%s

" COM_COMPONENTBUILDER_HFOUR_CLASSNAVHEADERLICENSEHFOURPSP="

%s

" COM_COMPONENTBUILDER_HI="Hi" -COM_COMPONENTBUILDER_HIDE="Hide" +COM_COMPONENTBUILDER_HIDE_ONLY="Hide Only" +COM_COMPONENTBUILDER_HIDE_TOGGLE="Hide Toggle" COM_COMPONENTBUILDER_HOW_TO_GET_A_S_FREE_KEYSA_FROM_VDM="How to get free keys from VDM." COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP="

Curl Not Found!

Please setup curl on your system, or componentbuilder will not function correctly!

" COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BKEY_ERRORB_OR_BROKEN_PACKAGE="

Data is corrupt!

This could be due to key error, or broken package!" @@ -5860,8 +5863,9 @@ COM_COMPONENTBUILDER_SHOULD_THIS_FIELD_BE_ESCAPED_IN_THE_LIST_VIEW="Should this 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="Show" COM_COMPONENTBUILDER_SHOW_IN_LIST_VIEW="Show in list view" +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." COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT="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." COM_COMPONENTBUILDER_SITE_VIEW="Site View" diff --git a/admin/models/ajax.php b/admin/models/ajax.php index f4deb2a8f..1a8b89733 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -1049,9 +1049,17 @@ class ComponentbuilderModelAjax extends JModelList { if (1 == $value) { - return JText::_('COM_COMPONENTBUILDER_SHOW'); + return JText::_('COM_COMPONENTBUILDER_SHOW_TOGGLE'); } - return JText::_('COM_COMPONENTBUILDER_HIDE'); + elseif (3 == $value) + { + return JText::_('COM_COMPONENTBUILDER_SHOW_ONLY'); + } + elseif (4 == $value) + { + return JText::_('COM_COMPONENTBUILDER_HIDE_ONLY'); + } + return JText::_('COM_COMPONENTBUILDER_HIDE_TOGGLE'); } protected function setTargetRelation($header, $value) diff --git a/admin/models/forms/admin_fields_conditions.xml b/admin/models/forms/admin_fields_conditions.xml index 67c614ad1..44aa77f2d 100644 --- a/admin/models/forms/admin_fields_conditions.xml +++ b/admin/models/forms/admin_fields_conditions.xml @@ -131,9 +131,13 @@ default="1"> + COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_SHOW_TOGGLE + COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_HIDE_TOGGLE + + COM_COMPONENTBUILDER - 1st September, 2018 + 8th September, 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 dedbc4d78..6d4fe670a 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -2400,14 +2400,14 @@ abstract class ComponentbuilderHelper /** - * Get the file path or url + * Get the file path or url * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found * - * @return string On success the path or url is returned based on the type requested + * @return string On success the path or url is returned based on the type requested * */ public static function getFolderPath($type = 'path', $target = 'folderpath', $default = '', $createIfNotSet = true) @@ -2448,7 +2448,7 @@ abstract class ComponentbuilderHelper /** * get the content of a file * - * @param string $path The path to the file + * @param string $path The path to the file * @param string/bool $none The return value if no content was found * * @return string On success @@ -2597,34 +2597,37 @@ abstract class ComponentbuilderHelper } /** - * the locker + * the locker * - * @var array + * @var array **/ protected static $locker = array(); /** - * the dynamic replacement salt + * the dynamic replacement salt * - * @var array + * @var array **/ protected static $globalSalt = array(); /** - * the timer + * the timer * - * @var object + * @var object **/ protected static $keytimer; /** - * To Lock string + * To Lock string + * + * @param string $string The string/array to lock + * @param string $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url encoding + * + * @return string Encrypted String * - * @param string $string The string/array to lock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url encoding **/ public static function lock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) { @@ -2638,13 +2641,13 @@ abstract class ComponentbuilderHelper { $timer = $salt; } + // set the default key + $key = self::salt($timer, $dynamic); + // try getting the system key if (method_exists(get_called_class(), "getCryptKey")) { - $key = self::getCryptKey('basic', self::salt($timer, $dynamic)); - } - else - { - $key = self::salt($timer, $dynamic); + // try getting the medium key first the fall back to basic, and then default + $key = self::getCryptKey('medium', self::getCryptKey('basic', $key)); } } // check if we have a salt timer @@ -2663,7 +2666,7 @@ abstract class ComponentbuilderHelper $string = serialize($string); } // prep for url - if ($urlencode) + if ($urlencode && method_exists(get_called_class(), "base64_urlencode")) { return self::base64_urlencode(self::$locker[$key]->encryptString($string)); } @@ -2671,13 +2674,16 @@ abstract class ComponentbuilderHelper } /** - * To un-Lock string + * To un-Lock string + * + * @param string $string The string to unlock + * @param string $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url decoding + * + * @return string Decrypted String * - * @param string $string The string to unlock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url decoding **/ public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) { @@ -2691,14 +2697,13 @@ abstract class ComponentbuilderHelper { $timer = $salt; } - // get secure key + // set the default key + $key = self::salt($timer, $dynamic); + // try getting the system key if (method_exists(get_called_class(), "getCryptKey")) { - $key = self::getCryptKey('basic', self::salt($timer, $dynamic)); - } - else - { - $key = self::salt($timer, $dynamic); + // try getting the medium key first the fall back to basic, and then default + $key = self::getCryptKey('medium', self::getCryptKey('basic', $key)); } } // check if we have a salt timer @@ -2712,7 +2717,7 @@ abstract class ComponentbuilderHelper self::$locker[$key] = new FOFEncryptAes($key, 128); } // make sure we have real base64 - if ($urlencode) + if ($urlencode && method_exists(get_called_class(), "base64_urldecode")) { $string = self::base64_urldecode($string); } @@ -2730,10 +2735,13 @@ abstract class ComponentbuilderHelper } /** - * The Salt + * The Salt + * + * @param int $type The type of length the salt should be valid + * @param int $dynamic The dynamic replacement array of salt build string + * + * @return string * - * @param int $type The type of length the salt should be valid - * @param int $dynamic The dynamic replacement array of salt build string **/ public static function salt($type = 1, $dynamic = null) { @@ -2778,9 +2786,9 @@ abstract class ComponentbuilderHelper } /** - * The function to insure the salt is valid within the given period (third try) + * The function to insure the salt is valid within the given period (third try) * - * @param int $main The main number + * @param int $main The main number */ protected static function periodFix($main) { @@ -2788,8 +2796,12 @@ abstract class ComponentbuilderHelper } /** - * Check if a string is serialized - * @param string $string + * Check if a string is serialized + * + * @param string $string + * + * @return Boolean + * */ public static function is_serial($string) { @@ -2797,7 +2809,7 @@ abstract class ComponentbuilderHelper } /** - * Get dynamic replacement salt + * Get dynamic replacement salt */ public static function getDynamicSalt($dynamic = null) { @@ -2814,7 +2826,7 @@ abstract class ComponentbuilderHelper } /** - * The random or dynamic secret salt + * The random or dynamic secret salt */ public static function getSecretSalt($string = null, $size = 9) { @@ -2837,7 +2849,7 @@ abstract class ComponentbuilderHelper } /** - * Get global replacement salt + * Get global replacement salt */ public static function getGlobalSalt() { @@ -2877,7 +2889,7 @@ abstract class ComponentbuilderHelper } /** - * Close public protocol + * Close public protocol */ public static function closePublicProtocol($id, $public) { @@ -2904,7 +2916,7 @@ abstract class ComponentbuilderHelper } /** - * Open public protocol + * Open public protocol */ public static function openPublicProtocol($SECRET, $ID, $PUBLIC) {