Example #1
0
//
// create a RQuery if a filter was provided
//
/**
 * @var RQuery $objectFilterRQuery
 */
$objectFilterRQuery = null;
if ($rulesFilter !== null) {
    $objectFilterRQuery = new RQuery('rule');
    $res = $objectFilterRQuery->parseFromString($rulesFilter, $errorMessage);
    if ($res === false) {
        fwrite(STDERR, "\n\n**ERROR** Rule filter parser: " . $errorMessage . "\n\n");
        exit(1);
    }
    print " - Rule filter after sanitization: ";
    $objectFilterRQuery->display();
    print "\n";
}
// --------------------
//
// load the config
//
print " - Loading configuration through PAN-Configurator library... ";
$pan->load_from_domxml($xmlDoc);
print "OK!\n";
// --------------------
//
// Location Filter Processing
//
// <editor-fold desc="Location Filter Processing" defaultstate="collapsed" >
/**@var RuleStore[] $ruleStoresToProcess */
Example #2
0
} else {
    $pan = new PanoramaConf();
}
print " - Detected platform type is '{$configType}'\n";
if ($configInput['type'] == 'api') {
    $pan->connector = $configInput['connector'];
}
$errorMessage = '';
$filterQuery = null;
if (isset(PH::$args['filter'])) {
    $filterQuery = new RQuery('rule');
    if (!$filterQuery->parseFromString(PH::$args['filter'], $errorMessage)) {
        derr($errorMessage);
    }
    print " - rule filter after sanitizing : ";
    $filterQuery->display();
}
//
// load the config
//
print " - loading config... ";
$pan->load_from_domxml($xmlDoc);
print "OK!\n";
// </editor-fold>
//
// Location provided in CLI ?
//
if (isset(PH::$args['location'])) {
    $rulesLocation = PH::$args['location'];
    if (!is_string($rulesLocation) || strlen($rulesLocation) < 1) {
        display_error_usage_exit('"location" argument is not a valid string');