Beispiel #1
0
 /**
  * Constructor method for widget base object
  */
 public function __construct()
 {
     $this->app = JFactory::getApplication();
     $this->session = JFactory::getSession();
     $this->request = $this->app->input;
     $this->dbo = JFactory::getDBO();
     $this->queryMethod = version_compare(JSNTplHelper::getJoomlaVersion(), '3.0', '>=') ? 'execute' : 'query';
     $this->language = JFactory::getLanguage();
     $this->language->load('tpl_' . $this->request->getCmd('template'), JPATH_ROOT);
     $this->language->load('lib_joomla');
     $this->_parseTemplateInfo($this->request->getCmd('template'));
 }
Beispiel #2
0
 /**
  * Process checking customer information
  *
  * @return  void
  */
 public function authAction()
 {
     // Process posted back data that sent from client
     if ($this->request->getMethod() == 'POST') {
         $username = $this->request->getString('username', '');
         $password = $this->request->getString('password', '');
         // Create new HTTP Request
         try {
             $orderedEditions = JSNTplApiLightcart::getOrderedEditions($this->template['id'], $username, $password);
         } catch (Exception $e) {
             throw $e;
         }
         $edition = $this->template['edition'];
         if ($edition != 'FREE' and strpos($edition, 'PRO ') === false) {
             $edition = 'PRO ' . $edition;
         }
         if (in_array($edition, $orderedEditions)) {
             $this->setResponse(array('id' => $this->template['id'], 'edition' => $edition, 'joomlaVersion' => JSNTplHelper::getJoomlaVersion(2), 'username' => urlencode($username), 'password' => urlencode($password)));
         } else {
             throw new Exception(JText::_('JSN_TPLFW_ERROR_API_ERR02'));
         }
     }
 }
 * @version     $Id$
 * @package     JSNExtension
 * @subpackage  TPLFramework
 * @author      JoomlaShine Team <*****@*****.**>
 * @copyright   Copyright (C) 2012 JoomlaShine.com. All Rights Reserved.
 * @license     GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.joomlashine.com
 * Technical Support:  Feedback - http://www.joomlashine.com/contact-us/get-support.html
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// Get all fieldset in XML
$fieldSets = $adminFormXml->fields->fieldset;
// Set appropriate wrapper class
$wrapperClass = 'jsn-joomla' . JSNTplHelper::getJoomlaVersion(1, false);
// Get template details
$template = JSNTplTemplateRecognization::detect($this->data->template);
// Prepare template name for link generation
$templateName = 'jsn-' . strtolower($template->name);
// Generate template introduction link
$templateLink = "http://www.joomlashine.com/joomla-templates/{$templateName}.html";
// Process template edition
$edition = $this->templateEdition->getEdition();
if ($edition == 'FREE') {
    $editionClass = 'jsn-free-edition';
} else {
    $editionClass = 'jsn-pro-edition';
}
// Get next template edition
$nextEdition = str_replace('PRO ', '', $this->templateEdition->getNextEdition());
Beispiel #4
0
 /**
  * Sample data package will be downloaded to temporary
  * folder in this action
  *
  * @return  void
  */
 public function downloadPackageAction()
 {
     JSNTplHelper::isDisabledFunction('set_time_limit') or set_time_limit(0);
     $config = JFactory::getConfig();
     $tmpPath = $config->get('tmp_path');
     $template = JSNTplTemplateRecognization::detect($this->template['name']);
     $fileUrl = 'http://www.joomlashine.com/joomla-templates/jsn-' . strtolower($template->name . '-' . preg_replace('/\\s(STANDARD|UNLIMITED)$/', '', $template->edition)) . '-sample-data-j' . (substr($version = JSNTplHelper::getJoomlaVersion(2, false), 0, 1) == '3' ? '30' : $version) . '.zip';
     // Download file to temporary folder
     try {
         $response = JSNTplHttpRequest::get($fileUrl, $tmpPath . "/{$this->template['name']}_sampledata.zip");
     } catch (Exception $e) {
         throw $e;
     }
     // Check download response headers
     if ($response['header']['content-type'] != 'application/zip') {
         throw new Exception(JText::_('JSN_TPLFW_ERROR_DOWNLOAD_CANNOT_LOCATED_FILE'));
     }
     $listExtensions = $this->_extractExtensions($tmpPath . "/{$this->template['name']}_sampledata.zip");
     $this->setResponse($listExtensions);
 }
