primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
<help key="Joomla_Update:_Options"/>
<inlinehelp button="show"/>
<fieldset
name="sources"
label="COM_JOOMLAUPDATE_CONFIG_SOURCES_LABEL"
description="COM_JOOMLAUPDATE_CONFIG_SOURCES_DESC"
>
<field
name="updatesource"
type="list"
label="COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_LABEL"
default="default"
validate="options"
>
<!-- Note: Changed the values lts to default and sts to next with 3.4.0 -->
<!-- All invalid/unsupported/obsolete options equated to default in code with 3.4.0 -->
<option value="default">COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT</option>
<option value="next">COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT</option>
<option value="custom">COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM</option>
</field>
<field
name="minimum_stability"
type="list"
label="COM_JOOMLAUPDATE_MINIMUM_STABILITY_LABEL"
description="COM_JOOMLAUPDATE_MINIMUM_STABILITY_DESC"
default="4"
validate="options"
>
<option value="0">COM_JOOMLAUPDATE_MINIMUM_STABILITY_DEV</option>
<option value="1">COM_JOOMLAUPDATE_MINIMUM_STABILITY_ALPHA</option>
<option value="2">COM_JOOMLAUPDATE_MINIMUM_STABILITY_BETA</option>
<option value="3">COM_JOOMLAUPDATE_MINIMUM_STABILITY_RC</option>
<option value="4">COM_JOOMLAUPDATE_MINIMUM_STABILITY_STABLE</option>
</field>
<field
name="customurl"
type="url"
label="COM_JOOMLAUPDATE_CONFIG_CUSTOMURL_LABEL"
default=""
length="50"
showon="updatesource:custom"
validate="url"
/>
<field
name="versioncheck"
type="radio"
label="COM_JOOMLAUPDATE_CONFIG_VERSIONCHECK_LABEL"
description="COM_JOOMLAUPDATE_CONFIG_VERSIONCHECK_DESC"
layout="joomla.form.field.radio.switcher"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="backupcheck"
type="radio"
label="COM_JOOMLAUPDATE_CONFIG_BACKUPCHECK_LABEL"
description="COM_JOOMLAUPDATE_CONFIG_BACKUPCHECK_DESC"
layout="joomla.form.field.radio.switcher"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</config>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,275 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* Important Notes:
* - Unlike other files, this file requires multiple namespace declarations in order to overload core classes during the update process
* - Also unlike other files, the normal constant defined checks must be within the global namespace declaration and can't be outside of it
*/
namespace {
// Require the restoration environment or fail cold. Prevents direct web access.
\defined('_JOOMLA_UPDATE') or die();
// Fake a miniature Joomla environment
if (!\defined('_JEXEC')) {
\define('_JEXEC', 1);
}
if (!\function_exists('jimport')) {
/**
* This is deprecated but it may still be used in the update finalisation script.
*
* @param string $path Ignored.
* @param string $base Ignored.
*
* @return boolean Always true.
*
* @since 1.7.0
*/
function jimport(string $path, ?string $base = null): bool
{
// Do nothing
return true;
}
}
if (!\function_exists('finalizeUpdate')) {
/**
* Run part of the Joomla! finalisation script, namely the part that cleans up unused files/folders
*
* @param string $siteRoot The root to the Joomla! site
* @param string $restorePath The base path to extract.php
*
* @return void
*
* @since 3.5.1
*/
function finalizeUpdate(string $siteRoot, string $restorePath): void
{
if (!\defined('JPATH_ROOT')) {
\define('JPATH_ROOT', $siteRoot);
}
$filePath = JPATH_ROOT . '/administrator/components/com_admin/script.php';
if (file_exists($filePath)) {
require_once $filePath;
}
// Make sure Joomla!'s code can figure out which files exist and need be removed
clearstatcache();
// Remove obsolete files - prevents errors occurring in some system plugins
if (class_exists('JoomlaInstallerScript')) {
(new JoomlaInstallerScript())->deleteUnexistingFiles();
}
/**
* Remove autoload_psr4.php so that namespace map is re-generated on the next request. This is needed
* when there are new classes added to extensions on new Joomla! release.
*/
$namespaceMapFile = JPATH_ROOT . '/administrator/cache/autoload_psr4.php';
if (is_file($namespaceMapFile)) {
\Joomla\Filesystem\File::delete($namespaceMapFile);
}
}
}
}
namespace Joomla\Filesystem
{
// Fake the File class
if (!class_exists('\Joomla\Filesystem\File')) {
/**
* File mock class
*
* @since 3.5.1
*/
abstract class File
{
/**
* Proxies checking a file exists to the native php version
*
* @param string $fileName The path to the file to be checked
*
* @return boolean
*
* @since 3.5.1
*/
public static function exists(string $fileName): bool
{
return @file_exists($fileName);
}
/**
* Delete a file and invalidate the PHP OPcache
*
* @param string $fileName The path to the file to be deleted
*
* @return boolean
*
* @since 3.5.1
*/
public static function delete(string $fileName): bool
{
self::invalidateFileCache($fileName);
return @unlink($fileName);
}
/**
* Rename a file and invalidate the PHP OPcache
*
* @param string $src The path to the source file
* @param string $dest The path to the destination file
*
* @return boolean True on success
*
* @since 4.0.1
*/
public static function move(string $src, string $dest): bool
{
self::invalidateFileCache($src);
$result = @rename($src, $dest);
if ($result) {
self::invalidateFileCache($dest);
}
return $result;
}
/**
* Invalidate opcache for a newly written/deleted file immediately, if opcache* functions exist and if this was a PHP file.
*
* @param string $filepath The path to the file just written to, to flush from opcache
* @param boolean $force If set to true, the script will be invalidated regardless of whether invalidation is necessary
*
* @return boolean TRUE if the opcode cache for script was invalidated/nothing to invalidate,
* or FALSE if the opcode cache is disabled or other conditions returning
* FALSE from opcache_invalidate (like file not found).
*
* @since 4.0.2
*/
public static function invalidateFileCache($filepath, $force = true)
{
return clearFileInOPCache($filepath);
}
}
}
// Fake the Folder class, mapping it to Restore's post-processing class
if (!class_exists('\Joomla\Filesystem\Folder')) {
/**
* Folder mock class
*
* @since 3.5.1
*/
abstract class Folder
{
/**
* Proxies checking a folder exists to the native php version
*
* @param string $folderName The path to the folder to be checked
*
* @return boolean
*
* @since 3.5.1
*/
public static function exists(string $folderName): bool
{
return @is_dir($folderName);
}
/**
* Delete a folder recursively and invalidate the PHP OPcache
*
* @param string $folderName The path to the folder to be deleted
*
* @return boolean
*
* @since 3.5.1
*/
public static function delete(string $folderName): bool
{
if (substr($folderName, -1) == '/') {
$folderName = substr($folderName, 0, -1);
}
if (!@file_exists($folderName) || !@is_dir($folderName) || !is_readable($folderName)) {
return false;
}
$di = new \DirectoryIterator($folderName);
/** @var \DirectoryIterator $item */
foreach ($di as $item) {
if ($item->isDot()) {
continue;
}
if ($item->isDir()) {
$status = self::delete($item->getPathname());
if (!$status) {
return false;
}
continue;
}
clearFileInOPCache($item->getPathname());
@unlink($item->getPathname());
}
return @rmdir($folderName);
}
}
}
if (!class_exists('\Joomla\CMS\Filesystem\File')) {
class_alias('\\Joomla\\Filesystem\\File', '\\Joomla\\CMS\\Filesystem\\File');
}
if (!class_exists('\Joomla\CMS\Filesystem\Folder')) {
class_alias('\\Joomla\\Filesystem\\Folder', '\\Joomla\\CMS\\Filesystem\\Folder');
}
}
namespace Joomla\CMS\Language
{
// Fake the Text class - we aren't going to show errors to people anyhow
if (!class_exists('\Joomla\CMS\Language\Text')) {
/**
* Text mock class
*
* @since 3.5.1
*/
abstract class Text
{
/**
* No need for translations in a non-interactive script, so always return an empty string here
*
* @param string $text A language constant
*
* @return string
*
* @since 3.5.1
*/
public static function sprintf(string $text): string
{
return '';
}
}
}
}

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="component" method="upgrade">
<name>com_joomlaupdate</name>
<author>Joomla! Project</author>
<creationDate>2021-08</creationDate>
<copyright>(C) 2012 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>4.0.3</version>
<description>COM_JOOMLAUPDATE_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Component\Joomlaupdate</namespace>
<media destination="com_joomlaupdate" folder="media">
<folder>js</folder>
</media>
<administration>
<files folder="admin">
<filename>config.xml</filename>
<filename>extract.php</filename>
<filename>finalisation.php</filename>
<folder>services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB/com_joomlaupdate.ini</language>
<language tag="en-GB">language/en-GB/com_joomlaupdate.sys.ini</language>
</languages>
</administration>
<updateservers>
<server type="extension" name="Joomla! Update Component">https://update.joomla.org/core/extensions/com_joomlaupdate.xml</server>
</updateservers>
</extension>

View File

@ -0,0 +1,53 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Extension\MVCComponent;
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
/**
* The content service provider.
*
* @since 4.0.0
*/
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.0.0
*/
public function register(Container $container)
{
$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Joomlaupdate'));
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Joomlaupdate'));
$container->set(
ComponentInterface::class,
function (Container $container) {
$component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
return $component;
}
);
}
};

View File

