Passed
Pull Request — 1.10.x (#1054)
by
unknown
53:05
created
main/admin/user_update_import.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
                     $user['error'] = get_lang('UserNameNotAvailable');
61 61
                     $errors[] = $user;
62 62
                 }
63
-             }
64
-          }
63
+                }
64
+            }
65 65
 
66 66
         // 3. Check status.
67 67
         if (isset($user['Status']) && !api_status_exists($user['Status'])) {
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
     return $users;
243 243
 }
244 244
 /**
245
- * XML-parser: handle start of element
246
- * @param   string  $parser Deprecated?
247
- * @param   string  $data The data to be parsed
248
- */
245
+     * XML-parser: handle start of element
246
+     * @param   string  $parser Deprecated?
247
+     * @param   string  $data The data to be parsed
248
+     */
249 249
 function element_start($parser, $data)
250 250
 {
251 251
     $data = api_utf8_decode($data);
Please login to merge, or discard this patch.
main/inc/lib/banner.lib.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * Code
5
- * @todo use globals or parameters or add this file in the template
6
- * @package chamilo.include
7
- */
4
+     * Code
5
+     * @todo use globals or parameters or add this file in the template
6
+     * @package chamilo.include
7
+     */
8 8
 
9 9
 /**
10 10
  * Determines the possible tabs (=sections) that are available.
@@ -42,20 +42,20 @@  discard block
 block discarded – undo
42 42
     $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
43 43
     $navigation['myprofile']['title'] = get_lang('ModifyProfile');
44 44
     $navigation['myprofile']['key'] = 'profile';
45
-	// Link to my agenda
45
+    // Link to my agenda
46 46
     $navigation['myagenda']['url'] = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=personal';
47 47
     $navigation['myagenda']['title'] = get_lang('MyAgenda');
48 48
     $navigation['myagenda']['key'] = 'agenda';
49 49
 
50
-	// Gradebook
51
-	if (api_get_setting('gradebook_enable') == 'true') {
50
+    // Gradebook
51
+    if (api_get_setting('gradebook_enable') == 'true') {
52 52
         $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
53 53
         $navigation['mygradebook']['title'] = get_lang('MyGradebook');
54 54
         $navigation['mygradebook']['key'] = 'gradebook';
55
-	}
55
+    }
56 56
 
57
-	// Reporting
58
-	if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
57
+    // Reporting
58
+    if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
59 59
         // Link to my space
60 60
         $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh()?'session.php':'');
61 61
         $navigation['session_my_space']['title'] = get_lang('MySpace');
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
         $navigation['session_my_progress']['key'] = 'my-progress';
80 80
     }
81 81
 
82
-	// Social
83
-	if (api_get_setting('allow_social_tool')=='true') {
82
+    // Social
83
+    if (api_get_setting('allow_social_tool')=='true') {
84 84
         $navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/home.php';
85 85
         $navigation['social']['title'] = get_lang('SocialNetwork');
86 86
         $navigation['social']['key'] = 'social-network';
87
-	}
87
+    }
88 88
 
89
-	// Dashboard
90
-	if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
89
+    // Dashboard
90
+    if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
91 91
         $navigation['dashboard']['url'] = api_get_path(WEB_CODE_PATH).'dashboard/index.php';
92 92
         $navigation['dashboard']['title'] = get_lang('Dashboard');
93 93
         $navigation['dashboard']['key'] = 'dashboard';
94
-	}
94
+    }
95 95
 
96
-	// Reports
96
+    // Reports
97 97
     /*
98 98
 	if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
99 99
         $navigation['reports']['url'] = api_get_path(WEB_CODE_PATH).'reports/index.php';
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
     }
117 117
     // End Custom Tabs
118 118
 
119
-	// Platform administration
120
-	if (api_is_platform_admin(true)) {
119
+    // Platform administration
120
+    if (api_is_platform_admin(true)) {
121 121
         $navigation['platform_admin']['url'] = api_get_path(WEB_CODE_PATH).'admin/';
122 122
         $navigation['platform_admin']['title'] = get_lang('PlatformAdmin');
123 123
         $navigation['platform_admin']['key'] = 'admin';
124
-	}
124
+    }
125 125
 
126
-	return $navigation;
126
+    return $navigation;
127 127
 }
128 128
 
129 129
 /**
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             }
352 352
         }
353 353
 
354
-		// Reports
354
+        // Reports
355 355
         if (!empty($possible_tabs['reports'])) {
356 356
             if (api_get_setting('show_tabs', 'reports') == 'true') {
357 357
                 if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) {
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 
493 493
     $menu = null;
494 494
     if (!empty($lis)) {
495
-         $menu .= $lis;
495
+            $menu .= $lis;
496 496
     }
497 497
     return $menu;
498 498
 }
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         $navigation_item_my_courses['title'] = get_lang('MyCourses');
549 549
         $navigation_item_my_courses['url'] = api_get_path(WEB_PATH).'user_portal.php';
550 550
         $navigation[] = $navigation_item_my_courses;
551
-        */
551
+         */
552 552
         $navigation[] = $navigation_item;
553 553
     }
554 554
 
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     $navigation['mycourses']['key'] = 'my-course';
40 40
 
41 41
     // My Profile
42
-    $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
42
+    $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '');
43 43
     $navigation['myprofile']['title'] = get_lang('ModifyProfile');
44 44
     $navigation['myprofile']['key'] = 'profile';
45 45
 	// Link to my agenda
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	// Gradebook
51 51
 	if (api_get_setting('gradebook_enable') == 'true') {
52
-        $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
52
+        $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '');
53 53
         $navigation['mygradebook']['title'] = get_lang('MyGradebook');
54 54
         $navigation['mygradebook']['key'] = 'gradebook';
55 55
 	}
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 	// Reporting
58 58
 	if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
59 59
         // Link to my space
60
-        $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh()?'session.php':'');
60
+        $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh() ? 'session.php' : '');
61 61
         $navigation['session_my_space']['title'] = get_lang('MySpace');
62 62
         $navigation['session_my_space']['key'] = 'my-space';
63 63
     } else if (api_is_student_boss()) {
64
-        $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH) . 'mySpace/student.php';
64
+        $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/student.php';
65 65
         $navigation['session_my_space']['title'] = get_lang('MySpace');
66 66
         $navigation['session_my_space']['key'] = 'my-space';
67 67
     } else {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     }
81 81
 
82 82
 	// Social
83
-	if (api_get_setting('allow_social_tool')=='true') {
83
+	if (api_get_setting('allow_social_tool') == 'true') {
84 84
         $navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/home.php';
85 85
         $navigation['social']['title'] = get_lang('SocialNetwork');
86 86
         $navigation['social']['key'] = 'social-network';
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
         'id' => 'header-logo'
162 162
     );
163 163
     $testServer = api_get_setting('server_type');
164
-    if ($testServer == 'test' && is_file($logoBase . 'svg')) {
165
-        $logo = $logoBase . 'svg';
164
+    if ($testServer == 'test' && is_file($logoBase.'svg')) {
165
+        $logo = $logoBase.'svg';
166 166
         $attributes['width'] = '245';
167 167
         $attributes['height'] = '68';
168 168
         $imageUrl = api_get_path(WEB_CSS_PATH).'themes/'.$theme.'/images/header-logo.svg';
169 169
     } else {
170
-        $logo = $logoBase . 'png';
171
-        $customLogo = $customLogoBase . 'png';
170
+        $logo = $logoBase.'png';
171
+        $customLogo = $customLogoBase.'png';
172 172
         $imageUrl = api_get_path(WEB_CSS_PATH).'themes/'.$theme.'/images/header-logo.png';
173 173
         $customImageUrl = api_get_path(WEB_CSS_PATH).'themes/'.$theme.'/images/header-logo-custom.png';
174 174
     }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     $_course = api_get_course_info();
219 219
     $course_id = 0;
220 220
     if (!empty($_course)) {
221
-        $course_id  = $_course['code'];
221
+        $course_id = $_course['code'];
222 222
     }
223 223
 
224 224
     $user_id = api_get_user_id();
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
         if (api_get_setting('gradebook_enable') == 'true') {
316 316
             if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
317 317
                 $navigation['mygradebook'] = $possible_tabs['mygradebook'];
318
-            } else{
318
+            } else {
319 319
                 $menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
320 320
             }
321 321
         }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             if (api_get_setting('allow_social_tool') == 'true') {
341 341
                 $navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
342 342
             }
343
-        } else{
343
+        } else {
344 344
             $menu_navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
345 345
         }
346 346
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
             if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
350 350
                 $navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
351 351
             }
352
-        } else{
352
+        } else {
353 353
             $menu_navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
354 354
         }
355 355
 
@@ -440,32 +440,32 @@  discard block
 block discarded – undo
440 440
     $home_top = '';
441 441
 
442 442
     if (is_file($homep.$menutabs.'_'.$lang.$ext) && is_readable($homep.$menutabs.'_'.$lang.$ext)) {
443
-        $home_top = @(string)file_get_contents($homep.$menutabs.'_'.$lang.$ext);
443
+        $home_top = @(string) file_get_contents($homep.$menutabs.'_'.$lang.$ext);
444 444
     } elseif (is_file($homep.$menutabs.$lang.$ext) && is_readable($homep.$menutabs.$lang.$ext)) {
445
-        $home_top = @(string)file_get_contents($homep.$menutabs.$lang.$ext);
445
+        $home_top = @(string) file_get_contents($homep.$menutabs.$lang.$ext);
446 446
     } else {
447 447
         //$errorMsg = get_lang('HomePageFilesNotReadable');
448 448
     }
449 449
 
450 450
     $home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top)));
451 451
 
452
-    $open = str_replace('{rel_path}',api_get_path(REL_PATH), $home_top);
452
+    $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top);
453 453
     $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
454 454
 
455 455
     $open_mtloggedin = '';
456 456
     if (api_get_user_id() && !api_is_anonymous()) {
457 457
         if (is_file($homep.$mtloggedin.'_'.$lang.$ext) && is_readable($homep.$mtloggedin.'_'.$lang.$ext)) {
458
-            $home_top = @(string)file_get_contents($homep.$mtloggedin.'_'.$lang.$ext);
458
+            $home_top = @(string) file_get_contents($homep.$mtloggedin.'_'.$lang.$ext);
459 459
             $home_top = str_replace('::private', '', $home_top);
460 460
         } elseif (is_file($homep.$mtloggedin.$lang.$ext) && is_readable($homep.$mtloggedin.$lang.$ext)) {
461
-            $home_top = @(string)file_get_contents($homep.$mtloggedin.$lang.$ext);
461
+            $home_top = @(string) file_get_contents($homep.$mtloggedin.$lang.$ext);
462 462
             $home_top = str_replace('::private', '', $home_top);
463 463
         } else {
464 464
             //$errorMsg = get_lang('HomePageFilesNotReadable');
465 465
         }
466 466
 
467 467
         $home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top)));
468
-        $open_mtloggedin = str_replace('{rel_path}',api_get_path(REL_PATH), $home_top);
468
+        $open_mtloggedin = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top);
469 469
         $open_mtloggedin = api_to_system_encoding($open_mtloggedin, api_detect_encoding(strip_tags($open_mtloggedin)));
470 470
     }
