Code

Applied modifications for fixed PHP versions
[gosa.git] / include / functions_setup.inc
index 9872bc5d72b36c13819a86530746a43939077688..44adf1ac1fd9893c3c6708177efd722cf0fc1b75 100644 (file)
@@ -40,7 +40,7 @@ function is_schema_readable($server, $admin, $password)
   $r= ldap_bind ($ds, $admin, $password);
 
   /* Get base to look for schema */
-  $sr  = @ldap_read ($ds, "", "objectClass=*", array("subschemaSubentry"));
+  $sr  = @ldap_read ($ds, NULL, "objectClass=*", array("subschemaSubentry"));
   $attr= @ldap_get_entries($ds,$sr);
   if (!isset($attr[0]['subschemasubentry'][0])){
     return (false);
@@ -101,7 +101,7 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false
   $r= ldap_bind ($ds, $admin, $password);
 
   /* Get base to look for schema */
-  $sr  = @ldap_read ($ds, "", "objectClass=*", array("subschemaSubentry"));
+  $sr  = @ldap_read ($ds, NULL, "objectClass=*", array("subschemaSubentry"));
   $attr= @ldap_get_entries($ds,$sr);
   if (!isset($attr[0]['subschemasubentry'][0])){
     return (array(array("msg" => _("Can't get schema information from server. No schema check possible!"), "status" => FALSE)));
@@ -226,6 +226,16 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false
     $affich['phoneaccount']['msg']= _("Support for gofon enabled")."<td class=\"check\">gofon.schema</td>";
     $affich['phoneaccount']['status']= true;
   }
+
+  if (!isset($objectclasses['nagiosContact'])){
+    $messages['nagioscontact']['msg']= _("Support for nagios disabled, no schema seems to be installed");
+    $affich['nagioscontact']['msg']= $messages['nagioscontact']['msg']."<td class=\"check\">nagios.schema</td>";
+    $messages['nagioscontact']['status']= FALSE;
+    $affich['nagioscontact']['status']= FALSE;
+  }else{
+    $affich['nagioscontact']['msg']= _("Support for nagios enabled")."<td class=\"check\">nagios.schema</td>";
+    $affich['nagioscontact']['status']= true;
+  }
   
   /* Fix for PHP Fehler "Undefined index: ldapconf"
    * Ablaufverfolgung[1]: Funktion schema_check        Datei: /home/hickert/gosa/include/functions_setup.inc (Zeile 230)
@@ -337,13 +347,13 @@ function perform_php_checks(&$faults)
 }
 
 function get_link($function_name) {
-  $result= "http://de.php.net/manual/en/function.";
+  $result= "<a href='http://de.php.net/manual/en/function.";
 
   /* Replace all underscores with hyphens (phpdoc convention) */
   $function_name= str_replace("_", "-", $function_name);
 
   /* Append to base URL */
-  $result.= $function_name.'.php';
+  $result.= $function_name.".php'>$function_name</a>";
 
   return $result;
 }
@@ -370,9 +380,9 @@ function perform_additional_function_checks(&$faults) {
   /* Only print message, if function is not callable */
   foreach($functions as $key => $fn_name) {
     if(!is_callable($fn_name)) {
-      $msg.= check (  $faults, _(sprintf("Checking for function <b><a href='%s' target='_blank'>%s</a></b>", get_link($fn_name), $fn_name)),
-        _(sprintf("The function <b><a href='%s' target='_blank'>%s</a></b> is used by GOsa. There is no information if it's optional or required yet.",get_link($fn_name),$fn_name)),
-        is_callable($fn_name), FALSE);
+      $msg.= check ($faults, sprintf(_("Checking for function %s"), "<b>".get_link($fn_name)."</b>"),
+        sprintf(_("The function %s is used by GOsa. There is no information if it's optional or required yet."), "<b>".get_link($fn_name)."</b>"),
+        is_callable($fn_name), false);
     }
   }
   return $msg;
@@ -494,19 +504,21 @@ function parse_contrib_conf()
   }
 
   /* Look for samba password generation method */
-  if(file_exists("/usr/lib/gosa/mkntpasswd")){
-    $pwdhash  = "/usr/lib/gosa/mkntpasswd";
+  if(file_exists("/usr/bin/mkntpasswd")){
+    $pwdhash  = "/usr/bin/mkntpasswd";
   } elseif (preg_match("/^Usage: mkntpwd /", shell_exec ("mkntpwd 2>&1"))){
     $pwdhash= "mkntpwd";
   } else {
     $pwdhash=('perl -MCrypt::SmbHash -e "ntlmgen \"\$ARGV[0]\", \$lm, \$nt; print \"\${lm}:\${nt}\n\";" $1');
   }
 
+
   /* Define which variables will be replaced */
   $replacements['{LOCATIONNAME}']  = $ldapconf['location'];
   $replacements['{SAMBAVERSION}']  = $used_samba_version;
   $replacements['{LDAPBASE}']      = $ldapconf['base'];
   $replacements['{LDAPADMIN}']     = $ldapconf['admin'];
+  $replacements['{UIDBASE}']       = $ldapconf['uidbase'];
   $replacements['{DNMODE}']        = $ldapconf['peopledn'];
   $replacements['{LDAPHOST}']      = $ldapconf['uri'];
   $replacements['{PASSWORD}']      = $ldapconf['password'];
@@ -812,14 +824,14 @@ function show_setup_page4($withoutput = true)
       print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
     }
   } else {
-    $sr=   @ldap_search ($ds, "", "objectClass=*", array("namingContexts"));
+    $sr=   @ldap_search ($ds, NULL, "objectClass=*", array("namingContexts"));
     $attr= @ldap_get_entries($ds,$sr);
 
     if((empty($attr))) {
       $base= "dc=example,dc=net";
 
       if($withoutput){
-        print_red(_("Bind to server successful, but the server seems to be completly empty, please check all informations twice"));
+        print_red(_("Bind to server successful, but the server seems to be completly empty, please check all information twice"));
       }
 
     } else {