'.$testMatch.' is not valid. ';
echo 'Parameter serviceType is not valid (wms, wfs). ';
die();
}
$serviceType = $testMatch;
$testMatch = NULL;
}
$serviceType= strtoupper($serviceType);
//TODO: Check wether request parameters cannot be found! Since this is not handled, update will not be available!
require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
require_once(dirname(__FILE__)."/../classes/class_wms.php");
?>
';
?>
id) {
echo " Skipped: " . $upd_wmsid . " ";
continue;
}
// update WMS from upload URL
$mywms = new wms();
$result = $mywms->createObjFromXML($uploadUrl);
if (!$result['success']) {
//echo $result['message']; //do nothing first - TODO give negative result!
//die();
} else {
$mywms->optimizeWMS();
echo " ";
if (!MD_OVERWRITE) {
$mywms->overwrite=false;
}
//possibility to see update information in georss and/or twitter channel
if(empty($_POST['twitter_news'])) {
$mywms->twitterNews = false;
}
if(empty($_POST['rss_news'])) {
$mywms->setGeoRss = false;
}
$mywms->updateObjInDB($upd_wmsid);
echo " Updated: " . $upd_wmsid . " ";
}
/*
// start new monitoring for this WMS
$now = time();
$sql = "UPDATE mb_monitor SET status = '-2', status_comment = 'Monitoring is still in progress...', " .
"timestamp_begin = $1, timestamp_end = $2 WHERE upload_id = $3 AND fkey_wms_id = $4";
$v = array($now, $now, $upload_id, $upd_wmsid);
$t = array('s', 's', 's', 'i');
$res = db_prep_query($sql,$v,$t);
$currentFilename = "wms_monitor_report_" . $upload_id . "_" .
$upd_wmsid . "_" . $wmsOwner . ".xml";
$exec = PHP_PATH . "php5 ../../tools/mod_monitorCapabilities_write.php " .
$currentFilename. " 0";
echo exec(escapeshellcmd($exec));
*/
}
echo " Please note: The updated services need to be monitored again in order to update the database.
";
}
break;
case "WFS":
$checkboxes = intval($_POST['cbs']);
for ($i=0; $i < $checkboxes; $i++) {
echo $i;
if (!isset($_POST['cb'.$i]) ||
!isset($_POST['upl_id'.$i])
) {
continue;
}
$upd_wfsid = intval($_POST['cb'.$i]);
$upload_id = intval($_POST['upl_id'.$i]);
if ($upd_wfsid) {
// get upload URL
$sql = "SELECT wfs_upload_url, wfs_owner FROM wfs WHERE wfs_id = $1";
$v = array($upd_wfsid);
$t = array("i");
$res = db_prep_query($sql, $v, $t);
$row = db_fetch_array($res);
$uploadUrl = $row["wfs_upload_url"];
$wfsOwner = $row["wfs_owner"];
if ($wfsOwner !== $user->id) {
echo " Skipped: " . $upd_wfsid . " ";
continue;
}
$id = $upd_wfsid;
$url = $uploadUrl;
//get authentication information from db
$sql = "SELECT wfs_auth_type, wfs_username, wfs_password from wfs WHERE wfs_id = $1 ";
$v = array($id);
$t = array('i');
$res = db_prep_query($sql,$v,$t);
$row = db_fetch_assoc($res);
$auth['auth_type'] = $row["wfs_auth_type"];
$auth['username'] = $row["wfs_username"];
$auth['password'] = $row["wfs_password"];
$wfsFactory = new UniversalWfsFactory();
if ($auth['auth_type'] =='') {
$auth = false;
}
$myWfs = $wfsFactory->createFromUrl($url, $auth);
//if (!MD_OVERWRITE) {
//if($obj->overwrite_md) {
// $myWfs->overwrite = true;
//} else {
$myWfs->overwrite=false;
//}
$myWfs->id = $id;
echo " Updated: " . $upd_wfsid . " ";
/*
// start new monitoring for this WMS
$now = time();
$sql = "UPDATE mb_monitor SET status = '-2', status_comment = 'Monitoring is still in progress...', " .
"timestamp_begin = $1, timestamp_end = $2 WHERE upload_id = $3 AND fkey_wms_id = $4";
$v = array($now, $now, $upload_id, $upd_wmsid);
$t = array('s', 's', 's', 'i');
$res = db_prep_query($sql,$v,$t);
$currentFilename = "wms_monitor_report_" . $upload_id . "_" .
$upd_wmsid . "_" . $wmsOwner . ".xml";
$exec = PHP_PATH . "php5 ../../tools/mod_monitorCapabilities_write.php " .
$currentFilename. " 0";
echo exec(escapeshellcmd($exec));
*/
}
echo " Please note: The updated services need to be monitored again in order to update the database.