viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

More tweaks to facilitate yioop running as own server, a=chris

Chris Pollett [2018-04-13 02:Apr:th]
More tweaks to facilitate yioop running as own server, a=chris
Filename
src/configs/Config.php
src/library/WebSite.php
diff --git a/src/configs/Config.php b/src/configs/Config.php
index 529a8c80c..f98e92d2a 100755
--- a/src/configs/Config.php
+++ b/src/configs/Config.php
@@ -169,6 +169,12 @@ function initializeBaseUrlAndCurrentWorkingDirectory()
     $port = ( ($http == "http://" && ($server_port != 80) ||
         ($http == "https://" && $server_port != 443))) ?
         ":" . $server_port : "";
+    if (nsdefined('SERVER_CONTEXT')) {;
+            $context = SERVER_CONTEXT;
+            if (!empty($context['SERVER_NAME'])) {
+                $_SERVER['SERVER_NAME'] = $context['SERVER_NAME'];
+            }
+        }
     $server_name = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] :
         "localhost";
     $dir_name = $path_info["dirname"];
@@ -197,6 +203,11 @@ ini_set('pcre.backtrack_limit', 1000000);
 nsconddefine("BASE_DIR", str_replace("\\", "/", realpath(__DIR__ ."/../")));
 nsconddefine("PARENT_DIR",  substr(BASE_DIR, 0, -strlen("/src")));
 nsconddefine("TEST_DIR",  PARENT_DIR . '/tests');
+if (file_exists(BASE_DIR."/configs/LocalConfig.php")) {
+    /** Include any locally specified defines (could use as an alternative
+        way to set work directory) */
+    require_once(BASE_DIR."/configs/LocalConfig.php");
+}
 initializeBaseUrlAndCurrentWorkingDirectory();
 /** Yioop Namespace*/
 nsdefine('NS', "seekquarry\\yioop\\");
diff --git a/src/library/WebSite.php b/src/library/WebSite.php
index e4957e4cd..59e4c760e 100644
--- a/src/library/WebSite.php
+++ b/src/library/WebSite.php
@@ -698,7 +698,8 @@ class WebSite
             "GATEWAY_INTERFACE" => "CGI/1.1",  "MAX_CACHE_FILESIZE" => 2000000,
             "MAX_CACHE_FILES" => 250,  "MAX_IO_LEN" => 128 * 1024,
             "MAX_REQUEST_LEN" => 10000000, "PATH" => $path,
-            "SERVER_ADMIN" => "you@example.com", "SERVER_SIGNATURE" => "",
+            "SERVER_ADMIN" => "you@example.com", "SERVER_NAME" => "localhost",
+            "SERVER_SIGNATURE" => "",
             "SERVER_SOFTWARE" => "ATTO WEBSITE SERVER",
         ];
         $original_address = $address;
@@ -748,6 +749,7 @@ class WebSite
             if (!empty($context[$server_global])) {
                 $server_globals[$server_global] =
                     $context[$server_global];
+                unset($context[$server_global]);
             }
         }
         if (!empty($context['ssl'])) {
ViewGit