[MODDB] Automatic Daylight Savings Time (DST) 2

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Ideas Centre
User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

[MODDB] Automatic Daylight Savings Time (DST) 2

Post by MartectX »

MOD Title: Automatic Daylight Savings Time (DST) 2
MOD Description: Introduces a city-based time zone system and thus allows for automatic Daylight Savings Time (DST) to be managed for each user separately. It also automatically detects DST periods and adjusts corresponding dates' ouputs accordingly.
MOD Version: 2.0.0 RC1
MOD Download: http://mods.martectx.de/automatic_dst_2.zip
Last edited by MartectX on Mon Jun 01, 2009 9:07 am, edited 16 times in total.
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: [DEV] Automatic Daylight Savings Time (DST) 1.1.0

Post by Muad''Dib »

Your the man!!! Ill keep my eyes on this thread.
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: [DEV] Automatic Daylight Savings Time (DST) 1.1.0

Post by Muad''Dib »

Installation was a breeze.

Here is what i set my timezone as in "automatic_dst.php"

$timezone = 'US/Pacific';

I believe this would have worked also:

$timezone = 'Etc/GMT-8';

The time is correct on my test board.

If i set my UCP setting to either DST or no DST, it doesnt make a difference.. the time stays the same on the board.

If i try to change the DST setting for the board it automatically sets it to "no" again.

Thats it so far.

I was thinking though that the registered users of a phpbb forum already enter in their own timezone. You can see it the same place you change the "Summer Time/DST is in effect" setting. It may be so much easier to use that setting they have already chosen to populate the $timezone variable... instead of having a redundant drop down box in the UCP. Make since? The same could be true for "System timezone:" under board settings. Eliminating the need for another drop down box (or whatever you had planned) altogether.
User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [DEV] Automatic Daylight Savings Time (DST) 1.1.0

Post by MartectX »

Muad''Dib wrote:If i set my UCP setting to either DST or no DST, it doesnt make a difference.. the time stays the same on the board.

If i try to change the DST setting for the board it automatically sets it to "no" again.

Thats it so far.
This is OK at this stage because the ability to affect DST at all will be removed with the very next version (if everything works automatically no user should have to worry about his settings!
Muad''Dib wrote:I was thinking though that the registered users of a phpbb forum already enter in their own timezone. You can see it the same place you change the "Summer Time/DST is in effect" setting. It may be so much easier to use that setting they have already chosen to populate the $timezone variable... instead of having a redundant drop down box in the UCP. Make since? The same could be true for "System timezone:" under board settings. Eliminating the need for another drop down box (or whatever you had planned) altogether.
Nah, the time zone dropdown box must stay in the UCP for you may have an international board with users from different parts of the world. But the box will contain the city choices of PHP - I don't think there is any need for translations then because cities and continents are easily recognizable.

Stay tuned - big update in the next hours! ;)
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: [DEV] Automatic Daylight Savings Time (DST) 1.1.0

Post by Muad''Dib »

MartectX wrote:Nah, the time zone dropdown box must stay in the UCP for you may have an international board with users from different parts of the world. But the box will contain the city choices of PHP - I don't think there is any need for translations then because cities and continents are easily recognizable.

Stay tuned - big update in the next hours! ;)
Well thats what im saying .. instead of creating another drop down box in the UCP and ACP, why not use the setting they have already chosen with the existing drop down boxes?
It just seems redundant to have two boxes.. unless im not understanding you correctly..

This also would make the mods transition seemless. Once the mod is installed, it automatically uses a setting that has already been configured by the users and admin --> (for the global board settings). No need to have all your users go into their UCP and select another timezone.

Cant wait for the update!
User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [DEV] Automatic Daylight Savings Time (DST) 1.1.0

Post by MartectX »

