diff --git a/README.md b/README.md
index b6c1ee71a..ee72fba30 100644
--- a/README.md
+++ b/README.md
@@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015
-+ *Last Build*: 19th April, 2018
++ *Last Build*: 20th April, 2018
+ *Version*: 2.7.6
+ *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*: **183307**
++ *Line count*: **183326**
+ *Field count*: **1013**
+ *File count*: **1200**
+ *Folder count*: **193**
diff --git a/admin/README.txt b/admin/README.txt
index b6c1ee71a..ee72fba30 100644
--- a/admin/README.txt
+++ b/admin/README.txt
@@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015
-+ *Last Build*: 19th April, 2018
++ *Last Build*: 20th April, 2018
+ *Version*: 2.7.6
+ *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*: **183307**
++ *Line count*: **183326**
+ *Field count*: **1013**
+ *File count*: **1200**
+ *Folder count*: **193**
diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini
index 2e118ab76..7f78bf580 100644
--- a/admin/language/en-GB/en-GB.com_componentbuilder.ini
+++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini
@@ -924,7 +924,7 @@ COM_COMPONENTBUILDER_BACK_TO_LIBRARIES="Back to Libraries"
COM_COMPONENTBUILDER_BASIC_TUTORIAL_ON_GIT_BSB="Basic Tutorial on git: %s"
COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_THIS_PACKAGE_BFAILEDB_CHECKSUM_VALIDATION_THIS_COULD_BE_A_SERIOUS_SECURITY_BREACH_DO_NOT_CONTINUE="Best to not continue!
This package FAILED checksum validation, this could be a serious security breach! DO NOT CONTINUE!!!"
COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_WE_COULD_NOT_LOAD_THE_CHECKSUM_FOR_THIS_PACKAGE_AND_SO_NO_VALIDATION_WAS_POSSIBLE_THIS_MAY_BE_DUE_TO_YOUR_NETWORK_OR_A_CHANGE_TO_THAT_PACKAGE_NAME="Best to not continue!
We could not load the checksum for this package, and so no validation was possible. This may be due to your network, or a change to that package name."
-COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVE_TO_CORRECT_LOCATION="Custom files not move to correct location!"
+COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVED_TO_CORRECT_LOCATION="Custom files not moved to correct location!"
COM_COMPONENTBUILDER_BEHIND="Behind"
COM_COMPONENTBUILDER_BEHIND_MEANS_YOUR_BLOCAL_SNIPPETB_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_A_BOLDER_MODIFIED_DATEB_THEN_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE="Behind means your local snippet (with the same name, library and type) has a older modified date then the community snippet (with the same name, library and type)."
COM_COMPONENTBUILDER_BETA_RELEASE="Beta Release"
@@ -932,7 +932,7 @@ COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_
COM_COMPONENTBUILDER_BFIELD_TYPEB_IDS_MISMATCH_IN_BSB="Field type id:%s mismatch in %s."
COM_COMPONENTBUILDER_BFIELD_TYPEB_NOT_SET_FOR_BSB="Field type not set for %s."
COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA="Get the key from %s"
-COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVE_TO_CORRECT_LOCATION="Images not move to correct location!"
+COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVED_TO_CORRECT_LOCATION="Images not moved to correct location!"
COM_COMPONENTBUILDER_BMULTIPLE_FIELD_REPEATABLE_MODEB_IDS_MISMATCH_IN_BFIELDSB_AND_WAS_EMREMOVEDEM_FROM_THE_FIELD="Multiple Field (repeatable mode) id:%s mismatch in field:%s, and was removed from the field."
COM_COMPONENTBUILDER_BSBS_IN_BSB_HAS_ID_MISMATCH_SO_THE_BSB_WAS_REMOVED="%s->%s in %s has id mismatch. So the %s was removed!"
COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS="%s could not be imported%s"
@@ -3971,12 +3971,12 @@ COM_COMPONENTBUILDER_FIELD_ZERO="0"
COM_COMPONENTBUILDER_FILE="File"
COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED="File %s could not be unlocked!"
COM_COMPONENTBUILDER_FILE_BSB_WAS_MOVED_TO_BSB="File %s was moved to %s"
-COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVE_TO_BSB="File %s was not move to %s"
+COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVED_TO_BSB="File %s was not moved to %s"
COM_COMPONENTBUILDER_FILE_BSB_WAS_SUCCESSFULLY_UNLOCKED="File %s was successfully unlocked!"
COM_COMPONENTBUILDER_FILTER="Filter"
COM_COMPONENTBUILDER_FOLDER="Folder"
COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB="Folder %s was moved to %s"
-COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_BSB="Folder %s was not move to %s"
+COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVED_TO_BSB="Folder %s was not moved to %s"
COM_COMPONENTBUILDER_FORCE_LOCAL_UPDATE="Force Local Update"
COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB="Full Width in Tab"
COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN="Function name already taken, please try again."
diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php
index 4aad147f7..48a2c4b07 100644
--- a/admin/models/import_joomla_components.php
+++ b/admin/models/import_joomla_components.php
@@ -725,7 +725,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
}
// do a after all run on all items that need it
- $this->updateAfter();
+ $this->updateAfterAll();
// finally move the old datasets
$this->moveDivergedData();
// lets move all the files to its correct location
@@ -739,7 +739,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
/**
* Save the smart items
*
- * @param string $type The type of values
+ * @param string $table The table
*
* @return boolean false on failure
*
@@ -873,7 +873,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// great we have some custom stuff lets move it
if (!JFolder::copy($customDir, $customPath,'',true))
{
- $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVE_TO_CORRECT_LOCATION'), 'error');
+ $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVED_TO_CORRECT_LOCATION'), 'error');
$success = false;
}
// display more import info
@@ -889,7 +889,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// great we have some images lets move them
if (!JFolder::copy($imageDir, $imagesPath,'',true))
{
- $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVE_TO_CORRECT_LOCATION'), 'error');
+ $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVED_TO_CORRECT_LOCATION'), 'error');
$success = false;
}
// display more import info
@@ -913,7 +913,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$fullPath = str_replace('//', '/', $dynamicDir . '/' . $folder);
if (!JFolder::exists($fullPath) || !JFolder::copy($fullPath, $destination,'',true))
{
- $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_BSB', $folder, $destination), 'error');
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVED_TO_BSB', $folder, $destination), 'error');
$success = false;
}
// display more import info
@@ -934,7 +934,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$fullPath = str_replace('//', '/', $dynamicDir . '/' . $file);
if (!JFile::exists($fullPath) || !JFile::copy($fullPath, $destination))
{
- $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVE_TO_BSB', $file, $destination), 'error');
+ $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVED_TO_BSB', $file, $destination), 'error');
$success = false;
}
// display more import info
@@ -1018,7 +1018,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
* @return void
*
**/
- public function updateAfter()
+ public function updateAfterAll()
{
if (ComponentbuilderHelper::checkArray($this->updateAfter['field']))
{
@@ -1097,7 +1097,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
if (ComponentbuilderHelper::checkJson($addlinked_views))
{
$addlinked_views = json_decode($addlinked_views, true);
- // convert Repetable Fields
+ // convert Repeatable Fields
if (ComponentbuilderHelper::checkArray($addlinked_views) && isset($addlinked_views['adminview']))
{
$addlinked_views = ComponentbuilderHelper::convertRepeatable($addlinked_views, 'addlinked_views');
@@ -1385,7 +1385,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
* object on success
*
**/
- protected function prepItem($item, &$type, $action, $diverged = false)
+ protected function prepItem($item, $type, $action, $diverged = false)
{
// remove access
if (isset($item->access))
@@ -1806,9 +1806,9 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'sql_tweak' => 'adminview'
- );
+ // repeatablefield => checker
+ 'sql_tweak' => 'adminview'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
// subform fields to target
@@ -2006,6 +2006,13 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
{
unset($item->localTranslation);
}
+ // move entranslation to source
+ if (isset($item->entranslation))
+ {
+ $item->source = $item->entranslation;
+ // also remove the old field
+ unset($item->entranslation);
+ }
break;
case 'admin_fields':
case 'admin_fields_conditions':
@@ -2217,7 +2224,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
* ID int on success
*
**/
- protected function updateLocalItem(&$item, &$type, &$canState)
+ protected function updateLocalItem(&$item, $type, &$canState)
{
// prep the item
if ($update = $this->prepItem($item, $type, 'update'))
@@ -2248,7 +2255,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
* ID int on success
*
**/
- protected function addLocalItem(&$item, &$type, $diverged = false)
+ protected function addLocalItem(&$item, $type, $diverged = false)
{
// prep the item
if ($add = $this->prepItem($item, $type, 'add', $diverged))
@@ -2279,15 +2286,26 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
* ID int on success
*
**/
- protected function getLocalItem(&$item, &$type, $retry = false, $get = 1, $diverged = false)
+ protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverged = false)
{
$query = $this->_db->getQuery(true);
$query->select('a.*');
$query->from($this->_db->quoteName('#__componentbuilder_' . $type, 'a'));
// only run query if where is set
$runQuery = false;
- if ($get == 1 && isset($item->created) && isset($item->id))
+ if ($get == 1 && isset($item->created) && isset($item->id) && (isset($item->name) || isset($item->system_name)))
{
+ // to prefent crazy mismatch with old IDs (I know very weired)
+ if (isset($item->system_name))
+ {
+ $query->where($this->_db->quoteName('a.system_name') . ' = '. $this->_db->quote($item->system_name));
+ }
+ // to prefent crazy mismatch with old IDs (I know very weired)
+ if (isset($item->name))
+ {
+ $query->where($this->_db->quoteName('a.name') . ' = '. $this->_db->quote($item->name));
+ }
+ // load the created and id
$query->where($this->_db->quoteName('a.created') . ' = '. $this->_db->quote($item->created));
$query->where($this->_db->quoteName('a.id') .' = '. (int) $item->id);
$runQuery = true;
@@ -2330,19 +2348,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
}
}
- elseif (isset($item->{$get}) && componentbuilderHelper::checkString($item->{$get})) // do not allow empty strings (since it could be major mis match)
- {
- // set the value
- $value = $item->{$get};
- // check if we have special value
- if ($this->specialValue && ComponentbuilderHelper::checkArray($this->specialValue) && isset($this->specialValue[$get]))
- {
- $value = $this->specialValue[$get];
- }
- $query->where($this->_db->quoteName('a.' . $get) . ' = '. $this->_db->quote($value));
- $runQuery = true;
- }
- elseif (isset($item->{$get}) && is_numeric($item->{$get}))
+ elseif (isset($item->{$get}))
{
// set the value
$value = $item->{$get};
@@ -2352,14 +2358,18 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$value = $this->specialValue[$get];
}
// load to query
- if (is_int($value))
+ if (is_numeric($value) && is_int($value))
{
$query->where($this->_db->quoteName('a.' . $get) . ' = '. (int) $value);
}
- elseif (is_float($value))
+ elseif (is_numeric($value) && is_float($value))
{
$query->where($this->_db->quoteName('a.' . $get) . ' = '. (float) $value);
}
+ elseif(componentbuilderHelper::checkString($value)) // do not allow empty strings (since it could be major mis match)
+ {
+ $query->where($this->_db->quoteName('a.' . $get) . ' = '. $this->_db->quote($value));
+ }
else
{
return false; // really not needed but who knows for sure...
@@ -2399,6 +2409,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
{
$this->specialValue['admin_view'] = $this->newID['admin_view'][(int) $item->admin_view];
}
+ // (TODO) I have seen this happen, seems dangerous!
+ else
+ {
+ return false;
+ }
break;
case 'validation_rule':
case 'fieldtype':
@@ -2549,27 +2564,31 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
case 'component_config':
case 'component_dashboard':
case 'component_files_folders':
- // get by joomla_component (since there should only be one of each component)
- $getter = array('joomla_component');
- $this->specialValue = array();
- // Yet if diverged it makes sense that the ID is updated.
- if ($diverged)
- {
- $this->specialValue['joomla_component'] = (int) $item->joomla_component;
- }
- elseif (isset($this->newID['joomla_component'][(int) $item->joomla_component]))
- {
- $this->specialValue['joomla_component'] = $this->newID['joomla_component'][(int) $item->joomla_component];
- }
- // (TODO) I have seen this happen, seems dangerous!
- else
- {
- return false;
- }
+ // get by joomla_component (since there should only be one of each component)
+ $getter = array('joomla_component');
+ $this->specialValue = array();
+ // Yet if diverged it makes sense that the ID is updated.
+ if ($diverged)
+ {
+ $this->specialValue['joomla_component'] = (int) $item->joomla_component;
+ }
+ elseif (isset($this->newID['joomla_component'][(int) $item->joomla_component]))
+ {
+ $this->specialValue['joomla_component'] = $this->newID['joomla_component'][(int) $item->joomla_component];
+ }
+ // (TODO) I have seen this happen, seems dangerous!
+ else
+ {
+ return false;
+ }
break;
case 'language_translation':
- // get by English translation since there should just be one
- $getter = 'entranslation';
+ // get by source translation since there should just be one
+ $getter = 'source';
+ if (isset($item->entranslation))
+ {
+ $item->source = $item->entranslation;
+ }
break;
case 'language':
// get by language tag since there should just be one
diff --git a/componentbuilder.xml b/componentbuilder.xml
index a08099ab4..584011a06 100644
--- a/componentbuilder.xml
+++ b/componentbuilder.xml
@@ -1,7 +1,7 @@
COM_COMPONENTBUILDER
- 19th April, 2018
+ 20th April, 2018
Llewellyn van der Merwe
llewellyn@joomlacomponentbuilder.com
http://joomlacomponentbuilder.com