From a94ec5e2e3ef053c5884c51fa5cc6be348391797 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 20 Aug 2007 09:21:56 +0000 Subject: [PATCH] Updated dhcp stuff to be compatible with PHP4. 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 --- .../admin/systems/class_dhcpNewSectionDialog.inc | 4 ++-- plugins/admin/systems/class_servDHCP.inc | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/plugins/admin/systems/class_dhcpNewSectionDialog.inc b/plugins/admin/systems/class_dhcpNewSectionDialog.inc index 32291f83e..e2235d372 100644 --- a/plugins/admin/systems/class_dhcpNewSectionDialog.inc +++ b/plugins/admin/systems/class_dhcpNewSectionDialog.inc @@ -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]; diff --git a/plugins/admin/systems/class_servDHCP.inc b/plugins/admin/systems/class_servDHCP.inc index d9c571f1d..742ae5539 100644 --- a/plugins/admin/systems/class_servDHCP.inc +++ b/plugins/admin/systems/class_servDHCP.inc @@ -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 ""; $editImg = "". ""; + + $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), -- 2.30.2