Firefox PHP

Module: Automatic Time Zones

Posted by Joe Curia 
All files from this thread

File Name File Size   Posted by Date  
automatic_timezones-6.0.2.tar.gz 5.7 KB open | download Joe Curia 07/07/2012 Read message
automatic_timezones-6.0.2.zip 8 KB open | download Joe Curia 07/07/2012 Read message
Module: Automatic Time Zones
October 20, 2008 07:27AM
This module tries to automatically detect the visitor's time zone (using JavaScript) and adjusts the times shown in your forum accordingly. This will work for both logged in and anonymous users.

By default, all time zone offests will be automatically determined by the time zone offset on the visitor's computer. For authenticated users and anonymous users that have cookies enabled in their browser, the time zone will be checked once per day. If an anonymous visitor does not have cookies enabled, that visitor's IP address will be stored with the offset information. In this case the time zone will be checked every two hours to avoid issues with dynamic and/or roaming IP's.

In the settings page, the admin can allow registered users to override the automatic timezone with one of there own choosing. To use this option, you must enable the option "Allow Time Zone Selection" in the User Settings section of the General Settings page in the admin section as well.

Initial coding of this module idea was done by Joe Curia (a.k.a. Azumandias). Maurice Makaay did a full rewrite in version 6.0.0, making use of new Phorum features to make the module more efficient and to fix some small remaining bugs.

Changelog:
----------

2012-07-07 v6.0.2 (Maurice Makaay)

    - Fixed a PHP error:
          "Unsupported operand types in .../include/format_functions.php on
		  line 248."

2011-04-02 v6.0.1 (Maurice Makaay)

    - Fixed a PHP warning:
      Missing argument 1 for phorum_mod_automatic_timezones_addon()

2011-04-01 v6.0.0 (Maurice Makaay)

    - A full rewrite of the module, taking Joe's ideas to the next level,
      making optimal use of new features in the Phorum core.

    - Extracted logic into a separate api.php, for code clarity. The module
      code has been simplified into using only three hooks.

    - Moved the javascript code into the global Phorum javascript (still
      only triggering this code when the timezone needs to be determined).

    - The module now uses the addon hook to handle posting the offset
      from the client to the module. The redirection code has been improved,
      to not have to fiddle with the active URL to include the offset in
      the request (which could cause issues with systems that use their own
      URL formatting schema for things like friendly URLs or embedding Phorum).

    - New offset caching mechanism, to minimize local impact:
      - When cookie storage is available for the client, then no local caching
        of offsets is done anymore.
      - When cookie storage is unavailable, then registered users will have
        their offset stored in the user's settings data. For unregistered
        users, the offset is cached based on the IP address of the user.
      - Keeping the IP-cache limited (to prevent db storage overflow) has
        been optimized to not delete all entries on overflow, but only
        to trim down the cache to 80% of the maximum allowed storage.

    - Fixed some buggy behavior that showed for users that configured their
      own timezone in the Control Center (when saving settings, the selected
      time zone was stored, but the settings panel would show the
      automatically determined time zone instead).

    - Fixed the bug that caused the PHP Notice "Undefined index: REMOTE_ADDR
      in .../automatic_timezones.php on line 79" when executing the
      script.php.

2009-04-02 v5.2.1.05 (Joe Curia)

    - Enhancement: Module rewritten to place the necessary javascript inside the
      header.  This allows for browsers without javascript to view the page
      without any negative consequences without the need for the excessive
      browscap support.  Thanks go to Phorum developer Maurice Makaay for
      pointing me in the right direction on this.

2009-03-28 v5.2.1.04 (Joe Curia)

    - Bugfix: Previous coding required the user's browser to support javascript.
      To work around this, the module now checks if the user's browser is
      capable of supporting javacript before running.  If the user has disabled
      javascript, a meta refresh will kick in after 2 seconds the first time
      they visit the forum.  After that their IP Address will be cached.
      Thanks go to Phorum user didi2 for reporting this bug.

    - Bugfix: Eliminated some PHP notices.

