[Fusionforge-commits] r16831 - trunk/src/common/docman

Franck VILLAUME nerville at fusionforge.org
Mon Nov 26 14:25:21 CET 2012


Author: nerville
Date: 2012-11-26 14:25:20 +0100 (Mon, 26 Nov 2012)
New Revision: 16831

Modified:
   trunk/src/common/docman/Document.class.php
Log:
add check about file before storage

Modified: trunk/src/common/docman/Document.class.php
===================================================================
--- trunk/src/common/docman/Document.class.php	2012-11-25 17:12:43 UTC (rev 16830)
+++ trunk/src/common/docman/Document.class.php	2012-11-26 13:25:20 UTC (rev 16831)
@@ -184,10 +184,16 @@
 
 		$docid = db_insertid($result, 'doc_data', 'docid');
 		if ($filesize) {
-			if (!DocumentStorage::instance()->store($docid, $data)) {
-				DocumentStorage::instance()->rollback();
+			if (is_file($data)) {
+				if (!DocumentStorage::instance()->store($docid, $data)) {
+					DocumentStorage::instance()->rollback();
+					db_rollback();
+					$this->setError(DocumentStorage::instance()->getErrorMessage());
+					return false;
+				}
+			} else {
+				$this->setError(_('Error Adding Document:').' '._('Not a file'));
 				db_rollback();
-				$this->setError(DocumentStorage::instance()->getErrorMessage());
 				return false;
 			}
 		}




More information about the Fusionforge-commits mailing list