diff --git a/README.md b/README.md
index cbd247b0e..2a11f9e30 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*: 21st March, 2018
++ *Last Build*: 24th March, 2018
+ *Version*: 2.7.0
+ *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*: **186511**
++ *Line count*: **186317**
+ *Field count*: **994**
+ *File count*: **1171**
+ *Folder count*: **189**
diff --git a/admin/README.txt b/admin/README.txt
index cbd247b0e..2a11f9e30 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*: 21st March, 2018
++ *Last Build*: 24th March, 2018
+ *Version*: 2.7.0
+ *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*: **186511**
++ *Line count*: **186317**
+ *Field count*: **994**
+ *File count*: **1171**
+ *Folder count*: **189**
diff --git a/admin/access.xml b/admin/access.xml
index b9769fd7d..a4f8040d9 100644
--- a/admin/access.xml
+++ b/admin/access.xml
@@ -344,7 +344,6 @@
This package FAILED checksum validation, this could be a serious security breach! DO NOT CONTINUE!!!"
+COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_WE_COULD_NOT_LOAD_THE_CHECKSUM_FOR_THIS_PACKAGE_AND_SO_NO_VALIDATION_WAS_POSSIBLE_THIS_MAY_BE_DUE_TO_YOUR_NETWORK_OR_A_CHANGE_TO_THAT_PACKAGE_NAME="Best to not continue!
We could not load the checksum for this package, and so no validation was possible. This may be due to your network, or a change to that package name."
COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVE_TO_CORRECT_LOCATION="Custom files not move to correct location!"
COM_COMPONENTBUILDER_BEHIND="Behind"
COM_COMPONENTBUILDER_BEHIND_MEANS_YOUR_BLOCAL_SNIPPETB_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_A_BOLDER_MODIFIED_DATEB_THEN_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE="Behind means your local snippet (with the same name, library and type) has a older modified date then the community snippet (with the same name, library and type)."
@@ -929,6 +930,7 @@ COM_COMPONENTBUILDER_BULK_UPDATE_ALL_AVAILABLE_SNIPPETS="Bulk Update All Availab
COM_COMPONENTBUILDER_BULK_UPDATE_ALL_DIVERGED_SNIPPETS="Bulk Update All Diverged Snippets"
COM_COMPONENTBUILDER_BULK_UPDATE_ALL_OUT_DATED_SNIPPETS="Bulk Update All Out Dated Snippets"
COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_TIME="Button to create %s will show once %s is saved for the first time."
+COM_COMPONENTBUILDER_CANCEL="Cancel"
COM_COMPONENTBUILDER_CHAIN="Chain"
COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="Check your owner details, it has not been set. Open the JCB Global Options, go to the Company tab and add the correct company details there."
COM_COMPONENTBUILDER_CLEAR_TMP="Clear tmp"
@@ -3191,6 +3193,7 @@ COM_COMPONENTBUILDER_DASHBOARD_FIELD_ADD="Add Field
"
COM_COMPONENTBUILDER_DASHBOARD_GETSNIPPETS="Get Snippets
"
COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENTS="Help Documents
"
COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENT_ADD="Add Help Document
"
+COM_COMPONENTBUILDER_DASHBOARD_IMPORTJCBPACKAGES="Import JCB Packages
"
COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENTS="Joomla Components
"
COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENT_ADD="Add Joomla Component
"
COM_COMPONENTBUILDER_DASHBOARD_LANGUAGE_TRANSLATIONS="Language Translations
"
@@ -3202,7 +3205,6 @@ COM_COMPONENTBUILDER_DASHBOARD_SERVERS="Servers
"
COM_COMPONENTBUILDER_DASHBOARD_SITE_VIEWS="Site Views
"
COM_COMPONENTBUILDER_DASHBOARD_SITE_VIEW_ADD="Add Site View
"
COM_COMPONENTBUILDER_DASHBOARD_SNIPPETS="Snippets
"
-COM_COMPONENTBUILDER_DASHBOARD_SNIPPET_ADD="Add Snippet
"
COM_COMPONENTBUILDER_DASHBOARD_TEMPLATES="Templates
"
COM_COMPONENTBUILDER_DASHBOARD_TEMPLATE_ADD="Add Template
"
COM_COMPONENTBUILDER_DATE="Date"
@@ -3879,10 +3881,14 @@ COM_COMPONENTBUILDER_FIELD_XML_LABEL="XML field definition (Please set the field
COM_COMPONENTBUILDER_FIELD_YES="Yes"
COM_COMPONENTBUILDER_FIELD_ZERO="0"
COM_COMPONENTBUILDER_FILE="File"
-COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVE_TO_S="File %s was not move to (%s)!"
+COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED="File %s could not be unlocked!"
+COM_COMPONENTBUILDER_FILE_BSB_WAS_MOVED_TO_BSB="File %s was moved to %s"
+COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVE_TO_BSB="File %s was not move to %s"
+COM_COMPONENTBUILDER_FILE_BSB_WAS_SUCCESSFULLY_UNLOCKED="File %s was successfully unlocked!"
COM_COMPONENTBUILDER_FILTER="Filter"
COM_COMPONENTBUILDER_FOLDER="Folder"
-COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_S="Folder %s was not move to (%s)!"
+COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB="Folder %s was moved to %s"
+COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_BSB="Folder %s was not move to %s"
COM_COMPONENTBUILDER_FORCE_LOCAL_UPDATE="Force Local Update"
COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB="Full Width in Tab"
COM_COMPONENTBUILDER_GENERAL_OVERVIEW_OF_HOW_THINGS_WORK_BSB="General overview of how things work: %s"
@@ -5271,6 +5277,7 @@ COM_COMPONENTBUILDER_PERMISSIONS="Permissions"
COM_COMPONENTBUILDER_PLEASE_ADD_FILES_TO_S="Please add files to (%s)"
COM_COMPONENTBUILDER_PLEASE_ADD_FOLDERS_TO_S="Please add folders to (%s)"
COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER="Please check again latter."
+COM_COMPONENTBUILDER_PLEASE_NOTE_THAT_THIS_PACKAGE_BHAS_NOB_CHECKSUM_VALIDATION="Please note that this package has no checksum validation!"
COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONENT_THAT_YOU_WOULD_LIKE_TO_COMPILE="Please select a component that you would like to compile."
COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER="Please try again later"
COM_COMPONENTBUILDER_PLEASE_WAIT_CLEARING_THE_TMP_FOLDER="Please wait! Clearing the tmp folder"
@@ -5927,8 +5934,6 @@ COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE_DESC="Allows users in this group to use
COM_COMPONENTBUILDER_SNIPPETS_COULD_NOT_BE_UPDATEDSAVED="Snippets could not be updated/saved"
COM_COMPONENTBUILDER_SNIPPETS_CREATE="Snippets Create"
COM_COMPONENTBUILDER_SNIPPETS_CREATE_DESC="Allows the users in this group to create create snippets"
-COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_ADD="Snippets Dashboard Add"
-COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the snippet"
COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST="Snippets Dashboard List"
COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the snippet"
COM_COMPONENTBUILDER_SNIPPETS_DELETE="Snippets Delete"
@@ -6109,6 +6114,8 @@ COM_COMPONENTBUILDER_SNIPPET_USAGE_HINT="Add Usage Here"
COM_COMPONENTBUILDER_SNIPPET_USAGE_LABEL="Usage"
COM_COMPONENTBUILDER_SNIPPET_VERSION_DESC="A count of the number of times this Snippet has been revised."
COM_COMPONENTBUILDER_SNIPPET_VERSION_LABEL="Revision"
+COM_COMPONENTBUILDER_SOME_BCUSTOM_FILESB_WERE_MOVED_TO_BSB="Some Custom files were moved to %s"
+COM_COMPONENTBUILDER_SOME_BIMAGESB_WERE_MOVED_TO_BSB="Some Images were moved to %s"
COM_COMPONENTBUILDER_SORRY_THIS_FUNCTION_NAME_IS_ALREADY_IN_USE="Sorry this function name is already in use!"
COM_COMPONENTBUILDER_SORTABLE="Sortable"
COM_COMPONENTBUILDER_SUBMENU="Submenu"
@@ -6263,6 +6270,7 @@ COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME="There are no new sn
COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME="There are no out of date snippets at this time"
COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME="There are no snippets to update at this time"
COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST="There has been an error, if this continues please inform your system administrator of a type error in the fields display request!"
+COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_GETTING_THE_PACKAGE_INFO="There was an error getting the package info."
COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="There was a problem, no view or id found in session or view not allowed to access area, we could not load any linked to values. Please inform your system administrator!"
COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_GET_PACKAGE_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE_A_S_GET_A_KEY_TODAYA="These are the same packages found on gitHub and can be imported by simply making a selection and then clicking the [Get Package] button.
Some of these packages would require a key, since they are not free. Get a key today!."
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"
@@ -6299,6 +6307,7 @@ COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED="The Snippet Was Succ
COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST="The url (%s) set to retrieve the packages does not exist!"
COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading"
COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_OTHER_AREAS_OF_JCB_AT_THIS_TIME="This %s is not linked to any other areas of JCB at this time!"
+COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_CHECKSUM_VALIDATION_PLEASE_VALIDATE_THIS_CHECKSUM_BSB_TO_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA="This package PASSED checksum validation! Please validate this checksum: %s to be the same as the one found @ "
COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY="This package has no key."
COM_COMPONENTBUILDER_TITLE="Title"
COM_COMPONENTBUILDER_TOTAL_DOWNLOADS="total downloads"
@@ -6342,6 +6351,7 @@ COM_COMPONENTBUILDER_WEBSITE="Website"
COM_COMPONENTBUILDER_WEBSITE_S="Website: %s"
COM_COMPONENTBUILDER_WE_DID_NOT_CHECK_THE_SNIPPET_IT_SELF_TO_SEE_IF_IT_CHANGED_WE_ONLY_WORK_ON_DATES="We did not check the snippet it self, to see if it changed. We only work on dates."
COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB="We failed to move %s!"
+COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB="We successfully moved %s!"
COM_COMPONENTBUILDER_YES="Yes"
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="Your data is encrypted with a AES 128 bit encryption using the above 32 character key.
Without this key it will take the current technology with a brute force attack method more then 700 000 000 000 000 000 000 000 000 000 000 years to crack theoretically."
COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_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_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE="Your data is encrypted with a AES 128 bit encryption using the above 32 character key. Without this key it will take the current technology with a brute force attack method more then 700 000 000 000 000 000 000 000 000 000 000 years to crack theoretically. Unless they have this key above, so do keep it safe."
diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini
index 4c001d1ce..43cb5b05c 100644
--- a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini
+++ b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini
@@ -696,8 +696,6 @@ COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE="Snippets Batch Use"
COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch snippets"
COM_COMPONENTBUILDER_SNIPPETS_CREATE="Snippets Create"
COM_COMPONENTBUILDER_SNIPPETS_CREATE_DESC="Allows the users in this group to create create snippets"
-COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_ADD="Snippets Dashboard Add"
-COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the snippet"
COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST="Snippets Dashboard List"
COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the snippet"
COM_COMPONENTBUILDER_SNIPPETS_DELETE="Snippets Delete"
diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php
index 932c065e9..edec1b78e 100644
--- a/admin/models/componentbuilder.php
+++ b/admin/models/componentbuilder.php
@@ -43,7 +43,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
$icons = array();
// view groups array
$viewGroups = array(
- 'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippet.add', 'png.snippets', 'png||getsnippets||index.php?option=com_componentbuilder&view=get_snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_document.add', 'png.help_documents')
+ 'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippets', 'png||getsnippets||index.php?option=com_componentbuilder&view=get_snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_document.add', 'png.help_documents')
);
// view access array
$viewAccess = array(
@@ -101,7 +101,6 @@ class ComponentbuilderModelComponentbuilder extends JModelList
'snippet.access' => 'snippet.access',
'snippets.submenu' => 'snippet.submenu',
'snippets.dashboard_list' => 'snippet.dashboard_list',
- 'snippet.dashboard_add' => 'snippet.dashboard_add',
'field.create' => 'field.create',
'fields.access' => 'field.access',
'field.access' => 'field.access',
diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php
index de71c6545..7d5558c76 100644
--- a/admin/models/import_joomla_components.php
+++ b/admin/models/import_joomla_components.php
@@ -93,6 +93,8 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
protected $fieldTypes = array();
protected $isMultiple = array();
protected $specialValue = false;
+ protected $checksum = null;
+ protected $checksumURLs = array('vdm' => 'https://raw.githubusercontent.com/vdm-io/JCB-Packages/master/');
/**
* Import an spreadsheet from either folder, url or upload.
@@ -102,24 +104,30 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
*/
public function import()
{
+ // set the state to import
$this->setState('action', 'import');
- $this->app = JFactory::getApplication();
- $session = JFactory::getSession();
- $package = null;
- $continue = false;
+ // get App
+ $this->app = JFactory::getApplication();
+ // get session
+ $session = JFactory::getSession();
+ // some defaults
+ $package = null;
+ $continue = false;
// get import type
- $this->getType = $this->app->input->getString('gettype', NULL);
+ $this->getType = $this->app->input->getString('gettype', NULL);
+ // do checksum validation
+ $this->checksum = $this->app->input->getString('checksum', NULL);
// get import type
- $this->getType = $this->app->input->getString('gettype', NULL);
- // get import type
- $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL);
-
+ $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL);
+ // if we have no package
if ($package === null)
{
+ // we must allow unsafe with smart import since it is code being imported.
if ($this->dataType === 'smart_package')
{
$this->allow_unsafe = true;
}
+ // action based on get Type
switch ($this->getType)
{
case 'folder':
@@ -136,7 +144,6 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$package = $this->_getPackageFromUrl();
break;
- case 'continue-basic':
case 'continue-ext':
$continue = true;
$package = $session->get('package', null);
@@ -149,7 +156,39 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
break;
default:
- $this->app->setUserState('com_componentbuilder.message', JText::_('COM_COMPONENTBUILDER_IMPORT_NO_IMPORT_TYPE_FOUND'));
+ $package = $session->get('package', null);
+ if (ComponentbuilderHelper::checkJson($package))
+ {
+ // get package
+ $package = json_decode($package, true);
+ // remove zip file
+ if (isset($package['packagename']))
+ {
+ $this->remove($package['packagename']);
+ }
+ // check if dir is set
+ if (isset($package['dir']))
+ {
+ // set auto loader
+ ComponentbuilderHelper::autoLoader('smart');
+ // get install folder
+ $dir = JFile::stripExt($package['dir']);
+ // remove unziped folder
+ ComponentbuilderHelper::removeFolder($dir);
+ }
+ }
+ // clear session
+ $session->clear('package');
+ $session->clear('dataType');
+ $session->clear('hasPackage');
+ $session->clear('smart_package_info');
+ $back = $session->get('backto_VDM_IMPORT', NULL);
+ $session->clear('backto_VDM_IMPORT');
+ if ($back)
+ {
+ $this->app->setUserState('com_componentbuilder.redirect_url', 'index.php?option=com_componentbuilder&view='.$back);
+ }
+ $session->clear('backto_VDM_IMPORT');
return false;
break;
}
@@ -170,35 +209,28 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
if(!$continue)
{
// check if this a smart package, if true then get info
- if ($this->dataType === 'smart_package')
+ if ($this->dataType !== 'smart_package' || !$this->getInfo($package, $session))
{
- $this->getInfo($package, $session);
+ $this->app->setUserState('com_componentbuilder.message', JText::_('COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_GETTING_THE_PACKAGE_INFO'));
+ return false;
}
- $package = json_encode($package);
+ // set package to session
+ $package = json_encode($package);
$session->set('package', $package);
$session->set('dataType', $this->dataType);
$session->set('hasPackage', true);
return true;
}
-
- // set the data
- if ('continue-basic' == $this->getType)
- {
- $headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true);
- }
- else
- {
- $headerList = null;
- // force update
- $this->forceUpdate = $this->app->input->getInt('force_update', 0);
- // show more information
- $this->moreInfo = $this->app->input->getInt('more_info', 0);
- // has a key
- $this->hasKey = $this->app->input->getInt('haskey', 0);
- // die sleutle
- $this->sleutle = $this->app->input->getString('sleutle', NULL);
- }
- if (!$this->setData($package, $headerList))
+ // force update
+ $this->forceUpdate = $this->app->input->getInt('force_update', 0);
+ // show more information
+ $this->moreInfo = $this->app->input->getInt('more_info', 0);
+ // has a key
+ $this->hasKey = $this->app->input->getInt('haskey', 0);
+ // die sleutle
+ $this->sleutle = $this->app->input->getString('sleutle', NULL);
+ // try to store/set data
+ if (!$this->setData($package))
{
// There was an error importing the package
$msg = JText::_('COM_COMPONENTBUILDER_IMPORT_ERROR');
@@ -219,8 +251,8 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$back = $session->get('backto_VDM_IMPORT', NULL);
if ($back)
{
- $this->app->setUserState('com_componentbuilder.redirect_url', 'index.php?option=com_componentbuilder&view='.$back);
- $session->clear('backto_VDM_IMPORT');
+ $this->app->setUserState('com_componentbuilder.redirect_url', 'index.php?option=com_componentbuilder&view='.$back);
+ $session->clear('backto_VDM_IMPORT');
}
$result = true;
}
@@ -230,7 +262,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// remove file after import
$this->remove($package['packagename']);
- $session->clear($this->getType.'_VDM_IMPORTHEADERS');
+
return $result;
}
@@ -244,6 +276,49 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// extract the package
if (JFile::exists($package['dir']))
{
+ // does this package pass a checksum
+ $checksum = false;
+ $checksumStatus = 'warning';
+ $checksumMessage = JText::_('COM_COMPONENTBUILDER_PLEASE_NOTE_THAT_THIS_PACKAGE_BHAS_NOB_CHECKSUM_VALIDATION');
+ // do hash validation here for git repos
+ if (ComponentbuilderHelper::checkString($this->checksum) && isset($this->checksumURLs[$this->checksum]))
+ {
+ // get packages checksums
+ $checksums = ComponentbuilderHelper::getFileContents($this->checksumURLs[$this->checksum].'checksum.json');
+ if (ComponentbuilderHelper::checkJson($checksums))
+ {
+ // convert to array
+ $checksums = json_decode($checksums, true);
+ // get package name
+ $packageName = basename($package['dir']);
+ // check if package is found
+ if (isset($checksums[$packageName]))
+ {
+ // validate checksum
+ if ($checksums[$packageName] === sha1_file($package['dir']))
+ {
+ $validator = $this->checksumURLs[$this->checksum].str_replace('.zip', '.sha', $packageName);
+ $checksumMessage = JText::sprintf('COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_CHECKSUM_VALIDATION_PLEASE_VALIDATE_THIS_CHECKSUM_BSB_TO_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA', $checksums[$packageName], 'href="'.$validator.'" target="_blank" title="verify checksum">', $validator);
+ $checksumStatus = 'Success';
+ $checksum = true;
+ }
+ }
+ // set error
+ if (!$checksum)
+ {
+ $checksumMessage = JText::_('COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_THIS_PACKAGE_BFAILEDB_CHECKSUM_VALIDATION_THIS_COULD_BE_A_SERIOUS_SECURITY_BREACH_DO_NOT_CONTINUE');
+ $checksumStatus = 'error';
+ }
+ }
+ // set error
+ else
+ {
+ $checksumMessage = JText::_('COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_WE_COULD_NOT_LOAD_THE_CHECKSUM_FOR_THIS_PACKAGE_AND_SO_NO_VALIDATION_WAS_POSSIBLE_THIS_MAY_BE_DUE_TO_YOUR_NETWORK_OR_A_CHANGE_TO_THAT_PACKAGE_NAME');
+ $checksumStatus = 'error';
+ }
+ }
+ // do not have check sum validation
+ $this->app->enqueueMessage($checksumMessage, $checksumStatus);
// get the zip adapter
$zip = JArchive::getAdapter('zip');
// set the directory name
@@ -469,11 +544,6 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// check the extension
switch(strtolower(pathinfo($file, PATHINFO_EXTENSION)))
{
- case 'xls':
- case 'ods':
- case 'csv':
- return true;
- break;
case 'zip':
if ($this->dataType === 'smart_package')
{
@@ -519,32 +589,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
* @return boolean false on failure
*
**/
- protected function setData($package, $target_headers)
+ protected function setData($package)
{
$jinput = JFactory::getApplication()->input;
// set the data based on the type of import being done
- if ('continue-basic' === $this->getType && ComponentbuilderHelper::checkArray($target_headers))
- {
- foreach($target_headers as $header)
- {
- $data['target_headers'][$header] = $jinput->getString($header, null);
- }
- // make sure the file is loaded
- JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
- // set the data
- if(isset($package['dir']))
- {
- $inputFileType = PHPExcel_IOFactory::identify($package['dir']);
- $excelReader = PHPExcel_IOFactory::createReader($inputFileType);
- $excelReader->setReadDataOnly(true);
- $excelObj = $excelReader->load($package['dir']);
- $data['array'] = $excelObj->getActiveSheet()->toArray(null, true,true,true);
- $excelObj->disconnectWorksheets();
- unset($excelObj);
- return $this->saveBasic($data);
- }
- }
- elseif ('continue-ext' === $this->getType)
+ if ('continue-ext' === $this->getType)
{
// set the data
if(isset($package['dir']))
@@ -685,14 +734,13 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
**/
protected function saveSmartItems($table)
{
- $success = true;
if (isset($this->data[$table]) && ComponentbuilderHelper::checkArray($this->data[$table]))
{
// get global action permissions
- $canDo = ComponentbuilderHelper::getActions($table);
- $canEdit = $canDo->get('core.edit');
- $canState = $canDo->get('core.edit.state');
- $canCreate = $canDo->get('core.create');
+ $canDo = ComponentbuilderHelper::getActions($table);
+ $canEdit = $canDo->get('core.edit');
+ $canState = $canDo->get('core.edit.state');
+ $canCreate = $canDo->get('core.create');
// set id keeper
if (!isset($this->newID[$table]))
{
@@ -770,7 +818,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
}
}
- return $success;
+ return true;
}
/**
@@ -799,6 +847,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVE_TO_CORRECT_LOCATION'), 'error');
$success = false;
}
+ // display more import info
+ elseif ($this->moreInfo)
+ {
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_SOME_BCUSTOM_FILESB_WERE_MOVED_TO_BSB', $customPath), 'success');
+ }
}
// check if we have images
$imageDir = str_replace('//', '/', $this->dir . '/images');
@@ -810,6 +863,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVE_TO_CORRECT_LOCATION'), 'error');
$success = false;
}
+ // display more import info
+ elseif ($this->moreInfo)
+ {
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_SOME_BIMAGESB_WERE_MOVED_TO_BSB', $imagesPath), 'success');
+ }
}
// now move the dynamic files if found
$dynamicDir = str_replace('//', '/', $this->dir . '/dynamic');
@@ -826,9 +884,14 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$fullPath = str_replace('//', '/', $dynamicDir . '/' . $folder);
if (!JFolder::exists($fullPath) || !JFolder::copy($fullPath, $destination,'',true))
{
- $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_S', $folder, $destination), 'error');
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_BSB', $folder, $destination), 'error');
$success = false;
}
+ // display more import info
+ elseif ($this->moreInfo)
+ {
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB', $folder, $destination), 'success');
+ }
}
}
// get a list of files
@@ -842,9 +905,14 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$fullPath = str_replace('//', '/', $dynamicDir . '/' . $file);
if (!JFile::exists($fullPath) || !JFile::copy($fullPath, $destination))
{
- $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVE_TO_S', $file, $destination), 'error');
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVE_TO_BSB', $file, $destination), 'error');
$success = false;
}
+ // display more import info
+ elseif ($this->moreInfo)
+ {
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_MOVED_TO_BSB', $file, $destination), 'success');
+ }
}
}
}
@@ -902,7 +970,13 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// write the decrypted data back to file
if (!ComponentbuilderHelper::writeFile($file, rtrim($unlocker->decryptString($data), "\0")))
{
- // we should add error handler here in case file could not be unlocked
+ // in case file could not be unlocked
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED', $file), 'error');
+ }
+ // display more import info
+ elseif ($this->moreInfo)
+ {
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_SUCCESSFULLY_UNLOCKED', $file), 'success');
}
}
@@ -1978,6 +2052,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// add the data to the mover
$this->divergedDataMover[$table][$uniqueKey]->{$type} = $values;
+ // display more import info
+ if ($this->moreInfo)
+ {
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB', ComponentbuilderHelper::safeString($type, 'Ww') . ' to ('.ComponentbuilderHelper::safeString($table, 'w').')'), 'success');
+ }
// success
return true;
}
@@ -2442,223 +2521,6 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
return false;
}
- /**
- * Save the data from the file to the database
- *
- * @param array $data The values to save
- *
- * @return boolean false on failure
- *
- **/
- protected function saveBasic($data)
- {
- // import the data if there is any
- if(ComponentbuilderHelper::checkArray($data['array']))
- {
- // get user object
- $this->user = JFactory::getUser();
- // remove header if it has headers
- $id_key = $data['target_headers']['id'];
- $published_key = $data['target_headers']['published'];
- $ordering_key = $data['target_headers']['ordering'];
- // get the first array set
- $firstSet = reset($data['array']);
-
- // check if first array is a header array and remove if true
- if($firstSet[$id_key] == 'id' || $firstSet[$published_key] == 'published' || $firstSet[$ordering_key] == 'ordering')
- {
- array_shift($data['array']);
- }
-
- // make sure there is still values in array and that it was not only headers
- if(ComponentbuilderHelper::checkArray($data['array']) && $this->user->authorise($this->dataType.'.import', 'com_componentbuilder') && $this->user->authorise('core.import', 'com_componentbuilder'))
- {
- // set target.
- $target = array_flip($data['target_headers']);
- // set some defaults
- $todayDate = JFactory::getDate()->toSql();
- // get global action permissions
- $canDo = ComponentbuilderHelper::getActions($this->dataType);
- $canEdit = $canDo->get('core.edit');
- $canState = $canDo->get('core.edit.state');
- $canCreate = $canDo->get('core.create');
- $hasAlias = $this->getAliasesUsed($this->dataType);
- // prosses the data
- foreach($data['array'] as $row)
- {
- $found = false;
- if (isset($row[$id_key]) && is_numeric($row[$id_key]) && $row[$id_key] > 0)
- {
- // raw items import & update!
- $query = $this->_db->getQuery(true);
- $query
- ->select('version')
- ->from($this->_db->quoteName('#__componentbuilder_'.$this->dataType))
- ->where($this->_db->quoteName('id') . ' = '. $this->_db->quote($row[$id_key]));
- // Reset the query using our newly populated query object.
- $this->_db->setQuery($query);
- $this->_db->execute();
- $found = $this->_db->getNumRows();
- }
-
- if($found && $canEdit)
- {
- // update item
- $id = $row[$id_key];
- $version = $this->_db->loadResult();
- // reset all buckets
- $query = $this->_db->getQuery(true);
- $fields = array();
- // Fields to update.
- foreach($row as $key => $cell)
- {
- // ignore column
- if ('IGNORE' == $target[$key])
- {
- continue;
- }
- // update modified
- if ('modified_by' == $target[$key])
- {
- continue;
- }
- // update modified
- if ('modified' == $target[$key])
- {
- continue;
- }
- // update version
- if ('version' == $target[$key])
- {
- $cell = (int) $version + 1;
- }
- // verify publish authority
- if ('published' == $target[$key] && !$canState)
- {
- continue;
- }
- // set to update array
- if(in_array($key, $data['target_headers']) && is_numeric($cell))
- {
- $fields[] = $this->_db->quoteName($target[$key]) . ' = ' . $cell;
- }
- elseif(in_array($key, $data['target_headers']) && is_string($cell))
- {
- $fields[] = $this->_db->quoteName($target[$key]) . ' = ' . $this->_db->quote($cell);
- }
- elseif(in_array($key, $data['target_headers']) && is_null($cell))
- {
- // if import data is null then set empty
- $fields[] = $this->_db->quoteName($target[$key]) . " = ''";
- }
- }
- // load the defaults
- $fields[] = $this->_db->quoteName('modified_by') . ' = ' . $this->_db->quote($this->user->id);
- $fields[] = $this->_db->quoteName('modified') . ' = ' . $this->_db->quote($todayDate);
- // Conditions for which records should be updated.
- $conditions = array(
- $this->_db->quoteName('id') . ' = ' . $id
- );
- $query->update($this->_db->quoteName('#__componentbuilder_' . $this->dataType))->set($fields)->where($conditions);
- $this->_db->setQuery($query);
- $this->_db->execute();
- }
- elseif ($canCreate)
- {
- // insert item
- $query = $this->_db->getQuery(true);
- // reset all buckets
- $columns = array();
- $values = array();
- $version = false;
- // Insert columns. Insert values.
- foreach($row as $key => $cell)
- {
- // ignore column
- if ('IGNORE' == $target[$key])
- {
- continue;
- }
- // remove id
- if ('id' == $target[$key])
- {
- continue;
- }
- // update created
- if ('created_by' == $target[$key])
- {
- continue;
- }
- // update created
- if ('created' == $target[$key])
- {
- continue;
- }
- // Make sure the alias is incremented
- if ('alias' == $target[$key])
- {
- $cell = $this->getAlias($cell,$this->dataType);
- }
- // update version
- if ('version' == $target[$key])
- {
- $cell = 1;
- $version = true;
- }
- // set to insert array
- if(in_array($key, $data['target_headers']) && is_numeric($cell))
- {
- $columns[] = $target[$key];
- $values[] = $cell;
- }
- elseif(in_array($key, $data['target_headers']) && is_string($cell))
- {
- $columns[] = $target[$key];
- $values[] = $this->_db->quote($cell);
- }
- elseif(in_array($key, $data['target_headers']) && is_null($cell))
- {
- // if import data is null then set empty
- $columns[] = $target[$key];
- $values[] = "''";
- }
- }
- // load the defaults
- $columns[] = 'created_by';
- $values[] = $this->_db->quote($this->user->id);
- $columns[] = 'created';
- $values[] = $this->_db->quote($todayDate);
- if (!$version)
- {
- $columns[] = 'version';
- $values[] = 1;
- }
- // Prepare the insert query.
- $query
- ->insert($this->_db->quoteName('#__componentbuilder_'.$this->dataType))
- ->columns($this->_db->quoteName($columns))
- ->values(implode(',', $values));
- // Set the query using our newly populated query object and execute it.
- $this->_db->setQuery($query);
- $done = $this->_db->execute();
- if ($done)
- {
- $aId = $this->_db->insertid();
- // make sure the access of asset is set
- ComponentbuilderHelper::setAsset($aId,$this->dataType);
- }
- }
- else
- {
- return false;
- }
- }
- return true;
- }
- }
- return false;
- }
-
/**
* Update constant path with real full path value
*
diff --git a/admin/views/import_joomla_components/tmpl/default.php b/admin/views/import_joomla_components/tmpl/default.php
index b1fd6c283..af8eb6dc5 100644
--- a/admin/views/import_joomla_components/tmpl/default.php
+++ b/admin/views/import_joomla_components/tmpl/default.php
@@ -32,48 +32,20 @@ JHtml::_('script', 'system/core.js', false, true);
JHtml::_('behavior.keepalive');
?>
-dataType === 'smart_package') ? '.zip' : '.csv .xls .ods'; ?>
+dataType === 'smart_package') ? '.zip' : 'none'; ?>