Muad''Dib wrote:Well thats what im saying .. instead of creating another drop down box in the UCP and ACP, why not use the setting they have already chosen with the existing drop down boxes?
It just seems redundant to have two boxes.. unless im not understanding you correctly..
That's what I had in mind - replace the old box.
Muad''Dib wrote:This also would make the mods transition seemless. Once the mod is installed, it automatically uses a setting that has already been configured by the users and admin --> (for the global board settings). No need to have all your users go into their UCP and select another timezone.
Hmmm... actually it's not easy to convert the phpBB time zones to PHP time zones. We'll probably have to set all users with an SQL query. :/ But that's a problem I'm going to face when the MOD is in BETA.
Muad''Dib wrote:Cant wait for the update!
I'm having dinner and will test the ModX installation instructions one last time. :P
User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Automatic Daylight Savings Time (DST) 1.1.1

Post by MartectX »

Version 1.1.1
  • Changed time zone options completely to include different DST areas
  • Disabled board and user DST settings which are now superfluous anyway
  • Date engine now checks every date for DST eligibility
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: [BETA] Automatic Daylight Savings Time (DST) 1.1.1

Post by Muad''Dib »

Well i thought i got rid of all the old traces of the previous version and then installed the latest, however it really screwed up the board's layout. Like it couldnt pull the style or something. Im going to be out for awhile, but when i get back ill do another clean install of phpbb and do the mod again to see what happens.


****EDIT****

I guess i should have checked error_log first ;)

Code: Select all

[13-Mar-2009 22:30:13] PHP Fatal error:  Call to undefined function automatic_dst_cache() in /home/<username>/public_html/dev/includes/cache.php on line 68
User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Automatic Daylight Savings Time (DST) 1.1.1

Post by MartectX »

Muad''Dib wrote:Well i thought i got rid of all the old traces of the previous version and then installed the latest, however it really screwed up the board's layout. Like it couldnt pull the style or something.
I have isolated the problem and asked for help in the MOD writers' section. Thanks for mentioning it (I don't like proSilver so I didn't notice it *g*)!

Here is a workaround:

OPEN includes/cache.php

FIND

Code: Select all

		$config['board_dst'] = automatic_dst_cache($config['board_timezone']);
REPLACE WITH

Code: Select all

	if (version_compare(PHP_VERSION, '5.2.0'))
	{
		date_default_timezone_set($config['board_timezone']);
	}
	else
	{
		putenv ('TZ=' . $config['board_timezone']);
	}

	$config['board_dst'] = date('I');
Muad''Dib wrote:

Code: Select all

[13-Mar-2009 22:30:13] PHP Fatal error:  Call to undefined function automatic_dst_cache() in /home/<username>/public_html/dev/includes/cache.php on line 68
Did you make the changes to common.php?
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: [BETA] Automatic Daylight Savings Time (DST) 1.1.1

Post by Muad''Dib »

MartectX wrote:
Muad''Dib wrote:

Code: Select all

[13-Mar-2009 22:30:13] PHP Fatal error:  Call to undefined function automatic_dst_cache() in /home/<username>/public_html/dev/includes/cache.php on line 68
Did you make the changes to common.php?
Yeah i made the change in common.php .. the error was caused by the edit in cache.php see below:
MartectX wrote:
Muad''Dib wrote:Well i thought i got rid of all the old traces of the previous version and then installed the latest, however it really screwed up the board's layout. Like it couldn't pull the style or something.
I have isolated the problem and asked for help in the MOD writers' section. Thanks for mentioning it (I don't like proSilver so I didn't notice it *g*)!

Here is a workaround:

OPEN includes/cache.php

FIND

Code: Select all

		$config['board_dst'] = automatic_dst_cache($config['board_timezone']);
REPLACE WITH

Code: Select all

	if (version_compare(PHP_VERSION, '5.2.0'))
	{
		date_default_timezone_set($config['board_timezone']);
	}
	else
	{
		putenv ('TZ=' . $config['board_timezone']);
	}

	$config['board_dst'] = date('I');
Ahh great that fixed it.

Here is my feedback thus far.

ITS FANTASTIC!