2009-02-04 v5.2.1.03 (Joe Curia)

    - Bugfix: Users in the GMT time zone (i.e. 0 offset) would experience an
      infinite loop.  Thanks go to Phorum user ExIslander for reporting this
      bug.

2008-12-15 v5.2.1.02 (Joe Curia)

    - Enhancement: Added support for the Recent Messages module and other
      modules which might call the phorum_api_user_save() function before
      displaying dates.

2008-10-22 v5.2.1.01 (Joe Curia)

    - Bugfix: Fixed a bug that caused the cc_panel hook in other modules to
      fail.  Thank you Maurice Makaay for this fix.

2008-10-20 v5.2.1.00 (Joe Curia)

    - Started.

Thanks go to these bug hunters:
didi2
Exislander
James E.
Maurice Makaay
Phil Connolly
Rob Granger


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald




Edited 6 time(s). Last edit at 07/07/2012 12:30PM by Maurice Makaay.
Attachments:
open | download - automatic_timezones-6.0.2.tar.gz (5.7 KB)
open | download - automatic_timezones-6.0.2.zip (8 KB)
Re: Module: Automatic Time Zones
October 22, 2008 12:26AM
Interesting, I installed and enabled the module and suddenly our User Avatars mod quit working: from the Control Center, clicking on the Avatar link displays the user's profile, not the avatar upload/selection page. Existing avatars were still present, but changing or uploading a new one did not work. Once I turned off the Automatic Time Zones the avatar page displayed fine.

Thought it was worth mentioning.

Wallet Friendly Watch Forum
www.wf-wf.com
Re: Module: Automatic Time Zones
October 22, 2008 12:40AM
I fixed the problem in the module and uploaded a new version in the first message of this thread. Please download v5_2_1_01 and see if it fixes your issue.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Automatic Time Zones
October 22, 2008 01:41AM
Argh! Thanks for catching that bug Maurice (if leaving out crucial data passes could be called a bug :)).


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Automatic Time Zones
October 22, 2008 08:20AM
That's not a bug.
We call it a "sin" ;-)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Module: Automatic Time Zones - Support for phorum_api_user_get()
December 15, 2008 04:49PM
I have completed v5.2.1.02 of this module with the following change:
- Enhancement: Added support for the Recent Messages module and other modules which might call the phorum_api_user_save() function before displaying dates.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Automatic Time Zones
February 03, 2009 11:54PM
One of my users found a potential bug in 5.2.1.01. He lives in London, and he (and a few friends he roped in to help test) were unable to access our phorum. Eventually, we were able to trace it to the common_pre hook and from there to this module. As you know, when it gets to the end of that hook, it attempts a location.href change; as far as I can tell, he was stuck in an endless loop of redirect, fail, redirect, fail.... None of our other users had issues with the time zone detection so I'm guessing it may have to do with London having a zero GMT offset!

I looked at 5.2.1.02 but that part of the code doesn't appear to have changed.

For the time being, we've just disabled that module. When I get a chance I'll change the time zone on my computer and see if I can figure out the problem.
Module: Automatic Time Zones v5.2.1.03 - Bugfix for GMT time zone
February 04, 2009 01:22AM
I have released v5.2.1.03 of this module with the following change:

- Bugfix: Users in the GMT time zone (i.e. 0 offset) would experience an infinite loop. Thanks go to Phorum user ExIslander for reporting this bug.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Automatic Time Zones
February 09, 2009 04:00PM
Thanks, Joe. I just got a chance to download and enable the fix, and the user can get in now. Much appreciated!
Re: Module: Automatic Time Zones
March 27, 2009 09:57PM
Hello.

I have the following problem with this mod.

When I activate it, my forum is not accessible for google indexing and text-based browsers like lynx.

When I open the forum in a text based browser, all what I get is:

-----
-----

these two lines, instead of the forum text.

So, when I activate the module, google cannot read my forum anymore because nothing is shown.

Strange, but it is this module which causes the problem.

regards
Sorry, only registered users may post in this forum.

Click here to login