Passed
Push — dev ( f403ee...8f997d )
by Salim
12:58
created
src/scripts/get_possible_import.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 		}
51 51
 	}
52 52
     
53
-} else {
53
+}else {
54 54
 	$availableVisits=[];
55 55
 }
56 56
 
Please login to merge, or discard this patch.
src/scripts/validate_dicom_upload_tus.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
 Session::checkSession();
38 38
 $linkpdo=Session::getLinkpdo();
39 39
 
40
-$timeStamp = time();
41
-$id_visit = $_POST['id_visit'];
42
-$nbOfInstances = $_POST['totalDicomFiles'];
40
+$timeStamp=time();
41
+$id_visit=$_POST['id_visit'];
42
+$nbOfInstances=$_POST['totalDicomFiles'];
43 43
 $anonFromOrthancId=$_POST['originalOrthancStudyID'];
44 44
 $username=$_SESSION['username'];
45 45
 $study=$_SESSION['study'];
46 46
 $role=$_SESSION['role'];
47
-$tusFilesID = $_POST['sucessIDsUploaded'];
47
+$tusFilesID=$_POST['sucessIDsUploaded'];
48 48
 
49
-$unzipedPath = $_SERVER['DOCUMENT_ROOT'].'/data/upload/temp/'.$timeStamp.'_'.$id_visit;
49
+$unzipedPath=$_SERVER['DOCUMENT_ROOT'].'/data/upload/temp/'.$timeStamp.'_'.$id_visit;
50 50
 
51 51
 $visitObject=new Visit($id_visit, $linkpdo);
52 52
 $userObject=new User($username, $linkpdo);
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 		}
72 72
 
73 73
 		//Unzip each uploaded file and remove them from tus
74
-		foreach($tusFilesID as $fileName){
75
-			$tempZipPath = get_tus_file($fileName);
74
+		foreach ($tusFilesID as $fileName) {
75
+			$tempZipPath=get_tus_file($fileName);
76 76
 
77 77
 			$zipSize=filesize($tempZipPath);
78 78
 			$uncompressedzipSize=get_zip_originalsize($tempZipPath);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		$files[]=$file->getPathname();
169 169
     }
170 170
     
171
-    if(sizeof($files) != $nbOfInstances){
171
+    if (sizeof($files) != $nbOfInstances) {
172 172
         throw new Exception("Number Of Uploaded Files dosen't match expected instance number");
173 173
     }
174 174
 	
@@ -271,23 +271,23 @@  discard block
 block discarded – undo
271 271
 
272 272
 function get_tus_file($fileName) {
273 273
     
274
-    $client = new Client([
274
+    $client=new Client([
275 275
         // Base URI is used with relative requests
276 276
 		'base_uri' => TUS_SERVER.'/tus/',
277 277
 		'headers' => ['Tus-Resumable' => '1.0.0']
278 278
     ]);
279
-	$downloadedFileName = tempnam(sys_get_temp_dir(), 'dicom');
279
+	$downloadedFileName=tempnam(sys_get_temp_dir(), 'dicom');
280 280
 
281
-	$resource  = fopen( $downloadedFileName, 'r+');
281
+	$resource=fopen($downloadedFileName, 'r+');
282 282
 	
283 283
 	$client->request('GET', $fileName, ['sink' => $resource]);
284 284
 
285 285
     return $downloadedFileName;
286 286
 }
287 287
 
288
-function delete_tus_file($fileName){
288
+function delete_tus_file($fileName) {
289 289
 
290
-    $client = new Client([
290
+    $client=new Client([
291 291
         // Base URI is used with relative requests
292 292
 		'base_uri' => TUS_SERVER.'/tus/',
293 293
 		'headers' => ['Tus-Resumable' => '1.0.0']
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 		//Log import
135 135
 		Tracker::logActivity($username, $role, $study, $visitObject->id_visit, "Upload Series", $logDetails);
136 136
 	
137
-	}catch (Throwable $e1) {
137
+	} catch (Throwable $e1) {
138 138
 		error_log($e1->getMessage());
139 139
 		handleException($e1);
140 140
 		header('HTTP/1.0 500 Internal Server Error');
141 141
 	}
142 142
 		
143 143
 
144
-}else {
144
+} else {
145 145
 	header('HTTP/1.0 403 Forbidden');
146 146
 	die('You are not allowed to access this file.');
147 147
 }
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	
197 197
 	if (count($importedMap) == 1 && $importedInstances == $nbOfInstances) {
198 198
 		return $importedMap;
199
-	}else {
199
+	} else {
200 200
 		//These error shall never occur
201 201
 		if (count($importedMap) > 1) {
202 202
 			throw new Exception("More than one study in Zip");
203
-		}else if ($importedInstances != $nbOfInstances) {
203
+		} else if ($importedInstances != $nbOfInstances) {
204 204
 			throw new Exception("Imported DICOM not matching announced number of Instances");
205 205
 			
206 206
 		}
@@ -216,8 +216,11 @@  discard block
 block discarded – undo
216 216
 	$it=new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS);
217 217
 	$it=new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
218 218
 	foreach ($it as $file) {
219
-		if ($file->isDir()) rmdir($file->getPathname());
220
-		else unlink($file->getPathname());
219
+		if ($file->isDir()) {
220
+			rmdir($file->getPathname());
221
+		} else {
222
+			unlink($file->getPathname());
223
+		}
221 224
 	}
222 225
 	rmdir($directory);
223 226
 }
Please login to merge, or discard this patch.