fixed double // in file path when exporting a component and its images

This commit is contained in:
Llewellyn van der Merwe 2017-04-08 21:52:51 +01:00
parent 7afbb131ce
commit f39a877db2
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
22 changed files with 44 additions and 36 deletions

View File

@ -109,7 +109,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.4.2
+ *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*: **105836**
+ *Line count*: **105844**
+ *File count*: **639**
+ *Folder count*: **115**

View File

@ -109,7 +109,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.4.2
+ *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*: **105836**
+ *Line count*: **105844**
+ *File count*: **639**
+ *Folder count*: **115**

View File

@ -9,7 +9,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -9,7 +9,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -9,7 +9,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -731,24 +731,26 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// set params
$params = JComponentHelper::getParams('com_componentbuilder');
// set custom folder path
$customPath = $params->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom');
$imagesPath = JPATH_SITE . '/images';
$customPath = str_replace('//', '/', $params->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom'));
$imagesPath = str_replace('//', '/', JPATH_SITE . '/images');
$success = true;
// check if we have custom files
if (JFolder::exists($dir . '/custom'))
$customDir = str_replace('//', '/', $dir . '/custom');
if (JFolder::exists($customDir))
{
// great we have some custom stuff lets move it
if (!JFolder::copy($dir . '/custom', $customPath,'',true))
if (!JFolder::copy($customDir, $customPath,'',true))
{
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVE_TO_CORRECT_LOCATION'), 'error');
$success = false;
}
}
// check if we have images
if (JFolder::exists($dir . '/images'))
$imageDir = str_replace('//', '/', $dir . '/images');
if (JFolder::exists($imageDir))
{
// great we have some images lets move them
if (!JFolder::copy($dir . '/images', $imagesPath,'',true))
if (!JFolder::copy($imageDir, $imagesPath,'',true))
{
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVE_TO_CORRECT_LOCATION'), 'error');
$success = false;
@ -771,14 +773,14 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// we must first store the current working directory
$joomla = getcwd();
// setup the type path
$customPath = $dir . '/custom';
$customPath = str_replace('//', '/', $dir . '/custom');
// go to the custom folder if found
if (JFolder::exists($customPath))
{
$this->unlock($customPath, $unlocker);
}
// setup the type path
$imagesPath = $dir . '/images';
$imagesPath = str_replace('//', '/', $dir . '/images');
// go to the custom folder if found
if (JFolder::exists($imagesPath))
{

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder
@ -396,7 +396,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
$name = 'images';
}
// setup the type path
$tmpPath = $this->packagePath . '/' . $name;
$tmpPath = str_replace('//', '/', $this->packagePath . '/' . $name);
// create type path if not set
if (!JFolder::exists($tmpPath))
{
@ -410,26 +410,32 @@ class ComponentbuilderModelJoomla_components extends JModelList
{
if ('file' === $type)
{
if (!JFile::exists($tmpPath.'/'.$item) && JFile::exists($this->customPath.'/'.$item))
$tmpFilePath = str_replace('//', '/', $tmpPath.'/'.$item);
$customFilePath = str_replace('//', '/', $this->customPath.'/'.$item);
if (!JFile::exists($tmpFilePath) && JFile::exists($customFilePath))
{
// move the file to its place
JFile::copy($this->customPath.'/'.$item, $tmpPath.'/'.$item,'',true);
JFile::copy($customFilePath, $tmpFilePath,'',true);
}
}
if ('image' === $type)
{
if (!JFile::exists($this->packagePath.'/'.$item) && JFile::exists(JPATH_ROOT.'/'.$item))
$tmpImagePath = str_replace('//', '/', $this->packagePath.'/'.$item);
$customImagePath = str_replace('//', '/', JPATH_ROOT.'/'.$item);
if (!JFile::exists($tmpImagePath) && JFile::exists($customImagePath))
{
// move the file to its place
JFile::copy(JPATH_ROOT.'/'.$item, $this->packagePath.'/'.$item,'',true);
JFile::copy($customImagePath, $tmpImagePath,'',true);
}
}
if ('folder' === $type)
{
if (!JFolder::exists($tmpPath.'/'.$item) && JFolder::exists($this->customPath.'/'.$item))
$tmpFolderPath = str_replace('//', '/', $tmpPath.'/'.$item);
$customFolderPath = str_replace('//', '/', $this->customPath.'/'.$item);
if (!JFolder::exists($tmpFolderPath) && JFolder::exists($customFolderPath))
{
// move the folder to its place
JFolder::copy($this->customPath.'/'.$item, $tmpPath.'/'.$item,'',true);
JFolder::copy($customFolderPath, $tmpFolderPath,'',true);
}
}
}

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -9,7 +9,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 330 of this MVC
@version @update number 331 of this MVC
@build 8th April, 2017
@created 6th May, 2015
@package Component Builder