[geeklog-devel] Solution for Bug 0000853

Ishesh Murarka 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",
> etc.
>
> 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[1],$DS[2],$DS[0]);
>>
>> 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
>> encountered".
>>
>> 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
>>
>>
>> --
>> http://www.geeklog.net/
>> http://geeklog.info/
>>
>> _______________________________________________
>> geeklog-devel mailing list
>> geeklog-devel at lists.geeklog.net
>> http://eight.pairlist.net/mailman/listinfo/geeklog-devel
>>
>
>
>
> --
> Warmly,
>
> Stanislav
>
>
>
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel
>
>


-- 
Regards,
Ishesh Murarka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist8.pair.net/pipermail/geeklog-devel/attachments/20090412/6e93b656/attachment.html>


More information about the geeklog-devel mailing list