Code

Updated mime-types
[gosa.git] / gosa-plugins / goto / admin / mimetypes / class_mimetypeGeneric.inc
index c6e48657887daacda0a76f918476da7604ab5d41..bd8f4cae6a082ecf4da9fc3aaf88e35a92209592 100644 (file)
@@ -106,7 +106,7 @@ class mimetype extends plugin
         $tmp = array();
         for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
           $str = $this->attrs[$attr][$i];
-          $tmp2= split("\|",$str);
+          $tmp2= explode("|",$str);
 
           if(count($tmp2) == 2){
             $name = $tmp2[0];
@@ -129,7 +129,7 @@ class mimetype extends plugin
         $this->base= dn2base($ui->dn);
       }
     } else {
-      $this->base= preg_replace ("/^.*,".normalizePreg(get_ou("mimetypeou"))."/", "", $this->dn);
+      $this->base= preg_replace ("/^.*,".preg_quote(get_ou("mimetypeRDN"), '/')."/i", "", $this->dn);
     }
 
     /* Get icon data */
@@ -162,38 +162,6 @@ class mimetype extends plugin
     }
     $smarty->assign("IconReadable", preg_match("/r/",$this->getacl("gotoMimeIcon",preg_match("/freeze/i",$this->FAIstate))));
 
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once && !preg_match("/freeze/i",$this->FAIstate)){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
     /* Check Posts */
     $posts = array(    
         "/^Pattern_SortUp_/"   => array("Action" => "Pattern_SortUp",  "Func" => "ArrayUp",    "Attr" => "use_gotoMimeFilePattern"),
@@ -244,8 +212,8 @@ class mimetype extends plugin
       /* Add gotoMimeFilePattern */
       if(isset($_POST['AddNewFilePattern']) && isset($_POST['NewFilePattern'])){
         if($this->acl_is_writeable("gotoMimeFilePattern")){
-          $str = $_POST['NewFilePattern'];
-          if(!empty($str)){
+          $str = trim($_POST['NewFilePattern']);
+          if($str != ""){
             $this->use_gotoMimeFilePattern[] = $str;
           }
         }
@@ -257,12 +225,12 @@ class mimetype extends plugin
         if($this->acl_is_writeable("gotoMimeApplication")){
           $str = "";
           if(isset($_POST['NewApplicationSelect']) && !empty($_POST['NewApplicationSelect'])){
-            $str = get_post("NewApplicationSelect");
+            $str = trim(get_post("NewApplicationSelect"));
           }
           if(isset($_POST['NewApplication']) && !empty($_POST['NewApplication'])){
-            $str = get_post("NewApplication");
+            $str = trim(get_post("NewApplication"));
           }
-          if(!empty($str) && !in_array($str,$this->use_gotoMimeApplication)){
+          if($str != "" && !in_array($str,$this->use_gotoMimeApplication)){
             $this->use_gotoMimeApplication[] = $str;
           }
         }
@@ -276,12 +244,12 @@ class mimetype extends plugin
         if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
           $str = "";
           if(isset($_POST['NewEmbeddedApplicationSelect']) && !empty($_POST['NewEmbeddedApplicationSelect'])){
-            $str = get_post('NewEmbeddedApplicationSelect');
+            $str = trim(get_post('NewEmbeddedApplicationSelect'));
           }
           if(isset($_POST['NewEmbeddedApplication']) && !empty($_POST['NewEmbeddedApplication'])){
-            $str = get_post('NewEmbeddedApplication');
+            $str = trim(get_post('NewEmbeddedApplication'));
           }
-          if(!empty($str) && !in_array($str,$this->use_gotoMimeEmbeddedApplication)){
+          if($str != "" && !in_array($str,$this->use_gotoMimeEmbeddedApplication)){
             $this->use_gotoMimeEmbeddedApplication[] = $str;
           }
         }
@@ -528,7 +496,7 @@ class mimetype extends plugin
   function check()
   {
     $message = plugin::check();
-    if(empty($this->cn)){
+    if($this->cn == "" ){
       $message[] = msgPool::required(_("Name"));
     }
     if(!count($this->use_gotoMimeFilePattern)){
@@ -542,7 +510,7 @@ class mimetype extends plugin
     if($this->is_release()){
       $base = $this->parent->parent->mime_release;
     }else{
-      $base = get_ou("mimetypeou").$this->base;
+      $base = get_ou("mimetypeRDN").$this->base;
     }
 
     $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$base,array("cn"));