Completed
Push — 1.11.x ( 78f130...f6f5c2 )
by José
50:40 queued 24:26
created
main/gradebook/lib/GradebookUtils.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@
 block discarded – undo
251 251
                     }
252 252
                 }
253 253
 
254
-               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&' . $courseParams.'">' .
254
+                $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&' . $courseParams.'">' .
255 255
                     Display::return_icon(
256 256
                         'percentage.png',
257 257
                         get_lang('EditAllWeights'),
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -732,7 +732,7 @@
 block discarded – undo
732 732
     }
733 733
 
734 734
     /**
735
-     * @param null $course_code
735
+     * @param string $course_code
736 736
      * @param int $gradebook_model_id
737 737
      * @return mixed
738 738
      */
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
         $course_code = Database::escape_string($course_code);
79 79
         if (!empty($link_id)) {
80 80
             $link_id = intval($link_id);
81
-            $sql = 'UPDATE ' . Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK) . '
82
-                    SET weight = ' . "'" . Database::escape_string((float) $weight) . "'" . '
83
-                    WHERE course_code = "' . $course_code . '" AND id = ' . $link_id;
81
+            $sql = 'UPDATE '.Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK).'
82
+                    SET weight = ' . "'".Database::escape_string((float) $weight)."'".'
83
+                    WHERE course_code = "' . $course_code.'" AND id = '.$link_id;
84 84
             Database::query($sql);
85 85
         }
86 86
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         // TODO find the corresponding category (the first one for this course, ordered by ID)
102 102
         $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
103
-        $sql = "DELETE FROM $l WHERE id = ".(int)$link_id;
103
+        $sql = "DELETE FROM $l WHERE id = ".(int) $link_id;
104 104
         Database::query($sql);
105 105
 
106 106
         return true;
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
             $visibility_icon = ($cat->is_visible() == 0) ? 'invisible' : 'visible';
196 196
             $visibility_command = ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible';
197 197
 
198
-            $modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' .
199
-                Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>';
198
+            $modify_icons .= '<a class="view_children" data-cat-id="'.$cat->get_id().'" href="javascript:void(0);">'.
199
+                Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>';
200 200
 
201 201
             if (!api_is_allowed_to_edit(null, true)) {
202 202
                 $modify_icons .= Display::url(
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
                         '',
207 207
                         ICON_SIZE_SMALL
208 208
                     ),
209
-                    'personal_stats.php?' . http_build_query([
209
+                    'personal_stats.php?'.http_build_query([
210 210
                         'selectcat' => $cat->get_id()
211
-                    ]) . '&' . api_get_cidreq(),
211
+                    ]).'&'.api_get_cidreq(),
212 212
                     [
213 213
                         'class' => 'ajax',
214 214
                         'data-title' => get_lang('FlatView')
@@ -224,16 +224,16 @@  discard block
 block discarded – undo
224 224
                 if (api_get_setting('gradebook_locking_enabled') == 'true') {
225 225
                     if ($cat->is_locked()) {
226 226
                         if (api_is_platform_admin()) {
227
-                            $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToUnlockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=unlock">' .
228
-                                Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . '</a>';
227
+                            $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToUnlockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=unlock">'.
228
+                                Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
229 229
                         } else {
230
-                            $modify_icons .= '&nbsp;<a href="#">' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . '</a>';
230
+                            $modify_icons .= '&nbsp;<a href="#">'.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>';
231 231
                         }
232
-                        $modify_icons .= '&nbsp;<a href="gradebook_flatview.php?export_pdf=category&selectcat=' . $cat->get_id() . '" >' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>';
232
+                        $modify_icons .= '&nbsp;<a href="gradebook_flatview.php?export_pdf=category&selectcat='.$cat->get_id().'" >'.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
233 233
                     } else {
234
-                        $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToLockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=lock">' .
235
-                            Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . '</a>';
236
-                        $modify_icons .= '&nbsp;<a href="#" >' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>';
234
+                        $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToLockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=lock">'.
235
+                            Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
236
+                        $modify_icons .= '&nbsp;<a href="#" >'.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
237 237
                     }
238 238
                 }
239 239
 
@@ -241,44 +241,44 @@  discard block
 block discarded – undo
241 241
                     if ($cat->is_locked() && !api_is_platform_admin()) {
242 242
                         $modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
243 243
                     } else {
244
-                        $modify_icons .= '<a href="gradebook_edit_cat.php?editcat=' . $cat->get_id() . '&'.$courseParams.'">' .
244
+                        $modify_icons .= '<a href="gradebook_edit_cat.php?editcat='.$cat->get_id().'&'.$courseParams.'">'.
245 245
                             Display::return_icon(
246 246
                                 'edit.png',
247 247
                                 get_lang('Modify'),
248 248
                                 '',
249 249
                                 ICON_SIZE_SMALL
250
-                            ) . '</a>';
250
+                            ).'</a>';
251 251
                     }
252 252
                 }
253 253
 
254
-               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&' . $courseParams.'">' .
254
+               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat='.$cat->get_id().'&'.$courseParams.'">'.
255 255
                     Display::return_icon(
256 256
                         'percentage.png',
257 257
                         get_lang('EditAllWeights'),
258 258
                         '',
259 259
                         ICON_SIZE_SMALL
260
-                    ) . '</a>';
260
+                    ).'</a>';
261 261
 
