From: cajus Date: Wed, 20 Dec 2006 06:55:05 +0000 (+0000) Subject: Prepared for multiple asterisk servers X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=443144f5a218dc4db583eedc3bc1281a69f383ba;p=gosa.git Prepared for multiple asterisk servers git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5438 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_config.inc b/include/class_config.inc index b72146e22..516195d7b 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -366,18 +366,20 @@ class config { /* Get asterisk servers */ $ldap->cd ($this->current['BASE']); $ldap->search ("(objectClass=goFonServer)"); + $this->data['SERVERS']['FON']= array(); if ($ldap->count()){ - $attrs= $ldap->fetch(); - $this->data['SERVERS']['FON']= array( - 'SERVER' => $attrs['cn'][0], - 'LOGIN' => $attrs['goFonAdmin'][0], - 'PASSWORD' => $attrs['goFonPassword'][0], - 'DB' => "gophone", - 'SIP_TABLE' => "sip_users", - 'EXT_TABLE' => "extensions", - 'VOICE_TABLE' => "voicemail_users", - 'QUEUE_TABLE' => "queues", - 'QUEUE_MEMBER_TABLE' => "queue_members"); + while ($attrs= $ldap->fetch()){ + $this->data['SERVERS']['FON'][]= array( + 'SERVER' => $attrs['cn'][0], + 'LOGIN' => $attrs['goFonAdmin'][0], + 'PASSWORD' => $attrs['goFonPassword'][0], + 'DB' => "gophone", + 'SIP_TABLE' => "sip_users", + 'EXT_TABLE' => "extensions", + 'VOICE_TABLE' => "voicemail_users", + 'QUEUE_TABLE' => "queues", + 'QUEUE_MEMBER_TABLE' => "queue_members"); + } } /* Get asterisk servers */ diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc index 0b3ec303e..013407a38 100644 --- a/plugins/admin/ogroups/class_phonequeue.inc +++ b/plugins/admin/ogroups/class_phonequeue.inc @@ -233,12 +233,12 @@ class phonequeue extends plugin $SQL = array(); - if(!isset($_SESSION['config']->data['SERVERS']['FON'])){ + if(!isset($_SESSION['config']->data['SERVERS']['FON'][0])){ return(_("There is currently no asterisk server defined. Your settings can't be saved.")); } // Get Configuration for Mysql database Server - $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; + $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'][0]; $s_parameter =""; // Connect to DB server @@ -613,7 +613,7 @@ class phonequeue extends plugin $SQL = array(); // Get Configuration for Mysql database Server - $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; + $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'][0]; $s_parameter =""; // Connect to DB server diff --git a/plugins/admin/users/class_divListUsers.inc b/plugins/admin/users/class_divListUsers.inc index f3f2bbe1d..1ebc98664 100644 --- a/plugins/admin/users/class_divListUsers.inc +++ b/plugins/admin/users/class_divListUsers.inc @@ -203,8 +203,8 @@ class divListUsers extends MultiSelectWindow */ $r_db =false; $r_con =false; - if (isset($_SESSION['config']->data['SERVERS']['FON'])){ - $a_SETUP= $_SESSION['config']->data['SERVERS']['FON']; + if (isset($_SESSION['config']->data['SERVERS']['FON'][0])){ + $a_SETUP= $_SESSION['config']->data['SERVERS']['FON'][0]; $r_con = false; $r_db = false; if(is_callable("mysql_pconnect")){ diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 82ee473bd..adce09d14 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -282,13 +282,13 @@ class conference extends plugin function SQL_add_me($save){ - if(!isset($_SESSION['config']->data['SERVERS']['FON'])){ + if(!isset($_SESSION['config']->data['SERVERS']['FON'][0])){ $this->generate_error = _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."); return(false); } // Get Configuration for Mysql database Server - $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; + $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'][0]; // Connect to DB server $r_con = false; @@ -413,7 +413,7 @@ class conference extends plugin if($this->old_tele_number){ // Get Configuration for Mysql database Server - $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; + $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'][0]; // Connect to DB server $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); diff --git a/plugins/gofon/fonreports/class_fonreport.inc b/plugins/gofon/fonreports/class_fonreport.inc index defaa4e79..69abf97f4 100644 --- a/plugins/gofon/fonreports/class_fonreport.inc +++ b/plugins/gofon/fonreports/class_fonreport.inc @@ -156,7 +156,7 @@ class fonreport extends plugin *****************/ /* Connecting, selecting database */ - if (!isset($this->config->data['SERVERS']['FON'])){ + if (!isset($this->config->data['SERVERS']['FON'][0])){ print_red(_("Can't connect to phone database, no reports can be shown!")); return($smarty->fetch(get_template_path('contents.tpl', TRUE))); }elseif(!is_callable("mysql_connect")){ @@ -164,7 +164,7 @@ class fonreport extends plugin return($smarty->fetch(get_template_path('contents.tpl', TRUE))); }else{ - $cfg= $this->config->data['SERVERS']['FON']; + $cfg= $this->config->data['SERVERS']['FON'][0]; $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']); if ($link === FALSE){ print_red(_("Can't connect to phone database, no reports can be shown!")); @@ -182,7 +182,7 @@ class fonreport extends plugin *****************/ $query = $this->CreateQuerySyntax(); - $cfg = $this->config->data['SERVERS']['FON']; + $cfg = $this->config->data['SERVERS']['FON'][0]; $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']); @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index 1b091cf07..3d73cec22 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -91,7 +91,7 @@ class macro extends plugin $tmp = array(); $number = 0; - if(!isset($_SESSION['config']->data['SERVERS']['FON'])){ + if(!isset($_SESSION['config']->data['SERVERS']['FON'][0])){ print_red(_("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database.")); } @@ -209,7 +209,7 @@ class macro extends plugin // Generate MySQL Syntax function generate_mysql_entension_entries($save = false,$delete_only=false,$remove_old_macroname=false){ - if(!isset($_SESSION['config']->data['SERVERS']['FON'])){ + if(!isset($_SESSION['config']->data['SERVERS']['FON'][0])){ return(true); } @@ -222,7 +222,7 @@ class macro extends plugin } // Get Configuration for Mysql database Server - $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; + $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'][0]; // Connect to DB server $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index c1932f559..30206d300 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -84,7 +84,7 @@ class phoneAccount extends plugin array_key_exists('FON',$_SESSION['config']->data['SERVERS']) && is_callable("mysql_connect") ) { - $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; + $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'][0]; $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."), @@ -256,7 +256,7 @@ class phoneAccount extends plugin // Generate MySQL Syntax function generate_mysql_entension_entries($save = false){ - if(!isset($_SESSION['config']->data['SERVERS']['FON'])){ + if(!isset($_SESSION['config']->data['SERVERS']['FON'][0])){ if($save) print_red(_("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database.")); return(true); @@ -269,7 +269,7 @@ class phoneAccount extends plugin } // Get Configuration for Mysql database Server - $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; // DB Configuration + $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'][0]; // DB Configuration $s_parameter = ""; // Contains paramter for selected Macro $r_con = false; // DB connection $r_db = false; // Selected DB @@ -654,7 +654,7 @@ class phoneAccount extends plugin $smarty->assign("macro", $this->macro); /* check if there is a FON server created */ - if(!isset($_SESSION['config']->data['SERVERS']['FON'])){ + if(!isset($_SESSION['config']->data['SERVERS']['FON'][0])){ print_red(_("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database.")); } @@ -1056,7 +1056,7 @@ class phoneAccount extends plugin array_key_exists('FON', $_SESSION['config']->data['SERVERS']) && is_callable("mysql_pconnect")) { // Get Configuration for Mysql database Server - $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; + $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'][0]; $s_parameter =""; // Connect to DB server