[Mapbender-commits] r5850 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Mar 29 04:04:43 EDT 2010


Author: christoph
Date: 2010-03-29 04:04:20 -0400 (Mon, 29 Mar 2010)
New Revision: 5850

Modified:
   trunk/mapbender/http/plugins/jq_upload.js
   trunk/mapbender/http/plugins/jq_upload.php
Log:
added configuration options

Modified: trunk/mapbender/http/plugins/jq_upload.js
===================================================================
--- trunk/mapbender/http/plugins/jq_upload.js	2010-03-29 08:03:10 UTC (rev 5849)
+++ trunk/mapbender/http/plugins/jq_upload.js	2010-03-29 08:04:20 UTC (rev 5850)
@@ -24,7 +24,7 @@
 					time = 0;
 					
 					var returnValueArray = returnValue.split("_");
-					var filename = returnValueArray[returnValueArray.length - 2];
+					var filename = returnValueArray[returnValueArray.length - 3];
 					var origFilename = window.frames[id+"_target"].filename;
 					var msg = "";
 					var success = false;

Modified: trunk/mapbender/http/plugins/jq_upload.php
===================================================================
--- trunk/mapbender/http/plugins/jq_upload.php	2010-03-29 08:03:10 UTC (rev 5849)
+++ trunk/mapbender/http/plugins/jq_upload.php	2010-03-29 08:04:20 UTC (rev 5850)
@@ -11,7 +11,7 @@
 		
 		$uploadedFile = $_FILES['myfile']['tmp_name'];
 		$clientFilename = $_FILES['myfile']['name'];
-		$serverFilename = Mapbender::session()->get("mb_user_id") . "_" . uniqid(true);
+		$serverFilename = Mapbender::session()->get("mb_user_id") . "-" . uniqid(true);
 
 		$uploadDir = TMPDIR;
 		if (defined("UPLOAD_DIR")) {
@@ -22,6 +22,8 @@
 			$allowedFileTypes = explode(",", UPLOAD_WHITELIST_FILE_TYPES);
 		}
 
+			new mb_exception(1);
+
 		// check if file type is valid
 		foreach ($allowedFileTypes as $item) {
 			$cancel = true;
@@ -31,6 +33,7 @@
 				break;
 			}
 		}
+			new mb_exception(2);
 		
 		$disallowedFileTypes = array("PHP", "PHP3", "PHP4", "PHTML", "PHP5", "PHP6");
 		if (defined("UPLOAD_BLACKLIST_FILE_TYPES")) {
@@ -39,7 +42,8 @@
 				$disallowedFileTypes
 			);
 		}
-		
+					new mb_exception(3);
+
 		// check if file type is valid
 		foreach ($disallowedFileTypes as $item) {
 			if(preg_match("/\.$item\$/i", $clientFilename)) {
@@ -48,6 +52,7 @@
 				break;
 			}
 		}
+					new mb_exception(4);
 		$maxSize = intval(ini_get("upload_max_filesize"))*1024;
 		if (defined("UPLOAD_MAX_SIZE_KB") && UPLOAD_MAX_SIZE_KB < $maxSize) {
 			$maxSize = UPLOAD_MAX_SIZE_KB;
@@ -62,7 +67,8 @@
 		if ($pos !== false) {
 			$extension = substr($clientFilename, $pos);
 		}
-		$serverFullFilename = $uploadDir . "/" . $serverFilename . $extension;
+		$serverFilename .= $extension;
+		$serverFullFilename = $uploadDir . "/" . $serverFilename;
 		if (!$cancel) {
 			if (!copy($uploadedFile, $serverFullFilename)) {
 				$status = "cancelled";
@@ -82,7 +88,7 @@
 	<head>
 		<script type="text/javascript">
 			window.id = "<?php 
-				echo $id . "_" . $serverFilename . "_" . $status . "_" . $message;
+				echo $id . "_" . $serverFullFilename . "_" . $status . "_" . $message;
 			?>";
 			window.filename = "<?php echo $clientFilename;  ?>";
 		</script>



More information about the Mapbender_commits mailing list