471 471
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
     if (!empty($open) OR !empty($open_mtloggedin)) {
475 475
         if (strpos($open.$open_mtloggedin, 'show_menu') === false) {
476 476
             if (api_is_anonymous()) {
477
-                $navigation[SECTION_CAMPUS]  = null;
477
+                $navigation[SECTION_CAMPUS] = null;
478 478
             }
479 479
         } else {
480 480
             if (api_get_user_id() && !api_is_anonymous()) {
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
     if (count($navigation) > 0 || !empty($lis)) {
489 489
         $pre_lis = '';
490 490
         foreach ($navigation as $section => $navigation_info) {
491
-            $key = (!empty($navigation_info['key'])?'tab-'.$navigation_info['key']:'');
491
+            $key = (!empty($navigation_info['key']) ? 'tab-'.$navigation_info['key'] : '');
492 492
             if (isset($GLOBALS['this_section'])) {
493 493
                 $current = $section == $GLOBALS['this_section'] ? ' id="current" class="active '.$key.'" ' : ' class="'.$key.'"';
494 494
             } else {
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 
533 533
     if (!empty($_course) && !isset($_GET['hide_course_breadcrumb'])) {
534 534
 
535
-        $navigation_item['url'] = $web_course_path . $_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
535
+        $navigation_item['url'] = $web_course_path.$_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
536 536
         $_course['name'] = api_htmlentities($_course['name']);
537 537
         $course_title = cut($_course['name'], MAX_LENGTH_BREADCRUMB);
538 538
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
                 $navigation_item['title'] = Display::img(api_get_path(WEB_IMG_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
548 548
                 break;
549 549
             default:
550
-                if (api_get_session_id() != -1 ) {
550
+                if (api_get_session_id() != -1) {
551 551
                     $navigation_item['title'] = Display::img(api_get_path(WEB_IMG_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
552 552
                 } else {
553 553
                     $navigation_item['title'] = Display::img(api_get_path(WEB_IMG_PATH).'home.png', $_course['name']).' '.$course_title;
@@ -581,22 +581,22 @@  discard block
 block discarded – undo
581 581
             // titles for shared folders
582 582
             if ($breadcrumb_step['name'] == 'shared_folder') {
583 583
                 $navigation_item['title'] = get_lang('UserFolders');
584
-            } elseif(strstr($breadcrumb_step['name'], 'shared_folder_session_')) {
584
+            } elseif (strstr($breadcrumb_step['name'], 'shared_folder_session_')) {
585 585
                 $navigation_item['title'] = get_lang('UserFolders');
586
-            } elseif(strstr($breadcrumb_step['name'], 'sf_user_')) {
586
+            } elseif (strstr($breadcrumb_step['name'], 'sf_user_')) {
587 587
                 $userinfo = api_get_user_info(substr($breadcrumb_step['name'], 8));
588 588
                 $navigation_item['title'] = $userinfo['complete_name'];
589
-            } elseif($breadcrumb_step['name'] == 'chat_files') {
589
+            } elseif ($breadcrumb_step['name'] == 'chat_files') {
590 590
                 $navigation_item['title'] = get_lang('ChatFiles');
591
-            } elseif($breadcrumb_step['name'] == 'images') {
591
+            } elseif ($breadcrumb_step['name'] == 'images') {
592 592
                 $navigation_item['title'] = get_lang('Images');
593
-            } elseif($breadcrumb_step['name'] == 'video') {
593
+            } elseif ($breadcrumb_step['name'] == 'video') {
594 594
                 $navigation_item['title'] = get_lang('Video');
595
-            } elseif($breadcrumb_step['name'] == 'audio') {
595
+            } elseif ($breadcrumb_step['name'] == 'audio') {
596 596
                 $navigation_item['title'] = get_lang('Audio');
597
-            } elseif($breadcrumb_step['name'] == 'flash') {
597
+            } elseif ($breadcrumb_step['name'] == 'flash') {
598 598
                 $navigation_item['title'] = get_lang('Flash');
599
-            } elseif($breadcrumb_step['name'] == 'gallery') {
599
+            } elseif ($breadcrumb_step['name'] == 'gallery') {
600 600
                 $navigation_item['title'] = get_lang('Gallery');
601 601
             }
602 602
             // Fixes breadcrumb title now we applied the Security::remove_XSS and
@@ -663,35 +663,35 @@  discard block
 block discarded – undo
663 663
         if (!empty($final_navigation)) {
664 664
             // $home_link.= '<span class="divider">/</span>';
665 665
             if (!empty($home_link)) {
666
-                $lis.= Display::tag('li', $home_link);
666
+                $lis .= Display::tag('li', $home_link);
667 667
             }
668 668
 
669 669
             foreach ($final_navigation as $bread) {
670 670
                 $bread_check = trim(strip_tags($bread));
671 671
                 if (!empty($bread_check)) {
672
-                    if ($final_navigation_count-1 > $i) {
672
+                    if ($final_navigation_count - 1 > $i) {
673 673
                         $bread .= '';
674 674
                     }
675
-                    $lis.= Display::tag('li', $bread,array('class'=>'active'));
675
+                    $lis .= Display::tag('li', $bread, array('class'=>'active'));
676 676
                     $i++;
677 677
                 }
678 678
             }
679 679
         } else {
680 680
             if (!empty($home_link)) {
681
-                $lis.= Display::tag('li', $home_link);
681
+                $lis .= Display::tag('li', $home_link);
682 682
             }
683 683
         }
684 684
 
685 685
         // View as student/teacher link
686 686
         $view = null;
687 687
         if (!empty($view_as_student_link)) {
688
-            $view .= Display::tag('div', $view_as_student_link, array('id' => 'view_as_link','class' => 'pull-right'));
688
+            $view .= Display::tag('div', $view_as_student_link, array('id' => 'view_as_link', 'class' => 'pull-right'));
689 689
         }
690 690
 
691 691
         if (!empty($navigation_right)) {
692
-            foreach($navigation_right as $item){
692
+            foreach ($navigation_right as $item) {
693 693
                 $extra_class = isset($item['class']) ? $item['class'] : null;
694
-                $lis.= Display::tag('li', $item['title'], array('class' => $extra_class.' pull-right'));
694
+                $lis .= Display::tag('li', $item['title'], array('class' => $extra_class.' pull-right'));
695 695
             }
696 696
         }
697 697
 
Please login to merge, or discard this patch.
main/admin/ldap_import_students_to_session.php 1 patch
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -53,93 +53,93 @@  discard block
 block discarded – undo
53 53
 //if ($annee == "" && $composante == "" && $etape == "") {
54 54
 if (empty($annee) && empty($id_session))
55 55
 {
56
-		Display::display_header($tool_name);
57
-		echo '<div style="align:center">';
58
-		echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU');
59
-		echo '<form method="get" action="'.api_get_self().'"><br />';
60
-		echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
61
-		echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"> ';
62
-		echo '<input type="submit" value="'.get_lang('Submit').'">';
63
-		echo '</form>';
64
-		echo '</div>';
56
+        Display::display_header($tool_name);
57
+        echo '<div style="align:center">';
58
+        echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU');
59
+        echo '<form method="get" action="'.api_get_self().'"><br />';
60
+        echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
61
+        echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"> ';
62
+        echo '<input type="submit" value="'.get_lang('Submit').'">';
63
+        echo '</form>';
64
+        echo '</div>';
65 65
 
66 66
 }
67 67
 elseif(!empty($annee) && empty($id_session))
68 68
 {
69
-	Display::display_header($tool_name);
70
-	echo '<div style="align:center">';
71
-	echo Display::return_icon(
72
-			'course.png',
73
-			get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />';
74
-	echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
75
-	echo '<select name="id_session">';
76
-
77
-	$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
78
-	$sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " .
79
-		" FROM $tbl_session ".
80
-		" ORDER BY name";
81
-	$result = Database::query($sql);
82
-
83
-	$sessions=Database::store_result($result);
84
-	$nbr_results=count($sessions);
85
-	foreach($sessions as $row) {
86
-		echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>';
87
-	}
88
-	echo '</select>';
89
-	echo '<input type="submit" value="'.get_lang('Submit').'">';
90
-	echo '</form>';
91
-	echo '</div>';
69
+    Display::display_header($tool_name);
70
+    echo '<div style="align:center">';
71
+    echo Display::return_icon(
72
+            'course.png',
73
+            get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />';
74
+    echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
75
+    echo '<select name="id_session">';
76
+
77
+    $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
78
+    $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " .
79
+        " FROM $tbl_session ".
80
+        " ORDER BY name";
81
+    $result = Database::query($sql);
82
+
83
+    $sessions=Database::store_result($result);
84
+    $nbr_results=count($sessions);
85
+    foreach($sessions as $row) {
86
+        echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>';
87
+    }
88
+    echo '</select>';
89
+    echo '<input type="submit" value="'.get_lang('Submit').'">';
90
+    echo '</form>';
91
+    echo '</div>';
92 92
 }
93 93
 // form4  annee != 0; composante != 0 etape != 0
94 94
 //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') {
95 95
 elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed']))
96 96
 {
97
-	Display::display_header($tool_name);
98
-	echo '<div style="align: center;">';
99
-	echo '<br />';
100
-	echo '<br />';
101
-	echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
102
-	//echo "Connection ...";
103
-	$ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
104
-	ldap_set_version($ds);
105
-
106
-	if ($ds) {
107
-
108
-		$r = false;
109
-		$res = ldap_handle_bind($ds, $r);
110
-
111
-		//$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
112
-		//echo "(ou=*$annee,ou=$composante)";
113
-		$sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
114
-
115
-		$info = ldap_get_entries($ds, $sr);
116
-
117
-		for ($key = 0; $key < $info["count"]; $key ++) {
118
-			$nom_form[] = $info[$key]["sn"][0];
119
-			$prenom_form[] = $info[$key]["givenname"][0];
120
-			$email_form[] = $info[$key]["mail"][0];
121
-			// Get uid from dn
122
-			//$dn_array=ldap_explode_dn($info[$key]["dn"],1);
123
-			//$username_form[] = $dn_array[0]; // uid is first key
124
-			$username_form[] = $info[$key]['uid'][0];
125
-			$outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
126
-			//$val = ldap_get_values_len($ds, $entry, "userPassword");
127
-			//$password_form[] = $val[0];
128
-			$password_form[] = $info[$key]['userPassword'][0];
129
-		}
130
-		ldap_unbind($ds);
131
-
132
-		/*-----------------------------------------------*/
133
-
134
-		asort($nom_form);
135
-		reset($nom_form);
136
-
137
-		$statut=5;
138
-		include ('ldap_form_add_users_group.php');
139
-	} else {
140
-		echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
141
-	}
142
-	echo '<br /><br />';
97
+    Display::display_header($tool_name);
98
+    echo '<div style="align: center;">';
99
+    echo '<br />';
100
+    echo '<br />';
101
+    echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
102
+    //echo "Connection ...";
103
+    $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
104
+    ldap_set_version($ds);
105
+
106
+    if ($ds) {
107
+
108
+        $r = false;
109
+        $res = ldap_handle_bind($ds, $r);
110
+
111
+        //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
112
+        //echo "(ou=*$annee,ou=$composante)";
113
+        $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
114
+
115
+        $info = ldap_get_entries($ds, $sr);
116
+
117
+        for ($key = 0; $key < $info["count"]; $key ++) {
118
+            $nom_form[] = $info[$key]["sn"][0];
119
+            $prenom_form[] = $info[$key]["givenname"][0];
120
+            $email_form[] = $info[$key]["mail"][0];
121
+            // Get uid from dn
122
+            //$dn_array=ldap_explode_dn($info[$key]["dn"],1);
123
+            //$username_form[] = $dn_array[0]; // uid is first key
124
+            $username_form[] = $info[$key]['uid'][0];
125
+            $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
126
+            //$val = ldap_get_values_len($ds, $entry, "userPassword");
127
+            //$password_form[] = $val[0];
128
+            $password_form[] = $info[$key]['userPassword'][0];
129
+        }
130
+        ldap_unbind($ds);
131
+
132
+        /*-----------------------------------------------*/
133
+
134
+        asort($nom_form);
135
+        reset($nom_form);
136
+
137
+        $statut=5;
138
+        include ('ldap_form_add_users_group.php');
139
+    } else {
140
+        echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
141
+    }
142
+    echo '<br /><br />';
143 143
     echo '<a href="ldap_import_students.php?annee=">'.get_lang('BackToNewSearch').'</a>';
144 144
     echo '<br /><br />';
145 145
     echo '</div>';
@@ -147,23 +147,23 @@  discard block
 block discarded – undo
147 147
 }
148 148
 elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
149 149
 {
150
-	$id=$_POST['username_form'];
151
-	$UserList=array();
152
-	$userid_match_login = array();
153
-	foreach ($id as $form_index=>$user_id)
154
-	{
155
-		if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
156
-		{
157
-			$tmp = ldap_add_user($user_id);
158
-			$UserList[]= $tmp;
159
-			$userid_match_login[$tmp] = $user_id;
160
-		}
161
-	}
162
-	if (!empty($_POST['id_session'])) {
163
-		$num = 0;
164
-		$tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
165
-		$tbl_session	  = Database::get_main_table(TABLE_MAIN_SESSION);
166
-		foreach ($UserList as $user_id) {
150
+    $id=$_POST['username_form'];
151
+    $UserList=array();
152
+    $userid_match_login = array();
153
+    foreach ($id as $form_index=>$user_id)
154
+    {
155
+        if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
156
+        {
157
+            $tmp = ldap_add_user($user_id);
158
+            $UserList[]= $tmp;
159
+            $userid_match_login[$tmp] = $user_id;
160
+        }
161
+    }
162
+    if (!empty($_POST['id_session'])) {
163
+        $num = 0;
164
+        $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
165
+        $tbl_session	  = Database::get_main_table(TABLE_MAIN_SESSION);
166
+        foreach ($UserList as $user_id) {
167 167
                     $res_user = Database::insert(
168 168
                         $tbl_session_user,
169 169
                         [
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
                     if ($res_user !== false) {
176 176
                         $num++;
177 177
                     }
178
-		}
179
-
180
-		if($num>0) {
181
-			$sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session);
182
-			$res = Database::query($sql);
183
-		}
184
-		header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session']));
185
-	}
186
-	/*
178
+        }
179
+
180
+        if($num>0) {
181
+            $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session);
182
+            $res = Database::query($sql);
183
+        }
184
+        header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session']));
185
+    }
186
+    /*
187 187
 	else
188 188
 	{
189 189
 		Display :: display_header($tool_name);
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 		Display :: display_normal_message($message,false);
203 203
 	}
204 204
 	*/
205
-	else
206
-	{
207
-		Display::display_header($tool_name);
208
-		$message=get_lang('NoUserAdded');
209
-		Display :: display_normal_message($message,false);
210
-	}
211
-	echo '<br /><br />';
205
+    else
206
+    {
207
+        Display::display_header($tool_name);
208
+        $message=get_lang('NoUserAdded');
209
+        Display :: display_normal_message($message,false);
210
+    }
211
+    echo '<br /><br />';
212 212
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
213 213
     echo '<br /><br />';
214 214
 }
Please login to merge, or discard this patch.
main/admin/ldap_import_students.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 //if ($annee == "" && $composante == "" && $etape == "") {
57 57
 if (empty($annee) && empty($course))
58 58
 {
59
-		Display::display_header($tool_name);
60
-		echo '<div style="align:center">';
61
-		Display::display_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU'));
62
-		echo get_lang('LDAPSelectFilterOnUsersOU');
63
-		//echo '<em>'.get_lang('ToDoThisYouMustEnterYearComponentAndComponentStep').'</em><br />';
64
-		///echo get_lang('FollowEachOfTheseStepsStepByStep').'<br />';
65
-
66
-		echo '<form method="get" action="'.api_get_self().'"><br />';
67
-		echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
68
-		echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"><br />';
69
-		echo '<input type="submit" value="'.get_lang('Submit').'">';
70
-		echo '</form>';
71
-		echo '</div>';
59
+        Display::display_header($tool_name);
60
+        echo '<div style="align:center">';
61
+        Display::display_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU'));
62
+        echo get_lang('LDAPSelectFilterOnUsersOU');
63
+        //echo '<em>'.get_lang('ToDoThisYouMustEnterYearComponentAndComponentStep').'</em><br />';
64
+        ///echo get_lang('FollowEachOfTheseStepsStepByStep').'<br />';
65
+
66
+        echo '<form method="get" action="'.api_get_self().'"><br />';
67
+        echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
68
+        echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"><br />';
69
+        echo '<input type="submit" value="'.get_lang('Submit').'">';
70
+        echo '</form>';
71
+        echo '</div>';
72 72
 
73 73
 }
74 74
 /*
@@ -200,71 +200,71 @@  discard block
 block discarded – undo
200 200
 */
201 201
 elseif(!empty($annee) && empty($course))
202 202
 {
203
-	Display::display_header($tool_name);
204
-	echo '<div style="align:center">';
205
-	echo Display::return_icon('course.png', get_lang('SelectCourseToImportUsersTo')).' '.get_lang('SelectCourseToImportUsersTo').'<br />';
206
-	echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
207
-	echo '<select name="course">';
208
-	$courses = CourseManager::get_courses_list();
209
-	foreach($courses as $row)
210
-	{
211
-		echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>';
212
-	}
213
-	echo '</select>';
214
-	echo '<input type="submit" value="'.get_lang('Submit').'">';
215
-	echo '</form>';
216
-	echo '</div>';
203
+    Display::display_header($tool_name);
204
+    echo '<div style="align:center">';
205
+    echo Display::return_icon('course.png', get_lang('SelectCourseToImportUsersTo')).' '.get_lang('SelectCourseToImportUsersTo').'<br />';
206
+    echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
207
+    echo '<select name="course">';
208
+    $courses = CourseManager::get_courses_list();
209
+    foreach($courses as $row)
210
+    {
211
+        echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>';
212
+    }
213
+    echo '</select>';
214
+    echo '<input type="submit" value="'.get_lang('Submit').'">';
215
+    echo '</form>';
216
+    echo '</div>';
217 217
 }
218 218
 // form4  annee != 0; composante != 0 etape != 0
219 219
 //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') {
220 220
 elseif (!empty($annee) && !empty($course) && empty($_POST['confirmed']))
221 221
 {
222
-	Display::display_header($tool_name);
223
-	echo '<div style="align: center;">';
224
-	echo '<br />';
225
-	echo '<br />';
226
-	echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
227
-	//echo "Connection ...";
228
-	$ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
229
-	ldap_set_version($ds);
230
-
231
-	if ($ds) {
232
-
233
-		$r = false;
234
-		$res = ldap_handle_bind($ds, $r);
235
-
236
-		//$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
237
-		//echo "(ou=*$annee,ou=$composante)";
238
-		$sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
239
-
240
-		$info = ldap_get_entries($ds, $sr);
241
-
242
-		for ($key = 0; $key < $info["count"]; $key ++) {
243
-			$nom_form[] = $info[$key]["sn"][0];
244
-			$prenom_form[] = $info[$key]["givenname"][0];
245
-			$email_form[] = $info[$key]["mail"][0];
246
-			// Get uid from dn
247
-			//$dn_array=ldap_explode_dn($info[$key]["dn"],1);
248
-			//$username_form[] = $dn_array[0]; // uid is first key
249
-			$username_form[] = $info[$key]['uid'][0];
250
-			$outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
251
-			//$val = ldap_get_values_len($ds, $entry, "userPassword");
252
-			//$password_form[] = $val[0];
253
-			$password_form[] = $info[$key]['userPassword'][0];
254
-		}
255
-		ldap_unbind($ds);
256
-
257
-		/*-----------------------------------------------*/
258
-
259
-		asort($nom_form);
260
-		reset($nom_form);
261
-
262
-		$statut=5;
263
-		include ('ldap_form_add_users_group.php');
264
-	} else {
265
-		echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
266
-	}
267
-	echo '<br /><br />';
222
+    Display::display_header($tool_name);
223
+    echo '<div style="align: center;">';
224
+    echo '<br />';
225
+    echo '<br />';
226
+    echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
227
+    //echo "Connection ...";
228
+    $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
229
+    ldap_set_version($ds);
230
+
231
+    if ($ds) {
232
+
233
+        $r = false;
234
+        $res = ldap_handle_bind($ds, $r);
235
+
236
+        //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
237
+        //echo "(ou=*$annee,ou=$composante)";
238
+        $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
239
+
240
+        $info = ldap_get_entries($ds, $sr);
241
+
242
+        for ($key = 0; $key < $info["count"]; $key ++) {
243
+            $nom_form[] = $info[$key]["sn"][0];
244
+            $prenom_form[] = $info[$key]["givenname"][0];
245
+            $email_form[] = $info[$key]["mail"][0];
246
+            // Get uid from dn
247
+            //$dn_array=ldap_explode_dn($info[$key]["dn"],1);
248
+            //$username_form[] = $dn_array[0]; // uid is first key
249
+            $username_form[] = $info[$key]['uid'][0];
250
+            $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
251
+            //$val = ldap_get_values_len($ds, $entry, "userPassword");
252
+            //$password_form[] = $val[0];
253
+            $password_form[] = $info[$key]['userPassword'][0];
254
+        }
255
+        ldap_unbind($ds);
256
+
257
+        /*-----------------------------------------------*/
258
+
259
+        asort($nom_form);
260
+        reset($nom_form);
261
+
262
+        $statut=5;
263
+        include ('ldap_form_add_users_group.php');
264
+    } else {
265
+        echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
266
+    }
267
+    echo '<br /><br />';
268 268
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
269 269
     echo '<br /><br />';
270 270
     echo '</div>';
@@ -272,27 +272,27 @@  discard block
 block discarded – undo
272 272
 }
273 273
 elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes'))
274 274
 {
275
-	$id=$_POST['username_form'];
276
-	$UserList=array();
277
-	$userid_match_login = array();
278
-	foreach ($id as $form_index=>$user_id)
279
-	{
280
-		if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
281
-		{
282
-			$tmp = ldap_add_user($user_id);
283
-			$UserList[]= $tmp;
284
-			$userid_match_login[$tmp] = $user_id;
285
-		}
286
-	}
287
-	if (!empty($_POST['course']))
288
-	{
289
-		foreach($UserList as $user_id)
290
-		{
291
-			CourseManager::add_user_to_course($user_id,$_POST['course']);
292
-		}
293
-		header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
294
-	}
295
-	/*
275
+    $id=$_POST['username_form'];
276
+    $UserList=array();
277
+    $userid_match_login = array();
278
+    foreach ($id as $form_index=>$user_id)
279
+    {
280
+        if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
281
+        {
282
+            $tmp = ldap_add_user($user_id);
283
+            $UserList[]= $tmp;
284
+            $userid_match_login[$tmp] = $user_id;
285
+        }
286
+    }
287
+    if (!empty($_POST['course']))
288
+    {
289
+        foreach($UserList as $user_id)
290
+        {
291
+            CourseManager::add_user_to_course($user_id,$_POST['course']);
292
+        }
293
+        header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
294
+    }
295
+    /*
296 296
 	else
297 297
 	{
298 298
 		Display :: display_header($tool_name);
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 		Display :: display_normal_message($message,false);
312 312
 	}
313 313
 	*/
314
-	else
315
-	{
316
-		Display::display_header($tool_name);
317
-		$message=get_lang('NoUserAdded');
318
-		Display :: display_normal_message($message,false);
319
-	}
320
-	echo '<br /><br />';
314
+    else
315
+    {
316
+        Display::display_header($tool_name);
317
+        $message=get_lang('NoUserAdded');
318
+        Display :: display_normal_message($message,false);
319
+    }
320
+    echo '<br /><br />';
321 321
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
322 322
     echo '<br /><br />';
323 323
 }
Please login to merge, or discard this patch.
main/admin/skills_import.php 1 patch
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * This tool allows platform admins to add skills by uploading a CSV or XML file
5
- * @package chamilo.admin
6
- * @documentation Some interesting basic skills can be found in the "Skills"
7
- * section here: http://en.wikipedia.org/wiki/Personal_knowledge_management
8
- */
4
+                         * This tool allows platform admins to add skills by uploading a CSV or XML file
5
+                         * @package chamilo.admin
6
+                         * @documentation Some interesting basic skills can be found in the "Skills"
7
+                         * section here: http://en.wikipedia.org/wiki/Personal_knowledge_management
8
+                         */
9 9
 
10 10
 $cidReset = true;
11 11
 require_once '../inc/global.inc.php';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             $oskill = new Skill();
71 71
             $skill_id = $oskill->add($skill);
72 72
             $parents[$saved_id] = $skill_id;
73
-		}
73
+        }
74 74
     }
75 75
 }
76 76
 
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
  */
82 82
 function parse_csv_data($file)
83 83
 {
84
-	$skills = Import :: csvToArray($file);
85
-	foreach ($skills as $index => $skill) {
86
-		$skills[$index] = $skill;
87
-	}
84
+    $skills = Import :: csvToArray($file);
85
+    foreach ($skills as $index => $skill) {
86
+        $skills[$index] = $skill;
87
+    }
88 88
 
89
-	return $skills;
89
+    return $skills;
90 90
 }
91 91
 
92 92
 /**
@@ -94,16 +94,16 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function element_start($parser, $data)
96 96
 {
97
-	$data = api_utf8_decode($data);
98
-	global $skill;
99
-	global $current_tag;
100
-	switch ($data) {
101
-		case 'Skill' :
102
-			$skill = array ();
103
-			break;
104
-		default :
105
-			$current_tag = $data;
106
-	}
97
+    $data = api_utf8_decode($data);
98
+    global $skill;
99
+    global $current_tag;
100
+    switch ($data) {
101
+        case 'Skill' :
102
+            $skill = array ();
103
+            break;
104
+        default :
105
+            $current_tag = $data;
106
+    }
107 107
 }
108 108
 
109 109
 /**
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function element_end($parser, $data)
113 113
 {
114
-	$data = api_utf8_decode($data);
115
-	global $skill;
116
-	global $skills;
117
-	global $current_value;
118
-	switch ($data) {
119
-		case 'Skill' :
120
-			$skills[] = $skill;
121
-			break;
122
-		default :
123
-			$skill[$data] = $current_value;
124
-			break;
125
-	}
114
+    $data = api_utf8_decode($data);
115
+    global $skill;
116
+    global $skills;
117
+    global $current_value;
118
+    switch ($data) {
119
+        case 'Skill' :
120
+            $skills[] = $skill;
121
+            break;
122
+        default :
123
+            $skill[$data] = $current_value;
124
+            break;
125
+    }
126 126
 }
127 127
 
128 128
 /**
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
  */
131 131
 function character_data($parser, $data)
132 132
 {
133
-	$data = trim(api_utf8_decode($data));
134
-	global $current_value;
135
-	$current_value = $data;
133
+    $data = trim(api_utf8_decode($data));
134
+    global $current_value;
135
+    $current_value = $data;
136 136
 }
137 137
 
138 138
 /**
@@ -142,19 +142,19 @@  discard block
 block discarded – undo
142 142
  */
143 143
 function parse_xml_data($file)
144 144
 {
145
-	global $current_tag;
146
-	global $current_value;
147
-	global $skill;
148
-	global $skills;
149
-	$skills = array();
150
-	$parser = xml_parser_create('UTF-8');
151
-	xml_set_element_handler($parser, 'element_start', 'element_end');
152
-	xml_set_character_data_handler($parser, 'character_data');
153
-	xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
154
-	xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
155
-	xml_parser_free($parser);
145
+    global $current_tag;
146
+    global $current_value;
147
+    global $skill;
148
+    global $skills;
149
+    $skills = array();
150
+    $parser = xml_parser_create('UTF-8');
151
+    xml_set_element_handler($parser, 'element_start', 'element_end');
152
+    xml_set_character_data_handler($parser, 'character_data');
153
+    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
154
+    xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
155
+    xml_parser_free($parser);
156 156
 
157
-	return $skills;
157
+    return $skills;
158 158
 }
159 159
 
160 160
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -169,81 +169,81 @@  discard block
 block discarded – undo
169 169
 $error_message = '';
170 170
 
171 171
 if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
172
-	$file_type = $_POST['file_type'];
173
-	Security::clear_token();
174
-	$tok = Security::get_token();
175
-	$allowed_file_mimetype = array('csv','xml');
176
-	$error_kind_file = false;
172
+    $file_type = $_POST['file_type'];
173
+    Security::clear_token();
174
+    $tok = Security::get_token();
175
+    $allowed_file_mimetype = array('csv','xml');
176
+    $error_kind_file = false;
177 177
     $error_message = '';
178 178
 
179
-	$ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'],'.')+1));
179
+    $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'],'.')+1));
180 180
 
181
-	if (in_array($ext_import_file,$allowed_file_mimetype)) {
182
-		if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) {
183
-			$skills	= parse_csv_data($_FILES['import_file']['tmp_name']);
184
-			$errors = validate_data($skills);
185
-			$error_kind_file = false;
186
-		} elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) {
187
-			$skills = parse_xml_data($_FILES['import_file']['tmp_name']);
188
-			$errors = validate_data($skills);
189
-			$error_kind_file = false;
190
-		} else {
191
-			$error_kind_file = true;
192
-		}
193
-	} else {
194
-		$error_kind_file = true;
195
-	}
181
+    if (in_array($ext_import_file,$allowed_file_mimetype)) {
182
+        if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) {
183
+            $skills	= parse_csv_data($_FILES['import_file']['tmp_name']);
184
+            $errors = validate_data($skills);
185
+            $error_kind_file = false;
186
+        } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) {
187
+            $skills = parse_xml_data($_FILES['import_file']['tmp_name']);
188
+            $errors = validate_data($skills);
189
+            $error_kind_file = false;
190
+        } else {
191
+            $error_kind_file = true;
192
+        }
193
+    } else {
194
+        $error_kind_file = true;
195
+    }
196 196
 
197
-	// List skill id with error.
198
-	$skills_to_insert = $skill_id_error = array();
199
-	if (is_array($errors)) {
200
-		foreach ($errors as $my_errors) {
201
-			$skill_id_error[] = $my_errors['SkillName'];
202
-		}
203
-	}
204
-	if (is_array($skills)) {
205
-		foreach ($skills as $my_skill) {
206
-			if (isset($my_skill['name']) && !in_array($my_skill['name'], $skill_id_error)) {
207
-				$skills_to_insert[] = $my_skill;
208
-			}
209
-		}
210
-	}
197
+    // List skill id with error.
198
+    $skills_to_insert = $skill_id_error = array();
199
+    if (is_array($errors)) {
200
+        foreach ($errors as $my_errors) {
201
+            $skill_id_error[] = $my_errors['SkillName'];
202
+        }
203
+    }
204
+    if (is_array($skills)) {
205
+        foreach ($skills as $my_skill) {
206
+            if (isset($my_skill['name']) && !in_array($my_skill['name'], $skill_id_error)) {
207
+                $skills_to_insert[] = $my_skill;
208
+            }
209
+        }
210
+    }
211 211
 
212
-	if (strcmp($file_type, 'csv') === 0) {
213
-		save_data($skills_to_insert);
214
-	} elseif (strcmp($file_type, 'xml') === 0) {
215
-		save_data($skills_to_insert);
216
-	} else {
217
-		$error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
218
-	}
212
+    if (strcmp($file_type, 'csv') === 0) {
213
+        save_data($skills_to_insert);
214
+    } elseif (strcmp($file_type, 'xml') === 0) {
215
+        save_data($skills_to_insert);
216
+    } else {
217
+        $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
218
+    }
219 219
 
220
-	if (count($errors) > 0) {
221
-		$see_message_import = get_lang('FileImportedJustSkillsThatAreNotRegistered');
222
-	} else {
223
-		$see_message_import = get_lang('FileImported');
224
-	}
220
+    if (count($errors) > 0) {
221
+        $see_message_import = get_lang('FileImportedJustSkillsThatAreNotRegistered');
222
+    } else {
223
+        $see_message_import = get_lang('FileImported');
224
+    }
225 225
 
226
-	if (count($errors) != 0) {
227
-		$warning_message = '<ul>';
228
-		foreach ($errors as $index => $error_skill) {
229
-			$warning_message .= '<li><b>'.$error_skill['error'].'</b>: ';
230
-			$warning_message .= '<strong>'.$error_skill['SkillName'].'</strong>&nbsp;('.$error_skill['SkillName'].')';
231
-			$warning_message .= '</li>';
232
-		}
233
-		$warning_message .= '</ul>';
234
-	}
226
+    if (count($errors) != 0) {
227
+        $warning_message = '<ul>';
228
+        foreach ($errors as $index => $error_skill) {
229
+            $warning_message .= '<li><b>'.$error_skill['error'].'</b>: ';
230
+            $warning_message .= '<strong>'.$error_skill['SkillName'].'</strong>&nbsp;('.$error_skill['SkillName'].')';
231
+            $warning_message .= '</li>';
232
+        }
233
+        $warning_message .= '</ul>';
234
+    }
235 235
 
236 236
     if ($error_kind_file) {
237
-		$error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
238
-	}
237
+        $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
238
+    }
239 239
 }
240 240
 Display :: display_header($tool_name);
241 241
 
242 242
 if (!empty($error_message)) {
243
-	Display::display_error_message($error_message);
243
+    Display::display_error_message($error_message);
244 244
 }
245 245
 if (!empty($see_message_import)) {
246
-	Display::display_normal_message($see_message_import);
246
+    Display::display_normal_message($see_message_import);
247 247
 }
248 248
 
249 249
 $form = new FormValidator('user_import','post','skills_import.php');
@@ -266,16 +266,16 @@  discard block
 block discarded – undo
266 266
 $i = 0;
267 267
 $count_fields = count($extra_fields);
268 268
 if ($count_fields > 0) {
269
-	foreach ($extra_fields as $extra) {
270
-		$list[] = $extra[1];
271
-		$list_reponse[] = 'xxx';
272
-		$spaces = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
273
-		$result_xml .= $spaces.'&lt;'.$extra[1].'&gt;xxx&lt;/'.$extra[1].'&gt;';
274
-		if ($i != $count_fields - 1) {
275
-			$result_xml .= '<br/>';
276
-		}
277
-		$i++;
278
-	}
269
+    foreach ($extra_fields as $extra) {
270
+        $list[] = $extra[1];
271
+        $list_reponse[] = 'xxx';
272
+        $spaces = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
273
+        $result_xml .= $spaces.'&lt;'.$extra[1].'&gt;xxx&lt;/'.$extra[1].'&gt;';
274
+        if ($i != $count_fields - 1) {
275
+            $result_xml .= '<br/>';
276
+        }
277
+        $i++;
278
+    }
279 279
 }
280 280
 ?>
281 281
 <p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
Please login to merge, or discard this patch.
main/document/edit_paint.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -61,44 +61,44 @@  discard block
 block discarded – undo
61 61
 /* Please, do not modify this dirname formatting */
62 62
 
63 63
 if (strstr($dir, '..')) {
64
-	$dir = '/';
64
+    $dir = '/';
65 65
 }
66 66
 
67 67
 if ($dir[0] == '.') {
68
-	$dir = substr($dir, 1);
68
+    $dir = substr($dir, 1);
69 69
 }
70 70
 
71 71
 if ($dir[0] != '/') {
72
-	$dir = '/'.$dir;
72
+    $dir = '/'.$dir;
73 73
 }
74 74
 
75 75
 if ($dir[strlen($dir) - 1] != '/') {
76
-	$dir .= '/';
76
+    $dir .= '/';
77 77
 }
78 78
 
79 79
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
80 80
 
81 81
 if (!is_dir($filepath)) {
82
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
83
-	$dir = '/';
82
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
83
+    $dir = '/';
84 84
 }
85 85
 
86 86
 //groups //TODO:clean
87 87
 if (!empty($groupId)) {
88
-	$interbreadcrumb[] = array(
89
-		'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
90
-		'name' => get_lang('GroupSpace'),
91
-	);
92
-	$group_document = true;
93
-	$noPHP_SELF = true;
88
+    $interbreadcrumb[] = array(
89
+        'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
90
+        'name' => get_lang('GroupSpace'),
91
+    );
92
+    $group_document = true;
93
+    $noPHP_SELF = true;
94 94
 }
95 95
 
96 96
 $is_certificate_mode = DocumentManager::is_certificate_mode($dir);
97 97
 
98 98
 if (!$is_certificate_mode)
99
-	$interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
99
+    $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
100 100
 else
101
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
101
+    $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
102 102
 
103 103
 // Interbreadcrumb for the current directory root path
104 104
 if (empty($document_data['parents'])) {
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 }
114 114
 
115 115
 $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] ||
116
-	DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
116
+    DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
117 117
 
118 118
 if (!$is_allowedToEdit) {
119
-	api_not_allowed(true);
119
+    api_not_allowed(true);
120 120
 }
121 121
 
122 122
 Event::event_access_tool(TOOL_DOCUMENT);
@@ -148,21 +148,21 @@  discard block
 block discarded – undo
148 148
 $locktitle="false";
149 149
 
150 150
 if ($_SERVER['HTTP_HOST']=="localhost") {
151
-	$path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
152
-	if (!file_exists($path_and_file)) {
153
-		$crossdomain='<?xml version="1.0"?>
151
+    $path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
152
+    if (!file_exists($path_and_file)) {
153
+        $crossdomain='<?xml version="1.0"?>
154 154
 			<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
155 155
 			<cross-domain-policy>
156 156
 				<allow-access-from domain="cdn.pixlr.com" />
157 157
 				<site-control permitted-cross-domain-policies="master-only"/>
158 158
 				<allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/>
159 159
 			</cross-domain-policy>';//more open domain="*"
160
-		@file_put_contents($path_and_file, $crossdomain);
161
-	}
162
-	$credentials="true";
160
+        @file_put_contents($path_and_file, $crossdomain);
161
+    }
162
+    $credentials="true";
163 163
 }
164 164
 else {
165
-	$credentials="false";
165
+    $credentials="false";
166 166
 }
167 167
 
168 168
 //make temp images
@@ -175,23 +175,23 @@  discard block
 block discarded – undo
175 175
 $htaccess=api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess';
176 176
 if (!file_exists($htaccess)) {
177 177
 
178
-	$htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
178
+    $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
179 179
 
180
-	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
181
-	if ($fp) {
182
-		fwrite($fp, $htaccess_content);
183
-		fclose($fp);
184
-	}
180
+    $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
181
+    if ($fp) {
182
+        fwrite($fp, $htaccess_content);
183
+        fclose($fp);
184
+    }
185 185
 }
186 186
 
187 187
 $html_index=api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html';
188 188
 if (!file_exists($html_index)) {
189
-	$html_index_content="<html><head></head><body></body></html>";
190
-	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
191
-	if ($fp) {
192
-		fwrite($fp, $html_index_content);
193
-		fclose($fp);
194
-	}
189
+    $html_index_content="<html><head></head><body></body></html>";
190
+    $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
191
+    if ($fp) {
192
+        fwrite($fp, $html_index_content);
193
+        fclose($fp);
194
+    }
195 195
 }
196 196
 
197 197
 //encript temp name file
Please login to merge, or discard this patch.
main/document/slideshow.php 1 patch
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * @author Patrick Cool [email protected] Ghent University Mai 2004
5
- * @author Julio Montoya Lots of improvements, cleaning, adding security
6
- * @author Juan Carlos Raña Trabado [email protected]	January 2008
7
- * @package chamilo.document
8
- */
4
+     * @author Patrick Cool [email protected] Ghent University Mai 2004
5
+     * @author Julio Montoya Lots of improvements, cleaning, adding security
6
+     * @author Juan Carlos Raña Trabado [email protected]	January 2008
7
+     * @package chamilo.document
8
+     */
9 9
 require_once '../inc/global.inc.php';
10 10
 api_protect_course_script();
11 11
 
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 $slide_id = isset($_GET['slide_id']) ? Security::remove_XSS($_GET['slide_id']) : null;
16 16
 
17 17
 if (empty($slide_id)) {
18
-	$edit_slide_id = 1;
18
+    $edit_slide_id = 1;
19 19
 } else {
20
-	$edit_slide_id = $slide_id;
20
+    $edit_slide_id = $slide_id;
21 21
 }
22 22
 
23 23
 if ($path != '/') {
24
-	$folder = $path.'/';
24
+    $folder = $path.'/';
25 25
 } else {
26
-	$folder = '/';
26
+    $folder = '/';
27 27
 }
28 28
 $sys_course_path = api_get_path(SYS_COURSE_PATH);
29 29
 
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 
42 42
 // Loading the slides from the session
43 43
 if (isset($_SESSION['image_files_only'])) {
44
-	$image_files_only = $_SESSION['image_files_only'];
44
+    $image_files_only = $_SESSION['image_files_only'];
45 45
 }
46 46
 
47 47
 // Calculating the current slide, next slide, previous slide and the number of slides
48 48
 $slide = null;
49 49
 if ($slide_id != 'all') {
50
-	$slide = $slide_id ? $slide_id : 0;
51
-	$previous_slide = $slide - 1;
52
-	$next_slide = $slide + 1;
50
+    $slide = $slide_id ? $slide_id : 0;
51
+    $previous_slide = $slide - 1;
52
+    $next_slide = $slide + 1;
53 53
 }
54 54
 $total_slides = count($image_files_only);
55 55
 ?>
@@ -62,62 +62,62 @@  discard block
 block discarded – undo
62 62
 <?php
63 63
 
64 64
 if ($slide_id != 'all') {
65
-	$image = null;
66
-	if (isset($image_files_only[$slide])) {
67
-		$image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide];
68
-	}
69
-	if (file_exists($image)) {
70
-		echo '<div class="actions-pagination">';
71
-
72
-		// Back forward buttons
73
-		if ($slide == 0) {
74
-			$imgp = 'action_prev_na.png';
75
-			$first = Display::return_icon('action_first_na.png');
76
-		} else {
77
-			$imgp = 'action_prev.png';
78
-			$first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'">
65
+    $image = null;
66
+    if (isset($image_files_only[$slide])) {
67
+        $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide];
68
+    }
69
+    if (file_exists($image)) {
70
+        echo '<div class="actions-pagination">';
71
+
72
+        // Back forward buttons
73
+        if ($slide == 0) {
74
+            $imgp = 'action_prev_na.png';
75
+            $first = Display::return_icon('action_first_na.png');
76
+        } else {
77
+            $imgp = 'action_prev.png';
78
+            $first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'">
79 79
 			          '.Display::return_icon('action_first.png', get_lang('FirstSlide')).'
80 80
 			          </a>';
81
-		}
81
+        }
82 82
 
83
-		// First slide
84
-		echo $first;
83
+        // First slide
84
+        echo $first;
85 85
 
86
-		// Previous slide
87
-		if ($slide > 0) {
88
-			echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">';
89
-		}
86
+        // Previous slide
87
+        if ($slide > 0) {
88
+            echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">';
89
+        }
90 90
 
91 91
         echo Display::return_icon($imgp, get_lang('Previous'));
92
-		if ($slide > 0) {
93
-			echo '</a>';
94
-		}
95
-
96
-		// Divider
97
-		echo ' [ '.$next_slide.'/'.$total_slides.' ] ';
98
-
99
-		// Next slide
100
-		if ($slide < $total_slides - 1) {
101
-			echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">';
102
-		}
103
-		if ($slide == $total_slides - 1) {
104
-			$imgn = 'action_next_na.png';
92
+        if ($slide > 0) {
93
+            echo '</a>';
94
+        }
95
+
96
+        // Divider
97
+        echo ' [ '.$next_slide.'/'.$total_slides.' ] ';
98
+
99
+        // Next slide
100
+        if ($slide < $total_slides - 1) {
101
+            echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">';
102
+        }
103
+        if ($slide == $total_slides - 1) {
104
+            $imgn = 'action_next_na.png';
105 105
             $last = Display::return_icon('action_last_na.png', get_lang('LastSlide'));
106
-		} else {
107
-			$imgn = 'action_next.png';
108
-			$last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'">
106
+        } else {
107
+            $imgn = 'action_next.png';
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
+        }
112 112
         echo Display::return_icon($imgn, get_lang('Next'));
113
-		if ($slide > 0) {
114
-			echo '</a>';
115
-		}
116
-
117
-		// Last slide
118
-		echo $last;
119
-		echo '</div>';
120
-	}
113
+        if ($slide > 0) {
114
+            echo '</a>';
115
+        }
116
+
117
+        // Last slide
118
+        echo $last;
119
+        echo '</div>';
120
+    }
121 121
 }
122 122
 
123 123
 // Exit the slideshow
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
 
127 127
 // Show thumbnails
128 128
 if ($slide_id != 'all') {
129
-	echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
129
+    echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
130 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().'">'.
@@ -142,24 +142,24 @@  discard block
 block discarded – undo
142 142
 
143 143
 // If we come from slideshowoptions.php we sessionize (new word !!! ;-) the options
144 144
 if (isset($_POST['Submit'])) {
145
-	// We come from slideshowoptions.php
146
-	//$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']);
147
-	$_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']);
148
-	if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
149
-		//echo "resizing";
150
-		$_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
151
-		$_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
152
-	} else {
153
-		//echo "unsetting the session heighte and width";
154
-		$_SESSION["image_resizing_width"] = null;
155
-		$_SESSION["image_resizing_height"] = null;
156
-	}
145
+    // We come from slideshowoptions.php
146
+    //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']);
147
+    $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']);
148
+    if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
149
+        //echo "resizing";
150
+        $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
151
+        $_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
152
+    } else {
153
+        //echo "unsetting the session heighte and width";
154
+        $_SESSION["image_resizing_width"] = null;
155
+        $_SESSION["image_resizing_height"] = null;
156
+    }
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 160
 if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == "resizing") {
161
-	$target_width = $_SESSION["image_resizing_width"];
162
-	$target_height = $_SESSION["image_resizing_height"];
161
+    $target_width = $_SESSION["image_resizing_width"];
162
+    $target_height = $_SESSION["image_resizing_height"];
163 163
 }
164 164
 
165 165
 /*	THUMBNAIL VIEW */
@@ -169,59 +169,59 @@  discard block
 block discarded – undo
169 169
 $html = '';
170 170
 if ($slide_id == 'all') {
171 171
 
172
-	// Config for make thumbnails
172
+    // Config for make thumbnails
173 173
     $allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png');
174
-	$max_thumbnail_width     = 250;
175
-	$max_thumbnail_height    = 250;
176
-	$png_compression	     = 0; // 0(none)-9
177
-	$jpg_quality  	         = 75; // from 0 to 100 (default is 75). More quality less compression
174
+    $max_thumbnail_width     = 250;
175
+    $max_thumbnail_height    = 250;
176
+    $png_compression	     = 0; // 0(none)-9
177
+    $jpg_quality  	         = 75; // from 0 to 100 (default is 75). More quality less compression
178 178
 
179
-	$directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
179
+    $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
180 180
 
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
185
-	$thumbnail_height_frame = $max_thumbnail_height;
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
185
+    $thumbnail_height_frame = $max_thumbnail_height;
186 186
 
187
-	// Create the template_thumbnails folder (if no exist)
187
+    // Create the template_thumbnails folder (if no exist)
188 188
 
189
-	if (!file_exists($directory_thumbnails)) {
190
-		@mkdir($directory_thumbnails, api_get_permissions_for_new_directories());
189
+    if (!file_exists($directory_thumbnails)) {
190
+        @mkdir($directory_thumbnails, api_get_permissions_for_new_directories());
191 191
     }
192 192
 
193
-	// check files and thumbnails
194
-	if (is_array($image_files_only)) {
193
+    // check files and thumbnails
194
+    if (is_array($image_files_only)) {
195 195
 
196
-		foreach ($image_files_only as $one_image_file) {
197
-			$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
198
-			$image_thumbnail= $directory_thumbnails.'.'.$one_image_file;
196
+        foreach ($image_files_only as $one_image_file) {
197
+            $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
198
+            $image_thumbnail= $directory_thumbnails.'.'.$one_image_file;
199 199
 
200
-			if (file_exists($image)) {
201
-				//check thumbnail
202
-				$imagetype = explode(".", $image);
200
+            if (file_exists($image)) {
201
+                //check thumbnail
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
-						$original_image_size = api_getimagesize($image);
210
-
211
-						switch($imagetype) {
212
-							case 'gif':
213
-								$source_img = imagecreatefromgif($image);
214
-								break;
215
-							case 'jpg':
216
-								$source_img = imagecreatefromjpeg($image);
217
-								break;
218
-							case 'jpeg':
219
-								$source_img = imagecreatefromjpeg($image);
220
-								break;
221
-							case 'png':
222
-								$source_img = imagecreatefrompng($image);
223
-								break;
224
-						}
209
+                        $original_image_size = api_getimagesize($image);
210
+
211
+                        switch($imagetype) {
212
+                            case 'gif':
213
+                                $source_img = imagecreatefromgif($image);
214
+                                break;
215
+                            case 'jpg':
216
+                                $source_img = imagecreatefromjpeg($image);
217
+                                break;
218
+                            case 'jpeg':
219
+                                $source_img = imagecreatefromjpeg($image);
220
+                                break;
221
+                            case 'png':
222
+                                $source_img = imagecreatefrompng($image);
223
+                                break;
224
+                        }
225 225
 
226 226
                         $new_thumbnail_size = api_calculate_image_size(
227 227
                             $original_image_size['width'],
@@ -229,33 +229,33 @@  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'];
235
-						}
236
-
237
-						$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
238
-
239
-						// preserve transparency
240
-						if ($imagetype == "png"){
241
-							imagesavealpha($crop, true);
242
-							$color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
243
-							imagefill($crop, 0, 0, $color);
244
-						}
245
-
246
-						if ($imagetype == "gif") {
247
-							$transindex = imagecolortransparent($source_img);
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
+                        }
236
+
237
+                        $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
238
+
239
+                        // preserve transparency
240
+                        if ($imagetype == "png"){
241
+                            imagesavealpha($crop, true);
242
+                            $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
243
+                            imagefill($crop, 0, 0, $color);
244
+                        }
245
+
246
+                        if ($imagetype == "gif") {
247
+                            $transindex = imagecolortransparent($source_img);
248 248
                             $palletsize = imagecolorstotal($source_img);
249
-							 //GIF89a for transparent and anim (first clip), either GIF87a
250
-							 if ($transindex >= 0 && $transindex < $palletsize){
251
-								 $transcol = imagecolorsforindex($source_img, $transindex);
252
-								 $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
253
-								 imagefill($crop, 0, 0, $transindex);
254
-								 imagecolortransparent($crop, $transindex);
255
-							 }
256
-						}
257
-
258
-						//resampled image
249
+                                //GIF89a for transparent and anim (first clip), either GIF87a
250
+                                if ($transindex >= 0 && $transindex < $palletsize){
251
+                                    $transcol = imagecolorsforindex($source_img, $transindex);
252
+                                    $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
253
+                                    imagefill($crop, 0, 0, $transindex);
254
+                                    imagecolortransparent($crop, $transindex);
255
+                                }
256
+                        }
257
+
258
+                        //resampled image
259 259
                         imagecopyresampled(
260 260
                             $crop,
261 261
                             $source_img,
@@ -269,69 +269,69 @@  discard block
 block discarded – undo
269 269
                             $original_image_size['height']
270 270
                         );
271 271
 
272
-						switch ($imagetype) {
273
-							case 'gif':
274
-								imagegif($crop,$image_thumbnail);
275
-								break;
276
-							case 'jpg':
277
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
278
-								break;
279
-							case 'jpeg':
280
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
281
-								break;
282
-							case 'png':
283
-								imagepng($crop,$image_thumbnail,$png_compression);
284
-								break;
285
-						}
286
-
287
-						//clean memory
288
-						imagedestroy($crop);
289
-					}//end !exist thumbnail
290
-
291
-					//show thumbnail and link
292
-
293
-					$one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
294
-					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
295
-					$image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
296
-				} else {
297
-					//if images aren't support by gd (not gif, jpg, jpeg, png)
298
-					if ($imagetype=="bmp") {
272
+                        switch ($imagetype) {
273
+                            case 'gif':
274
+                                imagegif($crop,$image_thumbnail);
275
+                                break;
276
+                            case 'jpg':
277
+                                imagejpeg($crop,$image_thumbnail,$jpg_quality);
278
+                                break;
279
+                            case 'jpeg':
280
+                                imagejpeg($crop,$image_thumbnail,$jpg_quality);
281
+                                break;
282
+                            case 'png':
283
+                                imagepng($crop,$image_thumbnail,$png_compression);
284
+                                break;
285
+                        }
286
+
287
+                        //clean memory
288
+                        imagedestroy($crop);
289
+                    }//end !exist thumbnail
290
+
291
+                    //show thumbnail and link
292
+
293
+                    $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
294
+                    $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
295
+                    $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
296
+                } else {
297
+                    //if images aren't support by gd (not gif, jpg, jpeg, png)
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
-						$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
303
-							$image_height = $thumbnail_size['height'];
304
-							$image_width  = $thumbnail_size['width'];
305
-						} else {
306
-							$image_height=$original_image_size[0];
307
-							$image_width=$original_image_size[1];
308
-						}
309
-					} else {
310
-						//example for svg files,...
311
-						$image_width=$max_thumbnail_width;
312
-						$image_height=$max_thumbnail_height;
313
-					}
314
-
315
-					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
316
-					$image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">';
317
-
318
-				}//end allowed image types
319
-			}//end if exist file image
320
-		}//end foreach
321
-	}//end image files only
322
-
323
-	// Creating the table
324
-	$html_table = '';
325
-
326
-	$i = 0;
327
-	$count_image = count($image_tag);
328
-	$number_iteration = ceil($count_image/$number_image);
329
-	$p = 0;
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
303
+                            $image_height = $thumbnail_size['height'];
304
+                            $image_width  = $thumbnail_size['width'];
305
+                        } else {
306
+                            $image_height=$original_image_size[0];
307
+                            $image_width=$original_image_size[1];
308
+                        }
309
+                    } else {
310
+                        //example for svg files,...
311
+                        $image_width=$max_thumbnail_width;
312
+                        $image_height=$max_thumbnail_height;
313
+                    }
314
+
315
+                    $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
316
+                    $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">';
317
+
318
+                }//end allowed image types
319
+            }//end if exist file image
320
+        }//end foreach
321
+    }//end image files only
322
+
323
+    // Creating the table
324
+    $html_table = '';
325
+
326
+    $i = 0;
327
+    $count_image = count($image_tag);
328
+    $number_iteration = ceil($count_image/$number_image);
329
+    $p = 0;
330 330
     $html = '';
331 331
     $html .= '<div class="gallery">';
332
-	for ($k = 0; $k < $number_iteration; $k++) {
333
-		for ($i = 0; $i < $number_image; $i++) {
334
-			if (isset($image_tag[$p])) {
332
+    for ($k = 0; $k < $number_iteration; $k++) {
333
+        for ($i = 0; $i < $number_image; $i++) {
334
+            if (isset($image_tag[$p])) {
335 335
                             $html .= '<div class="col-xs-6 col-sm-3 col-md-2">';
336 336
                             $html .= '<div class="canvas-one">';
337 337
                             $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">';
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
                             $html .= '</a>';
344 344
                             $html .= '</div>';
345 345
                             $html .= '</div>';
346
-			}
347
-			$p++;
348
-		}
349
-	}
346
+            }
347
+            $p++;
348
+        }
349
+    }
350 350
     $html .= '</div>';
351 351
 
352 352
 }//end slide==all
