Modified:
development/4.x/textpattern/include/txp_article.php
Log:
Article tab: Issue warning for invalid timestamps. Fixes issue 10. Thanks,
FireFusion.
Modified: development/4.x/textpattern/include/txp_article.php
==============================================================================
--- development/4.x/textpattern/include/txp_article.php (original)
+++ development/4.x/textpattern/include/txp_article.php Thu Jul 2 01:26:53
2009
@@ -87,6 +87,12 @@
}
$ts =
strtotime($year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.':'.$second);
+
+ if ($ts === false || $ts === -1) { // Tracking the PHP meanders on how
to return an error
+ article_edit(array(gTxt('invalid_postdate'), E_ERROR));
+ return;
+ }
+
$when = $when_ts = $ts - tz_offset($ts);
$when = "from_unixtime($when)";
}
@@ -222,6 +228,12 @@
}
$ts =
strtotime($year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.':'.$second);
+
+ if ($ts === false || $ts === -1) {
+ article_edit(array(gTxt('invalid_postdate'), E_ERROR));
+ return;
+ }
+
$when = $when_ts = $ts - tz_offset($ts);
$whenposted = "Posted=from_unixtime($when)";
}