Code

Remove  
[gosa.git] / gosa-core / setup / class_setupStep_Config2.inc
index e6b96b10cd333da4261ba4a26cda2fd7828709d3..2ec4ede3349fdad879f48aaad3b8508a57c23610 100644 (file)
@@ -24,23 +24,23 @@ class Step_Config2 extends setup_step
 {
   var $governmentmode = FALSE;
   var $sambaidmapping = FALSE;
-  var $header_image = "images/ldapserver.png";
+  var $header_image = "images/setup/server.png";
 
   var $cyrusunixstyle = FALSE;
-  var $mail       = "none";
+  var $mail           = "none";
+  var $mail_attrib    = "";
   var $mail_methods   = array();
   var $mail_settings = array("vacationdir"        => "/etc/gosa/vacation",
                              "vacationdir_active" => FALSE);
 
   var $generic_settings  = array( "enableCopyPaste" => false,
-                                  "enableDNS"      => false,
-                                  "enableDHCP"      => false,
                                   "wws_ou"        => "ou=winstations",
                                   "wws_ou_active" => FALSE,
                                   "snapshot_active"     => FALSE,
                                   "snapshot_base"       => "ou=snapshots,%base%",
                                   "snapshot_user"       => "%admin%",
                                   "snapshot_password"   => "",
+                                  "logging"             => "syslog,mysql",
                                   "snapshot_server"     => "%connection%");
 
   var $samba_settings    = array( "samba_sid"        => "0-815-4711",
@@ -50,23 +50,16 @@ class Step_Config2 extends setup_step
                                   "samba_rid_active" => FALSE); 
 
   var $sambaDomain_found    = FALSE;
-  var $use_netatalk         = FALSE;
-  var $enableFAI_management = FALSE;
-  var $enableMimeType       = FALSE;
-
   var $timezone       = "Europe/Berlin";
   var $timezones      = array();
 
-  var $attributes = array("governmentmode","sambaidmapping","cyrusunixstyle","mail","use_netatalk","enableFAI_management","timezone","enableMimeType");
+  var $attributes = array("mail_attrib","governmentmode","sambaidmapping","cyrusunixstyle","mail","timezone");
   var $called = FALSE;
 
   function Step_Config2()
   {
     $this->update_strings();
-    $tmp = $this->get_available_mail_classes();
-    foreach($tmp['name'] as $name){
-      $this->mail_methods[$name] = $name;
-    }
+    $this->mail_methods = $this->get_available_mail_classes();
 
     /* Look for samba password generation method */
     if(file_exists("/usr/bin/mkntpasswd")){
@@ -77,7 +70,7 @@ class Step_Config2 extends setup_step
       $pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"';
     }
 
-    $this->timezones = _get_tz_zones();
+    $this->timezones = timezone::_get_tz_zones();
     $this->samba_settings['smbhash'] = $pwdhash;
   }
 
@@ -92,14 +85,17 @@ class Step_Config2 extends setup_step
  
   function execute()
   {
+    $this->mail_methods = $this->get_available_mail_classes();
     /* On first call check for rid/sid base */
     $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
+    $ldap_l = new LDAP($cv['admin'],
         $cv['password'],
         $cv['connection'],
         FALSE,
         $cv['tls']);
 
+    $ldap = new ldapMultiplexer($ldap_l);
+
     $ldap->cd($cv['base']);
     $ldap->search("(objectClass=sambaDomain)",array("dn"));
     if($ldap->count()){
@@ -114,30 +110,6 @@ class Step_Config2 extends setup_step
         $this->samba_settings['samba_rid_active'] = TRUE;
       }
   
-      /* Check if we can enable netatalk plugin */
-      $tmp = $ldap->get_objectclasses();
-      if(is_array($tmp) && isset($tmp['apple-user'])) {
-        $this->use_netatalk = TRUE;
-      }
-
-      /* Check the FAI schema is used */
-      if(is_array($tmp) && isset($tmp['FAIclass'])){
-#        $this->enableFAI_management = TRUE;
-      }
-
-      /* Check the MimeType schema is used */
-      if(is_array($tmp) && isset($tmp['gotoMimeType'])){
-        $this->enableMimeType = TRUE;
-      }
-
-      if(is_array($tmp) && isset($tmp['dhcpClass'])){
-        $this->generic_settings['enableDHCP'] = TRUE;
-      }
-
-      if(is_array($tmp) && isset($tmp['dNSZone'])){
-        $this->generic_settings['enableDNS'] = TRUE;
-      }
-
       $this->called = TRUE;
     }
 
@@ -153,14 +125,18 @@ class Step_Config2 extends setup_step
     }
 
     $smarty = get_smarty();
