Plugin "Links to next/previous", Timeoffset Proble

Found a bug? Tell us!!
Post Reply
johncanary
Regular
Posts: 116
Joined: Mon Aug 20, 2007 4:00 am
Location: Spain
Contact:

Plugin "Links to next/previous", Timeoffset Proble

Post by johncanary »

Hello!

The "Links to next/previous" plugin does not handle Time Offest (Configuration) correctly. The NEXT link from the older post to the most recent post is not shown unless the server time reflects the corrected local time of the post. To make it clear some example"

Server time 10:00 (USA)
Time offsett +5:00
Local time: 15:00(Europe)

Old post id = 56
New post id = 57, published at 15:00 local time.

Entry with id = 56 does not habe the NEXT link to post id = 57 until 20:00 local time, which is 15:00 server time.

Get it.

I verified that with a test installation of serendipity. When server timeoff set == 0, then there is no problem.

In my case it takes 8 hours till the NEXT link to the newest post shows up. If I'd post 100 entries in thos 8 hours, non of them would have any PREV, NEXT links till the 8 hours have passed.

"Links to next/previous entry" Event Plugin. Version: 1.33
Serendipity 1.1.2 and PHP 4.3.11
Browser independent.

Good enough of a bug report?
Yours
John
Yours John
: John's Google+ Profile
: John's E-Biz Booster Blog powered by Serendipity 1.7/PHP 5.3.14
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Plugin "Links to next/previous", Timeoffset Pr

Post by garvinhicking »

Hi!

Hm, I thought the plugin would correclty handle it. Sadly, I'm a really dumbass when it comes down to server timezones, I've never fully understand/needed the logic behind it. *g*

However, maybe you can have a check. Edit the serendipity_event_entrypaging.php file. There you see this function:

Code: Select all

   function timeOffset($timestamp) {
        if (function_exists('serendipity_serverOffsetHour')) {
            return serendipity_serverOffsetHour($timestamp, true);
        }

        return $timestamp;
    }
Does it work if you change that to:

Code: Select all

   function timeOffset($timestamp) {
        if (function_exists('serendipity_serverOffsetHour')) {
            return serendipity_serverOffsetHour($timestamp);
        }

        return $timestamp;
    }
or maybe

Code: Select all

   function timeOffset($timestamp) {
        return $timestamp;
    }

?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
johncanary
Regular
Posts: 116
Joined: Mon Aug 20, 2007 4:00 am
Location: Spain
Contact:

!! FIXEDRe: Plugin "Links to next/previous", Timeo

Post by johncanary »

Hi,
This version works perfectly!

Code: Select all

   function timeOffset($timestamp) {
        return $timestamp;
    }
By the way the problem was opposite with negative offsets. In that case you would have NEXT links pointing to articles that are published in the future (general setting: don't show future articles), before they are actually published.

Why does the above solution work?

All timestamps in S9Y are recorded at "server time" (It does not matter if srver uses local time or UTC). The OFFSET config value is used for display mostly. Therefore it is not relevant for this condition.

I have verified that the above works correctly with all combination of
TimeOffset {-1,0,1} and posts that are published promptly and in the future.


Your hint was very helpful, since I did not have to check where to fix it. Feel free to use the above in the official bugfix, but understand that I don't give any warranties.

John
E-Biz Booster Blog
Yours John
: John's Google+ Profile
: John's E-Biz Booster Blog powered by Serendipity 1.7/PHP 5.3.14
Post Reply