Browse Source

Squelching errors feels wrong, although in this case it's probably harmless.
Reworked timezone file code to be E_ALL clean without the use of @

tassium 22 years ago
parent
commit
984adca7a4
1 changed files with 7 additions and 5 deletions
  1. 7 5
      include/options/personal.php

+ 7 - 5
include/options/personal.php

@@ -121,11 +121,13 @@ function load_optpage_data_personal() {
     if ( $tzChangeAllowed ) {
     if ( $tzChangeAllowed ) {
         $TZ_ARRAY[SMPREF_NONE] = _("Same as server");
         $TZ_ARRAY[SMPREF_NONE] = _("Same as server");
         $tzfile = SM_PATH . 'locale/timezones.cfg';
         $tzfile = SM_PATH . 'locale/timezones.cfg';
-        if(!$fd = @fopen($tzfile ,'r')) {
-            $message = _("Error opening timezone config, contact administrator.");
-            plain_error_message($message, $color);
-            exit;
-        }
+		if ((!is_readable($tzfile)) or (!$fd = fopen($tzfile,'r'))) {
+        	$message = _("Error opening timezone config, contact administrator.");
+		}
+		if (isset($message)) {
+	            plain_error_message($message, $color);
+	            exit;
+    	}
         while (!feof ($fd)) {
         while (!feof ($fd)) {
             $zone = fgets($fd, 1024);
             $zone = fgets($fd, 1024);
             if( $zone ) {
             if( $zone ) {