[Mapbender-commits] r10267 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Sep 23 23:32:21 PDT 2019
Author: hollsandre
Date: 2019-09-23 23:32:21 -0700 (Mon, 23 Sep 2019)
New Revision: 10267
Modified:
trunk/mapbender/http/php/mod_sessionWrapper.php
Log:
added possibility to change preferred gui in session
Modified: trunk/mapbender/http/php/mod_sessionWrapper.php
===================================================================
--- trunk/mapbender/http/php/mod_sessionWrapper.php 2019-09-23 06:45:26 UTC (rev 10266)
+++ trunk/mapbender/http/php/mod_sessionWrapper.php 2019-09-24 06:32:21 UTC (rev 10267)
@@ -6,7 +6,7 @@
$key = "mb_user_id";
$value = null;
$allowedOperations = array("get", "set");
-$allowedKeys = array("mb_user_id", "GML", "dsgvo");
+$allowedKeys = array("mb_user_id", "GML", "dsgvo", "preferred_gui");
$resultObj['result'] = '';
$resultObj['success'] = false;
@@ -14,16 +14,16 @@
//if (!($hostName == '127.0.0.1')) {
if (!($hostName == 'localhost' or $hostName == '127.0.0.1')) {
- $resultObj['message'] ='hostName not allowed - only local connections possible (localhost,127.0.0.1)';
+ $resultObj['message'] ='hostName not allowed - only local connections possible (localhost,127.0.0.1)';
$resultObj['result'] = null;
echo json_encode($resultObj);
- die();
+ die();
}
if (isset($_REQUEST["sessionId"]) & $_REQUEST["sessionId"] != "") {
//echo "<br>Requested sessionId: ".$_REQUEST["sessionId"]."<br>";
} else {
- $resultObj['message'] ='No sessionId given - please give parameter!';
+ $resultObj['message'] ='No sessionId given - please give parameter!';
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -35,7 +35,7 @@
session_id($_REQUEST["sessionId"]);
} else {
$e = new mb_exception("storage does not exist!");
- $resultObj['message'] ='Requested session does not exists on server - please use existing identifier!';
+ $resultObj['message'] ='Requested session does not exists on server - please use existing identifier!';
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -42,17 +42,17 @@
}
//parse operation
if (isset($_REQUEST["operation"]) & $_REQUEST["operation"] != "") {
- $testMatch = $_REQUEST["operation"];
+ $testMatch = $_REQUEST["operation"];
if (!in_array($testMatch, $allowedOperations)){
- $resultObj['message'] ='Parameter operation is not valid '.implode(',', $allowedOperations);
+ $resultObj['message'] ='Parameter operation is not valid '.implode(',', $allowedOperations);
$resultObj['result'] = null;
echo json_encode($resultObj);
- die();
+ die();
}
$operation = $testMatch;
$testMatch = NULL;
} else {
- $resultObj['message'] ="Parameter operation not set - please set either ".implode(' or ', $allowedOperations);
+ $resultObj['message'] ="Parameter operation not set - please set either ".implode(' or ', $allowedOperations);
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -59,17 +59,17 @@
}
//parse operation
if (isset($_REQUEST["key"]) & $_REQUEST["key"] != "") {
- $testMatch = $_REQUEST["key"];
- if (!in_array($testMatch, $allowedKeys)){
- $resultObj['message'] = 'Parameter key is not valid '.implode(',', $allowedKeys);
+ $testMatch = $_REQUEST["key"];
+ if (!in_array($testMatch, $allowedKeys)){
+ $resultObj['message'] = 'Parameter key is not valid '.implode(',', $allowedKeys);
$resultObj['result'] = null;
- echo json_encode($resultObj);
+ echo json_encode($resultObj);
die();
}
$key = $testMatch;
$testMatch = NULL;
} else {
- $resultObj['message'] = 'Parameter key not set - please set either '.implode(' or ', $allowedKeys);
+ $resultObj['message'] = 'Parameter key not set - please set either '.implode(' or ', $allowedKeys);
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -77,7 +77,7 @@
switch ($operation) {
case "get":
$resultObj['success'] = true;
- $resultObj['message'] = 'Extracted session variable successfully!';
+ $resultObj['message'] = 'Extracted session variable successfully!';
$resultObj['result']->key = $key;
$resultObj['result']->value = Mapbender::session()->get($key);
echo json_encode($resultObj);
@@ -90,16 +90,16 @@
//parse operation
if (isset($_REQUEST["value"]) & $_REQUEST["value"] != "") {
$testMatch = $_REQUEST["value"];
- /*if (!in_array($testMatch, $allowedKeys)){
- $resultObj['message'] = 'Parameter key is not valid '.implode(',', $allowedKeys);
+ /*if (!in_array($testMatch, $allowedKeys)){
+ $resultObj['message'] = 'Parameter key is not valid '.implode(',', $allowedKeys);
$resultObj['result'] = null;
- echo json_encode($resultObj);
+ echo json_encode($resultObj);
die();
}*/
$value = urldecode($testMatch);
$testMatch = NULL;
} else {
- $resultObj['message'] = 'Parameter value for key '.$key.' not given!';
+ $resultObj['message'] = 'Parameter value for key '.$key.' not given!';
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -118,7 +118,7 @@
$GML .= "</coordinates></LinearRing></outerBoundaryIs></Polygon></polygonMember></MultiPolygon></the_geom></gemeinde></featureMember></FeatureCollection>";
Mapbender::session()->set('GML', $GML);
$resultObj['success'] = true;
- $resultObj['message'] = 'Dummy GML MultiPolygon written into session!';
+ $resultObj['message'] = 'Dummy GML MultiPolygon written into session!';
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -125,7 +125,7 @@
}
Mapbender::session()->set('GML',$value);
$resultObj['success'] = true;
- $resultObj['message'] = 'GML written into session!';
+ $resultObj['message'] = 'GML written into session!';
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -138,7 +138,7 @@
case "true":
Mapbender::session()->set($key, "yes");
$resultObj['success'] = true;
- $resultObj['message'] = 'Set dsgvo to yes!';
+ $resultObj['message'] = 'Set dsgvo to yes!';
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -146,7 +146,7 @@
case "false":
Mapbender::session()->set($key, "no");
$resultObj['success'] = true;
- $resultObj['message'] = 'Set dsgvo to no!';
+ $resultObj['message'] = 'Set dsgvo to no!';
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -154,7 +154,7 @@
default:
Mapbender::session()->set($key, "no");
$resultObj['success'] = true;
- $resultObj['message'] = 'Set dsgvo to no!';
+ $resultObj['message'] = 'Set dsgvo to no!';
$resultObj['result'] = null;
echo json_encode($resultObj);
die();
@@ -163,8 +163,20 @@
$testMatch = NULL;
}
break;
- default:
- $resultObj['message'] = 'Not allowed to set key: '.$key.' via http!';
+ case "preferred_gui":
+ if (isset($_REQUEST["value"]) & $_REQUEST["value"] != "") {
+ $testMatch = $_REQUEST["value"];
+ $value = urldecode($testMatch);
+ Mapbender::session()->set($key, $value);
+ $resultObj['success'] = true;
+ $resultObj['message'] = 'Set preferred_gui to'.$value.'!';
+ $resultObj['result'] = null;
+ echo json_encode($resultObj);
+ die();
+ }
+ # break;
+ default:
+ $resultObj['message'] = 'Not allowed to set key: '.$key.' via http!';
$resultObj['result'] = null;
echo json_encode($resultObj);
break;
More information about the Mapbender_commits
mailing list