Skip to content

Commit

Permalink
Merge branch 'staging' into improveReinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed Sep 5, 2016
2 parents 677a849 + d08222d commit dede28d
Show file tree
Hide file tree
Showing 94 changed files with 766 additions and 839 deletions.
Expand Up @@ -92,7 +92,7 @@
description="COM_BANNERS_FIELD_DESCRIPTION_DESC"
filter="JComponentHelper::filterText"
buttons="true"
hide="readmore,pagebreak,module"
hide="readmore,pagebreak,module,article"
/>

<field
Expand Down
37 changes: 30 additions & 7 deletions administrator/components/com_categories/models/category.php
Expand Up @@ -593,14 +593,31 @@ public function save($data)
JError::raiseNotice(403, JText::_('COM_CATEGORIES_ERROR_ALL_LANGUAGE_ASSOCIATED'));
}

$associations[$table->language] = $table->id;

// Deleting old association for these items
$db = $this->getDbo();
// Get associationskey for edited item
$db = $this->getDbo();
$query = $db->getQuery(true)
->delete('#__associations')
->select($db->quoteName('key'))
->from($db->quoteName('#__associations'))
->where($db->quoteName('context') . ' = ' . $db->quote($this->associationsContext))
->where($db->quoteName('id') . ' IN (' . implode(',', $associations) . ')');
->where($db->quoteName('id') . ' = ' . (int) $table->id);
$db->setQuery($query);
$old_key = $db->loadResult();

// Deleting old associations for the associated items
$query = $db->getQuery(true)
->delete($db->quoteName('#__associations'))
->where($db->quoteName('context') . ' = ' . $db->quote($this->associationsContext));

if ($associations)
{
$query->where('(' . $db->quoteName('id') . ' IN (' . implode(',', $associations) . ') OR '
. $db->quoteName('key') . ' = ' . $db->quote($old_key) . ')');
}
else
{
$query->where($db->quoteName('key') . ' = ' . $db->quote($old_key));
}

$db->setQuery($query);

try
Expand All @@ -614,7 +631,13 @@ public function save($data)
return false;
}

if (!$all_language && count($associations))
// Adding self to the association
if (!$all_language)
{
$associations[$table->language] = (int) $table->id;
}

if (count($associations) > 1)
{
// Adding new association for these items
$key = md5(json_encode($associations));
Expand Down
Expand Up @@ -39,29 +39,35 @@
<?php echo JHtml::_('bootstrap.addTab', 'joomlaupdate-tabs', 'online-update', JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_TAB_ONLINE')); ?>
<?php endif; ?>

<?php if (!isset($this->updateInfo['object']->downloadurl->_data) && $this->updateInfo['installed'] < $this->updateInfo['latest']) : ?>
<?php // If we have no download URL we can't reinstall or update ?>
<?php echo $this->loadTemplate('nodownload'); ?>
<?php elseif (!$this->updateInfo['hasUpdate']) : ?>
<?php // If we have no update we can reinstall the core ?>
<?php echo $this->loadTemplate('reinstall'); ?>
<?php if ($this->selfUpdate) : ?>
<?php // If we have a self update notice to install it first! ?>
<?php JFactory::getApplication()->enqueueMessage(JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALL_SELF_UPDATE_FIRST'), 'error'); ?>
<?php echo $this->loadTemplate('updatemefirst'); ?>
<?php else : ?>
<?php // Ok let's show the update template ?>
<?php echo $this->loadTemplate('update'); ?>
<?php if (!isset($this->updateInfo['object']->downloadurl->_data) && $this->updateInfo['installed'] < $this->updateInfo['latest']) : ?>
<?php // If we have no download URL we can't reinstall or update ?>
<?php echo $this->loadTemplate('nodownload'); ?>
<?php elseif (!$this->updateInfo['hasUpdate']) : ?>
<?php // If we have no update we can reinstall the core ?>
<?php echo $this->loadTemplate('reinstall'); ?>
<?php else : ?>
<?php // Ok let's show the update template ?>
<?php echo $this->loadTemplate('update'); ?>
<?php endif; ?>
<?php endif; ?>

<input type="hidden" name="option" value="com_joomlaupdate" />
<?php echo JHtml::_('form.token'); ?>
</form>

<?php // Only Super Users have access to the Update & Install for obvious security reasons ?>
<?php if ($this->showUploadAndUpdate) : ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'joomlaupdate-tabs', 'upload-update', JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_TAB_UPLOAD')); ?>
<?php echo $this->loadTemplate('upload'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<?php endif; ?>
<?php // Only Super Users have access to the Update & Install for obvious security reasons ?>
<?php if ($this->showUploadAndUpdate) : ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'joomlaupdate-tabs', 'upload-update', JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_TAB_UPLOAD')); ?>
<?php echo $this->loadTemplate('upload'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<?php endif; ?>

<div class="download_message" style="display: none">
<p></p>
Expand Down
@@ -0,0 +1,21 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;

/** @var JoomlaupdateViewDefault $this */
?>

<fieldset>
<legend>
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_LIVE_UPDATE'); ?>
</legend>
<p>
<?php echo JText::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_LIVE_UPDATE_DESC'); ?>
</p>
</fieldset>
Expand Up @@ -140,6 +140,8 @@ public function display($tpl = null)
$this->warnings = $warningsModel->getItems();
}

$this->selfUpdate = $this->checkForSelfUpdate();

// Only Super Users have access to the Update & Install for obvious security reasons
$this->showUploadAndUpdate = JFactory::getUser()->authorise('core.admin');

Expand All @@ -149,4 +151,70 @@ public function display($tpl = null)
// Render the view.
parent::display($tpl);
}

/**
* Makes sure that the Joomla! Update Component Update is in the database and check if there is a new version.
*
* @return boolean True if there is a update else false
*
* @since 3.6.3
*/
private function checkForSelfUpdate()
{
$db = JFactory::getDbo();

$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('element') . " = " . $db->quote('com_joomlaupdate'));
$db->setQuery($query);

try
{
// Get the component extension ID
$joomlaUpdateComponentId = $db->loadResult();
}
catch (RuntimeException $e)
{
// Something is wrong here!
$joomlaUpdateComponentId = 0;
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}

// Try the update only if we have a extension id
if ($joomlaUpdateComponentId != 0)
{
// Allways force to check for an update!
$cache_timeout = 0;

$updater = JUpdater::getInstance();
$updater->findUpdates($joomlaUpdateComponentId, $cache_timeout, JUpdater::STABILITY_STABLE);

// Fetch the update information from the database.
$query = $db->getQuery(true)
->select('*')
->from($db->quoteName('#__updates'))
->where($db->quoteName('extension_id') . ' = ' . $db->quote($joomlaUpdateComponentId));
$db->setQuery($query);

try
{
$joomlaUpdateComponentObject = $db->loadObject();
}
catch (RuntimeException $e)
{
// Something is wrong here!
$joomlaUpdateComponentObject = null;
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}

if (is_null($joomlaUpdateComponentObject))
{
// No Update great!
return false;
}

return true;
}
}
}
Expand Up @@ -12,9 +12,7 @@
JHtml::_('behavior.keepalive');
JHtml::_('bootstrap.tooltip');

JLoader::register('ModLoginHelper', JPATH_ADMINISTRATOR . '/modules/mod_login/helper.php');

$twofactormethods = ModLoginHelper::getTwoFactorMethods();
$twofactormethods = JAuthenticationHelper::getTwoFactorMethods();

?>
<div class="alert alert-warning">
Expand Down
37 changes: 30 additions & 7 deletions administrator/components/com_menus/models/item.php
Expand Up @@ -1402,14 +1402,31 @@ public function save($data)
JError::raiseNotice(403, JText::_('COM_MENUS_ERROR_ALL_LANGUAGE_ASSOCIATED'));
}

