protected function setDateTodayIfWebsiteCreatedToday()
{
$date = Common::getRequestVar('date', false);
if ($date == 'today' || Common::getRequestVar('period', false) == 'range') {
return;
}
$websiteId = Common::getRequestVar('idSite', false, 'int');
if ($websiteId) {
$website = new Site($websiteId);
$datetimeCreationDate = $website->getCreationDate()->getDatetime();
$creationDateLocalTimezone = Date::factory($datetimeCreationDate, $website->getTimezone())->toString('Y-m-d');
$todayLocalTimezone = Date::factory('now', $website->getTimezone())->toString('Y-m-d');
if ($creationDateLocalTimezone == $todayLocalTimezone) {
Piwik::redirectToModule('CoreHome', 'index', array('date' => 'today', 'idSite' => $websiteId, 'period' => Common::getRequestVar('period')));
}
}
}