Honestly, i'm not to keen on what the verbiage for the time zone is. I would prefer (and this is definitely personal preference) for it to look exactly as phpbb already does. So for example, for my time zone America/Los_Angeles it would show [UTC -8] Pacific Time. Going even further it would be really cool (and i know it would be a lot of work) If when DST is in effect It would say [UTC -8] Pacific Daylight Savings Time... but when its not in effect it would say [UTC -8] Pacific Standard Time. Again, i know it would be a lot of work so if you were willing to come up with the code, i would be willing to populate the verbiage \ text. Other than that, it showing America/Los_Angeles or whatever timezone the user is in is fine and works.

****EDIT****
Actually couldnt that be done with tz and tz_zones in language\en\common.php fairly easily? Port those over to your automatic_dst.php file, and then add / remove as needed?? Just throwing ideas out there.
****END EDIT****

One sorta minor detail. When viewing the board as a Guest, the time at the top of the board is whatever the server is set to, but the area that says: All times are America/Los_Angeles [ DST ] (as an example) at the lower right of the page says:
All times are 0.0 [ DST ]. This can easily be remedied by going into the ACP, and manually setting the timezone for the Anonymous user account.

Other than that everything seems great!
User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Automatic Daylight Savings Time (DST) 1.1.1

Post by MartectX »

Muad''Dib wrote:Ahh great that fixed it.

Here is my feedback thus far.

ITS FANTASTIC!
Great to hear! :D
Muad''Dib wrote:Honestly, i'm not to keen on what the verbiage for the time zone is. I would prefer (and this is definitely personal preference) for it to look exactly as phpbb already does. So for example, for my time zone America/Los_Angeles it would show [UTC -8] Pacific Time. Going even further it would be really cool (and i know it would be a lot of work) If when DST is in effect It would say [UTC -8] Pacific Daylight Savings Time... but when its not in effect it would say [UTC -8] Pacific Standard Time. Again, i know it would be a lot of work so if you were willing to come up with the code, i would be willing to populate the verbiage \ text. Other than that, it showing America/Los_Angeles or whatever timezone the user is in is fine and works.

****EDIT****
Actually couldnt that be done with tz and tz_zones in language\en\common.php fairly easily? Port those over to your automatic_dst.php file, and then add / remove as needed?? Just throwing ideas out there.
****END EDIT****
I'll look into it for the next version. I will probably make it an option for the admin to choose between the complete list and the compressed list. Also on the complete list I'll translate the continents' names and maybe some cities. Deal? :)
Muad''Dib wrote:One sorta minor detail. When viewing the board as a Guest, the time at the top of the board is whatever the server is set to, but the area that says: All times are America/Los_Angeles [ DST ] (as an example) at the lower right of the page says:
All times are 0.0 [ DST ]. This can easily be remedied by going into the ACP, and manually setting the timezone for the Anonymous user account.
I guess I'll make it so that the anonymous user is automatically edited when you change the board's timezone - seems only logical to do so (I don't understand phpBB3's keeping of an anonymous dst setting and time zone anyway).


EDIT: It's not that easy to transfer the legacy time zones to legal PHP ones. The closest thing resembling them would be the Etc/GMT+X time zones which expressly are not to be used, as they "only exist for backward compatible reasons". :| And to make matters worse - if not to say worst - they all have absolute no DST information. So this possibility is out, cities are in.
User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Automatic Daylight Savings Time (DST) 1.1.2

Post by MartectX »

Version 1.1.2
  • Automatically setup the anonymous user
  • Integrated translation of time zones
  • Bugfix concerning display of time zone
Note: You can easily try the DST functionality if you choose America/Anchorage as they seem to be in DST already this year!
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: [BETA] Automatic Daylight Savings Time (DST) 1.1.2

Post by Muad''Dib »

So are we .. America/Los_Angeles.

Ill install here shortly and give you more feedback.
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: [BETA] Automatic Daylight Savings Time (DST) 1.1.2

Post by Muad''Dib »

Everything works as intended i would say. No problems on my test board.
User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Automatic Daylight Savings Time (DST) 1.1.2

Post by MartectX »

Muad''Dib wrote:Everything works as intended i would say. No problems on my test board.
Thank you for your assistance! :)
Locked

Return to “[3.0.x] MODs in Development”