Passed
Push — 1.10.x ( 48d966...000263 )
by
unknown
64:15
created
main/inc/lib/document.lib.php 2 patches
Doc Comments   +21 added lines, -18 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     /**
278 278
      *  @param string
279 279
      *  @param string
280
-     * 	@return true if the user is allowed to see the document, false otherwise
280
+     * 	@return boolean if the user is allowed to see the document, false otherwise
281 281
      * 	@author Sergio A Kessler, first version
282 282
      * 	@author Roan Embrechts, bugfix
283 283
      *  @todo not only check if a file is visible, but also check if the user is allowed to see the file??
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
      * Return true if the documentpath have visibility=1 as
1528 1528
      * item_property (you should use the is_visible_by_id)
1529 1529
      *
1530
-     * @param string $document_path the relative complete path of the document
1530
+     * @param string $doc_path the relative complete path of the document
1531 1531
      * @param array  $course the _course array info of the document's course
1532 1532
      * @param int
1533 1533
      * @param string
@@ -1612,6 +1612,8 @@  discard block
 block discarded – undo
1612 1612
      * @param   int
1613 1613
      * @param   int
1614 1614
      * @param bool
1615
+     * @param integer $session_id
1616
+     * @param integer $user_id
1615 1617
      * @return  bool
1616 1618
      */
