Firefox PHP

Readable Dates module

Posted by Maurice Makaay 
All files from this thread

File Name File Size   Posted by Date  
readable_dates-1.0.7.zip 6.8 KB open | download Maurice Makaay 05/08/2006 Read message
Readable Dates module
January 17, 2006 05:04AM
Make some dates easier to read for humans, by using "yesterday", "today"
or by leaving the year out of the date. Customization of all date strings
can be done through the lang/*.php files.

Install:

- Unpack the archive;

- Move the directory "readable_dates" to the directory "mods" within your Phorum installation;

- Login as administrator in Phorum's administrative interface and go to the "Modules" section;

- Enable the module "Readable Dates".


Changelog:

2006-05-08 v1.0.7
- Fixed typo: "Las edit was" -> "Last edit was" (thanks CBiLL).

2006-03-28 v1.0.6
- Do a restore for time formats at the end of the list and the
read hook, as suggested by Oliver Riesen. This will take away
some problems with other modules that are using time formatting
as well (but probably not all of them, in case date formatting
is run before the list/read hooks).

2006-03-01 v1.0.5
- The script did not load the right defaults.php file.
- Even more fixes for TZ handling. Users that have a timezone
set in the control center should now get a correct
date too when using this mod.

2006-01-20 v1.0.4
- Some more fixes for correct TZ handling. The previous version was
trying to fix problems in the wrong place, which caused unexpected
side-effect problems.
- The dates on the read page can now be formatted as well.
- A settings screen has been added. In the settings you can configure
on which pages you want to apply the readable date formatting.

2006-01-19 v1.0.3
- Some fixes for correct TZ handling (as provided by regdos)

2006-01-17 v1.0.2
- wrong datafield used for lastpost formatting (reported by regdos)

2006-01-16 v1.0.1
- Minor fix in French and German language packages

2006-01-10 v1.0.0
- Initial release


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 7 time(s). Last edit at 05/08/2006 03:56AM by mmakaay.
Attachments:
open | download - readable_dates-1.0.7.zip (6.8 KB)
Re: Readable Dates module
January 19, 2006 08:56AM
I test it and i test it and mod don't work corectly because:

1. in phorum_mod_readable_dates_list()
- $message["datestamp"] have tz offset
- $message["lastpost"] have tz offset

2. phorum_mod_readable_dates_index()
- $message["last_post_time"] havn't tz offset but it is simple to do.
Add/change lines:
 
       // Compute back the epoch time for the lastpost.
        $lastpost = phorum_date("%Y:%m:%d:%H:%M:%S",$message["last_post_time"]);
        $ds = explode(":", $lastpost);
        $lastpost = mktime($ds[3],$ds[4],$ds[5],$ds[1],$ds[2],$ds[0]);

        // Format the folder's last post time.
        $data[$id]["last_post"] = phorum_mod_readable_dates_format(
            $lastpost, $GLOBALS["PHORUM"]["long_date"]
        );

3. phorum_mod_readable_dates_format()
- $lt = localtime(time()); - havn't tz offset but it is simple to do
Add/change lines:
    if (empty($today)) {

        $now_tz = phorum_date("%Y:%m:%d:%H:%M:%S",time());
        $lt = explode(":", $now_tz);
        $today = mktime(0,0,0,$lt[1],$lt[2],$lt[0]);
    }
and
        if ($mt[5] == $lt[0]) {
            $fmt = $PHORUM["DATA"]["LANG"]["mod_readable_dates"]["thisyear"];
        }

All correct works but small error is with which on solution else not have good idea.
line:

// Format the time.
 return phorum_date($fmt, $time);
phorum_date adds second time tz offset and summary realy data have date + tz + tz.

--
Tomasz Regdos :: www.regdos.com
Re: Readable Dates module
January 19, 2006 11:19AM
For my installation I see no difference in my code and your code, so I accepted your code as being correct (at least for the case where you don't use a timezone offset, like me).

I already have updated the first post with the latest code, although a last

> realy data have date + tz + tz.

This is because now phorum_date() is called twice on the same data. This function will add the timezone twice. I'll look into that later.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Readable Dates module
January 20, 2006 07:31PM
Here's a new release for the Readable Dates module.
Changelog for version 1.0.4:
    - Some more fixes for correct TZ handling. The previous version was
      trying to fix problems in the wrong place, which caused unexpected
      side-effect problems.

    - The dates on the read page can now be formatted as well.

    - A settings screen has been added. In the settings you can configure
      on which pages you want to apply the readable date formatting.

The module package can be downloaded from the message at the start of this thread.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Readable Dates module
January 23, 2006 11:02AM
Hi.

There is a problem in the settings, after "save settings":

Fatal error: Call to undefined function: phorum_admin_okmsg() in /home/users2/e/elegall/www/ensaia2006/phorum/mods/readable_dates/settings.php on line 18

Is it due to my phorum version (5.0.19) ?

sonerien.
Re: Readable Dates module
January 23, 2006 11:09AM
Yes, it is. That messaging function is new for Phorum 5.1.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Readable Dates module
January 25, 2006 03:59PM
Ok thank you, I'm going to upload...
Re: Readable Dates module
February 07, 2006 05:32AM
Hi, I used this module and all seemed to be working well. Except it threw my forums clock off by about 4hrs. I thought it might have been my server/system clock or even my settings on the forum. In the end, when I disabled this module the forum time returned to normal. I'm hoping this bug can be fixed.. as I love the way this looks. I'm running 5.1.7 RC1
Re: Readable Dates module
February 07, 2006 07:11AM
I hate timezones :)

Some questions for you:
- What timezone are you in yourself?
- Is your server's timezone the same as your own timezone?
- Do you have Time Zone Offset set in the admin settings?
- Do you have a timezone defined in the user control center?
- Is the 4 hours offset +4 or -4 in respect to your own time?

I don't have an idea where the shift is coming from (I don't see it on my system), but based on this info I might be able to find the bug. The timezone handling is quite hard to nail down :(


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Readable Dates module
February 08, 2006 05:39AM
Quote
mmakaay
I hate timezones :)

Some questions for you:
- What timezone are you in yourself?
- Is your server's timezone the same as your own timezone?
- Do you have Time Zone Offset set in the admin settings?
- Do you have a timezone defined in the user control center?
- Is the 4 hours offset +4 or -4 in respect to your own time?

I don't have an idea where the shift is coming from (I don't see it on my system), but based on this info I might be able to find the bug. The timezone handling is quite hard to nail down :(

Hi Maurice, Here is my info.

- What timezone are you in yourself? Eastern Time
- Is your server's timezone the same as your own timezone? Yes, I believe so. I checked my servers clock settings and they are both on my Eastern settings.

- Do you have a timezone defined in the user control center? Yes, Eastern Time.
- Do you have Time Zone Offset set in the admin settings? No, Its set to 0.
- Is the 4 hours offset +4 or -4 in respect to your own time? The difference is actually +5hrs

Thank you for your time.
Sorry, only registered users may post in this forum.

Click here to login