$associations[$table->language] = $table->id;
// Get associationskey for edited item
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('key'))
->from($db->quoteName('#__associations'))
->where($db->quoteName('context') . ' = ' . $db->quote($this->associationsContext))
->where($db->quoteName('id') . ' = ' . (int) $table->id);
$db->setQuery($query);
$old_key = $db->loadResult();

// Deleting old association for these items
$db = $this->getDbo();
// Deleting old associations for the associated items
$query = $db->getQuery(true)
->delete('#__associations')
->where('context=' . $db->quote($this->associationsContext))
->where('id IN (' . implode(',', $associations) . ')');
->delete($db->quoteName('#__associations'))
->where($db->quoteName('context') . ' = ' . $db->quote($this->associationsContext));

if ($associations)
{
$query->where('(' . $db->quoteName('id') . ' IN (' . implode(',', $associations) . ') OR '
. $db->quoteName('key') . ' = ' . $db->quote($old_key) . ')');
}
else
{
$query->where($db->quoteName('key') . ' = ' . $db->quote($old_key));
}

$db->setQuery($query);

try
Expand All @@ -1423,7 +1440,13 @@ public function save($data)
return false;
}

if (!$all_language && count($associations) > 1)
// Adding self to the association
if (!$all_language)
{
$associations[$table->language] = (int) $table->id;
}

