Adds a config option to invert the time for Solaris machines in the US.
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 10 Oct 2000 13:11:12 +0000 (13:11 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 10 Oct 2000 13:11:12 +0000 (13:11 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@783 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/conf.pl
config/config_default.php
functions/date.php
functions/smtp.php

index 0b5aac51b3a4d556f9b550617d5548a0297427e4..cd4fc0a38dc50f34bc4b03b377d7a2682956e595 100755 (executable)
@@ -279,6 +279,7 @@ while (($command ne "q") && ($command ne "Q")) {
          print "7.    SMTP Port          : $WHT$smtpPort$NRM\n";
       }
       print "8.  Server               : $WHT$imap_server_type$NRM\n";
          print "7.    SMTP Port          : $WHT$smtpPort$NRM\n";
       }
       print "8.  Server               : $WHT$imap_server_type$NRM\n";
+      print "9.  Invert Time          : $WHT$invert_time$NRM\n";
       print "\n";
       print "R   Return to Main Menu\n";
    } elsif ($menu == 3) {
       print "\n";
       print "R   Return to Main Menu\n";
    } elsif ($menu == 3) {
@@ -431,6 +432,7 @@ while (($command ne "q") && ($command ne "Q")) {
          elsif ($command == 6) { $smtpServerAddress  = command16 (); }
          elsif ($command == 7) { $smtpPort           = command17 (); }
          elsif ($command == 8) { $imap_server_type   = command18 (); }
          elsif ($command == 6) { $smtpServerAddress  = command16 (); }
          elsif ($command == 7) { $smtpPort           = command17 (); }
          elsif ($command == 8) { $imap_server_type   = command18 (); }
+         elsif ($command == 9) { $invert_time        = command19 (); }
       } elsif ($menu == 3) {
          if    ($command == 1) { $default_folder_prefix          = command21 (); }
          elsif ($command == 2) { $show_prefix_option             = command22 (); }
       } elsif ($menu == 3) {
          if    ($command == 1) { $default_folder_prefix          = command21 (); }
          elsif ($command == 2) { $show_prefix_option             = command22 (); }
@@ -626,7 +628,7 @@ sub command17 {
 }
 # imap_server_type 
 sub command18 {
 }
 # imap_server_type 
 sub command18 {
-   print "Eash IMAP server has its own quirks.  As much as we tried to stick\n";
+   print "Each IMAP server has its own quirks.  As much as we tried to stick\n";
    print "to standards, it doesn't help much if the IMAP server doesn't follow\n";
    print "the same principles.  We have made some work-arounds for some of\n";
    print "these servers.  If you would like to use them, please select your\n";
    print "to standards, it doesn't help much if the IMAP server doesn't follow\n";
    print "the same principles.  We have made some work-arounds for some of\n";
    print "these servers.  If you would like to use them, please select your\n";
@@ -646,6 +648,29 @@ sub command18 {
    return $new_imap_server_type;
 }
 
    return $new_imap_server_type;
 }
 
+# invert_time
+sub command19 {
+   print "Sometimes the date of messages sent is messed up (off by a few hours\n";
+   print "on some machines).  Typically this happens if the system doesn't support\n";
+   print "tm_gmtoff.  It will happen only if your time zone is \"negative\".\n";
+   print "This most often occurs on Solaris 7 machines in the United States.\n";
+   print "By default, this is off.  It should be kept off unless problems surface\n";
+   print "about the time that messages are sent.\n";
+   print "    no  = Do NOT fix time -- almost always correct\n";
+   print "    yes = Fix the time for this system\n";
+   
+   $YesNo = 'n';
+   $YesNo = 'y' if ($invert_time eq "true");
+
+   print "Fix the time for this system (y/n) [$WHT$YesNo$NRM]: $WHT";
+
+   $new_invert_time = <STDIN>;
+   $new_invert_time =~ tr/yn//cd;
+   return "true" if ($new_invert_time eq "y");
+   return "false" if ($new_invert_time eq "n");
+   return $invert_time;
+}   
+
 # MOTD
 sub command71 {
    print "\nYou can now create the welcome message that is displayed\n";
 # MOTD
 sub command71 {
    print "\nYou can now create the welcome message that is displayed\n";
@@ -1451,8 +1476,9 @@ sub save_data {
    print FILE "\t\$useSendmail          =  $useSendmail;\n";
    print FILE "\t\$smtpServerAddress    = \"$smtpServerAddress\";\n";
    print FILE "\t\$smtpPort             =  $smtpPort;\n";
    print FILE "\t\$useSendmail          =  $useSendmail;\n";
    print FILE "\t\$smtpServerAddress    = \"$smtpServerAddress\";\n";
    print FILE "\t\$smtpPort             =  $smtpPort;\n";
-   print FILE "\t\$sendmail_path         = \"$sendmail_path\";\n";
+   print FILE "\t\$sendmail_path        = \"$sendmail_path\";\n";
    print FILE "\t\$imap_server_type     = \"$imap_server_type\";\n";
    print FILE "\t\$imap_server_type     = \"$imap_server_type\";\n";
+   print FILE "\t\$invert_time          = $invert_time;\n";
    
    print FILE "\n";
 
    
    print FILE "\n";
 
index 0d29759d1ec1e79e6a31c411c94c10ffd82fc4a8..b8bbcb92fa58058f05468465e9d8d21de1641d0a 100644 (file)
 
     $attachment_dir = $data_dir;
 
 
     $attachment_dir = $data_dir;
 
-//  This is the default size of the left folder list.  Default is 200,
+//  This is the default size of the folder list.  Default is 200,
 //  but you can set it to whatever you wish.
 
    $default_left_size = 200;
 //  but you can set it to whatever you wish.
 
    $default_left_size = 200;
 
  $default_unseen_notify = 2;
  $default_unseen_type   = 1;
 
  $default_unseen_notify = 2;
  $default_unseen_type   = 1;
+ // If you are running on a machine that doesn't have the tm_gmtoff
+ // value in your time structure and if you are in a time zone that
+ // has a negative offset, you need to set this value to 1.
+ // This is typically people in the US that are running Solaris 7.
+ $invert_time = false;
 ?>
 ?>
index 6dfc4ba1b7c4af1a1f524f842d5ec8e0abf948e4..9f9f48d1b813bbc106c2ebe88f96c241368f895e 100644 (file)
@@ -58,6 +58,8 @@
 
       /** now find what the server is at **/
       $current = date("Z", time());
 
       /** now find what the server is at **/
       $current = date("Z", time());
+      if ($invert_time)
+          $current = - $current;
       $stamp = (int)$stamp - (int)$gmt + (int)$current;
 
       return $stamp;
       $stamp = (int)$stamp - (int)$gmt + (int)$current;
 
       return $stamp;
 
    function getDateString($stamp) {
       $now = time();
 
    function getDateString($stamp) {
       $now = time();
-      $midnight = $now - ($now % 86400) - 86400 - date("Z", $now);
+      $dateZ = date("Z", $now);
+      if ($invert_time)
+          $dateZ = - $dateZ;
+      $midnight = $now - ($now % 86400) - 86400 - $dateZ;
 
       if ($midnight < $stamp) {
          // Today
 
       if ($midnight < $stamp) {
          // Today
index c6e1825c53a7317e5d0abe0a510e8bc336ff0e8b..6edb4488ca5edb266a2d947c374a5d0bcf9e2e7b 100644 (file)
@@ -93,6 +93,8 @@
    /* Time offset for correct timezone */
    function timezone () {
       $diff_second = date("Z");
    /* Time offset for correct timezone */
    function timezone () {
       $diff_second = date("Z");
+      if ($invert_time)
+          $diff_second = - $diff_second;
       if ($diff_second > 0)
          $sign = "+";
       else
       if ($diff_second > 0)
          $sign = "+";
       else