Added the community JCB package import option. Improved the jsonToString method to be more dynamic
This commit is contained in:
@ -116,6 +116,29 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the JCB package info (html)
|
||||
**/
|
||||
public function getJCBpackageInfo($url)
|
||||
{
|
||||
// convert URL
|
||||
$url = str_replace('.zip', '.info', $url);
|
||||
// check if url exist
|
||||
if ($info = ComponentbuilderHelper::getFileContents($url, false))
|
||||
{
|
||||
// Get the encryption object.
|
||||
$opener = new FOFEncryptAes('V4stD3vel0pmEntMethOd@YoUrS3rv!s', 128);
|
||||
$info = rtrim($opener->decryptString($info), "\0");
|
||||
// check if we have json
|
||||
if (ComponentbuilderHelper::checkJson($info))
|
||||
{
|
||||
$info = json_decode($info, true);
|
||||
return array('owner' => ComponentbuilderHelper::getPackageOwnerDetailsDisplay($info, true), 'packages' => ComponentbuilderHelper::getPackageComponentsDetailsDisplay($info));
|
||||
}
|
||||
}
|
||||
return array('error' => JText::_('COM_COMPONENTBUILDER_JCB_PACKAGE_INFO_PATH_DOES_NOT_WORK_WE_ADVICE_YOU_BNOT_TO_CONTINUEB_WITH_THE_IMPORT_OF_THE_SELECTED_PACKAGE'));
|
||||
}
|
||||
|
||||
/**
|
||||
* set the component display
|
||||
**/
|
||||
|
@ -97,7 +97,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
protected $isMultiple = array();
|
||||
protected $specialValue = false;
|
||||
protected $checksum = null;
|
||||
protected $checksumURLs = array('vdm' => 'https://raw.githubusercontent.com/vdm-io/JCB-Packages/master/');
|
||||
protected $checksumURLs = array('vdm' => 'https://raw.githubusercontent.com/vdm-io/JCB-Packages/master/', 'jcb' => 'https://raw.githubusercontent.com/vdm-io/JCB-Community-Packages/master/');
|
||||
protected $mustMerge = array('validation_rule', 'fieldtype', 'snippet', 'language', 'language_translation');
|
||||
|
||||
/**
|
||||
@ -682,7 +682,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$this->data = $data;
|
||||
return true;
|
||||
}
|
||||
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_KEY_ERROR_OR_BROKEN_PACKAGE'), 'error');
|
||||
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BKEY_ERRORB_OR_BROKEN_PACKAGE'), 'error');
|
||||
return false;
|
||||
}
|
||||
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BROKEN_PACKAGE'), 'error');
|
||||
|
Reference in New Issue
Block a user