]> git.mxchange.org Git - friendica.git/blobdiff - src/App.php
Code standards in App
[friendica.git] / src / App.php
index be4c7785ee200a555c9d4c5caddbdbeb8e3fb191..2429fde407f2b969078e1ed64d4c323ee940e634 100644 (file)
@@ -385,8 +385,8 @@ class App
                        throw new Exception('Error parsing config file ' . $filepath);
                }
 
-               foreach($config as $category => $values) {
-                       foreach($values as $key => $value) {
+               foreach ($config as $category => $values) {
+                       foreach ($values as $key => $value) {
                                $this->setConfigValue($category, $key, $value);
                        }
                }
@@ -403,9 +403,9 @@ class App
                // Loads addons default config
                Core\Addon::callHooks('load_config');
 
-               // Load the local config file again in case there are overwritten addon config
-               if (file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
-                       $this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php');
+               // Load the local addon config file to overwritten default addon config values
+               if (file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php')) {
+                       $this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php');
                }
        }
 
@@ -442,8 +442,14 @@ class App
                 *
                 * To get /path/to/friendica we perform dirname() for as many levels as there are slashes in the QUERY_STRING
                 */
-               if (!empty($_SERVER['SCRIPT_URL']) && !empty($_SERVER['QUERY_STRING'])) {
-                       $path = trim(dirname($_SERVER['SCRIPT_URL'], substr_count(trim($_SERVER['QUERY_STRING'], '/'), '/') + 1), '/');
+               if (!empty($_SERVER['SCRIPT_URL'])) {
+                       // Module
+                       if (!empty($_SERVER['QUERY_STRING'])) {
+                               $path = trim(dirname($_SERVER['SCRIPT_URL'], substr_count(trim($_SERVER['QUERY_STRING'], '/'), '/') + 1), '/');
+                       } else {
+                               // Root page
+                               $path = trim($_SERVER['SCRIPT_URL'], '/');
+                       }
 
                        if ($path && $path != $this->urlpath) {
                                $this->urlpath = $path;
@@ -505,7 +511,7 @@ class App
                // Use environment variables for mysql if they are set beforehand
                if (!empty(getenv('MYSQL_HOST'))
                        && (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER')))
-                       && !getenv('MYSQL_PASSWORD') === false
+                       && getenv('MYSQL_PASSWORD') !== false
                        && !empty(getenv('MYSQL_DATABASE')))
                {
                        $db_host = getenv('MYSQL_HOST');