Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.1-dev' into j4tagsrouting
- Loading branch information
Showing
1,787 changed files
with
34,473 additions
and
29,976 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
administrator/components/com_admin/postinstall/behindproxy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_admin | ||
* | ||
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
use Joomla\CMS\Factory; | ||
use Joomla\CMS\Filesystem\File; | ||
use Joomla\CMS\Filesystem\Path; | ||
use Joomla\CMS\Language\Text; | ||
use Joomla\Registry\Registry; | ||
use Joomla\Utilities\ArrayHelper; | ||
|
||
/** | ||
* Notifies users of the new Behind Load Balancer option in Global Config, if we detect they might be behind a proxy | ||
* | ||
* @return boolean | ||
* | ||
* @since 3.9.26 | ||
*/ | ||
function admin_postinstall_behindproxy_condition() | ||
{ | ||
$app = Factory::getApplication(); | ||
|
||
if ($app->get('behind_loadbalancer', '0')) | ||
{ | ||
return false; | ||
} | ||
|
||
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) | ||
{ | ||
return true; | ||
} | ||
|
||
if (array_key_exists('HTTP_CLIENT_IP', $_SERVER) && !empty($_SERVER['HTTP_CLIENT_IP'])) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
|
||
/** | ||
* Enables the Behind Load Balancer setting in Global Configuration | ||
* | ||
* @return void | ||
* | ||
* @since 3.9.26 | ||
*/ | ||
function behindproxy_postinstall_action() | ||
{ | ||
$prev = ArrayHelper::fromObject(new JConfig); | ||
$data = array_merge($prev, array('behind_loadbalancer' => '1')); | ||
|
||
$config = new Registry($data); | ||
|
||
// Set the configuration file path. | ||
$file = JPATH_CONFIGURATION . '/configuration.php'; | ||
|
||
// Attempt to make the file writeable | ||
if (Path::isOwner($file) && !Path::setPermissions($file, '0644')) | ||
{ | ||
Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'), 'error'); | ||
|
||
return; | ||
} | ||
|
||
// Attempt to write the configuration file as a PHP class named JConfig. | ||
$configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false)); | ||
|
||
if (!File::write($file, $configuration)) | ||
{ | ||
Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error'); | ||
|
||
return; | ||
} | ||
|
||
// Attempt to make the file unwriteable | ||
if (Path::isOwner($file) && !Path::setPermissions($file, '0444')) | ||
{ | ||
Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'), 'error'); | ||
} | ||
} |
Oops, something went wrong.