@ -0,0 +1,119 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Joomlaupdate\Administrator\Controller;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! Update Controller
*
* @since 2.5.4
*/
class DisplayController extends BaseController
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached.
* @param array $urlparams An array of safe URL parameters and their variable types.
* @see \Joomla\CMS\Filter\InputFilter::clean() for valid values.
*
* @return static This object to support chaining.
*
* @since 2.5.4
*/
public function display($cachable = false, $urlparams = false)
{
// Get the document object.
$document = $this->app->getDocument();
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'Joomlaupdate');
$vFormat = $document->getType();
$lName = $this->input->get('layout', 'default', 'string');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat)) {
// Only super user can access file upload
if ($view == 'upload' && !$this->app->getIdentity()->authorise('core.admin', 'com_joomlaupdate')) {
$this->app->redirect(Route::_('index.php?option=com_joomlaupdate', true));
}
// Get the model for the view.
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
/** @var ?\Joomla\Component\Installer\Administrator\Model\WarningsModel $warningsModel */
$warningsModel = $this->app->bootComponent('com_installer')
->getMVCFactory()->createModel('Warnings', 'Administrator', ['ignore_request' => true]);
if ($warningsModel !== null) {
$view->setModel($warningsModel, false);
}
// Check for update result
if ($lName === 'complete') {
$state = $model->getState();
$state->set('update_finished_with_error', $this->app->getUserState('com_joomlaupdate.update_finished_with_error'));
$state->set('update_errors', (array) $this->app->getUserState('com_joomlaupdate.update_errors', []));
$state->set('update_channel_reset', $this->app->getUserState('com_joomlaupdate.update_channel_reset'));
$state->set('installer_message', $this->app->getUserState('com_joomlaupdate.installer_message'));
$state->set('log_file', $this->app->get('log_path') . '/joomla_update.php');
}
// Perform update source preference check and refresh update information.
$model->applyUpdateSite();
$model->refreshUpdates();
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->document = $document;
$view->display();
}
return $this;
}
/**
* Provide the data for a badge in a menu item via JSON
*
* @return void
*
* @since 4.0.0
* @throws \Exception
*/
public function getMenuBadgeData()
{
if (!$this->app->getIdentity()->authorise('core.manage', 'com_joomlaupdate')) {
throw new \Exception(Text::_('JGLOBAL_AUTH_ACCESS_DENIED'));
}
$model = $this->getModel('Update');
$model->refreshUpdates();
$joomlaUpdate = $model->getUpdateInformation();
$hasUpdate = $joomlaUpdate['hasUpdate'] ? $joomlaUpdate['latest'] : '';
echo new JsonResponse($hasUpdate);
}
}

View File

