Code

Ported changes from yesterday.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 26 Oct 2007 06:13:45 +0000 (06:13 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 26 Oct 2007 06:13:45 +0000 (06:13 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7668 594d385d-05f5-0310-b6e9-bd551577e9d8

12 files changed:
include/class_hostActionQueue.inc
include/functions.inc
plugins/addons/gotomasses/class_divListMasses.inc
plugins/admin/ogroups/tabs_ogroups.inc
plugins/admin/systems/class_componentGeneric.inc
plugins/admin/systems/class_phoneGeneric.inc
plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/class_printerPPDDialog.inc
plugins/admin/systems/class_servGeneric.inc
plugins/admin/systems/class_terminalGeneric.inc
plugins/admin/systems/class_workstationGeneric.inc
plugins/admin/systems/class_workstationStartup.inc

index 59ca97dde940f913ad2185782c91d9591ff50a13..c32be66ae6821f9ddc0803b84ccebfa239378808 100644 (file)
@@ -110,20 +110,20 @@ class hostActionQueue {
         continue;
       }
 
-      $entry_id = $task_id= 0;    
+      $entry_id = $task_id= "";    
   
       /* Comment must be set correctly */
       if(empty($comment)){
         $desc     = "";
       }else{
-        $task_id =preg_replace("/^.*taskid:([0-9]*).*$/","\\1",$comment);
-        $entry_id=preg_replace("/^.*entryid:([0-9]*).*$/","\\1",$comment);
+        $task_id =preg_replace("/^.*taskid:([0-9a-z]*).*$/i","\\1",$comment);
+        $entry_id=preg_replace("/^.*entryid:([0-9a-z]*).*$/i","\\1",$comment);
         $desc    =preg_replace("/^.*desc:(.*)$/","\\1",$comment);
       }
-      if($task_id == 0 || empty($task_id)){ 
+      if($task_id == "" || empty($task_id)){ 
         $task_id  = $this->get_new_id();
       }
-      if($entry_id == 0 || empty($entry_id)){
+      if($entry_id == "" || empty($entry_id)){
         $entry_id = $this->get_new_id();
       }
    
@@ -254,9 +254,9 @@ class hostActionQueue {
     return(TRUE);
   }
 
-  private function _add_entry($entry,$task_id = 0)
+  private function _add_entry($entry,$task_id = "")
   {
-    if($task_id == 0 || empty($task_id)){
+    if($task_id == "" || empty($task_id)){
       $task_id = $this->get_new_id();
     }
     $entry['TASK_ID'] = $task_id;
index 423fb28e3659626511b236c2f878d65323333669..adf7cf60a41d858768e89f6787ccf9ade05909a0 100644 (file)
@@ -905,6 +905,10 @@ function is_phone_nr($nr)
   return preg_match ("/^[\/0-9 ()+*-]+$/", $nr);
 }
 
+function is_dns_name($str)
+{
+  return(preg_match("/^[a-z0-9\.\-]*$/i",$str));
+}
 
 function is_url($url)
 {
index 9a17bffdcc39377ce7902dbff46a01ba7ff51be7..f32f76b514f44a113f813425db52c87f925224ea 100644 (file)
@@ -113,8 +113,6 @@ class divListMasses extends MultiSelectWindow
         continue;
       }
 
-      
-
       /* Handle coloring */
       $color="";
       if($this->parent->sort_by == "TaskID"){
index b87ff78f69b42b48ad469b1bad161d03e55b5b38..d820aa5b8fda87ae75e8830eeb19cac56f70573b 100644 (file)
@@ -101,11 +101,13 @@ class ogrouptabs extends tabs
         $this->by_object['workservice']= new workservice($this->config, $this->dn);
         $this->by_object['workservice']->inheritTimeServer = false;
         $this->by_object['workservice']->parent= &$this;
+        $this->by_object['workservice']->acl = "#all#";
     }
     if((preg_match("/S/",$objects) || preg_match("/W/",$objects))&&(!isset($this->by_object['workstartup']))){
         $this->by_name['workstartup']= _("Startup");
         $this->by_object['workstartup']= new workstartup($this->config, $this->dn);
         $this->by_object['workstartup']->parent= &$this;
+        $this->by_object['workstartup']->acl = "#all#";
         $this->by_name['faiSummary']= _("Summary");
         $this->by_object['faiSummary']= new faiSummaryTab($this->config, $this->dn);
         $this->by_object['faiSummary']->parent= &$this;
index 3bd61a220223075da09e684a1a288e4182e5656e..4306494b3bc34f7f262f642c1112a381d6e2fd5a 100644 (file)
@@ -186,6 +186,11 @@ class componentGeneric extends plugin
       $message[]= _("The required field 'Component name' is not set.");
     }
 
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn) && chkacl ($this->acl, "cn") == ""){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
     /* To check for valid ip*/
     if($this->netConfigDNS->ipHostNumber == ""){
        $message[]= _("The required field IP address is empty.");
index a505fa931789b06289433571796226f5417db921..021990c8af199973c958cf2012af98bb50b628c6 100644 (file)
@@ -334,6 +334,11 @@ class phoneGeneric extends plugin
       }
     }
 
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn) && chkacl ($this->acl, "cn") == ""){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
     if ($this->cn == ""){
       $message[]= _("The required field 'Phone name' is not set.");
     }
index 55407a07e67f953d82e6de0dc5bc2be5430f3797..ec922b9fe332a9e3c7f4ef0df6cb4ea07ef79c11 100644 (file)
@@ -666,8 +666,13 @@ class printgeneric extends plugin
     $dn= "cn=".$this->cn.",ou=printers,ou=systems,".$this->base;
 
     /* must: cn */
-    if(preg_match("/printer/i",$this->BelongsTo) && (empty($this->cn))){
-      $message[]= "The required field 'Printer name' is not set.";
+    if(($this->BelongsTo == "Printer") && (empty($this->cn))){
+      $message[]= _("The required field 'Printer name' is not set.");
+    }
+
+    /* must: cn */
+    if(($this->BelongsTo == "Printer") && !is_dns_name($this->cn)){
+      $message[]= _("Invalid character in printer name.");
     }
 
     /* must: labeledURI */
@@ -731,10 +736,12 @@ class printgeneric extends plugin
       $this->PPDdialogToSave->save_ppd();
     }
     if($this->orig_dn != $this->dn){
-      $this->PPDdialogToSave = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
-      $this->PPDdialogToSave->cn = $this->cn;
-      $this->PPDdialogToSave->generateProperties();
-      $this->PPDdialogToSave->update_ppd_url();
+      if(!empty($this->gotoPrinterPPD)) {
+        $this->PPDdialogToSave = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
+        $this->PPDdialogToSave->cn = $this->cn;
+        $this->PPDdialogToSave->generateProperties();
+        $this->PPDdialogToSave->update_ppd_url();
+      }
     }
 
     /* Remove previously selected ppd file.*/
index 1863d8deb7d8219c50742f42e5377257854297c8..a867c707536aa141e9f7fcce27e0751df96841c9 100644 (file)
@@ -339,7 +339,7 @@ class printerPPDDialog extends plugin
   function getPrinterReload()
   {
     if(is_readable($this->pathToPPD)){
-      $tmp = $this->ppdManager->getPrinterList(true);
+      $tmp = @$this->ppdManager->getPrinterList(true);
 
       $this->ppdListHeader = $this->ppdList = array();
 
index de16b1d526aed09bcf83e9a347c1e8e3b30b2100..cf0eeffd901efacb958eb79d8d49434b31cb3cf0 100644 (file)
@@ -296,6 +296,11 @@ class servgeneric extends plugin
       $message[]= _("The required field 'Server name' is not set.");
     }
     
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn) && chkacl ($this->acl, "cn") == ""){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
     if ($this->orig_dn != $this->dn){
       $ldap= $this->config->get_ldap_link();
       $ldap->cd ($this->base);
index b0c2e4c679f8f5e49ca0bb6826abd88c7fcc510e..f10770f3e8db4ea045deb068c124e84df28ee11f 100644 (file)
@@ -454,6 +454,11 @@ class termgeneric extends plugin
       $message[]= _("The required field 'Terminal name' is not set.");
     }
 
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn) && chkacl ($this->acl, "cn") == ""){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
     if ($this->orig_dn == 'new'){
       $ldap= $this->config->get_ldap_link();
       $ldap->cd ($this->base);
index 5b5a58a6c54cd1c54800664159b908cebb789cd3..a19cd8617f9b602fa330ef2b2f250aa00529798c 100644 (file)
@@ -435,6 +435,11 @@ class workgeneric extends plugin
       $message[]= _("The required field 'Workstation name' is not set.");
     }
 
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn) && chkacl ($this->acl, "cn") == ""){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
     if ($this->orig_dn != $this->dn){
       $ldap= $this->config->get_ldap_link();
       $ldap->cd ($this->base);
index 6e72439f91a8fb50cb3b7cceaf9bed3a8cebf000..4105b26bc8406b8ae0b42113f16901975e833dc9 100644 (file)
@@ -949,7 +949,7 @@ class workstartup extends plugin
       }else{
         $tmp = $this->getFAIreleases();
         foreach($tmp as $release => $data){
-          if(isset($rest['RELEASE'][$release])){
+          if(isset($rest['RELEASE'][$release]) && $release == $this->FAIrelease){
             $use = $data['USE']; 
           }
         }