From d961652f5672ebe31086e0f6043cac51d344d00b Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 2 May 2018 16:47:01 +0200 Subject: [PATCH] Futher improved the JCB package manager, so to be more stable and give enough information about selected packages --- README.md | 6 +- admin/README.txt | 6 +- admin/controllers/joomla_components.php | 35 +----- admin/helpers/componentbuilder.php | 114 +++++++++++------- .../en-GB/en-GB.com_componentbuilder.ini | 7 +- admin/models/joomla_components.php | 26 ++-- .../import_joomla_components/view.html.php | 4 +- componentbuilder.xml | 4 +- componentbuilder_update_server.xml | 4 +- script.php | 2 +- site/helpers/componentbuilder.php | 114 +++++++++++------- .../en-GB/en-GB.com_componentbuilder.ini | 7 +- 12 files changed, 188 insertions(+), 141 deletions(-) diff --git a/README.md b/README.md index 05b08ec07..e6cc0d228 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.7.6) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.7.7) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -127,10 +127,10 @@ Component Builder is mapped as a component in itself on my local development env + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 + *Last Build*: 2nd May, 2018 -+ *Version*: 2.7.6 ++ *Version*: 2.7.7 + *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*: **193883** ++ *Line count*: **193930** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/README.txt b/admin/README.txt index 05b08ec07..e6cc0d228 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.7.6) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.7.7) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -127,10 +127,10 @@ Component Builder is mapped as a component in itself on my local development env + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 + *Last Build*: 2nd May, 2018 -+ *Version*: 2.7.6 ++ *Version*: 2.7.7 + *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*: **193883** ++ *Line count*: **193930** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/controllers/joomla_components.php b/admin/controllers/joomla_components.php index d16eab8fd..9e4f0563b 100644 --- a/admin/controllers/joomla_components.php +++ b/admin/controllers/joomla_components.php @@ -163,40 +163,9 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin $keyNotice = '

' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '

'; $keyNotice .= '

' . JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEYBR_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY') . ''; // set the package owner info - if ((isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner']))) + if (componentbuilderHelper::getPackageOwnerValue('owner', $model->info) || componentbuilderHelper::getPackageOwnerValue('company', $model->info)) { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '

'; - $ownerDetails .= ''; + $ownerDetails = componentbuilderHelper::getPackageOwnerDetailsDisplay($model->info, true); } else { diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index a889c2355..475d7a847 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -2042,57 +2042,47 @@ abstract class ComponentbuilderHelper return false; } + protected static $pkOwnerSearch = array( + 'company' => 'COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', + 'owner' => 'COM_COMPONENTBUILDER_EMOWNEREM_BSB', + 'website' => 'COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', + 'email' => 'COM_COMPONENTBUILDER_EMEMAILEM_BSB', + 'license' => 'COM_COMPONENTBUILDER_EMLICENSEEM_BSB', + 'copyright' => 'COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB' + ); + /** * get the JCB package owner details display **/ public static function getPackageOwnerDetailsDisplay(&$info, $trust = false) { + $hasOwner = false; $ownerDetails = ''; $ownerDetails .= ''; // provide some details to how the user can get a key - if (isset($info['getKeyFrom']['buy_link']) && self::checkString($info['getKeyFrom']['buy_link'])) + if ($hasOwner && isset($info['getKeyFrom']['buy_link']) && self::checkString($info['getKeyFrom']['buy_link'])) { $ownerDetails .= '
'; $ownerDetails .= JText::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA', $info['getKeyFrom']['buy_link'], $owner, $owner); } // add more custom links - elseif (isset($info['getKeyFrom']['buy_links']) && self::checkArray($info['getKeyFrom']['buy_links'])) + elseif ($hasOwner && isset($info['getKeyFrom']['buy_links']) && self::checkArray($info['getKeyFrom']['buy_links'])) { $buttons = array(); foreach ($info['getKeyFrom']['buy_links'] as $keyName => $link) @@ -2102,25 +2092,57 @@ abstract class ComponentbuilderHelper $ownerDetails .= '
'; $ownerDetails .= implode('
', $buttons); } - // return the owner details - if (!isset($owner) && !$trust) + if (!$hasOwner) { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '

'; - $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '

'; - } - elseif (!isset($owner) && $trust) - { - $ownerDetails = ''; + $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '

'; + if (!$trust) + { + $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '

'; + } } return $ownerDetails; } + public static function getPackageOwnerValue($key, &$info) + { + $source = (isset($info['source']) && isset($info['source'][$key])) ? 'source' : ((isset($info['getKeyFrom']) && isset($info['getKeyFrom'][$key])) ? 'getKeyFrom' : false); + if ($source && self::checkString($info[$source][$key])) + { + return $info[$source][$key]; + } + return false; + } + + /** + * get the JCB package component key status + **/ + public static function getPackageComponentsKeyStatus(&$info) + { + // check the package key status + if (!isset($info['key'])) + { + if (isset($info['getKeyFrom']) && isset($info['getKeyFrom']['owner'])) + { + // this just confirms it for older packages + $info['key'] = true; + } + else + { + // this just confirms it for older packages + $info['key'] = false; + } + } + return $info['key']; + } + /** * get the JCB package component details display **/ public static function getPackageComponentsDetailsDisplay(&$info) { + // check if these components need a key + $needKey = self::getPackageComponentsKeyStatus($info); if (isset($info['name']) && self::checkArray($info['name'])) { $cAmount = count((array) $info['name']); @@ -2141,6 +2163,14 @@ abstract class ComponentbuilderHelper $display[] = '
'; $display[] = '

'; $display[] = $info['short_description'][$key]; $display[] = '