[Mapbender-commits] r9737 - in trunk/mapbender/http: classes php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 10 05:07:06 PDT 2017


Author: armin11
Date: 2017-05-10 05:07:06 -0700 (Wed, 10 May 2017)
New Revision: 9737

Modified:
   trunk/mapbender/http/classes/class_administration.php
   trunk/mapbender/http/php/mod_owsproxy_conf.php
Log:
New possibilities for secured ows getfeatureinfo requests

Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php	2017-05-10 11:59:57 UTC (rev 9736)
+++ trunk/mapbender/http/classes/class_administration.php	2017-05-10 12:07:06 UTC (rev 9737)
@@ -1256,6 +1256,40 @@
    	}
 
 	/*
+	 * set the exchange_url tag of the wms
+	 * 
+	 * @param integer the wms-id 
+	 * 
+	 */
+
+   	function setWmsExchangeUrlTag($wms_id,$value){
+   		$sql = "UPDATE wms set wms_proxy_exchange_external_urls=$2 WHERE wms_id = $1 ";
+   		$t = array("i","i");
+		$v = array($wms_id,$value);
+   		$res = db_prep_query($sql,$v,$t);
+   	}	
+
+	/*
+	 * get the exchange_url tag of the wms
+	 * 
+	 * @param integer the wms-id 
+	 * @return 1 for active exchange_url and 0 or null if deactivated
+	 */
+
+   	function getWmsExchangeUrlTag($wms_id){
+   		$sql = "SELECT wms_proxy_exchange_external_urls from wms WHERE  wms_id = $1 ";
+   		$t = array("i");
+		$v = array($wms_id);
+   		$res = db_prep_query($sql,$v,$t);
+		if($row = db_fetch_array($res)){
+   			return $row["wms_proxy_exchange_external_urls"];
+   		}
+   		else{
+   			return false;
+   		}
+   	}	
+
+	/*
 	 * set the log tag of the wms
 	 * 
 	 * @param integer the wms-id 
@@ -1288,6 +1322,7 @@
    			return false;
    		}
    	}	
+
 	/*
 	 * set the pricevolume of the wms
 	 * 

Modified: trunk/mapbender/http/php/mod_owsproxy_conf.php
===================================================================
--- trunk/mapbender/http/php/mod_owsproxy_conf.php	2017-05-10 11:59:57 UTC (rev 9736)
+++ trunk/mapbender/http/php/mod_owsproxy_conf.php	2017-05-10 12:07:06 UTC (rev 9737)
@@ -78,59 +78,62 @@
 
 }
 
-
 foreach ($_POST as $var => $value) {
-	#select those which are relevant (hidden fields for proxy and log)
-	#identify them
+	//select those which are relevant (hidden fields for proxy and log)
+	//identify them
 	$parts=explode("_",$var);
-	#echo "All vars: <br>";
-	#echo $var." = ".$value."<br>";
+	//echo "All vars: <br>";
+	//echo $var." = ".$value."<br>";
 	$value=validateint($value);
-	if ($parts[0]!= 'status' && $parts[2]=='price'){ #for the pricing in the textfield
+	//test exchanging urls conf
+	if ($parts[0] == 'status' && $parts[2] == 'exchange') {
+		$admin->setWmsExchangeUrlTag(intval($parts[1]), $value);
+	}
+	//changing price information
+	if ($parts[0] != 'status' && $parts[2]=='price'){ //for the pricing in the textfield
 		if($parts[0] == "wms") {
-            $admin->setWmsPrice(intval($value),intval($parts[1]));
-        } else if($parts[0] == "wmsfi"){
-            $admin->setWmsfiPrice(intval($value),intval($parts[1]));
-        }
+            		$admin->setWmsPrice(intval($value),intval($parts[1]));
+        	} else if($parts[0] == "wmsfi") {
+            		$admin->setWmsfiPrice(intval($value),intval($parts[1]));
+        	}
 	}
-	#check the hidden fields if some log should be set 
+	//check the hidden fields if some log should be set 
 	if (($parts[2]=='log' || $parts[2]=='logfi') && $parts[0]=='status'){
-		#set the log value to 1 or 0
-        if($parts[2]=='log'){
-            $admin->setWmsLogTag(intval($parts[1]),$value);
-        } else if($parts[2]=='logfi'){
-            $admin->setWmsfiLogTag(intval($parts[1]),$value);
-        }
-		#if value is 0 then set the price to 0 to. there would be is no sense to have a price set - maybe change this behavior
+		//set the log value to 1 or 0
+        	if($parts[2]=='log') {
+            		$admin->setWmsLogTag(intval($parts[1]),$value);
+        	} else if($parts[2]=='logfi'){
+            		$admin->setWmsfiLogTag(intval($parts[1]),$value);
+        	}
+		//if value is 0 then set the price to 0 to. there would be is no sense to have a price set - maybe change this behavior
 		if ($value==0) {
 			if($parts[2]=='log'){
-                $admin->setWmsPrice(intval($value),intval($parts[1]));
-            } else if($parts[2]=='logfi'){
-                $admin->setWmsfiPrice(intval($value),intval($parts[1]));
-            }
+                		$admin->setWmsPrice(intval($value),intval($parts[1]));
+            		} else if($parts[2]=='logfi'){
+                		$admin->setWmsfiPrice(intval($value),intval($parts[1]));
+            		}
 		}
-		#echo "log: $var = $value<br>";
+		//echo "log: $var = $value<br>";
 	}
-	#check proxy fields
+	//check proxy fields
 	if ($parts[0]=='status' && $parts[2]=='proxy'){ 
-		#echo ("proxy settings identified: WMS_ID: ".intval($parts[1])." Value: ".$value."<br>");	
-		#echo ("Is active?: ");
-		#if ($admin->getWMSOWSstring(intval($parts[1]))=="") {echo " no";} else {echo " yes";}
-		#echo ("<br>");
-		#check if proxy should be activated and is not set
+		//echo ("proxy settings identified: WMS_ID: ".intval($parts[1])." Value: ".$value."<br>");	
+		//echo ("Is active?: ");
+		//if ($admin->getWMSOWSstring(intval($parts[1]))=="") {echo " no";} else {echo " yes";}
+		//echo ("<br>");
+		//check if proxy should be activated and is not set
 		if ($value==1 && $admin->getWMSOWSstring(intval($parts[1])) == "") {
-		#activate it!
+		//activate it!
 		$admin->setWMSOWSstring(intval($parts[1]),$value);
-		#echo "Activate Proxy for ".intval($parts[1])."<br>";
+		//echo "Activate Proxy for ".intval($parts[1])."<br>";
 		}
-		#check if active proxy should be deactivated
+		//check if active proxy should be deactivated
 		if ($value==0 && $admin->getWMSOWSstring(intval($parts[1])) !== "") {
-		#deactivate it
+		//deactivate it
 		$admin->setWMSOWSstring(intval($parts[1]),$value);
-		#echo "Deactivate Proxy for ".intval($parts[1])."<br>";
+		//echo "Deactivate Proxy for ".intval($parts[1])."<br>";
 		}
 	}
-
 }
 	
 }
@@ -169,19 +172,22 @@
             <td>WMS ID</td>
             <td>WMS Title</td>
             <td>Proxy</td>
+	    <td>Exchange URLs</td>
             <td>GetMap Log</td>
             <td>GetMap Price(cent/Mpixel)</td>
             <td>GetFeatureInfo Log</td>
             <td>GetFeatureInfo Price(cent/Aufruf)</td>
             <td>Show detailed Usage</td>
         </tr>";
-
+//read out infos from database
 for($i=0; $i<count($ownwms); $i++){
-	#read out current values in db
 	if($admin->getWMSOWSstring($ownwms[$i]) == false){ $status_proxy = 0 ;} else {$status_proxy = 1;};
+	//check for exchange urls conf
+	if($admin->getWmsExchangeUrlTag($ownwms[$i]) == false){ $status_exchange_urls = 0 ;} else {$status_exchange_urls = 1;};
+
 	if($admin->getWmsLogTag($ownwms[$i]) == 1){$status_log=1;} else {$status_log=0;};
 	if ($admin->getWmsPrice($ownwms[$i]) != 0 ){$status_price=$admin->getWmsPrice($ownwms[$i]);} else {$status_price=0;};
-    if($admin->getWmsfiLogTag($ownwms[$i]) == 1){$status_logfi=1;} else {$status_logfi=0;};
+        if($admin->getWmsfiLogTag($ownwms[$i]) == 1){$status_logfi=1;} else {$status_logfi=0;};
 	if ($admin->getWmsfiPrice($ownwms[$i]) != 0 ){$status_price_fi=$admin->getWmsfiPrice($ownwms[$i]);} else {$status_price_fi=0;};
     
 	$auth=$admin->getAuthInfoOfWMS($ownwms[$i]);
@@ -190,9 +196,9 @@
 	echo "<td>".$ownwms[$i]."</td>";
 	echo "<td";
 	if($status_auth == 1){echo " bgcolor=\"#FF0000\"";};
-	echo ">".$admin->getWmsTitleByWmsId($ownwms[$i]);
+	echo ">".$admin->getWmsTitleByWmsId($ownwms[$i])."</td>";
+	//for owsproxy activation************************************************************************************************
 	echo "<td>";
-	#for owsproxy	
 	echo "<input type='checkbox' id='wms_".$ownwms[$i]."_proxy' name='wms_".$ownwms[$i]."_proxy' 
         onclick='if(this.checked){
             document.getElementById(\"wms_\"+".$ownwms[$i]."+\"_log\").disabled=false;
@@ -213,31 +219,36 @@
             document.getElementById(\"status_\"+".$ownwms[$i]."+\"_log\").value=\"0\";
             document.getElementById(\"status_\"+".$ownwms[$i]."+\"_logfi\").value=\"0\";
         }'";
-	
-	
 	#default
 	if($status_proxy == 1){ echo " checked";  } else {echo " unchecked"; };  //if a proxy string is set
 	if($status_auth == 1){ echo " disabled";};
 	echo ">";
 	#initialize hidden field for status proxy:
-
 	echo "<input type=\"hidden\" name=\"status_".$ownwms[$i]."_proxy\" id=\"status_".$ownwms[$i]."_proxy\" value=".$status_proxy.">";
-
 	echo "</td>";
-	#for logging
+	//for exchange urls************************************************************************************************
+	echo "<td><input type='checkbox' id='wms_".$ownwms[$i]."_exchange_urls' name='wms_".$ownwms[$i]."_exchange_urls'";
+	#default
+	if($status_exchange_urls == 1){ echo " checked";  } else {echo " unchecked"; };
+       	echo " onclick='if(this.checked){
+            document.getElementById(\"status_\"+".$ownwms[$i]."+\"_exchange_urls\").value=\"1\";
+        } else {
+            document.getElementById(\"status_\"+".$ownwms[$i]."+\"_exchange_urls\").value=\"0\";
+        }'";
+	echo ">";
+	//initialize hidden field for status exchange urls
+	echo "<input type=\"hidden\" name=\"status_".$ownwms[$i]."_exchange_urls\" id=\"status_".$ownwms[$i]."_exchange_urls\" value=".$status_exchange_urls.">";
+	echo "</td>";
+	#for logging************************************************************************************************
 	echo "<td><input type='checkbox' id='wms_".$ownwms[$i]."_log' name='wms_".$ownwms[$i]."_log' onclick='if(this.checked){document.getElementById(\"wms_\"+".$ownwms[$i]."+\"_price\").disabled=false;document.getElementById(\"status_\"+".$ownwms[$i]."+\"_log\").value=\"1\"}else{document.getElementById(\"wms_\"+".$ownwms[$i]."+\"_price\").disabled=true;document.getElementById(\"wms_\"+".$ownwms[$i]."+\"_price\").value=\"0\";document.getElementById(\"status_\"+".$ownwms[$i]."+\"_log\").value=\"0\";document.getElementById(\"status_\"+".$ownwms[$i]."+\"_price\").value=\"0\"}'";
-
-	
 	#default
 	if($status_proxy==0){ echo "disabled "; };
 	if($status_log == 1){ echo " checked";  };//if a log tag is set -> to activate
 	echo ">";
 	#initialize hidden field for status log:
-	
 	echo "<input type=\"hidden\" name=\"status_".$ownwms[$i]."_log\" id=\"status_".$ownwms[$i]."_log\" value=".$status_log.">";
-
 	echo "</td>";
-	#for pricing
+	#for pricing************************************************************************************************
 	echo "<td><input id='wms_".$ownwms[$i]."_price' name='wms_".$ownwms[$i]."_price' type='text' size='5' value='";
 	echo $status_price;
 	echo "' ";
@@ -246,28 +257,18 @@
 	//if($admin->getWmsPrice($ownwms[$i]) != 0){ echo "disabled";  }
 	echo ">";
 	#initialize hidden field for status price:
-	
 	echo "<input type=\"hidden\" name=\"status_".$ownwms[$i]."_price\" id=\"status_".$ownwms[$i]."_price\" value=".$status_price.">";
-
-
 	echo "</td>";
-    
-    
-    
-    #for wmsfi logging
+        #for wmsfi logging************************************************************************************************
 	echo "<td><input type='checkbox' id='wms_".$ownwms[$i]."_logfi' name='wms_".$ownwms[$i]."_logfi' onclick='if(this.checked){document.getElementById(\"wmsfi_\"+".$ownwms[$i]."+\"_price\").disabled=false;document.getElementById(\"status_\"+".$ownwms[$i]."+\"_logfi\").value=\"1\"}else{document.getElementById(\"wmsfi_\"+".$ownwms[$i]."+\"_price\").disabled=true;document.getElementById(\"wmsfi_\"+".$ownwms[$i]."+\"_price\").value=\"0\";document.getElementById(\"status_\"+".$ownwms[$i]."+\"_logfi\").value=\"0\";document.getElementById(\"status_\"+".$ownwms[$i]."+\"_price\").value=\"0\"}'";
-
-	
 	#default
 	if($status_proxy==0){ echo "disabled "; };
 	if($status_logfi == 1){ echo " checked";  };//if a log tag is set -> to activate
 	echo ">";
 	#initialize hidden field for status log:
-	
 	echo "<input type=\"hidden\" name=\"status_".$ownwms[$i]."_logfi\" id=\"status_".$ownwms[$i]."_logfi\" value=".$status_logfi.">";
-
 	echo "</td>";
-	#for pricing
+	#for fi pricing************************************************************************************************
 	echo "<td><input id='wmsfi_".$ownwms[$i]."_price' name='wmsfi_".$ownwms[$i]."_price' type='text' size='5' value='";
 	echo $status_price_fi;
 	echo "' ";
@@ -276,16 +277,9 @@
 	//if($admin->getWmsPrice($ownwms[$i]) != 0){ echo "disabled";  }
 	echo ">";
 	#initialize hidden field for status price:
-	
 	echo "<input type=\"hidden\" name=\"status_".$ownwms[$i]."_price\" id=\"status_".$ownwms[$i]."_price\" value=".$status_price_fi.">";
-
-
 	echo "</td>";
-    
-    
-    
-    
-    
+   
 if($status_log == 1 || $status_logfi == 1){
 echo "<td><input type=button value='Show Usage' onclick=\"var newWindow = window.open('../php/mod_UsageShow.php?wmsid=".$ownwms[$i]."','wms','width=800,height=700,scrollbars');newWindow.href.location='Usage of Service: ".$wms_id."'\"></td>";
 }
@@ -303,4 +297,4 @@
 </table>
 </form>
 </body>
-</html>
\ No newline at end of file
+</html>



More information about the Mapbender_commits mailing list