Beispiel #5
0
 /**
  * Download product installation package from lightcart.
  * Return path to downloaded package when download successfull
  *
  * @param   string  $id        Identified name of the product
  * @param   string  $edition   Product edition to download
  * @param   string  $username  Customer username
  * @param   string  $password  Customer password
  * @param   string  $savePath  Path to save downloaded package
  *
  * @return  string
  */
 public static function downloadPackage($id, $edition = null, $username = null, $password = null, $savePath = null)
 {
     $joomlaVersion = JSNTplHelper::getJoomlaVersion(2);
     // Send request to joomlashine server to checking customer information
     $query = array('controller=remoteconnectauthentication', 'task=authenticate', 'tmpl=component', 'identified_name=' . $id, 'joomla_version=' . $joomlaVersion, 'upgrade=yes', 'custom=1', 'language=' . JFactory::getLanguage()->getTag());
     if (!empty($edition)) {
         $query[] = 'edition=' . $edition;
     }
     if (!empty($username) && !empty($password)) {
         $query[] = 'username='******'password='******'tmp_path') : $savePath;
     $downloadUrl = JSN_TPLFRAMEWORK_LIGHTCART_URL . '&' . implode('&', $query);
     $filePath = $tmpPath . '/jsn-' . $id . '.zip';
     try {
         JSNTplHttpRequest::get($downloadUrl, $filePath, array('content-type' => array('application/zip', 'application/x-zip', 'application/x-zip-compressed', 'application/octet-stream', 'application/x-compress', 'application/x-compressed', 'multipart/x-zip')));
     } catch (Exception $e) {
         // Check if we have LightCart error code?
         if (strlen($e->getMessage() == 5 and preg_match('/^ERR[0-9]+$/', $e->getMessage()))) {
             throw new Exception(JText::_('JSN_TPLFW_LIGHTCART_ERROR_' . $e->getMessage()));
         } else {
             throw $e;
         }
     }
     return $filePath;
 }
