Ver. 2.1.3.1
Issue/Bug: When selecting a form or multiple forms to be exported it won't download it.
The app will try to download the forms.xml file from the server root path instead of the public path.
Example:
GET
example.com/administrator/index.php?opti...omponent&file=/home/example/public_html/tmp/forms.xml
public function exportForm($cid)
{
$db = JFactory::getDbo();
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$root = $doc->createElement('baforms');
$root = $doc->appendChild($root);
foreach ($cid as $id) {
$baform = $doc->createElement('baform');
$baform = $root->appendChild($baform);
$this->createDOMBranch($doc, $db, '#__baforms_forms', $id, 'id', $baform, 'form');
$this->createDOMBranch($doc, $db, '#__baforms_forms_settings', $id, 'form_id', $baform, 'settings');
$columns = $doc->createElement('columns');
$columns = $baform->appendChild($columns);
$this->createDOMBranch($doc, $db, '#__baforms_columns', $id, 'form_id', $columns, 'column');
$items = $doc->createElement('items');
$items = $baform->appendChild($items);
$this->createDOMBranch($doc, $db, '#__baforms_items', $id, 'form_id', $items, 'item');
$pages = $doc->createElement('pages');
$pages = $baform->appendChild($pages);
$this->createDOMBranch($doc, $db, '#__baforms_pages', $id, 'form_id', $pages, 'page');
}
$file = '/tmp/forms.xml';
$bytes = $doc->save(JPATH_ROOT.$file);
if ($bytes) {
echo new JResponseJson(true, JPATH_ROOT.$file);
} else {
echo new JResponseJson(false, '', true);
}
jexit();
}