Skip to content

Commit

Permalink
Merge branch '4.8'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	calendar-bundle/composer.json
#	comments-bundle/composer.json
#	composer.json
#	core-bundle/composer.json
#	core-bundle/src/Resources/contao/config/constants.php
#	faq-bundle/composer.json
#	installation-bundle/composer.json
#	listing-bundle/composer.json
#	manager-bundle/composer.json
#	news-bundle/composer.json
#	newsletter-bundle/composer.json
  • Loading branch information
leofeyer committed Jul 16, 2019
2 parents 397b033 + 9e65c9d commit 6742d9e
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 18 deletions.
10 changes: 8 additions & 2 deletions calendar-bundle/src/Resources/contao/modules/ModuleEventlist.php
Expand Up @@ -184,8 +184,14 @@ protected function compile()
continue;
}

// Skip occurrences in the past but show running events (see #8497)
if (($this->cal_hideRunning || $event['repeatEnd']) && $event['end'] < $intStart)
// Hide running events
if ($this->cal_hideRunning && $event['begin'] < $intStart)
{
continue;
}

// Skip occurrences in the past
if ($event['repeatEnd'] && $event['end'] < $intStart)
{
continue;
}
Expand Down
17 changes: 17 additions & 0 deletions core-bundle/src/Resources/contao/classes/Backend.php
Expand Up @@ -1128,6 +1128,23 @@ public static function getDcaPickerWizard($extras, $table, $field, $inputName)
</script>';
}

/**
* Return the decoded host name
*
* @return string
*/
public static function getDecodedHostname()
{
$host = Environment::get('host');

if (strncmp($host, 'xn--', 4) === 0)
{
$host = Idna::decode($host);
}

return $host;
}

/**
* Add the custom layout section references
*/
Expand Down
14 changes: 14 additions & 0 deletions core-bundle/src/Resources/contao/classes/Frontend.php
Expand Up @@ -308,6 +308,20 @@ public static function getRootPageFromUrl()
$logger = System::getContainer()->get('monolog.logger.contao');
$accept_language = Environment::get('httpAcceptLanguage');

// Get the language from the URL if it is not set (see #456)
if (!isset($_GET['language']) && Config::get('addLanguageToUrl'))
{
$arrMatches = array();

// Get the request without the query string
list($strRequest) = explode('?', Environment::get('relativeRequest'), 2);

if (preg_match('@^([a-z]{2}(-[A-Z]{2})?)/@', $strRequest, $arrMatches))
{
Input::setGet('language', $arrMatches[1]);
}
}

// The language is set in the URL
if (!empty($_GET['language']) && Config::get('addLanguageToUrl'))
{
Expand Down
Expand Up @@ -55,7 +55,7 @@ public function run()
$objTemplate->base = Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['systemMessages']);
$objTemplate->host = Environment::get('host');
$objTemplate->host = Backend::getDecodedHostname();
$objTemplate->charset = Config::get('characterSet');
$objTemplate->messages = Message::generateUnwrapped() . Backend::getSystemMessages();
$objTemplate->noMessages = $GLOBALS['TL_LANG']['MSC']['noSystemMessages'];
Expand Down
Expand Up @@ -153,7 +153,7 @@ public function run()
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->h1 = $GLOBALS['TL_LANG']['MSC']['invalidToken'];
$objTemplate->title = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['invalidToken']);
$objTemplate->host = Environment::get('host');
$objTemplate->host = Backend::getDecodedHostname();
$objTemplate->charset = Config::get('characterSet');

