[Mapbender-commits] r10146 - trunk/mapbender/http_auth/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jun 12 06:39:52 PDT 2019


Author: armin11
Date: 2019-06-12 06:39:52 -0700 (Wed, 12 Jun 2019)
New Revision: 10146

Modified:
   trunk/mapbender/http_auth/http/index.php
Log:
further fix from simon.seyock - thanx

Modified: trunk/mapbender/http_auth/http/index.php
===================================================================
--- trunk/mapbender/http_auth/http/index.php	2019-06-07 13:52:24 UTC (rev 10145)
+++ trunk/mapbender/http_auth/http/index.php	2019-06-12 13:39:52 UTC (rev 10146)
@@ -707,7 +707,7 @@
  * 
  * @param string the original url of the image to send
  */
-function getImage($log_id, $or)
+function getImage($log_id, $or, $auth = false)
 {
     global $reqParams;    
     global $imageformats;
@@ -716,8 +716,7 @@
     } else {
         $header = "Content-Type: ".$reqParams['format'];
     }
-    if (func_num_args() == 3) { //new for HTTP Authentication
-        $auth = func_get_arg(2);
+    if ($auth) { //new for HTTP Authentication
 	//$e = new mb_exception("try to get: ". $or);
         getDocumentContent($log_id, $or, $header, $auth);
     } else {
@@ -732,13 +731,12 @@
  * @param string the url of the FeatureInfoRequest
  * @return string the content of the FeatureInfo document
  */
-function getFeatureInfo($log_id, $url)
+function getFeatureInfo($log_id, $url, $auth = false)
 {
     global $reqParams;
     //$e = new mb_notice("owsproxy: Try to fetch FeatureInfoRequest: " . $url);
     //header("Content-Type: " . $reqParams['info_format']);
-    if (func_num_args() == 3) { //new for HTTP Authentication
-        $auth = func_get_arg(2);
+    if ($auth) { //new for HTTP Authentication
         getDocumentContent($log_id, $url, false, $auth);
     } else {
         getDocumentContent($log_id, $url);
@@ -1008,13 +1006,12 @@
     return $id;
 }
 
-function getCapabilities($request, $requestFull, $extraParameter)
+function getCapabilities($request, $requestFull, $extraParameter, $auth = false)
 {
     global $arrayOnlineresources;
     global $layerId;
     header("Content-Type: application/xml");
-    if (func_num_args() == 4) { //new for HTTP Authentication
-        $auth = func_get_arg(3);
+    if ($auth) { //new for HTTP Authentication
 	$d = new connector($requestFull, $auth);
     } else {
 	$d = new connector($requestFull);
@@ -1162,18 +1159,17 @@
     }
     $new = $owsproxyUrl['scheme'] . "://" .$owsproxyUrl['host']. $port . "/registry/wfs/" . $wfsId;# ."?";
     if ($extraParameter !== false) {
-	$new .= '?'.$extraParameter;
-	//force https if authType is basic!
-	$new = str_replace("http://", "https://", $new);
-    }
-    if ($postData == false) {
-    	if (func_num_args() == 3) { //new for HTTP Authentication
-    	    $auth = func_get_arg(2);
-    	    $d = new connector($request, $auth);
-   	 } else {
-    	    $d = new connector($request);
-   	 }
-	 $wfsCaps = $d->file;
+        $new .= '?'.$extraParameter;
+        //force https if authType is basic!
+        $new = str_replace("http://", "https://", $new);
+        }
+        if ($postData == false) {
+            if ($auth) { //new for HTTP Authentication
+            $d = new connector($request, true);
+        } else {
+            $d = new connector($request);
+        }
+        $wfsCaps = $d->file;
     } else {
 		//$e = new mb_exception("owsproxy/index.php: postData will be send: ".$postData);
 		$postInterfaceObject = new connector();
@@ -1181,8 +1177,7 @@
 		$postInterfaceObject->set('curlSendCustomHeaders',true);
 		$postInterfaceObject->set('httpPostData', $postData);
 		$postInterfaceObject->set('httpContentType','text/xml');
-		if (func_num_args() == 3) { //new for HTTP Authentication
-    	  		$auth = func_get_arg(2);
+		if ($auth) { //new for HTTP Authentication
 			$postInterfaceObject->load($request, $auth);
 		} else {
 			$postInterfaceObject->load($request);
@@ -1510,14 +1505,13 @@
     return $ret;
 }
 
-function getDocumentContent($log_id, $url, $header = false)
+function getDocumentContent($log_id, $url, $header = false, $auth = false)
 {
     global $reqParams, $n, $postData;
     //debug
     $startTime = microtime();
     if ($postData == false) {
-    	if (func_num_args() == 4) { //new for HTTP Authentication
-    	    $auth = func_get_arg(3);
+    	if ($auth) { //new for HTTP Authentication
     	    $d = new connector($url, $auth);
    	 } else {
     	    $d = new connector($url);
@@ -1530,8 +1524,7 @@
 		$postInterfaceObject->set('curlSendCustomHeaders',true);
 		$postInterfaceObject->set('httpPostData', $postData);
 		$postInterfaceObject->set('httpContentType','text/xml');
-		if (func_num_args() == 4) { //new for HTTP Authentication
-    	  		$auth = func_get_arg(3);
+		if ($auth) { //new for HTTP Authentication
 			$postInterfaceObject->load($url, $auth);
 		} else {
 			$postInterfaceObject->load($url);



More information about the Mapbender_commits mailing list