262
-                $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&' . $courseParams. '">' .
262
+                $modify_icons .= '<a href="gradebook_flatview.php?selectcat='.$cat->get_id().'&'.$courseParams.'">'.
263 263
                     Display::return_icon(
264 264
                         'stats.png',
265 265
                         get_lang('FlatView'),
266 266
                         '',
267 267
                         ICON_SIZE_SMALL
268
-                    ) . '</a>';
269
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&' . $courseParams. '">' .
268
+                    ).'</a>';
269
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visiblecat='.$cat->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&'.$courseParams.'">'.
270 270
                     Display::return_icon(
271
-                        $visibility_icon . '.png',
271
+                        $visibility_icon.'.png',
272 272
                         get_lang('Visible'),
273 273
                         '',
274 274
                         ICON_SIZE_SMALL
275
-                    ) . '</a>';
275
+                    ).'</a>';
276 276
 
277 277
                 if ($cat->is_locked() && !api_is_platform_admin()) {
278 278
                     $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL);
279 279
                 } else {
280
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&selectcat=' . $selectcat . '&' . $courseParams. '" onclick="return confirmation();">' .
281
-                        Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>';
280
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deletecat='.$cat->get_id().'&selectcat='.$selectcat.'&'.$courseParams.'" onclick="return confirmation();">'.
281
+                        Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL).'</a>';
282 282
                 }
283 283
             }
284 284
 
@@ -307,22 +307,22 @@  discard block
 block discarded – undo
307 307
             if ($is_locked && !api_is_platform_admin()) {
308 308
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
309 309
             } else {
310
-                $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&' . $courseParams. '">' .
311
-                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
310
+                $modify_icons = '<a href="gradebook_edit_eval.php?editeval='.$eval->get_id().'&'.$courseParams.'">'.
311
+                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
312 312
             }
313 313
 
314
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&'.$courseParams. ' ">' .
315
-                Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
314
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visibleeval='.$eval->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&'.$courseParams.' ">'.
315
+                Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>';
316 316
             if (api_is_allowed_to_edit(null, true)) {
317
-                $modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &' . $courseParams. '">' .
318
-                    Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
317
+                $modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog='.$eval->get_id().'&selectcat='.$selectcat.' &'.$courseParams.'">'.
318
+                    Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>';
319 319
             }
320 320
 
321 321
             if ($is_locked && !api_is_platform_admin()) {
322
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
322
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
323 323
             } else {
324
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &' . $courseParams. '" onclick="return confirmation();">' .
325
-                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
324
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deleteeval='.$eval->get_id().'&selectcat='.$selectcat.' &'.$courseParams.'" onclick="return confirmation();">'.
325
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
326 326
             }
327 327
             return $modify_icons;
328 328
         }
@@ -354,21 +354,21 @@  discard block
 block discarded – undo
354 354
             if ($is_locked && !api_is_platform_admin()) {
355 355
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
356 356
             } else {
357
-                $modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&' . $courseParams.'">' .
358
-                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
357
+                $modify_icons = '<a href="gradebook_edit_link.php?editlink='.$link->get_id().'&'.$courseParams.'">'.
358
+                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
359 359
             }
360
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&'.$courseParams. ' ">' .
361
-                Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
362
-            $modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&selectcat=' . $selectcat . '&' . $courseParams. '">' .
363
-                Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
360
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visiblelink='.$link->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&'.$courseParams.' ">'.
361
+                Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>';
362
+            $modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink='.$link->get_id().'&selectcat='.$selectcat.'&'.$courseParams.'">'.
363
+                Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>';
364 364
 
365 365
             //If a work is added in a gradebook you can only delete the link in the work tool
366 366
 
367 367
             if ($is_locked && !api_is_platform_admin()) {
368
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
368
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
369 369
             } else {
370
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &' . $courseParams. '" onclick="return confirmation();">' .
371
-                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
370
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deletelink='.$link->get_id().'&selectcat='.$selectcat.' &'.$courseParams.'" onclick="return confirmation();">'.
371
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
372 372
             }
373 373
 
374 374
             return $modify_icons;
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
         $sql = "SELECT * FROM $table l
392 392
                 WHERE
393 393
                     course_code = '$course_code' AND
394
-                    type = ".(int)$resource_type . " AND
395
-                    ref_id = " . (int)$resource_id;
394
+                    type = ".(int) $resource_type." AND
395
+                    ref_id = " . (int) $resource_id;
396 396
         $res = Database::query($sql);
397 397
 
398 398
         if (Database::num_rows($res) < 1) {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
         }
416 416
         // TODO find the corresponding category (the first one for this course, ordered by ID)
417 417
         $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
418
-        $sql = "SELECT * FROM $l WHERE id = " . (int) $link_id;
418
+        $sql = "SELECT * FROM $l WHERE id = ".(int) $link_id;
419 419
         $res = Database::query($sql);
420 420
         $row = array();
