svn commit: r632 - trunk/mapbender/http/javascripts/mod_initWmc.php
christoph at osgeo.org
christoph at osgeo.org
Tue Jun 27 05:03:05 EDT 2006
Author: christoph
Date: 2006-06-27 09:03:05+0000
New Revision: 632
Modified:
trunk/mapbender/http/javascripts/mod_initWmc.php
Log:
fixed two bugs
now checking
- if wmc $_SESSION["mb_myWmc"] exists.
- if wmc $_SESSION["mb_myWmc"] belongs to user $_SESSION["mb_user_id"]
Modified: trunk/mapbender/http/javascripts/mod_initWmc.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_initWmc.php?view=diff&rev=632&p1=trunk/mapbender/http/javascripts/mod_initWmc.php&p2=trunk/mapbender/http/javascripts/mod_initWmc.php&r1=631&r2=632
==============================================================================
--- trunk/mapbender/http/javascripts/mod_initWmc.php (original)
+++ trunk/mapbender/http/javascripts/mod_initWmc.php 2006-06-27 09:03:05+0000
@@ -1,6 +1,7 @@
<?php
session_start();
require_once("../classes/class_wmc.php");
+require_once("../classes/class_administration.php");
$con = db_connect($DBSERVER,$OWNER,$PW);
db_select_db(DB,$con);
@@ -17,23 +18,36 @@
if($cnt > 1){
echo "alert('digitize_button: ID not unique!');";
}
-echo "var wmc_id = false;";
+
$js = "function mod_initWMC_init() {";
-//echo "alert('".$_SESSION['mb_myWmc']."');";
-if ($_SESSION['mb_myWmc']) {
- echo "wmc_id = '".$_SESSION['mb_myWmc']."';";
- $wmc_id = $_SESSION['mb_myWmc'];
- $wmc = new wmc();
- $wmc->createObjFromWMC($wmc_id);
- $js .= "deleteWmsObject();\n";
- $js .= $wmc->createJsObjFromWMC("", $e_target[0]);
- $js .= "var index = getMapObjIndexByName('" . $e_target[0] . "');\n";
- $js .= "document.getElementById('".$e_target[0]."').style.width = mb_mapObj[index].width;\n";
- $js .= "document.getElementById('".$e_target[0]."').style.height = mb_mapObj[index].height;\n";
- $js .= "mb_execloadWmsSubFunctions();\n";
+
+
+$adm = new administration();
+$valid_wmcs = $adm->getWmcByOwner($_SESSION["mb_user_id"]);
+
+if ($adm->getWmcById($_SESSION['mb_myWmc']) != false) {
+ if (in_array($_SESSION['mb_myWmc'], $valid_wmcs)) {
+ echo "var wmc_id = false;";
+ echo "wmc_id = '".$_SESSION['mb_myWmc']."';";
+ $wmc = new wmc();
+ $wmc->createObjFromWMC($_SESSION['mb_myWmc']);
+ $js .= "deleteWmsObject();\n";
+ $js .= $wmc->createJsObjFromWMC("", $e_target[0]);
+ $js .= "var index = getMapObjIndexByName('" . $e_target[0] . "');\n";
+ $js .= "document.getElementById('".$e_target[0]."').style.width = mb_mapObj[index].width;\n";
+ $js .= "document.getElementById('".$e_target[0]."').style.height = mb_mapObj[index].height;\n";
+ $js .= "mb_execloadWmsSubFunctions();\n";
+ }
+ else {
+ $js .= "alert('".$adm->getUserNameByUserId($_SESSION["mb_user_id"])." is not allowed to access WMC ".$_SESSION['mb_myWmc'].". Default GUI will be loaded instead.');";
+ }
+}
+else {
+ $js .= "alert('WMC id ".$_SESSION['mb_myWmc']." is not valid. Default GUI will be loaded instead.');";
}
$js .= "}";
echo $js;
+
?>
mb_registerInitFunctions("mod_initWMC()");
More information about the Mapbender_commits
mailing list