Firefox PHP

Module: Automatic Time Zones

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

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

regards,
-phil.

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 06:45PM by Joe Curia.
Re: Module: Automatic Time Zones
February 12, 2010 10: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 04:23PM
User info:

Anonymous user
User IP address = 24.128.76.5

Additional details:

Message:

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?
Thanks
rob



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:

HTTP_HOST = www.ppbb.com
HTTP_REFERER = [www.ppbb.com]
REQUEST_URI = /phorum/ajax.php
Re: Module: Automatic Time Zones
June 21, 2010 06: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 06:51PM
Joe, I am running 5.2.1.05. Did you patch the .php and keep the same version number?
Thanks
Rob

Automatic Time Zones (version 5.2.1.05)
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 06: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 11: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"];
To:
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 11:52AM by choon.
Re: Module: Automatic Time Zones
April 01, 2011 02:49PM
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