1617 1619
     public static function is_visible_by_id(
@@ -2090,6 +2092,7 @@  discard block
 block discarded – undo
2090 2092
      * @param	bool  	is file or string html
2091 2093
      * @param	string	type (one of the app tools) - optional (otherwise takes the current item's type)
2092 2094
      * @param	int		level of recursivity we're in
2095
+     * @param string $source_html
2093 2096
      * @return	array	List of file paths. An additional field containing 'local' or 'remote' helps determine
2094 2097
      * if the file should be copied into the zip or just linked
2095 2098
      */
@@ -2913,6 +2916,7 @@  discard block
 block discarded – undo
2913 2916
 
2914 2917
     /**
2915 2918
      * Obtains the text inside the file with the right parser
2919
+     * @param string $doc_path
2916 2920
      */
2917 2921
     public static function get_text_content($doc_path, $doc_mime)
2918 2922
     {
@@ -3163,6 +3167,7 @@  discard block
 block discarded – undo
3163 3167
      * Shows a play icon next to the document title in the document list
3164 3168
      * @param int
3165 3169
      * @param string
3170
+     * @param integer|null $i
3166 3171
      * @return string	html content
3167 3172
      */
3168 3173
     static function generate_media_preview($i, $type = 'simple')
@@ -3557,7 +3562,7 @@  discard block
 block discarded – undo
3557 3562
      * @param bool $add_move_button
3558 3563
      * @param string $target
3559 3564
      * @param string $overwrite_url
3560
-     * @return null|string
3565
+     * @return string
3561 3566
      */
3562 3567
     private static function parseFile(
3563 3568
         $course_info,
@@ -4058,7 +4063,7 @@  discard block
 block discarded – undo
4058 4063
     }
4059 4064
 
4060 4065
     /**
4061
-     * @return array
4066
+     * @return string[]
4062 4067
      */
4063 4068
     public static function get_web_odf_extension_list()
4064 4069
     {
@@ -4067,10 +4072,10 @@  discard block
 block discarded – undo
4067 4072
 
4068 4073
     /**
4069 4074
      * Set of extension allowed to use Jodconverter
4070
-     * @param $mode 'from'
4075
+     * @param string $mode 'from'
4071 4076
      *              'to'
4072 4077
      *              'all'
4073
-     * @param $format   'text'
4078
+     * @param string $format   'text'
4074 4079
      *                  'spreadsheet'
4075 4080
      *                  'presentation'
4076 4081
      *                  'drawing'
@@ -4274,7 +4279,7 @@  discard block
 block discarded – undo
4274 4279
     }
4275 4280
 
4276 4281
     /**
4277
-     * @return array
4282
+     * @return string[]
4278 4283
      */
4279 4284
     public static function get_system_folders()
4280 4285
     {
@@ -4292,7 +4297,7 @@  discard block
 block discarded – undo
4292 4297
     }
4293 4298
 
4294 4299
     /**
4295
-     * @return array
4300
+     * @return string[]
4296 4301
      */
4297 4302
     public static function getProtectedFolderFromStudent()
4298 4303
     {
@@ -4448,7 +4453,7 @@  discard block
 block discarded – undo
4448 4453
      * Requires the ffmpeg lib. In ubuntu: sudo apt-get install ffmpeg
4449 4454
      * @param string $wavFile
4450 4455
      * @param bool $removeWavFileIfSuccess
4451
-     * @return bool
4456
+     * @return string|false
4452 4457
      */
4453 4458
     public static function convertWavToMp3($wavFile, $removeWavFileIfSuccess = false)
4454 4459
     {
@@ -5536,9 +5541,6 @@  discard block
 block discarded – undo
5536 5541
     /**
5537 5542
      * Creates the row of edit icons for a file/folder
5538 5543
      *
5539
-     * @param string $curdirpath current path (cfr open folder)
5540
-     * @param string $type (file/folder)
5541
-     * @param string $path dbase path of file/folder
5542 5544
      * @param int $visibility (1/0)
5543 5545
      * @param int $id dbase id of the document
5544 5546
      * @return string html img tags with hyperlinks
@@ -5867,7 +5869,7 @@  discard block
 block discarded – undo
5867 5869
     /**
5868 5870
      * Gets the path translated with title of docs and folders
5869 5871
      * @param string $path the real path
5870
-     * @return the path which should be displayed
5872
+     * @return string path which should be displayed
5871 5873
      */
5872 5874
     public static function get_titles_of_path($path)
5873 5875
     {
@@ -5922,7 +5924,8 @@  discard block
 block discarded – undo
5922 5924
 
5923 5925
     /**
5924 5926
      * Checks whether the user is in shared folder
5925
-     * @return return bool Return true when user is into shared folder
5927
+     * @param integer $current_session_id
5928
+     * @return boolean bool Return true when user is into shared folder
5926 5929
      */
5927 5930
     public static function is_shared_folder($curdirpath, $current_session_id)
5928 5931
     {
@@ -5938,7 +5941,7 @@  discard block
 block discarded – undo
5938 5941
 
5939 5942
     /**
5940 5943
      * Checks whether the user is into any user shared folder
5941
-     * @return return bool Return true when user is in any user shared folder
5944
+     * @return boolean bool Return true when user is in any user shared folder
5942 5945
      */
5943 5946
     public static function is_any_user_shared_folder($path, $current_session_id)
5944 5947
     {
@@ -6152,7 +6155,7 @@  discard block
 block discarded – undo
6152 6155
      * @param int $id
6153 6156
      * @param array $courseInfo
6154 6157
      * @param int $sessionId
6155
-     * @return bool
6158
+     * @return boolean|null
6156 6159
      */
6157 6160
     public static function downloadDeletedDocument($id, $courseInfo, $sessionId)
6158 6161
     {
@@ -6171,7 +6174,7 @@  discard block
 block discarded – undo
6171 6174
      * @param array $courseInfo
6172 6175
      * @param int $sessionId
6173 6176
      *
6174
-     * @return bool
6177
+     * @return false|null
6175 6178
      */
6176 6179
     public static function downloadAllDeletedDocument($courseInfo, $sessionId)
6177 6180
     {
@@ -6210,7 +6213,7 @@  discard block
 block discarded – undo
6210 6213
      * @param array $courseInfo
6211 6214
      * @param int $sessionId
6212 6215
      *
6213
-     * @return bool
6216
+     * @return false|null
6214 6217
      */
6215 6218
     public function deleteDocumentsFromSession($courseInfo, $sessionId)
6216 6219
     {
Please login to merge, or discard this patch.
Spacing   +339 added lines, -339 removed lines patch added patch discarded remove patch
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
             return true;
291 291
         } else {
292 292
             $tbl_document = Database::get_course_table(TABLE_DOCUMENT);
293
-            $tbl_item_property = $this_course . 'item_property';
293
+            $tbl_item_property = $this_course.'item_property';
294 294
             $doc_url = Database::escape_string($doc_url);
295 295
             $query = "SELECT 1 FROM $tbl_document AS docs,$tbl_item_property AS props
296 296
                       WHERE
@@ -340,18 +340,18 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             header('Content-type: application/octet-stream');
343
-            header('Content-length: ' . $len);
343
+            header('Content-length: '.$len);
344 344
             if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
345
-                header('Content-Disposition: filename= ' . $filename);
345
+                header('Content-Disposition: filename= '.$filename);
346 346
             } else {
347
-                header('Content-Disposition: attachment; filename= ' . $filename);
347
+                header('Content-Disposition: attachment; filename= '.$filename);
348 348
             }
349 349
             if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
350 350
                 header('Pragma: ');
351 351
                 header('Cache-Control: ');
352 352
                 header('Cache-Control: public'); // IE cannot download from sessions without a cache
353 353
             }
354
-            header('Content-Description: ' . $filename);
354
+            header('Content-Description: '.$filename);
355 355
             header('Content-Transfer-Encoding: binary');
356 356
 
357 357
             $res = fopen($full_file_name, 'r');
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             $lpFixedEncoding = api_get_configuration_value('lp_fixed_encoding');
366 366
 
367 367
             header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
368
-            header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
368
+            header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
369 369
             // Commented to avoid double caching declaration when playing with IE and HTTPS
370 370
             //header('Cache-Control: no-cache, must-revalidate');
371 371
             //header('Pragma: no-cache');
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                     } else {
377 377
                         $encoding = @api_detect_encoding_html(file_get_contents($full_file_name));
378 378
                         if (!empty($encoding)) {
379
-                            $content_type .= '; charset=' . $encoding;
379
+                            $content_type .= '; charset='.$encoding;
380 380
                         }
381 381
                     }
382 382
                     break;
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                     } else {
387 387
                         $encoding = @api_detect_encoding(strip_tags(file_get_contents($full_file_name)));
388 388
                         if (!empty($encoding)) {
389
-                            $content_type .= '; charset=' . $encoding;
389
+                            $content_type .= '; charset='.$encoding;
390 390
                         }
391 391
                     }
392 392
                     break;
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
                     header('Content-type: application/octet-stream');
396 396
                     break;
397 397
             }
398
-            header('Content-type: ' . $content_type);
399
-            header('Content-Length: ' . $len);
398
+            header('Content-type: '.$content_type);
399
+            header('Content-Length: '.$len);
400 400
             $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
401 401
             if (strpos($user_agent, 'msie')) {
402
-                header('Content-Disposition: ; filename= ' . $filename);
402
+                header('Content-Disposition: ; filename= '.$filename);
403 403
             } else {
404
-                header('Content-Disposition: inline; filename= ' . $filename);
404
+                header('Content-Disposition: inline; filename= '.$filename);
405 405
             }
406 406
 
407 407
             if ($fixLinksHttpToHttps) {
@@ -442,18 +442,18 @@  discard block
 block discarded – undo
442 442
 
443 443
             header('Content-type: application/octet-stream');
444 444
             //header('Content-Type: application/force-download');
445
-            header('Content-length: ' . $len);
445
+            header('Content-length: '.$len);
446 446
             if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
447
-                header('Content-Disposition: filename= ' . $filename);
447
+                header('Content-Disposition: filename= '.$filename);
448 448
             } else {
449
-                header('Content-Disposition: attachment; filename= ' . $filename);
449
+                header('Content-Disposition: attachment; filename= '.$filename);
450 450
             }
451 451
             if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
452 452
                 header('Pragma: ');
453 453
                 header('Cache-Control: ');
454 454
                 header('Cache-Control: public'); // IE cannot download from sessions without a cache
455 455
             }
456
-            header('Content-Description: ' . $filename);
456
+            header('Content-Description: '.$filename);
457 457
             header('Content-transfer-encoding: binary');
458 458
             echo $full_string;
459 459
 
@@ -466,30 +466,30 @@  discard block
 block discarded – undo
466 466
 
467 467
             $content_type = self::file_get_mime_type($filename);
468 468
             header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
469
-            header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
469
+            header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
470 470
             header('Cache-Control: no-cache, must-revalidate');
471 471
             header('Pragma: no-cache');
472 472
             switch ($content_type) {
473 473
                 case 'text/html':
474 474
                     $encoding = @api_detect_encoding_html($full_string);
475 475
                     if (!empty($encoding)) {
476
-                        $content_type .= '; charset=' . $encoding;
476
+                        $content_type .= '; charset='.$encoding;
477 477
                     }
478 478
                     break;
479 479
                 case 'text/plain':
480 480
                     $encoding = @api_detect_encoding(strip_tags($full_string));
481 481
                     if (!empty($encoding)) {
482
-                        $content_type .= '; charset=' . $encoding;
482
+                        $content_type .= '; charset='.$encoding;
483 483
                     }
484 484
                     break;
485 485
             }
486
-            header('Content-type: ' . $content_type);
487
-            header('Content-Length: ' . $len);
486
+            header('Content-type: '.$content_type);
487
+            header('Content-Length: '.$len);
488 488
             $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
489 489
             if (strpos($user_agent, 'msie')) {
490
-                header('Content-Disposition: ; filename= ' . $filename);
490
+                header('Content-Disposition: ; filename= '.$filename);
491 491
             } else {
492
-                header('Content-Disposition: inline; filename= ' . $filename);
492
+                header('Content-Disposition: inline; filename= '.$filename);
493 493
             }
494 494
             echo($full_string);
495 495
             //You have to ensure that the calling script then stops processing (exit();)
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
             if (!empty($students)) {
583 583
                 $conditionList = array();
584 584
                 foreach ($students as $studentId => $studentInfo) {
585
-                    $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id'];
585
+                    $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id'];
586 586
                 }
587
-                $sharedCondition .= ' AND docs.path IN ("' . implode('","', $conditionList) . '")';
587
+                $sharedCondition .= ' AND docs.path IN ("'.implode('","', $conditionList).'")';
588 588
             }
589 589
         }
590 590
 
@@ -610,8 +610,8 @@  discard block
 block discarded – undo
610 610
                     last.c_id = {$_course['real_id']}
611 611
                 )
612 612
                 WHERE
613
-                    docs.path LIKE '" . Database::escape_string($path . $added_slash.'%'). "' AND
614
-                    docs.path NOT LIKE '" . Database::escape_string($path . $added_slash.'%/%')."' AND
613
+                    docs.path LIKE '".Database::escape_string($path.$added_slash.'%')."' AND
614
+                    docs.path NOT LIKE '" . Database::escape_string($path.$added_slash.'%/%')."' AND
615 615
                     docs.path NOT LIKE '%_DELETED_%' AND
616 616
                     $userGroupFilter AND
617 617
                     last.visibility $visibility_bit
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
                     $table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES);
653 653
                     $sql = "SELECT id FROM $table_template
654 654
                             WHERE
655
-                                course_code = '" . $_course['code'] . "' AND
655
+                                course_code = '".$_course['code']."' AND
656 656
                                 user_id = '".api_get_user_id()."' AND
657 657
                                 ref_doc = '".$row['id']."'";
658 658
                     $template_result = Database::query($sql);
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
         if (!empty($students)) {
763 763
             $conditionList = array();
764 764
             foreach ($students as $studentId => $studentInfo) {
765
-                $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id'];
765
+                $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id'];
766 766
             }
767 767
         }
768 768
 
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
                        INNER JOIN $TABLE_DOCUMENT  AS docs
787 787
                        ON (
788 788
                             docs.id = last.ref AND
789
-                            last.tool = '" . TOOL_DOCUMENT . "' AND
789
+                            last.tool = '".TOOL_DOCUMENT."' AND
790 790
                             last.c_id = {$_course['real_id']} AND
791 791
                             docs.c_id = {$_course['real_id']}
792 792
                        )
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
                         INNER JOIN $TABLE_DOCUMENT  AS docs
804 804
                         ON (
805 805
                             docs.id = last.ref AND
806
-                            last.tool = '" . TOOL_DOCUMENT . "' AND
806
+                            last.tool = '".TOOL_DOCUMENT."' AND
807 807
                             last.c_id = {$_course['real_id']} AND
808 808
                             docs.c_id = {$_course['real_id']}
809 809
                         )
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
                     WHERE
851 851
                         docs.id = last.ref AND
852 852
                         docs.filetype = 'folder' AND
853
-                        last.tool = '" . TOOL_DOCUMENT . "' AND
853
+                        last.tool = '".TOOL_DOCUMENT."' AND
854 854
                         $groupCondition AND
855 855
                         last.visibility = 1
856 856
                         $condition_session AND
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
                     WHERE
872 872
                         docs.id = last.ref AND
873 873
                         docs.filetype = 'folder' AND
874
-                        last.tool = '" . TOOL_DOCUMENT . "' AND
874
+                        last.tool = '".TOOL_DOCUMENT."' AND
875 875
                         $groupCondition AND
876 876
                         last.visibility = 0 $condition_session AND
877 877
                         last.c_id = {$_course['real_id']} AND
@@ -887,9 +887,9 @@  discard block
 block discarded – undo
887 887
                         FROM $TABLE_ITEMPROPERTY AS last, $TABLE_DOCUMENT AS docs
888 888
                         WHERE
889 889
                             docs.id = last.ref AND
890
-                            docs.path LIKE '" . Database::escape_string($row['path'].'/%') . "' AND
890
+                            docs.path LIKE '".Database::escape_string($row['path'].'/%')."' AND
891 891
                             docs.filetype = 'folder' AND
892
-                            last.tool = '" . TOOL_DOCUMENT . "' AND
892
+                            last.tool = '" . TOOL_DOCUMENT."' AND
893 893
                             $groupCondition AND
894 894
                             last.visibility = 1 $condition_session AND
895 895
                             last.c_id = {$_course['real_id']} AND
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
                                 tp.c_id = $course_id AND
967 967
                                 td.session_id = $sessionId AND
968 968
                                 tp.ref= td.id AND
969
-                                (path='" . $path . "' OR path LIKE BINARY '" . $path . "/%' ) ";
969
+                                (path='".$path."' OR path LIKE BINARY '".$path."/%' ) ";
970 970
                     // Get all id's of documents that are deleted
971 971
                     $what_to_check_result = Database::query($sql);
972 972
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
             $res = Database::query($sql);
1309 1309
             if (Database::num_rows($res) > 0) {
1310 1310
                 $row2 = Database::fetch_array($res);
1311
-                require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
1311
+                require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
1312 1312
                 $di = new ChamiloIndexer();
1313 1313
                 $di->remove_document((int) $row2['search_did']);
1314 1314
             }
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
             Database::query($sql);
1318 1318
 
1319 1319
             // remove terms from db
1320
-            require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
1320
+            require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
1321 1321
             delete_all_values_for_item($course_id, TOOL_DOCUMENT, $document_id);
1322 1322
         }
1323 1323
     }
@@ -1406,12 +1406,12 @@  discard block
 block discarded – undo
1406 1406
             $path = str_replace('%2F', '/', $url_path);
1407 1407
             $pathinfo = pathinfo($row['path']);
1408 1408
 
1409
-            $row['url'] = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?cidReq=' . $course_code . '&id=' . $id;
1410
-            $row['document_url'] = api_get_path(WEB_CODE_PATH) . 'document/document.php?cidReq=' . $course_code . '&id=' . $id;
1411
-            $row['absolute_path'] = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path'];
1412
-            $row['absolute_path_from_document'] = '/document' . $row['path'];
1413
-            $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'] . '/';
1414
-            $row['direct_url'] = $www . $path;
1409
+            $row['url'] = api_get_path(WEB_CODE_PATH).'document/showinframes.php?cidReq='.$course_code.'&id='.$id;
1410
+            $row['document_url'] = api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.$course_code.'&id='.$id;
1411
+            $row['absolute_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path'];
1412
+            $row['absolute_path_from_document'] = '/document'.$row['path'];
1413
+            $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'].'/';
1414
+            $row['direct_url'] = $www.$path;
1415 1415
 
1416 1416
             if (dirname($row['path']) == '.') {
1417 1417
                 $row['parent_id'] = '0';
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
                 $real_dir = '';
1431 1431
 
1432 1432
                 for ($i = 1; $i < $array_len; $i++) {
1433
-                    $real_dir .= '/' . $dir_array[$i];
1433
+                    $real_dir .= '/'.$dir_array[$i];
1434 1434
                     $parent_id = self::get_document_id($course_info, $real_dir);
1435 1435
                     if ($session_id != 0 && empty($parent_id)) {
1436 1436
                         $parent_id = self::get_document_id($course_info, $real_dir, 0);
@@ -1504,21 +1504,21 @@  discard block
 block discarded – undo
1504 1504
         $user_id = intval($user_id);
1505 1505
         $document_id = intval($document_id);
1506 1506
 
1507
-        $sql = 'SELECT id FROM ' . $table_template . '
1507
+        $sql = 'SELECT id FROM '.$table_template.'
1508 1508
                 WHERE
1509
-                    course_code="' . $course_code . '" AND
1510
-                    user_id="' . $user_id . '" AND
1511
-                    ref_doc="' . $document_id . '"';
1509
+                    course_code="' . $course_code.'" AND
1510
+                    user_id="' . $user_id.'" AND
1511
+                    ref_doc="' . $document_id.'"';
1512 1512
         $result = Database::query($sql);
1513 1513
         $template_id = Database::result($result, 0, 0);
1514 1514
 
1515
-        my_delete(api_get_path(SYS_CODE_PATH) . 'upload/template_thumbnails/' . $template_id . '.jpg');
1515
+        my_delete(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/'.$template_id.'.jpg');
1516 1516
 
1517
-        $sql = 'DELETE FROM ' . $table_template . '
1517
+        $sql = 'DELETE FROM '.$table_template.'
1518 1518
                 WHERE
1519
-                    course_code="' . $course_code . '" AND
1520
-                    user_id="' . $user_id . '" AND
1521
-                    ref_doc="' . $document_id . '"';
1519
+                    course_code="' . $course_code.'" AND
1520
+                    user_id="' . $user_id.'" AND
1521
+                    ref_doc="' . $document_id.'"';
1522 1522
 
1523 1523
         Database::query($sql);
1524 1524
     }
@@ -1578,9 +1578,9 @@  discard block
 block discarded – undo
1578 1578
                 INNER JOIN $propTable ip
1579 1579
                 ON (d.id = ip.ref AND d.c_id  = $course_id AND ip.c_id = $course_id)
1580 1580
         		WHERE
1581
-        		    ip.tool = '" . TOOL_DOCUMENT . "' $condition AND
1581
+        		    ip.tool = '".TOOL_DOCUMENT."' $condition AND
1582 1582
         			filetype = '$file_type' AND
1583
-        			locate(concat(path,'/'), '" . Database::escape_string($doc_path.'/'). "')=1
1583
+        			locate(concat(path,'/'), '".Database::escape_string($doc_path.'/')."')=1
1584 1584
                 ";
1585 1585
 
1586 1586
         $result = Database::query($sql);
@@ -1743,12 +1743,12 @@  discard block
 block discarded – undo
1743 1743
         if (empty($session_id)) {
1744 1744
             $sql_session = 'AND (session_id = 0 OR isnull(session_id)) ';
1745 1745
         } elseif ($session_id > 0) {
1746
-            $sql_session = 'AND session_id=' . intval($session_id);
1746
+            $sql_session = 'AND session_id='.intval($session_id);
1747 1747
         } else {
1748 1748
             $sql_session = '';
1749 1749
         }
1750
-        $sql = 'UPDATE ' . $tbl_category . ' SET document_id="' . intval($document_id) . '"
1751
-                WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session;
1750
+        $sql = 'UPDATE '.$tbl_category.' SET document_id="'.intval($document_id).'"
1751
+                WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session;
1752 1752
         Database::query($sql);
1753 1753
     }
1754 1754
 
@@ -1770,12 +1770,12 @@  discard block
 block discarded – undo
1770 1770
         if (empty($session_id)) {
1771 1771
             $sql_session = 'AND (session_id = 0 OR isnull(session_id)) ';
1772 1772
         } elseif ($session_id > 0) {
1773
-            $sql_session = 'AND session_id=' . intval($session_id);
1773
+            $sql_session = 'AND session_id='.intval($session_id);
1774 1774
         } else {
1775 1775
             $sql_session = '';
1776 1776
         }
1777
-        $sql = 'SELECT document_id FROM ' . $tbl_category . '
1778
-                WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session;
1777
+        $sql = 'SELECT document_id FROM '.$tbl_category.'
1778
+                WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session;
1779 1779
 
1780 1780
         $rs = Database::query($sql);
1781 1781
         $num = Database::num_rows($rs);
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
             $all_user_info = array();
1817 1817
             if (Database::num_rows($rs)) {
1818 1818
                 $row = Database::fetch_array($rs);
1819
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path'];
1819
+                $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path'];
1820 1820
                 if (is_file($filepath)) {
1821 1821
                     $my_content_html = file_get_contents($filepath);
1822 1822
                 }
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
             $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
1900 1900
         }
1901 1901
 
1902
-        $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id'];
1902
+        $url = api_get_path(WEB_PATH).'certificates/index.php?id='.$info_grade_certificate['id'];
1903 1903
 
1904 1904
         //replace content
1905 1905
         $info_to_replace_in_content_html = array(
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
             $course_info['name'],
1917 1917
             $info_grade_certificate['grade'],
1918 1918
             $url,
1919
-            '<a href="' . $url . '" target="_blank">' . get_lang('CertificateOnlineLink') . '</a>',
1919
+            '<a href="'.$url.'" target="_blank">'.get_lang('CertificateOnlineLink').'</a>',
1920 1920
             '((certificate_barcode))',
1921 1921
         );
1922 1922
 
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
         if (!empty($extraFields)) {
1941 1941
             foreach ($extraFields as $extraField) {
1942 1942
                 $valueExtra = isset($extra_user_info_data[$extraField['variable']]) ? $extra_user_info_data[$extraField['variable']] : '';
1943
-                $info_to_be_replaced_in_content_html[] = '((' . strtolower($extraField['variable']) . '))';
1943
+                $info_to_be_replaced_in_content_html[] = '(('.strtolower($extraField['variable']).'))';
1944 1944
                 $info_to_replace_in_content_html[] = $valueExtra;
1945 1945
             }
1946 1946
         }
@@ -1968,17 +1968,17 @@  discard block
 block discarded – undo
1968 1968
             $tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
1969 1969
             $session_id = api_get_session_id();
1970 1970
             if ($session_id == 0 || is_null($session_id)) {
1971
-                $sql_session = 'AND (session_id=' . intval($session_id) . ' OR isnull(session_id)) ';
1971
+                $sql_session = 'AND (session_id='.intval($session_id).' OR isnull(session_id)) ';
1972 1972
             } elseif ($session_id > 0) {
1973
-                $sql_session = 'AND session_id=' . intval($session_id);
1973
+                $sql_session = 'AND session_id='.intval($session_id);
1974 1974
             } else {
1975 1975
                 $sql_session = '';
1976 1976
             }
1977 1977
 
1978
-            $sql = 'UPDATE ' . $tbl_category . ' SET document_id=null
1978
+            $sql = 'UPDATE '.$tbl_category.' SET document_id=null
1979 1979
                     WHERE
1980
-                        course_code = "' . Database::escape_string($course_id) . '" AND
1981
-                        document_id="' . $default_certificate_id . '" ' . $sql_session;
1980
+                        course_code = "' . Database::escape_string($course_id).'" AND
1981
+                        document_id="' . $default_certificate_id.'" '.$sql_session;
1982 1982
             Database::query($sql);
1983 1983
         }
1984 1984
     }
@@ -1994,10 +1994,10 @@  discard block
 block discarded – undo
1994 1994
         if (!empty($courseInfo)) {
1995 1995
             $to_group_id = 0;
1996 1996
             $to_user_id = null;
1997
-            $course_dir = $courseInfo['path'] . "/document/";
1997
+            $course_dir = $courseInfo['path']."/document/";
1998 1998
             $sys_course_path = api_get_path(SYS_COURSE_PATH);
1999
-            $base_work_dir = $sys_course_path . $course_dir;
2000
-            $base_work_dir_test = $base_work_dir . 'certificates';
1999
+            $base_work_dir = $sys_course_path.$course_dir;
2000
+            $base_work_dir_test = $base_work_dir.'certificates';
2001 2001
             $dir_name = '/certificates';
2002 2002
             $post_dir_name = get_lang('CertificatesFiles');
2003 2003
             $visibility_command = 'invisible';
@@ -2224,9 +2224,9 @@  discard block
 block discarded – undo
2224 2224
                                             //$new_abs_path = realpath($dir.'/'.$second_part);
2225 2225
                                             $dir = '';
2226 2226
                                             if (!empty($abs_path)) {
2227
-                                                $dir = dirname($abs_path) . '/';
2227
+                                                $dir = dirname($abs_path).'/';
2228 2228
                                             }
2229
-                                            $new_abs_path = realpath($dir . $second_part);
2229
+                                            $new_abs_path = realpath($dir.$second_part);
2230 2230
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2231 2231
                                             if (count($in_files_list) > 0) {
2232 2232
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2239,9 +2239,9 @@  discard block
 block discarded – undo
2239 2239
                                             $files_list[] = array($second_part, 'local', 'rel');
2240 2240
                                             $dir = '';
2241 2241
                                             if (!empty($abs_path)) {
2242
-                                                $dir = dirname($abs_path) . '/';
2242
+                                                $dir = dirname($abs_path).'/';
2243 2243
                                             }
2244
-                                            $new_abs_path = realpath($dir . $second_part);
2244
+                                            $new_abs_path = realpath($dir.$second_part);
2245 2245
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2246 2246
                                             if (count($in_files_list) > 0) {
2247 2247
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2275,9 +2275,9 @@  discard block
 block discarded – undo
2275 2275
                                             $files_list[] = array($source, 'local', 'rel');
2276 2276
                                             $dir = '';
2277 2277
                                             if (!empty($abs_path)) {
2278
-                                                $dir = dirname($abs_path) . '/';
2278
+                                                $dir = dirname($abs_path).'/';
2279 2279
                                             }
2280
-                                            $new_abs_path = realpath($dir . $source);
2280
+                                            $new_abs_path = realpath($dir.$source);
2281 2281
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2282 2282
                                             if (count($in_files_list) > 0) {
2283 2283
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2290,9 +2290,9 @@  discard block
 block discarded – undo
2290 2290
                                             $files_list[] = array($source, 'local', 'rel');
2291 2291
                                             $dir = '';
2292 2292
                                             if (!empty($abs_path)) {
2293
-                                                $dir = dirname($abs_path) . '/';
2293
+                                                $dir = dirname($abs_path).'/';
2294 2294
                                             }
2295
-                                            $new_abs_path = realpath($dir . $source);
2295
+                                            $new_abs_path = realpath($dir.$source);
2296 2296
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2297 2297
                                             if (count($in_files_list) > 0) {
2298 2298
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2326,9 +2326,9 @@  discard block
 block discarded – undo
2326 2326
                                     $files_list[] = array($source, 'local', 'rel');
2327 2327
                                     $dir = '';
2328 2328
                                     if (!empty($abs_path)) {
2329
-                                        $dir = dirname($abs_path) . '/';
2329
+                                        $dir = dirname($abs_path).'/';
2330 2330
                                     }
2331
-                                    $new_abs_path = realpath($dir . $source);
2331
+                                    $new_abs_path = realpath($dir.$source);
2332 2332
                                     $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2333 2333
                                     if (count($in_files_list) > 0) {
2334 2334
                                         $files_list = array_merge($files_list, $in_files_list);
@@ -2341,9 +2341,9 @@  discard block
 block discarded – undo
2341 2341
                                     $files_list[] = array($source, 'local', 'rel');
2342 2342
                                     $dir = '';
2343 2343
                                     if (!empty($abs_path)) {
2344
-                                        $dir = dirname($abs_path) . '/';
2344
+                                        $dir = dirname($abs_path).'/';
2345 2345
                                     }
2346
-                                    $new_abs_path = realpath($dir . $source);
2346
+                                    $new_abs_path = realpath($dir.$source);
2347 2347
                                     $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2348 2348
                                     if (count($in_files_list) > 0) {
2349 2349
                                         $files_list = array_merge($files_list, $in_files_list);
@@ -2401,24 +2401,24 @@  discard block
 block discarded – undo
2401 2401
             // then possible closing brackets if we were in the opening bracket case
2402 2402
             // OR something like @import()
2403 2403
             $res = preg_match_all(
2404
-                '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))' .
2404
+                '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))'.
2405 2405
                 // '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]|[^\x00-\x7F])*)' . -> seems to be taking too much
2406 2406
                 // '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name
2407
-                '([ \n\t\r]+)?(' .
2407
+                '([ \n\t\r]+)?('.
2408 2408
                 // '(=([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+))' . -> doesn't restrict close enough to the url itself
2409
-                '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))' .
2410
-                '|' .
2409
+                '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))'.
2410
+                '|'.
2411 2411
                 // '(\(([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)\))' . -> doesn't restrict close enough to the url itself
2412
-                '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))' .
2413
-                '))' .
2414
-                '|' .
2412
+                '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))'.
2413
+                '))'.
2414
+                '|'.
2415 2415
                 // '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))?/', -> takes a lot (like 100's of thousands of empty possibilities)
2416 2416
                 '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/',
2417 2417
                 $attrString,
2418 2418
                 $regs
2419 2419
             );
2420 2420
         } catch (Exception $e) {
2421
-            error_log('Caught exception: ' . $e->getMessage(), 0);
2421
+            error_log('Caught exception: '.$e->getMessage(), 0);
2422 2422
         }
2423 2423
         if ($res) {
2424 2424
             for ($i = 0; $i < count($regs[1]); $i++) {
@@ -2496,14 +2496,14 @@  discard block
 block discarded – undo
2496 2496
                 $orig_course_info_path = $origin_course_info_path;
2497 2497
             }
2498 2498
         } else {
2499
-            $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'] . '/';
2499
+            $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'].'/';
2500 2500
             $orig_course_info_path = $orig_course_info['path'];
2501 2501
         }
2502 2502
 
2503 2503
         $destination_course_code = CourseManager::get_course_id_from_path($destination_course_directory);
2504 2504
         $destination_course_info = api_get_course_info($destination_course_code);
2505
-        $dest_course_path = api_get_path(SYS_COURSE_PATH) . $destination_course_directory . '/';
2506
-        $dest_course_path_rel = api_get_path(REL_COURSE_PATH) . $destination_course_directory . '/';
2505
+        $dest_course_path = api_get_path(SYS_COURSE_PATH).$destination_course_directory.'/';
2506
+        $dest_course_path_rel = api_get_path(REL_COURSE_PATH).$destination_course_directory.'/';
2507 2507
 
2508 2508
         $user_id = api_get_user_id();
2509 2509
 
@@ -2512,7 +2512,7 @@  discard block
 block discarded – undo
2512 2512
 
2513 2513
                 // Get information about source url
2514 2514
                 $real_orig_url = $source[0]; // url
2515
-                $scope_url = $source[1];   // scope (local, remote)
2515
+                $scope_url = $source[1]; // scope (local, remote)
2516 2516
                 $type_url = $source[2]; // type (rel, abs, url)
2517 2517
 
2518 2518
                 // Get path and query from origin url
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
                 $dest_url_query = '';
2525 2525
 
2526 2526
                 if (!empty($real_orig_query)) {
2527
-                    $dest_url_query = '?' . $real_orig_query;
2527
+                    $dest_url_query = '?'.$real_orig_query;
2528 2528
                     if (strpos($dest_url_query, $origin_course_code) !== false) {
2529 2529
                         $dest_url_query = str_replace($origin_course_code, $destination_course_code, $dest_url_query);
2530 2530
                     }
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
 
2606 2606
                                 //$destination_url = $url_course_path . $destination_course_directory . '/' . $document_file . $dest_url_query;
2607 2607
                                 // See BT#7780
2608
-                                $destination_url = $dest_course_path_rel . $document_file . $dest_url_query;
2608
+                                $destination_url = $dest_course_path_rel.$document_file.$dest_url_query;
2609 2609
 
2610 2610
                                 // If the course code doesn't exist in the path? what we do? Nothing! see BT#1985
2611 2611
                                 if (strpos($real_orig_path, $origin_course_code) === false) {
@@ -2640,14 +2640,14 @@  discard block
 block discarded – undo
2640 2640
     function replace_urls_inside_content_html_when_moving_file($file_name, $original_path, $destiny_path)
2641 2641
     {
2642 2642
         if (substr($original_path, strlen($original_path) - 1, strlen($original_path)) == '/') {
2643
-            $original = $original_path . $file_name;
2643
+            $original = $original_path.$file_name;
2644 2644
         } else {
2645
-            $original = $original_path . '/' . $file_name;
2645
+            $original = $original_path.'/'.$file_name;
2646 2646
         }
2647 2647
         if (substr($destiny_path, strlen($destiny_path) - 1, strlen($destiny_path)) == '/') {
2648
-            $destination = $destiny_path . $file_name;
2648
+            $destination = $destiny_path.$file_name;
2649 2649
         } else {
2650
-            $destination = $destiny_path . '/' . $file_name;
2650
+            $destination = $destiny_path.'/'.$file_name;
2651 2651
         }
2652 2652
         $original_count = count(explode('/', $original));
2653 2653
         $destination_count = count(explode('/', $destination));
@@ -2661,8 +2661,8 @@  discard block
 block discarded – undo
2661 2661
             $mode = 'inside';
2662 2662
         }
2663 2663
         //We do not select the $original_path becayse the file was already moved
2664
-        $content_html = file_get_contents($destiny_path . '/' . $file_name);
2665
-        $destination_file = $destiny_path . '/' . $file_name;
2664
+        $content_html = file_get_contents($destiny_path.'/'.$file_name);
2665
+        $destination_file = $destiny_path.'/'.$file_name;
2666 2666
 
2667 2667
         $pre_original = strstr($original_path, 'document');
2668 2668
         $pre_destin = strstr($destiny_path, 'document');
@@ -2684,11 +2684,11 @@  discard block
 block discarded – undo
2684 2684
         }
2685 2685
 
2686 2686
         if ($pre_original != '') {
2687
-            $pre_original = '..' . $pre_original . '/';
2687
+            $pre_original = '..'.$pre_original.'/';
2688 2688
         }
2689 2689
 
2690 2690
         if ($pre_destin != '') {
2691
-            $pre_destin = '..' . $pre_destin . '/';
2691
+            $pre_destin = '..'.$pre_destin.'/';
2692 2692
         }
2693 2693
 
2694 2694
         $levels = explode('/', $pre_original);
@@ -2706,7 +2706,7 @@  discard block
 block discarded – undo
2706 2706
         //echo '$count_pre_destination_levels '. $count_pre_destination_levels;
2707 2707
         $pre_remove = '';
2708 2708
         for ($i = 1; $i <= $count_pre_destination_levels; $i++) {
2709
-            $pre_remove .='..\/';
2709
+            $pre_remove .= '..\/';
2710 2710
         }
2711 2711
 
2712 2712
         $orig_source_html = DocumentManager::get_resources_from_source_html($content_html);
@@ -2714,9 +2714,9 @@  discard block
 block discarded – undo
2714 2714
         foreach ($orig_source_html as $source) {
2715 2715
 
2716 2716
             // get information about source url
2717
-            $real_orig_url = $source[0];   // url
2718
-            $scope_url = $source[1];   // scope (local, remote)
2719
-            $type_url = $source[2];   // tyle (rel, abs, url)
2717
+            $real_orig_url = $source[0]; // url
2718
+            $scope_url = $source[1]; // scope (local, remote)
2719
+            $type_url = $source[2]; // tyle (rel, abs, url)
2720 2720
             // Get path and query from origin url
2721 2721
             $orig_parse_url = parse_url($real_orig_url);
2722 2722
             $real_orig_path = $orig_parse_url['path'];
@@ -2743,11 +2743,11 @@  discard block
 block discarded – undo
2743 2743
                         $real_orig_url_temp = '';
2744 2744
                         if ($mode == 'inside') {
2745 2745
                             $real_orig_url_temp = str_replace('../', '', $real_orig_url);
2746
-                            $destination_url = $link_to_add . $real_orig_url_temp;
2746
+                            $destination_url = $link_to_add.$real_orig_url_temp;
2747 2747
                         } else {
2748 2748
                             $real_orig_url_temp = $real_orig_url;
2749 2749
 
2750
-                            $destination_url = preg_replace("/" . $pre_remove . "/", '', $real_orig_url, 1);
2750
+                            $destination_url = preg_replace("/".$pre_remove."/", '', $real_orig_url, 1);
2751 2751
                         }
2752 2752
                         if ($real_orig_url == $destination_url) {
2753 2753
                             //echo 'continue2';
@@ -2773,7 +2773,7 @@  discard block
 block discarded – undo
2773 2773
     {
2774 2774
         $course_data = api_get_course_info($course_code);
2775 2775
         $document_data = self::get_document_data_by_id($document_id, $course_code);
2776
-        $file_path = api_get_path(SYS_COURSE_PATH) . $course_data['path'] . '/document' . $document_data['path'];
2776
+        $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$document_data['path'];
2777 2777
         $pdf = new PDF('A4-L', 'L');
2778 2778
         $pdf->html_to_pdf($file_path, $document_data['title'], $course_code);
2779 2779
     }
@@ -2804,9 +2804,9 @@  discard block
 block discarded – undo
2804 2804
     ) {
2805 2805
         $course_info = api_get_course_info();
2806 2806
         $sessionId = api_get_session_id();
2807
-        $course_dir = $course_info['path'] . '/document';
2807
+        $course_dir = $course_info['path'].'/document';
2808 2808
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
2809
-        $base_work_dir = $sys_course_path . $course_dir;
2809
+        $base_work_dir = $sys_course_path.$course_dir;
2810 2810
 
2811 2811
         if (isset($files[$fileKey])) {
2812 2812
             $upload_ok = process_uploaded_file($files[$fileKey], $show_output);
@@ -2878,7 +2878,7 @@  discard block
 block discarded – undo
2878 2878
                     // Showing message when sending zip files
2879 2879
                     if ($new_path === true && $unzip == 1 && $show_output) {
2880 2880
                         Display::display_confirmation_message(
2881
-                            get_lang('UplUploadSucceeded') . '<br />',
2881
+                            get_lang('UplUploadSucceeded').'<br />',
2882 2882
                             false
2883 2883
                         );
2884 2884
                     }
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
         }
2981 2981
         if (isset($output)) {
2982 2982
             foreach ($output as & $line) {
2983
-                $content .= $line . "\n";
2983
+                $content .= $line."\n";
2984 2984
             }
2985 2985
             return $content;
2986 2986
         } else {
@@ -3012,13 +3012,13 @@  discard block
 block discarded – undo
3012 3012
         $group_condition = null;
3013 3013
         if (isset($group_id)) {
3014 3014
             $group_id = intval($group_id);
3015
-            $group_condition = " AND props.to_group_id='" . $group_id . "' ";
3015
+            $group_condition = " AND props.to_group_id='".$group_id."' ";
3016 3016
         }
3017 3017
 
3018 3018
         $session_condition = null;
3019 3019
         if (isset($session_id)) {
3020 3020
             $session_id = intval($session_id);
3021
-            $session_condition = " AND props.session_id='" . $session_id . "' ";
3021
+            $session_condition = " AND props.session_id='".$session_id."' ";
3022 3022
         }
3023 3023
 
3024 3024
         $sql = "SELECT SUM(size)
@@ -3028,7 +3028,7 @@  discard block
 block discarded – undo
3028 3028
                 WHERE
3029 3029
                     props.c_id 	= $course_id AND
3030 3030
                     docs.c_id 	= $course_id AND
3031
-                    props.tool 	= '" . TOOL_DOCUMENT . "' AND
3031
+                    props.tool 	= '".TOOL_DOCUMENT."' AND
3032 3032
                     props.visibility <> 2
3033 3033
                     $group_condition
3034 3034
                     $session_condition
@@ -3051,8 +3051,8 @@  discard block
 block discarded – undo
3051 3051
         $course_quota_m = round($course_quota / 1048576);
3052 3052
         $already_consumed_space_m = round($already_consumed_space / 1048576);
3053 3053
 
3054
-        $message = get_lang('MaximumAllowedQuota') . ' <strong>' . $course_quota_m . ' megabyte</strong>.<br />';
3055
-        $message .= get_lang('CourseCurrentlyUses') . ' <strong>' . $already_consumed_space_m . ' megabyte</strong>.<br />';
3054
+        $message = get_lang('MaximumAllowedQuota').' <strong>'.$course_quota_m.' megabyte</strong>.<br />';
3055
+        $message .= get_lang('CourseCurrentlyUses').' <strong>'.$already_consumed_space_m.' megabyte</strong>.<br />';
3056 3056
 
3057 3057
         $percentage = round(($already_consumed_space / $course_quota * 100), 1);
3058 3058
 
@@ -3060,33 +3060,33 @@  discard block
 block discarded – undo
3060 3060
 
3061 3061
         // Decide where to place percentage in graph
3062 3062
         if ($percentage >= 50) {
3063
-            $text_in_filled = '&nbsp;' . $other_percentage . '%';
3063
+            $text_in_filled = '&nbsp;'.$other_percentage.'%';
3064 3064
             $text_in_unfilled = '';
3065 3065
         } else {
3066
-            $text_in_unfilled = '&nbsp;' . $other_percentage . '%';
3066
+            $text_in_unfilled = '&nbsp;'.$other_percentage.'%';
3067 3067
             $text_in_filled = '';
3068 3068
         }
3069 3069
 
3070 3070
         // Decide the background colour of the graph
3071 3071
         if ($percentage < 65) {
3072
-            $colour = '#00BB00';        // Safe - green
3072
+            $colour = '#00BB00'; // Safe - green
3073 3073
         } elseif ($percentage < 90) {
3074
-            $colour = '#ffd400';        // Filling up - yelloworange
3074
+            $colour = '#ffd400'; // Filling up - yelloworange
3075 3075
         } else {
3076
-            $colour = '#DD0000';        // Full - red
3076
+            $colour = '#DD0000'; // Full - red
3077 3077
         }
3078 3078
 
3079 3079
         // This is used for the table width: a table of only 100 pixels looks too small
3080 3080
         $visual_percentage = 4 * $percentage;
3081 3081
         $visual_other_percentage = 4 * $other_percentage;
3082 3082
 
3083
-        $message .= get_lang('PercentageQuotaInUse') . ': <strong>' . $percentage . '%</strong>.<br />' .
3084
-            get_lang('PercentageQuotaFree') . ': <strong>' . $other_percentage . '%</strong>.<br />';
3083
+        $message .= get_lang('PercentageQuotaInUse').': <strong>'.$percentage.'%</strong>.<br />'.
3084
+            get_lang('PercentageQuotaFree').': <strong>'.$other_percentage.'%</strong>.<br />';
3085 3085
 
3086
-        $show_percentage = '&nbsp;' . $percentage . '%';
3087
-        $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\'' . api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/bg-header4.png\');" class="document-quota-bar">' .
3088
-            '<div style="width:' . $percentage . '%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;">&nbsp;</div>' .
3089
-            '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">' . $show_percentage . '</span></div>';
3086
+        $show_percentage = '&nbsp;'.$percentage.'%';
3087
+        $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\''.api_get_path(WEB_CODE_PATH).'css/'.api_get_visual_theme().'/images/bg-header4.png\');" class="document-quota-bar">'.
3088
+            '<div style="width:'.$percentage.'%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;">&nbsp;</div>'.
3089
+            '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">'.$show_percentage.'</span></div>';
3090 3090
         echo $message;
3091 3091
     }
3092 3092
 
@@ -3102,7 +3102,7 @@  discard block
 block discarded – undo
3102 3102
         $percentage = $already_consumed_space / $course_quota * 100;
3103 3103
         $percentage = round($percentage, 1);
3104 3104
         $message = get_lang('YouAreCurrentlyUsingXOfYourX');
3105
-        $message = sprintf($message, $already_consumed_space_m, $percentage . '%', $course_quota_m . ' ');
3105
+        $message = sprintf($message, $already_consumed_space_m, $percentage.'%', $course_quota_m.' ');
3106 3106
         echo Display::div($message, array('id' => 'document_quota'));
3107 3107
     }
3108 3108
 
@@ -3133,13 +3133,13 @@  discard block
 block discarded – undo
3133 3133
      */
3134 3134
     static function generate_jplayer_jquery($params = array())
3135 3135
     {
3136
-        $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/';
3136
+        $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
3137 3137
 
3138 3138
         $js = '
3139
-            $("#jquery_jplayer_' . $params['count'] . '").jPlayer({
3139
+            $("#jquery_jplayer_' . $params['count'].'").jPlayer({
3140 3140
                 ready: function() {
3141 3141
                     $(this).jPlayer("setMedia", {
3142
-                        ' . $params['extension'] . ' : "' . $params['url'] . '"
3142
+                        ' . $params['extension'].' : "'.$params['url'].'"
3143 3143
                     });
3144 3144
                 },
3145 3145
                 play: function() { // To avoid both jPlayers playing together.
@@ -3147,12 +3147,12 @@  discard block
 block discarded – undo
3147 3147
                 },
3148 3148
                 //errorAlerts: true,
3149 3149
                 //warningAlerts: true,
3150
-                swfPath: "' . $js_path . 'jquery-jplayer/jplayer/",
3150
+                swfPath: "' . $js_path.'jquery-jplayer/jplayer/",
3151 3151
                 //supplied: "m4a, oga, mp3, ogg, wav",
3152
-                supplied: "' . $params['extension'] . '",
3152
+                supplied: "' . $params['extension'].'",
3153 3153
                 wmode: "window",
3154 3154
                 solution: "flash, html",  // Do not change this setting
3155
-                cssSelectorAncestor: "#jp_container_' . $params['count'] . '",
3155
+                cssSelectorAncestor: "#jp_container_' . $params['count'].'",
3156 3156
             });  	 ' . "\n\n";
3157 3157
 
3158 3158
         return $js;
@@ -3182,16 +3182,16 @@  discard block
 block discarded – undo
3182 3182
         }
3183 3183
 
3184 3184
         //Shows only the play button
3185
-        $html = '<div id="jquery_jplayer_' . $i . '" class="jp-jplayer"></div>
3186
-                <div id="jp_container_' . $i . '" class="jp-audio">
3185
+        $html = '<div id="jquery_jplayer_'.$i.'" class="jp-jplayer"></div>
3186
+                <div id="jp_container_' . $i.'" class="jp-audio">
3187 3187
                     <div class="jp-type-single">
3188 3188
                         <div class="jp-gui jp-interface">
3189 3189
                             <ul class="jp-controls">
3190 3190
                                 <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
3191 3191
                                 <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
3192
-                                ' . $extra_controls . '
3192
+                                ' . $extra_controls.'
3193 3193
                             </ul>
3194
-                            ' . $progress . '
3194
+                            ' . $progress.'
3195 3195
                         </div>
3196 3196
                     </div>
3197 3197
                 </div>';
@@ -3244,8 +3244,8 @@  discard block
 block discarded – undo
3244 3244
                     </div>
3245 3245
                 </div>
3246 3246
                 <div class="jp-no-solution">
3247
-                    <span>' . get_lang('UpdateRequire') . '</span>
3248
-                    ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile") . '
3247
+                    <span>' . get_lang('UpdateRequire').'</span>
3248
+                    ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile").'
3249 3249
                 </div>
3250 3250
             </div>
3251 3251
         </div>';
@@ -3326,7 +3326,7 @@  discard block
 block discarded – undo
3326 3326
 
3327 3327
         $add_folder_filter = null;
3328 3328
         if (!empty($filter_by_folder)) {
3329
-            $add_folder_filter = " AND docs.path LIKE '" . Database::escape_string($filter_by_folder) . "%'";
3329
+            $add_folder_filter = " AND docs.path LIKE '".Database::escape_string($filter_by_folder)."%'";
3330 3330
         }
3331 3331
 
3332 3332
         // If we are in LP display hidden folder https://support.chamilo.org/issues/6679
@@ -3361,7 +3361,7 @@  discard block
 block discarded – undo
3361 3361
 
3362 3362
                 $notLikeCondition = null;
3363 3363
                 for ($i = 1; $i <= $num; $i++) {
3364
-                    $repeat = str_repeat('/%', $i+1);
3364
+                    $repeat = str_repeat('/%', $i + 1);
3365 3365
                     $notLikeCondition .= " AND docs.path NOT LIKE '".Database::escape_string($cleanedPath.$repeat)."' ";
3366 3366
                 }
3367 3367
 
@@ -3386,7 +3386,7 @@  discard block
 block discarded – undo
3386 3386
                 ON (docs.id = last.ref AND docs.c_id = last.c_id)
3387 3387
                 WHERE
3388 3388
                     docs.path NOT LIKE '%_DELETED_%' AND
3389
-                    last.tool = '" . TOOL_DOCUMENT . "' $condition_session AND
3389
+                    last.tool = '".TOOL_DOCUMENT."' $condition_session AND
3390 3390
                     (last.visibility = '1' $lp_visibility_condition) AND
3391 3391
                     last.visibility <> 2 AND
3392 3392
                     docs.c_id = {$course_info['real_id']} AND
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
                 Display::url(
3417 3417
                     Display::return_icon('close.png', get_lang('Close'), array(), ICON_SIZE_SMALL),
3418 3418
                     ' javascript:void(0);',
3419
-                    array('id' => 'close_div_' . $course_info['real_id'] . '_' . $session_id, 'class' => 'close_div')
3419
+                    array('id' => 'close_div_'.$course_info['real_id'].'_'.$session_id, 'class' => 'close_div')
3420 3420
                 ),
3421 3421
                 array('style' => 'position:absolute;right:10px')
3422 3422
             );
@@ -3516,12 +3516,12 @@  discard block
 block discarded – undo
3516 3516
 
3517 3517
                 if (image.hasClass('open')) {
3518 3518
                     image.removeClass('open');
3519
-                    image.attr('src', '" . $img_path . "nolines_plus.gif');
3519
+                    image.attr('src', '" . $img_path."nolines_plus.gif');
3520 3520
                     $('#'+id).show();
3521 3521
                     $('#'+tempId).hide();
3522 3522
                 } else {
3523 3523
                     image.addClass('open');
3524
-                    image.attr('src', '" . $img_path . "nolines_minus.gif');
3524
+                    image.attr('src', '" . $img_path."nolines_minus.gif');
3525 3525
                     $('#'+id).hide();
3526 3526
                     $('#'+tempId).show();
3527 3527
 
@@ -3569,7 +3569,7 @@  discard block
 block discarded – undo
3569 3569
         $overwrite_url
3570 3570
     ) {
3571 3571
         $img_path = api_get_path(WEB_IMG_PATH);
3572
-        $img_sys_path = api_get_path(SYS_CODE_PATH) . 'img/';
3572
+        $img_sys_path = api_get_path(SYS_CODE_PATH).'img/';
3573 3573
         $web_code_path = api_get_path(WEB_CODE_PATH);
3574 3574
 
3575 3575
         $documentId = $resource['id'];
@@ -3584,7 +3584,7 @@  discard block
 block discarded – undo
3584 3584
         // It's a file.
3585 3585
         $icon = choose_image($path);
3586 3586
         $position = strrpos($icon, '.');
3587
-        $icon = substr($icon, 0, $position) . '_small.gif';
3587
+        $icon = substr($icon, 0, $position).'_small.gif';
3588 3588
         $my_file_title = $resource['title'];
3589 3589
         $visibility = $resource['visibility'];
3590 3590
 
@@ -3596,25 +3596,25 @@  discard block
 block discarded – undo
3596 3596
         // Show the "image name" not the filename of the image.
3597 3597
         if ($lp_id) {
3598 3598
             //LP URL
3599
-            $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type=' . TOOL_DOCUMENT . '&amp;file=' . $documentId . '&amp;lp_id=' . $lp_id;
3599
+            $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type='.TOOL_DOCUMENT.'&amp;file='.$documentId.'&amp;lp_id='.$lp_id;
3600 3600
             if (!empty($overwrite_url)) {
3601
-                $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId.'';
3601
+                $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId.'';
3602 3602
             }
3603 3603
         } else {
3604 3604
             // Direct document URL
3605
-            $url = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId;
3605
+            $url = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId;
3606 3606
             if (!empty($overwrite_url)) {
3607
-                $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId;
3607
+                $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId;
3608 3608
             }
3609 3609
         }
3610 3610
 
3611
-        $img = $img_path . $icon;
3612
-        if (!file_exists($img_sys_path . $icon)) {
3613
-            $img = $img_path . 'icons/16/default_small.gif';
3611
+        $img = $img_path.$icon;
3612
+        if (!file_exists($img_sys_path.$icon)) {
3613
+            $img = $img_path.'icons/16/default_small.gif';
3614 3614
         }
3615 3615
 
3616 3616
         $link = Display::url(
3617
-            '<img alt="" src="' . $img . '" title="" />&nbsp;' . $my_file_title, $url,
3617
+            '<img alt="" src="'.$img.'" title="" />&nbsp;'.$my_file_title, $url,
3618 3618
             array('target' => $target)
3619 3619
         );
3620 3620
 
@@ -3625,12 +3625,12 @@  discard block
 block discarded – undo
3625 3625
         $return = null;
3626 3626
 
3627 3627
         if ($lp_id == false) {
3628
-            $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >';
3628
+            $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >';
3629 3629
         } else {
3630
-            $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >';
3630
+            $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >';
3631 3631
         }
3632 3632
 
3633
-        $return .= '<div class="item_data" style="margin-left:' . ($num  * 18) . 'px;margin-right:5px;">';
3633
+        $return .= '<div class="item_data" style="margin-left:'.($num * 18).'px;margin-right:5px;">';
3634 3634
 
3635 3635
         if ($add_move_button) {
3636 3636
             $return .= '<a class="moved" href="#">';
@@ -3697,7 +3697,7 @@  discard block
 block discarded – undo
3697 3697
             if (isset($resource['visible']) && $resource['visible'] == 0) {
3698 3698
                 $folder_class_hidden = "doc_folder_hidden"; // in base.css
3699 3699
             }
3700
-            $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"';
3700
+            $onclick = 'onclick="javascript: testResources(\'res_'.$resource['id'].'\',\'img_'.$resource['id'].'\')"';
3701 3701
         }
3702 3702
         $return = null;
3703 3703
 
@@ -3705,23 +3705,23 @@  discard block
 block discarded – undo
3705 3705
             $return = '<ul class="lp_resource">';
3706 3706
         }
3707 3707
 
3708
-        $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_' . $resource['id'] . '"  style="margin-left:' . ($num * 18) . 'px; ">';
3708
+        $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_'.$resource['id'].'"  style="margin-left:'.($num * 18).'px; ">';
3709 3709
 
3710 3710
         $image = $img_path.'nolines_plus.gif';
3711 3711
         if (empty($path)) {
3712 3712
             $image = $img_path.'nolines_minus.gif';
3713 3713
         }
3714
-        $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'] . '" '.$onclick.'>';
3714
+        $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'].'" '.$onclick.'>';
3715 3715
 
3716
-        $return .= '<img alt="" src="' . $img_path . 'lp_folder.gif" title="" align="absmiddle" />&nbsp;';
3716
+        $return .= '<img alt="" src="'.$img_path.'lp_folder.gif" title="" align="absmiddle" />&nbsp;';
3717 3717
         $return .= '<span '.$onclick.' style="cursor: pointer;" >'.$title.'</span>';
3718 3718
         $return .= '</li>';
3719 3719
 
3720 3720
         if (empty($path)) {
3721 3721
             if ($folderId == false) {
3722
-                $return .= '<div id="res_' . $resource['id'] . '" >';
3722
+                $return .= '<div id="res_'.$resource['id'].'" >';
3723 3723
             } else {
3724
-                $return .= '<div id="res_' . $resource['id'] . '" style="display: none;" >';
3724
+                $return .= '<div id="res_'.$resource['id'].'" style="display: none;" >';
3725 3725
             }
3726 3726
         }
3727 3727
 
@@ -3883,9 +3883,9 @@  discard block
 block discarded – undo
3883 3883
             $session_id = api_get_session_id();
3884 3884
         }
3885 3885
         $course_info = api_get_course_info($course_code);
3886
-        $course_dir = $course_info['path'] . '/document';
3886
+        $course_dir = $course_info['path'].'/document';
3887 3887
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
3888
-        $base_work_dir = $sys_course_path . $course_dir;
3888
+        $base_work_dir = $sys_course_path.$course_dir;
3889 3889
 
3890 3890
         $course_id = $course_info['real_id'];
3891 3891
         $table_document = Database::get_course_table(TABLE_DOCUMENT);
@@ -3894,7 +3894,7 @@  discard block
 block discarded – undo
3894 3894
         $result = Database::query($qry);
3895 3895
         if (Database::num_rows($result) == 1) {
3896 3896
             $row = Database::fetch_array($result);
3897
-            $doc_path = api_get_path(SYS_COURSE_PATH) . $course_dir . $row['path'];
3897
+            $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path'];
3898 3898
             //TODO: mime_content_type is deprecated, fileinfo php extension is enabled by default as of PHP 5.3.0
3899 3899
             // now versions of PHP on Debian testing(5.2.6-5) and Ubuntu(5.2.6-2ubuntu) are lower, so wait for a while
3900 3900
             $doc_mime = mime_content_type($doc_path);
@@ -3925,8 +3925,8 @@  discard block
 block discarded – undo
3925 3925
                 $file_content = self::get_text_content($doc_path, $doc_mime);
3926 3926
                 $course_code = Database::escape_string($course_code);
3927 3927
 
3928
-                require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
3929
-                require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
3928
+                require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
3929
+                require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
3930 3930
 
3931 3931
                 $ic_slide = new IndexableChunk();
3932 3932
                 $ic_slide->addValue('title', $file_title);
@@ -3943,7 +3943,7 @@  discard block
 block discarded – undo
3943 3943
                 $di = new ChamiloIndexer();
3944 3944
                 $return = $di->connectDb(null, null, $lang);
3945 3945
 
3946
-                require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
3946
+                require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
3947 3947
                 $specific_fields = get_specific_field_list();
3948 3948
 
3949 3949
                 // process different depending on what to do if file exists
@@ -3980,7 +3980,7 @@  discard block
 block discarded – undo
3980 3980
                             } else { //if the specific field is not defined, force an empty one
3981 3981
                                 $sterms = '';
3982 3982
                             }
3983
-                            $all_specific_terms .= ' ' . $sterms;
3983
+                            $all_specific_terms .= ' '.$sterms;
3984 3984
                             $sterms = explode(',', $sterms);
3985 3985
                             foreach ($sterms as $sterm) {
3986 3986
                                 $sterm = trim($sterm);
@@ -3994,7 +3994,7 @@  discard block
 block discarded – undo
3994 3994
                             }
3995 3995
                         }
3996 3996
                         // Add terms also to content to make terms findable by probabilistic search
3997
-                        $file_content = $all_specific_terms . ' ' . $file_content;
3997
+                        $file_content = $all_specific_terms.' '.$file_content;
3998 3998
 
3999 3999
                         if (!$simulation) {
4000 4000
                             $ic_slide->addValue('content', $file_content);
@@ -4020,7 +4020,7 @@  discard block
 block discarded – undo
4020 4020
                         } else { //if the specific field is not defined, force an empty one
4021 4021
                             $sterms = '';
4022 4022
                         }
4023
-                        $all_specific_terms .= ' ' . $sterms;
4023
+                        $all_specific_terms .= ' '.$sterms;
4024 4024
                         if (!empty($sterms)) {
4025 4025
                             $sterms = explode(',', $sterms);
4026 4026
                             foreach ($sterms as $sterm) {
@@ -4032,7 +4032,7 @@  discard block
 block discarded – undo
4032 4032
                         }
4033 4033
                     }
4034 4034
                     // Add terms also to content to make terms findable by probabilistic search
4035
-                    $file_content = $all_specific_terms . ' ' . $file_content;
4035
+                    $file_content = $all_specific_terms.' '.$file_content;
4036 4036
                     if (!$simulation) {
4037 4037
                         $ic_slide->addValue('content', $file_content);
4038 4038
                         $di->addChunk($ic_slide);
@@ -4316,7 +4316,7 @@  discard block
 block discarded – undo
4316 4316
         $defaultVisibility = 'visible';
4317 4317
 
4318 4318
         if (isset($settings['documents'])) {
4319
-            $portalDefaultVisibility =  'invisible';
4319
+            $portalDefaultVisibility = 'invisible';
4320 4320
             if ($settings['documents'] == 'true') {
4321 4321
                 $portalDefaultVisibility = 'visible';
4322 4322
             }
@@ -4554,7 +4554,7 @@  discard block
 block discarded – undo
4554 4554
         //make htaccess with allow from all, and file index.html into temp/audio
4555 4555
         $htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess';
4556 4556
         if (!file_exists($htaccess)) {
4557
-            $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
4557
+            $htaccess_content = "order deny,allow\r\nallow from all\r\nOptions -Indexes";
4558 4558
             $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess', 'w');
4559 4559
             if ($fp) {
4560 4560
                 fwrite($fp, $htaccess_content);
@@ -4563,9 +4563,9 @@  discard block
 block discarded – undo
4563 4563
         }
4564 4564
 
4565 4565
         //encript temp name file
4566
-        $name_crip = sha1(uniqid());//encript
4567
-        $findext= explode(".", $file);
4568
-        $extension = $findext[count($findext)-1];
4566
+        $name_crip = sha1(uniqid()); //encript
4567
+        $findext = explode(".", $file);
4568
+        $extension = $findext[count($findext) - 1];
4569 4569
         $file_crip = $name_crip.'.'.$extension;
4570 4570
 
4571 4571
         //copy file to temp/audio directory
@@ -4669,7 +4669,7 @@  discard block
 block discarded – undo
4669 4669
         $comment = null;
4670 4670
 
4671 4671
         $fileName = api_replace_dangerous_char($title);
4672
-        $filePath = api_get_path(SYS_COURSE_PATH) . "{$courseData['path']}/document{$dir}";
4672
+        $filePath = api_get_path(SYS_COURSE_PATH)."{$courseData['path']}/document{$dir}";
4673 4673
         $fileFullPath = "{$filePath}/{$fileName}.html";
4674 4674
         $fileSize = 0;
4675 4675
         $fileType = 'file';
@@ -4721,7 +4721,7 @@  discard block
 block discarded – undo
4721 4721
             $fileSize,
4722 4722
             $title,
4723 4723
             $comment,
4724
-            0,//$readonly = 0,
4724
+            0, //$readonly = 0,
4725 4725
             true, //$save_visibility = true,
4726 4726
             null, //$group_id = null,
4727 4727
             $sessionId
@@ -5006,8 +5006,8 @@  discard block
 block discarded – undo
5006 5006
             $sessionId,
5007 5007
             $groupId
5008 5008
         )) {
5009
-            $uniqueName = self::addSuffixToFileName($name, '_' . $counter);
5010
-            $filePath = $path . $uniqueName;
5009
+            $uniqueName = self::addSuffixToFileName($name, '_'.$counter);
5010
+            $filePath = $path.$uniqueName;
5011 5011
             $counter++;
5012 5012
         }
5013 5013
 
@@ -5040,7 +5040,7 @@  discard block
 block discarded – undo
5040 5040
             $folder_sql = implode("','", $escaped_folders);
5041 5041
 
5042 5042
             $sql = "SELECT * FROM $doc_table
5043
-                WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('" . $folder_sql . "')";
5043
+                WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('".$folder_sql."')";
5044 5044
             $res = Database::query($sql);
5045 5045
             $folder_titles = array();
5046 5046
             while ($obj = Database::fetch_object($res)) {
@@ -5048,7 +5048,7 @@  discard block
 block discarded – undo
5048 5048
             }
5049 5049
         }
5050 5050
 
5051
-        $form = new FormValidator('selector', 'GET', api_get_self() . '?' . api_get_cidreq());
5051
+        $form = new FormValidator('selector', 'GET', api_get_self().'?'.api_get_cidreq());
5052 5052
         $form->addElement('hidden', 'cidReq', api_get_course_id());
5053 5053
         $parent_select = $form->addSelect('id', get_lang('CurrentDirectory'), '', array('onchange' => 'javascript: document.selector.submit();'));
5054 5054
 
@@ -5068,9 +5068,9 @@  discard block
 block discarded – undo
5068 5068
                     $folder_titles[$folder] = cut($folder_titles[$folder], 80);
5069 5069
                     $counter = count($path_parts) - 2;
5070 5070
                     if ($counter > 0) {
5071
-                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', $counter) . ' &mdash; ' . $folder_titles[$folder];
5071
+                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', $counter).' &mdash; '.$folder_titles[$folder];
5072 5072
                     } else {
5073
-                        $label = ' &mdash; ' . $folder_titles[$folder];
5073
+                        $label = ' &mdash; '.$folder_titles[$folder];
5074 5074
                     }
5075 5075
                     $parent_select->addOption($label, $folder_id);
5076 5076
                     if ($selected != '') {
@@ -5088,7 +5088,7 @@  discard block
 block discarded – undo
5088 5088
                     } else {
5089 5089
                         $path_parts = explode('/', str_replace($group_dir, '', $folder));
5090 5090
                         $label = cut($label, 80);
5091
-                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2) . ' &mdash; ' . $label;
5091
+                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
5092 5092
                     }
5093 5093
                     $parent_select->addOption($label, $folder_id);
5094 5094
                     if ($selected != '') {
@@ -5120,7 +5120,7 @@  discard block
 block discarded – undo
5120 5120
     ) {
5121 5121
         global $dbl_click_id;
5122 5122
         $course_info = api_get_course_info();
5123
-        $www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document';
5123
+        $www = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document';
5124 5124
         $webOdflist = DocumentManager::get_web_odf_extension_list();
5125 5125
 
5126 5126
         // Get the title or the basename depending on what we're using
@@ -5144,11 +5144,11 @@  discard block
 block discarded – undo
5144 5144
 
5145 5145
         if (!$show_as_icon) {
5146 5146
             // Build download link (icon)
5147
-            $forcedownload_link = ($filetype == 'folder') ? api_get_self() . '?' . api_get_cidreq() . '&action=downloadfolder&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq() . '&amp;action=download&amp;id=' . $document_data['id'];
5147
+            $forcedownload_link = ($filetype == 'folder') ? api_get_self().'?'.api_get_cidreq().'&action=downloadfolder&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq().'&amp;action=download&amp;id='.$document_data['id'];
5148 5148
             // Folder download or file download?
5149 5149
             $forcedownload_icon = ($filetype == 'folder') ? 'save_pack.png' : 'save.png';
5150 5150
             // Prevent multiple clicks on zipped folder download
5151
-            $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_" . ($dbl_click_id++) . "=false;',10000); } else { return false; }\"" : '';
5151
+            $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_".($dbl_click_id++)."=false;',10000); } else { return false; }\"" : '';
5152 5152
         }
5153 5153
 
5154 5154
         $target = '_self';
@@ -5164,20 +5164,20 @@  discard block
 block discarded – undo
5164 5164
 
5165 5165
             if ($is_browser_viewable_file) {
5166 5166
                 if ($ext == 'pdf' || in_array($ext, $webOdflist)) {
5167
-                    $url = api_get_self() . '?' . api_get_cidreq() . '&amp;action=download&amp;id=' . $document_data['id'];
5167
+                    $url = api_get_self().'?'.api_get_cidreq().'&amp;action=download&amp;id='.$document_data['id'];
5168 5168
                 } else {
5169
-                    $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5169
+                    $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5170 5170
                 }
5171 5171
             } else {
5172 5172
                 // url-encode for problematic characters (we may not call them dangerous characters...)
5173
-                $path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq();
5174
-                $url = $www . $path;
5173
+                $path = str_replace('%2F', '/', $url_path).'?'.api_get_cidreq();
5174
+                $url = $www.$path;
5175 5175
             }
5176 5176
 
5177 5177
             /*$path = str_replace('%2F', '/', $url_path); //yox view hack otherwise the image can't be well read
5178 5178
             $url = $www . $path;*/
5179 5179
         } else {
5180
-            $url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id'];
5180
+            $url = api_get_self().'?'.api_get_cidreq().'&id='.$document_data['id'];
5181 5181
         }
5182 5182
 
5183 5183
         // The little download icon
@@ -5187,10 +5187,10 @@  discard block
 block discarded – undo
5187 5187
         if ($path == '/shared_folder') {
5188 5188
             $tooltip_title_alt = get_lang('UserFolders');
5189 5189
         } elseif (strstr($path, 'shared_folder_session_')) {
5190
-            $tooltip_title_alt = get_lang('UserFolders') . ' (' . api_get_session_name(api_get_session_id()) . ')';
5190
+            $tooltip_title_alt = get_lang('UserFolders').' ('.api_get_session_name(api_get_session_id()).')';
5191 5191
         } elseif (strstr($tooltip_title, 'sf_user_')) {
5192 5192
             $userinfo = api_get_user_info(substr($tooltip_title, 8));
5193
-            $tooltip_title_alt = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
5193
+            $tooltip_title_alt = get_lang('UserFolder').' '.$userinfo['complete_name'];
5194 5194
         } elseif ($path == '/chat_files') {
5195 5195
             $tooltip_title_alt = get_lang('ChatFiles');
5196 5196
         } elseif ($path == '/learning_path') {
@@ -5223,24 +5223,24 @@  discard block
 block discarded – undo
5223 5223
                 ) {
5224 5224
                     //filter when I am into shared folder, I can show for donwload only my shared folder
5225 5225
                     if (DocumentManager::is_shared_folder($curdirpath, $current_session_id)) {
5226
-                        if (preg_match('/shared_folder\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
5227
-                            preg_match('/shared_folder_session_' . $current_session_id . '\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
5226
+                        if (preg_match('/shared_folder\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) ||
5227
+                            preg_match('/shared_folder_session_'.$current_session_id.'\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) ||
5228 5228
                             api_is_allowed_to_edit() || api_is_platform_admin()
5229 5229
                         ) {
5230
-                            $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5231
-                                Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5230
+                            $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5231
+                                Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5232 5232
                         }
5233 5233
                     } elseif (!preg_match('/shared_folder/', urldecode($forcedownload_link)) ||
5234 5234
                         api_is_allowed_to_edit() ||
5235 5235
                         api_is_platform_admin()
5236 5236
                     ) {
5237
-                        $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5238
-                            Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5237
+                        $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5238
+                            Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5239 5239
                     }
5240 5240
                 }
5241 5241
             } else {
5242
-                $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5243
-                    Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5242
+                $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5243
+                    Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5244 5244
             }
5245 5245
 
5246 5246
             // Copy files to users myfiles
@@ -5248,12 +5248,12 @@  discard block
 block discarded – undo
5248 5248
                 api_get_setting('users_copy_files') == 'true' &&
5249 5249
                 !api_is_anonymous()
5250 5250
             ) {
5251
-                $copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq();
5251
+                $copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&action=copytomyfiles&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq();
5252 5252
 
5253 5253
                 if ($filetype == 'file') {
5254 5254
 
5255
-                    $copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5256
-                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
5255
+                    $copy_to_myfiles = '<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5256
+                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
5257 5257
 
5258 5258
                     if (api_get_setting('allow_my_files') === 'false') {
5259 5259
                         $copy_to_myfiles = '';
@@ -5272,13 +5272,13 @@  discard block
 block discarded – undo
5272 5272
                 $filetype == 'file' &&
5273 5273
                 in_array($extension, array('html', 'htm'))
5274 5274
             ) {
5275
-                $pdf_icon = ' <a style="float:right".' . $prevent_multiple_click . ' href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $document_data['id'] . '">' .
5276
-                    Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a> ';
5275
+                $pdf_icon = ' <a style="float:right".'.$prevent_multiple_click.' href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$document_data['id'].'">'.
5276
+                    Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a> ';
5277 5277
             }
5278 5278
 
5279 5279
             if ($is_browser_viewable_file) {
5280
-                $open_in_new_window_link = '<a href="' . $www . str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq() . '" style="float:right"' . $prevent_multiple_click . ' target="_blank">' .
5281
-                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
5280
+                $open_in_new_window_link = '<a href="'.$www.str_replace('%2F', '/', $url_path).'?'.api_get_cidreq().'" style="float:right"'.$prevent_multiple_click.' target="_blank">'.
5281
+                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
5282 5282
             }
5283 5283
 
5284 5284
             if ($filetype == 'file') {
@@ -5287,9 +5287,9 @@  discard block
 block discarded – undo
5287 5287
                     (preg_match('/wav$/i', urldecode($checkExtension)) && !preg_match('/_chnano_.wav$/i', urldecode($url))) ||
5288 5288
                     preg_match('/ogg$/i', urldecode($checkExtension))
5289 5289
                 ) {
5290
-                    return '<span style="float:left" ' . $visibility_class . '>' .
5291
-                    $title .
5292
-                    '</span>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5290
+                    return '<span style="float:left" '.$visibility_class.'>'.
5291
+                    $title.
5292
+                    '</span>'.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5293 5293
                 } elseif (
5294 5294
 
5295 5295
                     // Show preview
@@ -5307,7 +5307,7 @@  discard block
 block discarded – undo
5307 5307
                     )
5308 5308
                 ) {
5309 5309
                     // Simpler version of showinframesmin.php with no headers
5310
-                    $url = 'show_content.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5310
+                    $url = 'show_content.php?'.api_get_cidreq().'&id='.$document_data['id'];
5311 5311
                     $class = 'ajax';
5312 5312
                     if ($visibility == false) {
5313 5313
                         $class = "ajax invisible";
@@ -5322,34 +5322,34 @@  discard block
 block discarded – undo
5322 5322
                             'style' => 'float: left;'
5323 5323
                         ]
5324 5324
                     )
5325
-                    . $force_download_html . $send_to . $copy_to_myfiles
5326
-                    . $open_in_new_window_link . $pdf_icon;
5325
+                    . $force_download_html.$send_to.$copy_to_myfiles
5326
+                    . $open_in_new_window_link.$pdf_icon;
5327 5327
                 } else {
5328 5328
                     // For PDF Download the file.
5329 5329
                     $pdfPreview = null;
5330 5330
                     if ($ext != 'pdf' && !in_array($ext, $webOdflist)) {
5331
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5331
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5332 5332
                     } else {
5333 5333
                         $pdfPreview = Display::url(
5334 5334
                             Display::return_icon('preview.gif', get_lang('Preview')),
5335
-                            api_get_path(WEB_CODE_PATH).'document/showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'],
5335
+                            api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'],
5336 5336
                             array('style' => 'float:right')
5337 5337
                         );
5338 5338
                     }
5339 5339
                     // No plugin just the old and good showinframes.php page
5340
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" style="float:left" ' . $visibility_class . ' >' . $title . '</a>' .
5341
-                    $pdfPreview.$force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5340
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" style="float:left" '.$visibility_class.' >'.$title.'</a>'.
5341
+                    $pdfPreview.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5342 5342
                 }
5343 5343
             } else {
5344
-                return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . $title . '</a>' .
5345
-                $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5344
+                return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.$title.'</a>'.
5345
+                $force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5346 5346
             }
5347 5347
             // end copy files to users myfiles
5348 5348
         } else {
5349 5349
             // Icon column
5350 5350
             if (preg_match('/shared_folder/', urldecode($checkExtension)) &&
5351 5351
                 preg_match('/shared_folder$/', urldecode($checkExtension)) == false &&
5352
-                preg_match('/shared_folder_session_' . $current_session_id . '$/', urldecode($url)) == false
5352
+                preg_match('/shared_folder_session_'.$current_session_id.'$/', urldecode($url)) == false
5353 5353
             ) {
5354 5354
                 if ($filetype == 'file') {
5355 5355
                     //Sound preview with jplayer
@@ -5374,19 +5374,19 @@  discard block
 block discarded – undo
5374 5374
                             api_get_setting('enable_nanogong') == 'true'
5375 5375
                         )
5376 5376
                     ) {
5377
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5378
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5379
-                        DocumentManager::build_document_icon_tag($filetype, $path) .
5380
-                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5377
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5378
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5379
+                        DocumentManager::build_document_icon_tag($filetype, $path).
5380
+                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5381 5381
                     } else {
5382
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5383
-                        DocumentManager::build_document_icon_tag($filetype, $path) .
5384
-                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5382
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5383
+                        DocumentManager::build_document_icon_tag($filetype, $path).
5384
+                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5385 5385
                     }
5386 5386
                 } else {
5387
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' .
5388
-                    DocumentManager::build_document_icon_tag($filetype, $path) .
5389
-                    Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5387
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.
5388
+                    DocumentManager::build_document_icon_tag($filetype, $path).
5389
+                    Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5390 5390
                 }
5391 5391
             } else {
5392 5392
                 if ($filetype == 'file') {
@@ -5414,16 +5414,16 @@  discard block
 block discarded – undo
5414 5414
                             api_get_setting('enable_nanogong') == 'true'
5415 5415
                         )
5416 5416
                     ) {
5417
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; //without preview
5418
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5419
-                        DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5417
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; //without preview
5418
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5419
+                        DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5420 5420
                     } else {
5421
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5422
-                        DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5421
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5422
+                        DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5423 5423
                     }
5424 5424
                 } else {
5425
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' .
5426
-                    DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5425
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.
5426
+                    DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5427 5427
                 }
5428 5428
             }
5429 5429
         }
@@ -5447,7 +5447,7 @@  discard block
 block discarded – undo
5447 5447
 
5448 5448
             if (preg_match('/_chnano_.wav$/i', $basename)) {
5449 5449
                 $icon = "jplayer_play.png";
5450
-                $basename = 'wav' . ' ' . '(Nanogong)';
5450
+                $basename = 'wav'.' '.'(Nanogong)';
5451 5451
             } else {
5452 5452
                 $basename = substr(strrchr($basename, '.'), 1);
5453 5453
             }
@@ -5463,13 +5463,13 @@  discard block
 block discarded – undo
5463 5463
                 $userinfo = api_get_user_info(substr($basename, 8));
5464 5464
                 $icon = $userinfo['avatar_small'];
5465 5465
 
5466
-                $basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
5466
+                $basename = get_lang('UserFolder').' '.$userinfo['complete_name'];
5467 5467
                 $user_image = true;
5468 5468
             } elseif (strstr($path, 'shared_folder_session_')) {
5469 5469
                 if ($is_allowed_to_edit) {
5470
-                    $basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder');
5470
+                    $basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpUsersFolder');
5471 5471
                 } else {
5472
-                    $basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')';
5472
+                    $basename = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')';
5473 5473
                 }
5474 5474
                 $icon = 'folder_users.gif';
5475 5475
             } else {
@@ -5563,16 +5563,16 @@  discard block
 block discarded – undo
5563 5563
         // Build URL-parameters for table-sorting
5564 5564
         $sort_params = array();
5565 5565
         if (isset($_GET['column'])) {
5566
-            $sort_params[] = 'column=' . Security::remove_XSS($_GET['column']);
5566
+            $sort_params[] = 'column='.Security::remove_XSS($_GET['column']);
5567 5567
         }
5568 5568
         if (isset($_GET['page_nr'])) {
5569
-            $sort_params[] = 'page_nr=' . Security::remove_XSS($_GET['page_nr']);
5569
+            $sort_params[] = 'page_nr='.Security::remove_XSS($_GET['page_nr']);
5570 5570
         }
5571 5571
         if (isset($_GET['per_page'])) {
5572
-            $sort_params[] = 'per_page=' . Security::remove_XSS($_GET['per_page']);
5572
+            $sort_params[] = 'per_page='.Security::remove_XSS($_GET['per_page']);
5573 5573
         }
5574 5574
         if (isset($_GET['direction'])) {
5575
-            $sort_params[] = 'direction=' . Security::remove_XSS($_GET['direction']);
5575
+            $sort_params[] = 'direction='.Security::remove_XSS($_GET['direction']);
5576 5576
         }
5577 5577
         $sort_params = implode('&amp;', $sort_params);
5578 5578
         $visibility_icon = ($visibility == 0) ? 'invisible' : 'visible';
@@ -5585,89 +5585,89 @@  discard block
 block discarded – undo
5585 5585
         if ($is_read_only /* or ($session_id!=api_get_session_id()) */) {
5586 5586
             if (api_is_course_admin() || api_is_platform_admin()) {
5587 5587
                 if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5588
-                    $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5589
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5590
-                } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5591
-                    $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5592
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5588
+                    $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5589
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5590
+                } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5591
+                    $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5592
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5593 5593
                 } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5594
-                    $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5595
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5594
+                    $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5595
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5596 5596
                 } else {
5597
-                    $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id. '">' .
5598
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5597
+                    $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5598
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5599 5599
                 }
5600 5600
             } else {
5601 5601
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
5602 5602
             }
5603
-            $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
5603
+            $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
5604 5604
             if (api_is_allowed_to_edit() || api_is_platform_admin()) {
5605
-                $modify_icons .= '&nbsp;' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL);
5605
+                $modify_icons .= '&nbsp;'.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL);
5606 5606
             }