@ -0,0 +1,715 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Joomlaupdate\Administrator\Controller;
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Session\Session;
use Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* The Joomla! update controller for the Update view
*
* @since 2.5.4
*/
class UpdateController extends BaseController
{
/**
* Performs the download of the update package
*
* @return void
*
* @since 2.5.4
*/
public function download()
{
$this->checkToken();
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
$user = $this->app->getIdentity();
// Make sure logging is working before continue
try {
Log::add('Test logging', Log::INFO, 'Update');
} catch (\Throwable $e) {
$message = Text::sprintf('COM_JOOMLAUPDATE_UPDATE_LOGGING_TEST_FAIL', $e->getMessage());
$this->setRedirect('index.php?option=com_joomlaupdate', $message, 'error');
return;
}
Log::add(Text::sprintf('COM_JOOMLAUPDATE_UPDATE_LOG_START', $user->id, $user->name, \JVERSION), Log::INFO, 'Update');
$result = $model->download();
$file = $result['basename'];
$message = null;
$messageType = null;
// The versions mismatch (Use \JVERSION as target version when not set in case of reinstall core files)
if ($result['version'] !== $this->input->get('targetVersion', \JVERSION, 'string')) {
$message = Text::_('COM_JOOMLAUPDATE_VIEW_UPDATE_VERSION_WRONG');
$messageType = 'error';
$url = 'index.php?option=com_joomlaupdate';
$this->app->setUserState('com_joomlaupdate.file', null);
$this->setRedirect($url, $message, $messageType);
Log::add($message, Log::ERROR, 'Update');
return;
}
// The validation was not successful so stop.
if ($result['check'] === false) {
$message = Text::_('COM_JOOMLAUPDATE_VIEW_UPDATE_CHECKSUM_WRONG');
$messageType = 'error';
$url = 'index.php?option=com_joomlaupdate';
$this->app->setUserState('com_joomlaupdate.file', null);
$this->setRedirect($url, $message, $messageType);
Log::add($message, Log::ERROR, 'Update');
return;
}
if ($file) {
$this->app->setUserState('com_joomlaupdate.file', $file);
$url = 'index.php?option=com_joomlaupdate&task=update.install&' . $this->app->getSession()->getFormToken() . '=1';
Log::add(Text::sprintf('COM_JOOMLAUPDATE_UPDATE_LOG_FILE', $file), Log::INFO, 'Update');
} else {
$this->app->setUserState('com_joomlaupdate.file', null);
$url = 'index.php?option=com_joomlaupdate';
$message = Text::_('COM_JOOMLAUPDATE_VIEW_UPDATE_DOWNLOADFAILED');
$messageType = 'error';
}
$this->setRedirect($url, $message, $messageType);
}
/**
* Start the installation of the new Joomla! version
*
* @return void
*
* @since 2.5.4
*/
public function install()
{
$this->checkToken('get');
$this->app->setUserState('com_joomlaupdate.oldversion', JVERSION);
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
Log::add(Text::_('COM_JOOMLAUPDATE_UPDATE_LOG_INSTALL'), Log::INFO, 'Update');
$file = $this->app->getUserState('com_joomlaupdate.file', null);
$model->createRestorationFile($file);
$this->display();
}
/**
* Finalise the upgrade by running the necessary scripts
*
* @return void
*
* @since 2.5.4
*/
public function finalise()
{
/*
* Finalize with login page. Used for pre-token check versions
* to allow updates without problems but with a maximum of security.
*/
if (!Session::checkToken('get')) {
$this->setRedirect('index.php?option=com_joomlaupdate&view=update&layout=finaliseconfirm');
return;
}
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
try {
$model->finaliseUpgrade();
} catch (\Throwable $e) {
$model->collectError('finaliseUpgrade', $e);
}
// Reset update source from "Joomla Next" to "Default"
$this->app->setUserState('com_joomlaupdate.update_channel_reset', $model->resetUpdateSource());
// Check for update errors
if ($model->getErrors()) {
// The errors already should be logged at this point
// Collect a messages to show them later in the complete page
$errors = [];
foreach ($model->getErrors() as $error) {
$errors[] = $error->getMessage();
}
$this->app->setUserState('com_joomlaupdate.update_finished_with_error', true);
$this->app->setUserState('com_joomlaupdate.update_errors', $errors);
}
// Check for captured output messages in the installer
$msg = Installer::getInstance()->get('extension_message');
if ($msg) {
$this->app->setUserState('com_joomlaupdate.installer_message', $msg);
}
$url = 'index.php?option=com_joomlaupdate&task=update.cleanup&' . Session::getFormToken() . '=1';
$this->setRedirect($url);
}
/**
* Clean up after ourselves
*
* @return void
*
* @since 2.5.4
*/
public function cleanup()
{
/*
* Cleanup with login page. Used for pre-token check versions to be able to update
* from =< 3.2.7 to allow updates without problems but with a maximum of security.
*/
if (!Session::checkToken('get')) {
$this->setRedirect('index.php?option=com_joomlaupdate&view=update&layout=finaliseconfirm');
return;
}
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
try {
$model->cleanUp();
} catch (\Throwable $e) {
$model->collectError('cleanUp', $e);
}
// Check for update errors
if ($model->getErrors()) {
// The errors already should be logged at this point
// Collect a messages to show them later in the complete page
$errors = $this->app->getUserState('com_joomlaupdate.update_errors', []);
foreach ($model->getErrors() as $error) {
$errors[] = $error->getMessage();
}
$this->app->setUserState('com_joomlaupdate.update_finished_with_error', true);
$this->app->setUserState('com_joomlaupdate.update_errors', $errors);
}
$url = 'index.php?option=com_joomlaupdate&view=joomlaupdate&layout=complete';
// In case for errored update, redirect to component view
if ($this->app->getUserState('com_joomlaupdate.update_finished_with_error')) {
$url .= '&tmpl=component';
}
$this->setRedirect($url);
}
/**
* Purges updates.
*
* @return void
*
* @since 3.0
*/
public function purge()
{
// Check for request forgeries
$this->checkToken('request');
// Purge updates
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
$model->purge();
$url = 'index.php?option=com_joomlaupdate';
$this->setRedirect($url, $model->_message);
}
/**
* Uploads an update package to the temporary directory, under a random name
*
* @return void
*
* @since 3.6.0
*/
public function upload()
{
// Check for request forgeries
$this->checkToken();
// Did a non Super User tried to upload something (a.k.a. pathetic hacking attempt)?
$this->app->getIdentity()->authorise('core.admin') or jexit(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
// Make sure logging is working before continue
try {
Log::add('Test logging', Log::INFO, 'Update');
} catch (\Throwable $e) {
$message = Text::sprintf('COM_JOOMLAUPDATE_UPDATE_LOGGING_TEST_FAIL', $e->getMessage());
$this->setRedirect('index.php?option=com_joomlaupdate', $message, 'error');
return;
}
Log::add(Text::_('COM_JOOMLAUPDATE_UPDATE_LOG_UPLOAD'), Log::INFO, 'Update');
try {
$model->upload();
} catch (\RuntimeException $e) {
$url = 'index.php?option=com_joomlaupdate';
$this->setRedirect($url, $e->getMessage(), 'error');
return;
}
$token = Session::getFormToken();
$url = 'index.php?option=com_joomlaupdate&task=update.captive&' . $token . '=1';
$this->setRedirect($url);
}
/**
* Checks there is a valid update package and redirects to the captive view for super admin authentication.
*
* @return void
*
* @since 3.6.0
*/
public function captive()
{
// Check for request forgeries
$this->checkToken('get');
// Did a non Super User tried to upload something (a.k.a. pathetic hacking attempt)?
if (!$this->app->getIdentity()->authorise('core.admin')) {
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
}
// Do I really have an update package?
$tempFile = $this->app->getUserState('com_joomlaupdate.temp_file', null);
if (empty($tempFile) || !is_file($tempFile)) {
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
}
$this->input->set('view', 'upload');
$this->input->set('layout', 'captive');
$this->display();
}
/**
* Checks the admin has super administrator privileges and then proceeds with the update.
*
* @return void
*
* @since 3.6.0
*/
public function confirm()
{
// Check for request forgeries
$this->checkToken();
// Did a non Super User tried to upload something (a.k.a. pathetic hacking attempt)?
if (!$this->app->getIdentity()->authorise('core.admin')) {
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
}
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
// Get the captive file before the session resets
$tempFile = $this->app->getUserState('com_joomlaupdate.temp_file', null);
// Do I really have an update package?
if (!$model->captiveFileExists()) {
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
}
// Try to log in
$credentials = [
'username' => $this->input->post->get('username', '', 'username'),
'password' => $this->input->post->get('passwd', '', 'raw'),
'secretkey' => $this->input->post->get('secretkey', '', 'raw'),
];
$result = $model->captiveLogin($credentials);
if (!$result) {
$model->removePackageFiles();
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
}
// Set the update source in the session
$this->app->setUserState('com_joomlaupdate.file', basename($tempFile));
try {
Log::add(Text::sprintf('COM_JOOMLAUPDATE_UPDATE_LOG_FILE', $tempFile), Log::INFO, 'Update');
} catch (\RuntimeException $exception) {
// Informational log only
}
// Redirect to the actual update page
$url = 'index.php?option=com_joomlaupdate&task=update.install&' . Session::getFormToken() . '=1';
$this->setRedirect($url);
}
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types.
* @see \Joomla\CMS\Filter\InputFilter::clean() for valid values.
*
* @return static This object to support chaining.
*
* @since 2.5.4
*/
public function display($cachable = false, $urlparams = [])
{
// Get the document object.
$document = $this->app->getDocument();
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'update');
$vFormat = $document->getType();
$lName = $this->input->get('layout', 'default', 'string');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat)) {
// Get the model for the view.
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->document = $document;
$view->display();
}
return $this;
}
/**
* Checks the admin has super administrator privileges and then proceeds with the final & cleanup steps.
*
* @return void
*
* @since 3.6.3
*/
public function finaliseconfirm()
{
// Check for request forgeries
$this->checkToken();
// Did a non Super User try do this?
if (!$this->app->getIdentity()->authorise('core.admin')) {
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
}
// Get the model
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
// Try to log in
$credentials = [
'username' => $this->input->post->get('username', '', 'username'),
'password' => $this->input->post->get('passwd', '', 'raw'),
'secretkey' => $this->input->post->get('secretkey', '', 'raw'),
];
$result = $model->captiveLogin($credentials);
// The login fails?
if (!$result) {
$this->setMessage(Text::_('JGLOBAL_AUTH_INVALID_PASS'), 'warning');
$this->setRedirect('index.php?option=com_joomlaupdate&view=update&layout=finaliseconfirm');
return;
}
// Redirect back to the actual finalise page
$this->setRedirect('index.php?option=com_joomlaupdate&task=update.finalise&' . Session::getFormToken() . '=1');
}
/**
* Fetch Extension update XML proxy. Used to prevent Access-Control-Allow-Origin errors.
* Prints a JSON string.
* Called from JS.
*
* @since 3.10.0
*
* @deprecated 4.3 will be removed in 6.0
* Use batchextensioncompatibility instead.
* Example: $updateController->batchextensioncompatibility();
*
* @return void
*/
public function fetchExtensionCompatibility()
{
$extensionID = $this->input->get('extension-id', '', 'DEFAULT');
$joomlaTargetVersion = $this->input->get('joomla-target-version', '', 'DEFAULT');
$joomlaCurrentVersion = $this->input->get('joomla-current-version', '', JVERSION);
$extensionVersion = $this->input->get('extension-version', '', 'DEFAULT');
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
$upgradeCompatibilityStatus = $model->fetchCompatibility($extensionID, $joomlaTargetVersion);
$currentCompatibilityStatus = $model->fetchCompatibility($extensionID, $joomlaCurrentVersion);
$upgradeUpdateVersion = false;
$currentUpdateVersion = false;
$upgradeWarning = 0;
if ($upgradeCompatibilityStatus->state == 1 && !empty($upgradeCompatibilityStatus->compatibleVersions)) {
$upgradeUpdateVersion = end($upgradeCompatibilityStatus->compatibleVersions);
}
if ($currentCompatibilityStatus->state == 1 && !empty($currentCompatibilityStatus->compatibleVersions)) {
$currentUpdateVersion = end($currentCompatibilityStatus->compatibleVersions);
}
if ($upgradeUpdateVersion !== false) {
$upgradeOldestVersion = $upgradeCompatibilityStatus->compatibleVersions[0];
if ($currentUpdateVersion !== false) {
// If there are updates compatible with both CMS versions use these
$bothCompatibleVersions = array_values(
array_intersect($upgradeCompatibilityStatus->compatibleVersions, $currentCompatibilityStatus->compatibleVersions)
);
if (!empty($bothCompatibleVersions)) {
$upgradeOldestVersion = $bothCompatibleVersions[0];
$upgradeUpdateVersion = end($bothCompatibleVersions);
}
}
if (version_compare($upgradeOldestVersion, $extensionVersion, '>')) {
// Installed version is empty or older than the oldest compatible update: Update required
$resultGroup = 2;
} else {
// Current version is compatible
$resultGroup = 3;
}
if ($currentUpdateVersion !== false && version_compare($upgradeUpdateVersion, $currentUpdateVersion, '<')) {
// Special case warning when version compatible with target is lower than current
$upgradeWarning = 2;
}
} elseif ($currentUpdateVersion !== false) {
// No compatible version for target version but there is a compatible version for current version
$resultGroup = 1;
} else {
// No update server available
$resultGroup = 1;
}
// Do we need to capture
$combinedCompatibilityStatus = [
'upgradeCompatibilityStatus' => (object) [
'state' => $upgradeCompatibilityStatus->state,
'compatibleVersion' => $upgradeUpdateVersion,
],
'currentCompatibilityStatus' => (object) [
'state' => $currentCompatibilityStatus->state,
'compatibleVersion' => $currentUpdateVersion,
],
'resultGroup' => $resultGroup,
'upgradeWarning' => $upgradeWarning,
];
$this->app = Factory::getApplication();
$this->app->mimeType = 'application/json';
$this->app->charSet = 'utf-8';
$this->app->setHeader('Content-Type', $this->app->mimeType . '; charset=' . $this->app->charSet);
$this->app->sendHeaders();
try {
echo new JsonResponse($combinedCompatibilityStatus);
} catch (\Exception $e) {
echo $e;
}
$this->app->close();
}
/**
* Determines the compatibility information for a number of extensions.
*
* Called by the Joomla Update JavaScript (PreUpdateChecker.checkNextChunk).
*
* @return void
* @since 4.2.0
*
*/
public function batchextensioncompatibility()
{
$joomlaTargetVersion = $this->input->post->get('joomla-target-version', '', 'DEFAULT');
$joomlaCurrentVersion = $this->input->post->get('joomla-current-version', JVERSION);
$extensionInformation = $this->input->post->get('extensions', []);
/** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
$model = $this->getModel('Update');
$extensionResults = [];
$leftover = [];
$startTime = microtime(true);
foreach ($extensionInformation as $information) {
// Only process an extension if we have spent less than 5 seconds already
$currentTime = microtime(true);
if ($currentTime - $startTime > 5.0) {
$leftover[] = $information;
continue;
}
// Get the extension information and fetch its compatibility information
$extensionID = $information['eid'] ?: '';
$extensionVersion = $information['version'] ?: '';
$upgradeCompatibilityStatus = $model->fetchCompatibility($extensionID, $joomlaTargetVersion);
$currentCompatibilityStatus = $model->fetchCompatibility($extensionID, $joomlaCurrentVersion);
$upgradeUpdateVersion = false;
$currentUpdateVersion = false;
$upgradeWarning = 0;
if ($upgradeCompatibilityStatus->state == 1 && !empty($upgradeCompatibilityStatus->compatibleVersions)) {
$upgradeUpdateVersion = end($upgradeCompatibilityStatus->compatibleVersions);
}
if ($currentCompatibilityStatus->state == 1 && !empty($currentCompatibilityStatus->compatibleVersions)) {
$currentUpdateVersion = end($currentCompatibilityStatus->compatibleVersions);
}
if ($upgradeUpdateVersion !== false) {
$upgradeOldestVersion = $upgradeCompatibilityStatus->compatibleVersions[0];
if ($currentUpdateVersion !== false) {
// If there are updates compatible with both CMS versions use these
$bothCompatibleVersions = array_values(
array_intersect($upgradeCompatibilityStatus->compatibleVersions, $currentCompatibilityStatus->compatibleVersions)
);
if (!empty($bothCompatibleVersions)) {
$upgradeOldestVersion = $bothCompatibleVersions[0];
$upgradeUpdateVersion = end($bothCompatibleVersions);
}
}
if (version_compare($upgradeOldestVersion, $extensionVersion, '>')) {
// Installed version is empty or older than the oldest compatible update: Update required
$resultGroup = 2;
} else {
// Current version is compatible
$resultGroup = 3;
}
if ($currentUpdateVersion !== false && version_compare($upgradeUpdateVersion, $currentUpdateVersion, '<')) {
// Special case warning when version compatible with target is lower than current
$upgradeWarning = 2;
}
} elseif ($currentUpdateVersion !== false) {
// No compatible version for target version but there is a compatible version for current version
$resultGroup = 1;
} else {
// No update server available
$resultGroup = 1;
}
// Do we need to capture
$extensionResults[] = [
'id' => $extensionID,
'upgradeCompatibilityStatus' => (object) [
'state' => $upgradeCompatibilityStatus->state,
'compatibleVersion' => $upgradeUpdateVersion,
],
'currentCompatibilityStatus' => (object) [
'state' => $currentCompatibilityStatus->state,
'compatibleVersion' => $currentUpdateVersion,
],
'resultGroup' => $resultGroup,
'upgradeWarning' => $upgradeWarning,
];
}
$this->app->mimeType = 'application/json';
$this->app->charSet = 'utf-8';
$this->app->setHeader('Content-Type', $this->app->mimeType . '; charset=' . $this->app->charSet);
$this->app->sendHeaders();
try {
$return = [
'compatibility' => $extensionResults,
'extensions' => $leftover,
];
echo new JsonResponse($return);
} catch (\Exception $e) {
echo $e;
}
$this->app->close();
}
/**
* Fetch and report updates in \JSON format, for AJAX requests
*
* @return void
*
* @since 3.10.10
*/
public function ajax()
{
if (!Session::checkToken('get')) {
$this->app->setHeader('status', 403, true);
$this->app->sendHeaders();
echo Text::_('JINVALID_TOKEN_NOTICE');
$this->app->close();
}
/** @var UpdateModel $model */
$model = $this->getModel('Update');
$updateInfo = $model->getUpdateInformation();
$update = [];
$update[] = ['version' => $updateInfo['latest']];
echo json_encode($update);
$this->app->close();
}
}

View File

@ -0,0 +1,39 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Joomlaupdate\Administrator\Dispatcher;
use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Dispatcher\ComponentDispatcher;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* ComponentDispatcher class for com_joomlaupdate
*
* @since 4.0.0
*/
class Dispatcher extends ComponentDispatcher
{
/**
* Joomla Update is checked for global core.admin rights - not the usual core.manage for the component
*
* @return void
*/
protected function checkAccess()
{
// Check the user has permission to access this component if in the backend
if ($this->app->isClient('administrator') && !$this->app->getIdentity()->authorise('core.admin')) {
throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,325 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Joomlaupdate\Administrator\View\Joomlaupdate;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Version;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! Update's Default View
*
* @since 2.5.4
*/
class HtmlView extends BaseHtmlView
{
/**
* An array with the Joomla! update information.
*
* @var array
*
* @since 3.6.0
*/
protected $updateInfo = null;
/**
* PHP options.
*
* @var array Array of PHP config options
*
* @since 3.10.0
*/
protected $phpOptions = null;
/**
* PHP settings.
*
* @var array Array of PHP settings
*
* @since 3.10.0
*/
protected $phpSettings = null;
/**
* Non Core Extensions.
*
* @var array Array of Non-Core-Extensions
*
* @since 3.10.0
*/
protected $nonCoreExtensions = null;
/**
* The model state
*
* @var \Joomla\Registry\Registry
*
* @since 4.0.0
*/
protected $state;
/**
* Flag if the update component itself has to be updated
*
* @var boolean True when update is available otherwise false
*
* @since 4.0.0
*/
protected $selfUpdateAvailable = false;
/**
* The default admin template for the major version of Joomla that should be used when
* upgrading to the next major version of Joomla
*
* @var string
*
* @since 4.0.0
*/
protected $defaultBackendTemplate = 'atum';
/**
* Flag if default backend template is being used
*
* @var boolean True when default backend template is being used
*
* @since 4.0.0
*/
protected $isDefaultBackendTemplate = false;
/**
* A special prefix used for the emptystate layout variable
*
* @var string The prefix
*
* @since 4.0.0
*/
protected $messagePrefix = '';
/**
* A special text used for the emptystate layout to explain why there is no download
*
* @var string The message
*
* @since 4.4.0
*/
protected $reasonNoDownload = '';
/**
* Details on failed PHP or DB version requirements to be shown in the emptystate layout when there is no download
*
* @var \stdClass PHP and database requirements from the update manifest
*
* @since 4.4.2
*/
protected $detailsNoDownload;
/**
* List of non core critical plugins
*
* @var \stdClass[]
* @since 4.0.0
*/
protected $nonCoreCriticalPlugins = [];
/**
* Should I disable the confirmation checkbox for pre-update extension version checks?
*
* @var boolean
* @since 4.2.0
*/
protected $noVersionCheck = false;
/**
* Should I disable the confirmation checkbox for taking a backup before updating?
*
* @var boolean
* @since 4.2.0
*/
protected $noBackupCheck = false;
/**
* Renders the view
*
* @param string $tpl Template name
*
* @return void
*
* @since 2.5.4
*/
public function display($tpl = null)
{
$this->updateInfo = $this->get('UpdateInformation');
$this->selfUpdateAvailable = $this->get('CheckForSelfUpdate');
// Get results of pre update check evaluations
$model = $this->getModel();
$this->phpOptions = $this->get('PhpOptions');
$this->phpSettings = $this->get('PhpSettings');
$this->nonCoreExtensions = $this->get('NonCoreExtensions');
$this->isDefaultBackendTemplate = (bool) $model->isTemplateActive($this->defaultBackendTemplate);
$nextMajorVersion = Version::MAJOR_VERSION + 1;
// The critical plugins check is only available for major updates.
if (version_compare($this->updateInfo['latest'], (string) $nextMajorVersion, '>=')) {
$this->nonCoreCriticalPlugins = $this->get('NonCorePlugins');
}
// Set to true if a required PHP option is not ok
$isCritical = false;
foreach ($this->phpOptions as $option) {
if (!$option->state) {
$isCritical = true;
break;
}
}
$this->state = $this->get('State');
$hasUpdate = !empty($this->updateInfo['hasUpdate']);
$hasDownload = isset($this->updateInfo['object']->downloadurl->_data);
// Fresh update, show it
if ($this->getLayout() == 'complete') {
// Complete message, nothing to do here
} elseif ($this->selfUpdateAvailable) {
// There is an update for the updater itself. So we have to update it first
$this->setLayout('selfupdate');
} elseif (!$hasDownload || !$hasUpdate) {
// Could be that we have a download file but no update, so we offer a re-install
if ($hasDownload) {
// We can reinstall if we have a URL but no update
$this->setLayout('reinstall');
} else {
// No download available
if ($hasUpdate) {
$this->messagePrefix = '_NODOWNLOAD';
$this->reasonNoDownload = 'COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON';
$this->detailsNoDownload = $this->updateInfo['object']->get('otherUpdateInfo');
}
$this->setLayout('noupdate');
}
} elseif ($this->getLayout() != 'update' && ($isCritical || $this->shouldDisplayPreUpdateCheck())) {
// Here we have now two options: preupdatecheck or update
$this->setLayout('preupdatecheck');
} else {
$this->setLayout('update');
}
if (\in_array($this->getLayout(), ['preupdatecheck', 'update', 'upload'])) {
$language = $this->getLanguage();
$language->load('com_installer', JPATH_ADMINISTRATOR, 'en-GB', false, true);
$language->load('com_installer', JPATH_ADMINISTRATOR, null, true);
Factory::getApplication()->enqueueMessage(Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATE_NOTICE'), 'warning');
}
$params = ComponentHelper::getParams('com_joomlaupdate');
switch ($params->get('updatesource', 'default')) {
case 'next':
// "Minor & Patch Release for Current version AND Next Major Release".
$this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_NEXT';
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT');
break;
case 'custom':
// "Custom"
$this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_CUSTOM';
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM');
break;
default:
/**
* "Minor & Patch Release for Current version (recommended and default)".
* The commented "case" below are for documenting where 'default' and legacy options falls
* case 'default':
* case 'sts':
* case 'lts':
* case 'nochange':
* case 'testing':
*/
$this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_DEFAULT';
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT');
}
$this->noVersionCheck = $params->get('versioncheck', 1) == 0;
$this->noBackupCheck = $params->get('backupcheck', 1) == 0;
// Remove temporary files
$this->getModel()->removePackageFiles();
$this->addToolbar();
// Render the view.
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 4.0.0
*/
protected function addToolbar()
{
// Set the toolbar information.
ToolbarHelper::title(Text::_('COM_JOOMLAUPDATE_OVERVIEW'), 'joomla install');
if (\in_array($this->getLayout(), ['update', 'complete'])) {
$arrow = $this->getLanguage()->isRtl() ? 'arrow-right' : 'arrow-left';
ToolbarHelper::link('index.php?option=com_joomlaupdate', 'JTOOLBAR_BACK', $arrow);
ToolbarHelper::title(Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_TAB_UPLOAD'), 'joomla install');
} elseif (!$this->selfUpdateAvailable) {
ToolbarHelper::custom('update.purge', 'loop', '', 'COM_JOOMLAUPDATE_TOOLBAR_CHECK', false);
}
// Add toolbar buttons.
if ($this->getCurrentUser()->authorise('core.admin')) {
ToolbarHelper::preferences('com_joomlaupdate');
}
ToolbarHelper::divider();
ToolbarHelper::help('Joomla_Update');
}
/**
* Returns true, if the pre update check should be displayed.
*
* @return boolean
*
* @since 3.10.0
*/
public function shouldDisplayPreUpdateCheck()
{
// When the download URL is not found there is no core upgrade path
if (!isset($this->updateInfo['object']->downloadurl->_data)) {
return false;
}
$nextMinor = Version::MAJOR_VERSION . '.' . (Version::MINOR_VERSION + 1);
// Show only when we found a download URL, we have an update and when we update to the next minor or greater.
return $this->updateInfo['hasUpdate']
&& version_compare($this->updateInfo['latest'], $nextMinor, '>=');
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Joomlaupdate\Administrator\View\Update;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! Update's Update View
*
* @since 2.5.4
*/
class HtmlView extends BaseHtmlView
{
/**
* Renders the view.
*
* @param string $tpl Template name.
*
* @return void
*/
public function display($tpl = null)
{
Factory::getApplication()->getInput()->set('hidemainmenu', true);
// Set the toolbar information.
ToolbarHelper::title(Text::_('COM_JOOMLAUPDATE_OVERVIEW'), 'sync install');
// Render the view.
parent::display($tpl);
}
}

View File

@ -0,0 +1,113 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Joomlaupdate\Administrator\View\Upload;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! Update's Update View
*
* @since 3.6.0
*/
class HtmlView extends BaseHtmlView
{
/**
* An array with the Joomla! update information.
*
* @var array
*
* @since 4.0.0
*/
protected $updateInfo = null;
/**
* Flag if the update component itself has to be updated
*
* @var boolean True when update is available otherwise false
*
* @since 4.0.0
*/
protected $selfUpdateAvailable = false;
/**
* Warnings for the upload update
*
* @var array An array of warnings which could prevent the upload update
*
* @since 4.0.0
*/
protected $warnings = [];
/**
* Should I disable the confirmation checkbox for taking a backup before updating?
*
* @var boolean
* @since 4.2.0
*/
protected $noBackupCheck = false;
/**
* Renders the view.
*
* @param string $tpl Template name.
*
* @return void
*
* @since 3.6.0
*/
public function display($tpl = null)
{
// Load com_installer's language
$language = $this->getLanguage();
$language->load('com_installer', JPATH_ADMINISTRATOR, 'en-GB', false, true);
$language->load('com_installer', JPATH_ADMINISTRATOR, null, true);
$this->updateInfo = $this->get('UpdateInformation');
$this->selfUpdateAvailable = $this->get('CheckForSelfUpdate');
if ($this->getLayout() !== 'captive') {
$this->warnings = $this->get('Items', 'warnings');
}
$params = ComponentHelper::getParams('com_joomlaupdate');
$this->noBackupCheck = $params->get('backupcheck', 1) == 0;
$this->addToolbar();
// Render the view.
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 4.0.0
*/
protected function addToolbar()
{
// Set the toolbar information.
ToolbarHelper::title(Text::_('COM_JOOMLAUPDATE_OVERVIEW'), 'sync install');
$arrow = $this->getLanguage()->isRtl() ? 'arrow-right' : 'arrow-left';
ToolbarHelper::link('index.php?option=com_joomlaupdate&' . ($this->getLayout() == 'captive' ? 'view=upload' : ''), 'JTOOLBAR_BACK', $arrow);
ToolbarHelper::divider();
ToolbarHelper::help('Joomla_Update');
}
}

View File

@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
/** @var \Joomla\Component\Joomlaupdate\Administrator\View\Joomlaupdate\HtmlView $this */
$hadErrors = $this->state->get('update_finished_with_error');
$errors = $this->state->get('update_errors');
$channelReset = $this->state->get('update_channel_reset');
$logFile = $this->state->get('log_file');
$installerMsg = $this->state->get('installer_message');
$forumLink = '<a href="https://forum.joomla.org/" target="_blank" rel="noopener noreferrer">https://forum.joomla.org/</a>';
?>
<div class="card">
<h2 class="card-header"><?php echo Text::_('COM_JOOMLAUPDATE_VIEW_COMPLETE_HEADING'); ?></h2>
<div class="card-body">
<?php if ($channelReset) : ?>
<div class="alert alert-success">
<span class="icon-check-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('NOTICE'); ?></span>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_UPDATE_CHANGE_UPDATE_SOURCE_OK', Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT'), Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT')); ?>
</div>
<?php elseif ($channelReset !== null) : ?>
<div class="alert alert-warning">
<span class="icon-check-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('WARNING'); ?></span>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_UPDATE_CHANGE_UPDATE_SOURCE_FAILED', Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT'), Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT')); ?>
</div>
<?php endif; ?>
<?php if (!$hadErrors) : ?>
<div class="alert alert-success">
<span class="icon-check-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('NOTICE'); ?></span>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_VIEW_COMPLETE_MESSAGE', '&#x200E;' . JVERSION); ?>
</div>
<?php else : ?>
<div class="alert alert-error">
<span class="icon-check-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('NOTICE'); ?></span>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_VIEW_COMPLETE_WITH_ERROR_MESSAGE', $logFile, $forumLink); ?>
</div>
<p>
<a href="<?php echo Uri::base(true); ?>/" class="btn btn-primary"><?php echo Text::_('JGLOBAL_TPL_CPANEL_LINK_TEXT') ?></a>
</p>
<?php if ($errors) : ?>
<h3><?php echo Text::_('COM_JOOMLAUPDATE_VIEW_COMPLETE_UPDATE_ERRORS'); ?></h3>
<?php foreach ($errors as $error) : ?>
<div class="alert alert-error"><?php echo $error; ?></div>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($installerMsg) : ?>
<div>
<h3><?php echo Text::_('COM_JOOMLAUPDATE_VIEW_COMPLETE_INSTALLER_MESSAGE'); ?></h3>
<div class="alert alert-warning"><?php echo $installerMsg ?></div>
</div>
<?php endif; ?>
</div>
</div>
<form action="<?php echo Route::_('index.php?option=com_joomlaupdate'); ?>" method="post" id="adminForm">
<input type="hidden" name="task" value="">
<?php echo HTMLHelper::_('form.token'); ?>
</form>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<layout title="COM_JOOMLAUPDATE_DEFAULT_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_JOOMLAUPDATE_DEFAULT_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<fields name="params">
<fieldset name="basic" label="JOPTIONS">
<field
name="ajax-badge"
type="radio"
label="COM_JOOMLAUPDATE_JOOMLAUPDATE_VIEW_DISPLAY_BADGE"
layout="joomla.form.field.radio.switcher"
default=""
>
<option value="">JHIDE</option>
<option value="index.php?option=com_joomlaupdate&amp;task=getMenuBadgeData&amp;format=json">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Session\Session;
/** @var \Joomla\Component\Joomlaupdate\Administrator\View\Joomlaupdate\HtmlView $this */
$uploadLink = 'index.php?option=com_joomlaupdate&view=upload';
$reasonNoDownload = '';
if (!empty($this->reasonNoDownload)) {
$reasonNoDownload = Text::_($this->reasonNoDownload) . '<br>';
if (isset($this->detailsNoDownload->php)) {
$reasonNoDownload .= Text::sprintf(
'COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON_PHP',
$this->detailsNoDownload->php->used,
$this->detailsNoDownload->php->required
) . '<br>';
}
if (isset($this->detailsNoDownload->db)) {
$reasonNoDownload .= Text::sprintf(
'COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON_DATABASE',
Text::_('JLIB_DB_SERVER_TYPE_' . $this->detailsNoDownload->db->type),
$this->detailsNoDownload->db->used,
$this->detailsNoDownload->db->required
) . '<br>';
}
$reasonNoDownload .= Text::_('COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON_ACTION') . '<br>';
}
$displayData = [
'textPrefix' => 'COM_JOOMLAUPDATE' . $this->messagePrefix,
'content' => $reasonNoDownload . Text::sprintf($this->langKey, $this->updateSourceKey),
'formURL' => 'index.php?option=com_joomlaupdate&view=joomlaupdate',
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Updating_from_an_existing_version',
'icon' => 'icon-loop joomlaupdate',
'createURL' => 'index.php?option=com_joomlaupdate&task=update.purge&' . Session::getFormToken() . '=1'
];
if ($this->getCurrentUser()->authorise('core.admin', 'com_joomlaupdate')) {
$displayData['formAppend'] = '<div class="text-center"><a href="' . $uploadLink . '" class="btn btn-sm btn-outline-secondary">' . Text::_($displayData['textPrefix'] . '_EMPTYSTATE_APPEND') . '</a></div>';
}
if (isset($this->updateInfo['object']) && isset($this->updateInfo['object']->get('infourl')->_data)) :
$displayData['content'] .= '<br>' . HTMLHelper::_(
'link',
$this->updateInfo['object']->get('infourl')->_data,
Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_INFOURL'),
[
'target' => '_blank',
'rel' => 'noopener noreferrer',
'title' => isset($this->updateInfo['object']->get('infourl')->title) ? Text::sprintf('JBROWSERTARGET_NEW_TITLE', $this->updateInfo['object']->get('infourl')->title) : ''
]
);
endif;
$content = LayoutHelper::render('joomla.content.emptystate', $displayData);
// Inject Joomla! version
echo str_replace('%1$s', '&#x200E;' . $this->updateInfo['latest'], $content);

View File

@ -0,0 +1,371 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Version;
use Joomla\Component\Joomlaupdate\Administrator\View\Joomlaupdate\HtmlView;
/** @var HtmlView $this */
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->getDocument()->getWebAssetManager();
$wa->useScript('core')
->useScript('com_joomlaupdate.default')
->useScript('bootstrap.popover')
->useScript('bootstrap.tab');
// Text::script doesn't have a sprintf equivalent so work around this
$this->getDocument()->addScriptOptions('nonCoreCriticalPlugins', $this->nonCoreCriticalPlugins);
// Push Joomla! Update client-side error messages
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_CONFIRM_MESSAGE');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_WARNING_UNKNOWN');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_SERVER_ERROR');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_MORE_COMPATIBILITY_INFORMATION');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_LESS_COMPATIBILITY_INFORMATION');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_DESC');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_LIST');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_CONFIRM_MESSAGE');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_HELP');
// Push Joomla! core Joomla.Request error messages
Text::script('JLIB_JS_AJAX_ERROR_CONNECTION_ABORT');
Text::script('JLIB_JS_AJAX_ERROR_NO_CONTENT');
Text::script('JLIB_JS_AJAX_ERROR_OTHER');
Text::script('JLIB_JS_AJAX_ERROR_PARSE');
Text::script('JLIB_JS_AJAX_ERROR_TIMEOUT');
$compatibilityTypes = [
'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_RUNNING_PRE_UPDATE_CHECKS' => [
'class' => 'info',
'icon' => 'hourglass fa-spin',
'notes' => 'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_RUNNING_PRE_UPDATE_CHECKS_NOTES',
'group' => 0,
],
'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_REQUIRING_UPDATES_TO_BE_COMPATIBLE' => [
'class' => 'danger',
'icon' => 'times',
'notes' => 'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_REQUIRING_UPDATES_TO_BE_COMPATIBLE_NOTES',
'group' => 2,
],
'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_PRE_UPDATE_CHECKS_FAILED' => [
'class' => 'warning',
'icon' => 'exclamation-triangle',
'notes' => 'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_PRE_UPDATE_CHECKS_FAILED_NOTES',
'group' => 4,
],
'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_UPDATE_SERVER_OFFERS_NO_COMPATIBLE_VERSION' => [
'class' => 'warning',
'icon' => 'exclamation-triangle',
'notes' => 'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_UPDATE_SERVER_OFFERS_NO_COMPATIBLE_VERSION_NOTES',
'group' => 1,
],
'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_PROBABLY_COMPATIBLE' => [
'class' => 'success',
'icon' => 'check',
'notes' => 'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_PROBABLY_COMPATIBLE_NOTES',
'group' => 3,
],
];
$latestJoomlaVersion = $this->updateInfo['latest'];
$currentJoomlaVersion = $this->updateInfo['installed'] ?? JVERSION;
$updatePossible = true;
if (version_compare($this->updateInfo['latest'], Version::MAJOR_VERSION + 1, '>=') && $this->isDefaultBackendTemplate === false) {
Factory::getApplication()->enqueueMessage(
Text::sprintf(
'COM_JOOMLAUPDATE_VIEW_DEFAULT_NON_CORE_BACKEND_TEMPLATE_USED_NOTICE',
ucfirst($this->defaultBackendTemplate)
),
'info'
);
}
?>
<div id="joomlaupdate-wrapper" class="main-card p-3 mt-3" data-joomla-target-version="<?php echo $latestJoomlaVersion; ?>" data-joomla-current-version="<?php echo $currentJoomlaVersion; ?>">
<h2 class="my-3">
<?php echo Text::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_PREUPDATE_CHECK', '&#x200E;' . $this->updateInfo['latest']); ?>
</h2>
<p>
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXPLANATION_AND_LINK_TO_DOCS'); ?>
</p>
<div class="d-flex flex-wrap flex-lg-nowrap align-items-start my-4" id="preupdatecheck">
<div class="nav flex-column text-nowrap nav-pills me-3 mb-4" role="tablist" aria-orientation="vertical">
<button class="nav-link d-flex justify-content-between align-items-center active" id="joomlaupdate-precheck-required-tab" data-bs-toggle="pill" data-bs-target="#joomlaupdate-precheck-required-content" type="button" role="tab" aria-controls="joomlaupdate-precheck-required-content" aria-selected="true">
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_REQUIRED_SETTINGS'); ?>
<?php $labelClass = 'success'; ?>
<?php foreach ($this->phpOptions as $option) : ?>
<?php if (!$option->state) : ?>
<?php $labelClass = 'danger'; ?>
<?php $updatePossible = false; ?>
<?php break; ?>
<?php endif; ?>
<?php endforeach; ?>
<span class="fa fa-<?php echo $labelClass == 'danger' ? 'times' : 'check'; ?> fa-fw py-1 bg-white text-<?php echo $labelClass; ?>" aria-hidden="true"></span>
</button>
<button class="nav-link d-flex justify-content-between align-items-center" id="joomlaupdate-precheck-recommended-tab" data-bs-toggle="pill" data-bs-target="#joomlaupdate-precheck-recommended-content" type="button" role="tab" aria-controls="joomlaupdate-precheck-recommended-content" aria-selected="false">
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_RECOMMENDED_SETTINGS'); ?>
<?php $labelClass = 'success'; ?>
<?php foreach ($this->phpSettings as $setting) : ?>
<?php if ($setting->state !== $setting->recommended) : ?>
<?php $labelClass = 'warning'; ?>
<?php break; ?>
<?php endif; ?>
<?php endforeach; ?>
<span class="fa fa-<?php echo $labelClass == 'warning' ? 'exclamation-triangle' : 'check'; ?> fa-fw py-1 bg-white text-<?php echo $labelClass; ?>" aria-hidden="true"></span>
</button>
<button class="nav-link d-flex justify-content-between align-items-center" id="joomlaupdate-precheck-extensions-tab" data-bs-toggle="pill" data-bs-target="#joomlaupdate-precheck-extensions-content" type="button" role="tab" aria-controls="joomlaupdate-precheck-extensions-content" aria-selected="false">
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_EXTENSIONS'); ?>
<?php $labelClass = 'success'; ?>
<span class="fa fa-spinner fa-spin fa-fw py-1" aria-hidden="true"></span>
</button>
</div>
<div class="tab-content w-100">
<div class="tab-pane fade show active" id="joomlaupdate-precheck-required-content" role="tabpanel" aria-labelledby="joomlaupdate-precheck-required-tab">
<h3>
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_REQUIRED_SETTINGS'); ?>
</h3>
<div class="table-responsive">
<table class="table table-striped" id="preupdatecheck">
<caption class="visually-hidden">
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_CHECK_CAPTION'); ?>
</caption>
<thead>
<tr>
<th scope="col">
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_HEADING_REQUIREMENT'); ?>
</th>
<th scope="col">
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_HEADING_CHECKED'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->phpOptions as $option) : ?>
<tr>
<th scope="row">
<?php echo $option->label; ?>
<?php if ($option->notice) : ?>
<div class="small">
<?php echo $option->notice; ?>
</div>
<?php endif; ?>
</th>
<td>
<span class="badge bg-<?php echo $option->state ? 'success' : 'danger'; ?>">
<?php echo Text::_($option->state ? 'JYES' : 'JNO'); ?>
</span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade show" id="joomlaupdate-precheck-recommended-content" role="tabpanel" aria-labelledby="joomlaupdate-precheck-recommended-tab">
<h3>
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_RECOMMENDED_SETTINGS'); ?>
</h3>
<div class="table-responsive">
<table class="table table-striped" id="preupdatecheckphp">
<caption>
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_RECOMMENDED_SETTINGS_DESC'); ?>
</caption>
<thead>
<tr>
<th scope="col">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_DIRECTIVE'); ?>
</th>
<th scope="col">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_RECOMMENDED'); ?>
</th>
<th scope="col">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_ACTUAL'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->phpSettings as $setting) : ?>
<tr>
<th scope="row">
<?php echo $setting->label; ?>
</th>
<td>
<?php echo Text::_($setting->recommended ? 'JON' : 'JOFF'); ?>
</td>
<td>
<span class="badge bg-<?php echo ($setting->state === $setting->recommended) ? 'success' : 'warning'; ?>">
<?php echo Text::_($setting->state ? 'JON' : 'JOFF'); ?>
</span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade show" id="joomlaupdate-precheck-extensions-content" role="tabpanel" aria-labelledby="joomlaupdate-precheck-extensions-tab">
<h3>
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS'); ?>
</h3>
<div id="preupdateCheckWarning">
<div class="alert alert-warning">
<h4 class="alert-heading">
<?php echo Text::_('WARNING'); ?>
</h4>
<div class="alert-message">
<div class="preupdateCheckIncomplete">
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_CHECK_NOT_COMPLETE'); ?>
</div>
</div>
</div>
</div>
<div id="preupdateCheckCompleteProblems" class="hidden">
<div class="alert alert-warning">
<h4 class="alert-heading">
<?php echo Text::_('WARNING'); ?>
</h4>
<div class="alert-message">
<div class="preupdateCheckComplete">
<?php echo Text::_('COM_JOOMLAUPDATE_PREUPDATE_CHECK_COMPLETED_YOU_HAVE_DANGEROUS_PLUGINS'); ?>
</div>
</div>
</div>
</div>
<?php if (!empty($this->nonCoreExtensions)) : ?>
<div class="w-100">
<?php foreach ($compatibilityTypes as $compatibilityType => $data) : ?>
<div class="<?php echo $data['group'] > 0 ? 'hidden' : ''; ?> compatibilityTable" id="compatibilityTable<?php echo (int) $data['group']; ?>">
<h4 class="text-<?php echo $data['class']; ?> align-items-center">
<span class="fa fa-<?php echo $data['icon']; ?> me-2"></span>
<?php echo Text::_($compatibilityType); ?>
<?php if ($data['group'] > 0) : ?>
<button type="button" class="btn btn-primary btn-sm ms-3 compatibilitytoggle" data-state="closed">
<?php echo Text::_(
'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_MORE_COMPATIBILITY_INFORMATION'
); ?>
</button>
<?php endif; ?>
</h4>
<div class="table-responsive mb-5">
<table class="table table-striped">
<caption>
<?php echo Text::_($data['notes']); ?>
</caption>
<thead class="row-fluid">
<tr>
<th class="exname" scope="col">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NAME'); ?>
</th>
<th class="extype" scope="col">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_TYPE'); ?>
</th>
<th class="instver hidden" scope="col">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_INSTALLED_VERSION'); ?>
</th>
<th class="currcomp hidden" scope="col">
<?php echo Text::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_COMPATIBLE_WITH_JOOMLA_VERSION', isset($this->updateInfo['installed']) ? $this->escape($this->updateInfo['installed']) : JVERSION); ?>
</th>
<th class="upcomp hidden" scope="col">
<?php echo Text::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_COMPATIBLE_WITH_JOOMLA_VERSION', $this->escape($this->updateInfo['latest'])); ?>
</th>
</tr>
</thead>
<tbody class="row-fluid">
<?php // Only include this row once since the javascript moves the results into the right place ?>
<?php if ($data['group'] == 0) : ?>
<?php foreach ($this->nonCoreExtensions as $extension) : ?>
<tr>
<th class="exname" scope="row">
<?php echo $extension->name; ?>
</th>
<td class="extype">
<?php echo Text::_('COM_INSTALLER_TYPE_' . strtoupper($extension->type)); ?>
</td>
<td class="instver hidden">
<?php echo $extension->version; ?>
</td>
<td id="available-version-<?php echo $extension->extension_id; ?>" class="currcomp hidden"></td>
<td id="preUpdateCheck_<?php echo $extension->extension_id; ?>"
class="extension-check upcomp hidden"
data-extension-id="<?php echo $extension->extension_id; ?>"
data-extension-current-version="<?php echo $extension->version; ?>"
>
<img src="<?php echo Uri::root(true); ?>/media/system/images/ajax-loader.gif">
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<?php endforeach; ?>
</div>
<?php else : ?>
<div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_NONE'); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php if ($updatePossible) : ?>
<form action="<?php echo Route::_('index.php?option=com_joomlaupdate&layout=update'); ?>" method="post" class="d-flex flex-column mb-5">
<?php if (!$this->noVersionCheck) : ?>
<div id="preupdatecheckbox">
<div class="form-check d-flex justify-content-center mb-3">
<input type="checkbox" class="form-check-input me-3" id="noncoreplugins" name="noncoreplugins" value="1" required />
<label class="form-check-label" for="noncoreplugins">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_NON_CORE_PLUGIN_CONFIRMATION'); ?>
</label>
</div>
</div>
<?php endif; ?>
<button class="btn btn-lg btn-warning <?php echo $this->noVersionCheck ? '' : 'disabled' ?> submitupdate mx-auto"
type="submit" <?php echo $this->noVersionCheck ? '' : 'disabled' ?>>
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLUPDATE'); ?>
</button>
</form>
<?php endif; ?>
<form action="<?php echo Route::_('index.php?option=com_joomlaupdate&layout=update'); ?>" method="post" name="adminForm" id="adminForm">
<input type="hidden" name="task" value="">
<?php echo HTMLHelper::_('form.token'); ?>
</form>
<?php if ($this->getCurrentUser()->authorise('core.admin')) : ?>
<div class="text-center">
<a href="<?php echo Route::_('index.php?option=com_joomlaupdate&view=upload'); ?>" class="btn btn-sm btn-outline-secondary">
<?php echo Text::_('COM_JOOMLAUPDATE_EMPTYSTATE_APPEND'); ?>
</a>
</div>
<?php endif; ?>
</div>

View File

@ -0,0 +1,57 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
/** @var \Joomla\Component\Joomlaupdate\Administrator\View\Joomlaupdate\HtmlView $this */
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->getDocument()->getWebAssetManager();
$wa->useScript('core')
->useScript('com_joomlaupdate.default')
->useScript('bootstrap.popover');
$uploadLink = 'index.php?option=com_joomlaupdate&view=upload';
$displayData = [
'textPrefix' => 'COM_JOOMLAUPDATE_REINSTALL',
'content' => Text::sprintf($this->langKey, $this->updateSourceKey),
'formURL' => 'index.php?option=com_joomlaupdate&view=joomlaupdate',
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Updating_from_an_existing_version',
'icon' => 'icon-loop joomlaupdate',
'createURL' => '#'
];
if (isset($this->updateInfo['object']) && isset($this->updateInfo['object']->get('infourl')->_data)) :
$displayData['content'] .= '<br>' . HTMLHelper::_(
'link',
$this->updateInfo['object']->get('infourl')->_data,
Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_INFOURL'),
[
'target' => '_blank',
'rel' => 'noopener noreferrer',
'title' => isset($this->updateInfo['object']->get('infourl')->title) ? Text::sprintf('JBROWSERTARGET_NEW_TITLE', $this->updateInfo['object']->get('infourl')->title) : ''
]
);
endif;
if ($this->getCurrentUser()->authorise('core.admin', 'com_joomlaupdate')) :
$displayData['formAppend'] = '<div class="text-center"><a href="' . $uploadLink . '" class="btn btn-sm btn-outline-secondary">' . Text::_('COM_JOOMLAUPDATE_EMPTYSTATE_APPEND') . '</a></div>';
endif;
echo '<div id="joomlaupdate-wrapper">';
echo LayoutHelper::render('joomla.content.emptystate', $displayData);
echo '</div>';

View File

@ -0,0 +1,23 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Layout\LayoutHelper;
$displayData = [
'textPrefix' => 'COM_JOOMLAUPDATE_SELF',
'formURL' => 'index.php?option=com_joomlaupdate&view=joomlaupdate',
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Updating_from_an_existing_version',
'icon' => 'icon-loop joomlaupdate',
'createURL' => 'index.php?option=com_installer&view=update'
];
echo LayoutHelper::render('joomla.content.emptystate', $displayData);

View File

@ -0,0 +1,71 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
/** @var \Joomla\Component\Joomlaupdate\Administrator\View\Joomlaupdate\HtmlView $this */
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->getDocument()->getWebAssetManager();
$wa->useScript('core')
->useScript('com_joomlaupdate.default')
->useScript('bootstrap.popover');
$uploadLink = 'index.php?option=com_joomlaupdate&view=upload';
$displayData = [
'textPrefix' => 'COM_JOOMLAUPDATE_UPDATE',
'title' => Text::sprintf('COM_JOOMLAUPDATE_UPDATE_EMPTYSTATE_TITLE', $this->escape($this->updateInfo['latest'])),
'content' => Text::sprintf($this->langKey, $this->updateSourceKey),
'formURL' => 'index.php?option=com_joomlaupdate&view=joomlaupdate',
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Updating_from_an_existing_version',
'icon' => 'icon-loop joomlaupdate',
'createURL' => '#'
];
if (isset($this->updateInfo['object']) && isset($this->updateInfo['object']->get('infourl')->_data)) :
$displayData['content'] .= '<br>' . HTMLHelper::_(
'link',
$this->updateInfo['object']->get('infourl')->_data,
Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_INFOURL'),
[
'target' => '_blank',
'rel' => 'noopener noreferrer',
'title' => isset($this->updateInfo['object']->get('infourl')->title) ? Text::sprintf('JBROWSERTARGET_NEW_TITLE', $this->updateInfo['object']->get('infourl')->title) : ''
]
);
endif;
// Confirm backup and check
$classVisibility = $this->noBackupCheck ? 'd-none' : '';
$checked = $this->noBackupCheck ? 'checked' : '';
$displayData['content'] .= '<div class="form-check d-flex justify-content-center ' . $classVisibility . '">
<input class="form-check-input me-2" type="checkbox" value="" id="joomlaupdate-confirm-backup" ' . $checked . '>
<label class="form-check-label" for="joomlaupdate-confirm-backup">
' . Text::_('COM_JOOMLAUPDATE_UPDATE_CONFIRM_BACKUP') . '
</label>
</div>';
if ($this->getCurrentUser()->authorise('core.admin', 'com_joomlaupdate')) :
$displayData['formAppend'] = '
<div class="text-center"><a href="' . $uploadLink . '" class="btn btn-sm btn-outline-secondary">' . Text::_('COM_JOOMLAUPDATE_EMPTYSTATE_APPEND') . '</a></div>
<input type="hidden" name="targetVersion" value="' . $this->updateInfo['latest'] . '" />
';
endif;
echo '<div id="joomlaupdate-wrapper">';
echo LayoutHelper::render('joomla.content.emptystate', $displayData);
echo '</div>';

View File

@ -0,0 +1,137 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
/** @var \Joomla\Component\Joomlaupdate\Administrator\View\Update\HtmlView $this */
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->getDocument()->getWebAssetManager();
$wa->useScript('core')
->useScript('com_joomlaupdate.admin-update')
->useScript('bootstrap.modal');
Text::script('COM_JOOMLAUPDATE_ERRORMODAL_HEAD_FORBIDDEN');
Text::script('COM_JOOMLAUPDATE_ERRORMODAL_BODY_FORBIDDEN');
Text::script('COM_JOOMLAUPDATE_ERRORMODAL_HEAD_SERVERERROR');
Text::script('COM_JOOMLAUPDATE_ERRORMODAL_BODY_SERVERERROR');
Text::script('COM_JOOMLAUPDATE_ERRORMODAL_HEAD_GENERIC');
Text::script('COM_JOOMLAUPDATE_ERRORMODAL_BODY_INVALIDLOGIN');
Text::script('COM_JOOMLAUPDATE_UPDATING_FAIL');
Text::script('COM_JOOMLAUPDATE_UPDATING_COMPLETE');
Text::script('COM_JOOMLAUPDATE_VIEW_UPDATE_ITEMS');
Text::script('JLIB_SIZE_BYTES');
Text::script('JLIB_SIZE_KB');
Text::script('JLIB_SIZE_MB');
Text::script('JLIB_SIZE_GB');
Text::script('JLIB_SIZE_TB');
Text::script('JLIB_SIZE_PB');
Text::script('JLIB_SIZE_EB');
Text::script('JLIB_SIZE_ZB');
Text::script('JLIB_SIZE_YB');
$password = Factory::getApplication()->getUserState('com_joomlaupdate.password', null);
$filesize = Factory::getApplication()->getUserState('com_joomlaupdate.filesize', null);
$ajaxUrl = Uri::base() . 'components/com_joomlaupdate/extract.php';
$returnUrl = 'index.php?option=com_joomlaupdate&task=update.finalise&' . Factory::getSession()->getFormToken() . '=1';
$this->getDocument()->addScriptOptions(
'joomlaupdate',
[
'password' => $password,
'totalsize' => $filesize,
'ajax_url' => $ajaxUrl,
'return_url' => $returnUrl,
]
);
$helpUrl = 'https://docs.joomla.org/Special:MyLanguage/J4.x:Joomla_Update_Problems';
?>
<div class="px-4 py-5 my-5 text-center" id="joomlaupdate-progress">
<span class="fa-8x mb-4 icon-loop joomlaupdate" aria-hidden="true"></span>
<h1 class="display-5 fw-bold"><?php echo Text::_('COM_JOOMLAUPDATE_UPDATING_HEAD') ?></h1>
<div class="col-lg-6 mx-auto">
<p class="lead mb-4" id="update-title">
<?php echo Text::_('COM_JOOMLAUPDATE_UPDATING_INPROGRESS'); ?>
</p>
<div id="progress" class="progress my-3">
<div id="progress-bar" class="progress-bar progress-bar-striped progress-bar-animated"
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
<div id="update-progress" class="container text-muted my-3">
<div class="row">
<div class="col">
<span class="fa fa-file-archive" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('COM_JOOMLAUPDATE_VIEW_UPDATE_BYTESREAD'); ?></span>
<span id="extbytesin"></span>
</div>
<div class="col">
<span class="fa fa-hdd" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('COM_JOOMLAUPDATE_VIEW_UPDATE_BYTESEXTRACTED'); ?></span>
<span id="extbytesout"></span>
</div>
<div class="col">
<span class="fa fa-copy" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('COM_JOOMLAUPDATE_VIEW_UPDATE_FILESEXTRACTED'); ?></span>
<span id="extfiles"></span>
</div>
</div>
</div>
</div>
</div>
<div class="px-4 d-none" id="joomlaupdate-error">
<div class="card border-danger">
<h1 class="card-header bg-danger text-white" id="errorDialogLabel"></h1>
<div class="card-body">
<div id="errorDialogMessage"></div>
</div>
<div class="card-footer">
<div class="d-flex flex-row flex-wrap gap-2 align-items-center">
<div>
<a href="<?php echo $helpUrl ?>"
target="_blank"
class="btn btn-info">
<span class="fa fa-info-circle" aria-hidden="true"></span>
<?php echo Text::_('COM_JOOMLAUPDATE_ERRORMODAL_BTN_HELP') ?>
</a>
</div>
<div>
<button type="button" id="joomlaupdate-resume"
class="btn btn-primary">
<span class="fa fa-play" aria-hidden="true"></span>
<?php echo Text::_('COM_JOOMLAUPDATE_ERRORSTATE_BTN_RETRY') ?>
</button>
</div>
<div>
<button type="button" id="joomlaupdate-restart"
class="btn btn-warning">
<span class="fa fa-redo" aria-hidden="true"></span>
<?php echo Text::_('COM_JOOMLAUPDATE_ERRORSTATE_BTN_RESTART') ?>
</button>
</div>
<div class="flex-grow-1"></div>
<div>
<a href="<?php echo Route::_('index.php?option=com_joomlaupdate') ?>"
class="btn btn-danger btn-sm ms-3">
<?php echo Text::_('JCANCEL') ?>
</a>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,83 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
/** @var \Joomla\Component\Joomlaupdate\Administrator\View\Update\HtmlView $this */
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->getDocument()->getWebAssetManager();
$wa->useScript('keepalive');
?>
<div class="alert warning">
<h4 class="alert-heading">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_UPDATE_FINALISE_HEAD'); ?>
</h4>
<p>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_VIEW_UPDATE_FINALISE_HEAD_DESC', Factory::getApplication()->get('sitename')); ?>
</p>
</div>
<hr>
<form action="<?php echo Route::_('index.php', true); ?>" method="post" id="form-login" class="d-flex justify-content-center text-center">
<fieldset class="loginform">
<legend><?php echo Text::_('COM_JOOMLAUPDATE_CONFIRM'); ?></legend>
<div class="control-group">
<div class="controls">
<div class="input-group">
<input name="username" id="mod-login-username" type="text" class="form-control" required="required" autocomplete="username" placeholder="<?php echo Text::_('JGLOBAL_USERNAME'); ?>" size="15" autofocus="true">
<span class="input-group-text">
<span class="icon-user" aria-hidden="true"></span>
<label for="mod-login-username" class="visually-hidden">
<?php echo Text::_('JGLOBAL_USERNAME'); ?>
</label>
</span>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="input-group">
<input name="passwd" id="mod-login-password" type="password" class="form-control" required="required" autocomplete="current-password" placeholder="<?php echo Text::_('JGLOBAL_PASSWORD'); ?>" size="15">
<span class="input-group-text">
<span class="icon-lock" aria-hidden="true"></span>
<label for="mod-login-password" class="visually-hidden">
<?php echo Text::_('JGLOBAL_PASSWORD'); ?>
</label>
</span>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="btn-group">
<a class="btn btn-danger" href="index.php?option=com_joomlaupdate">
<span class="icon-times" aria-hidden="true"></span> <?php echo Text::_('JCANCEL'); ?>
</a>
<button type="submit" class="btn btn-primary">
<span class="icon-play" aria-hidden="true"></span> <?php echo Text::_('COM_JOOMLAUPDATE_VIEW_UPDATE_FINALISE_CONFIRM_AND_CONTINUE'); ?>
</button>
</div>
</div>
</div>
<input type="hidden" name="option" value="com_joomlaupdate">
<input type="hidden" name="task" value="update.finaliseconfirm">
<?php echo HTMLHelper::_('form.token'); ?>
</fieldset>
</form>

View File

@ -0,0 +1,85 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
/** @var \Joomla\Component\Joomlaupdate\Administrator\View\Upload\HtmlView $this */
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->getDocument()->getWebAssetManager();
$wa->useScript('core')
->useScript('jquery')
->useScript('form.validate')
->useScript('keepalive')
->useScript('field.passwordview');
Text::script('JSHOWPASSWORD');
Text::script('JHIDEPASSWORD');
?>
<div class="alert alert-warning">
<h4 class="alert-heading">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_UPLOAD_CAPTIVE_INTRO_HEAD'); ?>
</h4>
<p>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_VIEW_UPLOAD_CAPTIVE_INTRO_BODY', Factory::getApplication()->get('sitename')); ?>
</p>
</div>
<hr>
<form action="<?php echo Route::_('index.php', true); ?>" method="post" id="form-login" class="text-center card">
<fieldset class="loginform card-body">
<legend class="h2 mb-3"><?php echo Text::_('COM_JOOMLAUPDATE_CAPTIVE_HEADLINE'); ?></legend>
<div class="control-group">
<div class="controls">
<div class="input-group">
<input name="username" id="mod-login-username" type="text" class="form-control" required="required" autocomplete="username" placeholder="<?php echo Text::_('JGLOBAL_USERNAME'); ?>" size="15" autofocus="true">
<span class="input-group-text">
<span class="icon-user icon-fw" aria-hidden="true"></span>
<label for="mod-login-username" class="visually-hidden">
<?php echo Text::_('JGLOBAL_USERNAME'); ?>
</label>
</span>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="input-group">
<input name="passwd" id="mod-login-password" type="password" class="form-control" required="required" autocomplete="current-password" placeholder="<?php echo Text::_('JGLOBAL_PASSWORD'); ?>" size="15">
<button type="button" class="btn btn-secondary input-password-toggle">
<span class="icon-eye icon-fw" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('JSHOWPASSWORD'); ?></span>
</button>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<a class="btn btn-danger" href="index.php?option=com_joomlaupdate">
<span class="icon-times icon-white" aria-hidden="true"></span> <?php echo Text::_('JCANCEL'); ?>
</a>
<button type="submit" class="btn btn-primary">
<span class="icon-play icon-white" aria-hidden="true"></span> <?php echo Text::_('COM_INSTALLER_INSTALL_BUTTON'); ?>
</button>
</div>
</div>
<input type="hidden" name="option" value="com_joomlaupdate">
<input type="hidden" name="task" value="update.confirm">
<?php echo HTMLHelper::_('form.token'); ?>
</fieldset>
</form>

View File

@ -0,0 +1,102 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Updater\Update;
use Joomla\CMS\Utility\Utility;
use Joomla\Component\Joomlaupdate\Administrator\View\Joomlaupdate\HtmlView;
/** @var HtmlView $this */
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->getDocument()->getWebAssetManager();
$wa->useScript('core')
->useScript('com_joomlaupdate.default')
->useScript('bootstrap.popover');
Text::script('COM_INSTALLER_MSG_INSTALL_PLEASE_SELECT_A_PACKAGE', true);
Text::script('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG', true);
Text::script('JGLOBAL_SELECTED_UPLOAD_FILE_SIZE', true);
$latestJoomlaVersion = $this->updateInfo['latest'];
$currentJoomlaVersion = $this->updateInfo['installed'] ?? JVERSION;
?>
<div id="joomlaupdate-wrapper" class="main-card mt-3 p-3" data-joomla-target-version="<?php echo $latestJoomlaVersion; ?>" data-joomla-current-version="<?php echo $currentJoomlaVersion; ?>">
<div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_UPLOAD_INTRO', 'https://downloads.joomla.org/latest'); ?>
<?php if (is_object($this->updateInfo['object']) && ($this->updateInfo['object'] instanceof Update)) : ?>
<br><br>
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_PACKAGE_INFO', $this->updateInfo['object']->downloadurl->_data); ?>
<?php endif; ?>
</div>
<?php if (count($this->warnings)) : ?>
<h3><?php echo Text::_('COM_INSTALLER_SUBMENU_WARNINGS'); ?></h3>
<?php foreach ($this->warnings as $warning) : ?>
<div class="alert alert-warning">
<h4 class="alert-heading">
<span class="icon-exclamation-triangle" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('WARNING'); ?></span>
<?php echo $warning['message']; ?>
</h4>
<p class="mb-0"><?php echo $warning['description']; ?></p>
</div>
<?php endforeach; ?>
<div class="alert alert-info">
<h4 class="alert-heading">
<span class="icon-info-circle" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('COM_INSTALLER_MSG_WARNINGFURTHERINFO'); ?>
</h4>
<p class="mb-0"><?php echo Text::_('COM_INSTALLER_MSG_WARNINGFURTHERINFODESC'); ?></p>
</div>
<?php endif; ?>
<form enctype="multipart/form-data" action="index.php" method="post" id="uploadForm">
<div class="mb-3">
<label for="install_package" class="form-label">
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_UPLOAD_PACKAGE_FILE'); ?>
</label>
<input class="form-control" type="file" id="install_package" name="install_package" accept=".zip,application/zip">
<?php $maxSizeBytes = Utility::getMaxUploadSize(); ?>
<?php $maxSize = HTMLHelper::_('number.bytes', $maxSizeBytes); ?>
<input id="max_upload_size" name="max_upload_size" type="hidden" value="<?php echo $maxSizeBytes; ?>"/>
<div class="form-text"><?php echo Text::sprintf('JGLOBAL_MAXIMUM_UPLOAD_SIZE_LIMIT', '&#x200E;' . $maxSize); ?></div>
<div class="form-text hidden" id="file_size"><?php echo Text::sprintf('JGLOBAL_SELECTED_UPLOAD_FILE_SIZE', '&#x200E;' . ''); ?></div>
<div class="alert alert-warning hidden" id="max_upload_size_warn">
<?php echo Text::_('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG'); ?>
</div>
</div>
<div class="form-check mb-3 <?php echo $this->noBackupCheck ? 'd-none' : '' ?>">
<input class="form-check-input me-2 <?php echo $this->noBackupCheck ? 'd-none' : '' ?>"
type="checkbox" disabled value="" id="joomlaupdate-confirm-backup"
<?php echo $this->noBackupCheck ? 'checked' : '' ?>>
<label class="form-check-label" for="joomlaupdate-confirm-backup">
<?php echo Text::_('COM_JOOMLAUPDATE_UPDATE_CONFIRM_BACKUP'); ?>
</label>
</div>
<button id="uploadButton" class="btn btn-primary" disabled type="button"><?php echo Text::_('COM_INSTALLER_UPLOAD_AND_INSTALL'); ?></button>
<input type="hidden" name="task" value="update.upload">
<input type="hidden" name="option" value="com_joomlaupdate">
<?php echo HTMLHelper::_('form.token'); ?>
</form>
</div>