resourceType is not valid (wms, wfs, dataset, wmc).
';
die();
}
$resourceType = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["maintenanceFunction"]) & $_REQUEST["maintenanceFunction"] != "") {
$testMatch = $_REQUEST["maintenanceFunction"];
if (!($testMatch == 'reindex' or $testMatch == 'monitor')){
echo 'Parameter maintenanceFunction is not valid (reindex, monitor).
';
die();
}
$maintenanceFunction = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["resourceIds"]) & $_REQUEST["resourceIds"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["resourceIds"];
$pattern = '/^[\d,]*$/';
if (!preg_match($pattern,$testMatch)){
//echo 'resourceIds: '.$testMatch.' is not valid.
';
echo 'Parameter resourceIds is not valid (integer or cs integer list).
';
die();
}
$resourceIds = $testMatch;
$testMatch = NULL;
}
$allowedFunctions = array(
'wms' => array('reindex','monitor'),
'wfs' => array('reindex'),
'dataset' => array('reindex'),
'wmc' => array('reindex')
);
$functionThatNeedIdList = array('monitor');
//check for allowedFunction
if (!in_array($maintenanceFunction, $allowedFunctions[$resourceType])) {
echo 'Maintenance function not allowed for requested resource type.
';
die();
}
//check for given id if demanded
/*if (in_array($maintenanceFunction, $functionThatNeedIdList) && !isset($resourceIds)) {
echo 'Maintenance function need parameter resourceIds, but this is not given.
';
die();
}*/
?>