From: Roland Häder Date: Mon, 23 Jul 2018 01:10:07 +0000 (+0200) Subject: Fixed E_NOTICE and open_basedir() warnings (realpath() checks this). X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=refs%2Fheads%2Fsocial-master;p=quix0rs-gnu-social.git Fixed E_NOTICE and open_basedir() warnings (realpath() checks this). --- diff --git a/lib/common.php b/lib/common.php index 4a74fb5e7f..351138ff03 100644 --- a/lib/common.php +++ b/lib/common.php @@ -27,7 +27,7 @@ mb_internal_encoding('UTF-8'); require_once INSTALLDIR . '/lib/framework.php'; try { - GNUsocial::init(@$server, @$path, @$conffile); + GNUsocial::init(); } catch (NoConfigException $e) { // XXX: Throw a conniption if database not installed // XXX: Find a way to use htmlwriter for this instead of handcoded markup diff --git a/lib/gnusocial.php b/lib/gnusocial.php index 43c7c60ad2..07fdab3f05 100644 --- a/lib/gnusocial.php +++ b/lib/gnusocial.php @@ -370,6 +370,7 @@ class GNUsocial { global $_server, $_path, $config; + $config_files = []; // From most general to most specific: // server-wide, then vhost-wide, then for a path, // finally for a dir (usually only need one of the last two). @@ -377,11 +378,13 @@ class GNUsocial if (isset($conffile)) { $config_files = array($conffile); } else { - $config_files = array('/etc/gnusocial/config.php', - '/etc/gnusocial/config.d/'.$_server.'.php'); + if (realpath('/etc/gnusocial') !== false) { + $config_files[] = '/etc/gnusocial/config.php'; + $config_files[] = '/etc/gnusocial/config.d/' . $_server . '.php'; - if (strlen($_path) > 0) { - $config_files[] = '/etc/gnusocial/config.d/'.$_server.'_'.$_path.'.php'; + if (strlen($_path) > 0) { + $config_files[] = '/etc/gnusocial/config.d/'.$_server.'_'.$_path.'.php'; + } } $config_files[] = INSTALLDIR.'/config.php';