[geeklog-devel] Solution for Bug 0000853
ishesh at gmail.com
Sun Apr 12 14:22:49 EDT 2009
On Sun, Apr 12, 2009 at 1:33 AM, Stan Palatnik <yankees26an at gmail.com>wrote:
> Yea I didn't account for alphanumeric input using ctype. In that case, if
> the text field contains any letters it should be run through *strtotime*().
> It's a very flexible built-in php function that can detect alot of mixed
> dates. For example it detects "yesterday", " one week ago", June 10th 2008",
> The use of strtotime() would involve a lot of operations to convert from
date to number of seconds elapsed and then checking that with the date
(timestamp) on the database.
I think a better fix is to write a good checkdate() function
I've been working on this. I'm trying to add a few features like adding a
pop-up calender there and having these checks done when a date is clicked.
> On Sat, Apr 11, 2009 at 3:38 PM, Dirk Haun <dirk at haun-online.de> wrote:
>> Stan Palatnik wrote:
>> >The simplest fix is including checkdate() in both the start and end dates
>> >Another faster solution would be just to check if mkdate returns false
>> > $startdate = mktime(0,0,0,$DS,$DS,$DS);
>> Actually, when you crank up the error_reporting to E_ALL you already get
>> an error for the mktime() call: "A non well formed numeric value
>> I think the first thing we should be checking for is that the $DS and
>> $DE arrays both have exactly 3 elements. And if the user mixed in some
>> letters, both checkdate() and mktime() will barf again, so we may want
>> to cast the 3 elements to (int) when calling any of those functions.
>> Apart from that technicality, the real problem here is that this code
>> exists in pretty much every plugin out there that implemented the search
>> function ... And it doesn't look like the new search in 1.6.0 would
>> change anything here. Sami?
>> bye, Dirk
>> geeklog-devel mailing list
>> geeklog-devel at lists.geeklog.net
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the geeklog-devel