From f39a877db28d7ce8bf6cede2b6a4d4057c26a835 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sat, 8 Apr 2017 21:52:51 +0100 Subject: [PATCH] fixed double // in file path when exporting a component and its images --- README.md | 2 +- admin/README.txt | 2 +- admin/assets/css/joomla_component.css | 2 +- admin/assets/css/joomla_components.css | 2 +- admin/controllers/joomla_component.php | 2 +- admin/controllers/joomla_components.php | 2 +- admin/models/forms/joomla_component.js | 2 +- admin/models/import_joomla_components.php | 18 ++++++++------- admin/models/joomla_component.php | 2 +- admin/models/joomla_components.php | 22 ++++++++++++------- admin/tables/joomla_component.php | 2 +- admin/views/joomla_component/submitbutton.js | 2 +- admin/views/joomla_component/tmpl/edit.php | 2 +- admin/views/joomla_component/view.html.php | 2 +- .../views/joomla_components/tmpl/default.php | 2 +- .../tmpl/default_batch_body.php | 2 +- .../tmpl/default_batch_footer.php | 2 +- .../joomla_components/tmpl/default_body.php | 2 +- .../joomla_components/tmpl/default_foot.php | 2 +- .../joomla_components/tmpl/default_head.php | 2 +- .../tmpl/default_toolbar.php | 2 +- admin/views/joomla_components/view.html.php | 2 +- 22 files changed, 44 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 8a3069011..de8c47dff 100644 --- a/README.md +++ b/README.md @@ -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** diff --git a/admin/README.txt b/admin/README.txt index 8a3069011..de8c47dff 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -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** diff --git a/admin/assets/css/joomla_component.css b/admin/assets/css/joomla_component.css index 0f7cdb0d1..a5d15a0ab 100644 --- a/admin/assets/css/joomla_component.css +++ b/admin/assets/css/joomla_component.css @@ -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 diff --git a/admin/assets/css/joomla_components.css b/admin/assets/css/joomla_components.css index 995642255..984db50b1 100644 --- a/admin/assets/css/joomla_components.css +++ b/admin/assets/css/joomla_components.css @@ -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 diff --git a/admin/controllers/joomla_component.php b/admin/controllers/joomla_component.php index c2079cdaf..a81466569 100644 --- a/admin/controllers/joomla_component.php +++ b/admin/controllers/joomla_component.php @@ -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 diff --git a/admin/controllers/joomla_components.php b/admin/controllers/joomla_components.php index ecb0291e7..4bdae4329 100644 --- a/admin/controllers/joomla_components.php +++ b/admin/controllers/joomla_components.php @@ -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 diff --git a/admin/models/forms/joomla_component.js b/admin/models/forms/joomla_component.js index 105745e5c..5d21eb4e8 100644 --- a/admin/models/forms/joomla_component.js +++ b/admin/models/forms/joomla_component.js @@ -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 diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php index 76245f498..69d81c06f 100644 --- a/admin/models/import_joomla_components.php +++ b/admin/models/import_joomla_components.php @@ -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)) { diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php index fd01c2b60..883c50286 100644 --- a/admin/models/joomla_component.php +++ b/admin/models/joomla_component.php @@ -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 diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index c043468af..e75c51166 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -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); } } } diff --git a/admin/tables/joomla_component.php b/admin/tables/joomla_component.php index 31ae3e15f..b344d49cd 100644 --- a/admin/tables/joomla_component.php +++ b/admin/tables/joomla_component.php @@ -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 diff --git a/admin/views/joomla_component/submitbutton.js b/admin/views/joomla_component/submitbutton.js index adea19564..30562d67d 100644 --- a/admin/views/joomla_component/submitbutton.js +++ b/admin/views/joomla_component/submitbutton.js @@ -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 diff --git a/admin/views/joomla_component/tmpl/edit.php b/admin/views/joomla_component/tmpl/edit.php index ee124edba..086212381 100644 --- a/admin/views/joomla_component/tmpl/edit.php +++ b/admin/views/joomla_component/tmpl/edit.php @@ -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 diff --git a/admin/views/joomla_component/view.html.php b/admin/views/joomla_component/view.html.php index e4e3c8e6a..cdb1662e9 100644 --- a/admin/views/joomla_component/view.html.php +++ b/admin/views/joomla_component/view.html.php @@ -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 diff --git a/admin/views/joomla_components/tmpl/default.php b/admin/views/joomla_components/tmpl/default.php index cd57218f4..138011eb3 100644 --- a/admin/views/joomla_components/tmpl/default.php +++ b/admin/views/joomla_components/tmpl/default.php @@ -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 diff --git a/admin/views/joomla_components/tmpl/default_batch_body.php b/admin/views/joomla_components/tmpl/default_batch_body.php index 72de2f1aa..22552b99b 100644 --- a/admin/views/joomla_components/tmpl/default_batch_body.php +++ b/admin/views/joomla_components/tmpl/default_batch_body.php @@ -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 diff --git a/admin/views/joomla_components/tmpl/default_batch_footer.php b/admin/views/joomla_components/tmpl/default_batch_footer.php index 61b57249d..2ce6eea3c 100644 --- a/admin/views/joomla_components/tmpl/default_batch_footer.php +++ b/admin/views/joomla_components/tmpl/default_batch_footer.php @@ -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 diff --git a/admin/views/joomla_components/tmpl/default_body.php b/admin/views/joomla_components/tmpl/default_body.php index a2ec61e0e..46bf530fc 100644 --- a/admin/views/joomla_components/tmpl/default_body.php +++ b/admin/views/joomla_components/tmpl/default_body.php @@ -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 diff --git a/admin/views/joomla_components/tmpl/default_foot.php b/admin/views/joomla_components/tmpl/default_foot.php index 72d45432c..6f4d52c5c 100644 --- a/admin/views/joomla_components/tmpl/default_foot.php +++ b/admin/views/joomla_components/tmpl/default_foot.php @@ -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 diff --git a/admin/views/joomla_components/tmpl/default_head.php b/admin/views/joomla_components/tmpl/default_head.php index 3bc7a9125..2a5b74930 100644 --- a/admin/views/joomla_components/tmpl/default_head.php +++ b/admin/views/joomla_components/tmpl/default_head.php @@ -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 diff --git a/admin/views/joomla_components/tmpl/default_toolbar.php b/admin/views/joomla_components/tmpl/default_toolbar.php index cef2a6a8a..4d32430b7 100644 --- a/admin/views/joomla_components/tmpl/default_toolbar.php +++ b/admin/views/joomla_components/tmpl/default_toolbar.php @@ -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 diff --git a/admin/views/joomla_components/view.html.php b/admin/views/joomla_components/view.html.php index a943790df..77696d6f8 100644 --- a/admin/views/joomla_components/view.html.php +++ b/admin/views/joomla_components/view.html.php @@ -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