@@ -357,43 +357,43 @@  discard block
 block discarded – undo
357 357
 // This is for viewing all the images in the slideshow one at a time.
358 358
 
359 359
 if ($slide_id != 'all' && !empty($image_files_only)) {
360
-	if (file_exists($image) && is_file($image)) {
361
-		$image_height_width = resize_image($image, $target_width, $target_height);
362
-
363
-		$image_height = $image_height_width[0];
364
-		$image_width = $image_height_width[1];
365
-
366
-		$height_width_tags = null;
367
-		if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
368
-			$height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
369
-		}
370
-
371
-		// This is done really quickly and should be cleaned up a little bit using the API functions
372
-		$tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
373
-		if ($path == '/') {
374
-			$pathpart = '/';
375
-		} else {
376
-			$pathpart = $path.'/';
377
-		}
378
-		$sql = "SELECT * FROM $tbl_documents
360
+    if (file_exists($image) && is_file($image)) {
361
+        $image_height_width = resize_image($image, $target_width, $target_height);
362
+
363
+        $image_height = $image_height_width[0];
364
+        $image_width = $image_height_width[1];
365
+
366
+        $height_width_tags = null;
367
+        if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
368
+            $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
369
+        }
370
+
371
+        // This is done really quickly and should be cleaned up a little bit using the API functions
372
+        $tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
373
+        if ($path == '/') {
374
+            $pathpart = '/';
375
+        } else {
376
+            $pathpart = $path.'/';
377
+        }
378
+        $sql = "SELECT * FROM $tbl_documents
379 379
 		        WHERE c_id = $course_id AND path='".Database::escape_string($pathpart.$image_files_only[$slide])."'";
380
-		$result = Database::query($sql);
381
-		$row = Database::fetch_array($result);
380
+        $result = Database::query($sql);
381
+        $row = Database::fetch_array($result);
382 382
 
383 383
         echo '<div class="thumbnail">';
384
-		if ($slide < $total_slides - 1 && $slide_id != 'all') {
385
-			echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>";
386
-		} else {
387
-			echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>";
388
-		}
384
+        if ($slide < $total_slides - 1 && $slide_id != 'all') {
385
+            echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>";
386
+        } else {
387
+            echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>";
388
+        }
389 389
         if ($path == '/') {
390
-        	$path = '';
390
+            $path = '';
391 391
         }
392 392
 
393
-		list($width, $height) = getimagesize($image);
394
-		// Auto resize
395
-		if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == 'resizing') {
396
-		?>
393
+        list($width, $height) = getimagesize($image);
394
+        // Auto resize
395
+        if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == 'resizing') {
396
+        ?>
397 397
 
398 398
 		<script type="text/javascript">
399 399
 			var initial_width='<?php echo $width; ?>';
@@ -446,21 +446,21 @@  discard block
 block discarded – undo
446 446
 
447 447
 		</script>
448 448
     <?php
449
-		} else {
450
-			echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">";
451
-		}
449
+        } else {
450
+            echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">";
451
+        }
452 452
 
