Firefox PHP

Module: Automatic Time Zones

Posted by Joe Curia 
Re: Module: Automatic Time Zones
April 02, 2009 05:23AM
Cool. Works perfect! Thank you.
Re: Module: Automatic Time Zones
December 02, 2009 08:25PM

In function phorum_mod_automatic_timezones_start_output() I inserted an isset() check on your 'offset_by_ip' index. No big deal but when I am debugging and I have php report notices and warnings, might as well eliminate these.

You'll see the spot in the code where I bracketed the inserted condition with
// Begin BosonHack
// End BosonHack


EDIT: Your bugfix has been included in the latest release and your patch attachment deleted. Thanks for the fix. ~ Joe Curia

Edited 3 time(s). Last edit at 06/21/2010 12:45PM by Joe Curia.
Re: Module: Automatic Time Zones
February 12, 2010 04:49PM
Here is another undefined variable notice report: $query_string and $separator in automatic_timezones.php will be undefined if $_SERVER["QUERY_STRING"] is empty. I see it show up occasionally in the Event Logger report.
PHP notice: Undefined index: user
June 21, 2010 10:23AM
User info:

Anonymous user
User IP address =

Additional details:


PHP notice: Undefined index: user

PHP notice generated at /home/ppbb/public_html/phorum/mods/automatic_timezones/automatic_timezones.php:122

Back trace:

Function phorum_mod_automatic_timezones_user_get called
Function call_user_func_array called at
{path to Phorum}/common.php:1687
Function phorum_hook called at
{path to Phorum}/include/api/user.php:1038
seeing a lot of these in the event logger, is there a fix or a way to not log them if they are harmless?

Function phorum_api_user_get called at
{path to Phorum}/include/api/user.php:2442
Function phorum_api_user_session_restore called at
{path to Phorum}/common.php:590
Function require_once called at
{path to Phorum}/ajax.php:27

Request info:

REQUEST_URI = /phorum/ajax.php
Re: Module: Automatic Time Zones
June 21, 2010 12:47PM
Rob and Phil,

Thanks for pointing out the various bugs which were causing those PHP notices. I have patched them and included the fixes in v5.2.1.05 of this module. Please redownload/install the module (the automatic_timezones.php file specifically) and the notices should go away.

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
June 21, 2010 12:51PM
Joe, I am running Did you patch the .php and keep the same version number?

Automatic Time Zones (version
This module automatically detects each visitor's time zone and adjusts the times shown in
your forum accordingly, whether they are logged in or unregistered.
Created by Joe Curia
More info: web site • README • Changelog
Re: Module: Automatic Time Zones
June 21, 2010 12:57PM
sorry, diffed the code, I see you are checking for an empty array now, sorry for the extra post.
love your mods, dude!
Re: Module: Automatic Time Zones
March 23, 2011 06:36AM
Hi Joe,

Just a note. When execute ./script.php (Forum Subscriptions module from you I believe) which suppose to be execute via command/crontab, I will get the following:
PHP Notice:  Undefined index: REMOTE_ADDR in /path/to/phorum/mods/automatic_timezones/automatic_timezones.php on line 79

Since $_SERVER["REMOTE_ADDR"] is only available via serving via web server to web browsers, it isn't set in command line. In fact the $_SERVER global variable won't be set if I remember correctly. Is it possible for you to include a fix? Something from:
Language: PHP
  1. //check if the time zone offset has been set by ip (only when cookies cannot be created)
  2. if (isset($PHORUM["phorum_mod_automatic_timezones"]["offset_by_ip"][$_SERVER["REMOTE_ADDR"]]) &&
  3. $PHORUM["phorum_mod_automatic_timezones"]["offset_by_ip"][$_SERVER["REMOTE_ADDR"]]["timestamp"] + 7200 > time())
  4. $offset_by_ip = $PHORUM["phorum_mod_automatic_timezones"]["offset_by_ip"][$_SERVER["REMOTE_ADDR"]]["offset"];
Language: PHP
  1. //check if the time zone offset has been set by ip (only when cookies cannot be created)
  2. if (isset($_SERVER["REMOTE_ADDR"])) {
  3. if (isset($PHORUM["phorum_mod_automatic_timezones"]["offset_by_ip"][$_SERVER["REMOTE_ADDR"]]) &&
  4. $PHORUM["phorum_mod_automatic_timezones"]["offset_by_ip"][$_SERVER["REMOTE_ADDR"]]["timestamp"] + 7200 > time())
  5. $offset_by_ip = $PHORUM["phorum_mod_automatic_timezones"]["offset_by_ip"][$_SERVER["REMOTE_ADDR"]]["offset"];
  6. }
I hope you get what I mean ;)

If this is intended, please forgive my ignorant.

Thanks for your great modules.

Kindest regards,
Giam Teck Choon

Edited 2 time(s). Last edit at 03/23/2011 06:52AM by choon.
Re: Module: Automatic Time Zones
April 01, 2011 08:49AM
I have published a full rewrite of this module (version 6.0.0).

This release improves the module by making use of new Phorum features and by keeping the local storage for caching offsets at a minimum level (put differently: when a cookie can be used, it will be used as the sole storage mechanism).

This release also fixes a few remaining bugs (also the bug reported by "choon" about the REMOTE_ADDR PHP warning when running script.php).

Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login