Completed
Push — 1.11.x ( 60645e...aacf46 )
by José
76:05 queued 37:57
created
main/work/view.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /* For licensing terms, see /license.txt */
3 3
 
4 4
 require_once '../inc/global.inc.php';
5
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
5
+$current_course_tool = TOOL_STUDENTPUBLICATION;
6 6
 
7 7
 require_once 'work.lib.php';
8 8
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     $userInfo = api_get_user_info($work['user_id']);
53 53
     $interbreadcrumb[] = array('url' => $url_dir, 'name' => $my_folder_data['title']);
54 54
     $interbreadcrumb[] = array('url' => '#', 'name' => $userInfo['complete_name']);
55
-    $interbreadcrumb[] = array('url' => '#','name' => $work['title']);
55
+    $interbreadcrumb[] = array('url' => '#', 'name' => $work['title']);
56 56
 
57 57
     if (($courseInfo['show_score'] == 0 &&
58 58
         $work['active'] == 1 &&
Please login to merge, or discard this patch.
main/work/edit.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use ChamiloSession as Session;
5 5
 
6 6
 require_once '../inc/global.inc.php';
7
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
7
+$current_course_tool = TOOL_STUDENTPUBLICATION;
8 8
 
9 9
 api_protect_course_script(true);
10 10
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 $token = Security::get_token();
51 51
 
52 52
 $student_can_edit_in_session = api_is_allowed_to_session_edit(false, true);
53
-$has_ended   = false;
53
+$has_ended = false;
54 54
 $is_author = false;
55 55
 $work_item = get_work_data_by_id($item_id);
56 56
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 $form->setDefaults($defaults);
221 221
 $error_message = null;
222 222
 $_course = api_get_course_info();
223
-$currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH).$_course['path'] . '/';
223
+$currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH).$_course['path'].'/';
224 224
 
225 225
 $succeed = false;
