[Fusionforge-commits] r11918 - in trunk/src/common/docman: . actions

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Wed Dec 29 18:28:42 CET 2010


Author: nerville
Date: 2010-12-29 18:28:42 +0100 (Wed, 29 Dec 2010)
New Revision: 11918

Modified:
   trunk/src/common/docman/DocumentGroup.class.php
   trunk/src/common/docman/actions/injectzip.php
Log:
remove useless param: doc_group

Modified: trunk/src/common/docman/DocumentGroup.class.php
===================================================================
--- trunk/src/common/docman/DocumentGroup.class.php	2010-12-29 13:14:12 UTC (rev 11917)
+++ trunk/src/common/docman/DocumentGroup.class.php	2010-12-29 17:28:42 UTC (rev 11918)
@@ -195,12 +195,11 @@
 	/**
 	 * injectArchive - extract the attachment and create the directory tree if needed
 	 *
-	 * @param	int	doc_group id
 	 * @param	array	uploaded data
 	 * @return	boolean	success or not
 	 * @access	public
 	 */
-	function injectArchive($doc_group, $uploaded_data) {
+	function injectArchive($uploaded_data) {
 		if (!is_uploaded_file($uploaded_data['tmp_name'])) {
 			$this->setError(_('Invalid file name.'));
 			return false;
@@ -214,7 +213,7 @@
 		
 		switch ($uploaded_data_type) {
 			case "application/zip": {
-				$returned = $this->__injectZip($doc_group, $uploaded_data);
+				$returned = $this->__injectZip($uploaded_data);
 				break;
 			}
 			default: {
@@ -469,18 +468,17 @@
 	/**
 	 * __injectZip - private method to inject a zip archive tree and files
 	 *
-	 * @param	int	doc_group id
 	 * @param	array	uploaded zip
 	 * @return	boolean	success or not
 	 * @access	private
 	 */
-	private function __injectZip($doc_group, $uploadedZip) {
+	private function __injectZip($uploadedZip) {
 		$zip = new ZipArchive();
 		if ($zip->open($uploadedZip['tmp_name'])) {
 			$extractDir = forge_get_config('data_path').'/'.uniqid();
 			if ($zip->extractTo($extractDir)) {
 				$zip->close();
-				if ($this->__injectContent($doc_group, $extractDir)) {
+				if ($this->__injectContent($extractDir)) {
 					rmdir($extractDir);
 					return true;
 				} else {
@@ -500,19 +498,18 @@
 	/**
 	 * __injectContent - private method to inject a directory tree and files
 	 *
-	 * @param	int	doc_group id
 	 * @param	string	the directory to inject
 	 * @return	boolean	success or not
 	 * @access	private
 	 */
-	private function __injectContent($doc_group, $directory) {
+	private function __injectContent($directory) {
 		if (is_dir($directory)) {
 			$dir_arr = scandir($directory);
 			for ($i = 0; $i < count($dir_arr); $i++) {
 				if ($dir_arr[$i] != '.' && $dir_arr[$i] != '..') {
 					if (is_dir($directory.'/'.$dir_arr[$i])) {
-						if ($this->create($dir_arr[$i], $doc_group)) {
-							if (!$this->__injectContent($this->getID(), $directory.'/'.$dir_arr[$i])) {
+						if ($this->create($dir_arr[$i], $this->getID())) {
+							if (!$this->__injectContent($directory.'/'.$dir_arr[$i])) {
 								$this->setError(_('Unable to open directory for inject into tree'));
 								return false;
 							} else {
@@ -528,7 +525,7 @@
 							$dir_arr_type = 'application/binary';
 						}
 						$data = fread(fopen($directory.'/'.$dir_arr[$i], 'r'), filesize($directory.'/'.$dir_arr[$i]));
-						if (!$d->create($dir_arr[$i], $dir_arr_type, $data, $doc_group, 'no title', 'no description')) {
+						if (!$d->create($dir_arr[$i], $dir_arr_type, $data, $this->getID(), 'no title', 'no description')) {
 							$this->setError(_('Unable to add document from zip injection.'));
 							return false;
 						} else {

Modified: trunk/src/common/docman/actions/injectzip.php
===================================================================
--- trunk/src/common/docman/actions/injectzip.php	2010-12-29 13:14:12 UTC (rev 11917)
+++ trunk/src/common/docman/actions/injectzip.php	2010-12-29 17:28:42 UTC (rev 11918)
@@ -40,12 +40,12 @@
 		session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
 	}
 } else {
-	$dg = new DocumentGroup($g);
+	$dg = new DocumentGroup($g,$doc_group);
 	
 	if ($dg->isError())
 		session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($dg->getErrorMessage()));
 
-	if (!$dg->injectArchive($doc_group, $uploaded_zip)) {
+	if (!$dg->injectArchive($uploaded_zip)) {
 		$return_msg = $dg->getErrorMessage();
 		$return_url = '/docman/?group_id='.$group_id.'&error_msg='.urlencode($return_msg);
 	} else {




More information about the Fusionforge-commits mailing list