From 97a8f77ea95a87d11f61defef52f0d4a962db98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.bernigaud@opensides.be> Date: Thu, 24 Mar 2016 12:14:38 +0100 Subject: [PATCH] Fixes #4653 Improved fatal errors --- include/class_config.inc | 9 +++++++-- include/class_session.inc | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/class_config.inc b/include/class_config.inc index 08d5f2496..25b01398e 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -293,11 +293,12 @@ class config { session::global_set('HTTP_FDKEY_CACHE', $cache); } catch (Exception $e) { $msg = sprintf( - _('It seems you are trying to decode something which is not encoded : %s<br/>\n'. + _('It seems you are trying to decode something which is not encoded : %s<br/>'."\n". 'Please check you are not using a fusiondirectory.secrets file while your passwords are not encrypted.'), $e->getMessage() ); - msg_dialog::display(_("Configuration error"), $msg, FATAL_ERROR_DIALOG); + msg_dialog::display(_('Configuration error'), $msg, FATAL_ERROR_DIALOG); + exit; } } return $cache[$creds]; @@ -368,6 +369,10 @@ class config { */ function set_current($name) { + if (!isset($this->data['LOCATIONS'][$name])) { + msg_dialog::display(_('Error'), sprintf(_('Location "%s" could not be found in the configuration file'), $name), FATAL_ERROR_DIALOG); + exit; + } $this->current = $this->data['LOCATIONS'][$name]; if (isset($this->current['INITIAL_BASE'])) { diff --git a/include/class_session.inc b/include/class_session.inc index ddc47593a..72bf90150 100644 --- a/include/class_session.inc +++ b/include/class_session.inc @@ -48,6 +48,7 @@ class session { /* Sanity check */ if (!session::channel_exists($channel)) { msg_dialog::display(_("Internal error"), _("Requested channel does not exist! Please contact your Administrator."), FATAL_ERROR_DIALOG); + exit; } $channel = "gch_".$channel; @@ -85,6 +86,7 @@ class session { /* Sanity check */ if (!session::channel_exists($channel)) { msg_dialog::display(_("Internal error"), _("Requested channel does not exist! Please contact your Administrator."), FATAL_ERROR_DIALOG); + exit; } $_SESSION[$channel][$name] = $value; } @@ -123,6 +125,7 @@ class session { /* Sanity check */ if (!session::channel_exists($channel)) { msg_dialog::display(_("Internal error"), _("Requested channel does not exist! Please contact your Administrator."), FATAL_ERROR_DIALOG); + exit; } $channel = "gch_".$channel; -- GitLab