453
-		echo '</a>';
453
+        echo '</a>';
454 454
         echo '<div class="caption text-center">';
455 455
         echo Display::tag('h3', $row['title']);
456 456
         echo '<p>' . $row['comment'] . '</p>';
457 457
         echo '</div>';
458 458
         echo '</div>';
459 459
 
460
-		if (api_is_allowed_to_edit(null, true)) {
460
+        if (api_is_allowed_to_edit(null, true)) {
461 461
             echo '<ul class="list-unstyled">';
462
-			$aux = explode('.', htmlspecialchars($image_files_only[$slide]));
463
-			$ext = $aux[count($aux) - 1];
462
+            $aux = explode('.', htmlspecialchars($image_files_only[$slide]));
463
+            $ext = $aux[count($aux) - 1];
464 464
 
465 465
             if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
466 466
                 $resize_info = get_lang('Resizing').'<br />';
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
                 $resize_height = get_lang('Auto');
473 473
             } else {
474 474
                 $resize_info = get_lang('NoResizing').'<br />';
475
-				$resize_width = '';
476
-				$resize_height = '';
475
+                $resize_width = '';
476
+                $resize_height = '';
477 477
             }
478 478
 
479 479
             echo '<li class="text-center">';
@@ -493,16 +493,16 @@  discard block
 block discarded – undo
493 493
             );
494 494
             echo '</li>';
495 495
             echo '<li class="text-center">' . $width.' x '.$height . '</li>';
496
-			echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>';
496
+            echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>';
497 497
             echo '<li class="text-center">' . $resize_info . '</li>';
498
-			echo '<li class="text-center">' . $resize_width . '</li>';
499
-			echo '<li class="text-center">' . $resize_height . '</li>';
498
+            echo '<li class="text-center">' . $resize_width . '</li>';
499
+            echo '<li class="text-center">' . $resize_height . '</li>';
500 500
             echo '</ul>';
501
-		}
501
+        }
502 502
 
503
-	} else {
504
-		Display::display_warning_message(get_lang('FileNotFound'));
505
-	}
503
+    } else {
504
+        Display::display_warning_message(get_lang('FileNotFound'));
505
+    }
506 506
 } else {
507 507
     if ($slide_id != 'all') {
508 508
         Display::display_warning_message(get_lang('NoDataAvailable'));
Please login to merge, or discard this patch.
main/admin/settings.lib.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
     //Plugins NOT installed
131 131
     echo Display::page_subheader(get_lang('Plugins'));
132
-    echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'&sec_token=' . $token . '">';
132
+    echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'&sec_token='.$token.'">';
133 133
     echo '<table class="data_table">';
134 134
     echo '<tr>';
135 135
     echo '<th width="20px">';
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
     $plugin_list = array();
143 143
     $my_plugin_list = $plugin_obj->get_plugin_regions();
144
-    foreach($my_plugin_list as $plugin_item) {
144
+    foreach ($my_plugin_list as $plugin_item) {
145 145
         $plugin_list[$plugin_item] = $plugin_item;
146 146
     }
147 147
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             if (file_exists(api_get_path(SYS_PLUGIN_PATH).$plugin.'/readme.txt')) {
181 181
                 echo Display::url(
182 182
                     "<em class='fa fa-file-text-o'></em> readme.txt",
183
-                    api_get_path(WEB_PLUGIN_PATH) . $plugin . "/readme.txt",
183
+                    api_get_path(WEB_PLUGIN_PATH).$plugin."/readme.txt",
184 184
                     [
185 185
                         'class' => 'btn btn-default ajax',
186 186
                         'data-title' => $plugin_info['title'],
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                     $show_name = ucwords(str_replace('_', ' ', $style_dir));
323 323
 
324 324
                     if ($is_style_changeable) {
325
-                        $list_of_names[$style_dir]  = $show_name;
325
+                        $list_of_names[$style_dir] = $show_name;
326 326
                     }
327 327
                     $counter++;
328 328
                 }
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
             if (is_dir($dir)) {
354 354
                 $zip = new PclZip($arch);
355 355
                 // Remove path prefix except the style name and put file on disk
356
-                $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir,0,-strlen($safe_style_dir)));
356
+                $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir, 0, -strlen($safe_style_dir)));
357 357
                 //@TODO: use more generic script to download.
358
-                $str = '<a class="btn btn-primary btn-large" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/download.php?archive=' . str_replace(api_get_path(SYS_ARCHIVE_PATH), '', $arch) . '">'.get_lang('ClickHereToDownloadTheFile').'</a>';
358
+                $str = '<a class="btn btn-primary btn-large" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.str_replace(api_get_path(SYS_ARCHIVE_PATH), '', $arch).'">'.get_lang('ClickHereToDownloadTheFile').'</a>';
359 359
                 Display::display_normal_message($str, false);
360 360
             } else {
361 361
                 Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning'));
@@ -371,15 +371,15 @@  discard block
 block discarded – undo
371 371
     
372 372
     $logoForm->addHtml(Display::return_message(sprintf(get_lang('TheLogoMustBeSizeXAndFormatY'), '250 x 70', 'PNG'), 'info'));
373 373
     
374
-    $dir = api_get_path(SYS_PUBLIC_PATH).'css/themes/' . $selected . '/images/';
375
-    $url = api_get_path(WEB_CSS_PATH).'themes/' . $selected . '/images/';
374
+    $dir = api_get_path(SYS_PUBLIC_PATH).'css/themes/'.$selected.'/images/';
375
+    $url = api_get_path(WEB_CSS_PATH).'themes/'.$selected.'/images/';
376 376
     $logoFileName = 'header-logo.png';
377 377
     $newLogoFileName = 'header-logo-custom.png';
378 378
     
379 379
     if (is_file($dir.$newLogoFileName)) {
380
-        $logoForm->addLabel(get_lang('CurrentLogo'), '<img id="header-logo-custom" src="'. $url . $newLogoFileName .'?'. time() . '">'); 
380
+        $logoForm->addLabel(get_lang('CurrentLogo'), '<img id="header-logo-custom" src="'.$url.$newLogoFileName.'?'.time().'">'); 
381 381
     } else {
382
-        $logoForm->addLabel(get_lang('CurrentLogo'), '<img id="header-logo-custom" src="'. $url . $logoFileName .'?'. time() . '">');
382
+        $logoForm->addLabel(get_lang('CurrentLogo'), '<img id="header-logo-custom" src="'.$url.$logoFileName.'?'.time().'">');
383 383
     }
384 384
     
385 385
     $logoForm->addFile('new_logo', get_lang('UpdateLogo'));
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
             $imageInfo = getimagesize($_FILES['new_logo']['tmp_name']);
404 404
             $width = $imageInfo[0];
405 405
             $height = $imageInfo[1];
406
-            if ($width <= 250 && $height <= 70 ) {
406
+            if ($width <= 250 && $height <= 70) {
407 407
                 if (is_file($dir.$newLogoFileName)) {
408 408
                     unlink($dir.$newLogoFileName);
409 409
                 }
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
             });
448 448
             </script>';
449 449
             echo Display::tabs(
450
-                array(get_lang('Update'),get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')),
450
+                array(get_lang('Update'), get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')),
451 451
                 array($form_change->return_form(), $logoForm->return_form(), $form->return_form())
452 452
             );
453 453
         } else {
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
             if (!empty($areas_to_installed)) {
623 623
                 $plugin_obj->remove_all_regions($plugin);
624 624
                 foreach ($areas_to_installed as $region) {
625
-                    if (!empty($region) && $region != '-1' ) {
625
+                    if (!empty($region) && $region != '-1') {
626 626
                         $plugin_obj->add_to_region($plugin, $region);
627 627
                     }
628 628
                 }
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
     $values = api_get_settings_options('search_enabled');
715 715
     $form->addElement('header', null, get_lang('SearchEnabledTitle'));
716 716
 
717
-    $group = array ();
717
+    $group = array();
718 718
     if (is_array($values)) {
719 719
         foreach ($values as $key => $value) {
720 720
             $element = & $form->createElement('radio', 'search_enabled', '', get_lang($value['display_text']), $value['value']);
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
 
741 741
     if ($search_enabled == 'true') {
742 742
         $values = api_get_settings_options('search_show_unlinked_results');
743
-        $group = array ();
743
+        $group = array();
744 744
         foreach ($values as $key => $value) {
745 745
             $element = & $form->createElement('radio', 'search_show_unlinked_results', '', get_lang($value['display_text']), $value['value']);
746 746
             $group[] = $element;
747 747
         }
748
-        $form->addGroup($group, 'search_show_unlinked_results', array(get_lang('SearchShowUnlinkedResultsTitle'),get_lang('SearchShowUnlinkedResultsComment')), '', false);
748
+        $form->addGroup($group, 'search_show_unlinked_results', array(get_lang('SearchShowUnlinkedResultsTitle'), get_lang('SearchShowUnlinkedResultsComment')), '', false);
749 749
         $default_values['search_show_unlinked_results'] = api_get_setting('search_show_unlinked_results');
750 750
 
751 751
         $sf_values = array();
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
             $sf_values[$sf['code']] = $sf['name'];
754 754
         }
755 755
         $group = array();
756
-        $url =  Display::div(Display::url(get_lang('AddSpecificSearchField'), 'specific_fields.php'), array('class'=>'sectioncomment'));
756
+        $url = Display::div(Display::url(get_lang('AddSpecificSearchField'), 'specific_fields.php'), array('class'=>'sectioncomment'));
757 757
         if (empty($sf_values)) {
758 758
             $form->addElement('html', get_lang('SearchPrefilterPrefix').$url);
759 759
         } else {
@@ -820,10 +820,10 @@  discard block
 block discarded – undo
820 820
             $dir_is_writable = Display::return_icon('bullet_red.png', get_lang('Error'));
821 821
         }
822 822
 
823
-        $data[] = array(get_lang('XapianModuleInstalled'),$xapian_loaded);
824
-        $data[] = array(get_lang('DirectoryExists').' - '.$xapian_path,$dir_exists);
825
-        $data[] = array(get_lang('IsWritable').' - '.$xapian_path,$dir_is_writable);
826
-        $data[] = array(get_lang('SpecificSearchFieldsAvailable') ,$specific_fields_exists);
823
+        $data[] = array(get_lang('XapianModuleInstalled'), $xapian_loaded);
824
+        $data[] = array(get_lang('DirectoryExists').' - '.$xapian_path, $dir_exists);
825
+        $data[] = array(get_lang('IsWritable').' - '.$xapian_path, $dir_is_writable);
826
+        $data[] = array(get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists);
827 827
 
828 828
         echo Display::tag('h3', get_lang('Settings'));
829 829
         $table = new SortableTableFromArray($data);
@@ -833,16 +833,16 @@  discard block
 block discarded – undo
833 833
 
834 834
         //@todo windows support
835 835
         if (api_is_windows_os() == false) {
836
-            $list_of_programs = array('pdftotext','ps2pdf', 'catdoc','html2text','unrtf', 'catppt', 'xls2csv');
836
+            $list_of_programs = array('pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv');
837 837
 
838
-            foreach($list_of_programs as $program) {
838
+            foreach ($list_of_programs as $program) {
839 839
                 $output = $ret_val = null;
840 840
                 exec("which $program", $output, $ret_val);
841 841
                 $icon = Display::return_icon('bullet_red.png', get_lang('NotInstalled'));
842 842
                 if (!empty($output[0])) {
843 843
                     $icon = Display::return_icon('bullet_green.png', get_lang('Installed'));
844 844
                 }
845
-                $data2[]= array($program, $output[0], $icon);
845
+                $data2[] = array($program, $output[0], $icon);
846 846
             }
847 847
             echo Display::tag('h3', get_lang('ProgramsNeededToConvertFiles'));
848 848
             $table = new SortableTableFromArray($data2);
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
     if ($action != 'add') {
875 875
         echo '<div class="actions" style="margin-left: 1px;">';
876 876
         echo '<a href="settings.php?category=Templates&action=add">'.
877
-                Display::return_icon('new_template.png', get_lang('AddTemplate'),'',ICON_SIZE_MEDIUM).'</a>';
877
+                Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>';
878 878
         echo '</div>';
879 879
     }
880 880
 
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
  * @since Dokeos 1.8.6
994 994
  */
995 995
 function actions_filter($id) {
996
-    $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
997
-    $return .= '<a href="settings.php?category=Templates&action=delete&id='.Security::remove_XSS($id).'" onClick="javascript:if(!confirm('."'".get_lang('ConfirmYourChoice')."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
996
+    $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
997
+    $return .= '<a href="settings.php?category=Templates&action=delete&id='.Security::remove_XSS($id).'" onClick="javascript:if(!confirm('."'".get_lang('ConfirmYourChoice')."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
998 998
     return $return;
999 999
 }
1000 1000
 
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
     $form->addElement('html_editor', 'template_text', get_lang('Text'), null, array('ToolbarSet' => 'AdminTemplates', 'Width' => '100%', 'Height' => '400'));
1045 1045
 
1046 1046
     // Setting the form elements: the form to upload an image to be used with the template.
1047
-    $form->addElement('file','template_image',get_lang('Image'),'');
1047
+    $form->addElement('file', 'template_image', get_lang('Image'), '');
1048 1048
 
1049 1049
     // Setting the form elements: a little bit information about the template image.
1050 1050
     $form->addElement('static', 'file_comment', '', get_lang('TemplateImageComment100x70'));
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
             // Store the information in the database (as insert or as update).
1123 1123
             $table_system_template = Database :: get_main_table('system_template');
1124 1124
             if ($_GET['action'] == 'add') {
1125
-                $content_template =  Security::remove_XSS($values['template_text'], COURSEMANAGERLOWSECURITY);
1125
+                $content_template = Security::remove_XSS($values['template_text'], COURSEMANAGERLOWSECURITY);
1126 1126
                 $params = [
1127 1127
                     'title' =>  $values['title'],
1128 1128
                     'content' => $content_template,
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
 
1133 1133
                 // Display a feedback message.
1134 1134
                 Display::display_confirmation_message(get_lang('TemplateAdded'));
1135
-                echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', get_lang('AddTemplate'),'',ICON_SIZE_MEDIUM).'</a>';
1135
+                echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>';
1136 1136
             } else {
1137 1137
                 $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>'.Database::escape_string($values['template_text']).'</body>';
1138 1138
                 $sql = "UPDATE $table_system_template set title = '".Database::escape_string($values['title'])."', content = '".$content_template."'";
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
         display_templates();
1151 1151
     } else {
1152 1152
         $token = Security::get_token();
1153
-        $form->addElement('hidden','sec_token');
1153
+        $form->addElement('hidden', 'sec_token');
1154 1154
         $form->setConstants(array('sec_token' => $token));
1155 1155
         // Display the form.
1156 1156
         $form->display();
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
 
1251 1251
     $form = new FormValidator('settings', 'post', 'settings.php?category='.Security::remove_XSS($_GET['category']));
1252 1252
 
1253
-    $form->addElement('hidden', 'search_field', (!empty($_GET['search_field'])?Security::remove_XSS($_GET['search_field']):null));
1253
+    $form->addElement('hidden', 'search_field', (!empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null));
1254 1254
 
1255 1255
     $url_id = api_get_current_access_url_id();
1256 1256
 
@@ -1317,9 +1317,9 @@  discard block
 block discarded – undo
1317 1317
                 if (empty($row['category']))
1318 1318
                     $row['category'] = 0;
1319 1319
 
1320
-                if (is_array($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ])) {
1320
+                if (is_array($settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']])) {
1321 1321
                     // We are sure that the other site have a selected value.
1322
-                    if ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]['selected_value'] != '')
1322
+                    if ($settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']]['selected_value'] != '')
1323 1323
                         $row['selected_value'] = $settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']]['selected_value'];
1324 1324
                 }
1325 1325
                 // There is no else{} statement because we load the default $row['selected_value'] of the main Chamilo site.
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
                         array('maxlength' => '8')
1341 1341
                     );
1342 1342
                     $form->applyFilter($row['variable'], 'html_filter');
1343
-                    $default_values[$row['variable']] = round($row['selected_value']/1024/1024, 1);
1343
+                    $default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1);
1344 1344
                 } elseif ($row['variable'] == 'account_valid_duration') {
1345 1345
                     $form->addElement(
1346 1346
                         'text',
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
                         ),
1369 1369
                         $hideme
1370 1370
                     );
1371
-                    $form->applyFilter($row['variable'],'html_filter');
1371
+                    $form->applyFilter($row['variable'], 'html_filter');
1372 1372
                     $default_values[$row['variable']] = $row['selected_value'];
1373 1373
                 }
1374 1374
                 break;
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
                     if (file_exists($file)) {
1380 1380
                         $value = file_get_contents($file);
1381 1381
                     }
1382
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
1382
+                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
1383 1383
                     $default_values[$row['variable']] = $value;
1384 1384
                 } elseif ($row['variable'] == 'footer_extra_content') {
1385 1385
                     $file = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt';
@@ -1387,16 +1387,16 @@  discard block
 block discarded – undo
1387 1387
                     if (file_exists($file)) {
1388 1388
                         $value = file_get_contents($file);
1389 1389
                     }
1390
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
1390
+                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
1391 1391
                     $default_values[$row['variable']] = $value;
1392 1392
                 } else {
1393
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
1393
+                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
1394 1394
                     $default_values[$row['variable']] = $row['selected_value'];
1395 1395
                 }
1396 1396
                 break;
1397 1397
             case 'radio':
1398 1398
                 $values = api_get_settings_options($row['variable']);
1399
-                $group = array ();
1399
+                $group = array();
1400 1400
                 if (is_array($values)) {
1401 1401
                     foreach ($values as $key => $value) {
1402 1402
                         $element = &$form->createElement(
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
                         WHERE variable='".$row['variable']."' AND access_url =  1";
1428 1428
 
1429 1429
                 $result = Database::query($sql);
1430
-                $group = array ();
1430
+                $group = array();
1431 1431
                 while ($rowkeys = Database::fetch_array($result)) {
1432 1432
                     // Profile tab option should be hidden when the social tool is enabled.
1433 1433
                     if (api_get_setting('allow_social_tool') == 'true') {
@@ -1499,10 +1499,10 @@  discard block
 block discarded – undo
1499 1499
 
1500 1500
         switch ($row['variable']) {
1501 1501
             case 'pdf_export_watermark_enable':
1502
-                $url =  PDF::get_watermark(null);
1502
+                $url = PDF::get_watermark(null);
1503 1503
 
1504 1504
                 if ($url != false) {
1505
-                    $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png',get_lang('DelImage')).'</a>';
1505
+                    $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png', get_lang('DelImage')).'</a>';
1506 1506
                     $form->addElement('html', '<div style="max-height:100px; max-width:100px; margin-left:162px; margin-bottom:10px; clear:both;"><img src="'.$url.'" style="margin-bottom:10px;" />'.$delete_url.'</div>');
1507 1507
                 }
1508 1508
 
Please login to merge, or discard this patch.
main/admin/index.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * Index page of the admin tools
5
- * @package chamilo.admin
6
- */
4
+             * Index page of the admin tools
5
+             * @package chamilo.admin
6
+             */
7 7
 // Resetting the course id.
8 8
 $cidReset = true;
9 9
 
Please login to merge, or discard this patch.