226 226
 if ($form->validate()) {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             $description = isset($_POST['description']) ? $_POST['description'] : $work_data['description'];
242 242
 
243 243
             $add_to_update = null;
244
-            if ($is_allowed_to_edit && ($_POST['qualification'] !='' )) {
244
+            if ($is_allowed_to_edit && ($_POST['qualification'] != '')) {
245 245
                 $add_to_update = ', qualificator_id ='."'".api_get_user_id()."', ";
246 246
                 $add_to_update .= ' qualification = '."'".Database::escape_string($_POST['qualification'])."',";
247 247
                 $add_to_update .= ' date_of_qualification = '."'".api_get_utc_datetime()."'";
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                     'error'
268 268
                 );
269 269
             } else {
270
-                $sql = "UPDATE  " . $work_table . "
270
+                $sql = "UPDATE  ".$work_table."
271 271
                         SET	title = '".Database::escape_string($title)."',
272 272
                             description = '".Database::escape_string($description)."'
273 273
                             ".$add_to_update."
Please login to merge, or discard this patch.
main/work/work_missing.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /* For licensing terms, see /license.txt */
3 3
 
4 4
 require_once '../inc/global.inc.php';
5
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
5
+$current_course_tool = TOOL_STUDENTPUBLICATION;
6 6
 
7 7
 /*	Configuration settings */
8 8
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 $token = Security::get_token();
57 57
 
58 58
 if (!empty($group_id)) {
59
-    $group_properties  = GroupManager::get_group_properties($group_id);
59
+    $group_properties = GroupManager::get_group_properties($group_id);
60 60
     $show_work = false;
61 61
 
62 62
     if (api_is_allowed_to_edit(false, true)) {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 if (!empty($workId)) {
109 109
     if (empty($_GET['list']) or Security::remove_XSS($_GET['list']) == 'with') {
110 110
         $output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$workId.'&list=without">'.
111
-            Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'),'',ICON_SIZE_MEDIUM)."</a>";
111
+            Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'), '', ICON_SIZE_MEDIUM)."</a>";
112 112
     } else {
113 113
         if (!isset($_GET['action']) || (isset($_GET['action']) && $_GET['action'] != 'send_mail')) {
114 114
             $output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$workId.'&list=without&action=send_mail&sec_token='.$token.'">'.
Please login to merge, or discard this patch.
main/dropbox/recover_dropbox_files.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 $result = Database::query($sql);
34 34
 
35 35
 if (Database::num_rows($result)) {
36
-    $files  = Database::store_result($result);
36
+    $files = Database::store_result($result);
37 37
     $rows = array();
38 38
     foreach ($files as $file) {
39 39
         //Check if I have this file:
Please login to merge, or discard this patch.
main/dropbox/dropbox_init.inc.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     //sentArray keeps list of all files still available in the sent files list
222 222
     //of the user.
223 223
     //This is used to show or hide the overwrite file-radio button of the upload form
224
-	$javascript .= "
224
+    $javascript .= "
225 225
 		var sentArray = new Array(";
226 226
     if (isset($dropbox_person)) {
227 227
         for ($i = 0; $i < count($dropbox_person->sentWork); $i++) {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
             $javascript .= "'".$dropbox_person->sentWork[$i]->title."'";
232 232
         }
233 233
     }
234
-	$javascript .= ");
234
+    $javascript .= ");
235 235
 
236 236
 		function checkfile(str)
237 237
 		{
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 
297 297
 $checked_files = false;
298 298
 if (!$view || $view == 'received') {
299
-	$part = 'received';
299
+    $part = 'received';
300 300
 } elseif ($view = 'sent') {
301
-	$part = 'sent';
301
+    $part = 'sent';
302 302
 } else {
303
-	header('location: index.php?view='.$view.'&error=Error');
304
-	exit;
303
+    header('location: index.php?view='.$view.'&error=Error');
304
+    exit;
305 305
 }
306 306
 
307 307
 if (($postAction == 'download_received' || $postAction == 'download_sent') and !$_POST['store_feedback']) {
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     } else {
326 326
         api_not_allowed();
327 327
     }
328
-	exit();
328
+    exit();
329 329
 }
330 330
 
331 331
 /*	BREADCRUMBS */
@@ -335,45 +335,45 @@  discard block
 block discarded – undo
335 335
         'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(),
336 336
         'name' => get_lang('Dropbox', ''),
337 337
     );
338
-	$nameTools = get_lang('ReceivedFiles');
338
+    $nameTools = get_lang('ReceivedFiles');
339 339
 
340
-	if ($action == 'addreceivedcategory') {
340
+    if ($action == 'addreceivedcategory') {
341 341
         $interbreadcrumb[] = array(
342 342
             'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=received&'.api_get_cidreq(),
343 343
             'name' => get_lang('ReceivedFiles'),
344 344
         );
345
-		$nameTools = get_lang('AddNewCategory');
346
-	}
345
+        $nameTools = get_lang('AddNewCategory');
346
+    }
347 347
 }
348 348
 
349 349
 if ($view == 'sent' || empty($view)) {
350 350
     $interbreadcrumb[] = array(
351 351
         'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(),
352
-		'name' => get_lang('Dropbox')
352
+        'name' => get_lang('Dropbox')
353 353
     );
354
-	$nameTools = get_lang('SentFiles');
355
-
356
-	if ($action == 'addsentcategory') {
357
-		$interbreadcrumb[] = array(
358
-			'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(),
359
-			'name' => get_lang('SentFiles'),
360
-		);
361
-		$nameTools = get_lang('AddNewCategory');
362
-	}
363
-	if ($action == 'add') {
364
-		$interbreadcrumb[] = array(
365
-			'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(),
366
-			'name' => get_lang('SentFiles'),
367
-		);
368
-		$nameTools = get_lang('UploadNewFile');
369
-	}
354
+    $nameTools = get_lang('SentFiles');
355
+
356
+    if ($action == 'addsentcategory') {
357
+        $interbreadcrumb[] = array(
358
+            'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(),
359
+            'name' => get_lang('SentFiles'),
360
+        );
361
+        $nameTools = get_lang('AddNewCategory');
362
+    }
363
+    if ($action == 'add') {
364
+        $interbreadcrumb[] = array(
365
+            'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(),
366
+            'name' => get_lang('SentFiles'),
367
+        );
368
+        $nameTools = get_lang('UploadNewFile');
369
+    }
370 370
 }
371 371
 
372 372
 /*	HEADER & TITLE */
373 373
 
374 374
 if (isset($origin) && $origin == 'learnpath') {
375 375
     $htmlHeadXtra[] = $javascript;
376
-	Display::display_reduced_header($nameTools, 'Dropbox');
376
+    Display::display_reduced_header($nameTools, 'Dropbox');
377 377
 } else {
378 378
     Display::display_header($nameTools, 'Dropbox');
379 379
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 $is_courseTutor = api_is_course_tutor();
127 127
 $is_courseAdmin = api_is_course_admin();
128 128
 
129
-$current_course_tool  = TOOL_DROPBOX;
129
+$current_course_tool = TOOL_DROPBOX;
130 130
 
131 131
 // the dropbox configuration parameters
132 132
 $dropbox_cnf = require_once 'dropbox_config.inc.php';
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 $javascript .= "
279 279
 	</script>";
280 280
 $htmlHeadXtra[] = $javascript;
281
-$htmlHeadXtra[] ="<script>
281
+$htmlHeadXtra[] = "<script>
282 282
 function confirmation (name)
283 283
 {
284
-	if (confirm(\" ". get_lang("AreYouSureToDeleteJS") ." \"+ name + \" ?\"))
284
+	if (confirm(\" ". get_lang("AreYouSureToDeleteJS")." \"+ name + \" ?\"))
285 285
 		{return true;}
286 286
 	else
287 287
 		{return false;}
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 if ((!$is_allowed_in_course || !$is_course_member) && !api_is_allowed_to_edit(null, true)) {
323 323
     if ($origin != 'learnpath') {
324
-        api_not_allowed(true);//print headers/footers
324
+        api_not_allowed(true); //print headers/footers
325 325
     } else {
326 326
         api_not_allowed();
327 327
     }
Please login to merge, or discard this patch.
main/dropbox/index.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -220,23 +220,23 @@  discard block
 block discarded – undo
220 220
 
221 221
 		if (api_get_session_id() == 0) {
222 222
 			echo '<div class="actions">';
223
-			if ($view_dropbox_category_received != 0  && api_is_allowed_to_session_edit(false, true)) {
224
-				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
223
+			if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) {
224
+				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'), '', ICON_SIZE_MEDIUM)."</a>";
225 225
 				echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> ';
226 226
 				$movelist[0] = 'Root'; // move_received selectbox content
227 227
 			} else {
228
-				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>';
228
+				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'), '', ICON_SIZE_MEDIUM).'</a>';
229 229
 			}
230 230
 			echo '</div>';
231 231
 		} else {
232 232
 			if (api_is_allowed_to_session_edit(false, true)) {
233 233
 				echo '<div class="actions">';
234 234
 				if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) {
235
-					echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
235
+					echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'), '', ICON_SIZE_MEDIUM)."</a>";
236 236
 					echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> ';
237 237
 					$movelist[0] = 'Root'; // move_received selectbox content
238 238
 				} else {
239
-					echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>';
239
+					echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'), '', ICON_SIZE_MEDIUM).'</a>';
240 240
 				}
241 241
 				echo '</div>';
242 242
 			}
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 		if (api_get_session_id() == 0) {
257 257
 			echo '<div class="actions">';
258 258
 			if ($view_dropbox_category_sent != 0) {
259
-				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
259
+				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'), '', ICON_SIZE_MEDIUM)."</a>";
260 260
 				echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> ';
261 261
 			} else {
262
-				echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n";
262
+				echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'), '', ICON_SIZE_MEDIUM)."</a>\n";
263 263
 			}
264 264
 			if (empty($viewSentCategory)) {
265
-				echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>";
265
+				echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'), '', ICON_SIZE_MEDIUM)."</a>";
266 266
 			}
267 267
 			echo '</div>';
268 268
 		} else {
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 				echo '<div class="actions">';
271 271
 				if ($view_dropbox_category_sent != 0) {
272 272
 					echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> ';
273
-					echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
273
+					echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'), '', ICON_SIZE_MEDIUM)."</a>";
274 274
 				} else {
275
-					echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n";
275
+					echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'), '', ICON_SIZE_MEDIUM)."</a>\n";
276 276
 				}
277 277
 				if (empty($viewSentCategory)) {
278
-					echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>";
278
+					echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'), '', ICON_SIZE_MEDIUM)."</a>";
279 279
 				}
280 280
 				echo '</div>';
281 281
 			}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
 		if (api_get_session_id() == 0) {
330 330
 			$column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
331
-		} elseif (api_is_allowed_to_session_edit(false,true)) {
331
+		} elseif (api_is_allowed_to_session_edit(false, true)) {
332 332
 			$column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
333 333
 		}
334 334
 
@@ -373,13 +373,13 @@  discard block
 block discarded – undo
373 373
 				if ($dropbox_file->last_upload_date > $last_access &&
374 374
                     !in_array($dropbox_file->id, $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])
375 375
                 ) {
376
-					$new_icon = '&nbsp;'.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL);
376
+					$new_icon = '&nbsp;'.Display::return_icon('new_dropbox_message.png', get_lang('New'), '', ICON_SIZE_SMALL);
377 377
 				}
378 378
 
379 379
 				$link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
380 380
 				$dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
381 381
 				$dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
382
-                    Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description;
382
+                    Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'), ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description;
383 383
 				$file_size = $dropbox_file->filesize;
384 384
 				$dropbox_file_data[] = format_file_size($file_size);
385 385
 				$dropbox_file_data[] = $dropbox_file->author;
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
                     api_format_date($last_upload_date).'</span>';
390 390
 
391 391
 				$action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
392
-                <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a>
393
-                <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a>
392
+                <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'), '', ICON_SIZE_SMALL).'</a>
393
+                <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'), '', ICON_SIZE_SMALL).'</a>
394 394
                 <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.
395
-                Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
395
+                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
396 396
 
397 397
 				// This is a hack to have an additional row in a sortable table
398 398
 
@@ -426,12 +426,12 @@  discard block
 block discarded – undo
426 426
 					// The icon of the category
427 427
 					$link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">';
428 428
 					$dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>';
429
-					$dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>';
429
+					$dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>';
430 430
 					$dropbox_category_data[] = '';
431 431
 					$dropbox_category_data[] = '';
432 432
 					$dropbox_category_data[] = '';
433
-					$dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>
434
-										  <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
433
+					$dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>
434
+										  <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
435 435
 				}
436 436
 				if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) {
437 437
 					$dropbox_data_recieved[] = $dropbox_category_data;
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
         );
452 452
 
453 453
 		if (is_array($movelist)) {
454
-			foreach ($movelist as $catid => $catname){
455
-				$selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname);
454
+			foreach ($movelist as $catid => $catname) {
455
+				$selectlist['move_received_'.$catid] = get_lang('Move').'->'.Security::remove_XSS($catname);
456 456
 			}
457 457
 		}
458 458
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 				$link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
547 547
 				$dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
548 548
 				$dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
549
-                    Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description;
549
+                    Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description;
550 550
 				$file_size = $dropbox_file->filesize;
551 551
 				$dropbox_file_data[] = format_file_size($file_size);
552 552
                 $receivers_celldata = null;
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 				$receivers_celldata = '';
564 564
 
565 565
 				$action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
566
-                    <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a>
567
-                    <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a>
568
-                    <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
566
+                    <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'), '', ICON_SIZE_SMALL).'</a>
567
+                    <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'), '', ICON_SIZE_SMALL).'</a>
568
+                    <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
569 569
 				// This is a hack to have an additional row in a sortable table
570 570
 				if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) {
571 571
 					$action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table
@@ -594,16 +594,16 @@  discard block
 block discarded – undo
594 594
 					// This is where the checkbox icon for the files appear.
595 595
 					$link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">';
596 596
 					$dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>';
597
-					$dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>';
597
+					$dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>';
598 598
 					//$dropbox_category_data[] = '';
599 599
 					$dropbox_category_data[] = '';
600 600
 					//$dropbox_category_data[] = '';
601 601
 					$dropbox_category_data[] = '';
602 602
 					$dropbox_category_data[] = '';
603 603
 					$dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.
604
-                                    Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>
604
+                                    Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>
605 605
 									<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.
606
-                                    Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
606
+                                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
607 607
 				}
608 608
 				if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) {
609 609
 					$dropbox_data_sent[] = $dropbox_category_data;
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
         if (!empty($moveList)) {
627 627
             foreach ($moveList as $catid => $catname) {
628
-                $selectlist['move_sent_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname);
628
+                $selectlist['move_sent_'.$catid] = get_lang('Move').'->'.Security::remove_XSS($catname);
629 629
             }
630 630
         }
631 631
 
Please login to merge, or discard this patch.
Indentation   +428 added lines, -428 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 $last_access = '';
8 8
 // get the last time the user accessed the tool
9 9
 if (isset($_SESSION[$_course['id']]) && $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') {
10
-	$last_access = get_last_tool_access(TOOL_DROPBOX);
11
-	$_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access;
10
+    $last_access = get_last_tool_access(TOOL_DROPBOX);
11
+    $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access;
12 12
 } else {
13
-	if (isset($_SESSION[$_course['id']])) {
14
-		$last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX];
15
-	}
13
+    if (isset($_SESSION[$_course['id']])) {
14
+        $last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX];
15
+    }
16 16
 }
17 17
 
18 18
 $postAction = isset($_POST['action']) ? $_POST['action'] : null;
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
 // Display the form for adding a new dropbox item.
51 51
 if ($action == 'add') {
52
-	if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
53
-		api_not_allowed();
54
-	}
52
+    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
53
+        api_not_allowed();
54
+    }
55 55
     display_add_form(
56 56
         $dropbox_unid,
57 57
         $viewReceivedCategory,
@@ -61,56 +61,56 @@  discard block
 block discarded – undo
61 61
 }
62 62
 
63 63
 if (isset($_POST['submitWork'])) {
64
-	$check = Security::check_token();
65
-	if ($check) {
64
+    $check = Security::check_token();
65
+    if ($check) {
66 66
         store_add_dropbox();
67
-	}
67
+    }
68 68
 }
69 69
 
70 70
 // Display the form for adding a category
71 71
 if ($action == 'addreceivedcategory' || $action == 'addsentcategory') {
72
-	if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
73
-		api_not_allowed();
74
-	}
75
-	$categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : '';
76
-	display_addcategory_form($categoryName, '', $_GET['action']);
72
+    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
73
+        api_not_allowed();
74
+    }
75
+    $categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : '';
76
+    display_addcategory_form($categoryName, '', $_GET['action']);
77 77
 }
78 78
 
79 79
 // Editing a category: displaying the form
80 80
 if ($action == 'editcategory' && isset($_GET['id'])) {
81
-	if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
82
-		api_not_allowed();
83
-	}
84
-	if (!$_POST) {
85
-		if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
86
-			api_not_allowed();
87
-		}
88
-		display_addcategory_form('', $_GET['id'], 'editcategory');
89
-	}
81
+    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
82
+        api_not_allowed();
83
+    }
84
+    if (!$_POST) {
85
+        if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
86
+            api_not_allowed();
87
+        }
88
+        display_addcategory_form('', $_GET['id'], 'editcategory');
89
+    }
90 90
 }
91 91
 
92 92
 // Storing a new or edited category
93 93
 if (isset($_POST['StoreCategory'])) {
94
-	if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
95
-		api_not_allowed();
96
-	}
97
-	$return_information = store_addcategory();
98
-	if ($return_information['type'] == 'confirmation') {
99
-		Display :: display_confirmation_message($return_information['message']);
100
-	}
101
-	if ($return_information['type'] == 'error') {
102
-		Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']);
103
-		display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction);
104
-	}
94
+    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
95
+        api_not_allowed();
96
+    }
97
+    $return_information = store_addcategory();
98
+    if ($return_information['type'] == 'confirmation') {
99
+        Display :: display_confirmation_message($return_information['message']);
100
+    }
101
+    if ($return_information['type'] == 'error') {
102
+        Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']);
103
+        display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction);
104
+    }
105 105
 }
