From 2d3dea6dc6fe66cd56b0822dd3b9ed7c8eb35510 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 23 Jul 2018 03:10:07 +0200 Subject: [PATCH] Fixed E_NOTICE and open_basedir() warnings (realpath() checks this). --- lib/common.php | 2 +- lib/gnusocial.php | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) 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'; -- 2.39.5