5607
-            $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
5607
+            $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
5608 5608
         } else {
5609 5609
             //Edit button
5610 5610
             if (in_array($path, DocumentManager::get_system_folders())) {
5611 5611
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
5612
-            } elseif ($is_certificate_mode ) {
5612
+            } elseif ($is_certificate_mode) {
5613 5613
                 // gradebook category doesn't seem to be taken into account
5614
-                $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '&curdirpath=/certificates">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5614
+                $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'&curdirpath=/certificates">'.Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5615 5615
             } else {
5616 5616
                 if (api_get_session_id()) {
5617 5617
                     if ($document_data['session_id'] == api_get_session_id()) {
5618 5618
                         if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5619
-                            $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5620
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5621
-                        } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5622
-                            $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5623
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5619
+                            $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5620
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5621
+                        } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5622
+                            $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5623
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5624 5624
                         } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5625
-                            $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5626
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5625
+                            $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5626
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5627 5627
                         } else {
5628
-                            $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5629
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5628
+                            $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5629
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5630 5630
                         }
5631 5631
                     } else {
5632
-                        $modify_icons .= '&nbsp;' . Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
5632
+                        $modify_icons .= '&nbsp;'.Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
5633 5633
                     }
5634 5634
                 } else {
5635 5635
                     if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5636
-                        $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5637
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5638
-                    } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5639
-                        $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5640
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5636
+                        $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5637
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5638
+                    } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5639
+                        $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5640
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5641 5641
                     } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5642
