first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<access component="com_joomlaupdate">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
</section>
</access>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="sources"
label="COM_JOOMLAUPDATE_CONFIG_SOURCES_LABEL"
description="COM_JOOMLAUPDATE_CONFIG_SOURCES_DESC"
>
<field
name="updatesource"
type="list"
default="lts"
label="COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_LABEL"
description="COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DESC"
>
<option value="lts">COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_LTS</option>
<option value="sts">COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_STS</option>
<option value="testing">COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_TESTING</option>
<option value="custom">COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM</option>
<option value="nochange">COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NOCHANGE</option>
</field>
<field
name="customurl"
type="text"
default=""
length="50"
label="COM_JOOMLAUPDATE_CONFIG_CUSTOMURL_LABEL"
description="COM_JOOMLAUPDATE_CONFIG_CUSTOMURL_DESC"
/>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
filter="rules"
validate="rules"
component="com_joomlaupdate"
section="component" />
</fieldset>
</config>

View File

@ -0,0 +1,64 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Joomla! Update Controller
*
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
* @since 2.5.4
*/
class JoomlaupdateController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 2.5.4
*/
public function display($cachable = false, $urlparams = false)
{
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'default');
$vFormat = $document->getType();
$lName = $this->input->get('layout', 'default');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat))
{
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$view->ftp = &$ftp;
// Get the model for the view.
$model = $this->getModel($vName);
// 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;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,191 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* The Joomla! update controller for the Update view
*
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
* @since 2.5.4
*/
class JoomlaupdateControllerUpdate extends JControllerLegacy
{
/**
* Performs the download of the update package
*
* @return void
*
* @since 2.5.4
*/
public function download()
{
$this->_applyCredentials();
$model = $this->getModel('Default');
$file = $model->download();
$message = null;
$messageType = null;
if ($file)
{
JFactory::getApplication()->setUserState('com_joomlaupdate.file', $file);
$url = 'index.php?option=com_joomlaupdate&task=update.install';
}
else
{
JFactory::getApplication()->setUserState('com_joomlaupdate.file', null);
$url = 'index.php?option=com_joomlaupdate';
$message = JText::_('COM_JOOMLAUPDATE_VIEW_UPDATE_DOWNLOADFAILED');
}
$this->setRedirect($url, $message, $messageType);
}
/**
* Start the installation of the new Joomla! version
*
* @return void
*
* @since 2.5.4
*/
public function install()
{
$this->_applyCredentials();
$model = $this->getModel('Default');
$file = JFactory::getApplication()->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()
{
$this->_applyCredentials();
$model = $this->getModel('Default');
$model->finaliseUpgrade();
$url = 'index.php?option=com_joomlaupdate&task=update.cleanup';
$this->setRedirect($url);
}
/**
* Clean up after ourselves
*
* @return void
*
* @since 2.5.4
*/
public function cleanup()
{
$this->_applyCredentials();
$model = $this->getModel('Default');
$model->cleanUp();
$url = 'index.php?option=com_joomlaupdate&layout=complete';
$this->setRedirect($url);
}
/**
* Purges updates.
*
* @return void
*
* @since 3.0
*/
public function purge()
{
// Purge updates
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$model = $this->getModel('Default');
$model->purge();
$url = 'index.php?option=com_joomlaupdate';
$this->setRedirect($url, $model->_message);
}
/**
* 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, for valid values see {@link JFilterInput::clean()}.
*
* @return JoomlaupdateControllerUpdate This object to support chaining.
*
* @since 2.5.4
*/
public function display($cachable = false, $urlparams = array())
{
// Get the document object.
$document = JFactory::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');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat))
{
// Get the model for the view.
$model = $this->getModel('Default');
// 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;
}
/**
* Applies FTP credentials to Joomla! itself, when required
*
* @return void
*
* @since 2.5.4
*/
protected function _applyCredentials()
{
if (!JClientHelper::hasCredentials('ftp'))
{
$user = JFactory::getApplication()->getUserStateFromRequest('com_joomlaupdate.ftp_user', 'ftp_user', null, 'raw');
$pass = JFactory::getApplication()->getUserStateFromRequest('com_joomlaupdate.ftp_pass', 'ftp_pass', null, 'raw');
if ($user != '' && $pass != '')
{
// Add credentials to the session
if (!JClientHelper::setCredentials('ftp', $user, $pass))
{
JError::raiseWarning('SOME_ERROR_CODE', JText::_('JLIB_CLIENT_ERROR_HELPER_SETCREDENTIALSFROMREQUEST_FAILED'));
}
}
}
}
}

View File

@ -0,0 +1,430 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Smart download helper. Automatically uses cURL or URL fopen() wrappers to
* fetch the package.
*
* @package Joomla.Administrator
* @since 2.5.4
*/
class AdmintoolsHelperDownload
{
/**
* Downloads from a URL and saves the result as a local file
*
* @param string $url The URL to download from
* @param string $target The file path to download to
*
* @return bool True on success
*
* @since 2.5.4
*/
public static function download($url, $target)
{
jimport('joomla.filesystem.file');
// Make sure the target does not exist
if (JFile::exists($target))
{
if (!@unlink($target))
{
JFile::delete($target);
}
}
// Try to open the output file for writing
$fp = @fopen($target, 'wb');
if ($fp === false)
{
// The file can not be opened for writing. Let's try a hack.
$empty = '';
if ( JFile::write($target, $empty) )
{
if ( self::chmod($target, 511) )
{
$fp = @fopen($target, 'wb');
}
}
}
$result = false;
if ($fp !== false)
{
// First try to download directly to file if $fp !== false
$adapters = self::getAdapters();
$result = false;
while (!empty($adapters) && ($result === false))
{
// Run the current download method
$method = 'get' . strtoupper(array_shift($adapters));
$result = self::$method($url, $fp);
// Check if we have a download
if ($result === true)
{
// The download is complete, close the file pointer
@fclose($fp);
// If the filesize is not at least 1 byte, we consider it failed.
clearstatcache();
$filesize = @filesize($target);
if ($filesize <= 0)
{
$result = false;
$fp = @fopen($target, 'wb');
}
}
}
// If we have no download, close the file pointer
if ($result === false)
{
@fclose($fp);
}
}
if ($result === false)
{
// Delete the target file if it exists
if (file_exists($target))
{
if ( !@unlink($target) )
{
JFile::delete($target);
}
}
// Download and write using JFile::write();
$result = JFile::write($target, self::downloadAndReturn($url));
}
return $result;
}
/**
* Downloads from a URL and returns the result as a string
*
* @param string $url The URL to download from
*
* @return mixed Result string on success, false on failure
*
* @since 2.5.4
*/
public static function downloadAndReturn($url)
{
$adapters = self::getAdapters();
$result = false;
while (!empty($adapters) && ($result === false))
{
// Run the current download method
$method = 'get' . strtoupper(array_shift($adapters));
$result = self::$method($url, null);
}
return $result;
}
/**
* Does the server support PHP's cURL extension?
*
* @return bool True if it is supported
*
* @since 2.5.4
*/
private static function hasCURL()
{
static $result = null;
if (is_null($result))
{
$result = function_exists('curl_init');
}
return $result;
}
/**
* Downloads the contents of a URL and writes them to disk (if $fp is not null)
* or returns them as a string (if $fp is null)
*
* @param string $url The URL to download from
* @param resource $fp The file pointer to download to. Omit to return the contents.
* @param boolean $nofollow Should we follow 301/302/307 redirection HTTP headers?
*
* @return bool|string False on failure, true on success ($fp not null) or the URL contents (if $fp is null)
*
* @since 2.5.4
*/
private static function &getCURL($url, $fp = null, $nofollow = false)
{
$ch = curl_init($url);
if ( !@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1) && !$nofollow )
{
// Safe Mode is enabled. We have to fetch the headers and
// parse any redirections present in there.
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
// Get the headers
$data = curl_exec($ch);
curl_close($ch);
// Init
$newURL = $url;
// Parse the headers
$lines = explode("\n", $data);
foreach ($lines as $line)
{
if (substr($line, 0, 9) == "Location:")
{
$newURL = trim(substr($line, 9));
}
}
if ($url != $newURL)
{
return self::getCURL($newURL, $fp);
}
else
{
return self::getCURL($newURL, $fp, true);
}
}
else
{
@curl_setopt($ch, CURLOPT_MAXREDIRS, 20);
if (function_exists('set_time_limit'))
{
set_time_limit(0);
}
}
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, 'Joomla/' . JVERSION);
if (is_resource($fp))
{
curl_setopt($ch, CURLOPT_FILE, $fp);
}
else
{
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
}
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
/**
* Does the server support URL fopen() wrappers?
*
* @return bool
*
* @since 2.5.4
*/
private static function hasFOPEN()
{
static $result = null;
if (is_null($result))
{
// If we are not allowed to use ini_get, we assume that URL fopen is
// disabled.
if (!function_exists('ini_get'))
{
$result = false;
}
else
{
$result = ini_get('allow_url_fopen');
}
}
return $result;
}
/**
* Download from a URL using URL fopen() wrappers
*
* @param string $url The URL to download from
* @param resource $fp The file pointer to download to; leave null to return the d/l file as a string
*
* @return bool|string False on failure, true on success ($fp not null) or the URL contents (if $fp is null)
*
* @since 2.5.4
*/
private static function &getFOPEN($url, $fp = null)
{
$result = false;
// Open the URL for reading
if (function_exists('stream_context_create'))
{
$httpopts = array('user_agent' => 'Joomla/' . JVERSION);
$context = stream_context_create(array( 'http' => $httpopts ));
$ih = @fopen($url, 'r', false, $context);
}
else
{
// PHP 4 way (actually, it's just a fallback)
if ( function_exists('ini_set') )
{
ini_set('user_agent', 'Joomla/' . JVERSION);
}
$ih = @fopen($url, 'r');
}
// If fopen() fails, abort
if ( !is_resource($ih) )
{
return $result;
}
// Try to download
$bytes = 0;
$result = true;
$return = '';
while (!feof($ih) && $result)
{
$contents = fread($ih, 4096);
if ($contents === false)
{
@fclose($ih);
$result = false;
return $result;
}
else
{
$bytes += strlen($contents);
if (is_resource($fp))
{
$result = @fwrite($fp, $contents);
}
else
{
$return .= $contents;
unset($contents);
}
}
}
@fclose($ih);
if (is_resource($fp))
{
return $result;
}
elseif ( $result === true )
{
return $return;
}
else
{
return $result;
}
}
/**
* Detect and return available download "adapters" (not really adapters, as
* we don't follow the Adapter pattern, yet)
*
* @return array
*
* @since 2.5.4
*/
private static function getAdapters()
{
// Detect available adapters
$adapters = array();
if (self::hasCURL())
{
$adapters[] = 'curl';
}
if (self::hasFOPEN())
{
$adapters[] = 'fopen';
}
return $adapters;
}
/**
* Change the permissions of a file, optionally using FTP
*
* @param string $path Absolute path to file
* @param int $mode Permissions, e.g. 0755
*
* @return boolean True on success
*
* @since 2.5.4
*/
private static function chmod($path, $mode)
{
if (is_string($mode))
{
$mode = octdec($mode);
if ( ($mode < 0600) || ($mode > 0777) )
{
$mode = 0755;
}
}
$ftpOptions = JClientHelper::getCredentials('ftp');
// Check to make sure the path valid and clean
$path = JPath::clean($path);
if ($ftpOptions['enabled'] == 1)
{
// Connect the FTP client
$ftp = JClientFtp::getInstance(
$ftpOptions['host'], $ftpOptions['port'], null,
$ftpOptions['user'], $ftpOptions['pass']
);
}
if (@chmod($path, $mode))
{
$ret = true;
}
elseif ($ftpOptions['enabled'] == 1)
{
// Translate path and delete
$path = JPath::clean(str_replace(JPATH_ROOT, $ftpOptions['root'], $path), '/');
// FTP connector throws an error
$ret = $ftp->chmod($path, $mode);
} else
{
return false;
}
return $ret;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,44 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Joomla! update helper.
*
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
* @since 2.5.4
*/
class JoomlaupdateHelper
{
/**
* Gets a list of the actions that can be performed.
*
* @return JObject
*
* @since 2.5.4
*/
public static function getActions()
{
$user = JFactory::getUser();
$result = new JObject;
$assetName = 'com_joomlaupdate';
$actions = JAccess::getActions($assetName);
foreach ($actions as $action)
{
$result->set($action->name, $user->authorise($action->name, $assetName));
}
return $result;
}
}

View File

@ -0,0 +1,38 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Joomla! update selection list helper.
*
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
* @since 2.5.4
*/
class JoomlaupdateHelperSelect
{
/**
* Returns an HTML select element with the different extraction modes
*
* @param string $default The default value of the select element
*
* @return string
*
* @since 2.5.4
*/
public static function getMethods($default = 'direct')
{
$options = array();
$options[] = JHtml::_('select.option', 'direct', JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_METHOD_DIRECT'));
$options[] = JHtml::_('select.option', 'ftp', JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_METHOD_FTP'));
return JHtml::_('select.genericlist', $options, 'method', '', 'value', 'text', $default, 'extraction_method');
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,19 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if (!JFactory::getUser()->authorise('core.manage', 'com_joomlaupdate'))
{
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$controller = JControllerLegacy::getInstance('Joomlaupdate');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1" method="upgrade">
<name>com_joomlaupdate</name>
<author>Joomla! Project</author>
<creationDate>February 2012</creationDate>
<copyright>(C) 2005 - 2013 Open Source Matters. All rights reserved. </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>3.0.0</version>
<description>COM_JOOMLAUPDATE_XML_DESCRIPTION</description>
<administration>
<files folder="admin">
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>joomlaupdate.php</filename>
<filename>restore.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</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>
</extension>

View File

@ -0,0 +1,753 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
/**
* Joomla! update overview Model
*
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
* @author nikosdion <nicholas@dionysopoulos.me>
* @since 2.5.4
*/
class JoomlaupdateModelDefault extends JModelLegacy
{
/**
* Detects if the Joomla! update site currently in use matches the one
* configured in this component. If they don't match, it changes it.
*
* @return void
*
* @since 2.5.4
*/
public function applyUpdateSite()
{
// Determine the intended update URL
$params = JComponentHelper::getParams('com_joomlaupdate');
switch ($params->get('updatesource', 'nochange'))
{
// "Long Term Support (LTS) branch - Recommended"
case 'lts':
$updateURL = 'http://update.joomla.org/core/list.xml';
break;
// "Short term support (STS) branch"
case 'sts':
$updateURL = 'http://update.joomla.org/core/sts/list_sts.xml';
break;
// "Testing"
case 'testing':
$updateURL = 'http://update.joomla.org/core/test/list_test.xml';
break;
// "Custom"
case 'custom':
$updateURL = $params->get('customurl', '');
break;
// "Do not change"
case 'nochange':
default:
return;
break;
}
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('us') . '.*')
->from($db->quoteName('#__update_sites_extensions') . ' AS ' . $db->quoteName('map'))
->join(
'INNER', $db->quoteName('#__update_sites') . ' AS ' . $db->quoteName('us')
. ' ON (' . 'us.update_site_id = map.update_site_id)'
)
->where('map.extension_id = ' . $db->quote(700));
$db->setQuery($query);
$update_site = $db->loadObject();
if ($update_site->location != $updateURL)
{
// Modify the database record
$update_site->last_check_timestamp = 0;
$update_site->location = $updateURL;
$db->updateObject('#__update_sites', $update_site, 'update_site_id');
// Remove cached updates
$query->clear()
->delete($db->quoteName('#__updates'))
->where($db->quoteName('extension_id') . ' = ' . $db->quote('700'));
$db->setQuery($query);
$db->execute();
}
}
/**
* Makes sure that the Joomla! update cache is up-to-date
*
* @param boolean $force Force reload, ignoring the cache timeout
*
* @return void
*
* @since 2.5.4
*/
public function refreshUpdates($force = false)
{
if ($force)
{
$cache_timeout = 0;
}
else
{
$update_params = JComponentHelper::getParams('com_installer');
$cache_timeout = $update_params->get('cachetimeout', 6, 'int');
$cache_timeout = 3600 * $cache_timeout;
}
$updater = JUpdater::getInstance();
$updater->findUpdates(700, $cache_timeout);
}
/**
* Returns an array with the Joomla! update information
*
* @return array
*
* @since 2.5.4
*/
public function getUpdateInformation()
{
// Initialise the return array
$ret = array(
'installed' => JVERSION,
'latest' => null,
'object' => null
);
// Fetch the update information from the database
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('*')
->from($db->quoteName('#__updates'))
->where($db->quoteName('extension_id') . ' = ' . $db->quote(700));
$db->setQuery($query);
$updateObject = $db->loadObject();
if (is_null($updateObject))
{
$ret['latest'] = JVERSION;
return $ret;
}
else
{
$ret['latest'] = $updateObject->version;
}
// Fetch the full udpate details from the update details URL
jimport('joomla.updater.update');
$update = new JUpdate;
$update->loadFromXML($updateObject->detailsurl);
// Pass the update object
if ($ret['latest'] == JVERSION)
{
$ret['object'] = null;
}
else
{
$ret['object'] = $update;
}
return $ret;
}
/**
* Returns an array with the configured FTP options
*
* @return array
*
* @since 2.5.4
*/
public function getFTPOptions()
{
$config = JFactory::getConfig();
return array(
'host' => $config->get('ftp_host'),
'port' => $config->get('ftp_port'),
'username' => $config->get('ftp_user'),
'password' => $config->get('ftp_pass'),
'directory' => $config->get('ftp_root'),
'enabled' => $config->get('ftp_enable'),
);
}
/**
* Removes all of the updates from the table and enable all update streams.
*
* @return boolean Result of operation
*
* @since 3.0
*/
public function purge()
{
$db = JFactory::getDbo();
// Modify the database record
$update_site = new stdClass;
$update_site->last_check_timestamp = 0;
$update_site->enabled = 1;
$update_site->update_site_id = 1;
$db->updateObject('#__update_sites', $update_site, 'update_site_id');
$query = $db->getQuery(true)
->delete($db->quoteName('#__updates'))
->where($db->quoteName('update_site_id') . ' = ' . $db->quote('1'));
$db->setQuery($query);
if ($db->execute())
{
$this->_message = JText::_('JLIB_INSTALLER_PURGED_UPDATES');
return true;
}
else
{
$this->_message = JText::_('JLIB_INSTALLER_FAILED_TO_PURGE_UPDATES');
return false;
}
}
/**
* Downloads the update package to the site
*
* @return bool|string False on failure, basename of the file in any other case
*
* @since 2.5.4
*/
public function download()
{
$updateInfo = $this->getUpdateInformation();
$packageURL = $updateInfo['object']->downloadurl->_data;
$basename = basename($packageURL);
// Find the path to the temp directory and the local package
$config = JFactory::getConfig();
$tempdir = $config->get('tmp_path');
$target = $tempdir . '/' . $basename;
// Do we have a cached file?
$exists = JFile::exists($target);
if (!$exists)
{
// Not there, let's fetch it
return $this->downloadPackage($packageURL, $target);
}
else
{
// Is it a 0-byte file? If so, re-download please.
$filesize = @filesize($target);
if (empty($filesize))
{
return $this->downloadPackage($packageURL, $target);
}
// Yes, it's there, skip downloading
return $basename;
}
}
/**
* Downloads a package file to a specific directory
*
* @param string $url The URL to download from
* @param string $target The directory to store the file
*
* @return boolean True on success
*
* @since 2.5.4
*/
protected function downloadPackage($url, $target)
{
JLoader::import('helpers.download', JPATH_COMPONENT_ADMINISTRATOR);
$result = AdmintoolsHelperDownload::download($url, $target);
if (!$result)
{
return false;
}
else
{
return basename($target);
}
}
/**
* @since 2.5.4
*/
public function createRestorationFile($basename = null)
{
// Get a password
$password = JUserHelper::genRandomPassword(32);
$app = JFactory::getApplication();
$app->setUserState('com_joomlaupdate.password', $password);
// Do we have to use FTP?
$method = $app->input->get('method', 'direct');
// Get the absolute path to site's root
$siteroot = JPATH_SITE;
// If the package name is not specified, get it from the update info
if (empty($basename))
{
$updateInfo = $this->getUpdateInformation();
$packageURL = $updateInfo['object']->downloadurl->_data;
$basename = basename($packageURL);
}
// Get the package name
$config = JFactory::getConfig();
$tempdir = $config->get('tmp_path');
$file = $tempdir . '/' . $basename;
$filesize = @filesize($file);
$app->setUserState('com_joomlaupdate.password', $password);
$app->setUserState('com_joomlaupdate.filesize', $filesize);
$data = "<?php\ndefined('_AKEEBA_RESTORATION') or die('Restricted access');\n";
$data .= '$restoration_setup = array(' . "\n";
$data .= <<<ENDDATA
'kickstart.security.password' => '$password',
'kickstart.tuning.max_exec_time' => '5',
'kickstart.tuning.run_time_bias' => '75',
'kickstart.tuning.min_exec_time' => '0',
'kickstart.procengine' => '$method',
'kickstart.setup.sourcefile' => '$file',
'kickstart.setup.destdir' => '$siteroot',
'kickstart.setup.restoreperms' => '0',
'kickstart.setup.filetype' => 'zip',
'kickstart.setup.dryrun' => '0'
ENDDATA;
if ($method == 'ftp')
{
// Fetch the FTP parameters from the request. Note: The password should be
// allowed as raw mode, otherwise something like !@<sdf34>43H% would be
// sanitised to !@43H% which is just plain wrong.
$ftp_host = $app->input->get('ftp_host', '');
$ftp_port = $app->input->get('ftp_port', '21');
$ftp_user = $app->input->get('ftp_user', '');
$ftp_pass = $app->input->get('ftp_pass', '', 'default', 'none', 2);
$ftp_root = $app->input->get('ftp_root', '');
// Is the tempdir really writable?
$writable = @is_writeable($tempdir);
if ($writable)
{
// Let's be REALLY sure
$fp = @fopen($tempdir . '/test.txt', 'w');
if ($fp === false)
{
$writable = false;
}
else
{
fclose($fp);
unlink($tempdir . '/test.txt');
}
}
// If the tempdir is not writable, create a new writable subdirectory
if (!$writable)
{
$FTPOptions = JClientHelper::getCredentials('ftp');
$ftp = JClientFtp::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']);
$dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $tempdir . '/admintools'), '/');
if (!@mkdir($tempdir . '/admintools'))
{
$ftp->mkdir($dest);
}
if (!@chmod($tempdir . '/admintools', 511))
{
$ftp->chmod($dest, 511);
}
$tempdir .= '/admintools';
}
// Just in case the temp-directory was off-root, try using the default tmp directory
$writable = @is_writeable($tempdir);
if (!$writable)
{
$tempdir = JPATH_ROOT . '/tmp';
// Does the JPATH_ROOT/tmp directory exist?
if (!is_dir($tempdir))
{
JFolder::create($tempdir, 511);
JFile::write($tempdir . '/.htaccess', "order deny, allow\ndeny from all\nallow from none\n");
}
// If it exists and it is unwritable, try creating a writable admintools subdirectory
if (!is_writable($tempdir))
{
$FTPOptions = JClientHelper::getCredentials('ftp');
$ftp = JClientFtp::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']);
$dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $tempdir . '/admintools'), '/');
if (!@mkdir($tempdir . '/admintools'))
{
$ftp->mkdir($dest);
}
if (!@chmod($tempdir . '/admintools', 511))
{
$ftp->chmod($dest, 511);
}
$tempdir .= '/admintools';
}
}
// If we still have no writable directory, we'll try /tmp and the system's temp-directory
$writable = @is_writeable($tempdir);
if (!$writable)
{
if (@is_dir('/tmp') && @is_writable('/tmp'))
{
$tempdir = '/tmp';
}
else
{
// Try to find the system temp path
$tmpfile = @tempnam("dummy", "");
$systemp = @dirname($tmpfile);
@unlink($tmpfile);
if (!empty($systemp))
{
if (@is_dir($systemp) && @is_writable($systemp))
{
$tempdir = $systemp;
}
}
}
}
$data .= <<<ENDDATA
,
'kickstart.ftp.ssl' => '0',
'kickstart.ftp.passive' => '1',
'kickstart.ftp.host' => '$ftp_host',
'kickstart.ftp.port' => '$ftp_port',
'kickstart.ftp.user' => '$ftp_user',
'kickstart.ftp.pass' => '$ftp_pass',
'kickstart.ftp.dir' => '$ftp_root',
'kickstart.ftp.tempdir' => '$tempdir'
ENDDATA;
}
$data .= ');';
// Remove the old file, if it's there...
$configpath = JPATH_COMPONENT_ADMINISTRATOR . '/restoration.php';
if (JFile::exists($configpath))
{
JFile::delete($configpath);
}
// Write new file. First try with JFile.
$result = JFile::write($configpath, $data);
// In case JFile used FTP but direct access could help
if (!$result)
{
if (function_exists('file_put_contents'))
{
$result = @file_put_contents($configpath, $data);
if ($result !== false)
{
$result = true;
}
}
else
{
$fp = @fopen($configpath, 'wt');
if ($fp !== false)
{
$result = @fwrite($fp, $data);
if ($result !== false)
{
$result = true;
}
@fclose($fp);
}
}
}
return $result;
}
/**
* Runs the schema update SQL files, the PHP update script and updates the
* manifest cache and #__extensions entry. Essentially, it is identical to
* JInstallerFile::install() without the file copy.
*
* @return boolean True on success
*
* @since 2.5.4
*/
public function finaliseUpgrade()
{
$installer = JInstaller::getInstance();
$installer->setPath('source', JPATH_ROOT);
$installer->setPath('extension_root', JPATH_ROOT);
if (!$installer->setupInstall())
{
$installer->abort(JText::_('JLIB_INSTALLER_ABORT_DETECTMANIFEST'));
return false;
}
$installer->extension = JTable::getInstance('extension');
$installer->extension->load(700);
$installer->setAdapter($installer->extension->type);
$manifest = $installer->getManifest();
$manifestPath = JPath::clean($installer->getPath('manifest'));
$element = preg_replace('/\.xml/', '', basename($manifestPath));
// Run the script file
$manifestScript = (string) $manifest->scriptfile;
if ($manifestScript)
{
$manifestScriptFile = JPATH_ROOT . '/' . $manifestScript;
if (is_file($manifestScriptFile))
{
// load the file
include_once $manifestScriptFile;
}
$classname = 'JoomlaInstallerScript';
if (class_exists($classname))
{
$manifestClass = new $classname($this);
}
}
ob_start();
ob_implicit_flush(false);
if ($manifestClass && method_exists($manifestClass, 'preflight'))
{
if ($manifestClass->preflight('update', $this) === false)
{
$installer->abort(JText::_('JLIB_INSTALLER_ABORT_FILE_INSTALL_CUSTOM_INSTALL_FAILURE'));
return false;
}
}
$msg = ob_get_contents(); // create msg object; first use here
ob_end_clean();
// Get a database connector object
$db = JFactory::getDbo();
// Check to see if a file extension by the same name is already installed
// If it is, then update the table because if the files aren't there
// we can assume that it was (badly) uninstalled
// If it isn't, add an entry to extensions
$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('type') . ' = ' . $db->quote('file'))
->where($db->quoteName('element') . ' = ' . $db->quote('joomla'));
$db->setQuery($query);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
// Install failed, roll back changes
$installer->abort(
JText::sprintf('JLIB_INSTALLER_ABORT_FILE_ROLLBACK', JText::_('JLIB_INSTALLER_UPDATE'), $db->stderr(true))
);
return false;
}
$id = $db->loadResult();
$row = JTable::getInstance('extension');
if ($id)
{
// Load the entry and update the manifest_cache
$row->load($id);
// Update name
$row->set('name', 'files_joomla');
// Update manifest
$row->manifest_cache = $installer->generateManifestCache();
if (!$row->store())
{
// Install failed, roll back changes
$installer->abort(
JText::sprintf('JLIB_INSTALLER_ABORT_FILE_ROLLBACK', JText::_('JLIB_INSTALLER_UPDATE'), $db->stderr(true))
);
return false;
}
}
else
{
// Add an entry to the extension table with a whole heap of defaults
$row->set('name', 'files_joomla');
$row->set('type', 'file');
$row->set('element', 'joomla');
// There is no folder for files so leave it blank
$row->set('folder', '');
$row->set('enabled', 1);
$row->set('protected', 0);
$row->set('access', 0);
$row->set('client_id', 0);
$row->set('params', '');
$row->set('system_data', '');
$row->set('manifest_cache', $installer->generateManifestCache());
if (!$row->store())
{
// Install failed, roll back changes
$installer->abort(JText::sprintf('JLIB_INSTALLER_ABORT_FILE_INSTALL_ROLLBACK', $db->stderr(true)));
return false;
}
// Set the insert id
$row->set('extension_id', $db->insertid());
// Since we have created a module item, we add it to the installation step stack
// so that if we have to rollback the changes we can undo it.
$installer->pushStep(array('type' => 'extension', 'extension_id' => $row->extension_id));
}
/*
* Let's run the queries for the file
*/
if ($manifest->update)
{
$result = $installer->parseSchemaUpdates($manifest->update->schemas, $row->extension_id);
if ($result === false)
{
// Install failed, rollback changes
$installer->abort(JText::sprintf('JLIB_INSTALLER_ABORT_FILE_UPDATE_SQL_ERROR', $db->stderr(true)));
return false;
}
}
// Start Joomla! 1.6
ob_start();
ob_implicit_flush(false);
if ($manifestClass && method_exists($manifestClass, 'update'))
{
if ($manifestClass->update($installer) === false)
{
// Install failed, rollback changes
$installer->abort(JText::_('JLIB_INSTALLER_ABORT_FILE_INSTALL_CUSTOM_INSTALL_FAILURE'));
return false;
}
}
$msg .= ob_get_contents(); // append messages
ob_end_clean();
// Lastly, we will copy the manifest file to its appropriate place.
$manifest = array();
$manifest['src'] = $installer->getPath('manifest');
$manifest['dest'] = JPATH_MANIFESTS . '/files/' . basename($installer->getPath('manifest'));
if (!$installer->copyFiles(array($manifest), true))
{
// Install failed, rollback changes
$installer->abort(JText::_('JLIB_INSTALLER_ABORT_FILE_INSTALL_COPY_SETUP'));
return false;
}
// Clobber any possible pending updates
$update = JTable::getInstance('update');
$uid = $update->find(
array('element' => $element, 'type' => 'file', 'client_id' => '0', 'folder' => '')
);
if ($uid)
{
$update->delete($uid);
}
// And now we run the postflight
ob_start();
ob_implicit_flush(false);
if ($manifestClass && method_exists($manifestClass, 'postflight'))
{
$manifestClass->postflight('update', $this);
}
$msg .= ob_get_contents(); // append messages
ob_end_clean();
if ($msg != '')
{
$installer->set('extension_message', $msg);
}
return true;
}
/**
* Removes the extracted package file
*
* @return void
*
* @since 2.5.4
*/
public function cleanUp()
{
// Remove the update package
$config = JFactory::getConfig();
$tempdir = $config->get('tmp_path');
$file = JFactory::getApplication()->getUserState('com_joomlaupdate.file', null);
$target = $tempdir . '/' . $file;
if (!@unlink($target))
{
JFile::delete($target);
}
// Remove the restoration.php file
$target = JPATH_COMPONENT_ADMINISTRATOR . '/restoration.php';
if (!@unlink($target))
{
JFile::delete($target);
}
// Remove joomla.xml from the site's root
$target = JPATH_ROOT . '/joomla.xml';
if (!@unlink($target))
{
JFile::delete($target);
}
// Unset the update filename from the session
JFactory::getApplication()->setUserState('com_joomlaupdate.file', null);
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,20 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<fieldset>
<legend>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_COMPLETE_HEADING') ?>
</legend>
<p>
<?php echo JText::sprintf('COM_JOOMLAUPDATE_VIEW_COMPLETE_MESSAGE', JVERSION); ?>
</p>
</fieldset>

View File

@ -0,0 +1,139 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$ftpFieldsDisplay = $this->ftp['enabled'] ? '' : 'style = "display: none"';
?>
<form action="index.php" method="post" id="adminForm">
<?php if (is_null($this->updateInfo['object'])) : ?>
<fieldset>
<legend>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_NOUPDATES') ?>
</legend>
<p>
<?php echo JText::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_NOUPDATESNOTICE', JVERSION); ?>
</p>
</fieldset>
<?php else: ?>
<fieldset>
<legend>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATEFOUND') ?>
</legend>
<table class="table table-striped">
<tbody>
<tr>
<td>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLED') ?>
</td>
<td>
<?php echo $this->updateInfo['installed'] ?>
</td>
</tr>
<tr>
<td>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_LATEST') ?>
</td>
<td>
<?php echo $this->updateInfo['latest'] ?>
</td>
</tr>
<tr>
<td>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_PACKAGE') ?>
</td>
<td>
<a href="<?php echo $this->updateInfo['object']->downloadurl->_data ?>">
<?php echo $this->updateInfo['object']->downloadurl->_data ?>
</a>
</td>
</tr>
<tr>
<td>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_METHOD') ?>
</td>
<td>
<?php echo $this->methodSelect ?>
</td>
</tr>
<tr id="row_ftp_hostname" <?php echo $ftpFieldsDisplay ?>>
<td>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_HOSTNAME') ?>
</td>
<td>
<input type="text" name="ftp_host" value="<?php echo $this->ftp['host'] ?>" />
</td>
</tr>
<tr id="row_ftp_port" <?php echo $ftpFieldsDisplay ?>>
<td>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_PORT') ?>
</td>
<td>
<input type="text" name="ftp_port" value="<?php echo $this->ftp['port'] ?>" />
</td>
</tr>
<tr id="row_ftp_username" <?php echo $ftpFieldsDisplay ?>>
<td>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_USERNAME') ?>
</td>
<td>
<input type="text" name="ftp_user" value="<?php echo $this->ftp['username'] ?>" />
</td>
</tr>
<tr id="row_ftp_password" <?php echo $ftpFieldsDisplay ?>>
<td>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_PASSWORD') ?>
</td>
<td>
<input type="text" name="ftp_pass" value="<?php echo $this->ftp['password'] ?>" />
</td>
</tr>
<tr id="row_ftp_directory" <?php echo $ftpFieldsDisplay ?>>
<td>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_DIRECTORY') ?>
</td>
<td>
<input type="text" name="ftp_root" value="<?php echo $this->ftp['directory'] ?>" />
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
&nbsp;
</td>
<td>
<button class="submit" type="submit">
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLUPDATE') ?>
</button>
</td>
</tr>
</tfoot>
</table>
</fieldset>
<?php endif; ?>
<?php echo JHtml::_('form.token'); ?>
<input type="hidden" name="task" value="update.download" />
<input type="hidden" name="option" value="com_joomlaupdate" />
</form>
<div class="download_message" style="display: none">
<p></p>
<p class="nowarning"> <?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_DOWNLOAD_IN_PROGRESS'); ?></p>
<div class="joomlaupdate_spinner"></div>
</div>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,68 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Joomla! Update's Default View
*
* @package Joomla.Administrator
* @subpackage com_installer
* @since 2.5.4
*/
class JoomlaupdateViewDefault extends JViewLegacy
{
/**
* Renders the view
*
* @param string $tpl Template name
*
* @return void
*
* @since 2.5.4
*/
public function display($tpl=null)
{
// Get data from the model
$this->state = $this->get('State');
// Load useful classes
$model = $this->getModel();
$this->loadHelper('select');
// Assign view variables
$ftp = $model->getFTPOptions();
$this->assign('updateInfo', $model->getUpdateInformation());
$this->assign('methodSelect', JoomlaupdateHelperSelect::getMethods($ftp['enabled']));
// Set the toolbar information
JToolbarHelper::title(JText::_('COM_JOOMLAUPDATE_OVERVIEW'), 'install');
JToolbarHelper::custom('update.purge', 'purge', 'purge', 'JTOOLBAR_PURGE_CACHE', false, false);
// Add toolbar buttons
if (JFactory::getUser()->authorise('core.admin', 'com_joomlaupdate'))
{
JToolbarHelper::preferences('com_joomlaupdate');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_COMPONENTS_JOOMLA_UPDATE');
// Load mooTools
JHtml::_('behavior.framework', true);
// Load our Javascript
$document = JFactory::getDocument();
$document->addScript('../media/com_joomlaupdate/default.js');
JHtml::_('stylesheet', 'media/mediamanager.css', array(), true);
// Render the view
parent::display($tpl);
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<p class="nowarning"><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_UPDATE_INPROGRESS') ?></p>
<div class="joomlaupdate_spinner" ></div>
<div id="update-progress">
<div id="extprogress">
<div class="extprogrow">
<?php
echo JHtml::_(
'image', 'media/bar.gif', JText::_('COM_JOOMLAUPDATE_VIEW_PROGRESS'),
array('class' => 'progress', 'id' => 'progress'), true
); ?>
</div>
<div class="extprogrow">
<span class="extlabel"><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_UPDATE_PERCENT'); ?></span>
<span class="extvalue" id="extpercent"></span>
</div>
<div class="extprogrow">
<span class="extlabel"><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_UPDATE_BYTESREAD'); ?></span>
<span class="extvalue" id="extbytesin"></span>
</div>
<div class="extprogrow">
<span class="extlabel"><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_UPDATE_BYTESEXTRACTED'); ?></span>
<span class="extvalue" id="extbytesout"></span>
</div>
<div class="extprogrow">
<span class="extlabel"><?php echo JText::_('COM_JOOMLAUPDATE_VIEW_UPDATE_FILESEXTRACTED'); ?></span>
<span class="extvalue" id="extfiles"></span>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,70 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Joomla! Update's Update View
*
* @package Joomla.Administrator
* @subpackage com_installer
* @since 2.5.4
*/
class JoomlaupdateViewUpdate extends JViewLegacy
{
/**
* Renders the view
*
* @param string $tpl Template name
*
* @return void
*/
public function display($tpl=null)
{
$password = JFactory::getApplication()->getUserState('com_joomlaupdate.password', null);
$filesize = JFactory::getApplication()->getUserState('com_joomlaupdate.filesize', null);
$ajaxUrl = JUri::base().'components/com_joomlaupdate/restore.php';
$returnUrl = 'index.php?option=com_joomlaupdate&task=update.finalise';
// Set the toolbar information
JToolbarHelper::title(JText::_('COM_JOOMLAUPDATE_OVERVIEW'), 'install');
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_COMPONENTS_JOOMLA_UPDATE');
// Add toolbar buttons
if (JFactory::getUser()->authorise('core.admin', 'com_joomlaupdate'))
{
JToolbarHelper::preferences('com_joomlaupdate');
}
// Load mooTools
JHtml::_('behavior.framework', true);
$updateScript = <<<ENDSCRIPT
var joomlaupdate_password = '$password';
var joomlaupdate_totalsize = '$filesize';
var joomlaupdate_ajax_url = '$ajaxUrl';
var joomlaupdate_return_url = '$returnUrl';
ENDSCRIPT;
// Load our Javascript
$document = JFactory::getDocument();
$document->addScript('../media/com_joomlaupdate/json2.js');
$document->addScript('../media/com_joomlaupdate/encryption.js');
$document->addScript('../media/com_joomlaupdate/update.js');
JHtml::_('script', 'system/progressbar.js', true, true);
JHtml::_('stylesheet', 'media/mediamanager.css', array(), true);
$document->addScriptDeclaration($updateScript);
// Render the view
parent::display($tpl);
}
}