1 <?php
2 /*
3 * This code is part of GOsa (https://gosa.gonicus.de)
4 * Copyright (C) 2003-2006 - Cajus Pollmeier <pollmeier@gonicus.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
21 class config {
23 /* XML parser */
24 var $parser;
25 var $config_found= FALSE;
26 var $tags= array();
27 var $level= 0;
28 var $gpc= 0;
29 var $section= "";
30 var $currentLocation= "";
32 /* Selected connection */
33 var $current= array();
35 /* Link to LDAP-server */
36 var $ldap= NULL;
37 var $referrals= array();
39 /* Configuration data */
40 var $data= array( 'TABS' => array(), 'LOCATIONS' => array(), 'SERVERS' => array(),
41 'MAIN' => array( 'LANGUAGES' => array(), 'FAXFORMATS' => array() ),
42 'MENU' => array(), 'SERVICE' => array());
43 var $basedir= "";
45 /* Keep a copy of the current deparment list */
46 var $departments= array();
47 var $idepartments= array();
48 var $adepartments= array();
49 var $tdepartments= array();
51 function config($filename, $basedir= "")
52 {
53 $this->parser = xml_parser_create();
54 $this->basedir= $basedir;
56 xml_set_object($this->parser, $this);
57 xml_set_element_handler($this->parser, "tag_open", "tag_close");
59 /* Parse config file directly? */
60 if ($filename != ""){
61 $this->parse($filename);
62 }
63 }
65 function parse($filename)
66 {
67 $fh= fopen($filename, "r");
68 $xmldata= fread($fh, 100000);
69 fclose($fh);
70 if(!xml_parse($this->parser, chop($xmldata))){
71 print_red(sprintf(_("XML error in gosa.conf: %s at line %d"),
72 xml_error_string(xml_get_error_code($this->parser)),
73 xml_get_current_line_number($this->parser)));
74 echo $_SESSION['errors'];
75 exit;
76 }
77 }
79 function tag_open($parser, $tag, $attrs)
80 {
81 /* Save last and current tag for reference */
82 $this->tags[$this->level]= $tag;
83 $this->level++;
85 /* Trigger on CONF section */
86 if ($tag == 'CONF'){
87 $this->config_found= TRUE;
88 }
90 /* Return if we're not in config section */
91 if (!$this->config_found){
92 return;
93 }
95 /* yes/no to true/false and upper case TRUE to true and so on*/
96 foreach($attrs as $name => $value){
97 if(preg_match("/^(true|yes)$/i",$value)){
98 $attrs[$name] = "true";
99 }elseif(preg_match("/^(false|no)$/i",$value)){
100 $attrs[$name] = "false";
101 }
102 }
104 /* Look through attributes */
105 switch ($this->tags[$this->level-1]){
107 /* Handle tab section */
108 case 'TAB': $name= $this->tags[$this->level-2];
110 /* Create new array? */
111 if (!isset($this->data['TABS'][$name])){
112 $this->data['TABS'][$name]= array();
113 }
115 /* Add elements */
116 $this->data['TABS'][$name][]= $attrs;
117 break;
119 /* Handle location */
120 case 'LOCATION':
121 if ($this->tags[$this->level-2] == 'MAIN'){
122 $name= $attrs['NAME'];
123 $this->currentLocation= $name;
125 /* Add location elements */
126 $this->data['LOCATIONS'][$name]= $attrs;
127 }
128 break;
130 /* Handle referral tags */
131 case 'REFERRAL':
132 if ($this->tags[$this->level-2] == 'LOCATION'){
133 $url= $attrs['URL'];
134 $server= preg_replace('!^([^:]+://[^/]+)/.*$!', '\\1', $url);
136 /* Add location elements */
137 if (!isset($this->data['LOCATIONS'][$this->currentLocation]['REFERRAL'])){
138 $this->data['LOCATIONS'][$this->currentLocation]['REFERRAL']= array();
139 }
141 $this->data['LOCATIONS'][$this->currentLocation]['REFERRAL'][$server]= $attrs;
142 }
143 break;
145 /* Handle language */
146 case 'LANGUAGE':
147 if ($this->tags[$this->level-2] == 'MAIN'){
148 /* Add languages */
149 $this->data['MAIN']['LANGUAGES'][$attrs['NAME']]=
150 $attrs['TAG'];
151 }
152 break;
154 /* Handle faxformat */
155 case 'FAXFORMAT':
156 if ($this->tags[$this->level-2] == 'MAIN'){
157 /* Add fax formats */
158 $this->data['MAIN']['FAXFORMATS'][]= $attrs['TYPE'];
159 }
160 break;
162 /* Load main parameters */
163 case 'MAIN':
164 $this->data['MAIN']= array_merge ($this->data['MAIN'], $attrs);
165 break;
167 /* Load menu */
168 case 'SECTION':
169 if ($this->tags[$this->level-2] == 'MENU'){
170 $this->section= $attrs['NAME'];
171 $this->data['MENU'][$this->section]= array(); ;
172 }
173 break;
175 /* Inser plugins */
176 case 'PLUGIN':
177 if ($this->tags[$this->level-3] == 'MENU' &&
178 $this->tags[$this->level-2] == 'SECTION'){
180 $this->data['MENU'][$this->section][$this->gpc++]= $attrs;
181 }
182 if ($this->tags[$this->level-2] == 'SERVICEMENU'){
183 $this->data['SERVICE'][$attrs['CLASS']]= $attrs;
184 }
185 break;
186 }
187 }
189 function tag_close($parser, $tag)
190 {
191 /* Close config section */
192 if ($tag == 'CONF'){
193 $this->config_found= FALSE;
194 }
195 $this->level--;
196 }
198 function get_ldap_link($sizelimit= FALSE)
199 {
200 /* Build new connection */
201 $this->ldap= ldap_init ($this->current['SERVER'], $this->current['BASE'],
202 $this->current['ADMIN'], $this->current['PASSWORD']);
204 /* Check for connection */
205 if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){
206 $smarty= get_smarty();
207 print_red (_("Can't bind to LDAP. Please contact the system administrator."));
208 $smarty->display (get_template_path('headers.tpl'));
209 echo '<body style="background-image:none">'.$_SESSION['errors'].'</body></html>';
210 exit();
211 }
213 if (!isset($_SESSION['size_limit'])){
214 $_SESSION['size_limit']= $this->current['SIZELIMIT'];
215 $_SESSION['size_ignore']= $this->current['SIZEIGNORE'];
216 }
218 if ($sizelimit){
219 $this->ldap->set_size_limit($_SESSION['size_limit']);
220 } else {
221 $this->ldap->set_size_limit(0);
222 }
224 /* Move referrals */
225 if (!isset($this->current['REFERRAL'])){
226 $this->ldap->referrals= array();
227 } else {
228 $this->ldap->referrals= $this->current['REFERRAL'];
229 }
231 return ($this->ldap);
232 }
234 function set_current($name)
235 {
236 $this->current= $this->data['LOCATIONS'][$name];
237 if (!isset($this->current['PEOPLE'])){
238 $this->current['PEOPLE']= "ou=people";
239 }
240 if (!isset($this->current['GROUPS'])){
241 $this->current['GROUPS']= "ou=groups";
242 }
243 if (!isset($this->current['WINSTATIONS'])){
244 $this->current['WINSTATIONS']= "ou=winstations,ou=systems";
245 }
246 if (!isset($this->current['HASH'])){
247 $this->current['HASH']= "crypt";
248 }
249 if (!isset($this->current['DNMODE'])){
250 $this->current['DNMODE']= "cn";
251 }
252 if (!isset($this->current['MINID'])){
253 $this->current['MINID']= 100;
254 }
255 if (!isset($this->current['SIZELIMIT'])){
256 $this->current['SIZELIMIT']= 200;
257 }
258 if (!isset($this->current['SIZEINGORE'])){
259 $this->current['SIZEIGNORE']= TRUE;
260 } else {
261 if (preg_match("/true/i", $this->current['SIZEIGNORE'])){
262 $this->current['SIZEIGNORE']= TRUE;
263 } else {
264 $this->current['SIZEIGNORE']= FALSE;
265 }
266 }
268 /* Sort referrals, if present */
269 if (isset ($this->current['REFERRAL'])){
270 $bases= array();
271 $servers= array();
272 foreach ($this->current['REFERRAL'] as $ref){
273 $server= preg_replace('%^(.*)/[^/]+$%', '\\1', $ref['URL']);
274 $base= preg_replace('%^.*/([^/]+)$%', '\\1', $ref['URL']);
275 $bases[$base]= strlen($base);
276 $servers[$base]= $server;
277 }
278 asort($bases);
279 reset($bases);
280 }
282 /* SERVER not defined? Load the one with the shortest base */
283 if (!isset($this->current['SERVER'])){
284 $this->current['SERVER']= $servers[key($bases)];
285 }
287 /* BASE not defined? Load the one with the shortest base */
288 if (!isset($this->current['BASE'])){
289 $this->current['BASE']= key($bases);
290 }
292 /* Convert BASE to have escaped special characters */
293 $this->current['BASE']= @LDAP::convert($this->current['BASE']);
295 /* Parse LDAP referral informations */
296 if (!isset($this->current['ADMIN']) || !isset($this->current['PASSWORD'])){
297 $url= $this->current['SERVER'];
298 $referral= $this->current['REFERRAL'][$url];
299 $this->current['ADMIN']= $referral['ADMIN'];
300 $this->current['PASSWORD']= $referral['PASSWORD'];
301 }
303 /* Load server informations */
304 $this->load_servers();
305 }
307 function load_servers ()
308 {
309 /* Only perform actions if current is set */
310 if ($this->current == NULL){
311 return;
312 }
314 /* Fill imap servers */
315 $ldap= $this->get_ldap_link();
316 $ldap->cd ($this->current['BASE']);
317 $ldap->search ("(objectClass=goImapServer)");
319 $this->data['SERVERS']['IMAP']= array();
320 error_reporting(0);
321 while ($attrs= $ldap->fetch()){
322 $name= $attrs['goImapName'][0];
323 $this->data['SERVERS']['IMAP'][$name]= array( "connect" => $attrs['goImapConnect'][0],
324 "admin" => $attrs['goImapAdmin'][0],
325 "password" => $attrs['goImapPassword'][0],
326 "sieve_server" => $attrs['goImapSieveServer'][0],
327 "sieve_port" => $attrs['goImapSievePort'][0]);
328 }
329 error_reporting(E_ALL);
331 /* Get kerberos server. FIXME: only one is supported currently */
332 $ldap->cd ($this->current['BASE']);
333 $ldap->search ("(objectClass=goKrbServer)");
334 if ($ldap->count()){
335 $attrs= $ldap->fetch();
336 $this->data['SERVERS']['KERBEROS']= array( 'SERVER' => $attrs['cn'][0],
337 'REALM' => $attrs['goKrbRealm'][0],
338 'ADMIN' => $attrs['goKrbAdmin'][0],
339 'PASSWORD' => $attrs['goKrbPassword'][0]);
340 }
342 /* Get cups server. FIXME: only one is supported currently */
343 $ldap->cd ($this->current['BASE']);
344 $ldap->search ("(objectClass=goCupsServer)");
345 if ($ldap->count()){
346 $attrs= $ldap->fetch();
347 $this->data['SERVERS']['CUPS']= $attrs['cn'][0];
348 }
350 /* Get fax server. FIXME: only one is supported currently */
351 $ldap->cd ($this->current['BASE']);
352 $ldap->search ("(objectClass=goFaxServer)");
353 if ($ldap->count()){
354 $attrs= $ldap->fetch();
355 $this->data['SERVERS']['FAX']= array( 'SERVER' => $attrs['cn'][0],
356 'LOGIN' => $attrs['goFaxAdmin'][0],
357 'PASSWORD' => $attrs['goFaxPassword'][0]);
358 }
360 /* Get asterisk servers */
361 $ldap->cd ($this->current['BASE']);
362 $ldap->search ("(objectClass=goFonServer)");
363 if ($ldap->count()){
364 $attrs= $ldap->fetch();
365 $this->data['SERVERS']['FON']= array(
366 'SERVER' => $attrs['cn'][0],
367 'LOGIN' => $attrs['goFonAdmin'][0],
368 'PASSWORD' => $attrs['goFonPassword'][0],
369 'DB' => "gophone",
370 'SIP_TABLE' => "sip_users",
371 'EXT_TABLE' => "extensions",
372 'VOICE_TABLE' => "voicemail_users",
373 'QUEUE_TABLE' => "queues",
374 'QUEUE_MEMBER_TABLE' => "queue_members");
375 }
377 /* Get glpi servers */
378 $ldap->cd ($this->current['BASE']);
379 $ldap->search ("(&(objectClass=goGlpiServer)(cn=*)(goGlpiAdmin=*)(goGlpiDatabase=*))",array("cn","goGlpiPassword","goGlpiAdmin","goGlpiDatabase"));
380 if ($ldap->count()){
381 $attrs= $ldap->fetch();
382 if(!isset($attrs['goGlpiPassword'])){
383 $attrs['goGlpiPassword'][0] ="";
384 }
385 $this->data['SERVERS']['GLPI']= array(
386 'SERVER' => $attrs['cn'][0],
387 'LOGIN' => $attrs['goGlpiAdmin'][0],
388 'PASSWORD' => $attrs['goGlpiPassword'][0],
389 'DB' => $attrs['goGlpiDatabase'][0]);
390 }
391 /* Get logdb server */
392 $ldap->cd ($this->current['BASE']);
393 $ldap->search ("(objectClass=goLogDBServer)");
394 if ($ldap->count()){
395 $attrs= $ldap->fetch();
396 $this->data['SERVERS']['LOG']= array( 'SERVER' => $attrs['cn'][0],
397 'LOGIN' => $attrs['goLogAdmin'][0],
398 'PASSWORD' => $attrs['goLogPassword'][0]);
399 }
401 /* Get NFS server lists */
402 $tmp= array("default");
403 $ldap->cd ($this->current['BASE']);
404 $ldap->search ("(&(objectClass=goShareServer)(goExportEntry=*))");
405 while ($attrs= $ldap->fetch()){
406 for ($i= 0; $i<$attrs["goExportEntry"]["count"]; $i++){
407 $path= preg_replace ("/\s.*$/", "", $attrs["goExportEntry"][$i]);
408 $tmp[]= $attrs["cn"][0].":$path";
409 }
410 }
411 $this->data['SERVERS']['NFS']= $tmp;
414 /* Load Terminalservers */
415 $ldap->cd ($this->current['BASE']);
416 $ldap->search ("(objectClass=goTerminalServer)");
417 $this->data['SERVERS']['TERMINAL']= array();
418 $this->data['SERVERS']['TERMINAL'][]= "default";
420 $this->data['SERVERS']['FONT']= array();
421 $this->data['SERVERS']['FONT'][]= "default";
422 while ($attrs= $ldap->fetch()){
423 $this->data['SERVERS']['TERMINAL'][]= $attrs["cn"][0];
424 for ($i= 0; $i<$attrs["goFontPath"]["count"]; $i++){
425 $this->data['SERVERS']['FONT'][]= $attrs["goFontPath"][$i];
426 }
427 }
429 /* Ldap Server */
430 $this->data['SERVERS']['LDAP']= array();
431 $ldap->cd ($this->current['BASE']);
432 $ldap->search ("(objectClass=goLdapServer)");
433 while ($attrs= $ldap->fetch()){
434 if (isset($attrs["goLdapBase"])){
435 for ($i= 0; $i<$attrs["goLdapBase"]["count"]; $i++){
436 $this->data['SERVERS']['LDAP'][]= $attrs["cn"][0].":".$attrs["goLdapBase"][$i];
437 }
438 }
439 }
441 /* Get misc server lists */
442 $this->data['SERVERS']['SYSLOG']= array("default");
443 $this->data['SERVERS']['NTP']= array("default");
444 $ldap->cd ($this->current['BASE']);
445 $ldap->search ("(objectClass=goNtpServer)");
446 while ($attrs= $ldap->fetch()){
447 $this->data['SERVERS']['NTP'][]= $attrs["cn"][0];
448 }
449 $ldap->cd ($this->current['BASE']);
450 $ldap->search ("(objectClass=goSyslogServer)");
451 while ($attrs= $ldap->fetch()){
452 $this->data['SERVERS']['SYSLOG'][]= $attrs["cn"][0];
453 }
455 /* Get samba servers from LDAP, in case of samba3 */
456 if ($this->current['SAMBAVERSION'] == 3){
457 $this->data['SERVERS']['SAMBA']= array();
458 $ldap->cd ($this->current['BASE']);
459 $ldap->search ("(objectClass=sambaDomain)");
460 while ($attrs= $ldap->fetch()){
461 $this->data['SERVERS']['SAMBA'][$attrs['sambaDomainName'][0]]= array(
462 "SID" => $attrs["sambaSID"][0],
463 "RIDBASE" => $attrs["sambaAlgorithmicRidBase"][0]);
464 }
466 /* If no samba servers are found, look for configured sid/ridbase */
467 if (count($this->data['SERVERS']['SAMBA']) == 0){
468 if (!isset($this->current["SID"]) || !isset($this->current["RIDBASE"])){
469 print_red(_("SID and/or RIDBASE missing in your configuration!"));
470 echo $_SESSION['errors'];
471 exit;
472 } else {
473 $this->data['SERVERS']['SAMBA']['DEFAULT']= array(
474 "SID" => $this->current["SID"],
475 "RIDBASE" => $this->current["RIDBASE"]);
476 }
477 }
478 }
479 }
482 function get_departments($ignore_dn= "")
483 {
484 global $config;
486 /* Initialize result hash */
487 $result= array();
488 $administrative= array();
489 $result['/']= $this->current['BASE'];
490 $this->tdepartments= array();
492 /* Get list of department objects */
493 $ldap= $this->get_ldap_link();
494 $ldap->cd ($this->current['BASE']);
495 $ldap->search ("(objectClass=gosaDepartment)", array("ou", "objectClass", "gosaUnitTag"));
496 while ($attrs= $ldap->fetch()){
497 $dn= $ldap->getDN();
498 $this->tdepartments[$dn]= "";
500 /* Save administrative departments */
501 if (in_array_ics("gosaAdministrativeUnit", $attrs['objectClass']) &&
502 isset($attrs['gosaUnitTag'][0])){
503 $administrative[$dn]= $attrs['gosaUnitTag'][0];
504 $this->tdepartments[$dn]= $attrs['gosaUnitTag'][0];
505 }
507 if (in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass']) &&
508 isset($attrs['gosaUnitTag'][0])){
509 $this->tdepartments[$dn]= $attrs['gosaUnitTag'][0];
510 }
512 if ($dn == $ignore_dn){
513 continue;
514 }
516 /* Only assign non-root departments */
517 if ($dn != $result['/']){
518 $result[convert_department_dn($dn)]= $dn;
519 }
520 }
522 $this->adepartments= $administrative;
523 $this->departments= $result;
524 }
527 function make_idepartments($max_size= 28)
528 {
529 global $config;
530 $base = $config->current['BASE'];
532 $arr= array();
533 $ui= get_userinfo();
534 $this->idepartments= array();
536 /* Create multidimensional array, with all departments. */
537 foreach ($this->departments as $key => $val){
539 /* When using strict_units, filter non relevant parts */
540 if (isset($config->current['STRICT_UNITS']) && preg_match('/true/i', $config->current['STRICT_UNITS'])){
541 if ($ui->gosaUnitTag != "" && isset($this->tdepartments[$val]) &&
542 $this->tdepartments[$val] != $ui->gosaUnitTag){
543 continue;
544 }
545 }
547 /* remove base from dn */
548 $val2 = str_replace($base,"",$val);
550 /* Get every single ou */
551 $str = preg_replace("/ou=/","|ou=",$val2);
552 $elements = array_reverse(split("\|",$str));
554 /* Save last array position */
555 $last = &$arr;
557 /* Get array depth */
558 $cnt = count($elements);
560 /* Add last ou element of current dn to our array */
561 foreach($elements as $key => $ele){
563 /* skip enpty */
564 if(empty($ele)) continue;
566 /* Extract department name */
567 $elestr = preg_replace("/^ou=/","", $ele);
568 $elestr = preg_replace("/,$/","",$elestr);
570 /* Add to array */
571 if($key == ($cnt-2)){
572 $last[$elestr]['ENTRY'] = $val;
573 }
575 /* Set next array appending position */
576 $last = &$last[$elestr]['SUB'];
577 }
578 }
580 /* Add base entry */
581 $ret["/"]["ENTRY"] = $base;
582 $ret["/"]["SUB"] = $arr;
584 $this->idepartments= $this->generateDepartmentArray($ret,-1,$max_size);
585 }
588 /* Creates display friendly output from make_idepartments */
589 function generateDepartmentArray($arr,$depth = -1,$max_size){
590 $ret = array();
591 $depth ++;
593 /* Walk through array */
594 foreach($arr as $name => $entries){
596 /* If this department is the last in the current tree position
597 * remove it, to avoid generating output for it */
598 if(count($entries['SUB'])==0){
599 unset($entries['SUB']);
600 }
602 /* Fix name, if it contains a replace tag */
603 $name= @LDAP::fix($name);
605 /* Check if current name is too long, then cut it */
606 if(mb_strlen($name, 'UTF-8')> $max_size){
607 $name = mb_substr($name,0,($max_size-3), 'UTF-8')." ...";
608 }
610 /* Append the name to the list */
611 if(isset($entries['ENTRY'])){
612 $a = "";
613 for($i = 0 ; $i < $depth ; $i ++){
614 $a.=" ";
615 }
616 $ret[$entries['ENTRY']]=$a." ".$name;
617 }
619 /* recursive add of subdepartments */
620 if(isset($entries['SUB'])){
621 $ret = array_merge($ret,$this->generateDepartmentArray($entries['SUB'],$depth,$max_size));
622 }
623 }
625 return($ret);
626 }
628 /* This function returns all available Shares defined in this ldap
629 * There are two ways to call this function, if listboxEntry is true
630 * only name and path are attached to the array, in it is false, the whole
631 * entry will be parsed an atached to the result.
632 */
633 function getShareList($listboxEntry = false)
634 {
635 $ldap= $this->get_ldap_link();
636 $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn"));
637 $return= array();
638 while($entry = $ldap->fetch($a_res)){
639 if(isset($entry['goExportEntry']['count'])){
640 unset($entry['goExportEntry']['count']);
641 }
642 if(isset($entry['goExportEntry'])){
643 foreach($entry['goExportEntry'] as $export){
644 $shareAttrs = split("\|",$export);
645 if($listboxEntry) {
646 $return[$shareAttrs[0]."|".$entry['cn'][0]] = $shareAttrs[0]." - ".$entry['cn'][0];
647 }else{
648 $return[$shareAttrs[0]."|".$entry['cn'][0]]['server'] = $entry['cn'][0];
649 $return[$shareAttrs[0]."|".$entry['cn'][0]]['name'] = $shareAttrs[0];
650 $return[$shareAttrs[0]."|".$entry['cn'][0]]['description'] = $shareAttrs[1];
651 $return[$shareAttrs[0]."|".$entry['cn'][0]]['type'] = $shareAttrs[2];
652 $return[$shareAttrs[0]."|".$entry['cn'][0]]['charset'] = $shareAttrs[3];
653 $return[$shareAttrs[0]."|".$entry['cn'][0]]['path'] = $shareAttrs[4];
654 $return[$shareAttrs[0]."|".$entry['cn'][0]]['option'] = $shareAttrs[5];
655 }
656 }
657 }
658 }
659 return($return);
660 }
662 /* This function returns all available ShareServer */
663 function getShareServerList()
664 {
665 $ldap= $this->get_ldap_link();
666 $a_res = $ldap->search("(&(objectClass=goShareServer)(goExportEntry=*))",array("goExportEntry","cn"));
667 $return= array();
668 while($entry = $ldap->fetch($a_res)){
669 if(isset($entry['goExportEntry']['count'])){
670 unset($entry['goExportEntry']['count']);
671 }
672 foreach($entry['goExportEntry'] as $share){
673 $a_share = split("\|",$share);
674 $sharename = $a_share[0];
675 $return[$entry['cn'][0]."|".$sharename] = $entry['cn'][0]." [".$sharename."]";
676 }
677 }
678 return($return);
679 }
681 /* Check if there's the specified bool value set in the configuration */
682 function boolValueIsTrue($section, $value)
683 {
684 $section= strtoupper($section);
685 $value= strtoupper($value);
686 if (isset($this->data[$section][$value])){
688 $data= $this->data[$section][$value];
689 if (preg_match("/^true$/i", $data) || preg_match("/yes/i", $data)){
690 return TRUE;
691 }
693 }
695 return FALSE;
696 }
698 }
700 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
701 ?>