summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f95909e)
raw | patch | inline | side by side (parent: f95909e)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 27 Jun 2007 08:02:34 +0000 (08:02 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 27 Jun 2007 08:02:34 +0000 (08:02 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6712 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_servDNSeditZone.inc | patch | blob | history |
diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc
index 3dbfcec3a6b049d9bea13755b9fc12fd39691ff1..212a41bdc7258ca353630152549b0fba0c5e48dc 100644 (file)
/* Detect Network class */
if(!empty($this->ReverseZone)){
- $addr = preg_replace("/^[^\/]+\//","",$this->ReverseZone);
- if(preg_match("/^[0-9]*\.0\.0\.0$/",$addr)){
- $this->NetworkClass = "A";
- }
- if(preg_match("/^[0-9]*\.[0-9]*\.0\.0$/",$addr)){
- $this->NetworkClass = "B";
- }
- if(preg_match("/^[0-9]*\.[0-9]*\.[0-9]*\.0$/",$addr)){
- $this->NetworkClass = "C";
+
+ $dots = count(split(".",$this->ReverseZone));
+ if($dots == 0){
+ $this->NetworkClass = "A";
+ $this->ReverseZone .= ".0.0.0";
+ }elseif($dots == 1){
+ $this->NetworkClass = "B";
+ $this->ReverseZone .= ".0.0";
+ }else{
+ $this->NetworkClass = "C";
+ $this->ReverseZone .= ".0";
}
}
}
$this->Records [] = $rec;
}
+
$ret['RECORDS'] = $this->Records;
+
+ switch($this->NetworkClass){
+ case 'C' : $ret['ReverseZone']= preg_replace("/\.[0-9]*$/","",$this->ReverseZone);break;
+ case 'B' : $ret['ReverseZone']= preg_replace("/\.[0-9]*\.[0-9]*$/","",$this->ReverseZone);break;
+ case 'A' : $ret['ReverseZone']= preg_replace("/\.[0-9]*\.[0-9]*\.[0-9]*$/","",$this->ReverseZone);break;
+ default : trigger_error("Invalid network class given '".$this->NetworkClass."'");
+ }
$ret['InitialReverseZone']= $this->InitialReverseZone;
$ret['InitialzoneName'] = $this->InitialzoneName;