-                        $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '">' .
5643
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5642
+                        $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5643
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5644 5644
                     } else {
5645
-                        $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5646
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5645
+                        $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5646
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5647 5647
                     }
5648 5648
                 }
5649 5649
             }
5650 5650
 
5651 5651
             // Move button.
5652 5652
             if ($is_certificate_mode || in_array($path, DocumentManager::get_system_folders())) {
5653
-                $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5653
+                $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5654 5654
             } else {
5655 5655
                 if (api_get_session_id()) {
5656 5656
                     if ($document_data['session_id'] == api_get_session_id()) {
5657
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id .  '">' .
5658
-                            Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5657
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;move='.$document_id.'">'.
5658
+                            Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5659 5659
                     } else {
5660
-                        $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5660
+                        $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5661 5661
                     }
5662 5662
                 } else {
5663
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id .  '">' .
5664
-                        Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5663
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;move='.$document_id.'">'.
5664
+                        Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5665 5665
                 }
5666 5666
             }
5667 5667
 
5668 5668
             //Visibility button
5669 5669
             if ($is_certificate_mode) {
5670
-                $modify_icons .= '&nbsp;' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL) . '</a>';
5670
+                $modify_icons .= '&nbsp;'.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL).'</a>';
5671 5671
             } else {
5672 5672
                 if (api_is_allowed_to_edit() || api_is_platform_admin()) {
5673 5673
                     if ($visibility_icon == 'invisible') {
@@ -5675,14 +5675,14 @@  discard block
 block discarded – undo
5675 5675
                     } else {
5676 5676
                         $tip_visibility = get_lang('Hide');
5677 5677
                     }
5678
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;' . $visibility_command . '=' . $id . '&amp;' . $sort_params . '">' .
5679
-                        Display::return_icon($visibility_icon . '.png', $tip_visibility, '', ICON_SIZE_SMALL) . '</a>';
5678
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;'.$visibility_command.'='.$id.'&amp;'.$sort_params.'">'.
5679
+                        Display::return_icon($visibility_icon.'.png', $tip_visibility, '', ICON_SIZE_SMALL).'</a>';
5680 5680
                 }
5681 5681
             }
