From 272427489616a0692a097ba7cb95fbedeb9a67f7 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 28 Feb 2018 05:03:19 +0200 Subject: [PATCH] Added crypt method to helper class, and fixed the std folder array issue --- README.md | 2 +- admin/README.txt | 2 +- admin/helpers/compiler/b_Structure.php | 2 ++ admin/helpers/componentbuilder.php | 34 +++++++++++++++++++ .../en-GB/en-GB.com_componentbuilder.ini | 1 + site/helpers/componentbuilder.php | 34 +++++++++++++++++++ .../en-GB/en-GB.com_componentbuilder.ini | 1 + 7 files changed, 74 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ea8c3cfa5..e5d9dd09b 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.6.17 + *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*: **183036** ++ *Line count*: **183106** + *Field count*: **1641** + *File count*: **1169** + *Folder count*: **189** diff --git a/admin/README.txt b/admin/README.txt index ea8c3cfa5..e5d9dd09b 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.6.17 + *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*: **183036** ++ *Line count*: **183106** + *Field count*: **1641** + *File count*: **1169** + *Folder count*: **189** diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index dfaf18d1c..53a8a6f9c 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -739,6 +739,8 @@ class Structure extends Get { $README = true; } + // set the standard folders + $stdFolders = array('site','admin','media'); // start moving foreach ($this->joomlaVersionData->move->static as $ftem => $details) { diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 5c1b388fc..4eb896c3b 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -2409,6 +2409,40 @@ abstract class ComponentbuilderHelper JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED', $serverID), 'Error'); return false; } + + /** + * the Crypt objects + **/ + protected static $CRYPT = array(); + + /** + * get the Crypt object + * + * @return object on success with Crypt power + **/ + public static function crypt($TYPE) + { + // check if it was already set + if (isset(self::$CRYPT[$TYPE]) && self::checkObject(self::$CRYPT[$TYPE])) + { + return self::$CRYPT[$TYPE]; + } + // make sure we have the composer classes loaded + self::composerAutoload(); + // build class name + $CLASS = '\phpseclib\Crypt\\'.$TYPE; + // make sure we have the phpseclib classes + if (!class_exists($CLASS)) + { + // class not in place so send out error + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_OF_JCB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO', $CLASS), 'Error'); + return false; + } + // set the + self::$CRYPT[$TYPE] = new $CLASS(); + // return the object + return self::$CRYPT[$TYPE]; + } /** * Load the Component xml manifest. **/ diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index d3fbfbeba..f7976ce32 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -6163,6 +6163,7 @@ COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The phpseclib\NET\SFTP library\class is not available! This library\class should have been added to your libraries/vdm_io/vendor folder. Please contact your system administrator for more info" COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER="The %s file could not be moved to %s path on %s server." COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The %s file could not be moved to %s server." +COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_OF_JCB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The %s library\class is not available! This library\class should have been added to your libraries/vdm_io/vendor folder of JCB. Please contact your system administrator for more info!" COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK="The %s library can not be deleted, or things will break." COM_COMPONENTBUILDER_THE_COMPONENT_ADMIN_VIEWS="The component admin views" COM_COMPONENTBUILDER_THE_COMPONENT_CONFIG="The component config" diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index df2b25263..f0e036c3f 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -1475,6 +1475,40 @@ abstract class ComponentbuilderHelper JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED', $serverID), 'Error'); return false; } + + /** + * the Crypt objects + **/ + protected static $CRYPT = array(); + + /** + * get the Crypt object + * + * @return object on success with Crypt power + **/ + public static function crypt($TYPE) + { + // check if it was already set + if (isset(self::$CRYPT[$TYPE]) && self::checkObject(self::$CRYPT[$TYPE])) + { + return self::$CRYPT[$TYPE]; + } + // make sure we have the composer classes loaded + self::composerAutoload(); + // build class name + $CLASS = '\phpseclib\Crypt\\'.$TYPE; + // make sure we have the phpseclib classes + if (!class_exists($CLASS)) + { + // class not in place so send out error + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_OF_JCB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO', $CLASS), 'Error'); + return false; + } + // set the + self::$CRYPT[$TYPE] = new $CLASS(); + // return the object + return self::$CRYPT[$TYPE]; + } public static function jsonToString($value, $sperator = ", ", $table = null) { diff --git a/site/language/en-GB/en-GB.com_componentbuilder.ini b/site/language/en-GB/en-GB.com_componentbuilder.ini index fe21b6200..867b8b961 100644 --- a/site/language/en-GB/en-GB.com_componentbuilder.ini +++ b/site/language/en-GB/en-GB.com_componentbuilder.ini @@ -41,6 +41,7 @@ COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_ COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The phpseclib\NET\SFTP library\class is not available! This library\class should have been added to your libraries/vdm_io/vendor folder. Please contact your system administrator for more info" COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER="The %s file could not be moved to %s path on %s server." COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The %s file could not be moved to %s server." +COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_OF_JCB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The %s library\class is not available! This library\class should have been added to your libraries/vdm_io/vendor folder of JCB. Please contact your system administrator for more info!" COM_COMPONENTBUILDER_THE_FTP_CONNECTION_FOR_BSB_COULD_NOT_BE_MADE_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS="The FTP connection for %s could not be made. Please check your signature details!" COM_COMPONENTBUILDER_THE_FTP_SIGNATURE_FOR_BSB_WAS_NOT_WELL_FORMED_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS="The FTP signature for %s was not well formed, please check your signature details!" COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT="The login to %s has failed, please check that your details are correct!"