Beispiel #6
0
 /**
  * Action to execute queries from sample data file
  *
  * @return  void
  */
 public function installDataAction()
 {
     // Disable execution timeout
     if (!JSNTplHelper::isDisabledFunction('set_time_limit')) {
         set_time_limit(0);
     }
     try {
         // Create a backup of Joomla database
         $this->_backupDatabase();
         // Initialize variables
         if (!isset($this->temporary_path) || empty($this->temporary_path)) {
             $config = JFactory::getConfig();
             $this->temporary_path = $config->get('tmp_path') . "/{$this->template['name']}_sampledata.zip";
             $this->temporary_path = pathinfo($this->temporary_path, PATHINFO_DIRNAME) . '/' . pathinfo($this->temporary_path, PATHINFO_FILENAME);
             JPath::clean($this->temporary_path);
         }
         $xmlFiles = glob("{$this->temporary_path}/*.xml");
         if (empty($xmlFiles)) {
             throw new Exception(JText::_('JSN_TPLFW_ERROR_CANNOT_EXTRACT_SAMPLE_DATA_PACKAGE'));
         }
         // Load XML document
         $xml = simplexml_load_file(current($xmlFiles));
         $version = (string) $xml['version'];
         $joomla_ver = (string) $xml['joomla-version'];
         // Compare versions
         $templateVersion = JSNTplHelper::getTemplateVersion($this->template['name']);
         $joomlaVersion = new JVersion();
         if (version_compare($templateVersion, $version, '<')) {
             throw new Exception(JText::sprintf('JSN_TPLFW_ERROR_SAMPLE_DATA_OUT_OF_DATED', $templateVersion), 99);
         }
         if (!empty($joomla_ver) and version_compare($joomlaVersion->getShortVersion(), $joomla_ver, '<')) {
             throw new Exception(JText::sprintf('JSN_TPLFW_ERROR_JOOMLA_OUT_OF_DATE', $joomlaVersion->getShortVersion()), 99);
         }
         $thirdComponents = array();
         $thirdComponentErrors = array();
         // Looping to each extension type=component to get information and dependencies
         foreach ($xml->xpath('//extension[@author="3rd_party"]') as $component) {
             if (isset($component['author']) && $component['author'] == '3rd_party') {
                 $attrs = (array) $component->attributes();
                 $attrs = $attrs['@attributes'];
                 $componentType = (string) $attrs['type'];
                 $namePrefix = array('component' => 'com_', 'module' => 'mod_');
                 $componentName = isset($namePrefix[(string) $attrs['type']]) ? $namePrefix[$componentType] . $attrs['name'] : (string) $attrs['name'];
                 $state = $this->_getExtensionState($componentName, (string) $attrs['version'], true, (string) $attrs['type']);
                 $thirdComponents[] = array('id' => $attrs['name'], 'state' => $state, 'full_name' => (string) $attrs['full_name'], 'version' => (string) $attrs['version'], 'type' => $componentType);
             }
         }
         if (count($thirdComponents)) {
             foreach ($thirdComponents as $thirdComponent) {
                 if ($thirdComponent['state'] == 'install') {
                     $thirdComponentErrors[] = JText::sprintf('JSN_TPLFW_ERROR_THIRD_EXTENSION_NOT_INSTALLED', strtoupper($thirdComponent['full_name']) . ' ' . $thirdComponent['type'], $thirdComponent['version']);
                 } elseif ($thirdComponent['state'] == 'update') {
                     $thirdComponentErrors[] = JText::sprintf('JSN_TPLFW_ERROR_THIRD_EXTENSION_NEED_TO_INSTALLED', strtoupper($thirdComponent['full_name']) . ' ' . $thirdComponent['type'], $thirdComponent['version']);
                 } elseif ($thirdComponent['state'] == 'unsupported') {
                     $thirdComponentErrors[] = JText::sprintf('JSN_TPLFW_ERROR_THIRD_EXTENSION_NOT_SUPPORTED', strtoupper($thirdComponent['full_name']) . ' ' . $thirdComponent['type'], $thirdComponent['version']);
                 } else {
                     //do nothing
                 }
             }
         }
         if (count($thirdComponentErrors)) {
             $strThirdComponentError = '<ul>';
             foreach ($thirdComponentErrors as $thirdComponentError) {
                 $strThirdComponentError .= '<li>' . $thirdComponentError . '</li>';
             }
             $strThirdComponentError .= '</ul>';
             throw new Exception(JText::sprintf('JSN_TPLFW_ERROR_THIRD_EXTENSION', $strThirdComponentError), 99);
         }
         // Temporary backup data
         $this->_backupThirdPartyModules();
         $this->_backupThirdPartyAdminModules();
         $this->_backupThirdPartyMenus();
         // Delete admin modules
         $this->_deleteThirdPartyAdminModules();
         // Loop each extension to execute queries
         $attentions = array();
         foreach ($xml->xpath('//extension') as $extension) {
             // Get sample data queries.
             $queries = $extension->xpath('task[@name="dbinstall"]/parameters/parameter');
             // Verify extension.
             $canInstall = true;
             $extensionType = (string) $extension['type'];
             $namePrefix = array('component' => 'com_', 'module' => 'mod_');
             $extensionName = isset($namePrefix[(string) $extension['type']]) ? $namePrefix[$extensionType] . $extension['name'] : (string) $extension['name'];
             if (isset($extension['author']) && $extension['author'] == 'joomlashine') {
                 // Check if JoomlaShine extension is installed
                 $canInstall = JSNTplHelper::isInstalledExtension($extensionName, $extensionType);
                 if ($canInstall == false and $extensionType == 'component') {
                     // Add to attention list when extension is not installed
                     $attentions[] = array('id' => (string) $extension['name'], 'name' => (string) $extension['description'], 'url' => (string) $extension['producturl']);
                 }
             } elseif ($extension['type'] == 'component') {
                 // Check if 3rd-party component is installed.
                 $canInstall = JSNTplHelper::isInstalledExtension($extensionName);
                 if (!$canInstall) {
                     // Add to attention list.
                     $attentions[] = array('id' => (string) $extension['name'], 'name' => (string) $extension['title'], 'modules' => $extension->xpath('modules/module'), 'plugins' => $extension->xpath('plugins/plugin'), 'display' => count($queries) ? true : false);
                 } else {
                     // Verify version of the installed 3rd-party component.
                     $state = $this->_getExtensionState($extensionName, (string) $extension['version'], true);
                     if ('update' == $state) {
                         // Add to attention list.
                         $attentions[] = array('id' => (string) $extension['name'], 'name' => (string) $extension['title'], 'modules' => $extension->xpath('modules/module'), 'plugins' => $extension->xpath('plugins/plugin'), 'message' => JText::sprintf('JSN_TPLFW_UPDATE_3RD_PARTY_EXTENSION_FIRST', $this->_getExtensionVersion($extensionName), (string) $extension['version']), 'display' => count($queries) ? true : false);
                         $canInstall = false;
                     } elseif ('unsupported' == $state) {
                         // Add to attention list.
                         $attentions[] = array('id' => (string) $extension['name'], 'name' => (string) $extension['title'], 'modules' => $extension->xpath('modules/module'), 'plugins' => $extension->xpath('plugins/plugin'), 'message' => JText::sprintf('JSN_TPLFW_UNSUPPORTED_3RD_PARTY_EXTENSION_VERSION', $this->_getExtensionVersion($extensionName), (string) $extension['version']), 'display' => count($queries) ? true : false);
                         $canInstall = false;
                     } else {
                         // Make sure all required modules are installed also.
                         $missing = array();
                         foreach ($extension->xpath('modules/module') as $module) {
                             if (!@is_dir(JPATH_ROOT . '/modules/' . (string) $module)) {
                                 if ((string) $module['title'] != '') {
                                     $missing[] = (string) $module['title'];
                                 }
                             }
                         }
                         foreach ($extension->xpath('plugins/plugin') as $plugin) {
                             if (!@is_dir(JPATH_ROOT . '/plugins/' . (string) $plugin['group'] . '/' . (string) $plugin)) {
                                 if ((string) $plugin['title'] != '') {
                                     $missing[] = (string) $plugin['title'];
                                 }
                             }
                         }
                         if (count($missing)) {
                             // Add to attention list.
                             $attentions[] = array('id' => (string) $extension['name'], 'name' => (string) $extension['title'], 'modules' => $extension->xpath('modules/module'), 'plugins' => $extension->xpath('plugins/plugin'), 'missing' => $missing, 'message' => JText::_('JSN_TPLFW_MISSING_3RD_PARTY_EXTENSION_DEPENDENCIES'), 'display' => count($queries) ? true : false);
                             $canInstall = false;
                         }
                     }
                 }
             }
             if ($canInstall) {
                 // Execute sample data queries
                 foreach ($queries as $query) {
                     // Find remote assets then download to local system
                     if (preg_match_all('#(http://demo.joomlashine.com/[^\\s\\t\\r\\n]+/media/joomlashine/)[^\\s\\t\\r\\n]+\\.(js|css|bmp|gif|ico|jpg|png|svg|ttf|otf|eot|woff)#', $query, $matches, PREG_SET_ORDER)) {
                         foreach ($matches as $match) {
                             $keepAsIs = false;
                             if (!isset($this->mediaFolder)) {
                                 // Detect a writable folder to store demo assets
                                 foreach (array('media', 'cache', 'tmp') as $folder) {
                                     $folder = JPATH_ROOT . "/{$folder}";
                                     if (is_dir($folder) and is_writable($folder) and JFolder::create("{$folder}/joomlashine")) {
                                         $this->mediaFolder = "{$folder}/joomlashine";
                                         break;
                                     }
                                 }
                             }
                             if (isset($this->mediaFolder)) {
                                 // Generate path to store demo asset
                                 $mediaFile = str_replace($match[1], "{$this->mediaFolder}/", $match[0]);
                                 // Download demo asset only once
                                 if (!is_file($mediaFile)) {
                                     try {
                                         JSNTplHttpRequest::get($match[0], $mediaFile);
                                     } catch (Exception $e) {
                                         $keepAsIs = true;
                                     }
                                 }
                                 // Alter sample data query
                                 if (!$keepAsIs) {
                                     $query = str_replace($match[0], str_replace(JPATH_ROOT . '/', '', $mediaFile), $query);
                                 }
                             }
                         }
                     }
                     // Execute query
                     $this->dbo->setQuery((string) $query);
                     if (!$this->dbo->{$this->queryMethod}()) {
                         throw new Exception($this->dbo->getErrorMsg());
                     }
                 }
                 // Update component ID for linked menu items.
                 if ($extension['type'] == 'component') {
                     // Get component ID.
                     $query = $this->dbo->getQuery(true);
                     $query->select('extension_id')->from('#__extensions')->where('type = ' . $query->quote('component'))->where('element = ' . $query->quote($extensionName));
                     $this->dbo->setQuery($query);
                     $component_id = $this->dbo->loadResult();
                     // Update component ID for all menu items that link to this component.
                     $query = $this->dbo->getQuery(true);
                     $query->update('#__menu')->set('component_id = ' . $query->quote($component_id))->where('type = ' . $query->quote('component'))->where("link LIKE 'index.php?option={$extensionName}&%'");
                     $this->dbo->setQuery($query);
                     if (!$this->dbo->{$this->queryMethod}()) {
                         throw new Exception($this->dbo->getErrorMsg());
                     }
                 }
                 // Copy images if has.
                 if (isset($extension['images']) && @is_dir($this->temporary_path . '/' . (string) $extension['images'])) {
                     // Backup existing folder.
                     JFolder::move(JPATH_ROOT . '/' . (string) $extension['images'], JPATH_ROOT . '/' . (string) $extension['images'] . '-backup-at-' . date('y-m-d_H-i-s'));
                     // Delete current folder.
                     JFolder::delete(JPATH_ROOT . '/' . (string) $extension['images']);
                     // Move sample images folder.
                     JFolder::move($this->temporary_path . '/' . (string) $extension['images'], JPATH_ROOT . '/' . (string) $extension['images']);
                 }
                 // Download and install extended style if has.
                 if (isset($extension['ext-style-package'])) {
                     // Download extended style package.
                     $template = JSNTplTemplateRecognization::detect($this->template['name']);
                     $fileUrl = 'http://www.joomlashine.com/index.php?option=com_lightcart&controller=remoteconnectauthentication' . '&task=authenticate&tmpl=component&upgrade=yes&identified_name=ext_style&edition=' . '&joomla_version=' . JSNTplHelper::getJoomlaVersion(2) . '&file_attr=' . '{"identified_template_name":"tpl_' . strtolower($template->name) . '"' . ',"ext_style":"' . (string) $extension['ext-style-package'] . '"}';
                     // Download file to temporary folder.
                     try {
                         $response = JSNTplHttpRequest::get($fileUrl, $this->temporary_path . '/' . (string) $extension['ext-style-package'] . '_ext_style.zip');
                     } catch (Exception $e) {
                         throw $e;
                     }
                     // Check download response headers.
                     if ($response['header']['content-type'] != 'application/zip') {
                         throw new Exception(JText::_('JSN_TPLFW_ERROR_DOWNLOAD_CANNOT_LOCATED_FILE'));
                     }
                     // Install extended style.
                     JArchive::extract($this->temporary_path . '/' . (string) $extension['ext-style-package'] . '_ext_style.zip', JPATH_ROOT . '/' . (string) $extension['ext-style-path']);
                     // Fix for old extended style package of OS Property.
                     if (false !== strpos((string) $extension['ext-style-path'], '/com_osproperty/')) {
                         $template = 'jsn_' . strtolower($template->name);
                         if (@file_exists(JPATH_ROOT . '/' . (string) $extension['ext-style-path'] . "/{$template}/template.xml")) {
                             JFile::copy(JPATH_ROOT . '/' . (string) $extension['ext-style-path'] . "/{$template}/template.xml", JPATH_ROOT . '/' . (string) $extension['ext-style-path'] . "/{$template}/{$template}.xml");
                         }
                     }
                 }
                 // Manipulate data for K2.
                 if ('com_k2' == $extensionName) {
                     // Update user mapping for K2 items table.
                     $user = JFactory::getUser();
                     $query = $this->dbo->getQuery(true);
                     $query->update('#__k2_items')->set('created_by = ' . $query->quote($user->id));
                     $this->dbo->setQuery($query);
                     if (!$this->dbo->{$this->queryMethod}()) {
                         throw new Exception($this->dbo->getErrorMsg());
                     }
                     // Update user mapping for K2 users table.
                     $query = $this->dbo->getQuery(true);
                     $query->update('#__k2_users')->set('userID = ' . $query->quote($user->id));
                     $this->dbo->setQuery($query);
                     if (!$this->dbo->{$this->queryMethod}()) {
                         throw new Exception($this->dbo->getErrorMsg());
                     }
                 }
                 // Manipulate data for OS Property.
                 if ('com_osproperty' == $extensionName) {
                     // Update user mapping for agents table.
                     $user = JFactory::getUser();
                     $query = $this->dbo->getQuery(true);
                     $query->update('#__osrs_agents')->set('user_id = ' . $query->quote($user->id));
                     $this->dbo->setQuery($query);
                     if (!$this->dbo->{$this->queryMethod}()) {
                         throw new Exception($this->dbo->getErrorMsg());
                     }
                 }
                 // Unpublish menu item replacement published before.
                 if (isset($extension['menu-replacement'])) {
                     $items = array_map('intval', explode(',', (string) $extension['menu-replacement']));
                     $query = $this->dbo->getQuery(true);
                     $query->update('#__menu')->set('published = 0')->where('id IN (' . implode(', ', $items) . ')')->where('published = 1');
                     $this->dbo->setQuery($query);
                     if (!$this->dbo->{$this->queryMethod}()) {
                         throw new Exception($this->dbo->getErrorMsg());
                     }
                 }
                 // Unpublish module replacement published before.
                 if (isset($extension['module-replacement'])) {
                     $items = array_map('intval', explode(',', (string) $extension['module-replacement']));
                     $query = $this->dbo->getQuery(true);
                     $query->update('#__modules')->set('published = 0')->where('id IN (' . implode(', ', $items) . ')')->where('published = 1');
                     $this->dbo->setQuery($query);
                     if (!$this->dbo->{$this->queryMethod}()) {
                         throw new Exception($this->dbo->getErrorMsg());
                     }
                 }
             } else {
                 // Check if sample data contains menu item replacement for use when extension is missing.
                 if (isset($extension['menu-replacement'])) {
                     if (isset($menu_replacement)) {
                         $menu_replacement = array_merge($menu_replacement, array_map('intval', explode(',', (string) $extension['menu-replacement'])));
                     } else {
                         $menu_replacement = array_map('intval', explode(',', (string) $extension['menu-replacement']));
                     }
                 }
                 // Check if sample data contains module replacement for use when extension is missing.
                 if (isset($extension['module-replacement'])) {
                     if (isset($module_replacement)) {
                         $module_replacement = array_merge($module_replacement, array_map('intval', explode(',', (string) $extension['module-replacement'])));
                     } else {
                         $module_replacement = array_map('intval', explode(',', (string) $extension['module-replacement']));
                     }
                 }
             }
         }
         // Disable default template
         $query = $this->dbo->getQuery(true);
         $query->update('#__template_styles');
         $query->set('home = 0');
         $query->where('client_id = 0');
         $query->where('home = 1');
         $this->dbo->setQuery($query);
         if (!$this->dbo->{$this->queryMethod}()) {
             throw new Exception($this->dbo->getErrorMsg());
         }
         // Set installed template the default one
         $query = $this->dbo->getQuery(true);
         $query->update('#__template_styles');
         $query->set('home = 1');
         $query->where('id = ' . (int) $this->request->getInt('styleId'));
         $this->dbo->setQuery($query);
         if (!$this->dbo->{$this->queryMethod}()) {
             throw new Exception($this->dbo->getErrorMsg());
         }
         // Publish menu item replacement.
         if (isset($menu_replacement)) {
             $query = $this->dbo->getQuery(true);
             $query->update('#__menu')->set('published = 1')->where('id IN (' . implode(', ', $menu_replacement) . ')');
             $this->dbo->setQuery($query);
             if (!$this->dbo->{$this->queryMethod}()) {
                 throw new Exception($this->dbo->getErrorMsg());
             }
         }
         // Publish module replacement.
         if (isset($module_replacement)) {
             $query = $this->dbo->getQuery(true);
             $query->update('#__modules')->set('published = 1')->where('id IN (' . implode(', ', $module_replacement) . ')');
             $this->dbo->setQuery($query);
             if (!$this->dbo->{$this->queryMethod}()) {
                 throw new Exception($this->dbo->getErrorMsg());
             }
         }
     } catch (Exception $e) {
         $error = $e;
     }
     // Restore backed up data
     $this->_restoreThirdPartyData();
     $this->_rebuildMenus();
     // Clean up temporary data
     JInstallerHelper::cleanupInstall("{$this->temporary_path}.zip", $this->temporary_path);
     // Clean up junk data for extension that is not installed
     if (count($attentions)) {
         foreach ($attentions as $i => $attention) {
             // Clean up junk data imported during sample data installation.
             $this->_cleanJunkData('com_' . $attention['id'], isset($attention['modules']) ? $attention['modules'] : null, isset($attention['plugins']) ? $attention['plugins'] : null);
             // Make sure extension has name defined.
             if (!isset($attention['name']) || empty($attention['name'])) {
                 unset($attentions[$i]);
             } elseif (isset($attention['display']) && !$attention['display']) {
                 unset($attentions[$i]);
             } else {
                 // Remove data that are not necessary any more.
                 if (isset($attention['modules'])) {
                     unset($attentions[$i]['modules']);
                 }
                 if (isset($attention['plugins'])) {
                     unset($attentions[$i]['plugins']);
                 }
             }
         }
     }
     // Check if there is any error catched?
     if (isset($error)) {
         throw $error;
     }
     // Set final response
     $this->setResponse(array('attention' => array_values($attentions)));
 }