? autotimezone.conversion.to.D6.patch
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/autotimezone/README.txt,v
retrieving revision 1.3.2.3
diff -u -p -r1.3.2.3 README.txt
--- README.txt	23 Aug 2007 22:15:17 -0000	1.3.2.3
+++ README.txt	11 Feb 2009 10:31:36 -0000
@@ -1,4 +1,4 @@
-﻿// $Id: README.txt,v 1.3.2.3 2007/08/23 22:15:17 lukelast Exp $
+﻿// $Id$
 
 INSTALL INSTRUCTIONS FOR AUTOTIMEZONE.MODULE
 ----
@@ -20,4 +20,4 @@ The setting "Site configuration->Date an
 
 This module has the optional feature of setting a $_SESSION['timezone'] variable for guest users. This feature can be taken advantage of in custom code or other modules when a guest user’s time zone is needed. The Value of $_SESSION['timezone'] is in minutes from GMT.
 
-Please send comments to luke {at} lukelast [.] com
\ No newline at end of file
+Please send comments to luke {at} lukelast [.] com
Index: autotimezone.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/autotimezone/autotimezone.info,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 autotimezone.info
--- autotimezone.info	18 Jun 2007 23:06:31 -0000	1.1.2.3
+++ autotimezone.info	11 Feb 2009 10:31:36 -0000
@@ -1,3 +1,5 @@
-; $Id: autotimezone.info,v 1.1.2.3 2007/06/18 23:06:31 dww Exp $
+; $Id$
 name = Auto Time Zone
 description = Automatically updates users timezone using javascript.
+core = 6.x
+version = 6.x-1.0
Index: autotimezone.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/autotimezone/autotimezone.install,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 autotimezone.install
--- autotimezone.install	31 May 2007 16:26:03 -0000	1.1.2.2
+++ autotimezone.install	11 Feb 2009 10:31:36 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: autotimezone.install,v 1.1.2.2 2007/05/31 16:26:03 lukelast Exp $
+// $Id$
 
 /**
  * Implementation of hook_uninstall().
Index: autotimezone.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/autotimezone/autotimezone.module,v
retrieving revision 1.11.2.4
diff -u -p -r1.11.2.4 autotimezone.module
--- autotimezone.module	23 Aug 2007 22:13:42 -0000	1.11.2.4
+++ autotimezone.module	11 Feb 2009 10:31:36 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: autotimezone.module,v 1.11.2.4 2007/08/23 22:13:42 lukelast Exp $
+// $Id$
 
 /**
  * @file
@@ -12,45 +12,51 @@
 /**
  * Implementation of hook_menu().
  */
