Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/3.2.20' into support/3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Mar 26, 2015
2 parents 0e0691d + d6cb1ba commit 19043e4
Show file tree
Hide file tree
Showing 25 changed files with 200 additions and 72 deletions.
20 changes: 16 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ public function run()
// Load the page object depending on its type
$objHandler = new $GLOBALS['TL_PTY'][$objPage->type]();

// Backup some globals (see #7659)
$arrHead = $GLOBALS['TL_HEAD'];
$arrBody = $GLOBALS['TL_BODY'];
$arrMootools = $GLOBALS['TL_MOOTOOLS'];
$arrJquery = $GLOBALS['TL_JQUERY'];

try
{
// Generate the page
Expand All @@ -251,6 +257,12 @@ public function run()
}
catch (UnusedArgumentsException $e)
{
// Restore the globals (see #7659)
$GLOBALS['TL_HEAD'] = $arrHead;
$GLOBALS['TL_BODY'] = $arrBody;
$GLOBALS['TL_MOOTOOLS'] = $arrMootools;
$GLOBALS['TL_JQUERY'] = $arrJquery;

// Render the error page (see #5570)
$objHandler = new $GLOBALS['TL_PTY']['error_404']();
$objHandler->generate($pageId);
Expand Down Expand Up @@ -310,8 +322,8 @@ protected function outputFromCache()
// Check for a mobile layout
if (Input::cookie('TL_VIEW') == 'mobile' || (Environment::get('agent')->mobile && Input::cookie('TL_VIEW') != 'desktop'))
{
$strCacheKey = md5($strCacheKey . '.mobile');
$strCacheFile = TL_ROOT . '/system/cache/html/' . substr($strCacheKey, 0, 1) . '/' . $strCacheKey . '.html';
$strMd5CacheKey = md5($strCacheKey . '.mobile');
$strCacheFile = TL_ROOT . '/system/cache/html/' . substr($strMd5CacheKey, 0, 1) . '/' . $strMd5CacheKey . '.html';

if (file_exists($strCacheFile))
{
Expand All @@ -322,8 +334,8 @@ protected function outputFromCache()
// Check for a regular layout
if (!$blnFound)
{
$strCacheKey = md5($strCacheKey);
$strCacheFile = TL_ROOT . '/system/cache/html/' . substr($strCacheKey, 0, 1) . '/' . $strCacheKey . '.html';
$strMd5CacheKey = md5($strCacheKey);
$strCacheFile = TL_ROOT . '/system/cache/html/' . substr($strMd5CacheKey, 0, 1) . '/' . $strMd5CacheKey . '.html';

if (file_exists($strCacheFile))
{
Expand Down
2 changes: 1 addition & 1 deletion system/config/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Core version
*/
define('VERSION', '3.2');
define('BUILD', '19');
define('BUILD', '20');
define('LONG_TERM_SUPPORT', true);


Expand Down
29 changes: 29 additions & 0 deletions system/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
Contao Open Source CMS changelog
================================

Version 3.2.20 (2015-03-26)
---------------------------

### Fixed
Correctly convert date strings depending on their rgxp format (see #7721).

### Fixed
Update news and calendar feeds from the content view (see #7679).

### Fixed
Do not generally encode stand-alone ampersands (see #7684).

### Fixed
Restore some globals when catching the unused argument exception (see #7659).

### Fixed
Correctly set the CSS classes in the jQuery accordion and do not try to mess
with its ARIA handling (see #7622).

### Fixed
Handle language fragments without trailing slash when redirecting (see #7666).

### Fixed
Trigger the `load_callback` upon saving in "override all" mode (see #7670).

### Fixed
Ensure a unique language file array in the `Automator` class (see #7687).


Version 3.2.19 (2015-02-12)
---------------------------

Expand Down
27 changes: 27 additions & 0 deletions system/modules/calendar/dca/tl_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{
$GLOBALS['TL_DCA']['tl_content']['config']['ptable'] = 'tl_calendar_events';
$GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'][] = array('tl_content_calendar', 'checkPermission');
$GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'][] = array('tl_content_calendar', 'generateFeed');
}


Expand Down Expand Up @@ -151,4 +152,30 @@ protected function checkAccessToElement($id, $root, $blnIsPid=false)

return true;
}


/**
* Check for modified calendar feeds and update the XML files if necessary
*/
public function generateFeed()
{
$session = $this->Session->get('calendar_feed_updater');

if (!is_array($session) || empty($session))
{
return;
}

$this->import('Calendar');

foreach ($session as $id)
{
$this->Calendar->generateFeedsByCalendar($id);
}

$this->import('Automator');
$this->Automator->generateSitemap();

$this->Session->set('calendar_feed_updater', null);
}
}
2 changes: 1 addition & 1 deletion system/modules/core/classes/FrontendTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function output($blnCheckRequest=false)
}

// Parse the template
$strBuffer = str_replace(' & ', ' & ', $this->parse());
$strBuffer = $this->parse();

// HOOK: add custom output filters
if (isset($GLOBALS['TL_HOOKS']['outputFrontendTemplate']) && is_array($GLOBALS['TL_HOOKS']['outputFrontendTemplate']))
Expand Down
4 changes: 2 additions & 2 deletions system/modules/core/drivers/DC_File.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ protected function save($varValue)
}

// Convert date formats into timestamps
if (in_array($arrData['eval']['rgxp'], array('date', 'time', 'datim')))
if ($varValue != '' && in_array($arrData['eval']['rgxp'], array('date', 'time', 'datim')))
{
$objDate = new \Date($varValue, \Config::get($arrData['eval']['rgxp'] . 'Format'));
$objDate = new \Date($varValue, \Date::getFormatFromRgxp($arrData['eval']['rgxp']));
$varValue = $objDate->tstamp;
}

Expand Down
2 changes: 1 addition & 1 deletion system/modules/core/drivers/DC_Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ protected function save($varValue)
// Convert date formats into timestamps
if ($varValue != '' && in_array($arrData['eval']['rgxp'], array('date', 'time', 'datim')))
{
$objDate = new \Date($varValue, $GLOBALS['TL_CONFIG'][$arrData['eval']['rgxp'] . 'Format']);
$objDate = new \Date($varValue, \Date::getFormatFromRgxp($arrData['eval']['rgxp']));
$varValue = $objDate->tstamp;
}

Expand Down
19 changes: 18 additions & 1 deletion system/modules/core/drivers/DC_Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -2843,7 +2843,7 @@ protected function save($varValue)
// Convert date formats into timestamps
if ($varValue != '' && in_array($arrData['eval']['rgxp'], array('date', 'time', 'datim')))
{
$objDate = new \Date($varValue, $GLOBALS['TL_CONFIG'][$arrData['eval']['rgxp'] . 'Format']);
$objDate = new \Date($varValue, \Date::getFormatFromRgxp($arrData['eval']['rgxp']));
$varValue = $objDate->tstamp;
}

Expand All @@ -2861,6 +2861,23 @@ protected function save($varValue)
$new = deserialize($varValue, true);
$old = deserialize($this->objActiveRecord->{$this->strField}, true);

// Call load_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['load_callback']))
{
foreach ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['load_callback'] as $callback)
{
if (is_array($callback))
{
$this->import($callback[0]);
$old = $this->$callback[0]->$callback[1]($old, $this);
}
elseif (is_callable($callback))
{
$old = $callback($old, $this);
}
}
}

switch (\Input::post($this->strInputName . '_update'))
{
case 'add':
Expand Down
2 changes: 1 addition & 1 deletion system/modules/core/languages/it/default.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@
</trans-unit>
<trans-unit id="MSC.weekOffset">
<source>0</source>
<target>0</target>
<target>1</target>
</trans-unit>
<trans-unit id="MSC.titleFormat">
<source>%B %d%o, %Y</source>
Expand Down
2 changes: 1 addition & 1 deletion system/modules/core/languages/ru/default.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,7 @@ This e-mail has been generated by Contao. You can not reply to it directly.
</trans-unit>
<trans-unit id="MSC.readMore">
<source>Read the article: %s</source>
<target>Прочитать всю статью: %s</target>
<target>Прочитать полностью статью: %s</target>
</trans-unit>
<trans-unit id="MSC.targetPage">
<source>Target page</source>
Expand Down
2 changes: 2 additions & 0 deletions system/modules/core/languages/zh/default.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,11 @@
</trans-unit>
<trans-unit id="MSC.lastLogin.0">
<source>Previous login</source>
<target>上一次登录</target>
</trans-unit>
<trans-unit id="MSC.lastLogin.1">
<source>Previous login: %s</source>
<target>上一次登录: %s</target>
</trans-unit>
<trans-unit id="MSC.currentLogin.0">
<source>Last login</source>
Expand Down
19 changes: 9 additions & 10 deletions system/modules/core/library/Contao/Automator.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public function generateConfigCache()
$objCacheFile->close();

// Add a log entry
$this->log('Generated the autoload cache', __METHOD__, TL_CRON);
$this->log('Generated the config cache', __METHOD__, TL_CRON);
}


Expand All @@ -560,16 +560,15 @@ public function generateDcaCache()

foreach (scan(TL_ROOT . '/' . $strDir) as $strFile)
{
// Ignore non PHP files and files which have been included before
if (strncmp($strFile, '.', 1) === 0 || substr($strFile, -4) != '.php' || in_array($strFile, $arrFiles))
if (strncmp($strFile, '.', 1) !== 0 && substr($strFile, -4) == '.php')
{
continue;
$arrFiles[] = substr($strFile, 0, -4);
}

$arrFiles[] = substr($strFile, 0, -4);
}
}

$arrFiles = array_values(array_unique($arrFiles));

// Create one file per table
foreach ($arrFiles as $strName)
{
Expand Down Expand Up @@ -640,15 +639,15 @@ public function generateLanguageCache()

foreach (scan(TL_ROOT . '/' . $strDir) as $strFile)
{
if (strncmp($strFile, '.', 1) === 0 || (substr($strFile, -4) != '.php' && substr($strFile, -4) != '.xlf') || in_array($strFile, $arrFiles))
if (strncmp($strFile, '.', 1) !== 0 && (substr($strFile, -4) == '.php' || substr($strFile, -4) == '.xlf'))
{
continue;
$arrFiles[] = substr($strFile, 0, -4);
}

$arrFiles[] = substr($strFile, 0, -4);
}
}

$arrFiles = array_values(array_unique($arrFiles));

// Create one file per table
foreach ($arrFiles as $strName)
{
Expand Down
26 changes: 26 additions & 0 deletions system/modules/core/library/Contao/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,32 @@ public static function getNumericDatimFormat()
}


/**
* Return a numeric format string depending on the regular expression name
*
* @return string The numeric format string
*/
public static function getFormatFromRgxp($strRgxp)
{
switch ($strRgxp)
{
case 'date':
return static::getNumericDateFormat();
break;

case 'time':
return static::getNumericTimeFormat();
break;

case 'datim':
return static::getNumericDatimFormat();
break;
}

return null;
}


/**
* Parse a date format string and translate textual representations
*
Expand Down
4 changes: 2 additions & 2 deletions system/modules/core/library/Contao/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -1404,9 +1404,9 @@ public static function getAttributesFromDca($arrData, $strName, $varValue=null,
$arrAttributes['value'] = deserialize($varValue);

// Convert timestamps
if ($varValue != '' && ($arrData['eval']['rgxp'] == 'date' || $arrData['eval']['rgxp'] == 'time' || $arrData['eval']['rgxp'] == 'datim'))
if ($varValue != '' && in_array($arrData['eval']['rgxp'], array('date', 'time', 'datim')))
{
$objDate = new \Date($varValue);
$objDate = new \Date($varValue, \Date::getFormatFromRgxp($arrData['eval']['rgxp']));
$arrAttributes['value'] = $objDate->{$arrData['eval']['rgxp']};
}

Expand Down
2 changes: 1 addition & 1 deletion system/modules/core/models/PageModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static function find404ByPid($intPid, array $arrOptions=array())
* @param array $arrAliases An array of possible alias names
* @param array $arrOptions An optional options array
*
* @return \Model_Collection|null A collection of Models or null if there is no matching pages
* @return \Model\Collection|null A collection of Models or null if there is no matching pages
*/
public static function findByAliases($arrAliases, array $arrOptions=array())
{
Expand Down
2 changes: 1 addition & 1 deletion system/modules/core/modules/ModuleLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function generate()
}

// Set the last page visited
if ($this->redirectBack)
if (!$_POST && $this->redirectBack)
{
$_SESSION['LAST_PAGE_VISITED'] = $this->getReferer();
}
Expand Down
4 changes: 2 additions & 2 deletions system/modules/core/modules/ModulePersonalData.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ protected function compile()
$rgxp = $arrData['eval']['rgxp'];

// Convert date formats into timestamps (check the eval setting first -> #3063)
if (($rgxp == 'date' || $rgxp == 'time' || $rgxp == 'datim') && $varValue != '')
if ($varValue != '' && in_array($rgxp, array('date', 'time', 'datim')))
{
try
{
$objDate = new \Date($varValue);
$objDate = new \Date($varValue, \Date::getFormatFromRgxp($rgxp));
$varValue = $objDate->tstamp;
}
catch (\OutOfBoundsException $e)
Expand Down
4 changes: 2 additions & 2 deletions system/modules/core/modules/ModuleRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ protected function compile()
$rgxp = $arrData['eval']['rgxp'];

// Convert date formats into timestamps (check the eval setting first -> #3063)
if (($rgxp == 'date' || $rgxp == 'time' || $rgxp == 'datim') && $varValue != '')
if ($varValue != '' && in_array($rgxp, array('date', 'time', 'datim')))
{
try
{
$objDate = new \Date($varValue);
$objDate = new \Date($varValue, \Date::getFormatFromRgxp($rgxp));
$varValue = $objDate->tstamp;
}
catch (\OutOfBoundsException $e)
Expand Down
10 changes: 9 additions & 1 deletion system/modules/core/pages/PageError404.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ public function generate($pageId, $strDomain=null, $strHost=null)
// Only redirect if there is no language fragment (see #4669)
if ($strRequest != '' && !preg_match('@^[a-z]{2}(\-[A-Z]{2})?/@', $strRequest))
{
$this->redirect($objRootPage->language . '/' . \Environment::get('request'), 301);
// Handle language fragments without trailing slash (see #7666)
if (preg_match('@^[a-z]{2}(\-[A-Z]{2})?$@', $strRequest))
{
$this->redirect(($GLOBALS['TL_CONFIG']['rewriteURL'] ? '' : 'index.php/') . $strRequest . '/', 301);
}
else
{
$this->redirect(($GLOBALS['TL_CONFIG']['rewriteURL'] ? '' : 'index.php/') . $objRootPage->language . '/' . $strRequest, 301);
}
}
}

Expand Down
Loading

0 comments on commit 19043e4

Please sign in to comment.