index 90427bcdf19795a8a74e932e2412c3a71335cecf..84fcebc777fcd4707b9e7f063d51ed88df45af7c 100644 (file)
function view_schema_check($table)
{
- $message="<table class=\"check\">";
+ $message="<table summary=\"\" class=\"check\">";
foreach ($table as $key => $values){
$msg = $values['msg'];
}
-function schema_check($server, $admin, $password, $aff=0)
+function is_schema_readable($server, $admin, $password)
+{
+ $ds= ldap_connect ($server);
+ if (!$ds) {
+ return (false);
+ }
+ ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
+ $r= ldap_bind ($ds, $admin, $password);
+
+ /* Get base to look for schema */
+ $sr = @ldap_read ($ds, "", "objectClass=*", array("subschemaSubentry"));
+ $attr= @ldap_get_entries($ds,$sr);
+ if (!isset($attr[0]['subschemasubentry'][0])){
+ return (false);
+ }
+
+ $nb= $attr[0]['subschemasubentry'][0];
+ $objectclasses= array();
+ $sr= ldap_read ($ds, $nb, "objectClass=*", array("objectclasses"));
+ $attrs= ldap_get_entries($ds,$sr);
+ if (!isset($attrs[0])){
+ return (false);
+ }
+ return(true);
+}
+
+function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false)
{
global $config;
"gosaApplicationGroup" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"),
"GOhard" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
- "gotoTerminal" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
+ "gotoTerminal" => array("version" => "2.0", "class" => "terminals","file" => "goto.schema"),
"goServer" => array("version" => "2.4","class" => "server","file" => "goserver.schema"),
"goTerminalServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
"goNfsServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
} else {
if (!check_schema_version($objectclasses[$key], $value['version'])){
$messages[$key]['msg']= sprintf(_("Optional objectclass '%s' required by plugin '%s' does not have version %s"), $key, $class, $value['version']);
+ $messages[$key]['needonstartup'] = TRUE;
$messages[$key]['status'] =FALSE;
}else {
if(!isset($affich2[$class])){
if (!check_schema_version($objectclasses[$key], $value['version'])){
$messages[$key]['msg']= sprintf(_("Required objectclass '%s' does not have version %s"), $key, $value['version']);
$messages[$key]['status'] = FALSE;
+ $messages[$key]['needonstartup'] = TRUE;
}
+
}
}
}
$affich['phoneaccount']['msg']= _("Support for gofon enabled")."<td class=\"check\">gofon.schema</td>";
$affich['phoneaccount']['status']= true;
}
-
- if(($_SESSION['ldapconf']['mail_methods'][$_SESSION['ldapconf']['mail']] == "kolab")){
- if(!isset($objectclasses['kolabInetOrgPerson']))
- {
- $messages['kolab']['msg']= _("Support for Kolab disabled, no schema seems to be installed, setting mail-method to cyrus");
- $affich['kolab']['msg']=$messages['kolab']['msg']."<td class=\"check\">kolab2.schema</td>";
-
- $tmp= array_flip($_SESSION['ldapconf']['mail_methods']);
- $_SESSION['ldapconf']['mail']=$tmp['cyrus'];
- $messages['kolab']['status']= FALSE;
- $affich['kolab']['status']= FALSE;
- }else{
- $affich['kolab']['msg']=_("Support for Kolab enabled")."<td class=\"check\">gofon.schema</td>";
- $affich['kolab']['status']= TRUE;
- }
+
+ /* Fix for PHP Fehler "Undefined index: ldapconf"
+ * Ablaufverfolgung[1]: Funktion schema_check Datei: /home/hickert/gosa/include/functions_setup.inc (Zeile 230)
+ */
+ if((isset($_SESSION['ldapconf']['mail_methods']))&&(isset($_SESSION['ldapconf']))){
+ if(($_SESSION['ldapconf']['mail_methods'][$_SESSION['ldapconf']['mail']] == "kolab")&&(!$CalledByIndexPhP)){
+ if(!isset($objectclasses['kolabInetOrgPerson'])) {
+ $messages['kolab']['msg']= _("Support for Kolab disabled, no schema seems to be installed, setting mail-method to cyrus");
+ $affich['kolab']['msg']=$messages['kolab']['msg']."<td class=\"check\">kolab2.schema</td>";
+ $tmp= array_flip($_SESSION['ldapconf']['mail_methods']);
+ $_SESSION['ldapconf']['mail']=$tmp['cyrus'];
+ $messages['kolab']['status']= FALSE;
+ $affich['kolab']['status']= FALSE;
+ }else{
+ $affich['kolab']['msg']=_("Support for Kolab enabled")."<td class=\"check\">gofon.schema</td>";
+ $affich['kolab']['status']= TRUE;
+ }
+ }
}
if($aff==0){
return ($messages);
function check(&$faults, $message, $description, $test, $required= TRUE)
{
- $msg= "<table class='check'><tr><td class='check' style='font-size:14px;'>$message</td>
+ $msg= "<table summary=\"\" class='check'><tr><td class='check' style='font-size:14px;'>$message</td>
<td rowspan=2 style='vertical-align:middle; text-align:center;width:45px;'>";
if ($test){
$msg.= _("OK")."<br>";
function perform_additional_checks(&$faults)
{
+ $ret = NULL;
/* Programm check */
$msg= "<h1>"._("Checking for some additional programms")."</h1>";
$replacements['{LDAPHOST}'] = $ldapconf['uri'];
$replacements['{PASSWORD}'] = $ldapconf['password'];
$replacements['{CRYPT}'] = $ldapconf['arr_cryptkeys'][$ldapconf['arr_crypts']];
- $replacements['{SID}\n'] = "";
- $replacements['{RIDBASE}\n'] = "";
+ $replacements['{SID}'] = "";
+ $replacements['{RIDBASE}'] = "";
if($ldapconf['mail'] != "disabled"){
$replacements['{MAILMETHOD}'] = $ldapconf['mail_methods'][$ldapconf['mail']];
}
$replacements['{GOVERNMENTMODE}']= "false";
$replacements['{kolabAccount}'] = "";
$replacements['{servKolab}'] = "";
+ $replacements['{errorlvl}'] = $ldapconf['errorlvl'];
/* This array contains all preg_replace syntax to delete all unused plugins
THE kEY MUST BE THE CLASSNAME so we can check it with $ldapconf['classes'] */
$possible_plugins['webdav'][] = "'\n.*<tab.*webdav.*>.*\n'i";
$possible_plugins['phpgroupware'][]= "'\n.*<tab.*phpgroupware.*>.*\n'i";
- /* Header information
+ /*Header information
Needed to send the generated gosa.conf to the browser */
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
/* Try to find a Samba Domain Objekt */
$ldap->search("(objectClass=sambaDomain)");
-
+
/* Something found ??? so we need to define ridbase an SID by ourselfs */
if($ldap->count()< 1) {
$replacements['{SID}']= "sid=\"123412-11\"";
/* Remove all unused plugins */
- foreach($possible_plugins as $plugin) {
+ foreach($possible_plugins as $key=> $plugin) {
foreach($plugin as $key=>$val) {
if(in_array($plugin,$classes)) {
$str = preg_replace($val,"\n",$str);
/* Show setup_page 1 */
function show_setup_page1($withoutput = true)
{
+ $faults = array();
$smarty = get_smarty();
$smarty->assign ("content", get_template_path('setup_introduction.tpl'));
$smarty->assign ("tests", perform_php_checks($faults));
/* Show setup_page 2 */
function show_setup_page2($withoutput = true)
{
+ $faults = array();
$smarty = get_smarty();
$smarty->assign ("content", get_template_path('setup_step2.tpl'));
$smarty->assign ("tests", perform_additional_checks($faults));
function show_setup_page3($withoutput = true)
{
+ $ds = NULL;
$smarty = get_smarty();
/* Take the Post oder the Sessioin saved data */
{
$smarty= get_smarty();
+ // ?
if(!isset($_SESSION['ldapconf']['base'])){
$_SESSION['ldapconf']['base']= $base;
}
$arr_crypts= array();
$temp = "";
$checkvars = array("location", "admin", "password", "peopleou", "base",
- "peopledn", "arr_crypts", "mail", "uidbase");
+ "peopledn", "arr_crypts", "mail", "uidbase","errorlvl");
if(!isset($_SESSION['ldapconf']['arr_cryptkeys'])) {
require_once("class_password-methods.inc");
$_SESSION['ldapconf']['password']);
$_SESSION['classes']= $m;
+ if(!is_schema_readable($ldapconf['uri'],$ldapconf['admin'],$ldapconf['password'])){
+ if($withoutput){
+ print_red(_("Can't read schema informations, GOsa needs to know your schema setup. Please verify that it is readable for GOsa"));
+ }
+ $fault=true;
+ }
+
+
+
if ($ldap->error != "Success") {
if($withoutput) {
print_red(sprintf(_("Can't log into LDAP server. Reason was: %s."), $ldap->get_error()));
if($withoutput){
$smarty->display (get_template_path('setup.tpl'));
}
-
return (!$fault);
}
$info= posix_getgrgid(posix_getgid());
$smarty->assign("webgroup", $info['name']);
$smarty->assign("path", CONFIG_DIR);
- $message= "<table class=\"check\">";
+ $message= "<table summary=\"\" class=\"check\">";
$m= schema_check($ldapconf['uri'], $ldapconf['admin'], $ldapconf['password'],1);
if($withoutput) {
return(true);
} else {
- if(!($create_user)) {
+ if((!isset($create_user))||(!($create_user))) {
$smarty->assign ("content", get_template_path('setup_useradmin.tpl'));
$smarty->assign("exists",true);
} else {