X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Ffunctions_setup.inc;h=7d5582b06223aa3e1516d731c283fc1582978496;hb=2c7972420c32a603e35ac5454fde6fd40b31259d;hp=2a15513042c0f5d903b800a54893eddb28919890;hpb=5f305cccde524d528bff44b9c3d51fe4822f0cf4;p=gosa.git
diff --git a/include/functions_setup.inc b/include/functions_setup.inc
index 2a1551304..7d5582b06 100644
--- a/include/functions_setup.inc
+++ b/include/functions_setup.inc
@@ -32,28 +32,13 @@ function view_schema_check($table)
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, NULL, "objectClass=*", array("subschemaSubentry"));
- $attr= @ldap_get_entries($ds,$sr);
- if (!isset($attr[0]['subschemasubentry'][0])){
- return (false);
- }
+ $ldap = new LDAP($admin,$password,$server);
+ $tmp = $ldap->get_objectclasses();
- $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);
+ if(count($tmp)){
+ return(true);
}
- return(true);
+ return(false);
}
function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false)
@@ -78,8 +63,8 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false
"gosaApplication" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"),
"gosaApplicationGroup" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"),
- "GOhard" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
- "gotoTerminal" => array("version" => "2.0", "class" => "terminals","file" => "goto.schema"),
+ "GOhard" => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"),
+ "gotoTerminal" => array("version" => "2.5", "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"),
"goShareServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
@@ -92,35 +77,13 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false
"goFaxServer" => array("version" => "2.4", "class" => "gofaxAccount","file" => "gofax.schema"),
);
- /* Build LDAP connection */
- $ds= ldap_connect ($server);
- if (!$ds) {
- return (array(array("msg" => _("Can't bind to LDAP. No schema check possible!"), "status" => 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, NULL, "objectClass=*", array("subschemaSubentry"));
- $attr= @ldap_get_entries($ds,$sr);
- if (!isset($attr[0]['subschemasubentry'][0])){
+ /* Get objectclasses */
+ $ldap = new LDAP($admin,$password, $server);
+ $objectclasses = $ldap->get_objectclasses();
+ if(count($objectclasses) == 0){
return (array(array("msg" => _("Can't get schema information from server. No schema check possible!"), "status" => FALSE)));
}
- /* Get list of objectclasses */
- $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 (array(array("msg" => _("Can't get schema information from server. No schema check possible!"), "status" => FALSE)));
- }
- foreach ($attrs[0]['objectclasses'] as $val){
- $name= preg_replace("/^.* NAME\s+\(*\s*'([^']+)'\s*\)*.*$/", '\\1', $val);
- if ($name != $val){
- $objectclasses[$name]= $val;
- }
- }
/* Walk through objectclasses and check if they are needed or not */
foreach ($required_classes as $key => $value){
if (isset($value['class'])){
@@ -247,6 +210,16 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false
$affich['nagioscontact']['status']= true;
}
+ if ((!isset($objectclasses['apple-user'])) || (!isset($objectclasses['mount'])) ){
+ $messages['netatalk']['msg']= _("Support for netatalk disabled, no schema seems to be installed");
+ $affich['netatalk']['msg']= $messages['netatalk']['msg']."
apple.schema | ";
+ $messages['netatalk']['status']= FALSE;
+ $affich['netatalk']['status']= FALSE;
+ }else{
+ $affich['netatalk']['msg']= _("Support for netatalk enabled")."apple.schema | ";
+ $affich['netatalk']['status']= true;
+ }
+
/* Fix for PHP Fehler "Undefined index: ldapconf"
* Ablaufverfolgung[1]: Funktion schema_check Datei: /home/hickert/gosa/include/functions_setup.inc (Zeile 230)
*/
@@ -301,6 +274,7 @@ function perform_php_checks(&$faults)
$msg= "";
$msg.= ""._("PHP setup inspection")."
";
+
$msg.= check ( $faults, _("Checking for PHP version (>=4.1.0)"),
_("PHP must be of version 4.1.0 or above for some functions and known bugs in PHP language."),
version_compare(phpversion(), "4.1.0")>=0);
@@ -308,6 +282,10 @@ function perform_php_checks(&$faults)
$msg.= check ( $faults, _("Checking if register_globals is set to 'off'"),
_("register_globals is a PHP mechanism to register all global varibales to be accessible from scripts without changing the scope. This may be a security risk. GOsa will run in both modes."),
$check_globals == 0, FALSE);
+
+ $msg.= check ( $faults, _("PHP session.gc_maxlifetime (>= 86400 seconds)."),
+ _("PHP uses this value for the garbage collector to delete old sessions, setting this value to one day will prevent loosing session and cookie before they really timeout."),
+ ini_get("session.gc_maxlifetime") >= 86400,FALSE);
$msg.= check ( $faults, _("Checking for ldap module"),
_("This is the main module used by GOsa and therefore really required."),
@@ -360,6 +338,7 @@ function get_link($function_name) {
$result= "=1.1.2)"),
+ _("GraphicsMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."),
+ ($major > 1 || ($major == 1 && $minor >= 1) || ($major == 1 && $minor == 1 && $minor2 >= 2) ) );
+ } else {
+ $msg.= check ( $faults, _("Checking for ImageMagick (>=5.4.0)"),
+ _("ImageMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."),
+ ($major > 5 || ($major == 5 && $minor >= 4)));
+ }
} else {
$msg.= check ( $faults, _("Checking imagick module for PHP"),
_("Imagick is used to convert user supplied images to fit the suggested size and the unified JPEG format from PHP script."), function_exists('imagick_blob2image'), TRUE);
@@ -553,6 +539,8 @@ function parse_contrib_conf()
$possible_plugins['pureftp'][] = "'\n.*.*\n'i";
$possible_plugins['webdav'][] = "'\n.*.*\n'i";
$possible_plugins['phpgroupware'][]= "'\n.*.*\n'i";
+ $possible_plugins['netatalk'][0] = "'\n.*.*\n'i";
+ $possible_plugins['netatalk'][1] = "'\n.*.*\n'i";
/*Header information
Needed to send the generated gosa.conf to the browser */
@@ -625,11 +613,10 @@ function parse_contrib_conf()
$str = str_replace("mailMethod=\"{MAILMETHOD}\"","",$str);
}
-
/* Remove all unused plugins */
- foreach($possible_plugins as $key=> $plugin) {
- foreach($plugin as $key=>$val) {
- if(in_array($plugin,$classes)) {
+ foreach(array_keys($possible_plugins) as $akey) {
+ if(array_key_exists($akey,$classes)) {
+ foreach($possible_plugins[$akey] as $key=>$val) {
$str = preg_replace($val,"\n",$str);
}
}
@@ -643,11 +630,14 @@ function parse_contrib_conf()
/* Show setup_page 1 */
function show_setup_page1($withoutput = true)
{
- $faults = array();
+ $faults = false;
+ $faults2 = false;
$smarty = get_smarty();
$smarty->assign ("content", get_template_path('setup_introduction.tpl'));
$smarty->assign ("tests", perform_php_checks($faults));
- $smarty->assign ("detailed_tests", perform_additional_function_checks($faults));
+ $smarty->assign ("detailed_tests", perform_additional_function_checks($faults2));
+
+ $faults = $faults || $faults2;
/* This var is true if anything went wrong */
if ($faults){
@@ -667,14 +657,14 @@ function show_setup_page1($withoutput = true)
$smarty->display (get_template_path('setup.tpl'));
}
- return (!$faults);
+ return ($faults);
}
/* Show setup_page 2 */
function show_setup_page2($withoutput = true)
{
- $faults = array();
+ $faults = false;
$smarty = get_smarty();
$smarty->assign ("content", get_template_path('setup_step2.tpl'));
$smarty->assign ("tests", perform_additional_checks($faults));
@@ -692,7 +682,7 @@ function show_setup_page2($withoutput = true)
$smarty->display (get_template_path('setup.tpl'));
}
- return (!$faults);
+ return ($faults);
}
@@ -722,18 +712,7 @@ function show_setup_page3($withoutput = true)
/* No error till now */
$fault = false;
- /* If we pushed the Button continue */
- if(isset($_POST['continue3'])){
- if(!isset($uri)) {
- $fault = true;
-
- /* Output the Error */
- if($withoutput) {
- print_red (_("You've to specify an ldap server before continuing!"));
- $smarty->assign ("content", get_template_path('setup_step3.tpl'));
- }
- }
- } elseif (!$ds = @ldap_connect (validate($uri))) {
+ if (!$ds = @ldap_connect (validate($uri))) {
$fault =true;
/* Output the Error */
@@ -778,7 +757,7 @@ function show_setup_page3($withoutput = true)
$smarty->display (get_template_path('setup.tpl'));
}
- return (!$fault);
+ return ($fault);
}
@@ -786,6 +765,34 @@ function show_setup_page4($withoutput = true)
{
$smarty= get_smarty();
+ /* check POST data */
+ if(isset($_POST['check'])) {
+
+ /* Check if all needed vars are submitted */
+ foreach($checkvars as $key) {
+ if($key == "peopleou"){
+ continue;
+ }
+ if($key == "groupou"){
+ continue;
+ }
+
+ if((isset($_POST[$key]))&&($_POST[$key]!="")) {
+ $_SESSION['ldapconf'][$key] = $_POST[$key];
+ } else {
+ if($withoutput) {
+ print_red(sprintf(_("You're missing the required attribute '%s' from this formular. Please complete!"), $key));
+ }
+ $fault = true;
+ }
+ }
+ }
+
+ /* Transfer base */
+ if(isset($_POST['base'])){
+ $_SESSION['ldapconf']['base']= $_POST['base'];
+ }
+
// ?
if(!isset($_SESSION['ldapconf']['base'])){
$_SESSION['ldapconf']['base']= $base;
@@ -818,7 +825,7 @@ function show_setup_page4($withoutput = true)
/* If there are some empty vars in ldapconnect -
these values also represent out default values */
- if(!$ds = @ldap_connect (validate($uri))){
+ if(!$ds = @ldap_connect (validate($uri))){
$fault = true;
if($withoutput){
print_red (_("Can't connect to the specified LDAP server! Please make sure that is reachable for GOsa."));
@@ -826,22 +833,21 @@ function show_setup_page4($withoutput = true)
} elseif(!@ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)){
$fault = true;
if($withoutput){
- print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
+ print_red (_("Can't set ldap protocol version 3."));
}
} elseif(!$r= @ldap_bind ($ds)){
$fault = true;
if($withoutput){
- print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
+ print_red (_("Could not bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
}
} else {
- $sr= @ldap_search ($ds, NULL, "objectClass=*", array("namingContexts"));
+ $sr= @ldap_search ($r, 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 information twice"));
+# print_red(_("Bind to server successful, but the server seems to be completly empty, please check all information twice"));
}
} else {
@@ -881,34 +887,6 @@ function show_setup_page4($withoutput = true)
$_SESSION['ldapconf']['arr_crypts'] = $tmp['md5'];
}
- /* check POST data */
- if(isset($_POST['check'])) {
-
- /* Check if all needed vars are submitted */
- foreach($checkvars as $key) {
- if($key == "peopleou"){
- continue;
- }
- if($key == "groupou"){
- continue;
- }
-
- if((isset($_POST[$key]))&&($_POST[$key]!="")) {
- $_SESSION['ldapconf'][$key] = $_POST[$key];
- } else {
- if($withoutput) {
- print_red(sprintf(_("You're missing the required attribute '%s' from this formular. Please complete!"), $key));
- }
- $fault = true;
- }
- }
- }
-
- /* Transfer base */
- if(isset($_POST['base'])){
- $_SESSION['ldapconf']['base']= $_POST['base'];
- }
-
$smarty->assign("arr_cryptkeys",$_SESSION['ldapconf']['arr_cryptkeys']);
$smarty->assign("mail_methods", $_SESSION['ldapconf']['mail_methods']);
@@ -916,7 +894,7 @@ function show_setup_page4($withoutput = true)
$smarty->assign($key,$val);
}
- if(isset($_POST['check'])) {
+ if(isset($_POST['check']) || (isset($_POST['admin'])) && isset($_POST['password'])) {
$ldap= new LDAP($_SESSION['ldapconf']['admin'],
$_SESSION['ldapconf']['password'],
$_SESSION['ldapconf']['uri']);
@@ -955,7 +933,8 @@ function show_setup_page4($withoutput = true)
if($withoutput){
$smarty->display (get_template_path('setup.tpl'));
}
- return (!$fault);
+
+ return ($fault);
}