Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-11-26 06:08:11
- RazvanM
- New Member
- Registered: 2006-11-26
- Posts: 2
[issue] Cleanurl problems due to unix_timestamp
I noticed a small problem in the way the permlink works due to the use of unix_timestamp in Mysql queries.
The scenario is like this: I have an article which has the posted date “2006-11-21 05:51:34” in Mysql. When the the unix_timestamp(posted) is requested, the Mysql db returns 1164084694. When this is converted in PHP to a date it becomes “20 Nov 2006”, the permlink is generated as /2006/11/20/… and then the search in the database for “posted like ’2006-11-20%’” fails.
Disclaimer: I searched the forum for this problem and I didn’t find it. I apologise in advance if this was in fact already discussed.
Offline
Re: [issue] Cleanurl problems due to unix_timestamp
This may or may not be related to a longstanding bug in the function doArticle in publish.php that Marshall Potter turned up in relation to his mdp_calendar plugin. Mary or Marshall could confirm this.
Offline
#3 2006-11-26 13:16:29
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [issue] Cleanurl problems due to unix_timestamp
Yep.
Offline
#4 2006-11-26 17:48:15
- RazvanM
- New Member
- Registered: 2006-11-26
- Posts: 2
Re: [issue] Cleanurl problems due to unix_timestamp
Because I’m using year_month_day_title I was able to fix my problem by slighly changing the lookupByDateTitle function. The one that I’m using now is like this:
function lookupByDateTitle($when,$title,$debug=’‘)
{
$ts_min = strtotime($when);
$ts_max = $ts_min + 86400;
return safe_row(“ID,Section”,“textpattern”, “unix_timestamp(posted) > $ts_min and unix_timestamp(posted) < $ts_max and url_title like ‘“.doSlash($title).”’ and Status >= 4 limit 1”);
}
Offline