Passed
Push — 1.10.x ( 23173d...b65d66 )
by
unknown
59:50 queued 10:49
created
main/attendance/attendance_sheet.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     $form = new FormValidator(
25 25
             'filter',
26 26
             'post',
27
-            'index.php?action=attendance_sheet_list&' . api_get_cidreq().'&attendance_id=' . $attendance_id,
27
+            'index.php?action=attendance_sheet_list&'.api_get_cidreq().'&attendance_id='.$attendance_id,
28 28
             null,
29 29
             array(),
30 30
             'inline'
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                             <th width="100px"><?php echo get_lang('AttendancesFaults')?></th>
218 218
                         </tr>
219 219
                         <tr class="tableFloatingHeaderOriginal" >
220
-                            <th width="10px"><?php echo '#';?></th>
220
+                            <th width="10px"><?php echo '#'; ?></th>
221 221
                             <th width="10px"><?php echo get_lang('Photo')?></th>
222 222
                             <th width="150px"><?php echo get_lang('LastName')?></th>
223 223
                             <th width="140px"><?php echo get_lang('FirstName')?></th>
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
                         foreach ($users_in_course as $data) {
232 232
                             $faults = 0;
233 233
                             if ($i % 2 == 0) {
234
-                                $class='row_odd';
234
+                                $class = 'row_odd';
235 235
                             } else {
236
-                                $class='row_even';
236
+                                $class = 'row_even';
237 237
                             }
238 238
                             $username = api_htmlentities(sprintf(get_lang('LoginX'), $data['username']), ENT_QUOTES);
239 239
                             ?>
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
                                 <td><span title="<?php echo $username ?>"><?php echo $data['lastname'] ?></span></td>
244 244
                                 <td><?php echo $data['firstname'] ?></td>
245 245
                                 <td>
246
-                                    <div class="attendance-faults-bar" style="background-color:<?php echo (!empty($data['result_color_bar'])?$data['result_color_bar']:'none') ?>">
246
+                                    <div class="attendance-faults-bar" style="background-color:<?php echo (!empty($data['result_color_bar']) ? $data['result_color_bar'] : 'none') ?>">
247 247
                                         <?php echo $data['attendance_result'] ?>
248 248
                                     </div>
249 249
                                 </td>
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
                     foreach ($attendant_calendar as $calendar) {
266 266
                         $date = $calendar['date'];
267 267
                         $time = $calendar['time'];
268
-                        $datetime = '<div class="grey">'. $date . ' - ' . $time . '</div>';
268
+                        $datetime = '<div class="grey">'.$date.' - '.$time.'</div>';
269 269
 
270 270
                         $img_lock = Display::return_icon(
271 271
                             'lock-closed.png',
@@ -274,21 +274,21 @@  discard block
 block discarded – undo
274 274
                         );
275 275
 
276 276
                         if (!empty($calendar['done_attendance'])) {
277
-                            $datetime = '<div class="blue">' . $date . ' - ' . $time . '</div>';
277
+                            $datetime = '<div class="blue">'.$date.' - '.$time.'</div>';
278 278
                         }
279 279
                         $disabled_check = 'disabled = "true"';
280 280
                         $input_hidden = '<input type="hidden" id="hidden_input_'.$calendar['id'].'" name="hidden_input[]" value="" disabled />';
281 281
                         if ($next_attendance_calendar_id == $calendar['id']) {
282 282
                             $input_hidden = '<input type="hidden" id="hidden_input_'.$calendar['id'].'" name="hidden_input[]" value="'.$calendar['id'].'" />';
283 283
                             $disabled_check = '';
284
-                            $img_lock = Display::return_icon('lock-closed.png',get_lang('DateLock'),array('class'=>'img_unlock','id'=>'datetime_column_'.$calendar['id']));
284
+                            $img_lock = Display::return_icon('lock-closed.png', get_lang('DateLock'), array('class'=>'img_unlock', 'id'=>'datetime_column_'.$calendar['id']));
285 285
                         }
286 286
 
287 287
                         $result .= '<th>';
288 288
                         $result .= '<div class="date-attendance">'.$datetime.'&nbsp;';
289 289
 
290 290
                         if (api_is_allowed_to_edit(null, true)) {
291
-                            $result .= '<span id="attendance_lock" style="cursor:pointer">'.(!$is_locked_attendance || api_is_platform_admin()?$img_lock:'').'</span>';
291
+                            $result .= '<span id="attendance_lock" style="cursor:pointer">'.(!$is_locked_attendance || api_is_platform_admin() ? $img_lock : '').'</span>';
292 292
                         }
293 293
 
294 294
                         if ($is_locked_attendance == false) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                     }
300 300
                 } else {
301 301
                     $result  = '<th width="2000px"><span><a href="index.php?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.'">';
302
-                    $result .= Display::return_icon('attendance_calendar.png',get_lang('AttendanceCalendar'),'',ICON_SIZE_MEDIUM).' '.get_lang('GoToAttendanceCalendar').'</a></span></th>';
302
+                    $result .= Display::return_icon('attendance_calendar.png', get_lang('AttendanceCalendar'), '', ICON_SIZE_MEDIUM).' '.get_lang('GoToAttendanceCalendar').'</a></span></th>';
303 303
                 }
304 304
 
305 305
                 echo '<tr class="tableFloatingHeader row_odd" style="position: absolute; top: 0px; left: 0px; visibility: hidden; margin:0px;padding:0px">';
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                 $i = 0;
314 314
                 foreach ($users_in_course as $user) {
315 315
                     $class = '';
316
-                    if ($i%2 == 0) {
316
+                    if ($i % 2 == 0) {
317 317
                         $class = 'row_even';
318 318
                     } else {
319 319
                         $class = 'row_odd';
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                                     echo '<input type="checkbox" name="check_presence['.$calendar['id'].'][]" value="'.$user['user_id'].'" '.$disabled.' '.$checked.' />';
361 361
                                     echo '<span class="anchor_'.$calendar['id'].'"></span>';
362 362
                                 } else {
363
-                                    echo $presence ? Display::return_icon('checkbox_on.gif',get_lang('Presence')) : Display::return_icon('checkbox_off.gif',get_lang('Presence'));
363
+                                    echo $presence ? Display::return_icon('checkbox_on.gif', get_lang('Presence')) : Display::return_icon('checkbox_off.gif', get_lang('Presence'));
364 364
                                 }
365 365
                             } else {
366 366
                                 switch ($presence) {
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
                         </td>';
392 392
                     }
393 393
                     echo '</tr>';
394
-                    $i++ ;
394
+                    $i++;
395 395
                 }
396 396
                 echo '</tbody></table>';
397 397
                 echo '</div></div>';
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
     echo Display::page_header(get_lang('AttendanceSheetReport'));
420 420
     // View for students
421 421
     ?>
422
-    <?php if(!empty($users_presence)) { ?>
422
+    <?php if (!empty($users_presence)) { ?>
423 423
         <div>
424 424
             <table width="250px;">
425 425
                 <tr>
426 426
                     <td><?php echo get_lang('ToAttend').': ' ?></td>
427 427
                     <td>
428
-                        <center><div class="attendance-faults-bar" style="background-color:<?php echo (!empty($faults['color_bar'])?$faults['color_bar']:'none') ?>">
428
+                        <center><div class="attendance-faults-bar" style="background-color:<?php echo (!empty($faults['color_bar']) ? $faults['color_bar'] : 'none') ?>">
429 429
                         <?php echo $faults['faults'].'/'.$faults['total'].' ('.$faults['faults_porcent'].'%)' ?></div></center>
430 430
                     </td>
431 431
                 </tr>
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
             $i = 0;
443 443
             foreach ($users_presence[$user_id] as $presence) {
444 444
                 $class = '';
445
-                if ($i%2==0) {
445
+                if ($i % 2 == 0) {
446 446
                     $class = 'row_even';
447 447
                 } else {
448 448
                     $class = 'row_odd';
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                 ?>
451 451
                 <tr class="<?php echo $class ?>">
452 452
                     <td>
453
-                        <?php echo $presence['presence'] ? Display::return_icon('checkbox_on.gif',get_lang('Presence')) : Display::return_icon('checkbox_off.gif',get_lang('Presence')) ?>
453
+                        <?php echo $presence['presence'] ? Display::return_icon('checkbox_on.gif', get_lang('Presence')) : Display::return_icon('checkbox_off.gif', get_lang('Presence')) ?>
454 454
                         <?php echo "&nbsp; ".$presence['date_time'] ?>
455 455
                     </td>
456 456
                 </tr>
Please login to merge, or discard this patch.
main/inc/lib/document.lib.php 1 patch
Spacing   +335 added lines, -335 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
             );
@@ -3520,7 +3520,7 @@  discard block
 block discarded – undo
3520 3520
                     $('#'+tempId).hide();
3521 3521
                 } else {
3522 3522
                     image.addClass('open');
3523
-                    image.attr('src', '" . Display::returnIconPath('nolines_minus.gif') . "');
3523
+                    image.attr('src', '" . Display::returnIconPath('nolines_minus.gif')."');
3524 3524
                     $('#'+id).hide();
3525 3525
                     $('#'+tempId).show();
3526 3526
 
@@ -3567,7 +3567,7 @@  discard block
 block discarded – undo
3567 3567
         $target,
3568 3568
         $overwrite_url
3569 3569
     ) {
3570
-        $img_sys_path = api_get_path(SYS_CODE_PATH) . 'img/';
3570
+        $img_sys_path = api_get_path(SYS_CODE_PATH).'img/';
3571 3571
         $web_code_path = api_get_path(WEB_CODE_PATH);
3572 3572
 
3573 3573
         $documentId = $resource['id'];
@@ -3582,7 +3582,7 @@  discard block
 block discarded – undo
3582 3582
         // It's a file.
3583 3583
         $icon = choose_image($path);
3584 3584
         $position = strrpos($icon, '.');
3585
-        $icon = substr($icon, 0, $position) . '_small.gif';
3585
+        $icon = substr($icon, 0, $position).'_small.gif';
3586 3586
         $my_file_title = $resource['title'];
3587 3587
         $visibility = $resource['visibility'];
3588 3588
 
@@ -3594,25 +3594,25 @@  discard block
 block discarded – undo
3594 3594
         // Show the "image name" not the filename of the image.
3595 3595
         if ($lp_id) {
3596 3596
             // LP URL
3597
-            $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;
3597
+            $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;
3598 3598
             if (!empty($overwrite_url)) {
3599
-                $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId.'';
3599
+                $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId.'';
3600 3600
             }
3601 3601
         } else {
3602 3602
             // Direct document URL
3603
-            $url = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId;
3603
+            $url = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId;
3604 3604
             if (!empty($overwrite_url)) {
3605
-                $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId;
3605
+                $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId;
3606 3606
             }
3607 3607
         }
3608 3608
 
3609 3609
         $img = Display::returnIconPath($icon);
3610
-        if (!file_exists($img_sys_path . $icon)) {
3610
+        if (!file_exists($img_sys_path.$icon)) {
3611 3611
             $img = Display::returnIconPath('default_small.gif');
3612 3612
         }
3613 3613
 
3614 3614
         $link = Display::url(
3615
-            '<img alt="" src="' . $img . '" title="" />&nbsp;' . $my_file_title, $url,
3615
+            '<img alt="" src="'.$img.'" title="" />&nbsp;'.$my_file_title, $url,
3616 3616
             array('target' => $target)
3617 3617
         );
3618 3618
 
@@ -3623,12 +3623,12 @@  discard block
 block discarded – undo
3623 3623
         $return = null;
3624 3624
 
3625 3625
         if ($lp_id == false) {
3626
-            $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >';
3626
+            $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >';
3627 3627
         } else {
3628
-            $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >';
3628
+            $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >';
3629 3629
         }
3630 3630
 
3631
-        $return .= '<div class="item_data" style="margin-left:' . ($num  * 18) . 'px;margin-right:5px;">';
3631
+        $return .= '<div class="item_data" style="margin-left:'.($num * 18).'px;margin-right:5px;">';
3632 3632
 
3633 3633
         if ($add_move_button) {
3634 3634
             $return .= '<a class="moved" href="#">';
@@ -3693,7 +3693,7 @@  discard block
 block discarded – undo
3693 3693
             if (isset($resource['visible']) && $resource['visible'] == 0) {
3694 3694
                 $folder_class_hidden = "doc_folder_hidden"; // in base.css
3695 3695
             }
3696
-            $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"';
3696
+            $onclick = 'onclick="javascript: testResources(\'res_'.$resource['id'].'\',\'img_'.$resource['id'].'\')"';
3697 3697
         }
3698 3698
         $return = null;
3699 3699
 
@@ -3701,22 +3701,22 @@  discard block
 block discarded – undo
3701 3701
             $return = '<ul class="lp_resource">';
3702 3702
         }
3703 3703
 
3704
-        $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_' . $resource['id'] . '"  style="margin-left:' . ($num * 18) . 'px; ">';
3704
+        $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_'.$resource['id'].'"  style="margin-left:'.($num * 18).'px; ">';
3705 3705
 
3706 3706
         $image = Display::returnIconPath('nolines_plus.gif');
3707 3707
         if (empty($path)) {
3708 3708
             $image = Display::returnIconPath('nolines_minus.gif');
3709 3709
         }
3710
-        $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'] . '" '.$onclick.'>';
3710
+        $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'].'" '.$onclick.'>';
3711 3711
         $return .= Display::returnIconPath('lp_folder.gif').'&nbsp;';
3712 3712
         $return .= '<span '.$onclick.' style="cursor: pointer;" >'.$title.'</span>';
3713 3713
         $return .= '</li>';
3714 3714
 
3715 3715
         if (empty($path)) {
3716 3716
             if ($folderId == false) {
3717
-                $return .= '<div id="res_' . $resource['id'] . '" >';
3717
+                $return .= '<div id="res_'.$resource['id'].'" >';
3718 3718
             } else {
3719
-                $return .= '<div id="res_' . $resource['id'] . '" style="display: none;" >';
3719
+                $return .= '<div id="res_'.$resource['id'].'" style="display: none;" >';
3720 3720
             }
3721 3721
         }
3722 3722
 
@@ -3878,9 +3878,9 @@  discard block
 block discarded – undo
3878 3878
             $session_id = api_get_session_id();
3879 3879
         }
3880 3880
         $course_info = api_get_course_info($course_code);
3881
-        $course_dir = $course_info['path'] . '/document';
3881
+        $course_dir = $course_info['path'].'/document';
3882 3882
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
3883
-        $base_work_dir = $sys_course_path . $course_dir;
3883
+        $base_work_dir = $sys_course_path.$course_dir;
3884 3884
 
3885 3885
         $course_id = $course_info['real_id'];
3886 3886
         $table_document = Database::get_course_table(TABLE_DOCUMENT);
@@ -3889,7 +3889,7 @@  discard block
 block discarded – undo
3889 3889
         $result = Database::query($qry);
3890 3890
         if (Database::num_rows($result) == 1) {
3891 3891
             $row = Database::fetch_array($result);
3892
-            $doc_path = api_get_path(SYS_COURSE_PATH) . $course_dir . $row['path'];
3892
+            $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path'];
3893 3893
             //TODO: mime_content_type is deprecated, fileinfo php extension is enabled by default as of PHP 5.3.0
3894 3894
             // now versions of PHP on Debian testing(5.2.6-5) and Ubuntu(5.2.6-2ubuntu) are lower, so wait for a while
3895 3895
             $doc_mime = mime_content_type($doc_path);
@@ -3920,8 +3920,8 @@  discard block
 block discarded – undo
3920 3920
                 $file_content = self::get_text_content($doc_path, $doc_mime);
3921 3921
                 $course_code = Database::escape_string($course_code);
3922 3922
 
3923
-                require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
3924
-                require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
3923
+                require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
3924
+                require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
3925 3925
 
3926 3926
                 $ic_slide = new IndexableChunk();
3927 3927
                 $ic_slide->addValue('title', $file_title);
@@ -3938,7 +3938,7 @@  discard block
 block discarded – undo
3938 3938
                 $di = new ChamiloIndexer();
3939 3939
                 $return = $di->connectDb(null, null, $lang);
3940 3940
 
3941
-                require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
3941
+                require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
3942 3942
                 $specific_fields = get_specific_field_list();
3943 3943
 
3944 3944
                 // process different depending on what to do if file exists
@@ -3975,7 +3975,7 @@  discard block
 block discarded – undo
3975 3975
                             } else { //if the specific field is not defined, force an empty one
3976 3976
                                 $sterms = '';
3977 3977
                             }
3978
-                            $all_specific_terms .= ' ' . $sterms;
3978
+                            $all_specific_terms .= ' '.$sterms;
3979 3979
                             $sterms = explode(',', $sterms);
3980 3980
                             foreach ($sterms as $sterm) {
3981 3981
                                 $sterm = trim($sterm);
@@ -3989,7 +3989,7 @@  discard block
 block discarded – undo
3989 3989
                             }
3990 3990
                         }
3991 3991
                         // Add terms also to content to make terms findable by probabilistic search
3992
-                        $file_content = $all_specific_terms . ' ' . $file_content;
3992
+                        $file_content = $all_specific_terms.' '.$file_content;
3993 3993
 
3994 3994
                         if (!$simulation) {
3995 3995
                             $ic_slide->addValue('content', $file_content);
@@ -4015,7 +4015,7 @@  discard block
 block discarded – undo
4015 4015
                         } else { //if the specific field is not defined, force an empty one
4016 4016
                             $sterms = '';
4017 4017
                         }
4018
-                        $all_specific_terms .= ' ' . $sterms;
4018
+                        $all_specific_terms .= ' '.$sterms;
4019 4019
                         if (!empty($sterms)) {
4020 4020
                             $sterms = explode(',', $sterms);
4021 4021
                             foreach ($sterms as $sterm) {
@@ -4027,7 +4027,7 @@  discard block
 block discarded – undo
4027 4027
                         }
4028 4028
                     }
4029 4029
                     // Add terms also to content to make terms findable by probabilistic search
4030
-                    $file_content = $all_specific_terms . ' ' . $file_content;
4030
+                    $file_content = $all_specific_terms.' '.$file_content;
4031 4031
                     if (!$simulation) {
4032 4032
                         $ic_slide->addValue('content', $file_content);
4033 4033
                         $di->addChunk($ic_slide);
@@ -4311,7 +4311,7 @@  discard block
 block discarded – undo
4311 4311
         $defaultVisibility = 'visible';
4312 4312
 
4313 4313
         if (isset($settings['documents'])) {
4314
-            $portalDefaultVisibility =  'invisible';
4314
+            $portalDefaultVisibility = 'invisible';
4315 4315
             if ($settings['documents'] == 'true') {
4316 4316
                 $portalDefaultVisibility = 'visible';
4317 4317
             }
@@ -4549,7 +4549,7 @@  discard block
 block discarded – undo
4549 4549
         //make htaccess with allow from all, and file index.html into temp/audio
4550 4550
         $htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess';
4551 4551
         if (!file_exists($htaccess)) {
4552
-            $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
4552
+            $htaccess_content = "order deny,allow\r\nallow from all\r\nOptions -Indexes";
4553 4553
             $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess', 'w');
4554 4554
             if ($fp) {
4555 4555
                 fwrite($fp, $htaccess_content);
@@ -4558,9 +4558,9 @@  discard block
 block discarded – undo
4558 4558
         }
4559 4559
 
4560 4560
         //encript temp name file
4561
-        $name_crip = sha1(uniqid());//encript
4562
-        $findext= explode(".", $file);
4563
-        $extension = $findext[count($findext)-1];
4561
+        $name_crip = sha1(uniqid()); //encript
4562
+        $findext = explode(".", $file);
4563
+        $extension = $findext[count($findext) - 1];
4564 4564
         $file_crip = $name_crip.'.'.$extension;
4565 4565
 
4566 4566
         //copy file to temp/audio directory
@@ -4664,7 +4664,7 @@  discard block
 block discarded – undo
4664 4664
         $comment = null;
4665 4665
 
4666 4666
         $fileName = api_replace_dangerous_char($title);
4667
-        $filePath = api_get_path(SYS_COURSE_PATH) . "{$courseData['path']}/document{$dir}";
4667
+        $filePath = api_get_path(SYS_COURSE_PATH)."{$courseData['path']}/document{$dir}";
4668 4668
         $fileFullPath = "{$filePath}/{$fileName}.html";
4669 4669
         $fileSize = 0;
4670 4670
         $fileType = 'file';
@@ -4716,7 +4716,7 @@  discard block
 block discarded – undo
4716 4716
             $fileSize,
4717 4717
             $title,
4718 4718
             $comment,
4719
-            0,//$readonly = 0,
4719
+            0, //$readonly = 0,
4720 4720
             true, //$save_visibility = true,
4721 4721
             null, //$group_id = null,
4722 4722
             $sessionId
@@ -5001,8 +5001,8 @@  discard block
 block discarded – undo
5001 5001
             $sessionId,
5002 5002
             $groupId
5003 5003
         )) {
5004
-            $uniqueName = self::addSuffixToFileName($name, '_' . $counter);
5005
-            $filePath = $path . $uniqueName;
5004
+            $uniqueName = self::addSuffixToFileName($name, '_'.$counter);
5005
+            $filePath = $path.$uniqueName;
5006 5006
             $counter++;
5007 5007
         }
5008 5008
 
@@ -5035,7 +5035,7 @@  discard block
 block discarded – undo
5035 5035
             $folder_sql = implode("','", $escaped_folders);
5036 5036
 
5037 5037
             $sql = "SELECT * FROM $doc_table
5038
-                WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('" . $folder_sql . "')";
5038
+                WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('".$folder_sql."')";
5039 5039
             $res = Database::query($sql);
5040 5040
             $folder_titles = array();
5041 5041
             while ($obj = Database::fetch_object($res)) {
@@ -5043,7 +5043,7 @@  discard block
 block discarded – undo
5043 5043
             }
5044 5044
         }
5045 5045
 
5046
-        $form = new FormValidator('selector', 'GET', api_get_self() . '?' . api_get_cidreq());
5046
+        $form = new FormValidator('selector', 'GET', api_get_self().'?'.api_get_cidreq());
5047 5047
         $form->addElement('hidden', 'cidReq', api_get_course_id());
5048 5048
         $parent_select = $form->addSelect('id', get_lang('CurrentDirectory'), '', array('onchange' => 'javascript: document.selector.submit();'));
5049 5049
 
@@ -5063,9 +5063,9 @@  discard block
 block discarded – undo
5063 5063
                     $folder_titles[$folder] = cut($folder_titles[$folder], 80);
5064 5064
                     $counter = count($path_parts) - 2;
5065 5065
                     if ($counter > 0) {
5066
-                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', $counter) . ' &mdash; ' . $folder_titles[$folder];
5066
+                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', $counter).' &mdash; '.$folder_titles[$folder];
5067 5067
                     } else {
5068
-                        $label = ' &mdash; ' . $folder_titles[$folder];
5068
+                        $label = ' &mdash; '.$folder_titles[$folder];
5069 5069
                     }
5070 5070
                     $parent_select->addOption($label, $folder_id);
5071 5071
                     if ($selected != '') {
@@ -5083,7 +5083,7 @@  discard block
 block discarded – undo
5083 5083
                     } else {
5084 5084
                         $path_parts = explode('/', str_replace($group_dir, '', $folder));
5085 5085
                         $label = cut($label, 80);
5086
-                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2) . ' &mdash; ' . $label;
5086
+                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
5087 5087
                     }
5088 5088
                     $parent_select->addOption($label, $folder_id);
5089 5089
                     if ($selected != '') {
@@ -5115,7 +5115,7 @@  discard block
 block discarded – undo
5115 5115
     ) {
5116 5116
         global $dbl_click_id;
5117 5117
         $course_info = api_get_course_info();
5118
-        $www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document';
5118
+        $www = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document';
5119 5119
         $webOdflist = DocumentManager::get_web_odf_extension_list();
5120 5120
 
5121 5121
         // Get the title or the basename depending on what we're using
@@ -5139,11 +5139,11 @@  discard block
 block discarded – undo
5139 5139
 
5140 5140
         if (!$show_as_icon) {
5141 5141
             // Build download link (icon)
5142
-            $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'];
5142
+            $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'];
5143 5143
             // Folder download or file download?
5144 5144
             $forcedownload_icon = ($filetype == 'folder') ? 'save_pack.png' : 'save.png';
5145 5145
             // Prevent multiple clicks on zipped folder download
5146
-            $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; }\"" : '';
5146
+            $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; }\"" : '';
5147 5147
         }
5148 5148
 
5149 5149
         $target = '_self';
@@ -5159,20 +5159,20 @@  discard block
 block discarded – undo
5159 5159
 
5160 5160
             if ($is_browser_viewable_file) {
5161 5161
                 if ($ext == 'pdf' || in_array($ext, $webOdflist)) {
5162
-                    $url = api_get_self() . '?' . api_get_cidreq() . '&amp;action=download&amp;id=' . $document_data['id'];
5162
+                    $url = api_get_self().'?'.api_get_cidreq().'&amp;action=download&amp;id='.$document_data['id'];
5163 5163
                 } else {
5164
-                    $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5164
+                    $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5165 5165
                 }
5166 5166
             } else {
5167 5167
                 // url-encode for problematic characters (we may not call them dangerous characters...)
5168
-                $path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq();
5169
-                $url = $www . $path;
5168
+                $path = str_replace('%2F', '/', $url_path).'?'.api_get_cidreq();
5169
+                $url = $www.$path;
5170 5170
             }
5171 5171
 
5172 5172
             /*$path = str_replace('%2F', '/', $url_path); //yox view hack otherwise the image can't be well read
5173 5173
             $url = $www . $path;*/
5174 5174
         } else {
5175
-            $url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id'];
5175
+            $url = api_get_self().'?'.api_get_cidreq().'&id='.$document_data['id'];
5176 5176
         }
5177 5177
 
5178 5178
         // The little download icon
@@ -5182,10 +5182,10 @@  discard block
 block discarded – undo
5182 5182
         if ($path == '/shared_folder') {
5183 5183
             $tooltip_title_alt = get_lang('UserFolders');
5184 5184
         } elseif (strstr($path, 'shared_folder_session_')) {
5185
-            $tooltip_title_alt = get_lang('UserFolders') . ' (' . api_get_session_name(api_get_session_id()) . ')';
5185
+            $tooltip_title_alt = get_lang('UserFolders').' ('.api_get_session_name(api_get_session_id()).')';
5186 5186
         } elseif (strstr($tooltip_title, 'sf_user_')) {
5187 5187
             $userinfo = api_get_user_info(substr($tooltip_title, 8));
5188
-            $tooltip_title_alt = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
5188
+            $tooltip_title_alt = get_lang('UserFolder').' '.$userinfo['complete_name'];
5189 5189
         } elseif ($path == '/chat_files') {
5190 5190
             $tooltip_title_alt = get_lang('ChatFiles');
5191 5191
         } elseif ($path == '/learning_path') {
@@ -5218,24 +5218,24 @@  discard block
 block discarded – undo
5218 5218
                 ) {
5219 5219
                     //filter when I am into shared folder, I can show for donwload only my shared folder
5220 5220
                     if (DocumentManager::is_shared_folder($curdirpath, $current_session_id)) {
5221
-                        if (preg_match('/shared_folder\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
5222
-                            preg_match('/shared_folder_session_' . $current_session_id . '\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
5221
+                        if (preg_match('/shared_folder\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) ||
5222
+                            preg_match('/shared_folder_session_'.$current_session_id.'\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) ||
5223 5223
                             api_is_allowed_to_edit() || api_is_platform_admin()
5224 5224
                         ) {
5225
-                            $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5226
-                                Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5225
+                            $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5226
+                                Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5227 5227
                         }
5228 5228
                     } elseif (!preg_match('/shared_folder/', urldecode($forcedownload_link)) ||
5229 5229
                         api_is_allowed_to_edit() ||
5230 5230
                         api_is_platform_admin()
5231 5231
                     ) {
5232
-                        $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5233
-                            Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5232
+                        $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5233
+                            Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5234 5234
                     }
5235 5235
                 }
5236 5236
             } else {
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
             // Copy files to users myfiles
@@ -5243,12 +5243,12 @@  discard block
 block discarded – undo
5243 5243
                 api_get_setting('users_copy_files') == 'true' &&
5244 5244
                 !api_is_anonymous()
5245 5245
             ) {
5246
-                $copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq();
5246
+                $copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&action=copytomyfiles&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq();
5247 5247
 
5248 5248
                 if ($filetype == 'file') {
5249 5249
 
5250
-                    $copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5251
-                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
5250
+                    $copy_to_myfiles = '<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5251
+                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
5252 5252
 
5253 5253
                     if (api_get_setting('allow_my_files') === 'false') {
5254 5254
                         $copy_to_myfiles = '';
@@ -5267,13 +5267,13 @@  discard block
 block discarded – undo
5267 5267
                 $filetype == 'file' &&
5268 5268
                 in_array($extension, array('html', 'htm'))
5269 5269
             ) {
5270
-                $pdf_icon = ' <a style="float:right".' . $prevent_multiple_click . ' href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $document_data['id'] . '">' .
5271
-                    Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a> ';
5270
+                $pdf_icon = ' <a style="float:right".'.$prevent_multiple_click.' href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$document_data['id'].'">'.
5271
+                    Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a> ';
5272 5272
             }
5273 5273
 
5274 5274
             if ($is_browser_viewable_file) {
5275
-                $open_in_new_window_link = '<a href="' . $www . str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq() . '" style="float:right"' . $prevent_multiple_click . ' target="_blank">' .
5276
-                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
5275
+                $open_in_new_window_link = '<a href="'.$www.str_replace('%2F', '/', $url_path).'?'.api_get_cidreq().'" style="float:right"'.$prevent_multiple_click.' target="_blank">'.
5276
+                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
5277 5277
             }
5278 5278
 
5279 5279
             if ($filetype == 'file') {
@@ -5282,9 +5282,9 @@  discard block
 block discarded – undo
5282 5282
                     (preg_match('/wav$/i', urldecode($checkExtension)) && !preg_match('/_chnano_.wav$/i', urldecode($url))) ||
5283 5283
                     preg_match('/ogg$/i', urldecode($checkExtension))
5284 5284
                 ) {
5285
-                    return '<span style="float:left" ' . $visibility_class . '>' .
5286
-                    $title .
5287
-                    '</span>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5285
+                    return '<span style="float:left" '.$visibility_class.'>'.
5286
+                    $title.
5287
+                    '</span>'.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5288 5288
                 } elseif (
5289 5289
 
5290 5290
                     // Show preview
@@ -5302,7 +5302,7 @@  discard block
 block discarded – undo
5302 5302
                     )
5303 5303
                 ) {
5304 5304
                     // Simpler version of showinframesmin.php with no headers
5305
-                    $url = 'show_content.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5305
+                    $url = 'show_content.php?'.api_get_cidreq().'&id='.$document_data['id'];
5306 5306
                     $class = 'ajax';
5307 5307
                     if ($visibility == false) {
5308 5308
                         $class = "ajax invisible";
@@ -5317,34 +5317,34 @@  discard block
 block discarded – undo
5317 5317
                             'style' => 'float: left;'
5318 5318
                         ]
5319 5319
                     )
5320
-                    . $force_download_html . $send_to . $copy_to_myfiles
5321
-                    . $open_in_new_window_link . $pdf_icon;
5320
+                    . $force_download_html.$send_to.$copy_to_myfiles
5321
+                    . $open_in_new_window_link.$pdf_icon;
5322 5322
                 } else {
5323 5323
                     // For PDF Download the file.
5324 5324
                     $pdfPreview = null;
5325 5325
                     if ($ext != 'pdf' && !in_array($ext, $webOdflist)) {
5326
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5326
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5327 5327
                     } else {
5328 5328
                         $pdfPreview = Display::url(
5329 5329
                             Display::return_icon('preview.gif', get_lang('Preview')),
5330
-                            api_get_path(WEB_CODE_PATH).'document/showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'],
5330
+                            api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'],
5331 5331
                             array('style' => 'float:right')
5332 5332
                         );
5333 5333
                     }
5334 5334
                     // No plugin just the old and good showinframes.php page
5335
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" style="float:left" ' . $visibility_class . ' >' . $title . '</a>' .
5336
-                    $pdfPreview.$force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5335
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" style="float:left" '.$visibility_class.' >'.$title.'</a>'.
5336
+                    $pdfPreview.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5337 5337
                 }
5338 5338
             } else {
5339
-                return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . $title . '</a>' .
5340
-                $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5339
+                return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.$title.'</a>'.
5340
+                $force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5341 5341
             }
5342 5342
             // end copy files to users myfiles
5343 5343
         } else {
5344 5344
             // Icon column
5345 5345
             if (preg_match('/shared_folder/', urldecode($checkExtension)) &&
5346 5346
                 preg_match('/shared_folder$/', urldecode($checkExtension)) == false &&
5347
-                preg_match('/shared_folder_session_' . $current_session_id . '$/', urldecode($url)) == false
5347
+                preg_match('/shared_folder_session_'.$current_session_id.'$/', urldecode($url)) == false
5348 5348
             ) {
5349 5349
                 if ($filetype == 'file') {
5350 5350
                     //Sound preview with jplayer
@@ -5369,19 +5369,19 @@  discard block
 block discarded – undo
5369 5369
                             api_get_setting('enable_nanogong') == 'true'
5370 5370
                         )
5371 5371
                     ) {
5372
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5373
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5374
-                        DocumentManager::build_document_icon_tag($filetype, $path) .
5375
-                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5372
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5373
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5374
+                        DocumentManager::build_document_icon_tag($filetype, $path).
5375
+                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5376 5376
                     } else {
5377
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5378
-                        DocumentManager::build_document_icon_tag($filetype, $path) .
5379
-                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5377
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5378
+                        DocumentManager::build_document_icon_tag($filetype, $path).
5379
+                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5380 5380
                     }
5381 5381
                 } else {
5382
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $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.'" target="'.$target.'"'.$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 5387
                 if ($filetype == 'file') {
@@ -5409,16 +5409,16 @@  discard block
 block discarded – undo
5409 5409
                             api_get_setting('enable_nanogong') == 'true'
5410 5410
                         )
5411 5411
                     ) {
5412
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; //without preview
5413
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5414
-                        DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5412
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; //without preview
5413
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5414
+                        DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5415 5415
                     } else {
5416
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5417
-                        DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5416
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5417
+                        DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5418 5418
                     }
5419 5419
                 } else {
5420
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' .
5421
-                    DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5420
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.
5421
+                    DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5422 5422
                 }
5423 5423
             }