return $objTemplate->getResponse();
Expand Down
Expand Up @@ -149,7 +149,7 @@ public function run()
$objTemplate->base = Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['filepicker']);
$objTemplate->host = Environment::get('host');
$objTemplate->host = Backend::getDecodedHostname();
$objTemplate->charset = Config::get('characterSet');
$objTemplate->addSearch = true;
$objTemplate->search = $GLOBALS['TL_LANG']['MSC']['search'];
Expand Down
Expand Up @@ -149,7 +149,7 @@ public function run()
$objTemplate->base = Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['helpWizardTitle']);
$objTemplate->host = Environment::get('host');
$objTemplate->host = Backend::getDecodedHostname();
$objTemplate->charset = Config::get('characterSet');
$objTemplate->headline = $arrData['label'][0] ?: $field;
$objTemplate->helpWizard = $GLOBALS['TL_LANG']['MSC']['helpWizard'];
Expand Down
Expand Up @@ -100,7 +100,7 @@ public function run()
$objTemplate->base = Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->languages = System::getLanguages(true); // backwards compatibility
$objTemplate->host = Environment::get('host');
$objTemplate->host = Backend::getDecodedHostname();
$objTemplate->charset = Config::get('characterSet');
$objTemplate->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
$objTemplate->curLanguage = Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
Expand Down
Expand Up @@ -288,7 +288,7 @@ protected function output()
$this->Template->base = Environment::get('base');
$this->Template->language = $GLOBALS['TL_LANGUAGE'];
$this->Template->title = StringUtil::specialchars(strip_tags($this->Template->title));
$this->Template->host = Environment::get('host');
$this->Template->host = Backend::getDecodedHostname();
$this->Template->charset = Config::get('characterSet');
$this->Template->account = $GLOBALS['TL_LANG']['MOD']['login'][1];
$this->Template->preview = $GLOBALS['TL_LANG']['MSC']['fePreview'];
Expand Down
Expand Up @@ -139,7 +139,7 @@ public function run()
$objTemplate->base = Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']);
$objTemplate->host = Environment::get('host');
$objTemplate->host = Backend::getDecodedHostname();
$objTemplate->charset = Config::get('characterSet');
$objTemplate->addSearch = true;
$objTemplate->search = $GLOBALS['TL_LANG']['MSC']['search'];
Expand Down
Expand Up @@ -130,7 +130,7 @@ public function run()
$objTemplate->base = Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['pw_new']);
$objTemplate->host = Environment::get('host');
$objTemplate->host = Backend::getDecodedHostname();
$objTemplate->charset = Config::get('characterSet');
$objTemplate->action = ampersand(Environment::get('request'));
$objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['pw_new'];
Expand Down
Expand Up @@ -164,7 +164,7 @@ public function run()
$objTemplate->base = Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = StringUtil::specialchars($this->strFile);
$objTemplate->host = Environment::get('host');
$objTemplate->host = Backend::getDecodedHostname();
$objTemplate->charset = Config::get('characterSet');
$objTemplate->labels = (object) $GLOBALS['TL_LANG']['MSC'];
$objTemplate->download = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['fileDownload']);
Expand Down
Expand Up @@ -85,7 +85,7 @@ public function run()
$objTemplate->base = Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['fePreview']);
$objTemplate->host = Environment::get('host');
$objTemplate->host = Backend::getDecodedHostname();
$objTemplate->charset = Config::get('characterSet');
$objTemplate->site = Input::get('site', true);
$objTemplate->switchHref = $objRouter->generate('contao_backend_switch');
Expand Down
2 changes: 1 addition & 1 deletion core-bundle/src/Resources/contao/dca/tl_form.php
Expand Up @@ -473,7 +473,7 @@ public function generateAlias($varValue, Contao\DataContainer $dc)
// Generate an alias if there is none
if ($varValue == '')
{
$varValue = Contao\System::getContainer()->get('contao.slug')->generate($dc->activeRecord->title, $dc->activeRecord->jumpTo, $aliasExists);
$varValue = Contao\System::getContainer()->get('contao.slug')->generate($dc->activeRecord->title, Contao\Input::post('jumpTo') ?: $dc->activeRecord->jumpTo, $aliasExists);
}
elseif ($aliasExists($varValue))
{
Expand Down
10 changes: 5 additions & 5 deletions core-bundle/tests/Functional/RoutingTest.php
Expand Up @@ -385,7 +385,7 @@ public function getAliasesWithLocale(): \Generator
'/en/home.xml',
404,
'(404 Not Found)',
[],
['language' => 'en'],
'root-with-home.local',
false,
false,
Expand All @@ -395,7 +395,7 @@ public function getAliasesWithLocale(): \Generator
'/en/home/auto_item/foo.html',
404,
'(404 Not Found)',
[],
['language' => 'en'],
'root-with-home.local',
false,
false,
Expand Down Expand Up @@ -445,7 +445,7 @@ public function getAliasesWithLocale(): \Generator
'/en/.html',
404,
'(404 Not Found)',
[],
['language' => 'en'],
'root-with-home.local',
false,
false,
Expand Down Expand Up @@ -495,7 +495,7 @@ public function getAliasesWithLocale(): \Generator
'/en/home/auto_item/foo.html',
404,
'(404 Not Found)',
[],
['language' => 'en'],
'root-with-home.local',
true,
false,
Expand Down Expand Up @@ -545,7 +545,7 @@ public function getAliasesWithLocale(): \Generator
'/en/folder/url/home/auto_item/foo.html',
404,
'(404 Not Found)',
[],
['language' => 'en'],
'root-with-folder-urls.local',
true,
true,
Expand Down

0 comments on commit 6742d9e

Please sign in to comment.