Fixed the JCB package import url inclusion limitation.

This commit is contained in:
Llewellyn van der Merwe 2022-06-02 14:05:34 +02:00
parent f0cdf086d4
commit 9f04566c81
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
13 changed files with 88 additions and 72 deletions

View File

@ -12,7 +12,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 save 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.13.0) 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.13.1) 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)
@ -143,11 +143,11 @@ TODO
+ *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*: 27th May, 2022
+ *Version*: 2.13.0
+ *Last Build*: 2nd June, 2022
+ *Version*: 2.13.1
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **287273**
+ *Line count*: **287278**
+ *Field count*: **1581**
+ *File count*: **1853**
+ *Folder count*: **261**

View File

@ -12,7 +12,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 save 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.13.0) 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.13.1) 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)
@ -143,11 +143,11 @@ TODO
+ *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*: 27th May, 2022
+ *Version*: 2.13.0
+ *Last Build*: 2nd June, 2022
+ *Version*: 2.13.1
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **287273**
+ *Line count*: **287278**
+ *Field count*: **1581**
+ *File count*: **1853**
+ *Folder count*: **261**

View File

@ -257,10 +257,10 @@ class ComponentbuilderControllerAjax extends BaseController
case 'getJCBpackageInfo':
try
{
$urlValue = $jinput->get('url', NULL, 'STRING');
if($urlValue && $user->id != 0)
$packageValue = $jinput->get('package', NULL, 'BASE64');
if($packageValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getJCBpackageInfo($urlValue);
$result = $this->getModel('ajax')->getJCBpackageInfo($packageValue);
}
else
{

View File

@ -508,6 +508,8 @@ class Structure extends Get
$power->path
))
{
// activate dynamic folders
$this->setDynamicFolders();
// power path
$power->full_path = $this->componentPath . '/'
. $power->path;
@ -2257,23 +2259,8 @@ class Structure extends Get
&& StringHelper::check($checker[0])
&& !in_array($checker[0], $this->stdFolders))
{
// check if we should add the dynamic folder moving script to the installer script
if (!$this->setMoveFolders)
{
// add the setDynamicF0ld3rs() method to the install scipt.php file
$this->setMoveFolders = true;
// set message that this was done (will still add a tutorial link later)
$this->app->enqueueMessage(
JText::_(
'<hr /><h3>Dynamic folder(s) were detected.</h3>'
), 'Notice'
);
$this->app->enqueueMessage(
JText::sprintf(
'A method (setDynamicF0ld3rs) was added to the install <b>script.php</b> of this package to insure that the folder(s) are copied into the correct place when this component is installed!'
), 'Notice'
);
}
// activate dynamic folders
$this->setDynamicFolders();
}
elseif (count((array) $checker) == 2
&& StringHelper::check($checker[0]))
@ -3207,6 +3194,30 @@ class Structure extends Get
return $version_data;
}
/**
* Add the dynamic folders
*/
protected function setDynamicFolders()
{
// check if we should add the dynamic folder moving script to the installer script
if (!$this->setMoveFolders)
{
// add the setDynamicF0ld3rs() method to the install scipt.php file
$this->setMoveFolders = true;
// set message that this was done (will still add a tutorial link later)
$this->app->enqueueMessage(
JText::_(
'<hr /><h3>Dynamic folder(s) were detected.</h3>'
), 'Notice'
);
$this->app->enqueueMessage(
JText::sprintf(
'A method (setDynamicF0ld3rs) was added to the install <b>script.php</b> of this package to insure that the folder(s) are copied into the correct place when this component is installed!'
), 'Notice'
);
}
}
/**
* set the index.html file in a folder path
*

View File

@ -159,9 +159,10 @@ class ComponentbuilderModelAjax extends ListModel
/**
* get the JCB package info (html)
**/
public function getJCBpackageInfo($url)
public function getJCBpackageInfo($package)
{
// convert URL
$url = base64_decode($package);
$url = str_replace('.zip', '.info', $url);
// check if url exist
if ($info = ComponentbuilderHelper::getFileContents($url, false))
@ -199,7 +200,7 @@ class ComponentbuilderModelAjax extends ListModel
// check if we have json
if ($opened && ComponentbuilderHelper::checkJson($_info))
{
$info = json_decode($info, true);
$info = json_decode($_info, true);
return array('owner' => ComponentbuilderHelper::getPackageOwnerDetailsDisplay($info, true), 'packages' => ComponentbuilderHelper::getPackageComponentsDetailsDisplay($info));
}
}