-function autotimezone_menu($may_cache) {
+function autotimezone_menu() {
   $items = array();
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/autotimezone',
-      'title' => t('Autotimezone'),
-      'description' => t('Automatically updates users timezone using javascript.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => 'autotimezone_admin_settings',
-      'type' => MENU_NORMAL_ITEM,
-    );
-    $items[] = array('path' => 'autotimezone', 'title' => t('Auto Timezone Update'),
-      'callback' => 'autotimezone_page',
-      'access' => TRUE,
-      'type' => MENU_CALLBACK);
-  }
-  else {
-    if (!function_exists('throttle_status') || !throttle_status()) { //Don't do anything if the throttle is active.
-      global $user;
-      if ($user->uid != 0 or variable_get('autotimezone_update_guest', 0)) { //If the user is a guest, only continue if guest checking is on.
-        //We need to check if the user is a guest and then use the guest session variable.
-        if ($user->uid == 0) {
-          if (!$_SESSION['timezone']) {
-            $_SESSION['timezone'] = variable_get('date_default_timezone', 0);
-          }
-          $timezone = $_SESSION['timezone'] / -60;
-        }
-        else { //If user is not guest.
-          $timezone = $user->timezone / -60; //Convert offset to minutes.
+
+  $items['admin/settings/autotimezone'] = array(
+    'title' => 'Autotimezone',
+    'description' => 'Automatically updates users timezone using javascript.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('autotimezone_admin_settings'),
+    'access arguments' => array('administer site configuration'),
+    'type' => MENU_NORMAL_ITEM,
+  );
+  $items['autotimezone'] = array(
+    'title' => 'Auto Timezone Update',
+    'page callback' => 'autotimezone_page',
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK
+  );
+
+  return $items;
+}
+
+/**
+ * Implementation of hook_init().
+ */
+function autotimezone_init() {
+  if (!function_exists('throttle_status') || !throttle_status()) { //Don't do anything if the throttle is active.
+    global $user;
+    if ($user->uid != 0 or variable_get('autotimezone_update_guest', 0)) { //If the user is a guest, only continue if guest checking is on.
+      //We need to check if the user is a guest and then use the guest session variable.
+      if ($user->uid == 0) {
+        if (!$_SESSION['timezone']) {
+          $_SESSION['timezone'] = variable_get('date_default_timezone', 0);
         }
-        //This is the Javascript that will send the timezone back to the server if it needs to be updated.
-        $javascript = "\nvar now = new Date();";
-        $javascript .= "\nvar offset = now.getTimezoneOffset();";
-        $javascript .= "\n" . 'if (!(offset == ' . drupal_to_js($timezone) . ')) {$(document).ready(function(){$.get(' . drupal_to_js(url('autotimezone/', NULL, NULL, TRUE)) . ' + offset);})}';
-        drupal_add_js($javascript, 'inline');
+        $timezone = $_SESSION['timezone'] / -60;
       }
+      else { //If user is not guest.
+        $timezone = $user->timezone / -60; //Convert offset to minutes.
+      }
+      //This is the Javascript that will send the timezone back to the server if it needs to be updated.
+      $javascript = "\nvar now = new Date();";
+      $javascript .= "\nvar offset = now.getTimezoneOffset();";
+      $javascript .= "\n".'if (!(offset == '. drupal_to_js($timezone) .')) {$(document).ready(function(){$.get('. drupal_to_js(url('autotimezone/', array('absolute' => TRUE))) .' + offset);})}';
+      drupal_add_js($javascript, 'inline');
     }
   }
-  return $items;
 }
 
 /**
@@ -61,13 +67,18 @@ function autotimezone_menu($may_cache) {
  */
 function autotimezone_admin_settings() {
   variable_set('configurable_timezones', 1); //This variable must be true for the format_date function to use the individual users time zones.
-  $form['guest'] = array('#type' => 'fieldset', '#title' => t('Guest user options'), '#description' => t('If you do not know why you might need this feature keep it turned off.'));
+  $form['guest'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Guest user options'),
+    '#description' => t('If you do not know why you might need this feature keep it turned off.')
+  );
   $form['guest']['autotimezone_update_guest'] = array(
     '#type' => 'radios',
     '#title' => t('Update guest users session variables'),
     '#default_value' => variable_get('autotimezone_update_guest', 0),
     '#options' => array('1' => t('On'), '0' => t('Off')),
-    '#description' => t('This module can set a session variable named $_SESSION[\'timezone\'] for anonymous users, which is in the form of seconds from GMT. This feature is of no use unless extra code has been added to your site to take advantage of it.'));
+    '#description' => t('This module can set a session variable named $_SESSION[\'timezone\'] for anonymous users, which is in the form of seconds from GMT. This feature is of no use unless extra code has been added to your site to take advantage of it.')
+  );
   return system_settings_form($form);
 }
 
@@ -81,7 +92,7 @@ function autotimezone_page($offset) {
   $_SESSION['timezone'] = $offset; //Update session variable.
   //If needed update user object with new timezone value.
   if ($user->uid != 0 and $offset != $user->timezone) {
-    watchdog('user', t('Timezone updated from %old to %new.', array('%old' => $user->timezone / 3600, '%new' => $offset / 3600)));
+    watchdog('user', 'Timezone updated from %old to %new.', array('%old' => $user->timezone / 3600, '%new' => $offset / 3600));
     user_save($user, array('timezone' => $offset));
   }
 }
