From c8d7a1f1429a2a8dd114e28d0cb44f40f47bc7f3 Mon Sep 17 00:00:00 2001 From: janw Date: Thu, 1 Sep 2005 14:12:36 +0000 Subject: [PATCH] Added check for array key git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1291 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofon/phoneaccount/class_phoneAccount.inc | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 814d89026..3186283b9 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -66,25 +66,30 @@ class phoneAccount extends plugin } } - $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; - $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); - if(!$r_con){ - $this->generate_error = sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), + $a_SETUP= array(); + if(array_key_exists('config',$_SESSION) && + array_key_exists('SERVERS',$_SESSION['config']->data) && + array_key_exists('FON',$_SESSION['config']->data['SERVERS'])) { + $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; + $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); + if(!$r_con){ + $this->generate_error = sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), $a_SETUP['SERVER'],$a_SETUP['LOGIN']); - gosa_log(mysql_error()); - return false; - } - $db = @mysql_select_db($a_SETUP['DB'],$r_con); - if(!$db){ - $this->generate_error = sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']); - gosa_log(mysql_error()); - return false; - } + gosa_log(mysql_error()); + return false; + } + $db = @mysql_select_db($a_SETUP['DB'],$r_con); + if(!$db){ + $this->generate_error = sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']); + gosa_log(mysql_error()); + return false; + } - $first = false; - foreach($this->phoneNumbers as $key => $val){ - if(!$first){ - $first = $key; + $first = false; + foreach($this->phoneNumbers as $key => $val){ + if(!$first){ + $first = $key; + } } } -- 2.30.2