[BETA] Summertime changer

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! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
webmasterx
Registered User
Posts: 47
Joined: Fri Apr 05, 2002 6:00 am

[BETA] Summertime changer

Post by webmasterx »

[UPDATED: 30-03-2003 17:10, month math changed]

This is a little fix for boards in for example in the Netherlands. It wil change the time if summertime begins and it will change automaticly when wintertime begins.

Here the mod:
Daytime mod wrote: ##############################################################
## MOD Title: Daytime changer summertime / wintertime
## MOD Version: 1.0.0
## MOD Author: WebmasterX,
## info@zutfun.nl,
## Sander Hoekman,
## http://www.zutfun.nl
## MOD Description: This modification automaticly changes the
## winter time and summertime as known in Europe, The Netherlands
##
## Installation Level: easy
## Installation Time: 1 Minutes
## Files To Edit: includes/functions.php
## Included Files: n/a
##############################################################

#
#-----[ OPEN ]------------------------------------------
#

includes/functions.php

#
#-----[ FIND ]------------------------------------------
#

//
// Create date/time from format and timezone
//
function create_date($format, $gmepoch, $tz)

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//
// daytime changer summertime / wintertime
//

function daytime()
{

$n = date("n");
$y = date("Y")-2000;

if($n >= 3 && $n <= 9)
{
$season = 1;
$season_math = 5;
}
else if ( $n >= 10 || $n < 3 )
{
$season = 0;
$season_math = 2;
}

$day = 31 - ((((floor(5*$y/4)-floor($y/100)+floor($y/400))+$season_math)%7)+7)%7;

switch ($season)
{
case 0:

if( mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y")) > mktime (3,0,0,10,$day,date("Y")) )
{
$result = 0;
}
break;

case 1:

if( mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y")) > mktime(3,0,0,3,$day,date("Y")) )
{
$result = 3600;
}

break;


}

return $result;
}

#
#-----[ FIND ]------------------------------------------
#
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));

#
#-----[ REPLACE WITH ]------------------------------------------
#

return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz) + daytime()), $translate) : @gmdate($format, $gmepoch + (3600 * $tz) + daytime());

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


This mod has not been approved by the phpbb moding team because i just wrote it.

WebmasterX
Last edited by webmasterx on Sun Mar 30, 2003 3:16 pm, edited 1 time in total.
Wanna see something hot???

http://www.zutfun.nl

netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic »

These things pop up every time the clocks change. The only problem i can see with this is that it doesn't take into account where any of your users are. What if you have users in a timezone which doesn't change?

I've used this mod in the past - DST MOD (daylight savings time)
Last edited by netclectic on Sun Mar 30, 2003 8:47 am, edited 1 time in total.
Defend the game:
Image

webmasterx
Registered User
Posts: 47
Joined: Fri Apr 05, 2002 6:00 am

Post by webmasterx »

netclectic wrote: These things pop up every time the clocks change. The only problem i can see with this is that it doesn't take into account where any of your users are. What if you have users in a timezone which doesn't change?


Uhm than don't change it? I will work this further so it wil be compatible with all timezones.

WebmasterX
Wanna see something hot???

http://www.zutfun.nl

User avatar
smithy_dll
Former Team Member
Posts: 7630
Joined: Tue Jan 08, 2002 6:27 am
Location: Australia
Name: Lachlan Smith
Contact:

Post by smithy_dll »

hello, I would like to point the following out

Code: Select all

# 
#-----[ OPEN includes/functions.php ]------------------------------------------ 
# 
that isn't valid, the valid action is

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
please change, and read the document my signature links to (Official MOD Template)

webmasterx
Registered User
Posts: 47
Joined: Fri Apr 05, 2002 6:00 am

Post by webmasterx »

It's allready changed in the updated version above.

WebmasterX
Wanna see something hot???

http://www.zutfun.nl

dcom
Registered User
Posts: 1
Joined: Sun Mar 30, 2003 3:46 pm
Location: Prague, Czech Republic
Contact:

Post by dcom »

great, it works, thx :)