5424 5424
         }
@@ -5442,7 +5442,7 @@  discard block
 block discarded – undo
5442 5442
 
5443 5443
             if (preg_match('/_chnano_.wav$/i', $basename)) {
5444 5444
                 $icon = "jplayer_play.png";
5445
-                $basename = 'wav' . ' ' . '(Nanogong)';
5445
+                $basename = 'wav'.' '.'(Nanogong)';
5446 5446
             } else {
5447 5447
                 $basename = substr(strrchr($basename, '.'), 1);
5448 5448
             }
@@ -5458,13 +5458,13 @@  discard block
 block discarded – undo
5458 5458
                 $userinfo = api_get_user_info(substr($basename, 8));
5459 5459
                 $icon = $userinfo['avatar_small'];
5460 5460
 
5461
-                $basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
5461
+                $basename = get_lang('UserFolder').' '.$userinfo['complete_name'];
5462 5462
                 $user_image = true;
5463 5463
             } elseif (strstr($path, 'shared_folder_session_')) {
5464 5464
                 if ($is_allowed_to_edit) {
5465
-                    $basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder');
5465
+                    $basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpUsersFolder');
5466 5466
                 } else {
5467
-                    $basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')';
5467
+                    $basename = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')';
5468 5468
                 }
5469 5469
                 $icon = 'folder_users.gif';
5470 5470
             } else {
@@ -5558,16 +5558,16 @@  discard block
 block discarded – undo
5558 5558
         // Build URL-parameters for table-sorting
5559 5559
         $sort_params = array();
5560 5560
         if (isset($_GET['column'])) {
5561
-            $sort_params[] = 'column=' . Security::remove_XSS($_GET['column']);
5561
+            $sort_params[] = 'column='.Security::remove_XSS($_GET['column']);
5562 5562
         }
5563 5563
         if (isset($_GET['page_nr'])) {
5564
-            $sort_params[] = 'page_nr=' . Security::remove_XSS($_GET['page_nr']);
5564
+            $sort_params[] = 'page_nr='.Security::remove_XSS($_GET['page_nr']);
5565 5565
         }
5566 5566
         if (isset($_GET['per_page'])) {
5567
-            $sort_params[] = 'per_page=' . Security::remove_XSS($_GET['per_page']);
5567
+            $sort_params[] = 'per_page='.Security::remove_XSS($_GET['per_page']);
5568 5568
         }
5569 5569
         if (isset($_GET['direction'])) {
5570
-            $sort_params[] = 'direction=' . Security::remove_XSS($_GET['direction']);
5570
+            $sort_params[] = 'direction='.Security::remove_XSS($_GET['direction']);
5571 5571
         }
5572 5572
         $sort_params = implode('&amp;', $sort_params);
5573 5573
         $visibility_icon = ($visibility == 0) ? 'invisible' : 'visible';
@@ -5580,89 +5580,89 @@  discard block
 block discarded – undo
5580 5580
         if ($is_read_only /* or ($session_id!=api_get_session_id()) */) {
5581 5581
             if (api_is_course_admin() || api_is_platform_admin()) {
5582 5582
                 if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5583
-                    $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5584
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5585
-                } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5586
-                    $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5587
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5583
+                    $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5584
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5585
+                } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5586
+                    $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5587
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5588 5588
                 } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5589
-                    $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5590
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5589
+                    $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5590
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5591 5591
                 } else {
5592
-                    $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id. '">' .
5593
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5592
+                    $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5593
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5594 5594
                 }
5595 5595
             } else {
5596 5596
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
5597 5597
             }
5598
-            $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
5598
+            $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
5599 5599
             if (api_is_allowed_to_edit() || api_is_platform_admin()) {
5600
-                $modify_icons .= '&nbsp;' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL);
5600
+                $modify_icons .= '&nbsp;'.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL);
5601 5601
             }
5602
-            $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
5602
+            $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
5603 5603
         } else {
5604 5604
             //Edit button
5605 5605
             if (in_array($path, DocumentManager::get_system_folders())) {
5606 5606
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
5607
-            } elseif ($is_certificate_mode ) {
5607
+            } elseif ($is_certificate_mode) {
5608 5608
                 // gradebook category doesn't seem to be taken into account
5609
-                $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>';
5609
+                $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>';
5610 5610
             } else {
5611 5611
                 if (api_get_session_id()) {
5612 5612
                     if ($document_data['session_id'] == api_get_session_id()) {
5613 5613
                         if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5614
-                            $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5615
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5616
-                        } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5617
-                            $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5618
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5614
+                            $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5615
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5616
+                        } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5617
+                            $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5618
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5619 5619
                         } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5620
-                            $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5621
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5620
+                            $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5621
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5622 5622
                         } else {
5623
-                            $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5624
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5623
+                            $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5624
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5625 5625
                         }
5626 5626
                     } else {
5627
-                        $modify_icons .= '&nbsp;' . Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
5627
+                        $modify_icons .= '&nbsp;'.Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
5628 5628
                     }
5629 5629
                 } else {
5630 5630
                     if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5631
-                        $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5632
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5633
-                    } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5634
-                        $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5635
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5631
+                        $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5632
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5633
+                    } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5634
+                        $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5635
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5636 5636
                     } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5637
-                        $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '">' .
5638
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5637
+                        $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5638
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5639 5639
                     } else {
5640
-                        $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5641
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5640
+                        $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5641
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5642 5642
                     }
5643 5643
                 }
5644 5644
             }
5645 5645
 
5646 5646
             // Move button.
5647 5647
             if ($is_certificate_mode || in_array($path, DocumentManager::get_system_folders())) {
5648
-                $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5648
+                $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5649 5649
             } else {
5650 5650
                 if (api_get_session_id()) {
5651 5651
                     if ($document_data['session_id'] == api_get_session_id()) {
5652
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id .  '">' .
5653
-                            Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5652
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;move='.$document_id.'">'.
5653
+                            Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5654 5654
                     } else {
5655
-                        $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5655
+                        $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5656 5656
                     }
5657 5657
                 } else {
5658
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id .  '">' .
5659
-                        Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5658
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;move='.$document_id.'">'.
5659
+                        Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5660 5660
                 }
5661 5661
             }
5662 5662
 
5663 5663
             //Visibility button
5664 5664
             if ($is_certificate_mode) {
5665
-                $modify_icons .= '&nbsp;' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL) . '</a>';
5665
+                $modify_icons .= '&nbsp;'.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL).'</a>';
5666 5666
             } else {
5667 5667
                 if (api_is_allowed_to_edit() || api_is_platform_admin()) {
5668 5668
                     if ($visibility_icon == 'invisible') {
@@ -5670,14 +5670,14 @@  discard block
 block discarded – undo
5670 5670
                     } else {
5671 5671
                         $tip_visibility = get_lang('Hide');
5672 5672
                     }
5673
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;' . $visibility_command . '=' . $id . '&amp;' . $sort_params . '">' .
5674
-                        Display::return_icon($visibility_icon . '.png', $tip_visibility, '', ICON_SIZE_SMALL) . '</a>';
5673
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;'.$visibility_command.'='.$id.'&amp;'.$sort_params.'">'.
5674
+                        Display::return_icon($visibility_icon.'.png', $tip_visibility, '', ICON_SIZE_SMALL).'</a>';
5675 5675
                 }
5676 5676
             }
5677 5677
 
5678 5678
             // Delete button
5679 5679
             if (in_array($path, DocumentManager::get_system_folders())) {
5680
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5680
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5681 5681
             } else {
5682 5682
                 $titleToShow = addslashes(basename($document_data['title']));
5683 5683
 
@@ -5685,23 +5685,23 @@  discard block
 block discarded – undo
5685 5685
                     $_GET['curdirpath'] == '/certificates' &&
5686 5686
                     DocumentManager::get_default_certificate_id(api_get_course_id()) == $id
5687 5687
                 ) {
5688
-                    $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 . '\');">' .
5689
-                        Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5688
+                    $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.'\');">'.
5689
+                        Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5690 5690
                 } else {
5691 5691
                     if ($is_certificate_mode) {
5692
-                        $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 . '\');">' .
5693
-                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5692
+                        $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.'\');">'.
5693
+                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5694 5694
                     } else {
5695 5695
                         if (api_get_session_id()) {
5696 5696
                             if ($document_data['session_id'] == api_get_session_id()) {
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
-                                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5700
+                                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5701 5701
                             }
5702 5702
                         } else {
5703
-                            $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. '\');">' .
5704
-                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5703
+                            $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.'\');">'.
5704
+                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5705 5705
                         }
5706 5706
                     }
5707 5707
                 }
@@ -5713,15 +5713,15 @@  discard block
 block discarded – undo
5713 5713
                 // nothing to do
5714 5714
             } else {
5715 5715
                 if ($usePpt2lp && $formatType) {
5716
-                    $modify_icons .= '&nbsp;<a class="convertAction" href="#" ' .
5717
-                        'data-documentId = ' . $document_id .
5718
-                        ' data-formatType = ' . $formatType . '>' .
5716
+                    $modify_icons .= '&nbsp;<a class="convertAction" href="#" '.
5717
+                        'data-documentId = '.$document_id.
5718
+                        ' data-formatType = '.$formatType.'>'.
5719 5719
                         Display::return_icon(
5720 5720
                             'convert.png',
5721 5721
                             get_lang('Convert'),
5722 5722
                             array(),
5723 5723
                             ICON_SIZE_SMALL
5724
-                        ) . '</a>';
5724
+                        ).'</a>';
5725 5725
                 }
5726 5726
             }
5727 5727
         }
@@ -5729,8 +5729,8 @@  discard block
 block discarded – undo