5682 5682
 
5683 5683
             // Delete button
5684 5684
             if (in_array($path, DocumentManager::get_system_folders())) {
5685
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5685
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5686 5686
             } else {
5687 5687
                 $titleToShow = addslashes(basename($document_data['title']));
5688 5688
 
@@ -5690,23 +5690,23 @@  discard block
 block discarded – undo
5690 5690
                     $_GET['curdirpath'] == '/certificates' &&
5691 5691
                     DocumentManager::get_default_certificate_id(api_get_course_id()) == $id
5692 5692
                 ) {
5693
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;' . $sort_params . 'delete_certificate_id=' . $id . '" onclick="return confirmation(\'' . $titleToShow . '\');">' .
5694
-                        Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5693
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'delete_certificate_id='.$id.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5694
+                        Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5695 5695
                 } else {
5696 5696
                     if ($is_certificate_mode) {
5697
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid=' . $document_id  . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">' .
5698
-                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5697
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5698
+                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5699 5699
                     } else {
5700 5700
                         if (api_get_session_id()) {
5701 5701
                             if ($document_data['session_id'] == api_get_session_id()) {
5702
-                                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id  . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">'.
5703
-                                    Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5702
+                                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5703
+                                    Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5704 5704
                             } else {
5705
-                                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5705
+                                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5706 5706
                             }
5707 5707
                         } else {
5708
-                            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow. '\');">' .
5709
-                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5708
+                            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5709
+                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5710 5710
                         }
5711 5711
                     }
5712 5712
                 }
@@ -5718,15 +5718,15 @@  discard block
 block discarded – undo
5718 5718
                 // nothing to do
5719 5719
             } else {
5720 5720
                 if ($usePpt2lp && $formatType) {
5721
-                    $modify_icons .= '&nbsp;<a class="convertAction" href="#" ' .
5722
-                        'data-documentId = ' . $document_id .
5723
-                        ' data-formatType = ' . $formatType . '>' .
5721
+                    $modify_icons .= '&nbsp;<a class="convertAction" href="#" '.
5722
+                        'data-documentId = '.$document_id.
5723
+                        ' data-formatType = '.$formatType.'>'.
5724 5724
                         Display::return_icon(
5725 5725
                             'convert.png',
5726 5726
                             get_lang('Convert'),
5727 5727
                             array(),
5728 5728
                             ICON_SIZE_SMALL
5729
-                        ) . '</a>';
5729
+                        ).'</a>';
5730 5730
                 }
5731 5731
             }
5732 5732
         }
@@ -5734,8 +5734,8 @@  discard block
 block discarded – undo
5734 5734
         if ($type == 'file' && ($extension == 'html' || $extension == 'htm')) {
5735 5735
             if ($is_template == 0) {
5736 5736
                 if ((isset($_GET['curdirpath']) && $_GET['curdirpath'] != '/certificates') || !isset($_GET['curdirpath'])) {
5737
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;add_as_template=' . $id .  '&amp;' . $sort_params . '">' .
5738
-                        Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL) . '</a>';
5737
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;add_as_template='.$id.'&amp;'.$sort_params.'">'.
5738
+                        Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL).'</a>';
5739 5739
                 }
5740 5740
                 if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course
5741 5741
                     $visibility_icon_certificate = 'nocertificate';
@@ -5749,20 +5749,20 @@  discard block
 block discarded – undo
5749 5749
                         $certificate = get_lang('NoDefaultCertificate');
5750 5750
                     }
5751 5751
                     if (isset($_GET['selectcat'])) {
5752
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;selectcat=' . Security::remove_XSS($_GET['selectcat']) . '&amp;set_certificate=' . $id . '&amp;' . $sort_params . '">
5753
-                    <img src="../img/' . $visibility_icon_certificate . '.png" border="0" title="' . $certificate . '" alt="" /></a>';
5752
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;selectcat='.Security::remove_XSS($_GET['selectcat']).'&amp;set_certificate='.$id.'&amp;'.$sort_params.'">
5753
+                    <img src="../img/' . $visibility_icon_certificate.'.png" border="0" title="'.$certificate.'" alt="" /></a>';
5754 5754
                         if ($is_preview) {
5755
-                            $modify_icons .= '&nbsp;<a target="_blank"  href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;set_preview=' . $id . '&amp;' . $sort_params . '" >' .
5756
-                                Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL) . '</a>';
5755
+                            $modify_icons .= '&nbsp;<a target="_blank"  href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;set_preview='.$id.'&amp;'.$sort_params.'" >'.
5756
+                                Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL).'</a>';
5757 5757
                         }
5758 5758
                     }
5759 5759
                 }
5760 5760
             } else {
5761
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&amp;remove_as_template=' . $id. '&amp;' . $sort_params . '">' .
5762
-                    Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL) . '</a>';
5761
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;remove_as_template='.$id.'&amp;'.$sort_params.'">'.
5762
+                    Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL).'</a>';
5763 5763
             }
5764
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $id . '">' .
5765
-                Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a>';
5764
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$id.'">'.
5765
+                Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a>';
5766 5766
         }
5767 5767
         return $modify_icons;
5768 5768
     }
@@ -5831,7 +5831,7 @@  discard block
 block discarded – undo
5831 5831
                     // 3. inside a subfolder of the folder you want to move
