Fixed few bugs in import/export of JCB packages. Resolved gh-204. Made some updates to the Dropbox class, more coming.
This commit is contained in:
@ -958,7 +958,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// update the fields
|
||||
$object = new stdClass;
|
||||
$object->id = $adminview;
|
||||
$object->addlinked_views = json_encode($addlinked_views);
|
||||
$object->addlinked_views = json_encode($addlinked_views, JSON_FORCE_OBJECT);
|
||||
// update the admin view
|
||||
$this->_db->updateObject('#__componentbuilder_admin_view', $object, 'id');
|
||||
}
|
||||
@ -1013,7 +1013,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
if (ComponentbuilderHelper::checkArray($updateArray))
|
||||
{
|
||||
// load it back
|
||||
$item->{$field} = json_encode($this->updateSubformIDs($updateArray, $table, $targetArray));
|
||||
$item->{$field} = json_encode($this->updateSubformIDs($updateArray, $table, $targetArray), JSON_FORCE_OBJECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1052,7 +1052,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
if ($isJson)
|
||||
{
|
||||
return json_encode($values);
|
||||
return json_encode($values, JSON_FORCE_OBJECT);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$item = json_decode($item, true);
|
||||
$isJson = true;
|
||||
}
|
||||
if (ComponentbuilderHelper::checkArray($item))
|
||||
if (ComponentbuilderHelper::checkArray($item) && isset($item[$target]))
|
||||
{
|
||||
// set item ID
|
||||
$itemId = (isset($item['id'])) ? $item['id'] : 'newItem';
|
||||
@ -1135,7 +1135,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$item[$target] = json_encode($item[$target]);
|
||||
}
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkObject($item))
|
||||
elseif (ComponentbuilderHelper::checkObject($item) && isset($item->{$target}))
|
||||
{
|
||||
// set item ID
|
||||
$itemId = (isset($item->id)) ? $item->id : 'newItem';
|
||||
@ -1550,7 +1550,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// subform fields to target
|
||||
$updaterT = array(
|
||||
// subformfield => array( field => type_value )
|
||||
'addcustom_admin_views' => array('customadminview' => 'custom_admin_view')
|
||||
'addcustom_admin_views' => array('customadminview' => 'custom_admin_view', 'adminviews' => 'admin_view', 'before' => 'admin_view')
|
||||
);
|
||||
// update the subform ids
|
||||
$this->updateSubformsIDs($item, 'component_custom_admin_views', $updaterT);
|
||||
@ -1743,7 +1743,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// only update if we have translations
|
||||
if (ComponentbuilderHelper::checkArray($translations))
|
||||
{
|
||||
$item->translation = json_encode($translations);
|
||||
$item->translation = json_encode($translations, JSON_FORCE_OBJECT);
|
||||
}
|
||||
}
|
||||
elseif (isset($item->localTranslation) && ComponentbuilderHelper::checkJson($item->localTranslation))
|
||||
|
@ -258,7 +258,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
|
||||
}
|
||||
}
|
||||
$item->{$_value} = $bucket;
|
||||
$objectUpdate->{$_value} = json_encode($bucket);
|
||||
$objectUpdate->{$_value} = json_encode($bucket, JSON_FORCE_OBJECT);
|
||||
}
|
||||
}
|
||||
// be sure to update the table if we found repeatable fields that are still not converted
|
||||
|
@ -57,34 +57,34 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
}
|
||||
|
||||
public $user;
|
||||
public $packagePath = false;
|
||||
public $packageName = false;
|
||||
public $zipPath = false;
|
||||
public $key = array();
|
||||
public $exportBuyLinks = array();
|
||||
public $exportPackageLinks = array();
|
||||
public $info = array(
|
||||
'name' => array(),
|
||||
'short_description' => array(),
|
||||
'component_version' => array(),
|
||||
'companyname' => array(),
|
||||
'author' => array(),
|
||||
'email' => array(),
|
||||
'website' => array(),
|
||||
'license' => array(),
|
||||
'copyright' => array(),
|
||||
'getKeyFrom' => null
|
||||
);
|
||||
public $activeType = 'export';
|
||||
public $packagePath = false;
|
||||
public $packageName = false;
|
||||
public $zipPath = false;
|
||||
public $key = array();
|
||||
public $exportBuyLinks = array();
|
||||
public $exportPackageLinks = array();
|
||||
public $info = array(
|
||||
'name' => array(),
|
||||
'short_description' => array(),
|
||||
'component_version' => array(),
|
||||
'companyname' => array(),
|
||||
'author' => array(),
|
||||
'email' => array(),
|
||||
'website' => array(),
|
||||
'license' => array(),
|
||||
'copyright' => array(),
|
||||
'getKeyFrom' => null
|
||||
);
|
||||
public $activeType = 'export';
|
||||
|
||||
protected $params;
|
||||
protected $tempPath;
|
||||
protected $customPath;
|
||||
protected $smartExport = array();
|
||||
protected $exportIDs = array();
|
||||
protected $customCodeM = array();
|
||||
protected $fieldTypes = array();
|
||||
protected $isMultiple = array();
|
||||
protected $smartExport = array();
|
||||
protected $exportIDs = array();
|
||||
protected $customCodeM = array();
|
||||
protected $fieldTypes = array();
|
||||
protected $isMultiple = array();
|
||||
|
||||
/**
|
||||
* Method to build the export package
|
||||
@ -207,15 +207,15 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
continue;
|
||||
}
|
||||
// build information data set
|
||||
$this->info['name'][$item->id] = $item->name;
|
||||
$this->info['short_description'][$item->id] = $item->short_description;
|
||||
$this->info['component_version'][$item->id] = $item->component_version;
|
||||
$this->info['companyname'][$item->id] = $item->companyname;
|
||||
$this->info['author'][$item->id] = $item->author;
|
||||
$this->info['email'][$item->id] = $item->email;
|
||||
$this->info['website'][$item->id] = $item->website;
|
||||
$this->info['license'][$item->id] = $item->license;
|
||||
$this->info['copyright'][$item->id] = $item->copyright;
|
||||
$this->info['name'][$item->id] = $item->name;
|
||||
$this->info['short_description'][$item->id] = $item->short_description;
|
||||
$this->info['component_version'][$item->id] = $item->component_version;
|
||||
$this->info['companyname'][$item->id] = $item->companyname;
|
||||
$this->info['author'][$item->id] = $item->author;
|
||||
$this->info['email'][$item->id] = $item->email;
|
||||
$this->info['website'][$item->id] = $item->website;
|
||||
$this->info['license'][$item->id] = $item->license;
|
||||
$this->info['copyright'][$item->id] = $item->copyright;
|
||||
// set the keys
|
||||
if (isset($item->export_key) && ComponentbuilderHelper::checkString($item->export_key))
|
||||
{
|
||||
@ -500,6 +500,38 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// actions to take before storing the item if table is template, layout, site_view, or custom_admin_view
|
||||
if ('layout' === $table || 'template' === $table || 'site_view' === $table || 'custom_admin_view' === $table)
|
||||
{
|
||||
// unset snippets (we no longer export snippets)
|
||||
if (isset($item->snippet))
|
||||
{
|
||||
unset($item->snippet);
|
||||
}
|
||||
}
|
||||
// actions to take before storing the item if table is joomla_component
|
||||
if ('joomla_component' === $table)
|
||||
{
|
||||
// make sure old fields are not exported any more
|
||||
unset($item->addconfig);
|
||||
unset($item->addadmin_views);
|
||||
unset($item->addcustom_admin_views);
|
||||
unset($item->addsite_views);
|
||||
unset($item->version_update);
|
||||
unset($item->sql_tweak);
|
||||
unset($item->addcustommenus);
|
||||
unset($item->dashboard_tab);
|
||||
unset($item->php_dashboard_methods);
|
||||
unset($item->addfiles);
|
||||
unset($item->addfolders);
|
||||
}
|
||||
// actions to take before storing the item if table is admin_view
|
||||
if ('admin_view' === $table)
|
||||
{
|
||||
// make sure old fields are not exported any more
|
||||
unset($item->addfields);
|
||||
unset($item->addconditions);
|
||||
}
|
||||
// load to global object
|
||||
$this->smartExport[$table][$item->id] = $item;
|
||||
// set the custom code ID's
|
||||
@ -645,12 +677,12 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
$data = $locker->encryptString($data);
|
||||
// Set the key owner information
|
||||
$this->info['getKeyFrom'] = array();
|
||||
$this->info['getKeyFrom']['company'] = $this->params->get('export_company', null);
|
||||
$this->info['getKeyFrom']['owner'] = $this->params->get('export_owner', null);
|
||||
$this->info['getKeyFrom']['email'] = $this->params->get('export_email', null);
|
||||
$this->info['getKeyFrom']['website'] = $this->params->get('export_website', null);
|
||||
$this->info['getKeyFrom']['license'] = $this->params->get('export_license', null);
|
||||
$this->info['getKeyFrom']['copyright'] = $this->params->get('export_copyright', null);
|
||||
$this->info['getKeyFrom']['company'] = $this->params->get('export_company', null);
|
||||
$this->info['getKeyFrom']['owner'] = $this->params->get('export_owner', null);
|
||||
$this->info['getKeyFrom']['email'] = $this->params->get('export_email', null);
|
||||
$this->info['getKeyFrom']['website'] = $this->params->get('export_website', null);
|
||||
$this->info['getKeyFrom']['license'] = $this->params->get('export_license', null);
|
||||
$this->info['getKeyFrom']['copyright'] = $this->params->get('export_copyright', null);
|
||||
// making provision for future changes
|
||||
if (count($this->exportBuyLinks) == 1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user