5729 5729
         if ($type == 'file' && ($extension == 'html' || $extension == 'htm')) {
5730 5730
             if ($is_template == 0) {
5731 5731
                 if ((isset($_GET['curdirpath']) && $_GET['curdirpath'] != '/certificates') || !isset($_GET['curdirpath'])) {
5732
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;add_as_template=' . $id .  '&amp;' . $sort_params . '">' .
5733
-                        Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL) . '</a>';
5732
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;add_as_template='.$id.'&amp;'.$sort_params.'">'.
5733
+                        Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL).'</a>';
5734 5734
                 }
5735 5735
                 if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course
5736 5736
                     $visibility_icon_certificate = 'nocertificate';
@@ -5744,20 +5744,20 @@  discard block
 block discarded – undo
5744 5744
                         $certificate = get_lang('NoDefaultCertificate');
5745 5745
                     }
5746 5746
                     if (isset($_GET['selectcat'])) {
5747
-                        $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 . '">
5748
-                    <img src="../img/' . $visibility_icon_certificate . '.png" border="0" title="' . $certificate . '" alt="" /></a>';
5747
+                        $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.'">
5748
+                    <img src="../img/' . $visibility_icon_certificate.'.png" border="0" title="'.$certificate.'" alt="" /></a>';
5749 5749
                         if ($is_preview) {
5750
-                            $modify_icons .= '&nbsp;<a target="_blank"  href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;set_preview=' . $id . '&amp;' . $sort_params . '" >' .
5751
-                                Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL) . '</a>';
5750
+                            $modify_icons .= '&nbsp;<a target="_blank"  href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;set_preview='.$id.'&amp;'.$sort_params.'" >'.
5751
+                                Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL).'</a>';
5752 5752
                         }
5753 5753
                     }
5754 5754
                 }
5755 5755
             } else {
5756
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&amp;remove_as_template=' . $id. '&amp;' . $sort_params . '">' .
5757
-                    Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL) . '</a>';
5756
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;remove_as_template='.$id.'&amp;'.$sort_params.'">'.
5757
+                    Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL).'</a>';
5758 5758
             }
5759
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $id . '">' .
5760
-                Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a>';
5759
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$id.'">'.
5760
+                Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a>';
5761 5761
         }
5762 5762
         return $modify_icons;
5763 5763
     }
@@ -5826,7 +5826,7 @@  discard block
 block discarded – undo
5826 5826
                     // 3. inside a subfolder of the folder you want to move
