index 516195d7b43468767e91ee34c0ffe0ab00072cc2..036872656097e5a8e376521e14ff64081267e1d1 100644 (file)
--- a/include/class_config.inc
+++ b/include/class_config.inc
/* Configuration data */
var $data= array( 'TABS' => array(), 'LOCATIONS' => array(), 'SERVERS' => array(),
- 'MAIN' => array( 'LANGUAGES' => array(), 'FAXFORMATS' => array() ),
+ 'MAIN' => array( 'FAXFORMATS' => array() ),
'MENU' => array(), 'SERVICE' => array());
var $basedir= "";
}
break;
- /* Handle language */
- case 'LANGUAGE':
- if ($this->tags[$this->level-2] == 'MAIN'){
- /* Add languages */
- $this->data['MAIN']['LANGUAGES'][$attrs['NAME']]=
- $attrs['TAG'];
- }
- break;
-
/* Handle faxformat */
case 'FAXFORMAT':
if ($this->tags[$this->level-2] == 'MAIN'){
if (!isset($this->current['GROUPS'])){
$this->current['GROUPS']= "ou=groups";
}
+
+ if (isset($this->current['INITIAL_BASE'])){
+ $_SESSION['CurrentMainBase']= $this->current['INITIAL_BASE'];
+ }
/* Remove possibly added ',' from end of group and people ou */
$this->current['GROUPS'] = preg_replace("/,*$/","",$this->current['GROUPS']);
function load_servers ()
{
/* Only perform actions if current is set */
- if ($this->current == NULL){
+ if ($this->current === NULL){
return;
}
"sieve_server" => $attrs['goImapSieveServer'][0],
"sieve_port" => $attrs['goImapSievePort'][0]);
}
- error_reporting(E_ALL);
+ error_reporting(E_ALL | E_STRICT);
/* Get kerberos server. FIXME: only one is supported currently */
$ldap->cd ($this->current['BASE']);
'PASSWORD' => $attrs['goFaxPassword'][0]);
}
+
/* Get asterisk servers */
$ldap->cd ($this->current['BASE']);
$ldap->search ("(objectClass=goFonServer)");
- $this->data['SERVERS']['FON']= array();
+ $this->data['SERVERS']['FON']= array();
if ($ldap->count()){
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");
+
+ /* Add 0 entry for development */
+ if(count($this->data['SERVERS']['FON']) == 0){
+ $this->data['SERVERS']['FON'][0]= array(
+ 'DN' => $attrs['dn'],
+ '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");
+ }
+
+ /* Add entry with 'dn' as index */
+ $this->data['SERVERS']['FON'][$attrs['dn']]= array(
+ 'DN' => $attrs['dn'],
+ '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 */
+
+ /* Get glpi server */
$ldap->cd ($this->current['BASE']);
$ldap->search ("(&(objectClass=goGlpiServer)(cn=*)(goGlpiAdmin=*)(goGlpiDatabase=*))",array("cn","goGlpiPassword","goGlpiAdmin","goGlpiDatabase"));
if ($ldap->count()){
'PASSWORD' => $attrs['goGlpiPassword'][0],
'DB' => $attrs['goGlpiDatabase'][0]);
}
+
+
/* Get logdb server */
$ldap->cd ($this->current['BASE']);
$ldap->search ("(objectClass=goLogDBServer)");
'PASSWORD' => $attrs['goLogPassword'][0]);
}
+
+ /* GOsa logging databases */
+ $ldap->cd ($this->current['BASE']);
+ $ldap->search ("(objectClass=gosaLogServer)");
+ if ($ldap->count()){
+ while($attrs= $ldap->fetch()){
+ $this->data['SERVERS']['LOGGING'][$attrs['cn'][0]]=
+ array(
+ 'DN' => $attrs['dn'],
+ 'USER' => $attrs['goLogDBUser'][0],
+ 'DB' => $attrs['goLogDB'][0],
+ 'PWD' => $attrs['goLogDBPassword'][0]);
+ }
+ }
+
+
/* Get NFS server lists */
$tmp= array("default");
$ldap->cd ($this->current['BASE']);
$depth ++;
/* Walk through array */
+ ksort($arr);
foreach($arr as $name => $entries){
/* If this department is the last in the current tree position
if(isset($entries['ENTRY'])){
$a = "";
for($i = 0 ; $i < $depth ; $i ++){
- $a.=" ";
+ $a.=".";
}
$ret[$entries['ENTRY']]=$a." ".$name;
}
return FALSE;
}
+
+ function __search(&$arr, $name, $return)
+ {
+ $return= strtoupper($return);
+ if (is_array($arr)){
+ foreach ($arr as &$a){
+ if (isset($a['CLASS']) && strcasecmp($name, $a['CLASS']) == 0){
+ return(isset($a[$return])?$a[$return]:"");
+ } else {
+ $res= $this->__search ($a, $name, $return);
+ if ($res != ""){
+ return $res;
+ }
+ }
+ }
+ }
+ return ("");
+ }
+
+
+ function search($class, $value, $categories= "")
+ {
+ if (is_array($categories)){
+ foreach ($categories as $category){
+ $res= $this->__search($this->data[strtoupper($category)], $class, $value);
+ if ($res != ""){
+ return $res;
+ }
+ }
+ } else {
+ if ($categories == "") {
+ return $this->__search($this->data, $class, $value);
+ } else {
+ return $this->__search($this->data[strtoupper($categories)], $class, $value);
+ }
+ }
+
+ return ("");
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: