id;
//check for parameter wmc_id
if(!isset($_GET["wmc_id"])){
echo 'Error: wmc_id not requested
';
die();
//must leave script
}
function _e ($str) {
return htmlentities($str, ENT_QUOTES, CHARSET);
}
if (!$userId) {
$userId = PUBLIC_USER;
}
if (isset($_REQUEST["wmc_id"]) & $_REQUEST["wmc_id"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["wmc_id"];
$pattern = '/^[0-9_]*$/';
if (!preg_match($pattern,$testMatch)){
echo 'wmc_id: '.$testMatch.' is not valid.
';
die();
}
$wmc_id = $testMatch;
$testMatch = NULL;
}
//dummy parameter for drawing georss points:
$pointRadius = "10";
$fillColor = "#666666"; //grey
if (isset($_REQUEST["pointRadius"]) & $_REQUEST["pointRadius"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["pointRadius"];
$pattern = '/^[0-9]{2}|^[1-9]{1}$/';
if (!preg_match($pattern,$testMatch)){
echo 'pointRadius: '.$testMatch.' is not valid.
';
die();
}
$pointRadius = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["fillColor"]) & $_REQUEST["fillColor"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["fillColor"];
$pattern = '/^#[0-9a-f]{3}|#[0-9a-f]{6}$/';
if (!preg_match($pattern,$testMatch)){
echo 'fillColor: '.$testMatch.' is not valid.
';
die();
}
$fillColor = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["markerUrl"]) & $_REQUEST["markerUrl"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["markerUrl"];
$pattern = '/^[\d,]*$/';
if (!preg_match($pattern,$testMatch)){
echo 'markerUrl: '.$testMatch.' is not valid.
';
die();
}
$fillColor = $testMatch;
$testMatch = NULL;
}
//**************************************************************************
//functions which may be integrated from class_administration
function getWmsGetMapUrl($wmsId){
$sql = "SELECT wms_getmap FROM wms WHERE wms_id =$1";
$v = array($wmsId);
$t = array("i");
$res = db_prep_query($sql,$v,$t);
if ($row = db_fetch_array($res)){
return $row['wms_getmap'];
} else {
return false;
}
}
//end of functions which may be included from class_administration in next versions
//**************************************************************************
//Function to create an OpenLayers Javascript from a mapbender wmc document
function createOlFromWMC_id($wmc_id, $pointRadius, $fillColor){
//$myWmc = new wmc();
global $user;
global $userId;
global $admin;
//Get WMC out of mb Database
$sql = "SELECT wmc, wmc_serial_id FROM mb_user_wmc WHERE wmc_serial_id = $1";
$res = db_prep_query($sql, array($wmc_id), array("s"));
$wmc = db_fetch_row($res);
//control if wmc was found else use old wmc_id
if (!$wmc[0]) {
$sql = "SELECT wmc, wmc_serial_id FROM mb_user_wmc WHERE wmc_id = $1";
$res = db_prep_query($sql, array($wmc_id), array("s"));
$wmc = db_fetch_row($res);
//echo "Wmc with this id was not found in Database!
";
//die;
}
//generate wmc object and update urls of services in this object:
$wmcId = $wmc[1];
//$myWmc->createFromDb($wmcId);
//$updatedWmc = $myWmc->updateUrlsFromDb();//TODO: check why this functions need a session??
//Read out WMC into XML object
$xml=simplexml_load_string($wmc[0], "SimpleXMLElement", LIBXML_NOBLANKS);
if ($_REQUEST['withoutBody'] == '1') {
} else {
//generate general html data
$html='';
$html.="\n";
$html.="