Mr-Stabby
Registered User
Posts: 47
Joined: Sat Jan 25, 2003 9:07 pm
Location: Jersey

Post by Mr-Stabby »

Right i have noticed a problem, but its easily fixed

If you have fiddled about with the time actually turning off DST in windows and then setting the time manually, and then turning DST back on again, you may find posts on your forum that were posted an hour in the future, this therefore means that when someone trys to post again, it will think hang on they posted their last msg an hour from now, and as the settings say you can't post until 15 seconds after your last post, it will think ur flooding and not let u post, so u have to delete these msgs

You may also notice that you don't get the "new post" icon next to ur msgs as it thinks u last logged on an hour from now

But as long as no one posts until an hour after all this happened it should be ok, if you have many users, just lock the forum for an hour so u don't get all those annoying support calls like i have

Apart from that, that link i specified seems to be working, thx for that


make sure u make a backup of ur old functions file though just incase
umm...yeah

Pagemakers Design
Registered User
Posts: 285
Joined: Fri Jan 10, 2003 12:10 am
Location: Manchester UK

Post by Pagemakers Design »

webmasterx - Thanks. Just what I needed.

Paul UK

jaime
Registered User
Posts: 10
Joined: Sun Oct 13, 2002 1:48 am
Location: Spain
Contact:

Post by jaime »

netclectic wrote: What if you have users in a timezone which doesn't change?


DST is a big pain... I did not find any easy solution to this problem, other than asking my users to change the GMT setting as needed. :( Here you can see the dst transitions programmed for the first half of 2003.
Note that some of these dates will probably change, as some countries tend to change mind about DST every year.


8O 8O 8O 8O
Has ido al cine?
Visita http://www.cinepatas.com
LOCOS POR EL CINE

Do you like my forum? please RATE it

Pagemakers Design
Registered User
Posts: 285
Joined: Fri Jan 10, 2003 12:10 am
Location: Manchester UK

Post by Pagemakers Design »

Surely a better way would when you set the board's time to GMT+1 all existing postings and future posts should show GMT+1. Simple.

Asking your users to change their profiles should not be the way to do it. Some of my users can just about post a message!

netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic »

Pagemakers Design wrote: Surely a better way would when you set the board's time to GMT+1 all existing postings and future posts should show GMT+1. Simple.

Asking your users to change their profiles should not be the way to do it. Some of my users can just about post a message!


This doesn't work as the timezone set in a user's profile overrides the timezone set for the board.
Defend the game:
Image

Pagemakers Design
Registered User
Posts: 285
Joined: Fri Jan 10, 2003 12:10 am
Location: Manchester UK

Post by Pagemakers Design »

On my board I have removed the Time feature from the registration form (it's too complicated). So all times are now UK Local.

Works for me.

jaime
Registered User
Posts: 10
Joined: Sun Oct 13, 2002 1:48 am
Location: Spain
Contact:

Post by jaime »

On my board I have removed the Time feature from the registration form (it's too complicated). So all times are now UK Local.


I was about to do the same, but then I realized I had several users from S. America, who would be quite dissapointed with this.

The other solution I found is to change the user's timezone directly on the db with a query (ie everyone with GMT+1 to GMT+2) but I havent decided yet.
Has ido al cine?
Visita http://www.cinepatas.com
LOCOS POR EL CINE

Do you like my forum? please RATE it

Pagemakers Design
Registered User
Posts: 285
Joined: Fri Jan 10, 2003 12:10 am
Location: Manchester UK

Post by Pagemakers Design »

Luckily all my users are UK based. The board in on a company only website.

Kwikms
Registered User
Posts: 85
Joined: Wed Nov 20, 2002 2:33 am
Location: Hofheim / Germany
Contact:

Post by Kwikms »

What we need is a "Summertime" switch in every Userprofile. If activated the time will be correted.

AND the posts which where written in wintertime will still be displayed in wintertime. Now when you change GMT+1 to GMT+2 (Summertime) the old postings are also shown with GMT+2 even they where writtten one hour earlier (for those who have summer/wintertime).

Post Reply

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