5827 5827
                     if (($curdirpath != $folder) &&
5828 5828
                         ($folder != $move_file) &&
5829
-                        (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/')
5829
+                        (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')
5830 5830
                     ) {
5831 5831
                         $path_displayed = $folder;
5832 5832
                         // If document title is used, we have to display titles instead of real paths...
@@ -5843,7 +5843,7 @@  discard block
 block discarded – undo
5843 5843
             foreach ($folders as $folder) {
5844 5844
                 if (($curdirpath != $folder) &&
5845 5845
                     ($folder != $move_file) &&
5846
-                    (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/')
5846
+                    (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')
5847 5847
                 ) {
5848 5848
                     // Cannot copy dir into his own subdir
5849 5849
                     $path_displayed = DocumentManager::get_titles_of_path($folder);
@@ -5885,10 +5885,10 @@  discard block
 block discarded – undo
5885 5885
                 // If this path has soon been stored here we don't need a new query
5886 5886
                 $path_displayed .= $tmp_folders_titles[$tmp_path];
5887 5887
             } else {
5888
-                $sql = 'SELECT title FROM ' . Database::get_course_table(TABLE_DOCUMENT) . '
5889
-                    WHERE c_id = ' . $course_id . ' AND path LIKE BINARY "' . $tmp_path . '"';
5888
+                $sql = 'SELECT title FROM '.Database::get_course_table(TABLE_DOCUMENT).'
5889
+                    WHERE c_id = ' . $course_id.' AND path LIKE BINARY "'.$tmp_path.'"';
5890 5890
                 $rs = Database::query($sql);
5891
-                $tmp_title = '/' . Database::result($rs, 0, 0);
5891
+                $tmp_title = '/'.Database::result($rs, 0, 0);
5892 5892
                 $path_displayed .= $tmp_title;
5893 5893
                 $tmp_folders_titles[$tmp_path] = $tmp_title;
5894 5894
             }
@@ -5924,7 +5924,7 @@  discard block
 block discarded – undo
5924 5924
         $clean_curdirpath = Security::remove_XSS($curdirpath);
5925 5925
         if ($clean_curdirpath == '/shared_folder') {
5926 5926
             return true;
5927
-        } elseif ($clean_curdirpath == '/shared_folder_session_' . $current_session_id) {
5927
+        } elseif ($clean_curdirpath == '/shared_folder_session_'.$current_session_id) {
5928 5928
             return true;
5929 5929
         } else {
5930 5930
             return false;
@@ -5940,7 +5940,7 @@  discard block
 block discarded – undo
5940 5940
         $clean_path = Security::remove_XSS($path);
5941 5941
         if (strpos($clean_path, 'shared_folder/sf_user_')) {
5942 5942
             return true;
5943
-        } elseif (strpos($clean_path, 'shared_folder_session_' . $current_session_id . '/sf_user_')) {
5943
+        } elseif (strpos($clean_path, 'shared_folder_session_'.$current_session_id.'/sf_user_')) {
5944 5944
             return true;
5945 5945
         } else {
5946 5946
             return false;
@@ -5953,11 +5953,11 @@  discard block
 block discarded – undo
5953 5953
      */
5954 5954
     public static function is_my_shared_folder($user_id, $path, $current_session_id)
5955 5955
     {
5956
-        $clean_path = Security::remove_XSS($path) . '/';
5956
+        $clean_path = Security::remove_XSS($path).'/';
5957 5957
         //for security does not remove the last slash
5958
-        $main_user_shared_folder = '/shared_folder\/sf_user_' . $user_id . '\//';
5958
+        $main_user_shared_folder = '/shared_folder\/sf_user_'.$user_id.'\//';
5959 5959
         //for security does not remove the last slash
5960
-        $main_user_shared_folder_session = '/shared_folder_session_' . $current_session_id . '\/sf_user_' . $user_id . '\//';
5960
+        $main_user_shared_folder_session = '/shared_folder_session_'.$current_session_id.'\/sf_user_'.$user_id.'\//';
5961 5961
 
5962 5962
         if (preg_match($main_user_shared_folder, $clean_path)) {
5963 5963
             return true;
@@ -6230,7 +6230,7 @@  discard block
 block discarded – undo
6230 6230
                 ON (i.c_id = d.c_id)
6231 6231
                 WHERE
6232 6232
                     d.id = i.ref AND
6233
-                    i.tool = '" . TOOL_DOCUMENT . "'
6233
+                    i.tool = '".TOOL_DOCUMENT."'
6234 6234
                     $conditionSession AND
6235 6235
                     i.c_id = $courseId AND
6236 6236
                     d.c_id = $courseId ";
@@ -6238,9 +6238,9 @@  discard block
 block discarded – undo
6238 6238
         $result = Database::query($sql);
6239 6239
         $documents = Database::store_result($result, 'ASSOC');
6240 6240
         if ($documents) {
6241
-            $course_dir = $courseInfo['directory'] . '/document';
6241
+            $course_dir = $courseInfo['directory'].'/document';
6242 6242
             $sys_course_path = api_get_path(SYS_COURSE_PATH);
6243
-            $base_work_dir = $sys_course_path . $course_dir;
6243
+            $base_work_dir = $sys_course_path.$course_dir;
6244 6244
 
6245 6245
             foreach ($documents as $document) {
6246 6246
                 $documentId = $document['id'];
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/FormValidator.class.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $renderer->setHeaderTemplate('<legend>{header}</legend>');
100 100
 
101 101
         //Set required field template
102
-        $this->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>');
102
+        $this->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>');
103 103
         $noteTemplate = <<<EOT
104 104
 	<div class="form-group">
105 105
 		<div class="col-sm-offset-2 col-sm-10">{requiredNote}</div>
@@ -851,9 +851,9 @@  discard block
 block discarded – undo
851 851
             $label = get_lang('PleaseStandBy');
852 852
         }
853 853
         $this->with_progress_bar = true;
854
-        $this->updateAttributes("onsubmit=\"javascript: myUpload.start('dynamic_div','".Display::returnIconPath('progress_bar.gif')."','" . $label . "','" . $this->getAttribute('id') . "')\"");
855
-        $this->addElement('html', '<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>');
856
-        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . (abs(intval($delay)) * 1000) . ');</script>');
854
+        $this->updateAttributes("onsubmit=\"javascript: myUpload.start('dynamic_div','".Display::returnIconPath('progress_bar.gif')."','".$label."','".$this->getAttribute('id')."')\"");
855
+        $this->addElement('html', '<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>');
856
+        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload('.(abs(intval($delay)) * 1000).');</script>');
857 857
     }
858 858
 
859 859
     /**
@@ -870,11 +870,11 @@  discard block
 block discarded – undo
870 870
             return;
871 871
         }
872 872
 
873
-        $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH) . 'upload.xajax.php');
873
+        $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH).'upload.xajax.php');
874 874
 
875 875
         $xajax_upload->registerFunction('updateProgress');
876 876
         // IMPORTANT : must be the first element of the form
877
-        $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="' . $upload_id . '" />'), $element_after);
877
+        $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="'.$upload_id.'" />'), $element_after);
878 878
 
879 879
         $this->addElement('html', '<br />');
880 880
 
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
         $this->addElement(
883 883
             'html',
884 884
             '<div id="dynamic_div_container" style="display:none">
885
-                <div id="dynamic_div_label">' . get_lang('UploadFile') . '</div>
885
+                <div id="dynamic_div_label">' . get_lang('UploadFile').'</div>
886 886
                 <div id="dynamic_div_frame" style="width:214px; height:12px; border:1px solid grey; background-image:url(' . Display::returnIconPath('real_upload_frame.gif').');">
887 887
                     <div id="dynamic_div_filled" style="width:0%;height:100%;background-image:url(' . Display::returnIconPath('real_upload_step.gif').');background-repeat:repeat-x;background-position:center;"></div>
888 888
                 </div>
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
             $this->addElement('html', '
894 894
 			<div id="dynamic_div_waiter_container" style="display:none">
895 895
 				<div id="dynamic_div_waiter_label">
896
-					' . get_lang('SlideshowConversion') . '
896
+					' . get_lang('SlideshowConversion').'
897 897
 				</div>
898 898
 				<div id="dynamic_div_waiter_frame">
899 899
 					'.Display::return_icon('real_upload_frame.gif').'
@@ -903,18 +903,18 @@  discard block
 block discarded – undo
903 903
         }
904 904
 
905 905
         // Get the xajax code
906
-        $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH) . 'xajax'));
906
+        $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH).'xajax'));
907 907
 
908 908
         // Get the upload code
909
-        $this->addElement('html', '<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>');
910
-        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . (abs(intval($delay)) * 1000) . ');</script>');
909
+        $this->addElement('html', '<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>');
910
+        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload('.(abs(intval($delay)) * 1000).');</script>');
911 911
 
912 912
         if (!$wait_after_upload) {
913 913
             $wait_after_upload = 0;
914 914
         }
915 915
 
916 916
         // Add the upload event
917
-        $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','" . $upload_id . "','" . $this->getAttribute('id') . "'," . $wait_after_upload . ")\"");
917
+        $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','".$upload_id."','".$this->getAttribute('id')."',".$wait_after_upload.")\"");
918 918
     }
919 919
 
920 920
     /**
Please login to merge, or discard this patch.
main/inc/lib/display.lib.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param string Optional help file name
56 56
      * @param string $page_header
57 57
      */
58
-    public static function display_header($tool_name ='', $help = null, $page_header = null)
58
+    public static function display_header($tool_name = '', $help = null, $page_header = null)
59 59
     {
60 60
         $origin = api_get_origin();
61 61
         $showHeader = true;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $grid_class = array(),
352 352
         $elementCount = 0
353 353
     ) {
354
-        $column =  0;
354
+        $column = 0;
355 355
         $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
356 356
 
357 357
         $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      * @param bool	Filter (true) or not (false)
477 477
      * @return void
478 478
      */
479
-    public static function display_confirmation_message ($message, $filter = true, $returnValue = false)
479
+    public static function display_confirmation_message($message, $filter = true, $returnValue = false)
480 480
     {
481 481
         $message = self::return_message($message, 'confirm', $filter);
482 482
         if ($returnValue) {
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      * @param bool	Filter (true) or not (false)
494 494
      * @return void
495 495
      */
496
-    public static function display_error_message ($message, $filter = true, $returnValue = false)
496
+    public static function display_error_message($message, $filter = true, $returnValue = false)
497 497
     {
498 498
         $message = self::return_message($message, 'error', $filter);
499 499
         if ($returnValue) {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
      * @param string $type
509 509
      * @param bool $filter
510 510
      */
511
-    public static function return_message_and_translate($message, $type='normal', $filter = true)
511
+    public static function return_message_and_translate($message, $type = 'normal', $filter = true)
512 512
     {
513 513
         $message = get_lang($message);
514 514
         echo self::return_message($message, $type, $filter);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         }
533 533
 
534 534
         $class = "";
535
-        switch($type) {
535
+        switch ($type) {
536 536
             case 'warning':
537 537
                $class .= 'alert alert-warning';
538 538
                break;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
      * @param string  optional, class from stylesheet
561 561
      * @return string encrypted mailto hyperlink
562 562
      */
563
-    public static function encrypted_mailto_link ($email, $clickable_text = null, $style_class = '')
563
+    public static function encrypted_mailto_link($email, $clickable_text = null, $style_class = '')
564 564
     {
565 565
         if (is_null($clickable_text)) {
566 566
             $clickable_text = $email;
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
         }
576 576
         // Encrypt email
577 577
         $hmail = '';
578
-        for ($i = 0; $i < strlen($email); $i ++) {
578
+        for ($i = 0; $i < strlen($email); $i++) {
579 579
             $hmail .= '&#'.ord($email {
580 580
             $i }).';';
581 581
         }
582 582
         $hclickable_text = null;
583 583
         // Encrypt clickable text if @ is present
584 584
         if (strpos($clickable_text, '@')) {
585
-            for ($i = 0; $i < strlen($clickable_text); $i ++) {
585
+            for ($i = 0; $i < strlen($clickable_text); $i++) {
586 586
                 $hclickable_text .= '&#'.ord($clickable_text {
587 587
                 $i }).';';
588 588
             }
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
         }
615 615
         // Encrypt email
616 616
         $hmail = '';
617
-        for ($i = 0; $i < strlen($email); $i ++) {
617
+        for ($i = 0; $i < strlen($email); $i++) {
618 618
             $hmail .= '&#'.ord($email {
619 619
             $i }).';';
620 620
         }
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
     public static function get_alphabet_options($selected_letter = '')
648 648
     {
649 649
         $result = '';
650
-        for ($i = 65; $i <= 90; $i ++) {
650
+        for ($i = 65; $i <= 90; $i++) {
651 651
             $letter = chr($i);
652 652
             $result .= '<option value="'.$letter.'"';
653 653
             if ($selected_letter == $letter) {
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
     public static function get_numeric_options($min, $max, $selected_num = 0)
669 669
     {
670 670
         $result = '';
671
-        for ($i = $min; $i <= $max; $i ++) {
671
+        for ($i = $min; $i <= $max; $i++) {
672 672
             $result .= '<option value="'.$i.'"';
673 673
             if (is_int($selected_num))
674 674
                 if ($selected_num == $i) {
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
         if (isset($size)) {
742 742
             $size = intval($size);
743
-            $size_extra = $size . '/';
743
+            $size_extra = $size.'/';
744 744
         } else {
745 745
             $size = ICON_SIZE_SMALL;
746 746
         }
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
         $theme = 'themes/chamilo/icons/';
752 752
 
753 753
         if ($loadThemeIcon) {
754
-            $theme = 'themes/' . api_get_visual_theme() . '/icons/';
754
+            $theme = 'themes/'.api_get_visual_theme().'/icons/';
755 755
             // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX
756 756
             if (is_file($alternateCssPath.$theme.$size_extra.$image)) {
757 757
                 $icon = $alternateWebCssPath.$theme.$size_extra.$image;
@@ -768,11 +768,11 @@  discard block
 block discarded – undo
768 768
         // ask for the SVG version directly
769 769
         $testServer = api_get_setting('server_type');
770 770
         if ($testServer == 'test' && $return_only_path == false) {
771
-            $svgImage = substr($image, 0, -3) . 'svg';
772
-            if (is_file($code_path . $theme . 'svg/' . $svgImage)) {
773
-                $icon = $w_code_path . $theme . 'svg/' . $svgImage;
774
-            } elseif (is_file($code_path . 'img/icons/svg/' . $svgImage)) {
775
-                $icon = $w_code_path . 'img/icons/svg/' . $svgImage;
771
+            $svgImage = substr($image, 0, -3).'svg';
772
+            if (is_file($code_path.$theme.'svg/'.$svgImage)) {
773
+                $icon = $w_code_path.$theme.'svg/'.$svgImage;
774
+            } elseif (is_file($code_path.'img/icons/svg/'.$svgImage)) {
775
+                $icon = $w_code_path.'img/icons/svg/'.$svgImage;
776 776
             }
777 777
 
778 778
             if (empty($additional_attributes['height'])) {
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
             }
853 853
         }
854 854
         //some tags don't have this </XXX>
855
-        if (in_array($tag, array('img','input','br'))) {
855
+        if (in_array($tag, array('img', 'input', 'br'))) {
856 856
             $return_value = '<'.$tag.' '.$attribute_list.' />';
857 857
         } else {
858 858
             $return_value = '<'.$tag.' '.$attribute_list.' > '.$content.'</'.$tag.'>';
@@ -905,13 +905,13 @@  discard block
 block discarded – undo
905 905
     public static function input($type, $name, $value, $attributes = array())
906 906
     {
907 907
          if (isset($type)) {
908
-             $attributes['type']= $type;
908
+             $attributes['type'] = $type;
909 909
          }
910 910
          if (isset($name)) {
911
-             $attributes['name']= $name;
911
+             $attributes['name'] = $name;
912 912
          }
913 913
          if (isset($value)) {
914
-             $attributes['value']= $value;
914
+             $attributes['value'] = $value;
915 915
         }
916 916
         return self::tag('input', '', $attributes);
917 917
     }
@@ -944,14 +944,14 @@  discard block
 block discarded – undo
944 944
     ) {
945 945
         $html = '';
946 946
         $extra = '';
947
-        $default_id = 'id="' . $name . '" ';
947
+        $default_id = 'id="'.$name.'" ';
948 948
         foreach ($extra_attributes as $key => $parameter) {
949 949
             if ($key == 'id') {
950 950
                 $default_id = '';
951 951
             }
952
-            $extra .= $key . '="' . $parameter . '" ';
952
+            $extra .= $key.'="'.$parameter.'" ';
953 953
         }
954
-        $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>';
954
+        $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>';
955 955
 
956 956
         if ($show_blank_item) {
957 957
             if (empty($blank_item_text)) {
@@ -959,14 +959,14 @@  discard block
 block discarded – undo
959 959
             } else {
960 960
                 $blank_item_text = Security::remove_XSS($blank_item_text);
961 961
             }
962
-            $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1'));
962
+            $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1'));
963 963
         }
964 964
         if ($values) {
965 965
             foreach ($values as $key => $value) {
966 966
                 if (is_array($value) && isset($value['name'])) {
967 967
                     $value = $value['name'];
968 968
                 }
969
-                $html .= '<option value="' . $key . '"';
969
+                $html .= '<option value="'.$key.'"';
970 970
 
971 971
                 if (is_array($default)) {
972 972
                     foreach ($default as $item) {
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
                     }
982 982
                 }
983 983
 
984
-                $html .= '>' . $value . '</option>';
984
+                $html .= '>'.$value.'</option>';
985 985
             }
986 986
         }
987 987
         $html .= '</select>';
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
      */
1008 1008
     public static function tabs($header_list, $content_list, $id = 'tabs', $attributes = array(), $ul_attributes = array())
1009 1009
     {
1010
-        if (empty($header_list) || count($header_list) == 0 ) {
1010
+        if (empty($header_list) || count($header_list) == 0) {
1011 1011
             return '';
1012 1012
         }
1013 1013
 
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 
1045 1045
         $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes);
1046 1046
 
1047
-        return $main_div ;
1047
+        return $main_div;
1048 1048
     }
1049 1049
 
1050 1050
     /**
@@ -1092,8 +1092,8 @@  discard block
 block discarded – undo
1092 1092
      */
1093 1093
     public static function grid_html($div_id)
1094 1094
     {
1095
-        $table  = self::tag('table','', array('id' => $div_id));
1096
-        $table .= self::tag('div','', array('id' => $div_id.'_pager'));
1095
+        $table  = self::tag('table', '', array('id' => $div_id));
1096
+        $table .= self::tag('div', '', array('id' => $div_id.'_pager'));
1097 1097
         return $table;
1098 1098
     }
1099 1099
 
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
         $obj->colNames      = $column_names;
1155 1155
         $obj->colModel      = $column_model;
1156 1156
         $obj->pager         = '#'.$div_id.'_pager';
1157
-        $obj->datatype  = 'json';
1157
+        $obj->datatype = 'json';
1158 1158
         $obj->viewrecords = 'true';
1159 1159
 
1160 1160
         $all_value = 10000000;
@@ -1215,10 +1215,10 @@  discard block
 block discarded – undo
1215 1215
         // Adding static data.
1216 1216
         if (!empty($data)) {
1217 1217
             $data_var = $div_id.'_data';
1218
-            $json.=' var '.$data_var.' = '.json_encode($data).';';
1218
+            $json .= ' var '.$data_var.' = '.json_encode($data).';';
1219 1219
             $obj->data = $data_var;
1220 1220
             $obj->datatype = 'local';
1221
-            $json.="\n";
1221
+            $json .= "\n";
1222 1222
         }
1223 1223
 
1224 1224
         $obj->end = 'end';
@@ -1232,12 +1232,12 @@  discard block
 block discarded – undo
1232 1232
         }
1233 1233
 
1234 1234
         // Fixing true/false js values that doesn't need the ""
1235
-        $json_encode = str_replace(':"true"',':true',$json_encode);
1235
+        $json_encode = str_replace(':"true"', ':true', $json_encode);
1236 1236
         // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text
1237 1237
         $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode);
1238
-        $json_encode = str_replace(':"false"',':false',$json_encode);
1238
+        $json_encode = str_replace(':"false"', ':false', $json_encode);
1239 1239
         $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode);
1240
-        $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode);
1240
+        $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode);
1241 1241
 
1242 1242
         // Creating the jqgrid element.
1243 1243
         $json .= '$("#'.$div_id.'").jqGrid({';
@@ -1252,22 +1252,22 @@  discard block
 block discarded – undo
1252 1252
             $groups = '';
1253 1253
             foreach ($extra_params['groupHeaders'] as $group) {
1254 1254
                 //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" },
1255
-                $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText']  . '" },';
1255
+                $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },';
1256 1256
 
1257 1257
             }
1258 1258
             $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", {
1259 1259
                 "useColSpanStyle" : false,
1260 1260
                 "groupHeaders"    : [
1261
-                    ' . $groups . '
1261
+                    ' . $groups.'
1262 1262
                 ]
1263 1263
             });';
1264 1264
         }
1265 1265
 
1266 1266
         $all_text = addslashes(get_lang('All'));
1267 1267
         $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");';
1268
-        $json.= "\n";
1268
+        $json .= "\n";
1269 1269
         // Adding edit/delete icons.
1270
-        $json.= $formatter;
1270
+        $json .= $formatter;
1271 1271
 
1272 1272
         return $json;
1273 1273
     }
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
         }
1299 1299
 
1300 1300
         if (!empty($rows)) {
1301
-	        foreach($rows as $content) {
1301
+	        foreach ($rows as $content) {
1302 1302
 	            $table->setCellContents($row, $column, $content);
1303 1303
                 $row++;
1304 1304
             }
@@ -1460,7 +1460,7 @@  discard block
 block discarded – undo
1460 1460
 
1461 1461
         // Show all tool icons where there is something new.
1462 1462
         $return = '&nbsp;';
1463
-        foreach($notifications as $notification) {
1463
+        foreach ($notifications as $notification) {
1464 1464
             $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date']));
1465 1465
             $type = $notification['lastedit_type'];
1466 1466
             $label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)";
@@ -1503,9 +1503,9 @@  discard block
 block discarded – undo
1503 1503
             $tbl_session            = Database :: get_main_table(TABLE_MAIN_SESSION);
1504 1504
             $active = false;
1505 1505
             // Request for the name of the general coach
1506
-            $sql ='SELECT tu.lastname, tu.firstname, ts.*
1506
+            $sql = 'SELECT tu.lastname, tu.firstname, ts.*
1507 1507
                     FROM '.$tbl_session.' ts
1508
-                    LEFT JOIN '.$main_user_table .' tu
1508
+                    LEFT JOIN '.$main_user_table.' tu
1509 1509
                     ON ts.id_coach = tu.user_id
1510 1510
                     WHERE ts.id = '.intval($session_id);
1511 1511
             $rs = Database::query($sql);
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
             $session = array();
1516 1516
             $session['title'] = $session_info['name'];
1517 1517
             $session['coach'] = '';
1518
-            $session['dates'] =  '';
1518
+            $session['dates'] = '';
1519 1519
 
1520 1520
             if (
1521 1521
                 (
@@ -1597,8 +1597,8 @@  discard block
 block discarded – undo
1597 1597
                     );
1598 1598
                 }
1599 1599
 
1600
-                if ( api_get_setting('show_session_coach') === 'true' ) {
1601
-                    $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name(
1600
+                if (api_get_setting('show_session_coach') === 'true') {
1601
+                    $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name(
1602 1602
                         $session_info['firstname'],
1603 1603
                         $session_info['lastname']
1604 1604
                     );
@@ -1650,9 +1650,9 @@  discard block
 block discarded – undo
1650 1650
 		$percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1651 1651
 
1652 1652
 		if (!empty($percentage)) {
1653
-            $percentage = $percentage*125/100;
1653
+            $percentage = $percentage * 125 / 100;
1654 1654
         }
1655
-		$accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1655
+		$accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1656 1656
 
1657 1657
 		$star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1658 1658
 
@@ -1667,19 +1667,19 @@  discard block
 block discarded – undo
1667 1667
 
1668 1668
 		$labels = array();
1669 1669
 
1670
-		$labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1671
-		$labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1670
+		$labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1671
+		$labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1672 1672
 		if (!empty($number_of_users_who_voted)) {
1673
-			$labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1673
+			$labels[] = get_lang('Average').' '.$point_info['point_average_star'].'/5';
1674 1674
 		}
1675 1675
 
1676
-		$labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1676
+		$labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] ';
1677 1677
 
1678 1678
 		if (!$add_div_wrapper && api_is_anonymous()) {
1679
-			$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1679
+			$labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1680 1680
 		}
1681 1681
 
1682
-        $html .= Display::div(implode(' | ', $labels) , array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1682
+        $html .= Display::div(implode(' | ', $labels), array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1683 1683
         $html .= ' '.Display::span(' ', array('id' =>  'vote_label2_'.$id));
1684 1684
 
1685 1685
         if ($add_div_wrapper) {
@@ -1757,8 +1757,8 @@  discard block
 block discarded – undo
1757 1757
         if (!empty($list)) {
1758 1758
             $html = '<dl class="dl-horizontal">';
1759 1759
             foreach ($list as $item) {
1760
-                $html .= '<dt>' . $item['title'] . '</dt>';
1761
-                $html .= '<dd>' . $item['content'] . '</dd>';
1760
+                $html .= '<dt>'.$item['title'].'</dt>';
1761
+                $html .= '<dd>'.$item['content'].'</dd>';
1762 1762
             }
1763 1763
             $html .= '</dl>';
1764 1764
         }
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
      * @param string $type
1801 1801
      * @return null|string
1802 1802
      */
1803
-    public static function badge($count, $type ="warning")
1803
+    public static function badge($count, $type = "warning")
1804 1804
     {
1805 1805
         $class = '';
1806 1806
 
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
         if (!empty($content)) {
1877 1877
             $html = '<span class="label '.$class.'">';
1878 1878
             $html .= $content;
1879
-            $html .='</span>';
1879
+            $html .= '</span>';
1880 1880
         }
1881 1881
 
1882 1882
         return $html;
@@ -1897,7 +1897,7 @@  discard block
 block discarded – undo
1897 1897
                     $class = 'class ="active"';
1898 1898
                 }
1899 1899
 
1900
-                if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) {
1900
+                if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) {
1901 1901
                     $class = 'class ="active"';
1902 1902
                 }
1903 1903
                 $html .= "<li $class >";
@@ -2113,7 +2113,7 @@  discard block
 block discarded – undo
2113 2113
      */
2114 2114
     public static function getVCardUserLink($userId)
2115 2115
     {
2116
-        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);;
2116
+        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId); ;
2117 2117
 
2118 2118
         return $vCardUrl;
2119 2119
     }
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
     {
2132 2132
         $title = !empty($title) ? '<div class="panel-heading"><h3 class="panel-title">'.$title.'</h3>'.$extra.'</div>' : '';
2133 2133
         $footer = !empty($footer) ? '<div class="panel-footer ">'.$footer.'</div>' : '';
2134
-        $styles = ['primary','success','info','warning','danger'];
2134
+        $styles = ['primary', 'success', 'info', 'warning', 'danger'];
2135 2135
         $style = !in_array($style, $styles) ? 'default' : $style;
2136 2136
 
2137 2137
         return '
@@ -2176,7 +2176,7 @@  discard block
 block discarded – undo
2176 2176
         $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass;
2177 2177
 
2178 2178
         if (!$includeText) {
2179
-            $text = '<span class="sr-only">' . $text . '</span>';
2179
+            $text = '<span class="sr-only">'.$text.'</span>';
2180 2180
         }
2181 2181
 
2182 2182
         return self::url("$icon $text", $url, $attributes);
@@ -2191,16 +2191,16 @@  discard block
 block discarded – undo
2191 2191
      */
2192 2192
     public static function toolbarAction($id, $content = array(), $col = 2, $right = true)
2193 2193
     {
2194
-        $columns = 12/$col;
2194
+        $columns = 12 / $col;
2195 2195
         $html = '';
2196
-        $html .= '<div id="' . $id . '" class="actions">';
2196
+        $html .= '<div id="'.$id.'" class="actions">';
2197 2197
         $html .= '<div class="row">';
2198 2198
         if ($col > 4) {
2199 2199
             $html = '<div class="alert alert-warning" role="alert">Action toolbar design does not work when exceeding four columns - check Display::toolbarAction()</div>';
2200 2200
         } else {
2201
-            for ( $i = 0; $i < $col; $i++ ) {
2202
-                $html .= '<div class="col-md-' . $columns . '">';
2203
-                if ( $col == 2 && $i == 1 ) {
2201
+            for ($i = 0; $i < $col; $i++) {
2202
+                $html .= '<div class="col-md-'.$columns.'">';
2203
+                if ($col == 2 && $i == 1) {
2204 2204
                     if ($right === true) {
2205 2205
                         $html .= '<div class="pull-right">';
2206 2206
                         $html .= (isset($content[$i]) ? $content[$i] : '');
@@ -2315,9 +2315,9 @@  discard block
 block discarded – undo
2315 2315
             $params['class'] = 'panel panel-default';
2316 2316
             $html = null;
2317 2317
             if (!empty($title)) {
2318
-                $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL;
2318
+                $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL;
2319 2319
             }
2320
-            $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
2320
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
2321 2321
             $html = Display::div($html, $params);
2322 2322
         }
2323 2323
         return $html;
Please login to merge, or discard this patch.
main/document/slideshow.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 if ($slide_id != 'all') {
65 65
 	$image = null;
66 66
 	if (isset($image_files_only[$slide])) {
67
-		$image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide];
67
+		$image = $sys_course_path.$_course['path'].'/document'.$folder.$image_files_only[$slide];
68 68
 	}
69 69
 	if (file_exists($image)) {
70 70
 		echo '<div class="actions-pagination">';
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             $last = Display::return_icon('action_last_na.png', get_lang('LastSlide'));
106 106
 		} else {
107 107
 			$imgn = 'action_next.png';
108
-			$last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'">
108
+			$last = '<a href="slideshow.php?slide_id='.($total_slides - 1).'&curdirpath='.$pathurl.'">
109 109
 			        '.Display::return_icon('action_last.png', get_lang('LastSlide')).'
110 110
                 </a>';
111 111
 		}
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 
123 123
 // Exit the slideshow
124 124
 echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
125
-    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
125
+    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
126 126
 
127 127
 // Show thumbnails
128 128
 if ($slide_id != 'all') {
129 129
 	echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
130
-        Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>';
130
+        Display::return_icon('thumbnails.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM).'</a>';
131 131
 } else {
132
-	echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM);
132
+	echo Display::return_icon('thumbnails_na.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM);
133 133
 }
134 134
 // Slideshow options
135 135
 echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
136
-    Display::return_icon('settings.png', get_lang('SetSlideshowOptions'),'',ICON_SIZE_MEDIUM).'</a>';
136
+    Display::return_icon('settings.png', get_lang('SetSlideshowOptions'), '', ICON_SIZE_MEDIUM).'</a>';
137 137
 
138 138
 echo '</div>';
139 139
 echo '<br />';
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 }
158 158
 $target_width = $target_height = null;
159 159
 // The target height and width depends if we choose resizing or no resizing
160
-if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == "resizing") {
160
+if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") {
161 161
 	$target_width = $_SESSION["image_resizing_width"];
162 162
 	$target_height = $_SESSION["image_resizing_height"];
163 163
 }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 /*	THUMBNAIL VIEW */
166 166
 
167 167
 // This is for viewing all the images in the slideshow as thumbnails.
168
-$image_tag = array ();
168
+$image_tag = array();
169 169
 $html = '';
170 170
 if ($slide_id == 'all') {
171 171
 
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
 	$max_thumbnail_width     = 250;
175 175
 	$max_thumbnail_height    = 250;
176 176
 	$png_compression	     = 0; // 0(none)-9
177
-	$jpg_quality  	         = 75; // from 0 to 100 (default is 75). More quality less compression
177
+	$jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression
178 178
 
179 179
 	$directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
180 180
 
181 181
 	//Other parameters only for show tumbnails
182
-	$row_items 			     = 4;//only in slideshow.php
183
-	$number_image 			 = 7;//num icons cols to show
184
-	$thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x
182
+	$row_items = 4; //only in slideshow.php
183
+	$number_image = 7; //num icons cols to show
184
+	$thumbnail_width_frame = $max_thumbnail_width; //optional $max_thumbnail_width+x
185 185
 	$thumbnail_height_frame = $max_thumbnail_height;
186 186
 
187 187
 	// Create the template_thumbnails folder (if no exist)
@@ -195,20 +195,20 @@  discard block
 block discarded – undo
195 195
 
196 196
 		foreach ($image_files_only as $one_image_file) {
197 197
 			$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
198
-			$image_thumbnail= $directory_thumbnails.'.'.$one_image_file;
198
+			$image_thumbnail = $directory_thumbnails.'.'.$one_image_file;
199 199
 
200 200
 			if (file_exists($image)) {
201 201
 				//check thumbnail
202 202
 				$imagetype = explode(".", $image);
203 203
                 //or check $imagetype = image_type_to_extension(exif_imagetype($image), false);
204
-				$imagetype = strtolower($imagetype[count($imagetype)-1]);
204
+				$imagetype = strtolower($imagetype[count($imagetype) - 1]);
205 205
 
206
-				if (in_array($imagetype,$allowed_thumbnail_types)) {
207
-					if (!file_exists($image_thumbnail)){
206
+				if (in_array($imagetype, $allowed_thumbnail_types)) {
207
+					if (!file_exists($image_thumbnail)) {
208 208
                         //run each once we view thumbnails is too heavy, then need move into  !file_exists($image_thumbnail, and only run when haven't the thumbnail
209 209
 						$original_image_size = api_getimagesize($image);
210 210
 
211
-						switch($imagetype) {
211
+						switch ($imagetype) {
212 212
 							case 'gif':
213 213
 								$source_img = imagecreatefromgif($image);
214 214
 								break;
@@ -229,17 +229,17 @@  discard block
 block discarded – undo
229 229
                             $max_thumbnail_width,
230 230
                             $max_thumbnail_height
231 231
                         );
232
-						if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){
233
-							$new_thumbnail_size['width']=$original_image_size['width'];
234
-							$new_thumbnail_size['height']=$original_image_size['height'];
232
+						if ($max_thumbnail_width > $original_image_size['width'] && $max_thumbnail_height > $original_image_size['height']) {
233
+							$new_thumbnail_size['width'] = $original_image_size['width'];
234
+							$new_thumbnail_size['height'] = $original_image_size['height'];
235 235
 						}
236 236
 
237 237
 						$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
238 238
 
239 239
 						// preserve transparency
240
-						if ($imagetype == "png"){
240
+						if ($imagetype == "png") {
241 241
 							imagesavealpha($crop, true);
242
-							$color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
242
+							$color = imagecolorallocatealpha($crop, 0x00, 0x00, 0x00, 127);
243 243
 							imagefill($crop, 0, 0, $color);
244 244
 						}
245 245
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 							$transindex = imagecolortransparent($source_img);
248 248
                             $palletsize = imagecolorstotal($source_img);
249 249
 							 //GIF89a for transparent and anim (first clip), either GIF87a
250
-							 if ($transindex >= 0 && $transindex < $palletsize){
250
+							 if ($transindex >= 0 && $transindex < $palletsize) {
251 251
 								 $transcol = imagecolorsforindex($source_img, $transindex);
252 252
 								 $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
253 253
 								 imagefill($crop, 0, 0, $transindex);
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
 
272 272
 						switch ($imagetype) {
273 273
 							case 'gif':
274
-								imagegif($crop,$image_thumbnail);
274
+								imagegif($crop, $image_thumbnail);
275 275
 								break;
276 276
 							case 'jpg':
277
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
277
+								imagejpeg($crop, $image_thumbnail, $jpg_quality);
278 278
 								break;
279 279
 							case 'jpeg':
280
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
280
+								imagejpeg($crop, $image_thumbnail, $jpg_quality);
281 281
 								break;
282 282
 							case 'png':
283
-								imagepng($crop,$image_thumbnail,$png_compression);
283
+								imagepng($crop, $image_thumbnail, $png_compression);
284 284
 								break;
285 285
 						}
286 286
 
@@ -290,26 +290,26 @@  discard block
 block discarded – undo
290 290
 
291 291
 					//show thumbnail and link
292 292
 
293
-					$one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
293
+					$one_image_thumbnail_file = '.thumbs/.'.$one_image_file; //get path thumbnail
294 294
 					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
295 295
 					$image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
296 296
 				} else {
297 297
 					//if images aren't support by gd (not gif, jpg, jpeg, png)
298
-					if ($imagetype=="bmp") {
298
+					if ($imagetype == "bmp") {
299 299
                         // use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy
300 300
 						$original_image_size = getimagesize($image);
301
-						if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){
302
-							$thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files
301
+						if ($max_thumbnail_width < $original_image_size[0] || $max_thumbnail_height < $original_image_size[1]) {
302
+							$thumbnail_size = api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height); //don't use resize_image because doesn't run with bmp files
303 303
 							$image_height = $thumbnail_size['height'];
304 304
 							$image_width  = $thumbnail_size['width'];
305 305
 						} else {
306
-							$image_height=$original_image_size[0];
307
-							$image_width=$original_image_size[1];
306
+							$image_height = $original_image_size[0];
307
+							$image_width = $original_image_size[1];
308 308
 						}
309 309
 					} else {
310 310
 						//example for svg files,...
311
-						$image_width=$max_thumbnail_width;
312
-						$image_height=$max_thumbnail_height;
311
+						$image_width = $max_thumbnail_width;
312
+						$image_height = $max_thumbnail_height;
313 313
 					}
314 314
 
315 315
 					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
 	$i = 0;
327 327
 	$count_image = count($image_tag);
328
-	$number_iteration = ceil($count_image/$number_image);
328
+	$number_iteration = ceil($count_image / $number_image);
329 329
 	$p = 0;
330 330
     $html = '';
331 331
     $html .= '<div class="gallery">';
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
                             $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">';
338 338
                             $html .= '<div class="frame">';
339 339
                             $html .= '<div class="photo">';
340
-                            $html .=  $image_tag[$p];
340
+                            $html .= $image_tag[$p];
341 341
                             $html .= '</div>';
342 342
                             $html .= '</div>';
343 343
                             $html .= '</a>';
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
 		list($width, $height) = getimagesize($image);
396 396
 		// Auto resize
397
-		if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == 'resizing') {
397
+		if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') {
398 398
 		?>
399 399
 
400 400
 		<script type="text/javascript">
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 				start_height=initial_height;
412 412
 			}
413 413
 
414
-			document.write('<img id="image"  src="<?php echo  'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'"  border="0"  alt="<?php echo $image_files_only[$slide] ;?>">');
414
+			document.write('<img id="image"  src="<?php echo  'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'"  border="0"  alt="<?php echo $image_files_only[$slide]; ?>">');
415 415
 
416 416
 			function resizeImage() {
417 417
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
                 $resize_info = get_lang('Resizing').'<br />';
478 478
                 $resize_width = $_SESSION["image_resizing_width"].' x ';
479 479
                 $resize_height = $_SESSION['image_resizing_height'];
480
-            } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing'){
480
+            } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing') {
481 481
                 $resize_info = get_lang('Resizing').'<br />';
482 482
                 $resize_width = get_lang('Auto').' x ';
483 483
                 $resize_height = get_lang('Auto');
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 
495 495
 			echo $image_files_only[$slide].' <br />';
496 496
 			echo $width.' x '.$height.' <br />';
497
-			echo round((filesize($image)/1024), 2).' KB';
497
+			echo round((filesize($image) / 1024), 2).' KB';
498 498
 			echo ' - '.$ext;
499 499
 			echo '</td>';
500 500
 			echo '</tr>';
Please login to merge, or discard this patch.
main/document/create_paint.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -129,27 +129,27 @@
 block discarded – undo
129 129
 
130 130
 // pixlr
131 131
 // max size 1 Mb ??
132
-$title = urlencode(utf8_encode(get_lang('NewImage')));//TODO:check
132
+$title = urlencode(utf8_encode(get_lang('NewImage'))); //TODO:check
133 133
 //
134 134
 $image = Display::returnIconPath('canvas1024x768.png');
135 135
 //
136 136
 $pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
137
-$langpixlr  = api_get_language_isocode();
137
+$langpixlr = api_get_language_isocode();
138 138
 $langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr;
139
-$loc=$langpixlr;// deprecated ?? TODO:check pixlr read user browser
140
-
141
-$exit_path=api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
142
-$_SESSION['exit_pixlr']=$document_data['path'];
143
-$referrer="Chamilo";
144
-$target_path=api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
145
-$target=$target_path;
146
-$locktarget="true";
147
-$locktitle="false";
148
-
149
-if ($_SERVER['HTTP_HOST']=="localhost") {
150
-	$path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
139
+$loc = $langpixlr; // deprecated ?? TODO:check pixlr read user browser
140
+
141
+$exit_path = api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
142
+$_SESSION['exit_pixlr'] = $document_data['path'];
143
+$referrer = "Chamilo";
144
+$target_path = api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
145
+$target = $target_path;
146
+$locktarget = "true";
147
+$locktitle = "false";
148
+
149
+if ($_SERVER['HTTP_HOST'] == "localhost") {
150
+	$path_and_file = api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
151 151
 	if (!file_exists($path_and_file)) {
152
-		$crossdomain='<?xml version="1.0"?>
152
+		$crossdomain = '<?xml version="1.0"?>
153 153
 			<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
154 154
 			<cross-domain-policy>
155 155
 				<allow-access-from domain="cdn.pixlr.com" />
Please login to merge, or discard this patch.