private function &getBaseXPath() { $str = ''; $class = get_class($this->owner); if ($class == 'PanoramaConf' || $class == 'PANConf') { $str = "/config/shared"; } else { $str = $this->owner->getXPath(); } return $str; }
public function &getXPath(Rule $contextRule) { $class = get_class($this->owner); $serial = spl_object_hash($contextRule); $str = ''; if ($class == 'VirtualSystem') { $str = $this->owner->getXPath() . '/rulebase'; } else { if ($class == 'DeviceGroup') { if ($contextRule->isPreRule()) { $str = $this->owner->getXPath() . '/pre-rulebase'; } else { if ($contextRule->isPostRule()) { $str = $this->owner->getXPath() . '/post-rulebase'; } else { derr('unsupported mode'); } } } else { if ($class == 'PANConf') { derr('unsupported'); } else { if ($class == 'PanoramaConf') { if ($contextRule->isPreRule()) { $str = "/config/shared/pre-rulebase"; } else { if ($contextRule->isPostRule()) { $str = "/config/shared/post-rulebase"; } else { derr('unsupported mode'); } } } else { derr('unsupported mode'); } } } } $str .= '/' . self::$storeNameByType[$this->type]['xpathRoot'] . '/rules'; return $str; }
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; }