Пример #1
0
 public function rewriteXML()
 {
     if ($this->xmlroot !== null) {
         DH::clearDomNodeChilds($this->xmlroot);
         foreach ($this->o as $o) {
             $this->xmlroot->appendChild($o->xmlroot);
         }
     }
 }
Пример #2
0
 public function rewriteXML()
 {
     if ($this->isTmpAddr()) {
         return;
     }
     DH::clearDomNodeChilds($this->xmlroot);
     $tmp = DH::createElement($this->xmlroot, self::$AddressTypes[$this->type], $this->value);
     if ($this->_description !== null && strlen($this->_description) > 0) {
         DH::createElement($this->xmlroot, 'description', $this->_description);
     }
 }
 public function rewriteServiceGroupStoreXML()
 {
     DH::clearDomNodeChilds($this->servgroot);
     foreach ($this->servg as $s) {
         $this->servgroot->appendChild($s->xmlroot);
     }
 }
Пример #4
0
 public function rewriteXML()
 {
     if ($this->xmlroot !== null) {
         DH::clearDomNodeChilds($this->xmlroot);
         foreach ($this->o as $zone) {
             if (!$zone->isTmp()) {
                 $this->xmlroot->appendChild($zone->xmlroot);
             }
         }
     }
 }
 public function rewriteAddressGroupStoreXML()
 {
     DH::clearDomNodeChilds($this->addrgroot);
     foreach ($this->addrg as $s) {
         $this->addrgroot->appendChild($s->xmlroot);
     }
 }
Пример #6
0
 /**
  *
  *
  */
 public function rewriteService_XML()
 {
     DH::clearDomNodeChilds($this->serviceroot);
     if (is_null($this->service)) {
         DH::setDomNodeText($this->serviceroot, 'any');
         return;
     }
     DH::setDomNodeText($this->serviceroot, $this->service->name());
 }
Пример #7
0
 public function rewriteXML()
 {
     if ($this->xmlroot === null) {
         return;
     }
     DH::clearDomNodeChilds($this->xmlroot);
     foreach ($this->o as $o) {
         if (!$o->isTmp()) {
             $this->xmlroot->appendChild($o->xmlroot);
         }
     }
 }
Пример #8
0
 static function setDomNodeText(DOMNode $node, $text)
 {
     DH::clearDomNodeChilds($node);
     $node->appendChild($node->ownerDocument->createTextNode($text));
 }
Пример #9
0
 /**
  * @param string $newProtocol
  */
 public function setProtocol($newProtocol)
 {
     if ($newProtocol != 'tcp' || $newProtocol != 'udp') {
         derr("unsupported protocol '{$newProtocol}'");
     }
     if ($newProtocol == $this->_protocol) {
         return;
     }
     $this->_protocol = $newProtocol;
     DH::clearDomNodeChilds($this->protocolRoot);
     $this->tcpOrUdpRoot = DH::createElement($this->protocolRoot, $this->_protocol);
     DH::createElement($this->tcpOrUdpRoot, 'port', $this->_dport);
     if (strlen($this->_sport) > 0) {
         DH::createElement($this->tcpOrUdpRoot, 'source-port', $this->_dport);
     }
 }
Пример #10
0
 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);
         }
     }
 }
Пример #11
0
 /**
  * Rewrite XML for this object, useful after a batch editing to save computing time.
  * You should not need to call it by yourself in normal situations
  *
  */
 public function rewriteXML()
 {
     DH::clearDomNodeChilds($this->xmlroot);
     foreach ($this->rules as $rule) {
         $this->xmlroot->appendChild($rule->xmlroot);
     }
     if ($this->isPreOrPost) {
         DH::clearDomNodeChilds($this->postRulesRoot);
         foreach ($this->postRules as $rule) {
             $this->postRulesRoot->appendChild($rule->xmlroot);
         }
     }
 }
 public function rewriteXML()
 {
     if ($this->xmlroot === null) {
         return;
     }
     if ($this->xmlroot !== null && $this->name == 'snathosts' && count($this->o) == 0) {
         DH::clearDomNodeChilds($this->xmlroot);
     } else {
         DH::Hosts_to_xmlDom($this->xmlroot, $this->o, 'member', true);
     }
 }