]> git.mxchange.org Git - friendica.git/commitdiff
Avoid basepath problems
authorMichael <heluecht@pirati.ca>
Wed, 11 Oct 2017 18:21:10 +0000 (18:21 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 11 Oct 2017 18:21:10 +0000 (18:21 +0000)
src/App.php

index 67dfacf7a3fb891d0409da759b1768703cbe9c28..30d66dd2d50d5421a63e4165d1667c7aa208eb52 100644 (file)
@@ -132,8 +132,14 @@ class App {
 
                $hostname = '';
 
-               if (file_exists('.htpreconfig.php')) {
-                       include '.htpreconfig.php';
+               if (! static::directory_usable($basepath, false)) {
+                       throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');
+               }
+
+               $this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);
+
+               if (file_exists($this->basepath.DIRECTORY_SEPARATOR.'.htpreconfig.php')) {
+                       include $this->basepath.DIRECTORY_SEPARATOR.'.htpreconfig.php';
                }
 
                $this->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
@@ -201,12 +207,6 @@ class App {
                        $this->hostname = $hostname;
                }
 
-               if (! static::directory_usable($basepath, false)) {
-                       throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');
-               }
-
-               $this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);
-
                set_include_path(
                        get_include_path() . PATH_SEPARATOR
                        . $this->basepath . DIRECTORY_SEPARATOR . 'include' . PATH_SEPARATOR
@@ -416,8 +416,8 @@ class App {
                                $this->path = trim($parsed['path'], '\\/');
                        }
 
-                       if (file_exists('.htpreconfig.php')) {
-                               include '.htpreconfig.php';
+                       if (file_exists($this->basepath.DIRECTORY_SEPARATOR.'.htpreconfig.php')) {
+                               include $this->basepath.DIRECTORY_SEPARATOR.'.htpreconfig.php';
                        }
 
                        if (Config::get('config', 'hostname') != '') {