Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2011-09-29 04:13:55 +0400
committermattpiwik <matthieu.aubry@gmail.com>2011-09-29 04:13:55 +0400
commit2cb36fdad81218a39b6e87775c1c354a64713e25 (patch)
treee4870087bdd7fd06de3eafd048d69782729d6caf /core/Date.php
parent5517bec981453e27628a2200497fba005ad30e4f (diff)
Date better message
git-svn-id: http://dev.piwik.org/svn/trunk@5258 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Date.php')
-rw-r--r--core/Date.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/Date.php b/core/Date.php
index 3c7962ce1e..f2c6a94512 100644
--- a/core/Date.php
+++ b/core/Date.php
@@ -44,6 +44,7 @@ class Piwik_Date
*/
static public function factory($dateString, $timezone = null)
{
+ $invalidDateException = new Exception(Piwik_TranslateException('General_ExceptionInvalidDateFormat', array("YYYY-MM-DD, or 'today' or 'yesterday'", "strtotime", "http://php.net/strtotime")));
if($dateString instanceof self)
{
$dateString = $dateString->toString();
@@ -73,12 +74,18 @@ class Piwik_Date
($dateString = strtotime($dateString)) === false
))
{
- throw new Exception(Piwik_TranslateException('General_ExceptionInvalidDateFormat', array("YYYY-MM-DD, or 'today' or 'yesterday'", "strtotime", "http://php.net/strtotime")));
+ throw $invalidDateException;
}
else
{
$date = new Piwik_Date($dateString);
}
+ $timestamp = $date->getTimestamp();
+ if($timestamp < 681436800 // can't be doing web analytics before the 1st website
+ || $timestamp > 7289049600 // piwik is designed to last (date lib will break long before that)
+ ) {
+ throw $invalidDateException;
+ }
if(empty($timezone))
{
return $date;