if (count($associations) > 1)
{
// Adding new association for these items
$key = md5(json_encode($associations));
Expand Down
3 changes: 3 additions & 0 deletions administrator/language/en-GB/en-GB.com_joomlaupdate.ini
Expand Up @@ -32,12 +32,15 @@ COM_JOOMLAUPDATE_VIEW_COMPLETE_MESSAGE="Your site has been successfully updated.
COM_JOOMLAUPDATE_VIEW_DEFAULT_DOWNLOAD_IN_PROGRESS="Downloading update file. Please wait ..."
COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_DOWNLOAD_URL="We can't find a download URL"
COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_DOWNLOAD_URL_DESC="An update to Joomla %1$s was found, but it wasn't possible to fetch the download URL for that update. There are two possibilities why this happens:<br>- Your host doesn't support <a href="_QQ_"https://www.joomla.org/technical-requirements.html"_QQ_">the minimum requirements for Joomla %1$s</a> and there is no alternative download for your configuration available.<br>- There is a problem with Joomla Update Server.<br><br>Please try to download the update package from <a href="_QQ_"https://www.joomla.org/download.html"_QQ_">the official Joomla download page</a> and use the Upload and Update tab."
COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_LIVE_UPDATE="Live Update is not available"
COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_LIVE_UPDATE_DESC="There is a new version of the Joomla Update Component that needs to be installed first. <a class=\"alert-link\" href="_QQ_"index.php?option=com_installer&view=update"_QQ_">Click here to update the component</a>."
COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_DIRECTORY="FTP Root"
COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_HOSTNAME="FTP Host"
COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_PASSWORD="FTP Password"
COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_PORT="FTP Port"
COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_USERNAME="FTP Username"
COM_JOOMLAUPDATE_VIEW_DEFAULT_INFOURL="Additional Information"
COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALL_SELF_UPDATE_FIRST="You must update to the latest version of the Joomla Update Component before you can install the Joomla Core Update!"
COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLAGAIN="Reinstall Joomla core files"
COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLED="Installed Joomla version"
COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLUPDATE="Install the Update"
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/en-GB.com_templates.ini
Expand Up @@ -31,7 +31,7 @@ COM_TEMPLATES_COMPILE_ERROR="An error occurred. Failed to compile."
COM_TEMPLATES_COMPILE_LESS="You should compile %s to generate a CSS file."
COM_TEMPLATES_COMPILE_SUCCESS="Successfully compiled LESS."
COM_TEMPLATES_CONFIG_FIELDSET_DESC="Global configuration for templates."
COM_TEMPLATES_CONFIG_POSITIONS_DESC="Enable the preview of the module positions in the template by appending tp=1 to the web address. Also enables the Preview button in the list of templates. Please refresh the page after changing this setting."
COM_TEMPLATES_CONFIG_POSITIONS_DESC="Enable the preview of the module positions in the template by appending tp=1 to the web address. Also enables the Preview button in the list of templates."
COM_TEMPLATES_CONFIG_POSITIONS_LABEL="Preview Module Positions"
COM_TEMPLATES_CONFIG_FONT_DESC="These file types will be available for font preview."
COM_TEMPLATES_CONFIG_FONT_LABEL="Valid Font Formats"
Expand Down
2 changes: 1 addition & 1 deletion administrator/modules/mod_menu/tmpl/default_enabled.php
Expand Up @@ -387,6 +387,6 @@
);
$menu->addChild(new JMenuNode(JText::_('MOD_MENU_HELP_DEVELOPER'), 'https://developer.joomla.org', 'class:help-dev', false, '_blank'));
$menu->addChild(new JMenuNode(JText::_('MOD_MENU_HELP_XCHANGE'), 'https://joomla.stackexchange.com', 'class:help-dev', false, '_blank'));
$menu->addChild(new JMenuNode(JText::_('MOD_MENU_HELP_SHOP'), 'https://shop.joomla.org', 'class:help-shop', false, '_blank'));
$menu->addChild(new JMenuNode(JText::_('MOD_MENU_HELP_SHOP'), 'https://community.joomla.org/the-joomla-shop.html', 'class:help-shop', false, '_blank'));
$menu->getParent();
}
Expand Up @@ -369,7 +369,7 @@
new JMenuNode(JText::_('MOD_MENU_HELP_XCHANGE'), 'https://joomla.stackexchange.com', 'class:help-dev', false, '_blank')
);
$menu->addChild(
new JMenuNode(JText::_('MOD_MENU_HELP_SHOP'), 'https://shop.joomla.org', 'class:help-shop', false, '_blank')
new JMenuNode(JText::_('MOD_MENU_HELP_SHOP'), 'https://community.joomla.org/the-joomla-shop.html', 'class:help-shop', false, '_blank')
);
$menu->getParent();
}
Expand Down
2 changes: 1 addition & 1 deletion installation/controller/install/email.php
Expand Up @@ -136,7 +136,7 @@ public function execute()
}
catch (Exception $e)
{
$app->enqueueMessage(JText::_('INSTL_EMAIL_NOT_SENT'), 'notice');
$app->enqueueMessage(JText::_('INSTL_EMAIL_NOT_SENT'), 'warning');
}

$app->sendJsonResponse($r);
Expand Down
4 changes: 2 additions & 2 deletions installation/controller/install/languages.php
Expand Up @@ -56,13 +56,13 @@ public function execute()
if (!$lids)
{
// No languages have been selected
$app->enqueueMessage(JText::_('INSTL_LANGUAGES_NO_LANGUAGE_SELECTED'));
$app->enqueueMessage(JText::_('INSTL_LANGUAGES_NO_LANGUAGE_SELECTED'), 'warning');
}
else
{
// Install selected languages
$model->install($lids);
$app->enqueueMessage(JText::_('INSTL_LANGUAGES_MORE_LANGUAGES'));
$app->enqueueMessage(JText::_('INSTL_LANGUAGES_MORE_LANGUAGES'), 'notice');
}

// Redirect to the page.
Expand Down

0 comments on commit dede28d

Please sign in to comment.