View File

@ -143,6 +143,11 @@ class ComponentbuilderModelImport_joomla_components extends BaseDatabaseModel
break;
case 'url':
$url = JFactory::getApplication()->input->getString('import_url');
if ($url === base64_encode(base64_decode($url, true)))
{
JFactory::getApplication()->input->set('import_url', base64_decode($url));
}
$package = $this->_getPackageFromUrl();
break;

File diff suppressed because one or more lines are too long

View File

@ -360,16 +360,16 @@ jQuery(document).ready(function($)
// get all jcb packages
jQuery("#jcb_package option").each(function()
{
var key = jQuery(this).val();
packages[key] = 'jcb';
var package = jQuery(this).val();
packages[package] = 'jcb';
});
<?php endif; ?>
<?php if (isset($this->vdmPackages) && $this->vdmPackages && ComponentbuilderHelper::checkArray($this->vdmPackages)): ?>
// get all vdm packages
jQuery("#vdm_package option").each(function()
{
var key = jQuery(this).val();
packages[key] = 'vdm';
var package = jQuery(this).val();
packages[package] = 'vdm';
});
<?php endif; ?>
// no start behind the scene getting of package info
@ -377,20 +377,19 @@ jQuery(document).ready(function($)
});
function autoJCBpackageInfo(){
jQuery.each( packages, function( url, type ) {
var key = url.replace(/\W/g, '');
jQuery.each( packages, function( package, type ) {
// check if the values are local
var result = jQuery.jStorage.get('JCB-packages-details'+key, null);
if (!result && url.length > 0) {
autoJCBpackageInfoAgain(url, key, type);
var result = jQuery.jStorage.get('JCB-packages-details' + package, null);
if (!result && package.length > 0) {
autoJCBpackageInfoAgain(package, type);
}
});
}
function autoJCBpackageInfoAgain(url, key,type){
getJCBpackageInfo_server(url).done(function(result) {
function autoJCBpackageInfoAgain(package, type){
getJCBpackageInfo_server(package).done(function(result) {
if(result.owner || result.packages){
jQuery.jStorage.set('JCB-packages-details'+key, result, {TTL: expire});
jQuery.jStorage.set('JCB-packages-details' + package, result, {TTL: expire});
}
});
}
@ -401,15 +400,14 @@ function getJCBpackageInfo(type){
jQuery('#noticeboard').show();
jQuery('#installer-import').hide();
// get value
var url = jQuery('#'+type+'_package').val();
if (url) {
var key = url.replace(/\W/g, '');
var package = jQuery('#'+type+'_package').val();
if (package) {
// check if the values are local
var result = jQuery.jStorage.get('JCB-packages-details'+key, null);
var result = jQuery.jStorage.get('JCB-packages-details'+package, null);
if (result) {
showJCBpackageInfo(result, key, type);
showJCBpackageInfo(result, package, type);
} else {
getJCBpackageInfoAgain(url, key, type);
getJCBpackageInfoAgain(package, type);
}
} else {
// hide spinner
@ -424,17 +422,17 @@ function getJCBpackageInfo(type){
}
}
function getJCBpackageInfoAgain(url, key,type){
getJCBpackageInfo_server(url).done(function(result) {
showJCBpackageInfo(result, key,type);
function getJCBpackageInfoAgain(package, type){
getJCBpackageInfo_server(package).done(function(result) {
showJCBpackageInfo(result, package, type);
});
}
function showJCBpackageInfo(result, key,type){
function showJCBpackageInfo(result, package, type){
if(result.owner || result.packages){
jQuery('#'+type+'_packages_details').html(result.packages);
jQuery('#'+type+'_package_owner_details').html(result.owner);
jQuery.jStorage.set('JCB-packages-details'+key, result, {TTL: expire});
jQuery.jStorage.set('JCB-packages-details'+package, result, {TTL: expire});
// some display moves
jQuery('#'+type+'_packages_installer').removeClass('span12').addClass('span6');
jQuery('#'+type+'_packages_display').addClass('span6');
@ -454,10 +452,10 @@ function showJCBpackageInfo(result, key,type){
jQuery('#installer-import').show();
}
function getJCBpackageInfo_server(url){
function getJCBpackageInfo_server(package){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getJCBpackageInfo&format=json";
if(token.length > 0 && url.length > 0){
var request = 'token='+token+'&url=' + url;
if(token.length > 0 && package.length > 0){
var request = token + '=1&package=' + package;
}
return jQuery.ajax({
type: 'GET',
@ -475,7 +473,7 @@ jQuery(document).ready(function () {
jQuery.get(noticeboard)
.success(function(board) {
if (board.length > 5) {
jQuery(".noticeboard-md").html(marked(board));
jQuery(".noticeboard-md").html(marked.parse(board));
getIS(1,board).done(function(result) {
if (result){
jQuery(".vdm-new-notice").show();

View File

@ -57,7 +57,7 @@ class ComponentbuilderViewImport_joomla_components extends HtmlView
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
// add title to the page
JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_JCB_PACKAGE_IMPORT'),'upload');
JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_JCB_PACKAGE_IMPORT'), 'upload');
// add refesh button.
JToolBarHelper::custom('joomla_component.refresh', 'refresh', '', 'COM_COMPONENTBUILDER_REFRESH', false);
}
@ -75,7 +75,7 @@ class ComponentbuilderViewImport_joomla_components extends HtmlView
$manageDirectories = $this->params->get('manage_jcb_package_directories', 2);
if ($manageDirectories == 2)
{
$this->directories = array('vdm','jcb');
$this->directories = array('vdm', 'jcb');
}
elseif ($manageDirectories == 1)
{
@ -122,7 +122,7 @@ class ComponentbuilderViewImport_joomla_components extends HtmlView
$this->document->addScript(JURI::root() .'media/com_componentbuilder/js/jstorage.min.js');
$this->document->addScript(JURI::root() .'media/com_componentbuilder/js/strtotime.js');
// add marked library
$this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/custom/marked.js");
$this->document->addScript(JURI::root() . "media/com_componentbuilder/js/marked.js");
// check if we should use browser storage
$setBrowserStorage = $this->params->get('set_browser_storage', null);
if ($setBrowserStorage)
@ -369,7 +369,7 @@ class ComponentbuilderViewImport_joomla_components extends HtmlView
{
if (strpos($vdmListObject->path, '.zip') !== false)
{
$vdm_packageOptions[ComponentbuilderHelper::$vdmGithubPackageUrl.$vdmListObject->path] = $this->setPackageName($vdmListObject->path);
$vdm_packageOptions[base64_encode(ComponentbuilderHelper::$vdmGithubPackageUrl.$vdmListObject->path)] = $this->setPackageName($vdmListObject->path);
$load = true;
}
}
@ -413,7 +413,7 @@ class ComponentbuilderViewImport_joomla_components extends HtmlView
{
if (strpos($jcbListObject->path, '.zip') !== false)
{
$jcb_packageOptions[ComponentbuilderHelper::$jcbGithubPackageUrl.$jcbListObject->path] = $this->setPackageName($jcbListObject->path);
$jcb_packageOptions[base64_encode(ComponentbuilderHelper::$jcbGithubPackageUrl.$jcbListObject->path)] = $this->setPackageName($jcbListObject->path);
$load = true;
}
}

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>27th May, 2022</creationDate>
<creationDate>2nd June, 2022</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>2.13.0</version>
<version>2.13.1</version>
<description><![CDATA[
<h1>Component Builder (v.2.13.0)</h1>
<h1>Component Builder (v.2.13.1)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.

View File

@ -1058,10 +1058,10 @@
<description>Builds Complex Joomla Components</description>
<element>com_componentbuilder</element>
<type>component</type>
<version>2.13.0</version>
<version>2.13.1</version>
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.13.0/JCB_v2.13.0.zip</downloadurl>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.13.1/JCB_v2.13.1.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>

View File

@ -109,7 +109,7 @@ abstract class StringHelper
{
if ($replaceNumbers === true)
{
// remove all numbers and replace with english text version (works well only up to millions)
// remove all numbers and replace with English text version (works well only up to millions)
$string = self::numbers($string);
}
// 0nly continue if we have a string

View File

@ -9254,7 +9254,7 @@ class com_componentbuilderInstallerScript
echo '<a target="_blank" href="http://www.joomlacomponentbuilder.com" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 2.13.0 Was Successful! Let us know if anything is not working as expected.</h3>';
<h3>Upgrade to Version 2.13.1 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already.
if (!isset($db))