5832 5832
                     if (($curdirpath != $folder) &&
5833 5833
                         ($folder != $move_file) &&
5834
-                        (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/')
5834
+                        (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')
5835 5835
                     ) {
5836 5836
                         $path_displayed = $folder;
5837 5837
                         // If document title is used, we have to display titles instead of real paths...
@@ -5848,7 +5848,7 @@  discard block
 block discarded – undo
5848 5848
             foreach ($folders as $folder) {
5849 5849
                 if (($curdirpath != $folder) &&
5850 5850
                     ($folder != $move_file) &&
5851
-                    (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/')
5851
+                    (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')
5852 5852
                 ) {
5853 5853
                     // Cannot copy dir into his own subdir
5854 5854
                     $path_displayed = DocumentManager::get_titles_of_path($folder);
@@ -5890,10 +5890,10 @@  discard block
 block discarded – undo
5890 5890
                 // If this path has soon been stored here we don't need a new query
5891 5891
                 $path_displayed .= $tmp_folders_titles[$tmp_path];
5892 5892
             } else {
5893
-                $sql = 'SELECT title FROM ' . Database::get_course_table(TABLE_DOCUMENT) . '
5894
-                    WHERE c_id = ' . $course_id . ' AND path LIKE BINARY "' . $tmp_path . '"';
5893
+                $sql = 'SELECT title FROM '.Database::get_course_table(TABLE_DOCUMENT).'
5894
+                    WHERE c_id = ' . $course_id.' AND path LIKE BINARY "'.$tmp_path.'"';
5895 5895
                 $rs = Database::query($sql);
5896
-                $tmp_title = '/' . Database::result($rs, 0, 0);
5896
+                $tmp_title = '/'.Database::result($rs, 0, 0);
5897 5897
                 $path_displayed .= $tmp_title;
5898 5898
                 $tmp_folders_titles[$tmp_path] = $tmp_title;
5899 5899
             }
@@ -5929,7 +5929,7 @@  discard block
 block discarded – undo
5929 5929
         $clean_curdirpath = Security::remove_XSS($curdirpath);
5930 5930
         if ($clean_curdirpath == '/shared_folder') {
5931 5931
             return true;
5932
-        } elseif ($clean_curdirpath == '/shared_folder_session_' . $current_session_id) {
5932
+        } elseif ($clean_curdirpath == '/shared_folder_session_'.$current_session_id) {
5933 5933
             return true;
5934 5934
         } else {
5935 5935
             return false;
@@ -5945,7 +5945,7 @@  discard block
 block discarded – undo
5945 5945
         $clean_path = Security::remove_XSS($path);
5946 5946
         if (strpos($clean_path, 'shared_folder/sf_user_')) {
5947 5947
             return true;
5948
-        } elseif (strpos($clean_path, 'shared_folder_session_' . $current_session_id . '/sf_user_')) {
5948
+        } elseif (strpos($clean_path, 'shared_folder_session_'.$current_session_id.'/sf_user_')) {
5949 5949
             return true;
5950 5950
         } else {
5951 5951
             return false;
@@ -5958,11 +5958,11 @@  discard block
 block discarded – undo
5958 5958
      */
5959 5959
     public static function is_my_shared_folder($user_id, $path, $current_session_id)
5960 5960
     {
5961
-        $clean_path = Security::remove_XSS($path) . '/';
5961
+        $clean_path = Security::remove_XSS($path).'/';
5962 5962
         //for security does not remove the last slash
5963
-        $main_user_shared_folder = '/shared_folder\/sf_user_' . $user_id . '\//';
5963
+        $main_user_shared_folder = '/shared_folder\/sf_user_'.$user_id.'\//';
5964 5964
         //for security does not remove the last slash
5965
-        $main_user_shared_folder_session = '/shared_folder_session_' . $current_session_id . '\/sf_user_' . $user_id . '\//';
5965
+        $main_user_shared_folder_session = '/shared_folder_session_'.$current_session_id.'\/sf_user_'.$user_id.'\//';
5966 5966
 
5967 5967
         if (preg_match($main_user_shared_folder, $clean_path)) {
5968 5968
             return true;
@@ -6234,7 +6234,7 @@  discard block
 block discarded – undo
6234 6234
                 ON (i.c_id = d.c_id)
6235 6235
                 WHERE
6236 6236
                     d.id = i.ref AND
6237
-                    i.tool = '" . TOOL_DOCUMENT . "'
6237
+                    i.tool = '".TOOL_DOCUMENT."'
6238 6238
                     $conditionSession AND
6239 6239
                     i.c_id = {$courseInfo['real_id']} AND
6240 6240
                     d.c_id = {$courseInfo['real_id']} ";
@@ -6242,9 +6242,9 @@  discard block
 block discarded – undo
6242 6242
         $result = Database::query($sql);
6243 6243
         $documents = Database::store_result($result, 'ASSOC');
6244 6244
         if ($documents) {
6245
-            $course_dir = $courseInfo['directory'] . '/document';
6245
+            $course_dir = $courseInfo['directory'].'/document';
6246 6246
             $sys_course_path = api_get_path(SYS_COURSE_PATH);
6247
-            $base_work_dir = $sys_course_path . $course_dir;
6247
+            $base_work_dir = $sys_course_path.$course_dir;
6248 6248
 
6249 6249
             foreach ($documents as $document) {
6250 6250
                 $documentId = $document['id'];
Please login to merge, or discard this patch.
main/work/upload.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 
4
-use ChamiloSession as Session;
5
-
6 4
 /**
7 5
  * Class ExerciseLib
8 6
  * shows a question and its answers
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 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
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 );
234 234
 
235 235
 $multiple_form = '<div class="description-upload">'.get_lang('ClickToSelectOrDragAndDropMultipleFilesOnTheUploadField').'</div>';
236
-$multiple_form .=  '
236
+$multiple_form .= '
237 237
 <span class="btn btn-success fileinput-button">
238 238
     <i class="glyphicon glyphicon-plus"></i>
239 239
     <span>'.get_lang('AddFiles').'</span>
Please login to merge, or discard this patch.
main/work/work.lib.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 
36 36
     if (!empty($id)) {
37 37
         $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'&id='.$my_back_id.'">'.
38
-            Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
38
+            Display::return_icon('back.png', get_lang('BackToWorksList'), '', ICON_SIZE_MEDIUM).'</a>';
39 39
     }
40 40
 
41 41
     if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') {
42 42
         // Create dir
43 43
         if (empty($id)) {
44 44
             $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=create_dir&origin='.$origin.'&gradebook='.$gradebook.'">';
45
-            $display_output .= Display::return_icon('new_work.png', get_lang('CreateAssignment'),'',ICON_SIZE_MEDIUM).'</a>';
45
+            $display_output .= Display::return_icon('new_work.png', get_lang('CreateAssignment'), '', ICON_SIZE_MEDIUM).'</a>';
46 46
         }
47 47
         if (empty($id)) {
48 48
             // Options
49 49
             $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=settings&origin='.$origin.'&gradebook='.$gradebook.'">';
50
-            $display_output .= Display::return_icon('settings.png', get_lang('EditToolOptions'),'',ICON_SIZE_MEDIUM).'</a>';
50
+            $display_output .= Display::return_icon('settings.png', get_lang('EditToolOptions'), '', ICON_SIZE_MEDIUM).'</a>';
51 51
         }
52
-        $display_output .= '<a id="open-view-list" href="#">' . Display::return_icon('listwork.png', get_lang('ViewStudents'),'',ICON_SIZE_MEDIUM) . '</a>';
52
+        $display_output .= '<a id="open-view-list" href="#">'.Display::return_icon('listwork.png', get_lang('ViewStudents'), '', ICON_SIZE_MEDIUM).'</a>';
53 53
 
54 54
     }
55 55
 
56 56
     if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath' && api_is_allowed_to_session_edit(false, true)) {
57 57
         // Delete all files
58
-        if (api_get_setting('permanently_remove_deleted_files') == 'true'){
58
+        if (api_get_setting('permanently_remove_deleted_files') == 'true') {
59 59
             $message = get_lang('ConfirmYourChoiceDeleteAllfiles');
60 60
         } else {
61 61
             $message = get_lang('ConfirmYourChoice');
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function two_digits($number)
114 114
 {
115
-    $number = (int)$number;
115
+    $number = (int) $number;
116 116
     return ($number < 10) ? '0'.$number : $number;
117 117
 }
118 118
 
@@ -547,11 +547,11 @@  discard block
 block discarded – undo
547 547
     );
548 548
 
549 549
     $columnModel = array(
550
-        array('name'=>'type', 'index'=>'type', 'width'=>'30',   'align'=>'center', 'sortable' => 'false'),
551
-        array('name'=>'title', 'index'=>'title', 'width'=>'250',   'align'=>'left'),
552
-        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'80',  'align'=>'center', 'sortable'=>'false'),
553
-        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80',  'align'=>'center'),
554
-        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125',  'align'=>'center'),
550
+        array('name'=>'type', 'index'=>'type', 'width'=>'30', 'align'=>'center', 'sortable' => 'false'),
551
+        array('name'=>'title', 'index'=>'title', 'width'=>'250', 'align'=>'left'),
552
+        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'80', 'align'=>'center', 'sortable'=>'false'),
553
+        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80', 'align'=>'center'),
554
+        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125', 'align'=>'center'),
555 555
     );
556 556
 
557 557
     if ($courseInfo['show_score'] == 0) {
@@ -588,10 +588,10 @@  discard block
 block discarded – undo
588 588
 {
589 589
     $columnModel = array(
590 590
         array('name'=>'type', 'index'=>'type', 'width'=>'35', 'align'=>'center', 'sortable' => 'false'),
591
-        array('name'=>'title', 'index'=>'title',  'width'=>'300',   'align'=>'left', 'wrap_cell' => "true"),
592
-        array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'125',  'align'=>'center'),
593
-        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'125',  'align'=>'center'),
594
-        array('name'=>'amount', 'index'=>'end_on', 'width'=>'110',  'align'=>'center'),
591
+        array('name'=>'title', 'index'=>'title', 'width'=>'300', 'align'=>'left', 'wrap_cell' => "true"),
592
+        array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'125', 'align'=>'center'),
593
+        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'125', 'align'=>'center'),
594
+        array('name'=>'amount', 'index'=>'end_on', 'width'=>'110', 'align'=>'center'),
595 595
         array('name'=>'actions', 'index'=>'actions', 'width'=>'110', 'align'=>'left', 'sortable'=>'false')
596 596
     );
597 597
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
         return false;
794 794
     }
795 795
 
796
-    $base_work_dir = api_get_path(SYS_COURSE_PATH) .$_course['path'].'/work';
796
+    $base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/work';
797 797
     $work_data_url = $base_work_dir.$work_data['url'];
798 798
     $check = Security::check_abs_path($work_data_url.'/', $base_work_dir.'/');
799 799
 
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 function get_work_path($id)
864 864
 {
865 865
     $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
866
-    $course_id  = api_get_course_int_id();
866
+    $course_id = api_get_course_int_id();
867 867
     $sql = 'SELECT url FROM '.$table.'
868 868
             WHERE c_id = '.$course_id.' AND id='.intval($id);
869 869
     $res = Database::query($sql);
@@ -984,9 +984,9 @@  discard block
 block discarded – undo
984 984
     if ($handle = @opendir($directory)) {
985 985
         while (false !== ($file = readdir($handle))) {
986 986
             if ($file != '.' && $file != '..') {
987
-                if (is_dir($directory. '/' . $file)) {
988
-                    $array_items = array_merge($array_items, directory_to_array($directory. '/' . $file));
989
-                    $file = $directory . '/' . $file;
987
+                if (is_dir($directory.'/'.$file)) {
988
+                    $array_items = array_merge($array_items, directory_to_array($directory.'/'.$file));
989
+                    $file = $directory.'/'.$file;
990 990
                     $array_items[] = preg_replace("/\/\//si", '/', $file);
991 991
                 }
992 992
             }
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 
1019 1019
     $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
1020 1020
 
1021
-    for($i = 0; $i < count($only_dir); $i++) {
1021
+    for ($i = 0; $i < count($only_dir); $i++) {
1022 1022
         $url = $only_dir[$i];
1023 1023
 
1024 1024
         $params = [
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
             if (is_dir($path_dir.'/'.$entry)) {
1059 1059
                 $count_dir++;
1060 1060
                 if ($recurse) {
1061
-                    $count += count_dir($path_dir . '/' . $entry, $recurse);
1061
+                    $count += count_dir($path_dir.'/'.$entry, $recurse);
1062 1062
                 }
1063 1063
             } else {
1064 1064
                 $count++;
@@ -1323,11 +1323,11 @@  discard block
 block discarded – undo
1323 1323
         $courseInfo
1324 1324
     );
1325 1325
 
1326
-    if (!in_array($direction, array('asc','desc'))) {
1326
+    if (!in_array($direction, array('asc', 'desc'))) {
1327 1327
         $direction = 'desc';
1328 1328
     }
1329 1329
     if (!empty($where_condition)) {
1330
-        $where_condition = ' AND ' . $where_condition;
1330
+        $where_condition = ' AND '.$where_condition;
1331 1331
     }
1332 1332
 
1333 1333
     $column = !empty($column) ? Database::escape_string($column) : 'sent_date';
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
         $direction = 'desc';
1471 1471
     }
1472 1472
     if (!empty($where_condition)) {
1473
-        $where_condition = ' AND ' . $where_condition;
1473
+        $where_condition = ' AND '.$where_condition;
1474 1474
     }
1475 1475
 
1476 1476
     $column = !empty($column) ? Database::escape_string($column) : 'sent_date';
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
             );
1528 1528
 
1529 1529
             $work['amount'] = Display::label(
1530
-                $countUniqueAttempts . '/' .
1530
+                $countUniqueAttempts.'/'.
1531 1531
                 $totalUsers,
1532 1532
                 'success'
1533 1533
             );
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
                         array(),
1577 1577
                         ICON_SIZE_SMALL
1578 1578
                     ),
1579
-                    api_get_path(WEB_CODE_PATH) . 'work/downloadfolder.inc.php?id=' . $workId . '&' . api_get_cidreq()
1579
+                    api_get_path(WEB_CODE_PATH).'work/downloadfolder.inc.php?id='.$workId.'&'.api_get_cidreq()
1580 1580
                 );
1581 1581
             } else {
1582 1582
                 $downloadLink = Display::url(
@@ -1660,7 +1660,7 @@  discard block
 block discarded – undo
1660 1660
     $userCondition = " AND u.user_id = $studentId ";
1661 1661
     $sessionCondition = " AND w.session_id = $sessionId ";
1662 1662
     $workCondition = " AND w_rel.work_id = $workId";
1663
-    $workParentCondition  = " AND w.parent_id = $workId";
1663
+    $workParentCondition = " AND w.parent_id = $workId";
1664 1664
 
1665 1665
     $sql = "(
1666 1666
                 $select1 FROM $userTable u
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
         }
1769 1769
 
1770 1770
         if ($allowEdition && !empty($itemId)) {
1771
-            $deleteLink  = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId);
1771
+            $deleteLink = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId);
1772 1772
         } else {
1773 1773
             $deleteLink = null;
1774 1774
         }
@@ -1849,7 +1849,7 @@  discard block
 block discarded – undo
1849 1849
     $start = intval($start);
1850 1850
     $limit = intval($limit);
1851 1851
 
1852
-    if (!in_array($direction, array('asc','desc'))) {
1852
+    if (!in_array($direction, array('asc', 'desc'))) {
1853 1853
         $direction = 'desc';
1854 1854
     }
1855 1855
 
@@ -1917,13 +1917,13 @@  discard block
 block discarded – undo
1917 1917
         $work_assignment = get_work_assignment_by_id($work_id);
1918 1918
 
1919 1919
         if (!empty($studentId)) {
1920
-            $where_condition.= " AND u.user_id = ".intval($studentId);
1920
+            $where_condition .= " AND u.user_id = ".intval($studentId);
1921 1921
         }
1922 1922
 
1923 1923
         $sql = " $select
1924 1924
                 FROM $work_condition  $user_condition
1925 1925
                 WHERE $extra_conditions $where_condition $condition_session
1926
-                    AND u.status != " . INVITEE . "
1926
+                    AND u.status != ".INVITEE."
1927 1927
                 ORDER BY $column $direction";
1928 1928
 
1929 1929
         if (!empty($start) && !empty($limit)) {
@@ -1980,7 +1980,7 @@  discard block
 block discarded – undo
1980 1980
                     $qualification_string = Display::label('-');
1981 1981
                 } else {
1982 1982
                     $label = 'info';
1983
-                    $relativeScore = $work['qualification']/$work_data['qualification'];
1983
+                    $relativeScore = $work['qualification'] / $work_data['qualification'];
1984 1984
                     if ($relativeScore < 0.5) {
1985 1985
                         $label = 'important';
1986 1986
                     } elseif ($relativeScore < 0.75) {
@@ -2036,10 +2036,10 @@  discard block
 block discarded – undo
2036 2036
                 // If URL is present then there's a file to download keep BC.
2037 2037
                 if ($work['contains_file'] || !empty($work['url'])) {
2038 2038
                     $link_to_download = '<a href="'.$url.'download.php?id='.$item_id.'&'.api_get_cidreq().'">'.
2039
-                        Display::return_icon('save.png', get_lang('Save'),array(), ICON_SIZE_SMALL).'</a> ';
2039
+                        Display::return_icon('save.png', get_lang('Save'), array(), ICON_SIZE_SMALL).'</a> ';
2040 2040
                 }
2041 2041
 
2042
-                $send_to = Portfolio::share('work', $work['id'],  array('style' => 'white-space:nowrap;'));
2042
+                $send_to = Portfolio::share('work', $work['id'], array('style' => 'white-space:nowrap;'));
2043 2043
 
2044 2044
                 $feedback = null;
2045 2045
                 $count = getWorkCommentCount($item_id, $course_info);
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
                 $work_date = api_convert_and_format_date($work['sent_date']);
2059 2059
 
2060 2060
                 $work['sent_date_from_db'] = $work['sent_date'];
2061
-                $work['sent_date'] = '<div class="date-time">' . date_to_str_ago(api_get_local_time($work['sent_date'])) . ' ' . $add_string . ' ' . $work_date . '</div>';
2061
+                $work['sent_date'] = '<div class="date-time">'.date_to_str_ago(api_get_local_time($work['sent_date'])).' '.$add_string.' '.$work_date.'</div>';
2062 2062
 
2063 2063
                 // Actions.
2064 2064
                 $correction = '';
@@ -2076,8 +2076,8 @@  discard block
 block discarded – undo
2076 2076
                         Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a> ';
2077 2077
 
2078 2078
                     if ($unoconv && empty($work['contains_file'])) {
2079
-                        $action .=  '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'" title="'.get_lang('ExportToDoc').'" >'.
2080
-                            Display::return_icon('export_doc.png', get_lang('ExportToDoc'),array(), ICON_SIZE_SMALL).'</a> ';
2079
+                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'" title="'.get_lang('ExportToDoc').'" >'.
2080
+                            Display::return_icon('export_doc.png', get_lang('ExportToDoc'), array(), ICON_SIZE_SMALL).'</a> ';
2081 2081
                     }
2082 2082
 
2083 2083
                     $correction = '
@@ -2120,9 +2120,9 @@  discard block
 block discarded – undo
2120 2120
 
2121 2121
                     if ($locked) {
2122 2122
                         if ($qualification_exists) {
2123
-                            $action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'),array(), ICON_SIZE_SMALL);
2123
+                            $action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'), array(), ICON_SIZE_SMALL);
2124 2124
                         } else {
2125
-                            $action .= Display::return_icon('edit_na.png', get_lang('Comment'),array(), ICON_SIZE_SMALL);
2125
+                            $action .= Display::return_icon('edit_na.png', get_lang('Comment'), array(), ICON_SIZE_SMALL);
2126 2126
                         }
2127 2127
                     } else {
2128 2128
                         if ($qualification_exists) {
@@ -2136,45 +2136,45 @@  discard block
 block discarded – undo
2136 2136
 
2137 2137
                     if ($work['contains_file']) {
2138 2138
                         if ($locked) {
2139
-                            $action .= Display::return_icon('move_na.png', get_lang('Move'),array(), ICON_SIZE_SMALL);
2139
+                            $action .= Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
2140 2140
                         } else {
2141 2141
                             $action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=move&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Move').'">'.
2142
-                                Display::return_icon('move.png', get_lang('Move'),array(), ICON_SIZE_SMALL).'</a>';
2142
+                                Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
2143 2143
                         }
2144 2144
                     }
2145 2145
 
2146 2146
                     if ($work['accepted'] == '1') {
2147 2147
                         $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_invisible&item_id='.$item_id.'" title="'.get_lang('Invisible').'" >'.
2148
-                            Display::return_icon('visible.png', get_lang('Invisible'),array(), ICON_SIZE_SMALL).'</a>';
2148
+                            Display::return_icon('visible.png', get_lang('Invisible'), array(), ICON_SIZE_SMALL).'</a>';
2149 2149
                     } else {
2150 2150
                         $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_visible&item_id='.$item_id.'" title="'.get_lang('Visible').'" >'.
2151
-                            Display::return_icon('invisible.png', get_lang('Visible'),array(), ICON_SIZE_SMALL).'</a> ';
2151
+                            Display::return_icon('invisible.png', get_lang('Visible'), array(), ICON_SIZE_SMALL).'</a> ';
2152 2152
                     }
2153 2153
 
2154 2154
                     if ($locked) {
2155 2155
                         $action .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
2156 2156
                     } else {
2157
-                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
2158
-                            Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
2157
+                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
2158
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
2159 2159
                     }
2160 2160
                 } elseif ($is_author && (empty($work['qualificator_id']) || $work['qualificator_id'] == 0)) {
2161 2161
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
2162
-                        Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a>';
2162
+                        Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
2163 2163
 
2164 2164
                     if (api_get_course_setting('student_delete_own_publication') == 1) {
2165 2165
                         if (api_is_allowed_to_session_edit(false, true)) {
2166 2166
                             $action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
2167
-                                Display::return_icon('edit.png', get_lang('Comment'),array(), ICON_SIZE_SMALL).'</a>';
2167
+                                Display::return_icon('edit.png', get_lang('Comment'), array(), ICON_SIZE_SMALL).'</a>';
2168 2168
                         }
2169
-                        $action .= ' <a href="'.$url.'work_list.php?'.api_get_cidreq().'&action=delete&item_id='.$item_id.'&id='.$work['parent_id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'"  >'.
2170
-                            Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
2169
+                        $action .= ' <a href="'.$url.'work_list.php?'.api_get_cidreq().'&action=delete&item_id='.$item_id.'&id='.$work['parent_id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'"  >'.
2170
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
2171 2171
                     } else {
2172
-                        $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
2172
+                        $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
2173 2173
                     }
2174 2174
                 } else {
2175 2175
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
2176
-                        Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a>';
2177
-                    $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
2176
+                        Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
2177
+                    $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
2178 2178
                 }
2179 2179
 
2180 2180
                 // Status.
@@ -2207,7 +2207,7 @@  discard block
 block discarded – undo
2207 2207
     $_course = api_get_course_info();
2208 2208
     $task_id = $task_data['id'];
2209 2209
     $task_title = !empty($task_data['title']) ? $task_data['title'] : basename($task_data['url']);
2210
-    $subject = '[' . api_get_setting('siteName') . '] ';
2210
+    $subject = '['.api_get_setting('siteName').'] ';
2211 2211
 
2212 2212
     // The body can be as long as you wish, and any combination of text and variables
2213 2213
     $content = get_lang('ReminderToSubmitPendingTask')."\n".get_lang('CourseName').' : '.$_course['name']."\n";
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
     $mails_sent_to = array();
2219 2219
     foreach ($list_users as $user) {
2220 2220
         $name_user = api_get_person_name($user[1], $user[0], null, PERSON_NAME_EMAIL_ADDRESS);
2221
-        $dear_line = get_lang('Dear')." ".api_get_person_name($user[1], $user[0]) .", \n\n";
2221
+        $dear_line = get_lang('Dear')." ".api_get_person_name($user[1], $user[0]).", \n\n";
2222 2222
         $body      = $dear_line.$content;
2223 2223
         MessageManager::send_message($user[3], $subject, $body);
2224 2224
         $mails_sent_to[] = $name_user;
@@ -2247,22 +2247,22 @@  discard block
 block discarded – undo
2247 2247
     } else {
2248 2248
         $students = CourseManager::get_student_list_from_course_code($courseCode, true, $sessionId);
2249 2249
     }
2250
-    $emailsubject = '[' . api_get_setting('siteName') . '] '.get_lang('HomeworkCreated');
2250
+    $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('HomeworkCreated');
2251 2251
     $currentUser = api_get_user_info(api_get_user_id());
2252 2252
     if (!empty($students)) {
2253
-        foreach($students as $student) {
2253
+        foreach ($students as $student) {
2254 2254
             $user_info = api_get_user_info($student["user_id"]);
2255
-            if(!empty($user_info["mail"])) {
2255
+            if (!empty($user_info["mail"])) {
2256 2256
                 $name_user = api_get_person_name(
2257 2257
                     $user_info["firstname"],
2258 2258
                     $user_info["lastname"],
2259 2259
                     null,
2260 2260
                     PERSON_NAME_EMAIL_ADDRESS
2261 2261
                 );
2262
-                $link = api_get_path(WEB_CODE_PATH) . 'work/work_list_all.php?' . api_get_cidreq() . '&id=' . $workId;
2262
+                $link = api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId;
2263 2263
                 $emailbody = get_lang('Dear')." ".$name_user.",\n\n";
2264 2264
                 $emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse')." ".$courseCode.". "."\n\n".
2265
-                    '<a href="'. $link . '">' . get_lang('PleaseCheckHomeworkPage') . '</a>';
2265
+                    '<a href="'.$link.'">'.get_lang('PleaseCheckHomeworkPage').'</a>';
2266 2266
                 $emailbody .= "\n\n".api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);
2267 2267
 
2268 2268
                 $additionalParameters = array(
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
     $url = Database::escape_string($url);
2305 2305
     $sql = "SELECT id FROM $work_table WHERE url='$url'";
2306 2306
     $result = Database::query($sql);
2307
-    if (Database::num_rows($result)> 0) {
2307
+    if (Database::num_rows($result) > 0) {
2308 2308
         $row = Database::fetch_row($result);
2309 2309
         if (empty($row)) {
2310 2310
             return false;
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 {
2327 2327
     $output = '<select name="'.$name.'" id="'.$name.'">';
2328 2328
     foreach ($values as $key => $value) {
2329
-        $output .= '<option value="'.$key.'" '.(($checked==$key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2329
+        $output .= '<option value="'.$key.'" '.(($checked == $key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2330 2330
     }
2331 2331
     $output .= '</select>';
2332 2332
     return $output;
@@ -2340,9 +2340,9 @@  discard block
 block discarded – undo
2340 2340
  */
2341 2341
 function make_checkbox($name, $checked = '', $label = null)
2342 2342
 {
2343
-    $check = '<input id ="'.$name.'" type="checkbox" value="1" name="'.$name.'" '.((!empty($checked))?'checked="checked"':'').'/>';
2343
+    $check = '<input id ="'.$name.'" type="checkbox" value="1" name="'.$name.'" '.((!empty($checked)) ? 'checked="checked"' : '').'/>';
2344 2344
     if (!empty($label)) {
2345
-        $check .="<label for ='$name'>$label</label>";
2345
+        $check .= "<label for ='$name'>$label</label>";
2346 2346
     }
2347 2347
     return $check;
2348 2348
 }
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
     }
2497 2497
 
2498 2498
     if (!empty($studentId)) {
2499
-        $sql_users.= " AND u.user_id = ".intval($studentId);
2499
+        $sql_users .= " AND u.user_id = ".intval($studentId);
2500 2500
     }
2501 2501
 
2502 2502
     $group_id = api_get_group_id();
@@ -2506,7 +2506,7 @@  discard block
 block discarded – undo
2506 2506
     if ($group_id) {
2507 2507
         $group_user_list = GroupManager::get_subscribed_users($group_id);
2508 2508
         if (!empty($group_user_list)) {
2509
-            foreach($group_user_list as $group_user) {
2509
+            foreach ($group_user_list as $group_user) {
2510 2510
                 $new_group_user_list[] = $group_user['user_id'];
2511 2511
             }
2512 2512
         }
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
 function getWorkComments($work)
2928 2928
 {
2929 2929
     $commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT);
2930
-    $userTable= Database::get_main_table(TABLE_MAIN_USER);
2930
+    $userTable = Database::get_main_table(TABLE_MAIN_USER);
2931 2931
 
2932 2932
     $courseId = intval($work['c_id']);
2933 2933
     $workId = intval($work['id']);
@@ -3610,7 +3610,7 @@  discard block
 block discarded – undo
3610 3610
             null,
3611 3611
             PERSON_NAME_EMAIL_ADDRESS
3612 3612
         );
3613
-        $subject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']."  ";
3613
+        $subject = "[".api_get_setting('siteName')."] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']."  ";
3614 3614
         foreach ($user_list as $user_data) {
3615 3615
             $to_user_id = $user_data['user_id'];
3616 3616
             $user_info = api_get_user_info($to_user_id);
@@ -3659,7 +3659,7 @@  discard block
 block discarded – undo
3659 3659
 
3660 3660
     $title = $values['title'];
3661 3661
     $description = $values['description'];
3662
-    $contains_file = isset($values['contains_file']) && !empty($values['contains_file']) ? intval($values['contains_file']): 0;
3662
+    $contains_file = isset($values['contains_file']) && !empty($values['contains_file']) ? intval($values['contains_file']) : 0;
3663 3663
 
3664 3664
     $saveWork = true;
3665 3665
     $message = null;
@@ -4026,8 +4026,8 @@  discard block
 block discarded – undo
4026 4026
                     LINK_STUDENTPUBLICATION,
4027 4027
                     $workId,
4028 4028
                     $params['new_dir'],
4029
-                    (float)$params['weight'],
4030
-                    (float)$params['qualification'],
4029
+                    (float) $params['weight'],
4030
+                    (float) $params['qualification'],
4031 4031
                     $params['description'],
4032 4032
                     1,
4033 4033
                     api_get_session_id()
@@ -4287,15 +4287,15 @@  discard block
 block discarded – undo
4287 4287
     // changing the tool setting: is a student allowed to delete his/her own document
4288 4288
 
4289 4289
     // counting the number of occurrences of this setting (if 0 => add, if 1 => update)
4290
-    $query = "SELECT * FROM " . $table_course_setting . "
4290
+    $query = "SELECT * FROM ".$table_course_setting."
4291 4291
               WHERE c_id = $courseId AND variable = 'student_delete_own_publication'";
4292 4292
 
4293 4293
     $result = Database::query($query);
4294 4294
     $number_of_setting = Database::num_rows($result);
4295 4295
 
4296 4296
     if ($number_of_setting == 1) {
4297
-        $query = "UPDATE " . $table_course_setting . " SET
4298
-                  value='" . Database::escape_string($studentDeleteOwnPublication) . "'
4297
+        $query = "UPDATE ".$table_course_setting." SET
4298
+                  value='" . Database::escape_string($studentDeleteOwnPublication)."'
4299 4299
                   WHERE variable = 'student_delete_own_publication' AND c_id = $courseId";
4300 4300
         Database::query($query);
4301 4301
     } else {
@@ -4334,9 +4334,9 @@  discard block
 block discarded – undo
4334 4334
     $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
4335 4335
     $item_id = intval($item_id);
4336 4336
     $course_id = $course_info['real_id'];
4337
-    $sql = "UPDATE  " . $work_table . "
4337
+    $sql = "UPDATE  ".$work_table."
4338 4338
             SET accepted = 0
4339
-            WHERE c_id = $course_id AND id = '" . $item_id . "'";
4339
+            WHERE c_id = $course_id AND id = '".$item_id."'";
4340 4340
     Database::query($sql);
4341 4341
     api_item_property_update(
4342 4342
         $course_info,
@@ -4480,7 +4480,7 @@  discard block
 block discarded – undo
4480 4480
                 $courseCode,
4481 4481
                 $sessionId,
4482 4482
                 $limitString,
4483
-                $orderBy ,
4483
+                $orderBy,
4484 4484
                 STUDENT,
4485 4485
                 $getCount
4486 4486
             );
@@ -4817,8 +4817,8 @@  discard block
 block discarded – undo
4817 4817
     if (!empty($sessionId)) {
4818 4818
         $sessionInfo = api_get_session_info($sessionId);
4819 4819
         if (!empty($sessionInfo)) {
4820
-            $header .= ' - ' . $sessionInfo['name'];
4821
-            $header .= '<br />' . $sessionInfo['description'];
4820
+            $header .= ' - '.$sessionInfo['name'];
4821
+            $header .= '<br />'.$sessionInfo['description'];
4822 4822
             $teachers = SessionManager::getCoachesByCourseSessionToString(
4823 4823
                 $sessionId,
4824 4824
                 $courseInfo['real_id']
@@ -4834,12 +4834,12 @@  discard block
 block discarded – undo
4834 4834
     $expiresOn = null;
4835 4835
 
4836 4836
     if (!empty($assignment) && isset($assignment['expires_on'])) {
4837
-        $content .= '<br /><strong>' . get_lang('ExpirationDate') . '</strong>: ' . api_get_local_time($assignment['expires_on']);
4837
+        $content .= '<br /><strong>'.get_lang('ExpirationDate').'</strong>: '.api_get_local_time($assignment['expires_on']);
4838 4838
         $expiresOn = api_get_local_time($assignment['expires_on']);
4839 4839
     }
4840 4840
 
4841 4841
     if (!empty($workData['description'])) {
4842
-        $content .= '<br /><strong>' . get_lang('Description') . '</strong>: ' . $workData['description'];
4842
+        $content .= '<br /><strong>'.get_lang('Description').'</strong>: '.$workData['description'];
4843 4843
     }
4844 4844
 
4845 4845
     $workList = get_work_user_list(null, null, null, null, $workId);
@@ -4860,7 +4860,7 @@  discard block
 block discarded – undo
4860 4860
                 );
4861 4861
 
4862 4862
                 $column = 0;
4863
-                foreach($headers as $header) {
4863
+                foreach ($headers as $header) {
4864 4864
                     $table->setHeaderContents(0, $column, $header);
4865 4865
                     $column++;
4866 4866
                 }
@@ -4908,7 +4908,7 @@  discard block
 block discarded – undo
4908 4908
 
4909 4909
                 if (!empty($content)) {
4910 4910
                     $params = array(
4911
-                        'filename' => $workData['title'] . '_' . api_get_local_time(),
4911
+                        'filename' => $workData['title'].'_'.api_get_local_time(),
4912 4912
                         'pdf_title' => api_replace_dangerous_char($workData['title']),
4913 4913
                         'course_code' => $courseInfo['code'],
4914 4914
                         'add_signatures' => false
@@ -4939,7 +4939,7 @@  discard block
 block discarded – undo
4939 4939
     $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip";
4940 4940
     $coursePath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/work/';
4941 4941
 
4942
-    $zip  = new PclZip($tempZipFile);
4942
+    $zip = new PclZip($tempZipFile);
4943 4943
 
4944 4944
     $workPerUser = getWorkPerUser($userId);
4945 4945
 
Please login to merge, or discard this patch.
main/forum/forumfunction.inc.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1316,16 +1316,16 @@
 block discarded – undo
1316 1316
     }
1317 1317
 }
1318 1318
 /**
1319
- * Retrieve all the information off the forum categories (or one specific) for the current course.
1320
- * The categories are sorted according to their sorting order (cat_order
1321
- *
1322
- * @param int $id default ''. When an id is passed we only find the information
1323
- * about that specific forum category. If no id is passed we get all the forum categories.
1324
- * @return array containing all the information about all the forum categories
1325
- *
1326
- * @author Patrick Cool <[email protected]>, Ghent University
1327
- * @version february 2006, dokeos 1.8
1328
- */
1319
+     * Retrieve all the information off the forum categories (or one specific) for the current course.
1320
+     * The categories are sorted according to their sorting order (cat_order
1321
+     *
1322
+     * @param int $id default ''. When an id is passed we only find the information
1323
+     * about that specific forum category. If no id is passed we get all the forum categories.
1324
+     * @return array containing all the information about all the forum categories
1325
+     *
1326
+     * @author Patrick Cool <[email protected]>, Ghent University
1327
+     * @version february 2006, dokeos 1.8
1328
+     */
1329 1329
 function get_forum_categories($id = '')
1330 1330
 {
1331 1331
     $table_categories = Database :: get_course_table(TABLE_FORUM_CATEGORY);
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                     file.delete + '<\/td>' +
70 70
                     '<input type=\"hidden\" value=\"' + file.id +'\" name=\"file_ids[]\">' + '<\/tr>');
71 71
             } else {
72
-                alert('" . get_lang('UploadError') . "');
72
+                alert('" . get_lang('UploadError')."');
73 73
             }
74 74
         }
75 75
     });
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
             var l = $(this);
90 90
             var id = l.closest("tr").attr("id");
91 91
             var filename = l.closest("tr").find(".attachFilename").html();
92
-            if (confirm("' . get_lang('AreYouSureToDeleteJS') . '", filename)) {
92
+            if (confirm("' . get_lang('AreYouSureToDeleteJS').'", filename)) {
93 93
                 $.ajax({
94 94
                     type: "POST",
95
-                    url: "'.api_get_path(WEB_AJAX_PATH) . 'forum.ajax.php?'.api_get_cidreq().'&a=delete_file&attachId=" + id +"&thread='.$threadId .'&forum='.$forumId .'",
95
+                    url: "'.api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq().'&a=delete_file&attachId=" + id +"&thread='.$threadId.'&forum='.$forumId.'",
96 96
                     dataType: "json",
97 97
                     success: function(data) {
98 98
                         if (data.error == false) {
@@ -991,24 +991,24 @@  discard block
 block discarded – undo
991 991
     $html = '';
992 992
     $id = Security::remove_XSS($id);
993 993
     if ($current_visibility_status == '1') {
994
-        $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&';
994
+        $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
995 995
         if (is_array($additional_url_parameters)) {
996 996
             foreach ($additional_url_parameters as $key => $value) {
997
-                $html .= $key . '=' . $value . '&';
997
+                $html .= $key.'='.$value.'&';
998 998
             }
999 999
         }
1000
-        $html.='action=invisible&content='.$content.'&id='.$id.'">'.
1000
+        $html .= 'action=invisible&content='.$content.'&id='.$id.'">'.
1001 1001
             Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_SMALL).'</a>';
1002 1002
     }
1003 1003
     if ($current_visibility_status == '0') {
1004
-        $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&';
1004
+        $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
1005 1005
         if (is_array($additional_url_parameters)) {
1006 1006
             foreach ($additional_url_parameters as $key => $value) {
1007
-                $html .= $key . '=' . $value . '&';
1007
+                $html .= $key.'='.$value.'&';
1008 1008
             }
1009 1009
         }
1010
-        $html .= 'action=visible&content=' . $content . '&id=' . $id . '">' .
1011
-            Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL) . '</a>';
1010
+        $html .= 'action=visible&content='.$content.'&id='.$id.'">'.
1011
+            Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL).'</a>';
1012 1012
     }
1013 1013
     return $html;
1014 1014
 }
@@ -1029,21 +1029,21 @@  discard block
 block discarded – undo
1029 1029
         $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
1030 1030
         if (is_array($additional_url_parameters)) {
1031 1031
             foreach ($additional_url_parameters as $key => $value) {
1032
-                $html .= $key . '=' . $value . '&';
1032
+                $html .= $key.'='.$value.'&';
1033 1033
             }
1034 1034
         }
1035
-        $html.= 'action=unlock&content='.$content.'&id='.$id.'">'.
1035
+        $html .= 'action=unlock&content='.$content.'&id='.$id.'">'.
1036 1036
             Display::return_icon('lock.png', get_lang('Unlock'), array(), ICON_SIZE_SMALL).'</a>';
1037 1037
     }
1038 1038
     if ($current_lock_status == '0') {
1039 1039
         $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
1040 1040
         if (is_array($additional_url_parameters)) {
1041 1041
             foreach ($additional_url_parameters as $key => $value) {
1042
-                $html .= $key . '=' . $value . '&';
1042
+                $html .= $key.'='.$value.'&';
1043 1043
             }
1044 1044
         }
1045
-        $html .= 'action=lock&content=' . $content . '&id=' . $id . '">' .
1046
-            Display::return_icon('unlock.png', get_lang('Lock'), array(), ICON_SIZE_SMALL) . '</a>';
1045
+        $html .= 'action=lock&content='.$content.'&id='.$id.'">'.
1046
+            Display::return_icon('unlock.png', get_lang('Lock'), array(), ICON_SIZE_SMALL).'</a>';
1047 1047
     }
1048 1048
     return $html;
1049 1049
 }
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
                     forum_categories.c_id = $course_id AND
1247 1247
                     item_properties.c_id = $course_id AND
1248 1248
                     forum_categories.cat_id=item_properties.ref AND
1249
-                    item_properties.tool='" . TOOL_FORUM_CATEGORY . "'
1249
+                    item_properties.tool='".TOOL_FORUM_CATEGORY."'
1250 1250
                 ORDER BY forum_categories.cat_order $sort_direction";
1251 1251
     }
1252 1252
     if ($content == 'forum') {
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
             FROM $table
1255 1255
             WHERE
1256 1256
                 c_id = $course_id AND
1257
-                forum_category='" . Database::escape_string($forum_category) . "'
1257
+                forum_category='".Database::escape_string($forum_category)."'
1258 1258
             ORDER BY forum_order $sort_direction";
1259 1259
     }
1260 1260
     // Finding the items that need to be switched.
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 {
1312 1312
     $current_visibility_status = intval($current_visibility_status);
1313 1313
     if ($current_visibility_status == 0) {
1314
-        $status='invisible';
1314
+        $status = 'invisible';
1315 1315
         return $status;
1316 1316
     }
1317 1317
 }
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 {
2212 2212
     $table_forums = Database :: get_course_table(TABLE_FORUM);
2213 2213
     $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
2214
-    $courseId = empty($courseId) ? api_get_course_int_id(): intval($courseId);
2214
+    $courseId = empty($courseId) ? api_get_course_int_id() : intval($courseId);
2215 2215
     $forum_id = intval($forum_id);
2216 2216
 
2217 2217
     $sql = "SELECT *
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
  */
2371 2371
 function store_thread($current_forum, $values, $courseInfo = array(), $showMessage = true)
2372 2372
 {
2373
-    $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo ;
2373
+    $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo;
2374 2374
     $_user = api_get_user_info();
2375 2375
     $course_id = $courseInfo['real_id'];
2376 2376
     $courseCode = $courseInfo['code'];
@@ -2614,11 +2614,11 @@  discard block
 block discarded – undo
2614 2614
     $form = new FormValidator(
2615 2615
         'thread',
2616 2616
         'post',
2617
-        api_get_self() . '?' . http_build_query([
2617
+        api_get_self().'?'.http_build_query([
2618 2618
             'forum' => $myForum,
2619 2619
             'gradebook' => $myGradebook,
2620 2620
             'thread' => $myThread,
2621
-        ]) . '&' . api_get_cidreq()
2621
+        ]).'&'.api_get_cidreq()
2622 2622
     );
2623 2623
 
2624 2624
     $form->addElement('header', get_lang('EditThread'));
@@ -2683,7 +2683,7 @@  discard block
 block discarded – undo
2683 2683
     $form->addElement('html', '</div>');
2684 2684
 
2685 2685
     if (!empty($formValues)) {
2686
-        $defaults['thread_qualify_gradebook'] = ($formValues['threadQualifyMax'] > 0 && empty($_POST)) ? 1 : 0 ;
2686
+        $defaults['thread_qualify_gradebook'] = ($formValues['threadQualifyMax'] > 0 && empty($_POST)) ? 1 : 0;
2687 2687
         $defaults['thread_title'] = prepare4display($formValues['threadTitle']);
2688 2688
         $defaults['thread_sticky'] = strval(intval($formValues['threadSticky']));
2689 2689
         $defaults['thread_peer_qualify'] = intval($formValues['threadPeerQualify']);
@@ -2755,13 +2755,13 @@  discard block
 block discarded – undo
2755 2755
     $form = new FormValidator(
2756 2756
         'thread',
2757 2757
         'post',
2758
-        api_get_self() . '?' . http_build_query([
2758
+        api_get_self().'?'.http_build_query([
2759 2759
             'forum' => intval($my_forum),
2760 2760
             'gradebook' => $my_gradebook,
2761 2761
             'thread' => intval($myThread),
2762 2762
             'post' => intval($my_post),
2763 2763
             'action' => $action,
2764
-        ]) . '&' . api_get_cidreq()
2764
+        ]).'&'.api_get_cidreq()
2765 2765
     );
2766 2766
     $form->setConstants(array('forum' => '5'));
2767 2767
 
@@ -3024,7 +3024,7 @@  discard block
 block discarded – undo
3024 3024
 
3025 3025
             if ($row[0] == 0) {
3026 3026
                 $sql = "INSERT INTO $table_threads_qualify (c_id, user_id, thread_id,qualify,qualify_user_id,qualify_time,session_id)
3027
-                        VALUES (".$course_id.", '".$user_id."','".$thread_id."',".(float)$thread_qualify.", '".$currentUserId."','".$qualify_time."','".$session_id."')";
3027
+                        VALUES (".$course_id.", '".$user_id."','".$thread_id."',".(float) $thread_qualify.", '".$currentUserId."','".$qualify_time."','".$session_id."')";
3028 3028
                 Database::query($sql);
3029 3029
 
3030 3030
                 $insertId = Database::insert_id();
@@ -4627,9 +4627,9 @@  discard block
 block discarded – undo
4627 4627
             continue;
4628 4628
         }
4629 4629
 
4630
-        $course_dir = $_course['path'] . '/upload/forum';
4630
+        $course_dir = $_course['path'].'/upload/forum';
4631 4631
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
4632
-        $updir = $sys_course_path . $course_dir;
4632
+        $updir = $sys_course_path.$course_dir;
4633 4633
 
4634 4634
         // Try to add an extension to the file if it hasn't one.
4635 4635
         $new_file_name = add_ext_on_mime(
@@ -4646,7 +4646,7 @@  discard block
 block discarded – undo
4646 4646
         }
4647 4647
 
4648 4648
         $new_file_name = uniqid('');
4649
-        $new_path = $updir . '/' . $new_file_name;
4649
+        $new_path = $updir.'/'.$new_file_name;
4650 4650
         $result = @move_uploaded_file($attachment['tmp_name'], $new_path);
4651 4651
         $safe_file_comment = Database::escape_string($file_comment);
4652 4652
         $safe_file_name = Database::escape_string($file_name);
@@ -4811,16 +4811,16 @@  discard block
 block discarded – undo
4811 4811
     $forum_table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
4812 4812
     $course_id = api_get_course_int_id();
4813 4813
 
4814
-    $cond = (!empty($id_attach)) ? " iid = " . (int) $id_attach . "" : " post_id = " . (int) $post_id . "";
4814
+    $cond = (!empty($id_attach)) ? " iid = ".(int) $id_attach."" : " post_id = ".(int) $post_id."";
4815 4815
     $sql = "SELECT path FROM $forum_table_attachment WHERE c_id = $course_id AND $cond";
4816 4816
     $res = Database::query($sql);
4817 4817
     $row = Database::fetch_array($res);
4818 4818
 
4819
-    $course_dir = $_course['path'] . '/upload/forum';
4819
+    $course_dir = $_course['path'].'/upload/forum';
4820 4820
     $sys_course_path = api_get_path(SYS_COURSE_PATH);
4821
-    $updir = $sys_course_path . $course_dir;
4821
+    $updir = $sys_course_path.$course_dir;
4822 4822
     $my_path = isset($row['path']) ? $row['path'] : null;
4823
-    $file = $updir . '/' . $my_path;
4823
+    $file = $updir.'/'.$my_path;
4824 4824
     if (Security::check_abs_path($file, $updir)) {
4825 4825
         @unlink($file);
4826 4826
     }
@@ -5368,35 +5368,35 @@  discard block
 block discarded – undo
5368 5368
                         $post_list = get_thread_user_post_limit($course_code, $thread['thread_id'], $user_id, 1);
5369 5369
                         $post_counter = count($post_list);
5370 5370
                         if (is_array($post_list) && count($post_list) > 0) {
5371
-                            $hand_forums.= '<div id="social-thread">';
5372
-                            $hand_forums.= Display::return_icon('thread.png', get_lang('Thread'), '', ICON_SIZE_MEDIUM);
5373
-                            $hand_forums.= '&nbsp;'.Security::remove_XSS($thread['thread_title'], STUDENT);
5374
-                            $hand_forums.= '</div>';
5371
+                            $hand_forums .= '<div id="social-thread">';
5372
+                            $hand_forums .= Display::return_icon('thread.png', get_lang('Thread'), '', ICON_SIZE_MEDIUM);
5373
+                            $hand_forums .= '&nbsp;'.Security::remove_XSS($thread['thread_title'], STUDENT);
5374
+                            $hand_forums .= '</div>';
5375 5375
 
5376 5376
                             foreach ($post_list as $posts) {
5377
-                                $hand_forums.= '<div id="social-post">';
5378
-                                $hand_forums.= '<strong>'.Security::remove_XSS($posts['post_title'], STUDENT).'</strong>';
5379
-                                $hand_forums.= '<br / >';
5380
-                                $hand_forums.= Security::remove_XSS($posts['post_text'], STUDENT);
5381
-                                $hand_forums.= '</div>';
5382
-                                $hand_forums.= '<br / >';
5377
+                                $hand_forums .= '<div id="social-post">';
5378
+                                $hand_forums .= '<strong>'.Security::remove_XSS($posts['post_title'], STUDENT).'</strong>';
5379
+                                $hand_forums .= '<br / >';
5380
+                                $hand_forums .= Security::remove_XSS($posts['post_text'], STUDENT);
5381
+                                $hand_forums .= '</div>';
5382
+                                $hand_forums .= '<br / >';
5383 5383
                             }
5384 5384
                         }
5385 5385
                     }
5386 5386
                     $i++;
5387 5387
                 }
5388
-                $forum_results .='<div id="social-forum">';
5389
-                $forum_results .='<div class="clear"></div><br />';
5390
-                $forum_results .='<div id="social-forum-title">'.
5388
+                $forum_results .= '<div id="social-forum">';
5389
+                $forum_results .= '<div class="clear"></div><br />';
5390
+                $forum_results .= '<div id="social-forum-title">'.
5391 5391
                     Display::return_icon('forum.gif', get_lang('Forum')).'&nbsp;'.Security::remove_XSS($forum['forum_title'], STUDENT).
5392 5392
                     '<div style="float:right;margin-top:-35px">
5393 5393
                                         <a href="../forum/viewforum.php?cidReq='.$course_code.'&gidReq=&forum='.$forum['forum_id'].' " >'.get_lang('SeeForum').'</a>
5394 5394
                                     </div></div>';
5395
-                $forum_results .='<br / >';
5395
+                $forum_results .= '<br / >';
5396 5396
                 if ($post_counter > 0) {
5397
-                    $forum_results .=$hand_forums;
5397
+                    $forum_results .= $hand_forums;
5398 5398
                 }
5399
-                $forum_results .='</div>';
5399
+                $forum_results .= '</div>';
5400 5400
             }$j++;
5401 5401
         }
5402 5402
     }
@@ -5537,16 +5537,16 @@  discard block
 block discarded – undo
5537 5537
     $courseId = intval($courseId);
5538 5538
     if (empty($courseId)) {
5539 5539
         // $courseId can be null, use api method
5540
-        $courseId= api_get_course_int_id();
5540
+        $courseId = api_get_course_int_id();
5541 5541
     }
5542 5542
     /*
5543 5543
      * Check if Attachment ID and Course ID are greater than zero
5544 5544
      * and array of field values is not empty
5545 5545
      */
5546 5546
     if ($id > 0 && $courseId > 0 && !empty($array) && is_array($array)) {
5547
-        foreach($array as $key => &$item) {
5547
+        foreach ($array as $key => &$item) {
5548 5548
             $item = Database::escape_string($item);
5549
-            $setString .= $key . ' = "' .$item . '", ';
5549
+            $setString .= $key.' = "'.$item.'", ';
5550 5550
         }
5551 5551
         // Delete last comma
5552 5552
         $setString = substr($setString, 0, strlen($setString) - 2);
@@ -5590,7 +5590,7 @@  discard block
 block discarded – undo
5590 5590
         return '';
5591 5591
     }
5592 5592
 
5593
-    $url = api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq().'&forum=' . $forumId . '&thread=' . $threadId . '&postId=' . $postId . '&a=upload_file';
5593
+    $url = api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='.$threadId.'&postId='.$postId.'&a=upload_file';
5594 5594
     // Form
5595 5595
     $formFileUpload = '<div class="form-ajax">
5596 5596
         <form id="file_upload" action="'.$url.'" method="POST" enctype="multipart/form-data">
@@ -5638,10 +5638,10 @@  discard block
 block discarded – undo
5638 5638
         foreach ($uploadedFiles as $k => $uploadedFile) {
5639 5639
             if (!empty($uploadedFile) && in_array($uploadedFile['id'], $attachIds)) {
5640 5640
                 // Buil html table including an input with attachmentID
5641
-                $fileDataContent .= '<tr id="' . $uploadedFile['id'] . '" ><td>' . $uploadedFile['name'] . '</td><td>' . $uploadedFile['size'] . '</td><td>&nbsp;' . $uploadedFile['result'] .
5642
-                    ' </td><td> <input style="width:90%;" type="text" value="' . $uploadedFile['comment'] . '" name="file_comments[]"> </td><td>' .
5643
-                    $uploadedFile['delete'] . '</td>' .
5644
-                    '<input type="hidden" value="' . $uploadedFile['id'] .'" name="file_ids[]">' . '</tr>';
5641
+                $fileDataContent .= '<tr id="'.$uploadedFile['id'].'" ><td>'.$uploadedFile['name'].'</td><td>'.$uploadedFile['size'].'</td><td>&nbsp;'.$uploadedFile['result'].
5642
+                    ' </td><td> <input style="width:90%;" type="text" value="'.$uploadedFile['comment'].'" name="file_comments[]"> </td><td>'.
5643
+                    $uploadedFile['delete'].'</td>'.
5644
+                    '<input type="hidden" value="'.$uploadedFile['id'].'" name="file_ids[]">'.'</tr>';
5645 5645
             } else {
5646 5646
                 /*
5647 5647
                  * If attachment data is empty, then delete it from $_SESSION
@@ -5654,7 +5654,7 @@  discard block
 block discarded – undo
5654 5654
     $style = empty($fileDataContent) ? 'display: none;' : '';
5655 5655
     // Forum attachment Ajax table
5656 5656
     $fileData = '
5657
-    <div class="control-group " style="'. $style . '">
5657
+    <div class="control-group " style="'. $style.'">
5658 5658
         <label class="control-label">'.get_lang('AttachmentList').'</label>
5659 5659
         <div class="controls">
5660 5660
             <table id="attachmentFileList" class="files data_table span10">
@@ -5726,7 +5726,7 @@  discard block
 block discarded – undo
5726 5726
             // name contains an URL to download attachment file and its filename
5727 5727
             $json['name'] = Display::url(
5728 5728
                 api_htmlentities($row['filename']),
5729
-                api_get_path(WEB_CODE_PATH) . 'forum/download.php?file='.$row['path'].'&'.api_get_cidreq(),
5729
+                api_get_path(WEB_CODE_PATH).'forum/download.php?file='.$row['path'].'&'.api_get_cidreq(),
5730 5730
                 array('target'=>'_blank', 'class' => 'attachFilename')
5731 5731
             );
5732 5732
             $json['id'] = $row['iid'];
@@ -5737,9 +5737,9 @@  discard block
 block discarded – undo
5737 5737
             if (!empty($row) && is_array($row)) {
5738 5738
                 // Set result as success and bring delete URL
5739 5739
                 $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded'));
5740
-                $url = api_get_path(WEB_CODE_PATH) . 'forum/viewthread.php?' . api_get_cidreq() . '&action=delete_attach&forum=' . $forumId . '&thread=' . $threadId.'&id_attach=' . $row['iid'];
5740
+                $url = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&action=delete_attach&forum='.$forumId.'&thread='.$threadId.'&id_attach='.$row['iid'];
5741 5741
                 $json['delete'] = Display::url(
5742
-                    Display::return_icon('delete.png',get_lang('Delete'), array(), ICON_SIZE_SMALL),
5742
+                    Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL),
5743 5743
                     $url,
5744 5744
                     array('class' => 'deleteLink')
5745 5745
                 );
@@ -5828,7 +5828,7 @@  discard block
 block discarded – undo
5828 5828
                 WHERE c_id = $courseId AND post_id = $postId";
5829 5829
         $result = Database::query($sql);
5830 5830
         if ($result !== false && Database::num_rows($result) > 0) {
5831
-            while ($row = Database::fetch_array($result,'ASSOC')) {
5831
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
5832 5832
                 $array[] = $row['id'];
5833 5833
             }
5834 5834
         }
Please login to merge, or discard this patch.
main/document/upload.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 }
69 69
 
70 70
 if (empty($document_data)) {
71
-    $document_id  = $parent_id =  0;
71
+    $document_id = $parent_id = 0;
72 72
     $path = '/';
73 73
 } else {
74 74
     $document_id = $document_data['id'];
@@ -307,16 +307,16 @@  discard block
 block discarded – undo
307 307
 
308 308
 // Link back to the documents overview
309 309
 if ($is_certificate_mode) {
310
-    $actions = '<a href="document.php?id='.$document_id.'&selectcat=' . $selectcat.'&'.api_get_cidreq().'">'.
311
-        Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
310
+    $actions = '<a href="document.php?id='.$document_id.'&selectcat='.$selectcat.'&'.api_get_cidreq().'">'.
311
+        Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>';
312 312
 } else {
313 313
     $actions = '<a href="document.php?id='.$document_id.'&'.api_get_cidreq().'">'.
314
-        Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
314
+        Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
315 315
 }
316 316
 
317 317
 // Link to create a folder
318 318
 
319
-echo $toolbar = Display::toolbarAction('toolbar-upload', array( 0 => $actions), 1);
319
+echo $toolbar = Display::toolbarAction('toolbar-upload', array(0 => $actions), 1);
320 320
 // Form to select directory
321 321
 $folders = DocumentManager::get_all_document_folders($_course, $groupId, $is_allowed_to_edit);
322 322
 if (!$is_certificate_mode) {
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument').'<div style="font-size: 80%" >'.$supported_formats.'</div>');
366 366
     $form->addElement('html', '<br /><div class="sub-form">');
367 367
     $form->addElement('html', '<div class="label">'.get_lang('SearchFeatureDocumentLanguage').'</div>');
368
-    $form->addElement('html', '<div>' . api_get_languages_combo(null) . '</div>');
368
+    $form->addElement('html', '<div>'.api_get_languages_combo(null).'</div>');
369 369
     $form->addElement('html', '</div><div class="sub-form">');
370 370
     $specific_fields = get_specific_field_list();
371 371
     foreach ($specific_fields as $specific_field) {
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 $simple_form = $form->returnForm();
402 402
 
403 403
 $multiple_form = '<div class="description-upload">'.get_lang('ClickToSelectOrDragAndDropMultipleFilesOnTheUploadField').'</div>';
404
-$multiple_form .=  '
404
+$multiple_form .= '
405 405
 <span class="btn btn-success fileinput-button">
406 406
     <i class="glyphicon glyphicon-plus"></i>
407 407
     <span>'.get_lang('AddFiles').'</span>
Please login to merge, or discard this patch.