-    $smarty->assign("sambaDomain_found",$this->sambaDomain_found);
-    $smarty->assign("generic_settings",$this->generic_settings);
-    $smarty->assign("mail_settings",$this->mail_settings);
-    $smarty->assign("mail_methods",$this->mail_methods);
-    $smarty->assign("samba_settings",$this->samba_settings);
+    $smarty->assign("sambaDomain_found",  $this->sambaDomain_found);
+    $smarty->assign("generic_settings",  reverse_html_entities($this->generic_settings));
+    $smarty->assign("mail_settings",     reverse_html_entities($this->mail_settings));
+    $smarty->assign("mail_methods",      reverse_html_entities($this->mail_methods));
+    $smarty->assign("samba_settings",    reverse_html_entities($this->samba_settings));
+
+    $smarty->assign("logging_mysql" ,preg_match("/mysql/",$this->generic_settings['logging']));
+    $smarty->assign("logging_syslog",preg_match("/syslog/",$this->generic_settings['logging']));
+   
     $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
-        foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,reverse_html_entities($this->$attr));
     }
     $smarty->assign("timezone"     ,$this->timezone);
     $smarty->assign("timezones"    ,$this->timezones);
@@ -175,6 +151,8 @@ class Step_Config2 extends setup_step
         $this->timezone = $_POST['timezone'];
       }
 
+      $old_mail = $this->mail;
+
       /* Get attributes */
       foreach($this->attributes as $attr){
         if(isset($_POST[$attr])){
@@ -182,6 +160,16 @@ class Step_Config2 extends setup_step
         }
       }
 
+      /* Get logging */
+      $logging = "";
+      if(isset($_POST['logging_syslog'])){
+        $logging.= "syslog,";
+      }
+      if(isset($_POST['logging_mysql'])){
+        $logging.= "mysql,";
+      }
+      $this->generic_settings['logging'] = trim($logging,",");
+
       /* Mail settings */
       if(isset($_POST['vacationdir_active'])){
         $this->mail_settings['vacationdir_active'] = TRUE;
@@ -195,12 +183,6 @@ class Step_Config2 extends setup_step
       if(isset($_POST['enableCopyPaste'])){
         $this->generic_settings['enableCopyPaste'] = get_post('enableCopyPaste');
       }
-      if(isset($_POST['enableDNS'])){
-        $this->generic_settings['enableDNS'] = get_post('enableDNS');
-      }
-      if(isset($_POST['enableDHCP'])){
-        $this->generic_settings['enableDHCP'] = get_post('enableDHCP');
-      }
 
       if(isset($_POST['wws_ou_active'])){
         $this->generic_settings['wws_ou_active'] = TRUE;
@@ -282,30 +264,27 @@ class Step_Config2 extends setup_step
     return($tmp);
   }
 
-/* Returns the classnames auf the mail classes */
+
+  /* Returns the classnames auf the mail classes */
   function get_available_mail_classes()
   {
-    $dir = opendir( "../include");
+    global $class_mapping;
+
+    /* Check if we have the mail classes/plugins installed */
+    if(!class_available("mailMethod")){
+      return(array());
+    }
     $methods = array();
-    $suffix = "class_mail-methods-";
-    $lensuf = strlen($suffix);
-    $prefix = ".inc";
-    $lenpre = strlen($prefix);
-    $i = 0;
-    while (($file = readdir($dir)) !== false){
-
-      if(stristr($file,$suffix)) {
-        $lenfile = strlen($file);
-        $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
-        $methods['file'][$i] = $file;
-        $methods[$i]['file'] = $file;
-        $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
-        $i++;
+    foreach($class_mapping as $name => $file){
+      if(preg_match("/^mailMethod.*$/i",$name)){
+        $name = preg_replace("/^mailMethod/","",$name);
+        if(!empty($name)){
+          $methods[$name]['name'] = $name;
+        }
       }
     }
     return($methods);
   }
-
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: