'.$testMatch.' is not valid.
';
die();
}
$type = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["outputFormat"]) & $_REQUEST["outputFormat"] != "") {
$testMatch = $_REQUEST["outputFormat"];
if (!($testMatch == 'html' or $testMatch == 'json')){
echo 'outputFormat: '.$testMatch.' is not valid.
';
die();
}
$outputFormat = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["scale"]) & $_REQUEST["scale"] != "") {
$testMatch = $_REQUEST["scale"];
if (!($testMatch == 'linear')){
echo 'scale: '.$testMatch.' is not valid.
';
die();
}
$scale = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["maxObjects"]) & $_REQUEST["maxObjects"] != "") {
$testMatch = $_REQUEST["maxObjects"];
if (!(($testMatch == '10') or ($testMatch == '15') or ($testMatch == 20) or ($testMatch == '25') or ($testMatch == '30'))){
echo 'maxObjects: '.$testMatch.' is not valid.
';
die();
}
$maxObjects = (integer)$testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["maxFontSize"]) & $_REQUEST["maxFontSize"] != "") {
$testMatch = $_REQUEST["maxFontSize"];
if (!(($testMatch == '10') or ($testMatch == '20') or ($testMatch == '30') or ($testMatch == '40'))){
echo 'maxFontSize: '.$testMatch.' is not valid.
';
die();
}
$maxFontSize = (integer)$testMatch;
$testMatch = NULL;
}
//
if (isset($_REQUEST["languageCode"]) & $_REQUEST["languageCode"] != "") {
//validate to wms, wfs
$testMatch = $_REQUEST["languageCode"];
if (!($testMatch == 'de' or $testMatch == 'en' or $testMatch == 'fr')){
echo 'languageCode: '.$testMatch.' is not valid.
';
die();
}
$languageCode = $testMatch;
$testMatch = NULL;
}
/*
if (isset($_REQUEST["hostName"]) & $_REQUEST["hostName"] != "") {
//validate to some hosts
$testMatch = $_REQUEST["hostName"];
if (!($testMatch == 'www.geoportal.rlp' or $testMatch == 'www.geoportal.rlp.de' or $testMatch == 'www.gdi-rp-dienste3.rlp.de' or $testMatch == '10.7.101.151' or $testMatch == '10.7.101.252' )){
echo 'hostName: '.$testMatch.' is not a valid server of gdi-rp.
';
die();
}
$hostName = $testMatch;
$testMatch = NULL;
}
*/
if (isset($_REQUEST["hostName"]) & $_REQUEST["hostName"] != "") {
//validate to some hosts
$testMatch = $_REQUEST["hostName"];
//look for whitelist in mapbender.conf
$HOSTNAME_WHITELIST_array = explode(",",HOSTNAME_WHITELIST);
if (!in_array($testMatch,$HOSTNAME_WHITELIST_array)) {
echo "Requested hostname ".$testMatch." not whitelist! Please control your mapbender.conf.";
$e = new mb_notice("Whitelist: ".HOSTNAME_WHITELIST);
$e = new mb_notice($testMatch." not found in whitelist!");
die();
}
$hostName = $testMatch;
$testMatch = NULL;
}
if ($outputFormat == 'json'){
$classJSON = new Mapbender_JSON;
}
if ($languageCode == 'en'){
$pathToSearchScript = '/portal/en/service/search.html?cat=dienste&searchfilter=';
}
if ($type == 'keywords'){
$sql = "select a.keyword, sum(a.count) from (";
$sql .= "(select keyword, count(*) from keyword INNER JOIN layer_keyword ON (layer_keyword.fkey_keyword_id = keyword.keyword_id) GROUP BY keyword.keyword) union ";
$sql .= "(select keyword, count(*) from keyword INNER JOIN wmc_keyword ON (wmc_keyword.fkey_keyword_id = keyword.keyword_id) GROUP BY keyword.keyword) union ";
$sql .= "(select keyword, count(*) from keyword INNER JOIN wfs_featuretype_keyword ON (wfs_featuretype_keyword.fkey_keyword_id = keyword.keyword_id)";
$sql .= " GROUP BY keyword.keyword)) as a WHERE a.keyword <> '' GROUP BY a.keyword ORDER BY sum DESC LIMIT $1";
$showName = 'keyword';
}
if ($type == 'topicCategories') {
$sql = "select a.md_topic_category_code_".$languageCode.", a.md_topic_category_id,sum(a.count) from (";
$sql .= "(select md_topic_category_code_".$languageCode.",md_topic_category_id, count(*) from md_topic_category INNER JOIN layer_md_topic_category ON (layer_md_topic_category.fkey_md_topic_category_id = md_topic_category.md_topic_category_id) GROUP BY md_topic_category.md_topic_category_code_".$languageCode.",md_topic_category.md_topic_category_id) union ";
$sql .= "(select md_topic_category_code_".$languageCode.",md_topic_category_id, count(*) from md_topic_category INNER JOIN wfs_featuretype_md_topic_category ON (wfs_featuretype_md_topic_category.fkey_md_topic_category_id = md_topic_category.md_topic_category_id) GROUP BY md_topic_category.md_topic_category_code_".$languageCode.",md_topic_category.md_topic_category_id) union ";
$sql .= "(select md_topic_category_code_".$languageCode.",md_topic_category_id, count(*) from md_topic_category INNER JOIN wmc_md_topic_category ON (wmc_md_topic_category.fkey_md_topic_category_id = md_topic_category.md_topic_category_id)";
$sql .= " GROUP BY md_topic_category.md_topic_category_code_".$languageCode.",md_topic_category.md_topic_category_id)) as a WHERE a.md_topic_category_code_".$languageCode." <> '' GROUP BY a.md_topic_category_code_".$languageCode.", a.md_topic_category_id ORDER BY sum DESC LIMIT $1";
$showName = 'md_topic_category_code_'.$languageCode;
}
#sql
#select a.md_topic_category_code_de,a.md_topic_category_id, sum(a.count) from ((select md_topic_category_code_de,md_topic_category_id, count(*) from md_topic_category INNER JOIN layer_md_topic_category ON (layer_md_topic_category.fkey_md_topic_category_id = md_topic_category.md_topic_category_id) GROUP BY md_topic_category.md_topic_category_code_de,md_topic_category.md_topic_category_id) union (select md_topic_category_code_de,md_topic_category_id, count(*) from md_topic_category INNER JOIN wfs_featuretype_md_topic_category ON (wfs_featuretype_md_topic_category.fkey_md_topic_category_id = md_topic_category.md_topic_category_id) GROUP BY md_topic_category.md_topic_category_code_de,md_topic_category.md_topic_category_id) union (select md_topic_category_code_de,md_topic_category_id, count(*) from md_topic_category INNER JOIN wmc_md_topic_category ON (wmc_md_topic_category.fkey_md_topic_category_id = md_topic_category.md_topic_category_id) GROUP BY md_topic_category.md_topic_category_code_de,md_topic_category.md_topic_category_id)) as a WHERE a.md_topic_category_code_de <> '' GROUP BY a.md_topic_category_code_de, a.md_topic_category_id ORDER BY sum DESC LIMIT 20
$v = array($maxObjects);
$t = array('i');
$res = db_prep_query($sql,$v,$t);
$tags = array();
$i = 0;
//max pixelsize
$inc = ($maxFontSize-$minFontSize)/$maxObjects;//maybe 10 or 5 or ...
$maxWeight = 0;
while($row = db_fetch_array($res)){
if ((integer)$row['sum'] >= $maxWeight ) {
$maxWeight = (integer)$row['sum'];
}
if ($type == 'topicCategories') {
$tags[$i] = array('weight' =>$row['sum'], 'tagname' =>$row[$showName], 'url'=>'http://'.$hostName.$pathToSearchScript.urlencode('searchText=*&resultTarget=file&outputFormat=json&isoCategories='.$row['md_topic_category_id'].'&languageCode='.$languageCode));
}
if ($type == 'keywords') {
$tags[$i] = array('weight' =>$row['sum'], 'tagname' =>$row[$showName], 'url'=>'http://'.$hostName.$pathToSearchScript.urlencode('searchText='.$row[$showName].'&resultTarget=file&outputFormat=json&languageCode='.$languageCode));
}
$i++;
}
//normalize the tag cloud with some max value for pixelsize or set them to linear scale!
for($i=0; $i";
echo "Mapbender Tag Cloud";
echo "";
echo "";
echo "";
echo "