[Mapbender-commits] r4952 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Nov 6 02:37:13 EST 2009


Author: christoph
Date: 2009-11-06 02:37:11 -0500 (Fri, 06 Nov 2009)
New Revision: 4952

Modified:
   trunk/mapbender/http/classes/class_user.php
   trunk/mapbender/http/classes/class_wmc.php
Log:


Modified: trunk/mapbender/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php	2009-11-06 07:22:56 UTC (rev 4951)
+++ trunk/mapbender/http/classes/class_user.php	2009-11-06 07:37:11 UTC (rev 4952)
@@ -109,7 +109,7 @@
 	}
 
 	public function isPublic () {
-		if ($this->id === PUBLIC_USER) {
+		if (defined(PUBLIC_USER) && $this->id === PUBLIC_USER) {
 			return true;
 		}
 		return false;

Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php	2009-11-06 07:22:56 UTC (rev 4951)
+++ trunk/mapbender/http/classes/class_wmc.php	2009-11-06 07:37:11 UTC (rev 4952)
@@ -480,7 +480,8 @@
 	 * @param $id String the WMC id
 	 */
 	public static function getDocument ($id) {
-		$sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_id = $1 AND fkey_user_id = $2";
+		$sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_id = $1 AND " . 
+			"(fkey_user_id = $2 OR wmc_public = 1)";
 		$v = array($id, Mapbender::session()->get("mb_user_id"));
 		$t = array('s', 'i');
 		$res = db_prep_query($sql,$v,$t);
@@ -523,6 +524,31 @@
 		return $this->wmc_title;
 	}
 
+	private function getLayerWithoutIdArray () {
+		$layerWithoutWmsIdArray = array();
+		$layerWithoutLayerIdArray = array();
+		
+		// check if WMS IDs exist
+		$wmsArray = $this->mainMap->getWmsArray();
+		for ($i = 0; $i < count($wmsArray); $i++) {
+			$currentWms = $wmsArray[$i];		
+			if (!is_numeric($currentWms[$currentId])) {
+				array_push($layerWithoutWmsIdArray, $currentId);
+			}
+		}
+		
+		// check if layer IDs exist
+		for ($i = 0; $i < count($layerIdArray); $i++) {
+			$currentId = $layerIdArray[$i];
+			if (!is_numeric($this->wmc_layer_id[$currentId])) {
+				array_push($layerWithoutLayerIdArray, $currentId);
+			}
+		}
+		$noIdArray = array_unique(array_merge($layerWithoutWmsIdArray, $layerWithoutLayerIdArray));
+		return $noIdArray;
+	}
+
+
 	// ---------------------------------------------------------------------------
 	// OUTPUT FUNCTIONS
 	// ---------------------------------------------------------------------------



More information about the Mapbender_commits mailing list