Code

Updated dhcp stuff to be compatible with PHP4.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 20 Aug 2007 09:21:56 +0000 (09:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 20 Aug 2007 09:21:56 +0000 (09:21 +0000)
No static variables in classes and no static variable calls.
Class names will always be returned as lowercase.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7072 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_dhcpNewSectionDialog.inc
plugins/admin/systems/class_servDHCP.inc

index 32291f83e451f635e208fbe7cbdcdee942abe71b..e2235d3728924a5cfdb047772a520778ec2baba5 100644 (file)
@@ -10,7 +10,7 @@ class dhcpNewSectionDialog extends plugin
   /* Mapping array */
   var $types= array();
   var $classtype= "";
-  static $sectionMap= array(  "dhcpService" => array("dhcpSharedNetwork", "dhcpSubnet", "dhcpGroup", "dhcpHost" /*, "dhcpClass"*/),
+  var $sectionMap= array(  "dhcpService" => array("dhcpSharedNetwork", "dhcpSubnet", "dhcpGroup", "dhcpHost" /*, "dhcpClass"*/),
                               #"dhcpClass" => array("dhcpSubClass"),
                               "dhcpSubClass" => array(),
                               "dhcpHost" => array(),
@@ -41,7 +41,7 @@ class dhcpNewSectionDialog extends plugin
     $smarty = get_smarty();
     $display= "";
 
-    $sections= dhcpNewSectionDialog::$sectionMap[$this->classtype];
+    $sections= $this->sectionMap[$this->classtype];
     $t_sections= array();
     foreach ($sections as $section){
       $t_sections[$section]= $this->types[$section]; 
index d9c571f1d752ae83ac09dd9cfc3b7afdd9324832..742ae553962f93849e3d3a44ff277913fd4fc022 100644 (file)
@@ -28,6 +28,12 @@ class servdhcp extends plugin
             "dhcpFailOverPeer" => _("Failover peer"),
             "dhcpSharedNetwork" => _("Shared network"));
 
+
+    /* Backport: PHP4 compatibility  */
+    foreach($this->types as $type => $translation){
+           $this->types[strtolower($type)] = $translation;
+    }
+
     /* Load information about available services */
     $this->reload(); 
     if (!count($this->dhcpSections)){
@@ -48,7 +54,8 @@ class servdhcp extends plugin
     /* Section Creation? */
     if (isset($_POST['create_section']) && isset($_POST['section'])){
       $section= $_POST['section'];
-      if (isset(dhcpNewSectionDialog::$sectionMap[$section])){
+      $tmp = new dhcpNewSectionDialog(NULL);
+      if (isset($tmp->sectionMap[$section])){
         $this->dialog= new $section($this->current_object);
         $this->current_object= "";
       } else {
@@ -237,8 +244,11 @@ class servdhcp extends plugin
       "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>";
     $editImg = "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>".
       "<input type='image' src='images/edittrash.png' name='delDhcp_%s' title='"._("Remove DHCP section")."'>";
+       
+    $tmp = new dhcpNewSectionDialog(NULL);
     foreach($this->dhcpSections as $section => $values ){
-      if (count(dhcpNewSectionDialog::$sectionMap[$this->objectType($section)])){
+       
+      if (count($tmp->sectionMap[$this->objectType($section)])){
         if ($this->objectType($section) == "dhcpService"){
           $DhcpList->AddEntry(array(
               array("string" => $values),