106 106
 
107 107
 
108 108
 // Move a File
109 109
 if (($action == 'movesent' || $action == 'movereceived') AND isset($_GET['move_id'])) {
110
-	if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
111
-		api_not_allowed();
112
-	}
113
-	display_move_form(
110
+    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
111
+        api_not_allowed();
112
+    }
113
+    display_move_form(
114 114
         str_replace('move', '', $action),
115 115
         $_GET['move_id'],
116 116
         get_dropbox_categories(str_replace('move', '', $action)),
@@ -121,33 +121,33 @@  discard block
 block discarded – undo
121 121
     );
122 122
 }
123 123
 if (isset($_POST['do_move'])) {
124
-	Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part']));
124
+    Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part']));
125 125
 }
126 126
 
127 127
 // Delete a file
128 128
 if (($action == 'deletereceivedfile' || $action == 'deletesentfile') AND isset($_GET['id']) AND is_numeric($_GET['id'])) {
129
-	if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
130
-		api_not_allowed();
131
-	}
132
-	$dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
133
-	if ($action == 'deletereceivedfile') {
134
-		$dropboxfile->deleteReceivedWork($_GET['id']);
135
-		$message = get_lang('ReceivedFileDeleted');
136
-	}
137
-	if ($action == 'deletesentfile') {
138
-		$dropboxfile->deleteSentWork($_GET['id']);
139
-		$message = get_lang('SentFileDeleted');
140
-	}
141
-	Display :: display_confirmation_message($message);
129
+    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
130
+        api_not_allowed();
131
+    }
132
+    $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
133
+    if ($action == 'deletereceivedfile') {
134
+        $dropboxfile->deleteReceivedWork($_GET['id']);
135
+        $message = get_lang('ReceivedFileDeleted');
136
+    }
137
+    if ($action == 'deletesentfile') {
138
+        $dropboxfile->deleteSentWork($_GET['id']);
139
+        $message = get_lang('SentFileDeleted');
140
+    }
141
+    Display :: display_confirmation_message($message);
142 142
 }
143 143
 
144 144
 // Delete a category
145 145
 if (($action == 'deletereceivedcategory' || $action == 'deletesentcategory') AND isset($_GET['id']) AND is_numeric($_GET['id'])) {
146
-	if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
147
-		api_not_allowed();
148
-	}
149
-	$message = delete_category($action, $_GET['id']);
150
-	Display :: display_confirmation_message($message);
146
+    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
147
+        api_not_allowed();
148
+    }
149
+    $message = delete_category($action, $_GET['id']);
150
+    Display :: display_confirmation_message($message);
151 151
 }
152 152
 
153 153
 // Do an action on multiple files
@@ -162,27 +162,27 @@  discard block
 block discarded – undo
162 162
     $postAction == 'delete_sent' ||
163 163
     $postAction == 'download_sent')
164 164
 ) {
165
-	$display_message = handle_multiple_actions();
166
-	Display :: display_normal_message($display_message);
165
+    $display_message = handle_multiple_actions();
166
+    Display :: display_normal_message($display_message);
167 167
 }
168 168
 
169 169
 // Store Feedback
170 170
 
171 171
 if (isset($_POST['feedback'])) {
172
-	if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
173
-		api_not_allowed();
174
-	}
175
-	$check = Security::check_token();
176
-	if ($check) {
177
-		$display_message = store_feedback();
178
-		Display :: display_normal_message($display_message);
179
-		Security::check_token();
180
-	}
172
+    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
173
+        api_not_allowed();
174
+    }
175
+    $check = Security::check_token();
176
+    if ($check) {
177
+        $display_message = store_feedback();
178
+        Display :: display_normal_message($display_message);
179
+        Security::check_token();
180
+    }
181 181
 }
182 182
 
183 183
 // Error Message
184 184
 if (isset($_GET['error']) AND !empty($_GET['error'])) {
185
-	Display :: display_normal_message(get_lang($_GET['error']));
185
+    Display :: display_normal_message(get_lang($_GET['error']));
186 186
 }
187 187
 
188 188
 $dropbox_data_sent = array();
@@ -190,96 +190,96 @@  discard block
 block discarded – undo
190 190
 $dropbox_data_recieved = array();
191 191
 
192 192
 if ($action != 'add') {
193
-	// Getting all the categories in the dropbox for the given user
194
-	$dropbox_categories = get_dropbox_categories();
195
-	// Greating the arrays with the categories for the received files and for the sent files
196
-	foreach ($dropbox_categories as $category) {
197
-		if ($category['received'] == '1') {
198
-			$dropbox_received_category[] = $category;
199
-		}
200
-		if ($category['sent'] == '1') {
201
-			$dropbox_sent_category[] = $category;
202
-		}
203
-	}
204
-
205
-	// ACTIONS
206
-	if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) {
207
-		//echo '<h3>'.get_lang('ReceivedFiles').'</h3>';
208
-
209
-		// This is for the categories
210
-		if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') {
211
-			$view_dropbox_category_received = $viewReceivedCategory;
212
-		} else {
213
-			$view_dropbox_category_received = 0;
214
-		}
215
-
216
-		/* Menu Received */
217
-
218
-		if (api_get_session_id() == 0) {
219
-			echo '<div class="actions">';
220
-			if ($view_dropbox_category_received != 0  && api_is_allowed_to_session_edit(false, true)) {
221
-				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
222
-				echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> ';
223
-				$movelist[0] = 'Root'; // move_received selectbox content
224
-			} else {
225
-				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>';
226
-			}
227
-			echo '</div>';
228
-		} else {
229
-			if (api_is_allowed_to_session_edit(false, true)) {
230
-				echo '<div class="actions">';
231
-				if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) {
232
-					echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
233
-					echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> ';
234
-					$movelist[0] = 'Root'; // move_received selectbox content
235
-				} else {
236
-					echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>';
237
-				}
238
-				echo '</div>';
239
-			}
240
-		}
241
-	}
242
-
243
-	if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) {
244
-		// This is for the categories
245
-		if (isset($viewSentCategory) AND $viewSentCategory != '') {
246
-			$view_dropbox_category_sent = $viewSentCategory;
247
-		} else {
248
-			$view_dropbox_category_sent = 0;
249
-		}
250
-
251
-		/* Menu Sent */
252
-
253
-		if (api_get_session_id() == 0) {
254
-			echo '<div class="actions">';
255
-			if ($view_dropbox_category_sent != 0) {
256
-				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
257
-				echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> ';
258
-			} else {
259
-				echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n";
260
-			}
261
-			if (empty($viewSentCategory)) {
262
-				echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>";
263
-			}
264
-			echo '</div>';
265
-		} else {
266
-			if (api_is_allowed_to_session_edit(false, true)) {
267
-				echo '<div class="actions">';
268
-				if ($view_dropbox_category_sent != 0) {
269
-					echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> ';
270
-					echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
271
-				} else {
272
-					echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n";
273
-				}
274
-				if (empty($viewSentCategory)) {
275
-					echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>";
276
-				}
277
-				echo '</div>';
278
-			}
279
-		}
280
-	}
281
-	/*	THE MENU TABS */
282
-	if ($dropbox_cnf['sent_received_tabs']) {
193
+    // Getting all the categories in the dropbox for the given user
194
+    $dropbox_categories = get_dropbox_categories();
195
+    // Greating the arrays with the categories for the received files and for the sent files
196
+    foreach ($dropbox_categories as $category) {
197
+        if ($category['received'] == '1') {
198
+            $dropbox_received_category[] = $category;
199
+        }
200
+        if ($category['sent'] == '1') {
201
+            $dropbox_sent_category[] = $category;
202
+        }
203
+    }
204
+
205
+    // ACTIONS
206
+    if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) {
207
+        //echo '<h3>'.get_lang('ReceivedFiles').'</h3>';
208
+
209
+        // This is for the categories
210
+        if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') {
211
+            $view_dropbox_category_received = $viewReceivedCategory;
212
+        } else {
213
+            $view_dropbox_category_received = 0;
214
+        }
215
+
216
+        /* Menu Received */
217
+
218
+        if (api_get_session_id() == 0) {
219
+            echo '<div class="actions">';
220
+            if ($view_dropbox_category_received != 0  && api_is_allowed_to_session_edit(false, true)) {
221
+                echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
222
+                echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> ';
223
+                $movelist[0] = 'Root'; // move_received selectbox content
224
+            } else {
225
+                echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>';
226
+            }
227
+            echo '</div>';
228
+        } else {
229
+            if (api_is_allowed_to_session_edit(false, true)) {
230
+                echo '<div class="actions">';
231
+                if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) {
232
+                    echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
233
+                    echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> ';
234
+                    $movelist[0] = 'Root'; // move_received selectbox content
235
+                } else {
236
+                    echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>';
237
+                }
238
+                echo '</div>';
239
+            }
240
+        }
241
+    }
242
+
243
+    if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) {
244
+        // This is for the categories
245
+        if (isset($viewSentCategory) AND $viewSentCategory != '') {
246
+            $view_dropbox_category_sent = $viewSentCategory;
247
+        } else {
248
+            $view_dropbox_category_sent = 0;
249
+        }
250
+
251
+        /* Menu Sent */
252
+
253
+        if (api_get_session_id() == 0) {
254
+            echo '<div class="actions">';
255
+            if ($view_dropbox_category_sent != 0) {
256
+                echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
257
+                echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> ';
258
+            } else {
259
+                echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n";
260
+            }
261
+            if (empty($viewSentCategory)) {
262
+                echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>";
263
+            }
264
+            echo '</div>';
265
+        } else {
266
+            if (api_is_allowed_to_session_edit(false, true)) {
267
+                echo '<div class="actions">';
268
+                if ($view_dropbox_category_sent != 0) {
269
+                    echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> ';
270
+                    echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>";
271
+                } else {
272
+                    echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n";
273
+                }
274
+                if (empty($viewSentCategory)) {
275
+                    echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>";
276
+                }
277
+                echo '</div>';
278
+            }
279
+        }
280
+    }
281
+    /*	THE MENU TABS */
282
+    if ($dropbox_cnf['sent_received_tabs']) {
283 283
 ?>
284 284
 <ul class="nav nav-tabs">
285 285
     <li <?php if (!$view || $view == 'sent') { echo 'class="active"'; } ?> >
@@ -293,150 +293,150 @@  discard block
 block discarded – undo
293 293
     </li>
294 294
 </ul>
295 295
 <?php
296
-	}
296
+    }
297 297
     /*	RECEIVED FILES */
298
-	if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) {
299
-		// This is for the categories
300
-		if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') {
301
-			$view_dropbox_category_received = $viewReceivedCategory;
302
-		} else {
303
-			$view_dropbox_category_received = 0;
304
-		}
305
-
306
-		// Object initialisation
307
-		$dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
308
-		 // note: are the $is_courseAdmin and $is_courseTutor parameters needed????
309
-
310
-		// Constructing the array that contains the total number of feedback messages per document.
311
-		$number_feedback = get_total_number_feedback();
312
-
313
-		// Sorting and paging options
314
-		$sorting_options = array();
315
-		$paging_options = array();
316
-
317
-		// The headers of the sortable tables
318
-		$column_header = array();
319
-		$column_header[] = array('', false, '');
320
-		$column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"');
321
-		$column_header[] = array(get_lang('ReceivedTitle'), true, '');
322
-		$column_header[] = array(get_lang('Size'), true, '');
323
-		$column_header[] = array(get_lang('Authors'), true, '');
324
-		$column_header[] = array(get_lang('LastResent'), true);
325
-
326
-		if (api_get_session_id() == 0) {
327
-			$column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
328
-		} elseif (api_is_allowed_to_session_edit(false,true)) {
329
-			$column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
330
-		}
331
-
332
-		$column_header[] = array('RealDate', true);
333
-		$column_header[] = array('RealSize', true);
334
-
335
-		// An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide
336
-		$column_show[] = 1;
337
-		$column_show[] = 1;
338
-		$column_show[] = 1;
339
-		$column_show[] = 1;
340
-		$column_show[] = 1;
341
-		$column_show[] = 1;
342
-
343
-		if (api_get_session_id() == 0) {
344
-			$column_show[] = 1;
345
-		} elseif (api_is_allowed_to_session_edit(false, true)) {
346
-			$column_show[] = 1;
347
-		}
348
-		$column_show[] = 0;
349
-
350
-		// Here we change the way how the columns are going to be sort
351
-		// in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
352
-		// because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
353
-
354
-		$column_order[3] = 8;
355
-		$column_order[5] = 7;
356
-
357
-		// The content of the sortable table = the received files
358
-		foreach ($dropbox_person -> receivedWork as $dropbox_file) {
359
-			$dropbox_file_data = array();
360
-			if ($view_dropbox_category_received == $dropbox_file->category) {
298
+    if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) {
299
+        // This is for the categories
300
+        if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') {
301
+            $view_dropbox_category_received = $viewReceivedCategory;
302
+        } else {
303
+            $view_dropbox_category_received = 0;
304
+        }
305
+
306
+        // Object initialisation
307
+        $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
308
+            // note: are the $is_courseAdmin and $is_courseTutor parameters needed????
309
+
310
+        // Constructing the array that contains the total number of feedback messages per document.
311
+        $number_feedback = get_total_number_feedback();
312
+
313
+        // Sorting and paging options
314
+        $sorting_options = array();
315
+        $paging_options = array();
316
+
317
+        // The headers of the sortable tables
318
+        $column_header = array();
319
+        $column_header[] = array('', false, '');
320
+        $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"');
321
+        $column_header[] = array(get_lang('ReceivedTitle'), true, '');
322
+        $column_header[] = array(get_lang('Size'), true, '');
323
+        $column_header[] = array(get_lang('Authors'), true, '');
324
+        $column_header[] = array(get_lang('LastResent'), true);
325
+
326
+        if (api_get_session_id() == 0) {
327
+            $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
328
+        } elseif (api_is_allowed_to_session_edit(false,true)) {
329
+            $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
330
+        }
331
+
332
+        $column_header[] = array('RealDate', true);
333
+        $column_header[] = array('RealSize', true);
334
+
335
+        // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide
336
+        $column_show[] = 1;
337
+        $column_show[] = 1;
338
+        $column_show[] = 1;
339
+        $column_show[] = 1;
340
+        $column_show[] = 1;
341
+        $column_show[] = 1;
342
+
343
+        if (api_get_session_id() == 0) {
344
+            $column_show[] = 1;
345
+        } elseif (api_is_allowed_to_session_edit(false, true)) {
346
+            $column_show[] = 1;
347
+        }
348
+        $column_show[] = 0;
349
+
350
+        // Here we change the way how the columns are going to be sort
351
+        // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
352
+        // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
353
+
354
+        $column_order[3] = 8;
355
+        $column_order[5] = 7;
356
+
357
+        // The content of the sortable table = the received files
358
+        foreach ($dropbox_person -> receivedWork as $dropbox_file) {
359
+            $dropbox_file_data = array();
360
+            if ($view_dropbox_category_received == $dropbox_file->category) {
361 361
                 // we only display the files that are in the category that we are in.
362
-				$dropbox_file_data[] = $dropbox_file->id;
362
+                $dropbox_file_data[] = $dropbox_file->id;
363 363
 
364
-				if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) {
365
-					$_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array();
366
-				}
364
+                if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) {
365
+                    $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array();
366
+                }
367 367
 
368
-				// New icon
369
-				$new_icon = '';
370
-				if ($dropbox_file->last_upload_date > $last_access &&
368
+                // New icon
369
+                $new_icon = '';
370
+                if ($dropbox_file->last_upload_date > $last_access &&
371 371
                     !in_array($dropbox_file->id, $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])
372 372
                 ) {
373
-					$new_icon = '&nbsp;'.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL);
374
-				}
373
+                    $new_icon = '&nbsp;'.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL);
374
+                }
375 375
 
376
-				$link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
377
-				$dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
378
-				$dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
376
+                $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
377
+                $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
378
+                $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
379 379
                     Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description;
380
-				$file_size = $dropbox_file->filesize;
381
-				$dropbox_file_data[] = format_file_size($file_size);
382
-				$dropbox_file_data[] = $dropbox_file->author;
380
+                $file_size = $dropbox_file->filesize;
381
+                $dropbox_file_data[] = format_file_size($file_size);
382
+                $dropbox_file_data[] = $dropbox_file->author;
383 383
 
384
-				$last_upload_date = api_get_local_time($dropbox_file->last_upload_date);
385
-				$dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'.
384
+                $last_upload_date = api_get_local_time($dropbox_file->last_upload_date);
385
+                $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'.
386 386
                     api_format_date($last_upload_date).'</span>';
387 387
 
388
-				$action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
388
+                $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
389 389
                 <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a>
390 390
                 <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a>
391 391
                 <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.
392 392
                 Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
393 393
 
394
-				// This is a hack to have an additional row in a sortable table
395
-
396
-				if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) {
397
-					$action_icons .= "</td></tr>"; // Ending the normal row of the sortable table
398
-					$action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>";
399
-				}
400
-				if (api_get_session_id() == 0) {
401
-					$dropbox_file_data[] = $action_icons;
402
-				} elseif (api_is_allowed_to_session_edit(false, true)) {
403
-					$dropbox_file_data[] = $action_icons;
404
-				}
405
-				$action_icons = '';
406
-				$dropbox_file_data[] = $last_upload_date;
407
-				$dropbox_file_data[] = $file_size;
408
-				$dropbox_data_recieved[] = $dropbox_file_data;
409
-			}
410
-		}
411
-
412
-		// The content of the sortable table = the categories (if we are not in the root)
413
-		if ($view_dropbox_category_received == 0) {
414
-			foreach ($dropbox_categories as $category) {
415
-			    /*  Note: This can probably be shortened since the categories
394
+                // This is a hack to have an additional row in a sortable table
395
+
396
+                if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) {
397
+                    $action_icons .= "</td></tr>"; // Ending the normal row of the sortable table
398
+                    $action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>";
399
+                }
400
+                if (api_get_session_id() == 0) {
401
+                    $dropbox_file_data[] = $action_icons;
402
+                } elseif (api_is_allowed_to_session_edit(false, true)) {
403
+                    $dropbox_file_data[] = $action_icons;
404
+                }
405
+                $action_icons = '';
406
+                $dropbox_file_data[] = $last_upload_date;
407
+                $dropbox_file_data[] = $file_size;
408
+                $dropbox_data_recieved[] = $dropbox_file_data;
409
+            }
410
+        }
411
+
412
+        // The content of the sortable table = the categories (if we are not in the root)
413
+        if ($view_dropbox_category_received == 0) {
414
+            foreach ($dropbox_categories as $category) {
415
+                /*  Note: This can probably be shortened since the categories
416 416
 			    for the received files are already in the
417 417
 			    $dropbox_received_category array;*/
418
-				$dropbox_category_data = array();
419
-				if ($category['received'] == '1') {
420
-					$movelist[$category['cat_id']] = $category['cat_name'];
418
+                $dropbox_category_data = array();
419
+                if ($category['received'] == '1') {
420
+                    $movelist[$category['cat_id']] = $category['cat_name'];
421 421
                     // This is where the checkbox icon for the files appear
422
-					$dropbox_category_data[] = $category['cat_id'];
423
-					// The icon of the category
424
-					$link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">';
425
-					$dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>';
426
-					$dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>';
427
-					$dropbox_category_data[] = '';
428
-					$dropbox_category_data[] = '';
429
-					$dropbox_category_data[] = '';
430
-					$dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>
422
+                    $dropbox_category_data[] = $category['cat_id'];
423
+                    // The icon of the category
424
+                    $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">';
425
+                    $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>';
426
+                    $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>';
427
+                    $dropbox_category_data[] = '';
428
+                    $dropbox_category_data[] = '';
429
+                    $dropbox_category_data[] = '';
430
+                    $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>
431 431
 										  <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
432
-				}
433
-				if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) {
434
-					$dropbox_data_recieved[] = $dropbox_category_data;
435
-				}
436
-			}
437
-		}
438
-
439
-		// Displaying the table
432
+                }
433
+                if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) {
434
+                    $dropbox_data_recieved[] = $dropbox_category_data;
435
+                }
436
+            }
437
+        }
438
+
439
+        // Displaying the table
440 440
         $additional_get_parameters = array(
441 441
             'view' => $view,
442 442
             'view_received_category' => $viewReceivedCategory,
@@ -447,15 +447,15 @@  discard block
 block discarded – undo
447 447
             'download_received' => get_lang('Download')
448 448
         );
449 449
 
450
-		if (is_array($movelist)) {
451
-			foreach ($movelist as $catid => $catname){
452
-				$selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname);
453
-			}
454
-		}
450
+        if (is_array($movelist)) {
451
+            foreach ($movelist as $catid => $catname){
452
+                $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname);
453
+            }
454
+        }
455 455
 
456
-		if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
457
-			$selectlist = array();
458
-		}
456
+        if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
457
+            $selectlist = array();
458
+        }
459 459
         echo '<div class="files-table">';
460 460
         Display::display_sortable_config_table(
461 461
             'dropbox',
@@ -469,154 +469,154 @@  discard block
 block discarded – undo
469 469
             $selectlist
470 470
         );
471 471
         echo '</div>';
472
-	}
473
-
474
-	/*	SENT FILES */
475
-
476
-	if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) {
477
-		// This is for the categories
478
-		if (isset($viewSentCategory) AND $viewSentCategory != '') {
479
-			$view_dropbox_category_sent = $viewSentCategory;
480
-		} else {
481
-			$view_dropbox_category_sent = 0;
482
-		}
483
-
484
-		// Object initialisation
485
-		$dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
486
-
487
-		// Constructing the array that contains the total number of feedback messages per document.
488
-		$number_feedback = get_total_number_feedback();
489
-
490
-		// Sorting and paging options
491
-		$sorting_options = array();
492
-		$paging_options = array();
493
-
494
-		// The headers of the sortable tables
495
-		$column_header = array();
496
-
497
-		$column_header[] = array('', false, '');
498
-		$column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"');
499
-		$column_header[] = array(get_lang('SentTitle'), true, '');
500
-		$column_header[] = array(get_lang('Size'), true, '');
501
-		$column_header[] = array(get_lang('SentTo'), true, '');
502
-		$column_header[] = array(get_lang('LastResent'), true, '');
503
-
504
-		if (api_get_session_id() == 0) {
505
-			$column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
506
-		} elseif (api_is_allowed_to_session_edit(false, true)) {
507
-			$column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
508
-		}
509
-
510
-		$column_header[] = array('RealDate', true);
511
-		$column_header[] = array('RealSize', true);
512
-
513
-		$column_show = array();
514
-		$column_order = array();
515
-
516
-		// An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide
517
-		$column_show[] = 1;
518
-		$column_show[] = 1;
519
-		$column_show[] = 1;
520
-		$column_show[] = 1;
521
-		$column_show[] = 1;
522
-		$column_show[] = 1;
523
-		if (api_get_session_id() == 0) {
524
-			$column_show[] = 1;
525
-		} elseif (api_is_allowed_to_session_edit(false, true)) {
526
-			$column_show[] = 1;
527
-		}
528
-		$column_show[] = 0;
529
-
530
-		// Here we change the way how the colums are going to be sort
531
-		// in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
532
-		// because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
533
-
534
-		$column_order[3] = 8;
535
-		$column_order[5] = 7;
536
-
537
-		// The content of the sortable table = the received files
538
-		foreach ($dropbox_person->sentWork as $dropbox_file) {
539
-			$dropbox_file_data = array();
540
-
541
-			if ($view_dropbox_category_sent == $dropbox_file->category) {
542
-				$dropbox_file_data[] = $dropbox_file->id;
543
-				$link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
544
-				$dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
545
-				$dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
472
+    }
473
+
474
+    /*	SENT FILES */
475
+
476
+    if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) {
477
+        // This is for the categories
478
+        if (isset($viewSentCategory) AND $viewSentCategory != '') {
479
+            $view_dropbox_category_sent = $viewSentCategory;
480
+        } else {
481
+            $view_dropbox_category_sent = 0;
482
+        }
483
+
484
+        // Object initialisation
485
+        $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
486
+
487
+        // Constructing the array that contains the total number of feedback messages per document.
488
+        $number_feedback = get_total_number_feedback();
489
+
490
+        // Sorting and paging options
491
+        $sorting_options = array();
492
+        $paging_options = array();
493
+
494
+        // The headers of the sortable tables
495
+        $column_header = array();
496
+
497
+        $column_header[] = array('', false, '');
498
+        $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"');
499
+        $column_header[] = array(get_lang('SentTitle'), true, '');
500
+        $column_header[] = array(get_lang('Size'), true, '');
501
+        $column_header[] = array(get_lang('SentTo'), true, '');
502
+        $column_header[] = array(get_lang('LastResent'), true, '');
503
+
504
+        if (api_get_session_id() == 0) {
505
+            $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
506
+        } elseif (api_is_allowed_to_session_edit(false, true)) {
507
+            $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
508
+        }
509
+
510
+        $column_header[] = array('RealDate', true);
511
+        $column_header[] = array('RealSize', true);
512
+
513
+        $column_show = array();
514
+        $column_order = array();
515
+
516
+        // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide
517
+        $column_show[] = 1;
518
+        $column_show[] = 1;
519
+        $column_show[] = 1;
520
+        $column_show[] = 1;
521
+        $column_show[] = 1;
522
+        $column_show[] = 1;
523
+        if (api_get_session_id() == 0) {
524
+            $column_show[] = 1;
525
+        } elseif (api_is_allowed_to_session_edit(false, true)) {
526
+            $column_show[] = 1;
527
+        }
528
+        $column_show[] = 0;
529
+
530
+        // Here we change the way how the colums are going to be sort
531
+        // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
532
+        // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
533
+
534
+        $column_order[3] = 8;
535
+        $column_order[5] = 7;
536
+
537
+        // The content of the sortable table = the received files
538
+        foreach ($dropbox_person->sentWork as $dropbox_file) {
539
+            $dropbox_file_data = array();
540
+
541
+            if ($view_dropbox_category_sent == $dropbox_file->category) {
542
+                $dropbox_file_data[] = $dropbox_file->id;
543
+                $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
544
+                $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
545
+                $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
546 546
                     Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description;
547
-				$file_size = $dropbox_file->filesize;
548
-				$dropbox_file_data[] = format_file_size($file_size);
547
+                $file_size = $dropbox_file->filesize;
548
+                $dropbox_file_data[] = format_file_size($file_size);
549 549
                 $receivers_celldata = null;
550
-				foreach ($dropbox_file->recipients as $recipient) {
551
-					$userInfo = api_get_user_info($recipient['user_id']);
552
-					$receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata;
553
-				}
554
-				$receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma.
555
-				$dropbox_file_data[] = $receivers_celldata;
556
-				$last_upload_date = api_get_local_time($dropbox_file->last_upload_date);
557
-				$dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'.
558
-					api_format_date($last_upload_date).'</span>';
559
-
560
-				//$dropbox_file_data[] = $dropbox_file->author;
561
-				$receivers_celldata = '';
562
-
563
-				$action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
550
+                foreach ($dropbox_file->recipients as $recipient) {
551
+                    $userInfo = api_get_user_info($recipient['user_id']);
552
+                    $receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata;
553
+                }
554
+                $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma.
555
+                $dropbox_file_data[] = $receivers_celldata;
556
+                $last_upload_date = api_get_local_time($dropbox_file->last_upload_date);
557
+                $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'.
558
+                    api_format_date($last_upload_date).'</span>';
559
+
560
+                //$dropbox_file_data[] = $dropbox_file->author;
561
+                $receivers_celldata = '';
562
+
563
+                $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
564 564
                     <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a>
565 565
                     <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a>
566 566
                     <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
567
-				// This is a hack to have an additional row in a sortable table
568
-				if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) {
569
-					$action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table
570
-					$action_icons .= "<tr><td colspan=\"2\">";
571
-					$action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>";
572
-					$action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>";
573
-				}
574
-				$dropbox_file_data[] = $action_icons;
575
-				$dropbox_file_data[] = $last_upload_date;
576
-				$dropbox_file_data[] = $file_size;
577
-				$action_icons = '';
578
-				$dropbox_data_sent[] = $dropbox_file_data;
579
-			}
580
-		}
567
+                // This is a hack to have an additional row in a sortable table
568
+                if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) {
569
+                    $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table
570
+                    $action_icons .= "<tr><td colspan=\"2\">";
571
+                    $action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>";
572
+                    $action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>";
573
+                }
574
+                $dropbox_file_data[] = $action_icons;
575
+                $dropbox_file_data[] = $last_upload_date;
576
+                $dropbox_file_data[] = $file_size;
577
+                $action_icons = '';
578
+                $dropbox_data_sent[] = $dropbox_file_data;
579
+            }
580
+        }
581 581
 
582 582
         $moveList = array();
