File manager - Edit - /home/jardides/www/Jardi-design/administrator/components/com_templateck/views/template/tmpl/ajaxinstalltemplate.php
Back
<?php /** * @name Template Creator CK 3 * @package com_templateck * @copyright Copyright (C) 2013. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); jimport('joomla.filesystem.file'); error_reporting(0); // to avoid problems with the ajax method $input = JFactory::getApplication()->input; $templatename = $input->get('templatename', '', 'string'); $path = JPATH_ROOT . '/components/com_templateck/projects/' . $templatename; $app = JFactory::getApplication(); $package = null; $installType = 'folder'; // Remember the 'Install from Directory' path. //$package = $this->_getPackageFromFolder(); // Get the path to the package to install. $p_dir = $path; $p_dir = JPath::clean($p_dir); // Did you give us a valid directory? if (!is_dir($p_dir)) { $result = "false"; $msg = JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_ENTER_A_PACKAGE_DIRECTORY'); $msgType = 'error'; } // Detect the package type $type = JInstallerHelper::detectType($p_dir); // Did you give us a valid package? if (!$type) { $result = "false"; $msg = JText::_('COM_INSTALLER_MSG_INSTALL_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'); $msgType = 'error'; } $package['packagefile'] = null; $package['extractdir'] = null; $package['dir'] = $p_dir; $package['type'] = $type; // Was the package unpacked? if (!$package || !$package['type']) { $result = "false"; $msg = JText::_('COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE'); $msgType = 'error'; } // Get an installer instance. $installer = JInstaller::getInstance(); // Install the package. if (!$installer->install($package['dir'])) { // There was an error installing the package. $msg = JText::_('CK_INSTALL_TEMPLATE_ERROR'); $result = "false"; $msgType = 'error'; } else { // Package installed sucessfully. $msg = JText::_('CK_INSTALL_TEMPLATE_SUCCESS'); $result = "true"; $msgType = 'message'; } // Set some model state values. //$app->enqueueMessage($msg, $msgType); //echo $msg; // Cleanup the install files. if (!is_file($package['packagefile'])) { $config = JFactory::getConfig(); $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile']; } //JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); echo '{"result": "' . $result . '", "message": "' . $msg . '", "type": "' . $msgType . '"}';
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.03 |
proxy
|
phpinfo
|
Settings