Code

Move from "none" to "$name" as requested
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Nov 2006 07:09:19 +0000 (07:09 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Nov 2006 07:09:19 +0000 (07:09 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5025 594d385d-05f5-0310-b6e9-bd551577e9d8

Changelog
include/functions.inc
plugins/admin/systems/class_divListSystem.inc
plugins/admin/systems/class_systemManagement.inc
plugins/admin/systems/class_termDNS.inc

index e0ca4c2f65d6fb8c9b85fd1b690c95052a61388f..d20c453af1bacaa08a8d354b58ad8594b468a8a4 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -3,8 +3,8 @@ GOsa2 changelog
 
 * gosa 2.5.6
   - Fixed endless javascript loop in setup.php
-  - Fixed setup.php to have no loops in certain cases
   - Avoid tab lables to have line feeds
+  - Activated missing checks for IP and MAC
 
 * gosa 2.5.5
   - Added remove method for shared folder in kolab mode
index 354d92816acfbbdbdedb88b5b2ed30db3c58bf2e..a4b89396010526feb8919df0ef05683026ce6abf 100644 (file)
@@ -986,6 +986,13 @@ function is_ip($ip)
   return preg_match("/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $ip);
 }
 
+
+function is_mac($mac)
+{
+  return preg_match("/^[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$/i", $mac);
+}
+
+
 /* Checks if the given ip address doesn't match
     "is_ip" because there is also a sub net mask given */
 function is_ip_with_subnetmask($ip)
index b58169262f276e3faa9c0676a3cad729f78edfcb..c5665751c8d9a00b726c01262ab5b7c419e0ba68 100644 (file)
@@ -50,7 +50,7 @@ class divListSystem extends MultiSelectWindow
     /* set Page header */
     $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
     $this->AddHeader(array("string"=>_("System / Department")));
-    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:60px;border-right:0px;'"));
+    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:70px;border-right:0px;'"));
 
     /*                  Text        ,Value    ,Name         ,Is selected */
     $this->AddCheckBox("ShowServers",         _("Select to see servers"),            _("Show servers"),          true);
@@ -175,6 +175,10 @@ class divListSystem extends MultiSelectWindow
         $action2 = "";
       }
 
+      if(in_array("gotoWorkstation",$val['objectClass'])){
+        $action2= "<input class='center' type='image' src='images/cdrom.png' alt='"._("Create CD")."'   name='gen_cd_%KEY%' title='"._("Create FAI CD")."'>".$action2;
+      }
+
       if(isset($val['message'])){
         $display.= "  (".$val['message']." '".$this->config->idepartments[$_SESSION['CurrentMainBase']]."'  )";
       }
@@ -182,7 +186,7 @@ class divListSystem extends MultiSelectWindow
       $img    = $this->parent->convert_list($val);
       $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'");
       $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
-      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:70px;border-right:0px;text-align:right;'");
       $this->AddElement( array($field1,$field2,$field3));
     }
 
index 2a959b8bb1e4445e8b195f57397b6fffa4c09ef2..9a1b941a230c1ef7c7145d6dd6c34319784ab119 100644 (file)
@@ -83,6 +83,9 @@ class systems extends plugin
       }elseif(preg_match("/user_setpwd_.*/i",$key)){
         $s_action="change_pw";
         $s_entry  = preg_replace("/user_setpwd_/i","",$key);
+      }elseif(preg_match("/gen_cd_.*/i",$key)){
+        $s_action="gen_cd";
+        $s_entry  = preg_replace("/gen_cd_/i","",$key);
       }elseif(preg_match("/newsystem_.*/i",$key)){
         $s_action="newsystem";
         $s_entry  = preg_replace("/newsystem_/i","",$key);
@@ -219,6 +222,16 @@ class systems extends plugin
       }
     }
 
+    /********************
+      Create FAI CD ...   
+     ********************/
+    if ($s_action=="gen_cd"){
+      $this->dn= $this->terminals[$s_entry]['dn'];
+      $_SESSION['objectinfo']= $this->dn;
+      return ($smarty->fetch(get_template_path('gencd.tpl', TRUE)));
+    }
+
+
 
     /********************
       Change password ...   
index 74a7183e59187bc7524da99b304ae6c566148ec6..fc55c61d73bbc67e2f7765b787c92accb2f5b258 100644 (file)
@@ -298,12 +298,11 @@ class termDNS extends plugin
         $message[]= _("The required field 'IP-address' is not set.");
       }
 
-      /* check if given ip is valid ipi
-       */
-      $num="(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
-      if (!preg_match("/^$num\\.$num\\.$num\\.$num$/", $this->ipHostNumber)){
-        $message[]= _("Wrong IP format in field IP-address.");
-      }
+    }
+
+    /* check if given ip is valid ip */
+    if ($this->ipHostNumber != "" && !is_ip($this->ipHostNumber)){
+      $message[]= _("Wrong IP format in field IP-address.");
     }
 
     /* Check if mac is empty 
@@ -314,8 +313,7 @@ class termDNS extends plugin
 
     /* Check if given mac is valid mac 
      */
-    $tr = count(split(":",$this->macAddress));
-    if($tr!=6){
+    if(!is_mac($this->macAddress)){
       $message[]=(_("The given macaddress is invalid. There must be 6 2byte segments seperated by ':'."));
     }