583
-		// The content of the sortable table = the categories (if we are not in the root)
584
-		if ($view_dropbox_category_sent == 0) {
585
-			foreach ($dropbox_categories as $category) {
586
-				$dropbox_category_data = array();
583
+        // The content of the sortable table = the categories (if we are not in the root)
584
+        if ($view_dropbox_category_sent == 0) {
585
+            foreach ($dropbox_categories as $category) {
586
+                $dropbox_category_data = array();
587 587
 
588
-				if ($category['sent'] == '1') {
588
+                if ($category['sent'] == '1') {
589 589
 
590 590
                     $moveList[$category['cat_id']] = $category['cat_name'];
591
-					$dropbox_category_data[] = $category['cat_id'];
592
-					// This is where the checkbox icon for the files appear.
593
-					$link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">';
594
-					$dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>';
595
-					$dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>';
596
-					//$dropbox_category_data[] = '';
597
-					$dropbox_category_data[] = '';
598
-					//$dropbox_category_data[] = '';
599
-					$dropbox_category_data[] = '';
600
-					$dropbox_category_data[] = '';
601
-					$dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.
591
+                    $dropbox_category_data[] = $category['cat_id'];
592
+                    // This is where the checkbox icon for the files appear.
593
+                    $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">';
594
+                    $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>';
595
+                    $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>';
596
+                    //$dropbox_category_data[] = '';
597
+                    $dropbox_category_data[] = '';
598
+                    //$dropbox_category_data[] = '';
599
+                    $dropbox_category_data[] = '';
600
+                    $dropbox_category_data[] = '';
601
+                    $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.
602 602
                                     Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>
603 603
 									<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.
604 604
                                     Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
605
-				}
606
-				if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) {
607
-					$dropbox_data_sent[] = $dropbox_category_data;
608
-				}
609
-			}
610
-		}
611
-
612
-		// Displaying the table
613
-		$additional_get_parameters = array(
605
+                }
606
+                if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) {
607
+                    $dropbox_data_sent[] = $dropbox_category_data;
608
+                }
609
+            }
610
+        }
611
+
612
+        // Displaying the table
613
+        $additional_get_parameters = array(
614 614
             'view' => $view,
615 615
             'view_received_category' => $viewReceivedCategory,
616 616
             'view_sent_category' => $viewSentCategory
617 617
         );
618 618
 
619
-		$selectlist = array(
619
+        $selectlist = array(
620 620
             'delete_received' => get_lang('Delete'),
621 621
             'download_received' => get_lang('Download')
622 622
         );
@@ -627,12 +627,12 @@  discard block
 block discarded – undo
627 627
             }
628 628
         }
629 629
 
630
-		if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
631
-			$selectlist = array('download_received' => get_lang('Download'));
632
-		}
630
+        if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
631
+            $selectlist = array('download_received' => get_lang('Download'));
632
+        }
633 633
 
634 634
         echo '<div class="files-table">';
635
-		Display::display_sortable_config_table(
635
+        Display::display_sortable_config_table(
636 636
             'dropbox',
637 637
             $column_header,
638 638
             $dropbox_data_sent,
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
             $selectlist
645 645
         );
646 646
         echo '</div>';
647
-	}
647
+    }
648 648
 }
649 649
 
650 650
 Display::display_footer();
Please login to merge, or discard this patch.
main/inc/ajax/install.ajax.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 $action = $_GET['a'];
10 10
 
11 11
 switch ($action) {
12
-	case 'send_contact_information':
12
+    case 'send_contact_information':
13 13
         if (!empty($_POST)) {
14 14
             // get params from contact form
15 15
             $person_name = $_POST['person_name'];
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
             }
62 62
         break;
63
-	default:
64
-		echo '';
63
+    default:
64
+        echo '';
65 65
 }
66 66
 exit;
Please login to merge, or discard this patch.
main/inc/lib/webservices/MessagesWebService.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
                 'hasAttachments' => $hasAttachments,
119 119
                 'platform' => array(
120 120
                     'website' => api_get_path(WEB_PATH),
121
-                    'messagingTool' => api_get_path(WEB_PATH) . 'main/messages/inbox.php'
121
+                    'messagingTool' => api_get_path(WEB_PATH).'main/messages/inbox.php'
122 122
                 )
123 123
             );
124 124
         }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         }
202 202
 
203 203
         $headers = [
204
-            'Authorization: key=' . $gdcApiKey,
204
+            'Authorization: key='.$gdcApiKey,
205 205
             'Content-Type: application/json'
206 206
         ];
207 207
 
