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 untrusted user: 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! 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) > 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) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 27th May, 2022 + *Last Build*: 2nd June, 2022
+ *Version*: 2.13.0 + *Version*: 2.13.1
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **287273** + *Line count*: **287278**
+ *Field count*: **1581** + *Field count*: **1581**
+ *File count*: **1853** + *File count*: **1853**
+ *Folder count*: **261** + *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! 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) > 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) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 27th May, 2022 + *Last Build*: 2nd June, 2022
+ *Version*: 2.13.0 + *Version*: 2.13.1
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **287273** + *Line count*: **287278**
+ *Field count*: **1581** + *Field count*: **1581**
+ *File count*: **1853** + *File count*: **1853**
+ *Folder count*: **261** + *Folder count*: **261**

View File

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

View File

@ -508,6 +508,8 @@ class Structure extends Get
$power->path $power->path
)) ))
{ {
// activate dynamic folders
$this->setDynamicFolders();
// power path // power path
$power->full_path = $this->componentPath . '/' $power->full_path = $this->componentPath . '/'
. $power->path; . $power->path;
@ -2257,23 +2259,8 @@ class Structure extends Get
&& StringHelper::check($checker[0]) && StringHelper::check($checker[0])
&& !in_array($checker[0], $this->stdFolders)) && !in_array($checker[0], $this->stdFolders))
{ {
// check if we should add the dynamic folder moving script to the installer script // activate dynamic folders
if (!$this->setMoveFolders) $this->setDynamicFolders();
{
// 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'
);
}
} }
elseif (count((array) $checker) == 2 elseif (count((array) $checker) == 2
&& StringHelper::check($checker[0])) && StringHelper::check($checker[0]))
@ -3207,6 +3194,30 @@ class Structure extends Get
return $version_data; 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 * 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) * get the JCB package info (html)
**/ **/
public function getJCBpackageInfo($url) public function getJCBpackageInfo($package)
{ {
// convert URL // convert URL
$url = base64_decode($package);
$url = str_replace('.zip', '.info', $url); $url = str_replace('.zip', '.info', $url);
// check if url exist // check if url exist
if ($info = ComponentbuilderHelper::getFileContents($url, false)) if ($info = ComponentbuilderHelper::getFileContents($url, false))
@ -199,7 +200,7 @@ class ComponentbuilderModelAjax extends ListModel
// check if we have json // check if we have json
if ($opened && ComponentbuilderHelper::checkJson($_info)) 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)); return array('owner' => ComponentbuilderHelper::getPackageOwnerDetailsDisplay($info, true), 'packages' => ComponentbuilderHelper::getPackageComponentsDetailsDisplay($info));
} }
} }

View File

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

View File

@ -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/jstorage.min.js');
$this->document->addScript(JURI::root() .'media/com_componentbuilder/js/strtotime.js'); $this->document->addScript(JURI::root() .'media/com_componentbuilder/js/strtotime.js');
// add marked library // 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 // check if we should use browser storage
$setBrowserStorage = $this->params->get('set_browser_storage', null); $setBrowserStorage = $this->params->get('set_browser_storage', null);
if ($setBrowserStorage) if ($setBrowserStorage)
@ -369,7 +369,7 @@ class ComponentbuilderViewImport_joomla_components extends HtmlView
{ {
if (strpos($vdmListObject->path, '.zip') !== false) 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; $load = true;
} }
} }
@ -413,7 +413,7 @@ class ComponentbuilderViewImport_joomla_components extends HtmlView
{ {
if (strpos($jcbListObject->path, '.zip') !== false) 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; $load = true;
} }
} }

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade"> <extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>27th May, 2022</creationDate> <creationDate>2nd June, 2022</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright> <copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license> <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[ <description><![CDATA[
<h1>Component Builder (v.2.13.0)</h1> <h1>Component Builder (v.2.13.1)</h1>
<div style="clear: both;"></div> <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. <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> <description>Builds Complex Joomla Components</description>
<element>com_componentbuilder</element> <element>com_componentbuilder</element>
<type>component</type> <type>component</type>
<version>2.13.0</version> <version>2.13.1</version>
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl> <infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
<downloads> <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> </downloads>
<tags> <tags>
<tag>stable</tag> <tag>stable</tag>

View File

@ -109,7 +109,7 @@ abstract class StringHelper
{ {
if ($replaceNumbers === true) 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); $string = self::numbers($string);
} }
// 0nly continue if we have a 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"> echo '<a target="_blank" href="http://www.joomlacomponentbuilder.com" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/> <img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a> </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. // Set db if not set already.
if (!isset($db)) if (!isset($db))