[textpattern commit] r3242 - Article tab: Issue warning for invalid timestamps. Fixes issue 10. Thanks, FireFusion.

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 2, 2009, 4:45:52 AM7/2/09
to txp...@googlegroups.com
Author: r.wetzlmayr
Date: Thu Jul 2 01:26:53 2009
New Revision: 3242

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)";
}

Reply all
Reply to author
Forward
0 new messages