- md5
- 5b6561ba28eed1ca989ff347a625dd42
- sha1
- f1d5a6c6178ac30dbc14bbbf92a94d85ae9821c2
- sha256
- c3f2ab6382f37f8db3c55714bcd8fdf9f9348da99f258a947aa8f01a58181bcf
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Installer\Administrator\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
/**
* Installer controller for Joomla! installer class.
*
* @since 1.5
*/
class InstallController extends BaseController
{
/**
* Install an extension.
*
* @return mixed
*
* @since 1.5
*/
public function install()
{
// Check for request forgeries.
$this->checkToken();
/* @var \Joomla\Component\Installer\Administrator\Model\InstallModel $model */
$model = $this->getModel('install');
// TODO: Reset the users acl here as well to kill off any missing bits.
$result = $model->install();
$app = $this->app;
$redirect_url = $app->getUserState('com_installer.redirect_url');
if (!$redirect_url)
{
$redirect_url = base64_decode($this->input->get('return'));
}
// Don't redirect to an external URL.
if (!Uri::isInternal($redirect_url))
{
$redirect_url = '';
}
if (empty($redirect_url))
{
$redirect_url = Route::_('index.php?option=com_installer&view=install', false);
}
else
{
// Wipe out the user state when we're going to redirect.
$app->setUserState('com_installer.redirect_url', '');
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message', '');
}
$this->setRedirect($redirect_url);
return $result;
}
/**
* Install an extension from drag & drop ajax upload.
*
* @return void
*
* @since 3.7.0
*/
public function ajax_upload()
{
$app = $this->app;
$message = $app->getUserState('com_installer.message');
// Do install
$result = $this->install();
// Get redirect URL
$redirect = $this->redirect;
// Push message queue to session because we will redirect page by \Javascript, not $app->redirect().
// The "application.queue" is only set in redirect() method, so we must manually store it.
$app->getSession()->set('application.queue', $app->getMessageQueue());
header('Content-Type: application/json');
echo new JsonResponse(array('redirect' => $redirect), $message, !$result);
$app->close();
}
}
The same content is in 3 releases, Joomla 4.0.0-alpha8 to 4.0.0-alpha10. See them all, or every version of this file.