421 421
         if (Database::num_rows($res) > 0) {
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
     {
434 434
         $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
435 435
         $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
436
-        $sql = 'SELECT c.id FROM ' . $course_table . ' c
437
-                INNER JOIN ' . $tbl_grade_links . ' l
436
+        $sql = 'SELECT c.id FROM '.$course_table.' c
437
+                INNER JOIN ' . $tbl_grade_links.' l
438 438
                 ON c.code = l.course_code
439
-                WHERE l.id=' . intval($id_link) . ' OR l.category_id=' . intval($id_link);
439
+                WHERE l.id=' . intval($id_link).' OR l.category_id='.intval($id_link);
440 440
         $res = Database::query($sql);
441 441
         $array = Database::fetch_array($res, 'ASSOC');
442 442
         return $array['id'];
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
     {
546 546
         $result = Result :: load($resid);
547 547
         if ($importscore > $eval_max) {
548
-            header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&overwritemax=');
548
+            header('Location: gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&overwritemax=');
549 549
             exit;
550 550
         }
551 551
         $result[0]->set_score($importscore);
@@ -589,8 +589,8 @@  discard block
 block discarded – undo
589 589
     {
590 590
         $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
591 591
         $sql = 'SELECT COUNT(*) as count
592
-                FROM ' . $table . ' gc
593
-                WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" ';
592
+                FROM ' . $table.' gc
593
+                WHERE gc.cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'" ';
594 594
         $rs_exist = Database::query($sql);
595 595
         $row = Database::fetch_array($rs_exist);
596 596
         if ($row['count'] == 0) {
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
     public static function get_certificate_by_user_id($cat_id, $user_id)
614 614
     {
615 615
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
616
-        $sql = 'SELECT * FROM ' . $table_certificate . '
617
-                WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"';
616
+        $sql = 'SELECT * FROM '.$table_certificate.'
617
+                WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"';
618 618
 
619 619
         $result = Database::query($sql);
620 620
         $row = Database::fetch_array($result, 'ASSOC');
@@ -633,18 +633,18 @@  discard block
 block discarded – undo
633 633
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
634 634
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
635 635
         $sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username
636
-                FROM ' . $table_user . ' u
637
-                INNER JOIN ' . $table_certificate . ' gc
636
+                FROM ' . $table_user.' u
637
+                INNER JOIN ' . $table_certificate.' gc
638 638
                 ON u.user_id=gc.user_id ';
639 639
         if (!is_null($cat_id) && $cat_id > 0) {
640
-            $sql.=' WHERE cat_id=' . intval($cat_id);
640
+            $sql .= ' WHERE cat_id='.intval($cat_id);
641 641
         }
642 642
         if (!empty($userList)) {
643 643
             $userList = array_map('intval', $userList);
644 644
             $userListCondition = implode("','", $userList);
645 645
             $sql .= " AND u.user_id IN ('$userListCondition')";
646 646
         }
647
-        $sql.=' ORDER BY u.firstname';
647
+        $sql .= ' ORDER BY u.firstname';
648 648
         $rs = Database::query($sql);
649 649
 
650 650
         $list_users = array();
@@ -665,10 +665,10 @@  discard block
 block discarded – undo
665 665
     {
666 666
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
667 667
         $sql = 'SELECT gc.score_certificate, gc.created_at, gc.path_certificate, gc.cat_id, gc.user_id, gc.id
668
-                FROM  ' . $table_certificate . ' gc
669
-                WHERE gc.user_id="' . intval($user_id) . '" ';
668
+                FROM  ' . $table_certificate.' gc
669
+                WHERE gc.user_id="' . intval($user_id).'" ';
670 670
         if (!is_null($cat_id) && $cat_id > 0) {
671
-            $sql.=' AND cat_id=' . intval($cat_id);
671
+            $sql .= ' AND cat_id='.intval($cat_id);
672 672
         }
673 673
 
674 674
         $rs = Database::query($sql);
@@ -696,12 +696,12 @@  discard block
 block discarded – undo
696 696
         $variables = isset($content_html['variables']) ? $content_html['variables'] : null;
697 697
         $contentHead = null;
698 698
 
699
-        $path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path($course_code) . '/document/images/gallery';
699
+        $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_code).'/document/images/gallery';
700 700
         $new_content_html = str_replace('../images/gallery', $path_image, $new_content_html);
701 701
 
702
-        $path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document';
702
+        $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document';
703 703
         $new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html);
704
-        $new_content_html = str_replace(SYS_CODE_PATH . 'img/', api_get_path(WEB_IMG_PATH), $new_content_html);
704
+        $new_content_html = str_replace(SYS_CODE_PATH.'img/', api_get_path(WEB_IMG_PATH), $new_content_html);
705 705
 
706 706
         $dom = new DOMDocument();
707 707
         $dom->loadHTML($new_content_html);
@@ -750,9 +750,9 @@  discard block
 block discarded – undo
750 750
             $session_id = api_get_session_id();
751 751
 
752 752
             $t = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
753
-            $sql = "SELECT * FROM $t WHERE course_code = '" . Database::escape_string($course_code) . "' ";
753
+            $sql = "SELECT * FROM $t WHERE course_code = '".Database::escape_string($course_code)."' ";
754 754
             if (!empty($session_id)) {
755
-                $sql .= " AND session_id = " . (int) $session_id;
755
+                $sql .= " AND session_id = ".(int) $session_id;
756 756
             } else {
757 757
                 $sql .= " AND (session_id IS NULL OR session_id = 0) ";
758 758
             }
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
                 if (!empty($session_id)) {
765 765
                     $my_session_id = api_get_session_id();
766 766
                     $s_name = api_get_session_name($my_session_id);
767
-                    $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name);
767
+                    $cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name);
768 768
                     $cat->set_session_id($session_id);
769 769
                 } else {
770 770
                     $cat->set_name($course_code);
@@ -886,13 +886,13 @@  discard block
 block discarded – undo
886 886
 
887 887
         if ($use_grade_model) {
888 888
             if ($parent_id == 0) {
889
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
889
+                $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed');
890 890
             } else {
891
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')';
891
+                $title = api_strtoupper(get_lang('Average')).'<br />'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')';
892 892
             }
893 893
         } else {
894 894
             if ($parent_id == 0) {
895
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
895
+                $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed');
896 896
             } else {
897 897
                 $title = api_strtoupper(get_lang('Average'));
898 898
             }
@@ -946,11 +946,11 @@  discard block
 block discarded – undo
946 946
         } else {
947 947
             $column = 0;
948 948
             $table->setCellContents($row, $column, get_lang('NoResults'));
949
-            $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"');
949
+            $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"');
950 950
         }
951 951
 
952 952
         $pdfParams = array(
953
-            'filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(),
953
+            'filename' => get_lang('FlatView').'_'.api_get_utc_datetime(),
954 954
             'pdf_title' => $title,
955 955
             'course_code' => $course_code,
956 956
             'add_signatures' => true
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
         $a_students = array();
1036 1036
         while ($user = Database::fetch_array($result)) {
1037 1037
             if (!array_key_exists($user['user_id'], $a_students)) {
1038
-                $a_current_student = array ();
1038
+                $a_current_student = array();
1039 1039
                 $a_current_student[] = $user['user_id'];
1040 1040
                 $a_current_student[] = $user['username'];
1041 1041
                 $a_current_student[] = $user['lastname'];
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
         foreach ($links as $link) {
1094 1094
             // links are always in a course
1095 1095
             $coursecode = $link->get_course_code();
1096
-            if (!array_key_exists($coursecode,$coursecodes)) {
1096
+            if (!array_key_exists($coursecode, $coursecodes)) {
1097 1097
                 $coursecodes[$coursecode] = '1';
1098 1098
                 $users = array_merge($users, GradebookUtils::get_users_in_course($coursecode));
1099 1099
             }
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
      * Search students matching a given last name and/or first name
1107 1107
      * @author Bert Steppé
1108 1108
      */
1109
-    public static function find_students($mask= '')
1109
+    public static function find_students($mask = '')
1110 1110
     {
1111 1111
         // students shouldn't be here // don't search if mask empty
1112 1112
         if (!api_is_allowed_to_edit() || empty ($mask)) {
@@ -1117,23 +1117,23 @@  discard block
 block discarded – undo
1117 1117
         $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
1118 1118
         $tbl_cru = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
1119 1119
         $sql = 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code
1120
-                FROM ' . $tbl_user . ' user';
1120
+                FROM ' . $tbl_user.' user';
1121 1121
         if (!api_is_platform_admin()) {
1122
-            $sql .= ', ' . $tbl_cru . ' cru';
1122
+            $sql .= ', '.$tbl_cru.' cru';
1123 1123
         }
1124 1124
 
1125
-        $sql .= ' WHERE user.status = ' . STUDENT;
1126
-        $sql .= ' AND (user.lastname LIKE '."'%" . $mask . "%'";
1127
-        $sql .= ' OR user.firstname LIKE '."'%" . $mask . "%')";
1125
+        $sql .= ' WHERE user.status = '.STUDENT;
1126
+        $sql .= ' AND (user.lastname LIKE '."'%".$mask."%'";
1127
+        $sql .= ' OR user.firstname LIKE '."'%".$mask."%')";
1128 1128
 
1129 1129
         if (!api_is_platform_admin()) {
1130 1130
             $sql .= ' AND user.user_id = cru.user_id AND
1131 1131
                       cru.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' AND
1132 1132
                       cru.c_id in (
1133
-                            SELECT c_id FROM '.$tbl_cru . '
1133
+                            SELECT c_id FROM '.$tbl_cru.'
1134 1134
                             WHERE
1135
-                                user_id = ' . api_get_user_id() . ' AND
1136
-                                status = ' . COURSEMANAGER . '
1135
+                                user_id = ' . api_get_user_id().' AND
1136
+                                status = ' . COURSEMANAGER.'
1137 1137
                         )
1138 1138
                     ';
1139 1139
         }
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
         $sql = 'SELECT ref_id FROM '.$table_link.'
1178 1178
                 WHERE id = '.$linkId.' AND type='.LINK_ATTENDANCE;
1179 1179
 
1180
-        $rs_attendance  = Database::query($sql);
1180
+        $rs_attendance = Database::query($sql);
1181 1181
         if (Database::num_rows($rs_attendance) > 0) {
1182 1182
             $row_attendance = Database::fetch_array($rs_attendance);
1183 1183
             $sql = 'UPDATE '.$tbl_attendance.' SET attendance_weight ='.$weight.'
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
                 'course' => $courseInfo['title'],
1273 1273
                 'score' => $certificateInfo['score_certificate'],
1274 1274
                 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT),
1275
-                'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"
1275
+                'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}"
1276 1276
             ];
1277 1277
         }
1278 1278
 
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
                     'course' => $course['title'],
1337 1337
                     'score' => $certificateInfo['score_certificate'],
1338 1338
                     'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT),
1339
-                    'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"
1339
+                    'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}"
1340 1340
                 ];
1341 1341
             }
1342 1342
         }
Please login to merge, or discard this patch.
main/messages/view_message.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,22 +6,22 @@  discard block
 block discarded – undo
6 6
 $cidReset = true;
7 7
 require_once '../inc/global.inc.php';
8 8
 api_block_anonymous_users();
9
-if (api_get_setting('allow_message_tool')!='true') {
9
+if (api_get_setting('allow_message_tool') != 'true') {
10 10
 	api_not_allowed();
11 11
 }
12 12
 
13 13
 if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'social') {
14 14
 	$this_section = SECTION_SOCIAL;
15
-	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
16
-	$interbreadcrumb[]= array ('url' => 'inbox.php?f=social','name' => get_lang('Inbox'));
15
+	$interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'main/social/home.php', 'name' => get_lang('Social'));
16
+	$interbreadcrumb[] = array('url' => 'inbox.php?f=social', 'name' => get_lang('Inbox'));
17 17
 } else {
18 18
 	$this_section = SECTION_MYPROFILE;
19
-	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
19
+	$interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'main/auth/profile.php', 'name' => get_lang('Profile'));
20 20
 }
21 21
 
22 22
 $social_right_content = '';
23 23
 
24
-if (isset($_GET['f']) && $_GET['f']=='social') {
24
+if (isset($_GET['f']) && $_GET['f'] == 'social') {
25 25
 	$social_parameter = '?f=social';
26 26
 } else {
27 27
 	if (api_get_setting('extended_profile') == 'true') {
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 		}
34 34
 		if (api_get_setting('allow_message_tool') == 'true') {
35 35
 		    $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
36
-                Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
36
+                Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>';
37 37
             $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
38
-                Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
38
+                Display::return_icon('inbox.png', get_lang('Inbox')).'</a>';
39 39
             $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
40
-                Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
40
+                Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
41 41
 		}
42 42
 		$social_right_content .= '</div>';
43 43
 	}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     $show_menu = 'messages_inbox';
54 54
 }
55 55
 
56
-$message  = '';
56
+$message = '';
57 57
 
58 58
 // LEFT COLUMN
59 59
 if (api_get_setting('allow_social_tool') == 'true') {
Please login to merge, or discard this patch.
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
 require_once '../inc/global.inc.php';
8 8
 api_block_anonymous_users();
9 9
 if (api_get_setting('allow_message_tool')!='true') {
10
-	api_not_allowed();
10
+    api_not_allowed();
11 11
 }
12 12
 
13 13
 if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'social') {
14
-	$this_section = SECTION_SOCIAL;
15
-	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
16
-	$interbreadcrumb[]= array ('url' => 'inbox.php?f=social','name' => get_lang('Inbox'));
14
+    $this_section = SECTION_SOCIAL;
15
+    $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
16
+    $interbreadcrumb[]= array ('url' => 'inbox.php?f=social','name' => get_lang('Inbox'));
17 17
 } else {
18
-	$this_section = SECTION_MYPROFILE;
19
-	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
18
+    $this_section = SECTION_MYPROFILE;
19
+    $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
20 20
 }
21 21
 
22 22
 $social_right_content = '';
23 23
 
24 24
 if (isset($_GET['f']) && $_GET['f']=='social') {
25
-	$social_parameter = '?f=social';
25
+    $social_parameter = '?f=social';
26 26
 } else {
27
-	if (api_get_setting('extended_profile') == 'true') {
28
-		$social_right_content .= '<div class="actions">';
27
+    if (api_get_setting('extended_profile') == 'true') {
28
+        $social_right_content .= '<div class="actions">';
29 29
 
30
-		if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') {
31
-			$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
30
+        if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') {
31
+            $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
32 32
                 Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
33
-		}
34
-		if (api_get_setting('allow_message_tool') === 'true') {
35
-		    $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
33
+        }
34
+        if (api_get_setting('allow_message_tool') === 'true') {
35
+            $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
36 36
                 Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
37 37
             $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
38 38
                 Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
39 39
             $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
40 40
                 Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
41
-		}
42
-		$social_right_content .= '</div>';
43
-	}
41
+        }
42
+        $social_right_content .= '</div>';
43
+    }
44 44
 }
45 45
 
46 46
 if (empty($_GET['id'])) {
Please login to merge, or discard this patch.
main/admin/statistics/index.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         <script>
21 21
             $(document).ready(function() {
22 22
                 $.ajax({
23
-                    url: "'. api_get_path(WEB_CODE_PATH) .'inc/ajax/statistics.ajax.php?a=recentlogins",
23
+                    url: "'. api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?a=recentlogins",
24 24
                     type: "POST",
25 25
                     success: function(data) {
26 26
                         Chart.defaults.global.responsive = true;
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 // users ...
51 51
 $tools[$strUsers]['report=users'] = get_lang('CountUsers');
52 52
 $tools[$strUsers]['report=recentlogins'] = get_lang('Logins');
53
-$tools[$strUsers]['report=logins&amp;type=month'] = get_lang('Logins') . ' (' . get_lang('PeriodMonth') . ')';
54
-$tools[$strUsers]['report=logins&amp;type=day'] = get_lang('Logins') . ' (' . get_lang('PeriodDay') . ')';
55
-$tools[$strUsers]['report=logins&amp;type=hour'] = get_lang('Logins') . ' (' . get_lang('PeriodHour') . ')';
56
-$tools[$strUsers]['report=pictures'] = get_lang('CountUsers') . ' (' . get_lang('UserPicture') . ')';
53
+$tools[$strUsers]['report=logins&amp;type=month'] = get_lang('Logins').' ('.get_lang('PeriodMonth').')';
54
+$tools[$strUsers]['report=logins&amp;type=day'] = get_lang('Logins').' ('.get_lang('PeriodDay').')';
55
+$tools[$strUsers]['report=logins&amp;type=hour'] = get_lang('Logins').' ('.get_lang('PeriodHour').')';
56
+$tools[$strUsers]['report=pictures'] = get_lang('CountUsers').' ('.get_lang('UserPicture').')';
57 57
 $tools[$strUsers]['report=no_login_users'] = get_lang('StatsUsersDidNotLoginInLastPeriods');
58 58
 $tools[$strUsers]['report=zombies'] = get_lang('Zombies');
59 59
 
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 echo '<table><tr>';
69 69
 foreach ($tools as $section => $items) {
70 70
     echo '<td style="vertical-align:top;">';
71
-    echo '<h3>' . $section . '</h3>';
71
+    echo '<h3>'.$section.'</h3>';
72 72
     echo '<ul>';
73 73
     foreach ($items as $key => $value) {
74
-        echo '<li><a href="index.php?' . $key . '">' . $value . '</a></li>';
74
+        echo '<li><a href="index.php?'.$key.'">'.$value.'</a></li>';
75 75
     }
76 76
     echo '</ul>';
77 77
     echo '</td>';
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 echo '</tr></table>';
80 80
 
81 81
 $course_categories = Statistics::getCourseCategories();
82
-echo '<br/><br/>';//@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
82
+echo '<br/><br/>'; //@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
83 83
 
84 84
 switch ($report) {
85 85
     case 'courses':
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         Statistics::printStats(get_lang('Students'), $students);
122 122
         break;
123 123
     case 'recentlogins':
124
-        echo '<h2>'. sprintf(get_lang('LastXDays'), '15') . '</h2>';
124
+        echo '<h2>'.sprintf(get_lang('LastXDays'), '15').'</h2>';
125 125
         echo '<canvas class="col-md-12" id="canvas" height="100px" style="margin-bottom: 20px"></canvas>';
126 126
         Statistics::printRecentLoginStats();
127 127
         Statistics::printRecentLoginStats(true);
Please login to merge, or discard this patch.
main/inc/lib/javascript/svgedit/svg-editor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * @since 25/september/2010
6 6
  */
7 7
 
8
-require_once '../../../../inc/global.inc.php';//hack for Chamilo
8
+require_once '../../../../inc/global.inc.php'; //hack for Chamilo
9 9
 api_protect_course_script();
10 10
 api_block_anonymous_users();
11 11
 if (!isset($_SESSION['draw_dir'])) {
Please login to merge, or discard this patch.
main/inc/lib/javascript/svgedit/extensions/allowedMimeTypes.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
     'jpeg' => 'image/jpeg',
7 7
     'bmp' => 'image/bmp',
8 8
     'webp' => 'image/webp',
9
-	'pdf' => 'application/pdf'
9
+    'pdf' => 'application/pdf'
10 10
 );
11 11
 
12 12
 ?>
13 13
\ No newline at end of file
Please login to merge, or discard this patch.
main/inc/lib/javascript/svgedit/extensions/savefile.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2
-	// You must first create a file "savefile_config.php" in this extensions directory and do whatever
3
-	//   checking of user credentials, etc. that you wish; otherwise anyone will be able to post SVG
4
-	//   files to your server which may cause disk space or possibly security problems
5
-  require('savefile_config.php');
6
-  if (!isset($_POST['output_svg'])) {
7
-		print "You must supply output_svg";
8
-		exit;
9
-	}
10
-	$svg = $_POST['output_svg'];
11
-	$filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved') . '.svg'; // These characters are indicated as prohibited by Windows
2
+    // You must first create a file "savefile_config.php" in this extensions directory and do whatever
3
+    //   checking of user credentials, etc. that you wish; otherwise anyone will be able to post SVG
4
+    //   files to your server which may cause disk space or possibly security problems
5
+    require('savefile_config.php');
6
+    if (!isset($_POST['output_svg'])) {
7
+        print "You must supply output_svg";
8
+        exit;
9
+    }
10
+    $svg = $_POST['output_svg'];
11
+    $filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved') . '.svg'; // These characters are indicated as prohibited by Windows
12 12
 
13
-	$fh = fopen($filename, 'w') or die("Can't open file");
14
-	fwrite($fh, $svg);
15
-	fclose($fh);
13
+    $fh = fopen($filename, 'w') or die("Can't open file");
14
+    fwrite($fh, $svg);
15
+    fclose($fh);
16 16
 ?>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 		exit;
9 9
 	}
10 10
 	$svg = $_POST['output_svg'];
11
-	$filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved') . '.svg'; // These characters are indicated as prohibited by Windows
11
+	$filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved').'.svg'; // These characters are indicated as prohibited by Windows
12 12
 
13 13
 	$fh = fopen($filename, 'w') or die("Can't open file");
14 14
 	fwrite($fh, $svg);
Please login to merge, or discard this patch.
main/inc/lib/javascript/svgedit/extensions/imagelib/users.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,19 +16,19 @@  discard block
 block discarded – undo
16 16
 //get all files and folders
17 17
 $scan_files = [];
18 18
 if (is_dir($user_disk_path)) {
19
-	$scan_files = scandir($user_disk_path);
19
+    $scan_files = scandir($user_disk_path);
20 20
 }
21 21
 //get all svg and png files
22 22
 $accepted_extensions = array('.svg', '.png');
23 23
 
24 24
 if (is_array($scan_files) && count($scan_files) > 0) {
25
-	foreach ($scan_files as & $file) {
26
-		$slideshow_extension = strrchr($file, '.');
27
-		$slideshow_extension = strtolower($slideshow_extension);
28
-		if (in_array($slideshow_extension, $accepted_extensions)) {
29
-			$png_svg_files[] =$file;
30
-		}
31
-	}
25
+    foreach ($scan_files as & $file) {
26
+        $slideshow_extension = strrchr($file, '.');
27
+        $slideshow_extension = strtolower($slideshow_extension);
28
+        if (in_array($slideshow_extension, $accepted_extensions)) {
29
+            $png_svg_files[] =$file;
30
+        }
31
+    }
32 32
 }
33 33
 $style = '<style>';
34 34
 $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
@@ -47,23 +47,23 @@  discard block
 block discarded – undo
47 47
 echo '<h2>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h2>';
48 48
 
49 49
 if (!empty($png_svg_files)) {
50
-	echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
51
-	echo '<ul>';
52
-	foreach($png_svg_files as $filename) {
53
-		$image = $user_disk_path.$filename;
50
+    echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
51
+    echo '<ul>';
52
+    foreach($png_svg_files as $filename) {
53
+        $image = $user_disk_path.$filename;
54 54
 
55
-		if (strpos($filename, "svg")){
56
-			$new_sizes['width'] = 60;
57
-			$new_sizes['height'] = 60;
58
-		} else {
59
-			$new_sizes = api_resize_image($image, 60, 60);
60
-		}
55
+        if (strpos($filename, "svg")){
56
+            $new_sizes['width'] = 60;
57
+            $new_sizes['height'] = 60;
58
+        } else {
59
+            $new_sizes = api_resize_image($image, 60, 60);
60
+        }
61 61
 
62
-		echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
63
-	}
64
-	echo '</ul>';
62
+        echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
63
+    }
64
+    echo '</ul>';
65 65
 } else {
66
-	Display::display_warning_message(get_lang('NoSVGImages'));
66
+    Display::display_warning_message(get_lang('NoSVGImages'));
67 67
 }
68 68
 ?>
69 69
 </body>
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 		$slideshow_extension = strrchr($file, '.');
26 26
 		$slideshow_extension = strtolower($slideshow_extension);
27 27
 		if (in_array($slideshow_extension, $accepted_extensions)) {
28
-			$png_svg_files[] =$file;
28
+			$png_svg_files[] = $file;
29 29
 		}
30 30
 	}
31 31
 }
32 32
 $style = '<style>';
33 33
 $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
34 34
 $style .= '@import "'.api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/default.css";';
35
-$style .='</style>';
35
+$style .= '</style>';
36 36
 
37 37
 ?>
38 38
 <!doctype html>
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 if (!empty($png_svg_files)) {
49 49
 	echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
50 50
 	echo '<ul>';
51
-	foreach($png_svg_files as $filename) {
51
+	foreach ($png_svg_files as $filename) {
52 52
 		$image = $user_disk_path.$filename;
53 53
 
54
-		if (strpos($filename, "svg")){
54
+		if (strpos($filename, "svg")) {
55 55
 			$new_sizes['width'] = 60;
56 56
 			$new_sizes['height'] = 60;
57 57
 		} else {
Please login to merge, or discard this patch.
main/inc/lib/javascript/svgedit/extensions/imagelib/groups.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 $array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array();
35 35
 
36 36
 if (count($array_to_search) > 0) {
37
-	while (list($key) = each($array_to_search)) {
38
-		$all_files[] = basename($array_to_search[$key]['path']);
39
-	}
37
+    while (list($key) = each($array_to_search)) {
38
+        $all_files[] = basename($array_to_search[$key]['path']);
39
+    }
40 40
 }
41 41
 
42 42
 //get all svg and png group files
@@ -70,26 +70,26 @@  discard block
 block discarded – undo
70 70
         ($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'], $groupId))) || $group_properties['doc_state'] == 1
71 71
 ){
72 72
 
73
-	if (!empty($png_svg_files)) {
74
-		echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
75
-		echo '<ul>';
76
-		foreach($png_svg_files as $filename) {
77
-			$image = $group_disk_path.$filename;
78
-
79
-			if (strpos($filename, "svg")){
80
-				$new_sizes['width'] = 60;
81
-				$new_sizes['height'] = 60;
82
-			} else {
83
-				$new_sizes = api_resize_image($image, 60, 60);
84
-			}
73
+    if (!empty($png_svg_files)) {
74
+        echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
75
+        echo '<ul>';
76
+        foreach($png_svg_files as $filename) {
77
+            $image = $group_disk_path.$filename;
78
+
79
+            if (strpos($filename, "svg")){
80
+                $new_sizes['width'] = 60;
81
+                $new_sizes['height'] = 60;
82
+            } else {
83
+                $new_sizes = api_resize_image($image, 60, 60);
84
+            }
85 85
             echo '<li style="display:inline; padding:8px;">';
86 86
             echo '<a href = "'.$group_web_path.$filename.'" alt="'.$filename.'" title="'.$filename.'">';
87 87
             echo '<img src = "'.$group_web_path.$filename.'" width = "'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
88
-		}
89
-		echo '</ul>';
90
-	}
88
+        }
89
+        echo '</ul>';
90
+    }
91 91
 } else {
92
-	echo Display::display_warning_message(get_lang('OnlyAccessFromYourGroup'));
92
+    echo Display::display_warning_message(get_lang('OnlyAccessFromYourGroup'));
93 93
 }
94 94
 ?>
95 95
 </body>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $slideshow_extension = strrchr($file, '.');
48 48
         $slideshow_extension = strtolower($slideshow_extension);
49 49
         if (in_array($slideshow_extension, $accepted_extensions)) {
50
-            $png_svg_files[] =$file;
50
+            $png_svg_files[] = $file;
51 51
         }
52 52
     }
53 53
 }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 $style = '<style>';
56 56
 $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
57 57
 $style .= '@import "'.api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/default.css";';
58
-$style .='</style>';
58
+$style .= '</style>';
59 59
 
60 60
 ?>
61 61
 <!doctype html>
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
 if ((
69 69
         $group_properties['doc_state'] == 2 &&
70 70
         ($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'], $groupId))) || $group_properties['doc_state'] == 1
71
-){
71
+) {
72 72
 
73 73
 	if (!empty($png_svg_files)) {
74 74
 		echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
75 75
 		echo '<ul>';
76
-		foreach($png_svg_files as $filename) {
76
+		foreach ($png_svg_files as $filename) {
77 77
 			$image = $group_disk_path.$filename;
78 78
 
79
-			if (strpos($filename, "svg")){
79
+			if (strpos($filename, "svg")) {
80 80
 				$new_sizes['width'] = 60;
81 81
 				$new_sizes['height'] = 60;
82 82
 			} else {
Please login to merge, or discard this patch.
main/inc/lib/javascript/svgedit/extensions/imagelib/index.php 3 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -23,22 +23,22 @@  discard block
 block discarded – undo
23 23
 $array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array();
24 24
 
25 25
 if (count($array_to_search) > 0) {
26
-	while (list($key) = each($array_to_search)) {
27
-		$all_files[] = basename($array_to_search[$key]['path']);
28
-	}
26
+    while (list($key) = each($array_to_search)) {
27
+        $all_files[] = basename($array_to_search[$key]['path']);
28
+    }
29 29
 }
30 30
 
31 31
 //get all svg and png files
32 32
 $accepted_extensions = array('.svg', '.png');
33 33
 
34 34
 if (is_array($all_files) && count($all_files) > 0) {
35
-	foreach ($all_files as & $file) {
36
-		$slideshow_extension = strrchr($file, '.');
37
-		$slideshow_extension = strtolower($slideshow_extension);
38
-		if (in_array($slideshow_extension, $accepted_extensions)) {
39
-			$png_svg_files[] =$file;
40
-		}
41
-	}
35
+    foreach ($all_files as & $file) {
36
+        $slideshow_extension = strrchr($file, '.');
37
+        $slideshow_extension = strtolower($slideshow_extension);
38
+        if (in_array($slideshow_extension, $accepted_extensions)) {
39
+            $png_svg_files[] =$file;
40
+        }
41
+    }
42 42
 }
43 43
 
44 44
 $disk_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images/gallery/';
@@ -57,24 +57,24 @@  discard block
 block discarded – undo
57 57
 <?php
58 58
 echo '<h2>'.get_lang('Course').': '.$course_info['name'].'</h2>';
59 59
 if (!empty($png_svg_files)) {
60
-	echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
61
-	echo '<ul>';
62
-	foreach($png_svg_files as $filename) {
63
-		$image=$disk_path.$filename;
64
-
65
-		if (strpos($filename, "svg")){
66
-			$new_sizes['width'] = 60;
67
-			$new_sizes['height'] = 60;
68
-		}
69
-		else {
70
-			$new_sizes = api_resize_image($image, 60, 60);
71
-		}
72
-
73
-		echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
74
-	}
75
-	echo '</ul>';
60
+    echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
61
+    echo '<ul>';
62
+    foreach($png_svg_files as $filename) {
63
+        $image=$disk_path.$filename;
64
+
65
+        if (strpos($filename, "svg")){
66
+            $new_sizes['width'] = 60;
67
+            $new_sizes['height'] = 60;
68
+        }
69
+        else {
70
+            $new_sizes = api_resize_image($image, 60, 60);
71
+        }
72
+
73
+        echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
74
+    }
75
+    echo '</ul>';
76 76
 } else {
77
-	Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath'));
77
+    Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath'));
78 78
 }
79 79
 ?>
80 80
 </body>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
14 14
 
15
-$curdirpath='/images/gallery'; //path of library directory
15
+$curdirpath = '/images/gallery'; //path of library directory
16 16
 
17 17
 $course_info = api_get_course_info();
18 18
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		$slideshow_extension = strrchr($file, '.');
37 37
 		$slideshow_extension = strtolower($slideshow_extension);
38 38
 		if (in_array($slideshow_extension, $accepted_extensions)) {
39
-			$png_svg_files[] =$file;
39
+			$png_svg_files[] = $file;
40 40
 		}
41 41
 	}
42 42
 }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 $style = '<style>';
48 48
 $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
49 49
 $style .= '@import "'.api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/default.css";';
50
-$style .='</style>';
50
+$style .= '</style>';
51 51
 
52 52
 ?>
53 53
 <!doctype html>
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 if (!empty($png_svg_files)) {
60 60
 	echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
61 61
 	echo '<ul>';
62
-	foreach($png_svg_files as $filename) {
63
-		$image=$disk_path.$filename;
62
+	foreach ($png_svg_files as $filename) {
63
+		$image = $disk_path.$filename;
64 64
 
65
-		if (strpos($filename, "svg")){
65
+		if (strpos($filename, "svg")) {
66 66
 			$new_sizes['width'] = 60;
67 67
 			$new_sizes['height'] = 60;
68 68
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@
 block discarded – undo
65 65
 		if (strpos($filename, "svg")){
66 66
 			$new_sizes['width'] = 60;
67 67
 			$new_sizes['height'] = 60;
68
-		}
69
-		else {
68
+		} else {
70 69
 			$new_sizes = api_resize_image($image, 60, 60);
71 70
 		}
72 71
 
Please login to merge, or discard this patch.