public function setDNAT($host, $ports = null) { if (is_null($host)) { derr(" Host cannot be NULL"); } if (!is_null($this->dnathost)) { $this->dnathost->removeReference($this); } if (!isset($this->dnatroot) || $this->dnatroot === FALSE) { $this->dnatroot = $this->xmlroot->ownerDocument->createElement('destination-translation'); } if (!isset($this->dnatrootTAroot) || $this->dnatrootTAroot === FALSE) { $this->subdnatTAroot = $this->xmlroot->ownerDocument->createElement('translated-address'); } if (!isset($this->dnatrootTAroot) || $this->dnatrootTAroot === FALSE) { $this->subdnatTProot = $this->xmlroot->ownerDocument->createElement('translated-port'); } if (!is_null($host)) { $this->dnatroot = $this->xmlroot->appendChild($this->dnatroot); $this->subdnatTAroot = $this->dnatroot->appendChild($this->subdnatTAroot); DH::setDomNodeText($this->subdnatTAroot, $host->name()); } $this->dnathost = $host; $this->dnathost->addReference($this); $this->dnatports = $ports; if (is_null($ports)) { DH::removeChild($this->dnatroot, $this->subdnatTProot); } else { $this->subdnatTProot = $this->dnatroot->appendChild($this->subdnatTProot); setDomNodeText($this->subdnatTProot, $ports); } }
public function rewriteSecProfXML() { if ($this->secprofroot !== null) { DH::clearDomNodeChilds($this->secprofroot); } if ($this->secproftype == 'group') { if ($this->secprofroot === null || $this->secprofroot === false) { $this->secprofroot = DH::createElement($this->xmlroot, 'profile-setting'); } else { $this->xmlroot->appendChild($this->secprofroot); } $tmp = $this->secprofroot->ownerDocument->createElement('group'); $tmp = $this->secprofroot->appendChild($tmp); $tmp = $tmp->appendChild($this->secprofroot->ownerDocument->createElement('member')); $tmp->appendChild($this->secprofroot->ownerDocument->createTextNode($this->secprofgroup)); } else { if ($this->secproftype == 'profiles') { if ($this->secprofroot === null || $this->secprofroot === false) { $this->secprofroot = DH::createElement($this->xmlroot, 'profile-setting'); } else { $this->xmlroot->appendChild($this->secprofroot); } $tmp = $this->secprofroot->ownerDocument->createElement('profiles'); $tmp = $this->secprofroot->appendChild($tmp); foreach ($this->secprofprofiles as $index => $value) { $type = $tmp->appendChild($this->secprofroot->ownerDocument->createElement($index)); $ntmp = $type->appendChild($this->secprofroot->ownerDocument->createElement('member')); $ntmp->appendChild($this->secprofroot->ownerDocument->createTextNode($value)); } } elseif ($this->secprofroot !== null) { DH::removeChild($this->xmlroot, $this->secprofroot); } } }