Permalink
Browse files

Do not override the global settings upon every call of `getPageDetail…

…s()`
  • Loading branch information...
1 parent e53b339 commit 5eec89b0c69405e313388b6f1cdf46b53b92e5b2 @leofeyer leofeyer committed Jan 5, 2012
Showing with 27 additions and 30 deletions.
  1. +24 −0 index.php
  2. +3 −30 system/libraries/Controller.php
View
@@ -175,6 +175,30 @@ public function run()
$objPage = $this->getPageDetails($objPage->id);
}
+ // Overwrite the global date and time format in the front end
+ if ($objPage->dateFormat != '')
+ {
+ $GLOBALS['TL_CONFIG']['dateFormat'] = $objPage->dateFormat;
+ }
+ if ($objPage->timeFormat != '')
+ {
+ $GLOBALS['TL_CONFIG']['timeFormat'] = $objPage->timeFormat;
+ }
+ if ($objPage->datimFormat != '')
+ {
+ $GLOBALS['TL_CONFIG']['datimFormat'] = $objPage->datimFormat;
+ }
+
+ // Set the admin e-mail address
+ if ($objPage->adminEmail != '')
+ {
+ list($GLOBALS['TL_ADMIN_NAME'], $GLOBALS['TL_ADMIN_EMAIL']) = $this->splitFriendlyName($objPage->adminEmail);
+ }
+ else
+ {
+ list($GLOBALS['TL_ADMIN_NAME'], $GLOBALS['TL_ADMIN_EMAIL']) = $this->splitFriendlyName($GLOBALS['TL_CONFIG']['adminEmail']);
+ }
+
// Exit if the root page has not been published (see #2425) and
// do not try to load the 404 page! It can cause an infinite loop.
if (!BE_USER_LOGGED_IN && !$objPage->rootIsPublic)
@@ -680,6 +680,9 @@ protected function getPageDetails($intId)
$objPage->staticFiles = $objParentPage->staticFiles;
$objPage->staticSystem = $objParentPage->staticSystem;
$objPage->staticPlugins = $objParentPage->staticPlugins;
+ $objPage->dateFormat = $objParentPage->dateFormat;
+ $objPage->timeFormat = $objParentPage->timeFormat;
+ $objPage->datimFormat = $objParentPage->datimFormat;
// Store whether the root page has been published
$time = time();
@@ -705,36 +708,6 @@ protected function getPageDetails($intId)
$objPage->mainPageTitle = strip_insert_tags($objPage->mainPageTitle);
$objPage->rootTitle = strip_insert_tags($objPage->rootTitle);
- // Overwrite the global date and time format in the front end
- if (!$GLOBALS['TL_ROOT_VALUES_SET'] && TL_MODE == 'FE' && $objParentPage->numRows && $objParentPage->type == 'root')
- {
- if ($objParentPage->dateFormat != '')
- {
- $GLOBALS['TL_CONFIG']['dateFormat'] = $objParentPage->dateFormat;
- }
- if ($objParentPage->timeFormat != '')
- {
- $GLOBALS['TL_CONFIG']['timeFormat'] = $objParentPage->timeFormat;
- }
- if ($objParentPage->datimFormat != '')
- {
- $GLOBALS['TL_CONFIG']['datimFormat'] = $objParentPage->datimFormat;
- }
-
- // Set the admin e-mail address
- if ($objParentPage->adminEmail != '')
- {
- list($GLOBALS['TL_ADMIN_NAME'], $GLOBALS['TL_ADMIN_EMAIL']) = $this->splitFriendlyName($objParentPage->adminEmail);
- }
- else
- {
- list($GLOBALS['TL_ADMIN_NAME'], $GLOBALS['TL_ADMIN_EMAIL']) = $this->splitFriendlyName($GLOBALS['TL_CONFIG']['adminEmail']);
- }
-
- // Do not set the root values upon subsequent calls
- $GLOBALS['TL_ROOT_VALUES_SET'] = true;
- }
-
// Do not cache protected pages
if ($objPage->protected)
{

0 comments on commit 5eec89b

Please sign in to comment.