Please login to merge, or discard this patch.
main/inc/lib/geometry.lib.php 3 patches
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
  * @returns an array such as: for all i in [0..max[x][ : for all j in [0..max[y][ : array[i][j] = FALSE
14 14
  */
15 15
 function poly_init($max) {
16
-    return array_fill(0, $max["x"]-1,
17
-            array_fill(0, $max["y"]-1, FALSE));
16
+    return array_fill(0, $max["x"] - 1,
17
+            array_fill(0, $max["y"] - 1, FALSE));
18 18
 }
19 19
 
20 20
 
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
     	array_push($bords[$poly[0]['y']], $poly[0]['x']);
70 70
 
71 71
     $i = 1; // we re-use $i and $old_pente bellow the loop
72
-    $old_pente=0;
73
-    for (    ;    // for each points of the polygon but the first
74
-        $i<sizeof($poly) && (!empty($poly[$i]['x']) && !empty($poly[$i]['y'])); $i++) {
72
+    $old_pente = 0;
73
+    for (;    // for each points of the polygon but the first
74
+        $i < sizeof($poly) && (!empty($poly[$i]['x']) && !empty($poly[$i]['y'])); $i++) {
75 75
 
76 76
         /* special cases */
77
-        if ($poly[$i-1]['y'] == $poly[$i]['y']) {
78
-            if ($poly[$i-1]['x'] == $poly[$i]['x'])
77
+        if ($poly[$i - 1]['y'] == $poly[$i]['y']) {
78
+            if ($poly[$i - 1]['x'] == $poly[$i]['x'])
79 79
                 continue; // twice the same point
80 80
             else {    //  infinite elevation of the edge
81 81
             	if (is_array($bords[$poly[$i]['y']]))
82
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
83
-                $old_pente=0;
82
+                	array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
83
+                $old_pente = 0;
84 84
                 continue;
85 85
             }
86 86
         }
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 
94 94
         /* computing the elevation of the edge going */
95 95
         //        from $poly[$i-1] to $poly[$i]
96
-        $pente = ($poly[$i-1]['x']-$poly[$i]['x'])/
97
-                 ($poly[$i-1]['y']-$poly[$i]['y']);
96
+        $pente = ($poly[$i - 1]['x'] - $poly[$i]['x']) /
97
+                 ($poly[$i - 1]['y'] - $poly[$i]['y']);
98 98
 
99 99
         // if the sign of the elevation change from the one of the
100 100
         // previous edge, the point must be added a second time inside
101 101
         // $bords
102
-        if ($i>1)
103
-            if (($old_pente<0 && $pente>0)
104
-                    || ($old_pente>0 && $pente<0)) {
102
+        if ($i > 1)
103
+            if (($old_pente < 0 && $pente > 0)
104
+                    || ($old_pente > 0 && $pente < 0)) {
105 105
 				if (is_array($bords[$poly[$i]['y']])) //avoid warning
106
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
106
+                	array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
107 107
 
108 108
                 if (DEBUG)
109 109
                     echo '*('.$poly[$i]['x'].
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
         	}
112 112
 
113 113
         /* detect the direction of the elevation in Y */
114
-        $dy_inc = ($poly[$i]['y']-$poly[$i-1]['y']) > 0 ? 1 : -1;
115
-        $x = $poly[$i-1]['x'];
114
+        $dy_inc = ($poly[$i]['y'] - $poly[$i - 1]['y']) > 0 ? 1 : -1;
115
+        $x = $poly[$i - 1]['x'];
116 116
 //        if (DEBUG) echo "init: ".$poly[$i-1]['y']."  dy_inc: ".$dy_inc.
117 117
 //            "   end: ".$poly[$i]['y']."   pente:".$pente;
118 118
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 
122 122
         // we iterate w/ $dy in ]$poly[$i-1]['y'],$poly[$i-1]['y'][
123 123
         //    w/ $dy_inc as increment
124
-        for ($dy = $poly[$i-1]['y']+$dy_inc;
124
+        for ($dy = $poly[$i - 1]['y'] + $dy_inc;
125 125
             $dy != $poly[$i]['y'];
126 126
             $dy += $dy_inc) {
127
-            $x += $pente*$dy_inc;
127
+            $x += $pente * $dy_inc;
128 128
             array_push($bords[$dy], $x);
129 129
 //            if (DEBUG) echo '/('.$x.';'.$dy.')   ';
130 130
         }
@@ -132,47 +132,47 @@  discard block
 block discarded – undo
132 132
     }
133 133
 
134 134
     // closing the polygone (the edge between $poly[$i-1] and $poly[0])
135
-    if ($poly[$i-1]['y']!=$poly[0]['y']) {// droite--> rien à faire
135
+    if ($poly[$i - 1]['y'] != $poly[0]['y']) {// droite--> rien à faire
136 136
 
137 137
         // elevation between $poly[0]['x'] and $poly[1]['x'])
138
-        $rest = $poly[0]['y']-$poly[1]['y'];
139
-        if ($rest!=0)
140
-        	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
138
+        $rest = $poly[0]['y'] - $poly[1]['y'];
139
+        if ($rest != 0)
140
+        	$pente1 = ($poly[0]['x'] - $poly[1]['x']) / ($rest);
141 141
         else
142 142
 			$pente1 = 0;
143 143
 
144 144
         // elevation between $poly[$i-1]['x'] and $poly[0]['x'])
145
-        $pente = ($poly[$i-1]['x']-$poly[0]['x'])/
146
-            ($poly[$i-1]['y']-$poly[0]['y']);
145
+        $pente = ($poly[$i - 1]['x'] - $poly[0]['x']) /
146
+            ($poly[$i - 1]['y'] - $poly[0]['y']);
147 147
 
148 148
 //        if (DEBUG) echo 'start('.$poly[$i-1]['x'].','.$poly[$i-1]['y'].
149 149
 //                ')-end('.$poly[0]['x'].','.$poly[0]['y'].
150 150
 //                ')-pente'.$pente;
151 151
 
152 152
         // doubling the first point if needed (see above)
153
-        if (($pente1<0 && $pente>0) || ($pente1>0 && $pente<0)) {
153
+        if (($pente1 < 0 && $pente > 0) || ($pente1 > 0 && $pente < 0)) {
154 154
         	if (is_array($bords[$poly[$i - 1]['y']]))
155
-            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
155
+            	array_push($bords[$poly[$i - 1]['y']], round($poly[$i - 1]['x']));
156 156
             //if (DEBUG) echo '('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
157 157
         }
158 158
         //  doubling the last point if neededd
159
-        if (($old_pente<0 && $pente>0) || ($old_pente>0 && $pente<0)) {
160
-        	if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
161
-            	array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
159
+        if (($old_pente < 0 && $pente > 0) || ($old_pente > 0 && $pente < 0)) {
160
+        	if (is_array($bords[$poly[$i - 1]['y']])) //avoid warning
161
+            	array_push($bords[$poly[$i - 1]['y']], round($poly[$i - 1]['x']));
162 162
             //if (DEBUG) echo '*('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
163 163
         }
164 164
 
165 165
 
166
-        $dy_inc = ($poly[0]['y']-$poly[$i-1]['y']) > 0 ? 1 : -1;
167
-        $x = $poly[$i-1]['x'];
166
+        $dy_inc = ($poly[0]['y'] - $poly[$i - 1]['y']) > 0 ? 1 : -1;
167
+        $x = $poly[$i - 1]['x'];
168 168
 //        if (DEBUG) echo "init: ".$poly[$i-1]['y']."  dy_inc: ".$dy_inc.
169 169
 //            "   end: ".$poly[0]['y'];
170 170
 
171
-        for ($dy = $poly[$i-1]['y']+$dy_inc;
171
+        for ($dy = $poly[$i - 1]['y'] + $dy_inc;
172 172
             $dy != $poly[0]['y'];
173 173
             $dy += $dy_inc)
174 174
         {
175
-            $x += $pente*$dy_inc;
175
+            $x += $pente * $dy_inc;
176 176
             array_push($bords[$dy], round($x));
177 177
 //            if (DEBUG) echo '/('.$x.';'.$dy.')   ';
178 178
         }
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
     /* basic idea: we sort a column of edges.
183 183
         For each pair of point, we color the points in between */
184 184
     $n = count($bords);
185
-    for ($i = 0; $i<$n; $i++) {  // Y
185
+    for ($i = 0; $i < $n; $i++) {  // Y
186 186
         //error_log(__FILE__.' - Border Num '.$i,0);
187 187
         if (is_array($bords[$i])) {
188 188
        		sort($bords[$i]);
189 189
         }
190 190
 
191
-        for ($j = 0; $j<sizeof($bords[$i]);$j+=2) { // bords
191
+        for ($j = 0; $j < sizeof($bords[$i]); $j += 2) { // bords
192 192
             if (!isset($bords[$i][$j + 1])) {
193 193
                 break;
194 194
             }
195 195
 
196
-            for ($k = round($bords[$i][$j]); $k<=$bords[$i][$j+1];$k++) {
196
+            for ($k = round($bords[$i][$j]); $k <= $bords[$i][$j + 1]; $k++) {
197 197
                 $res[$k][$i] = true; //filling the array with trues
198
-                if ($test == 1)  {
198
+                if ($test == 1) {
199 199
                 	/*how to draw the polygon in a human way:
200 200
                 	In ubuntu : sudo apt-get install gnuplot
201 201
                 	Create an empty file with all points with the result of this echos (No commas, no point, no headers)
@@ -222,19 +222,19 @@  discard block
 block discarded – undo
222 222
  *
223 223
  * @return string     html code of the representation of the polygone image
224 224
  */
225
-function poly_dump(&$poly, $max, $format='raw') {
225
+function poly_dump(&$poly, $max, $format = 'raw') {
226 226
     if ($format == 'html') {
227 227
         $s = "<div style='font-size: 8px; line-height:3px'><pre>\n";
228 228
     }
229
-    for ($i=0; $i<$max['y']; $i++) {
230
-        for($j=0; $j<$max['x']; $j++)
231
-            if($poly[$j][$i] == TRUE)
232
-                $s .= ($format=='html'?"<b>1</b>":'1');
229
+    for ($i = 0; $i < $max['y']; $i++) {
230
+        for ($j = 0; $j < $max['x']; $j++)
231
+            if ($poly[$j][$i] == TRUE)
232
+                $s .= ($format == 'html' ? "<b>1</b>" : '1');
233 233
             else
234 234
                 $s .= "0";
235
-        $s .= ($format=='html'?"<br />\n":"\n");
235
+        $s .= ($format == 'html' ? "<br />\n" : "\n");
236 236
     }
237
-    $s .= ($format=='html'?"</pre></div>\n":"\n");
237
+    $s .= ($format == 'html' ? "</pre></div>\n" : "\n");
238 238
     return $s;
239 239
 }
240 240
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
     $surfaceOf1 = 0;
253 253
     $surfaceOf2 = 0;
254 254
 
255
-    for ($i=0; $i<$max['x']; $i++)
256
-        for($j=0; $j<$max['y']; $j++) {
255
+    for ($i = 0; $i < $max['x']; $i++)
256
+        for ($j = 0; $j < $max['y']; $j++) {
257 257
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == TRUE)) {
258 258
                 $surfaceOf1++;
259 259
                 if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == FALSE))
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                 $surfaceOf2++;
264 264
         }
265 265
 
266
-    return array (
266
+    return array(
267 267
         "s1" => $surfaceOf1,
268 268
         "s2" => $surfaceOf2,
269 269
         "both" => $surfaceOf1 - $onlyIn1,
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
  */
283 283
 function poly_touch(&$poly1, &$poly2, $max) {
284 284
 
285
-    for ($i=0; $i<$max['x']; $i++) {
286
-        for($j=0; $j<$max['y']; $j++) {
285
+    for ($i = 0; $i < $max['x']; $i++) {
286
+        for ($j = 0; $j < $max['y']; $j++) {
287 287
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == true)
288 288
                 && isset($poly2[$i][$j]) && ($poly2[$i][$j] == true)) {
289 289
                     return true;
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
  * @return  array   An array of points in the right format to use with the
302 302
  *                  local functions
303 303
  */
304
-function convert_coordinates($coords,$sep='|') {
304
+function convert_coordinates($coords, $sep = '|') {
305 305
     $points = array();
306
-    $pairs = explode($sep,$coords);
306
+    $pairs = explode($sep, $coords);
307 307
     foreach ($pairs as $idx => $pcoord) {
308
-        list($x,$y) = explode(';',$pcoord);
309
-        $points[] = array('x'=>$x,'y'=>$y);
308
+        list($x, $y) = explode(';', $pcoord);
309
+        $points[] = array('x'=>$x, 'y'=>$y);
310 310
     }
311 311
 	return $points;
312 312
 }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
             $my = $coord['y'];
337 337
         }
338 338
     }
339
-    return array('x'=>$mx,'y'=>$my);
339
+    return array('x'=>$mx, 'y'=>$my);
340 340
 }
341 341
 
342 342
 /**
Please login to merge, or discard this patch.
Braces   +49 added lines, -28 removed lines patch added patch discarded remove patch
@@ -65,8 +65,10 @@  discard block
 block discarded – undo
65 65
     $bords = array_fill(0, $bord_lenght, array()); // building this array
66 66
 
67 67
     /* adding the first point of the polygone */
68
-    if (is_array($bords[$poly[0]['y']])) //avoid warning
68
+    if (is_array($bords[$poly[0]['y']])) {
69
+        //avoid warning
69 70
     	array_push($bords[$poly[0]['y']], $poly[0]['x']);
71
+    }
70 72
 
71 73
     $i = 1; // we re-use $i and $old_pente bellow the loop
72 74
     $old_pente=0;
@@ -75,11 +77,14 @@  discard block
 block discarded – undo
75 77
 
76 78
         /* special cases */
77 79
         if ($poly[$i-1]['y'] == $poly[$i]['y']) {
78
-            if ($poly[$i-1]['x'] == $poly[$i]['x'])
79
-                continue; // twice the same point
80
+            if ($poly[$i-1]['x'] == $poly[$i]['x']) {
81
+                            continue;
82
+            }
83
+            // twice the same point
80 84
             else {    //  infinite elevation of the edge
81
-            	if (is_array($bords[$poly[$i]['y']]))
82
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
85
+            	if (is_array($bords[$poly[$i]['y']])) {
86
+            	                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
87
+            	}
83 88
                 $old_pente=0;
84 89
                 continue;
85 90
             }
@@ -87,9 +92,13 @@  discard block
 block discarded – undo
87 92
 
88 93
 		//echo 'point:'.$poly[$i]['y']; bug here
89 94
         // adding the point as a part of an edge
90
-        if (is_array($bords[$poly[$i]['y']])) //avoid warning
95
+        if (is_array($bords[$poly[$i]['y']])) {
96
+            //avoid warning
91 97
         array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
92
-        if (DEBUG) echo '('.$poly[$i]['x'].';'.$poly[$i]['y'].')   ';
98
+        }
99
+        if (DEBUG) {
100
+            echo '('.$poly[$i]['x'].';'.$poly[$i]['y'].')   ';
101
+        }
93 102
 
94 103
         /* computing the elevation of the edge going */
95 104
         //        from $poly[$i-1] to $poly[$i]
@@ -99,15 +108,17 @@  discard block
 block discarded – undo
99 108
         // if the sign of the elevation change from the one of the
100 109
         // previous edge, the point must be added a second time inside
101 110
         // $bords
102
-        if ($i>1)
103
-            if (($old_pente<0 && $pente>0)
111
+        if ($i>1) {
112
+                    if (($old_pente<0 && $pente>0)
104 113
                     || ($old_pente>0 && $pente<0)) {
105 114
 				if (is_array($bords[$poly[$i]['y']])) //avoid warning
106 115
                 	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
116
+        }
107 117
 
108
-                if (DEBUG)
109
-                    echo '*('.$poly[$i]['x'].
118
+                if (DEBUG) {
119
+                                    echo '*('.$poly[$i]['x'].
110 120
                         ';'.$poly[$i]['y'].')   ';
121
+                }
111 122
         	}
112 123
 
113 124
         /* detect the direction of the elevation in Y */
@@ -136,10 +147,11 @@  discard block
 block discarded – undo
136 147
 
137 148
         // elevation between $poly[0]['x'] and $poly[1]['x'])
138 149
         $rest = $poly[0]['y']-$poly[1]['y'];
139
-        if ($rest!=0)
140
-        	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
141
-        else
142
-			$pente1 = 0;
150
+        if ($rest!=0) {
151
+                	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
152
+        } else {
153
+        			$pente1 = 0;
154
+        }
143 155
 
144 156
         // elevation between $poly[$i-1]['x'] and $poly[0]['x'])
145 157
         $pente = ($poly[$i-1]['x']-$poly[0]['x'])/
@@ -151,14 +163,17 @@  discard block
 block discarded – undo
151 163
 
152 164
         // doubling the first point if needed (see above)
153 165
         if (($pente1<0 && $pente>0) || ($pente1>0 && $pente<0)) {
154
-        	if (is_array($bords[$poly[$i - 1]['y']]))
155
-            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
166
+        	if (is_array($bords[$poly[$i - 1]['y']])) {
167
+        	            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
168
+        	}
156 169
             //if (DEBUG) echo '('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
157 170
         }
158 171
         //  doubling the last point if neededd
159 172
         if (($old_pente<0 && $pente>0) || ($old_pente>0 && $pente<0)) {
160
-        	if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
173
+        	if (is_array($bords[$poly[$i-1]['y']])) {
174
+        	    //avoid warning
161 175
             	array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
176
+        	}
162 177
             //if (DEBUG) echo '*('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
163 178
         }
164 179
 
@@ -227,11 +242,13 @@  discard block
 block discarded – undo
227 242
         $s = "<div style='font-size: 8px; line-height:3px'><pre>\n";
228 243
     }
229 244
     for ($i=0; $i<$max['y']; $i++) {
230
-        for($j=0; $j<$max['x']; $j++)
231
-            if($poly[$j][$i] == TRUE)
245
+        for($j=0; $j<$max['x']; $j++) {
246
+                    if($poly[$j][$i] == TRUE)
232 247
                 $s .= ($format=='html'?"<b>1</b>":'1');
233
-            else
234
-                $s .= "0";
248
+        }
249
+            else {
250
+                            $s .= "0";
251
+            }
235 252
         $s .= ($format=='html'?"<br />\n":"\n");
236 253
     }
237 254
     $s .= ($format=='html'?"</pre></div>\n":"\n");
@@ -252,15 +269,19 @@  discard block
 block discarded – undo
252 269
     $surfaceOf1 = 0;
253 270
     $surfaceOf2 = 0;
254 271
 
255
-    for ($i=0; $i<$max['x']; $i++)
256
-        for($j=0; $j<$max['y']; $j++) {
272
+    for ($i=0; $i<$max['x']; $i++) {
273
+            for($j=0;
274
+    }
275
+    $j<$max['y']; $j++) {
257 276
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == TRUE)) {
258 277
                 $surfaceOf1++;
259
-                if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == FALSE))
260
-                    $onlyIn1++;
278
+                if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == FALSE)) {
279
+                                    $onlyIn1++;
280
+                }
281
+            }
282
+            if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == TRUE)) {
283
+                            $surfaceOf2++;
261 284
             }
262
-            if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == TRUE))
263
-                $surfaceOf2++;
264 285
         }
265 286
 
266 287
     return array (
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
      *        for all j in [O..max[y][ : for all i in bords[$j] :
57 57
      *            (i,j) is a point inside an edge of the polygone
58 58
      */
59
-	$bord_lenght = $max['x'];
59
+    $bord_lenght = $max['x'];
60 60
     if ($max['y'] > $bord_lenght) {
61
-     	$bord_lenght = $max['y'];
61
+            $bord_lenght = $max['y'];
62 62
     }
63 63
 
64 64
     //$bords = array_fill(0, $bord_lenght-1, array()); // building this array
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     /* adding the first point of the polygone */
68 68
     if (is_array($bords[$poly[0]['y']])) //avoid warning
69
-    	array_push($bords[$poly[0]['y']], $poly[0]['x']);
69
+        array_push($bords[$poly[0]['y']], $poly[0]['x']);
70 70
 
71 71
     $i = 1; // we re-use $i and $old_pente bellow the loop
72 72
     $old_pente=0;
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
             if ($poly[$i-1]['x'] == $poly[$i]['x'])
79 79
                 continue; // twice the same point
80 80
             else {    //  infinite elevation of the edge
81
-            	if (is_array($bords[$poly[$i]['y']]))
82
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
81
+                if (is_array($bords[$poly[$i]['y']]))
82
+                    array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
83 83
                 $old_pente=0;
84 84
                 continue;
85 85
             }
86 86
         }
87 87
 
88
-		//echo 'point:'.$poly[$i]['y']; bug here
88
+        //echo 'point:'.$poly[$i]['y']; bug here
89 89
         // adding the point as a part of an edge
90 90
         if (is_array($bords[$poly[$i]['y']])) //avoid warning
91 91
         array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
         if ($i>1)
103 103
             if (($old_pente<0 && $pente>0)
104 104
                     || ($old_pente>0 && $pente<0)) {
105
-				if (is_array($bords[$poly[$i]['y']])) //avoid warning
106
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
105
+                if (is_array($bords[$poly[$i]['y']])) //avoid warning
106
+                    array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
107 107
 
108 108
                 if (DEBUG)
109 109
                     echo '*('.$poly[$i]['x'].
110 110
                         ';'.$poly[$i]['y'].')   ';
111
-        	}
111
+            }
112 112
 
113 113
         /* detect the direction of the elevation in Y */
114 114
         $dy_inc = ($poly[$i]['y']-$poly[$i-1]['y']) > 0 ? 1 : -1;
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
         // elevation between $poly[0]['x'] and $poly[1]['x'])
138 138
         $rest = $poly[0]['y']-$poly[1]['y'];
139 139
         if ($rest!=0)
140
-        	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
140
+            $pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
141 141
         else
142
-			$pente1 = 0;
142
+            $pente1 = 0;
143 143
 
144 144
         // elevation between $poly[$i-1]['x'] and $poly[0]['x'])
145 145
         $pente = ($poly[$i-1]['x']-$poly[0]['x'])/
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 
152 152
         // doubling the first point if needed (see above)
153 153
         if (($pente1<0 && $pente>0) || ($pente1>0 && $pente<0)) {
154
-        	if (is_array($bords[$poly[$i - 1]['y']]))
155
-            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
154
+            if (is_array($bords[$poly[$i - 1]['y']]))
155
+                array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
156 156
             //if (DEBUG) echo '('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
157 157
         }
158 158
         //  doubling the last point if neededd
159 159
         if (($old_pente<0 && $pente>0) || ($old_pente>0 && $pente<0)) {
160
-        	if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
161
-            	array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
160
+            if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
161
+                array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
162 162
             //if (DEBUG) echo '*('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
163 163
         }
164 164
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     for ($i = 0; $i<$n; $i++) {  // Y
186 186
         //error_log(__FILE__.' - Border Num '.$i,0);
187 187
         if (is_array($bords[$i])) {
188
-       		sort($bords[$i]);
188
+                sort($bords[$i]);
189 189
         }
190 190
 
191 191
         for ($j = 0; $j<sizeof($bords[$i]);$j+=2) { // bords
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             for ($k = round($bords[$i][$j]); $k<=$bords[$i][$j+1];$k++) {
197 197
                 $res[$k][$i] = true; //filling the array with trues
198 198
                 if ($test == 1)  {
199
-                	/*how to draw the polygon in a human way:
199
+                    /*how to draw the polygon in a human way:
200 200
                 	In ubuntu : sudo apt-get install gnuplot
201 201
                 	Create an empty file with all points with the result of this echos (No commas, no point, no headers)
202 202
                 	In gnuplot:
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                 	For 2 polygons:  plot "/home/jmontoya/test", "/home/jmontoya/test2"
205 205
                 	A new window will appear with the plot
206 206
                 	*/
207
-                	echo $k.'  '.$i; echo '<br />';
207
+                    echo $k.'  '.$i; echo '<br />';
208 208
                 }
209 209
             }
210 210
         }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         list($x,$y) = explode(';',$pcoord);
309 309
         $points[] = array('x'=>$x,'y'=>$y);
310 310
     }
311
-	return $points;
311
+    return $points;
312 312
 }
313 313
 
314 314
 /**
@@ -321,11 +321,11 @@  discard block
 block discarded – undo
321 321
     $mx = 0;
322 322
     $my = 0;
323 323
     foreach ($coords1 as $coord) {
324
-    	if ($coord['x'] > $mx) {
324
+        if ($coord['x'] > $mx) {
325 325
             $mx = $coord['x'];
326
-    	}
326
+        }
327 327
         if ($coord['y'] > $my) {
328
-        	$my = $coord['y'];
328
+            $my = $coord['y'];
329 329
         }
330 330
     }
331 331
     foreach ($coords2 as $coord) {
Please login to merge, or discard this patch.