public function AppOverrideRule($owner, $fromTemplateXML = false) { $this->owner = $owner; $this->findParentAddressStore(); $this->init_tags_with_store(); $this->init_from_with_store(); $this->init_to_with_store(); $this->init_source_with_store(); $this->init_destination_with_store(); if ($fromTemplateXML) { $xmlElement = DH::importXmlStringOrDie($owner->xmlroot->ownerDocument, self::$templatexml); $this->load_from_domxml($xmlElement); } }
/** * @param RuleStore $owner * @param bool $fromTemplateXML */ public function NatRule($owner, $fromTemplateXML = false) { $this->owner = $owner; $this->findParentAddressStore(); $this->findParentServiceStore(); $this->init_tags_with_store(); $this->init_from_with_store(); $this->init_to_with_store(); $this->init_source_with_store(); $this->init_destination_with_store(); $this->snathosts = new AddressRuleContainer($this); $this->snathosts->name = 'snathosts'; if ($fromTemplateXML) { $xmlElement = DH::importXmlStringOrDie($owner->xmlroot->ownerDocument, self::$templatexml); $this->load_from_domxml($xmlElement); } }
public function createVirtualSystem($vsysID, $displayName = '') { if (!is_numeric($vsysID)) { derr("new vsys id must be an integer but '{$vsysID}' was provided"); } $newVsysName = 'vsys' . $vsysID; if ($this->findVirtualSystem($newVsysName) !== null) { derr("cannot create '{$newVsysName}' because it already exists"); } $xmlNode = DH::importXmlStringOrDie($this->xmldoc, VirtualSystem::$templateXml); $xmlNode->setAttribute('name', $newVsysName); if (strlen($displayName) > 0) { DH::createElement($xmlNode, 'display-name', $displayName); } $this->vsyssroot->appendChild($xmlNode); $newVsys = new VirtualSystem($this); $newVsys->load_from_domxml($xmlNode); $this->virtualSystems[] = $newVsys; return $newVsys; }
$newXpath = implode('/', $newXpath); $xpathResultsLocal = $xpathQlocal->query($newXpath); if ($xpathResultsLocal->length != 1) { derr('unsupported, debug xpath query: ' . $newXpath); } $newNode = $doc->importNode($xpathResults->item(0), true); $localParentNode = $xpathResultsLocal->item(0); $localParentNode->appendChild($newNode); continue; } //derr('unsupported'); } } if (isset(PH::$args['injectuseradmin2'])) { $usersNode = DH::findXPathSingleEntryOrDie('/config/mgt-config/users', $doc); $newUserNode = DH::importXmlStringOrDie($doc, '<entry name="admin2"><phash>$1$bgnqjgob$HmenJzuuUAYmETzsMcdfJ/</phash><permissions><role-based><superuser>yes</superuser></role-based></permissions></entry>'); $usersNode->appendChild($newUserNode); } if ($debugAPI) { $configOutput['connector']->setShowApiCalls(true); } if ($configOutput['filename'] !== null) { $saveName = $configOutput['filename']; } else { $saveName = 'stage0.xml'; } print "{$configOutput['connector']->apihost}/{$saveName} ... "; $configOutput['connector']->uploadConfiguration(DH::firstChildElement($doc), $saveName, false); } } else { derr('not supported yet');