Code

- Updated fro new Debian upload
[gosa.git] / include / class_timezones.inc
index 3c2534dd052adee4f15a6133b51bafb1feb16d4e..26369328468665761bd78b33753184c52f226d3c 100644 (file)
@@ -49,7 +49,9 @@ function get_default_timezone($stamp = NULL)
 
     /* Check if we could use the PHP5 default timezone functions */
     if(function_exists("date_default_timezone_set")){
-      date_default_timezone_set($tz);
+      if(!@date_default_timezone_set($tz)){
+        print_red(sprintf(_("The timezone setting '%s' in your gosa.conf is not valid. Can not calculate correct timezone offset."),$tz));
+      }
       $tz_delta = date("Z", $stamp);
       $tz_delta = $tz_delta / 3600 ;
       return(array("name" => $tz, "value" => $tz_delta));
@@ -65,6 +67,7 @@ function get_default_timezone($stamp = NULL)
       $dst_zones  = $tmp['DST_ZONES'];
 
       /* Detect zone and calculate offset */
+      $found = FALSE;
       foreach($zones as $name => $value){
         if(preg_match("#".normalizePreg($name)."#i",$tz)){
           $offset = $value / 3600 ;
@@ -72,8 +75,14 @@ function get_default_timezone($stamp = NULL)
             $offset ++;
           }
           $zone = array("name" => $name, "value" => $offset);
+          $found = TRUE;
+          break;
         }
       }
+      if(!$found){
+        print_red(sprintf(_("The timezone setting \"".$tz."\" in your gosa.conf is not valid. Can not calculate correct timezone offest."),
+$tz));
+      }
     }
   }
   return($zone);