فهرست منبع

Updated core extension, timezone

markseu 3 سال پیش
والد
کامیت
80ce9c75b7
2فایلهای تغییر یافته به همراه12 افزوده شده و 7 حذف شده
  1. 10 5
      system/extensions/core.php
  2. 2 2
      system/extensions/update-current.ini

+ 10 - 5
system/extensions/core.php

@@ -2,7 +2,7 @@
 // Core extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/core
 
 class YellowCore {
-    const VERSION = "0.8.81";
+    const VERSION = "0.8.82";
     const RELEASE = "0.8.20";
     public $page;           // current page
     public $content;        // content files
@@ -3249,10 +3249,15 @@ class YellowToolbox {
     
     // Detect server timezone
     public function detectServerTimezone() {
-        $timezone = @date_default_timezone_get();
-        if (PHP_OS=="Darwin" && $timezone=="UTC") {
-            if (preg_match("#zoneinfo/(.*)#", @readlink("/etc/localtime"), $matches)) $timezone = $matches[1];
+        $timezone = ini_get("date.timezone");
+        if (empty($timezone)) {
+            if (PHP_OS=="Darwin") {
+                if (preg_match("#zoneinfo/(.*)#", @readlink("/etc/localtime"), $matches)) $timezone = $matches[1];
+            } else {
+                if (preg_match("/^(\S+)\/(\S+)/", $this->readFile("/etc/timezone"), $matches)) $timezone = $matches[1];
+            }
         }
+        if (empty($timezone)) $timezone = "UTC";
         return $timezone;
     }
     
@@ -3264,7 +3269,7 @@ class YellowToolbox {
         if (preg_match("/^(\S+)\/(\S+)/", $this->getServer("SERVER_SOFTWARE"), $matches)) {
             $name = $matches[1];
             $version = $matches[2];
-        } elseif (preg_match("/^(\S+)/u", $this->getServer("SERVER_SOFTWARE"), $matches)) {
+        } elseif (preg_match("/^(\S+)/", $this->getServer("SERVER_SOFTWARE"), $matches)) {
             $name = $matches[1];
         }
         if (PHP_SAPI=="cli" || PHP_SAPI=="cli-server") {

+ 2 - 2
system/extensions/update-current.ini

@@ -21,11 +21,11 @@ Tag: feature
 system/extensions/command.php: command.php, create, update
 
 Extension: Core
-Version: 0.8.81
+Version: 0.8.82
 Description: Core functionality of the website.
 DocumentationUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/core
 DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/core.zip
-Published: 2022-05-14 12:50:14
+Published: 2022-05-16 17:15:20
 Developer: Datenstrom
 Tag: feature
 system/extensions/core.php: core.php, create, update