Completed
Push — master ( 5da9ea...eef579 )
by Angel Fernando Quiroz
50:18 queued 17:36
created
main/lp/scorm.class.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
                 $path = '';
394 394
                 $type = 'dir';
395 395
                 if (isset($this->resources[$item['identifierref']])) {
396
-                    $oRes =& $this->resources[$item['identifierref']];
396
+                    $oRes = & $this->resources[$item['identifierref']];
397 397
                     $path = @$oRes->get_path();
398 398
                     if (!empty($path)) {
399 399
                         $temptype = $oRes->get_scorm_type();
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
                 $item['parameters'] = Database::escape_string($item['parameters']);
445 445
 
446 446
                 $sql = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,launch_data, parameters)
447
-                        VALUES ($courseId, $lp_id, '$type', '$identifier', '$title', '$path' , 0, $max_score, $value_add $parent, $previous, 0, '$prereq', ".$item['rel_order'] .", '".$item['datafromlms']."', '".$item['parameters']."' )";
447
+                        VALUES ($courseId, $lp_id, '$type', '$identifier', '$title', '$path' , 0, $max_score, $value_add $parent, $previous, 0, '$prereq', ".$item['rel_order'].", '".$item['datafromlms']."', '".$item['parameters']."' )";
448 448
 
449 449
                 Database::query($sql);
450 450
                 if ($this->debug > 1) { error_log('New LP - In import_manifest(), inserting item : '.$sql, 0); }
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
                     foreach ($specific_fields as $specific_field) {
479 479
                         if (isset($_REQUEST[$specific_field['code']])) {
480 480
                             $sterms = trim($_REQUEST[$specific_field['code']]);
481
-                            $all_specific_terms .= ' '. $sterms;
481
+                            $all_specific_terms .= ' '.$sterms;
482 482
                             if (!empty($sterms)) {
483 483
                                 $sterms = explode(',', $sterms);
484 484
                                 foreach ($sterms as $sterm) {
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
                             }
488 488
                         }
489 489
                     }
490
-                    $body_to_index = $all_specific_terms .' '. $title;
490
+                    $body_to_index = $all_specific_terms.' '.$title;
491 491
                     $ic_slide->addValue("content", $body_to_index);
492 492
                     // TODO: Add a comment to say terms separated by commas.
493 493
                     $courseid = api_get_course_id();
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                         SE_COURSE_ID => $courseid,
498 498
                         SE_TOOL_ID => TOOL_LEARNPATH,
499 499
                         SE_DATA => array('lp_id' => $lp_id, 'lp_item'=> $previous, 'document_id' => ''), // TODO: Unify with other lp types.
500
-                        SE_USER => (int)api_get_user_id(),
500
+                        SE_USER => (int) api_get_user_id(),
501 501
                     );
502 502
                     $ic_slide->xapian_data = serialize($xapian_data);
503 503
                     $di->addChunk($ic_slide);
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
     public function import_package($zip_file_info, $current_dir = '', $courseInfo = array())
544 544
     {
545 545
         if ($this->debug > 0) {
546
-            error_log('In scorm::import_package('.print_r($zip_file_info,true).',"'.$current_dir.'") method', 0);
546
+            error_log('In scorm::import_package('.print_r($zip_file_info, true).',"'.$current_dir.'") method', 0);
547 547
         }
548 548
 
549 549
         $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
         $zip_file_name = $zip_file_info['name'];
555 555
 
556 556
         if ($this->debug > 1) {
557
-            error_log('New LP - import_package() - zip file path = ' . $zip_file_path . ', zip file name = ' . $zip_file_name, 0);
557
+            error_log('New LP - import_package() - zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name, 0);
558 558
         }
559 559
 
560 560
         $course_rel_dir = api_get_course_path($courseInfo['code']).'/scorm'; // scorm dir web path starting from /courses
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
         $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/
563 563
 
564 564
         if ($this->debug > 1) {
565
-            error_log( 'New LP - import_package() - current_dir = ' . $current_dir, 0);
565
+            error_log('New LP - import_package() - current_dir = '.$current_dir, 0);
566 566
         }
567 567
 
568 568
         // Get name of the zip file without the extension.
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
         $file_info = pathinfo($zip_file_name);
571 571
         $filename = $file_info['basename'];
572 572
         $extension = $file_info['extension'];
573
-        $file_base_name = str_replace('.'.$extension,'',$filename); // Filename without its extension.
573
+        $file_base_name = str_replace('.'.$extension, '', $filename); // Filename without its extension.
574 574
         $this->zipname = $file_base_name; // Save for later in case we don't have a title.
575 575
 
576 576
         if ($this->debug > 1) { error_log("New LP - base file name is : ".$file_base_name, 0); }
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         $slash_count = substr_count($shortest_path, '/');
617 617
         foreach ($manifest_list as $manifest_path) {
618 618
             $tmp_slash_count = substr_count($manifest_path, '/');
619
-            if ($tmp_slash_count<$slash_count) {
619
+            if ($tmp_slash_count < $slash_count) {
620 620
                 $shortest_path = $manifest_path;
621 621
                 $slash_count = $tmp_slash_count;
622 622
             }
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
         $this->subdir .= '/'.dirname($shortest_path); // Do not concatenate because already done above.
626 626
         $manifest = $shortest_path;
627 627
         if ($this->debug > 1) { error_log('New LP - Package type is now '.$package_type, 0); }
628
-        if ($package_type== '') {
628
+        if ($package_type == '') {
629 629
             // && defined('CHECK_FOR_SCORM') && CHECK_FOR_SCORM)
630 630
             if ($this->debug > 1) { error_log('New LP - Package type is empty', 0); }
631 631
 
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
             $new_dir = '/'.$new_dir;
651 651
         }
652 652
 
653
-        if ($new_dir[strlen($new_dir)-1] == '/') {
654
-            $new_dir = substr($new_dir,0,-1);
653
+        if ($new_dir[strlen($new_dir) - 1] == '/') {
654
+            $new_dir = substr($new_dir, 0, -1);
655 655
         }
656 656
 
657 657
         /* Uncompressing phase */
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
                     if ($file != '.' && $file != '..') {
693 693
                         $filetype = 'file';
694 694
 
695
-                        if (is_dir($course_sys_dir . $new_dir . $file)) {
695
+                        if (is_dir($course_sys_dir.$new_dir.$file)) {
696 696
                             $filetype = 'folder';
697 697
                         }
698 698
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
                                     }
722 722
                                 }
723 723
                             }
724
-                            @rename($course_sys_dir.$new_dir.$file,$course_sys_dir.$new_dir.$safe_file);
724
+                            @rename($course_sys_dir.$new_dir.$file, $course_sys_dir.$new_dir.$safe_file);
725 725
                             if ($this->debug >= 1) { error_log('New LP - Renaming '.$course_sys_dir.$new_dir.$file.' to '.$course_sys_dir.$new_dir.$safe_file, 0); }
726 726
                         }
727 727
                     }
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
         if ($this->debug > 0) { error_log('In scorm::get_res_path('.$id.') method', 0); }
909 909
         $path = '';
910 910
         if (isset($this->resources[$id])) {
911
-            $oRes =& $this->resources[$id];
911
+            $oRes = & $this->resources[$id];
912 912
             $path = @$oRes->get_path();
913 913
         }
914 914
         return $path;
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
         if ($this->debug > 0) { error_log('In scorm::get_res_type('.$id.') method', 0); }
925 925
         $type = '';
926 926
         if (isset($this->resources[$id])) {
927
-            $oRes =& $this->resources[$id];
927
+            $oRes = & $this->resources[$id];
928 928
             $temptype = $oRes->get_scorm_type();
929 929
             if (!empty($temptype)) {
930 930
                 $type = $temptype;
@@ -943,9 +943,9 @@  discard block
 block discarded – undo
943 943
         $title = '';
944 944
         if (isset($this->manifest['organizations']['default'])) {
945 945
             $title = $this->organizations[$this->manifest['organizations']['default']]->get_name();
946
-        } elseif (count($this->organizations)==1) {
946
+        } elseif (count($this->organizations) == 1) {
947 947
             // This will only get one title but so we don't need to know the index.
948
-            foreach($this->organizations as $id => $value) {
948
+            foreach ($this->organizations as $id => $value) {
949 949
                 $title = $this->organizations[$id]->get_name();
950 950
                 break;
951 951
             }
Please login to merge, or discard this patch.
main/lp/scorm_api.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 require_once __DIR__.'/../inc/global.inc.php';
27 27
 
28
-$file   = (empty($_SESSION['file'])?'':$_SESSION['file']);
28
+$file = (empty($_SESSION['file']) ? '' : $_SESSION['file']);
29 29
 /** @var learnpath $oLP */
30 30
 $oLP = unserialize($_SESSION['lpobject']);
31 31
 /** @var learnpathItem $oItem */
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 header('Content-type: text/javascript');
43 43
 
44
-?>var scorm_logs=<?php echo ((empty($oLP->scorm_debug) or (!api_is_course_admin() && !api_is_platform_admin()) )?'0':'3');?>; //debug log level for SCORM. 0 = none, 1=light, 2=a lot, 3=all - displays logs in log frame
44
+?>var scorm_logs=<?php echo ((empty($oLP->scorm_debug) or (!api_is_course_admin() && !api_is_platform_admin())) ? '0' : '3'); ?>; //debug log level for SCORM. 0 = none, 1=light, 2=a lot, 3=all - displays logs in log frame
45 45
 var lms_logs = 0; //debug log level for LMS actions. 0=none, 1=light, 2=a lot, 3=all
46 46
 
47 47
 // API Object initialization (eases access later on)
@@ -144,25 +144,25 @@  discard block
 block discarded – undo
144 144
 olms.statusSignalReceived = 0;
145 145
 
146 146
 // Strictly scorm variables
147
-olms.score=<?php echo $oItem->get_score();?>;
148
-olms.max='<?php echo $oItem->get_max();?>';
149
-olms.min='<?php echo $oItem->get_min();?>';
150
-olms.lesson_status='<?php echo $oItem->get_status();?>';
151
-olms.session_time='<?php echo $oItem->get_scorm_time('js');?>';
152
-olms.suspend_data = '<?php echo $oItem->get_suspend_data();?>';
153
-olms.lesson_location = '<?php echo $oItem->get_lesson_location();?>';
154
-olms.total_time = '<?php echo $oItem->get_scorm_time('js');?>';
155
-olms.mastery_score = '<?php echo $oItem->get_mastery_score();?>';
147
+olms.score=<?php echo $oItem->get_score(); ?>;
148
+olms.max='<?php echo $oItem->get_max(); ?>';
149
+olms.min='<?php echo $oItem->get_min(); ?>';
150
+olms.lesson_status='<?php echo $oItem->get_status(); ?>';
151
+olms.session_time='<?php echo $oItem->get_scorm_time('js'); ?>';
152
+olms.suspend_data = '<?php echo $oItem->get_suspend_data(); ?>';
153
+olms.lesson_location = '<?php echo $oItem->get_lesson_location(); ?>';
154
+olms.total_time = '<?php echo $oItem->get_scorm_time('js'); ?>';
155
+olms.mastery_score = '<?php echo $oItem->get_mastery_score(); ?>';
156 156
 olms.launch_data = '<?php echo $oItem->get_launch_data(); ?>';
157
-olms.max_time_allowed = '<?php echo $oItem->get_max_time_allowed();?>';
158
-olms.interactions = new Array(<?php echo $oItem->get_interactions_js_array();?>);
157
+olms.max_time_allowed = '<?php echo $oItem->get_max_time_allowed(); ?>';
158
+olms.interactions = new Array(<?php echo $oItem->get_interactions_js_array(); ?>);
159 159
 olms.item_objectives = new Array();
160 160
 olms.info_lms_item = new Array();
161 161
 
162 162
 // Chamilo internal variables (not SCORM)
163 163
 // olms.saved_lesson_status = 'not attempted';
164
-olms.lms_lp_id = <?php echo $oLP->get_id();?>;
165
-olms.lms_item_id = <?php echo $oItem->get_id();?>;
164
+olms.lms_lp_id = <?php echo $oLP->get_id(); ?>;
165
+olms.lms_item_id = <?php echo $oItem->get_id(); ?>;
166 166
 olms.lms_initialized = 0;
167 167
 // switch_finished indicates if the switch process is finished (if it has gone
168 168
 // through LMSInitialize() for the new item. Until then, all LMSSetValue()
@@ -171,26 +171,26 @@  discard block
 block discarded – undo
171 171
 olms.switch_finished = 0;
172 172
 
173 173
 //olms.lms_total_lessons = <?php echo $oLP->get_total_items_count(); ?>;
174
-//olms.lms_complete_lessons = <?php echo $oLP->get_complete_items_count();?>;
175
-//olms.lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode;?>';
174
+//olms.lms_complete_lessons = <?php echo $oLP->get_complete_items_count(); ?>;
175
+//olms.lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode; ?>';
176 176
 //if(lms_progress_bar_mode == ''){lms_progress_bar_mode='%';}
177 177
 
178
-olms.lms_view_id = '<?php echo $oLP->get_view();?>';
178
+olms.lms_view_id = '<?php echo $oLP->get_view(); ?>';
179 179
 if(olms.lms_view_id == ''){ olms.lms_view_id = 1;}
180
-olms.lms_user_id = '<?php echo $userId;?>';
181
-olms.lms_next_item = '<?php echo $oLP->get_next_item_id();?>';
182
-olms.lms_previous_item = '<?php echo $oLP->get_previous_item_id();?>';
183
-olms.lms_lp_type = '<?php echo $oLP->get_type();?>';
184
-olms.lms_item_type = '<?php echo $oItem->get_type();?>';
185
-olms.lms_item_credit = '<?php echo $oItem->get_credit();?>';
186
-olms.lms_item_lesson_mode = '<?php echo $oItem->get_lesson_mode();?>';
187
-olms.lms_item_launch_data = '<?php echo addslashes($oItem->get_launch_data());?>';
188
-olms.lms_item_core_exit = '<?php echo $oItem->get_core_exit();?>';
180
+olms.lms_user_id = '<?php echo $userId; ?>';
181
+olms.lms_next_item = '<?php echo $oLP->get_next_item_id(); ?>';
182
+olms.lms_previous_item = '<?php echo $oLP->get_previous_item_id(); ?>';
183
+olms.lms_lp_type = '<?php echo $oLP->get_type(); ?>';
184
+olms.lms_item_type = '<?php echo $oItem->get_type(); ?>';
185
+olms.lms_item_credit = '<?php echo $oItem->get_credit(); ?>';
186
+olms.lms_item_lesson_mode = '<?php echo $oItem->get_lesson_mode(); ?>';
187
+olms.lms_item_launch_data = '<?php echo addslashes($oItem->get_launch_data()); ?>';
188
+olms.lms_item_core_exit = '<?php echo $oItem->get_core_exit(); ?>';
189 189
 olms.lms_course_id = '<?php echo $oLP->get_course_int_id(); ?>';
190 190
 olms.lms_session_id = '<?php echo api_get_session_id(); ?>';
191 191
 olms.lms_course_code = '<?php echo $oLP->getCourseCode(); ?>';
192 192
 olms.lms_course_id =  '<?php echo $oLP->get_course_int_id(); ?>';
193
-<?php echo $oLP->get_items_details_as_js('olms.lms_item_types');?>
193
+<?php echo $oLP->get_items_details_as_js('olms.lms_item_types'); ?>
194 194
 
195 195
 // Following definition of cmi.core.score.raw in SCORM 1.2, "LMS should
196 196
 // initialize this to an empty string ("") upon initial launch of a SCO. The
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
     logit_scorm('Other SCORM calls are shown in orange.', 1);
228 228
     logit_lms('To add new messages to these logs, use logit_lms() or logit_scorm().');
229 229
 
230
-    olms.info_lms_item[0] = '<?php echo $oItem->get_id();?>';
231
-    olms.info_lms_item[1] = '<?php echo $oItem->get_id();?>';
230
+    olms.info_lms_item[0] = '<?php echo $oItem->get_id(); ?>';
231
+    olms.info_lms_item[1] = '<?php echo $oItem->get_id(); ?>';
232 232
 
233 233
     $("#content_id").load(function() {
234 234
         logit_lms('#content_id load event starts');
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         result = 'id,score,status';
500 500
     } else if(param == 'cmi.objectives._count'){
501 501
     // ---- cmi.objectives._count
502
-        //result='<?php echo $oItem->get_view_count();?>';
502
+        //result='<?php echo $oItem->get_view_count(); ?>';
503 503
         result = olms.item_objectives.length;
504 504
     } else if(param.substring(0,15)== 'cmi.objectives.'){
505 505
         var myres = '';
Please login to merge, or discard this patch.
main/lp/lp_move_item.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 /* Header and action code */
19 19
 $htmlHeadXtra[] = '<script>'.
20
-$_SESSION['oLP']->get_js_dropdown_array() .
20
+$_SESSION['oLP']->get_js_dropdown_array().
21 21
 "
22 22
     function load_cbo(id) {
23 23
         if (!id) {
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
         $('#previous').selectpicker('refresh');
42 42
     }
43 43
 " .
44
-"\n" .
45
-'$().ready(function() {'."\n" .
46
-  'if ($(\'#previous\')) {'."\n" .
44
+"\n".
45
+'$().ready(function() {'."\n".
46
+  'if ($(\'#previous\')) {'."\n".
47 47
     'if(\'parent is\'+$(\'#idParent\').val()) {'.
48
-      'load_cbo($(\'#idParent\').val());'."\n" .
49
-  '}}'."\n" .
50
-'});</script>'."\n" ;
48
+      'load_cbo($(\'#idParent\').val());'."\n".
49
+  '}}'."\n".
50
+'});</script>'."\n";
51 51
 
52 52
 /* Constants and variables */
53 53
 
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 /* SHOWING THE ADMIN TOOLS */
82 82
 
83 83
 if (isset($_SESSION['gradebook'])) {
84
-    $gradebook=	$_SESSION['gradebook'];
84
+    $gradebook = $_SESSION['gradebook'];
85 85
 }
86 86
 
87 87
 if (!empty($gradebook) && $gradebook == 'view') {
88
-    $interbreadcrumb[] = array (
88
+    $interbreadcrumb[] = array(
89 89
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
90 90
         'name' => get_lang('ToolGradebook')
91 91
     );
Please login to merge, or discard this patch.
main/lp/openoffice_document.class.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
         ///learning_path/ppt_dirname directory
59 59
         $this->created_dir = $result['dir'];
60 60
         if (substr($this->created_dir, -1, 1) == '/') {
61
-            $this->file_path = $this->created_dir . api_replace_dangerous_char($file['name']);
61
+            $this->file_path = $this->created_dir.api_replace_dangerous_char($file['name']);
62 62
         } else {
63
-            $this->file_path = $this->created_dir . '/' . api_replace_dangerous_char($file['name']);
63
+            $this->file_path = $this->created_dir.'/'.api_replace_dangerous_char($file['name']);
64 64
         }
65 65
 
66 66
         //var_dump($this->file_name, $this->file_path, $this->base_work_dir, $this->created_dir);
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
             $perm = api_get_setting('permissions_for_new_files');
105 105
 
106 106
             if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
107
-                $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
108
-                $class_path = $converter_path . ';' . $converter_path . '/jodconverter-2.2.2.jar;' . $converter_path . '/jodconverter-cli-2.2.2.jar';
107
+                $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png');
108
+                $class_path = $converter_path.';'.$converter_path.'/jodconverter-2.2.2.jar;'.$converter_path.'/jodconverter-cli-2.2.2.jar';
109 109
                 //$cmd = 'java -cp "'.$class_path.'" DokeosConverter';
110
-                $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $class_path . '" DokeosConverter';
110
+                $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$class_path.'" DokeosConverter';
111 111
             } else {
112
-                $converter_path = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
112
+                $converter_path = api_get_path(SYS_PATH).'main/inc/lib/ppt2png';
113 113
                 //$class_path = '-cp .:jodconverter-2.2.1.jar:jodconverter-cli-2.2.1.jar';
114 114
                 $class_path = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar';
115
-                $cmd = 'cd ' . $converter_path . ' && java ' . $class_path . ' DokeosConverter';
115
+                $cmd = 'cd '.$converter_path.' && java '.$class_path.' DokeosConverter';
116 116
             }
117 117
 
118
-            $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
118
+            $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port');
119 119
             // Call to the function implemented by child.
120 120
             $cmd .= $this->add_command_parameters();
121 121
             // To allow openoffice to manipulate docs.
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             @chmod($this->base_work_dir.$this->file_path, 0777);
125 125
 
126 126
             $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere.
127
-            putenv('LC_ALL=' . $locale);
127
+            putenv('LC_ALL='.$locale);
128 128
 
129 129
             $files = array();
130 130
             $return = 0;
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
             $result = $this->_get_remote_ppt2lp_files($file, $size);
151 151
             $result = unserialize($result);
152 152
             // Save remote images to server
153
-            chmod($this->base_work_dir . $this->created_dir, api_get_permissions_for_new_directories());
153
+            chmod($this->base_work_dir.$this->created_dir, api_get_permissions_for_new_directories());
154 154
             if (!empty($result['images'])) {
155 155
                 foreach ($result['images'] as $image => $img_data) {
156 156
                     $image_path = $this->base_work_dir.$this->created_dir;
157
-                    @file_put_contents($image_path . '/' . $image, base64_decode($img_data));
158
-                    @chmod($image_path . '/' . $image, 0777);
157
+                    @file_put_contents($image_path.'/'.$image, base64_decode($img_data));
158
+                    @chmod($image_path.'/'.$image, 0777);
159 159
                 }
160 160
             }
161 161
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         $uri = '';
200 200
         $result = preg_match('/^([a-zA-Z0-9]*):\/\/([^\/]*)\//', $ppt2lp_host, $matches);
201 201
         if ($result) {
202
-            $uri = $matches[1] . '://' . $matches[2] . '/';
202
+            $uri = $matches[1].'://'.$matches[2].'/';
203 203
         } else {
204 204
             $uri = $ppt2lp_host;
205 205
         }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9,
219 219
         );
220 220
         if (substr($ppt2lp_host, 0, 5) === 'https') {
221
-            $options['ssl_method'] =  SOAP_SSL_METHOD_TLS;
221
+            $options['ssl_method'] = SOAP_SSL_METHOD_TLS;
222 222
             // If using SSL, please note that *not* supporting the SSLv2
223 223
             // (broken in terms of security), the server tends to generate
224 224
             // the following issue:
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             //error_log('['.time().'] Calling wsConvertPpt webservice on ' . $ppt2lp_host);
244 244
             $result = $client->__call('wsConvertPpt', array('pptData' => $params));
245 245
         } catch (Exception $e) {
246
-            error_log('['.time().'] Chamilo SOAP call error: ' . $e->getMessage());
246
+            error_log('['.time().'] Chamilo SOAP call error: '.$e->getMessage());
247 247
         }
248 248
         // Make sure we destroy the SOAP client as it may generate SSL connection
249 249
         // binding issue (if using SSL)
@@ -276,38 +276,38 @@  discard block
 block discarded – undo
276 276
         $ppt2lpHost = api_get_setting('service_ppt2lp', 'host');
277 277
         $permissionFile = api_get_permissions_for_new_files();
278 278
         $permissionFolder = api_get_permissions_for_new_directories();
279
-        if (file_exists($this->base_work_dir . '/' . $this->created_dir)) {
279
+        if (file_exists($this->base_work_dir.'/'.$this->created_dir)) {
280 280
 
281 281
             return $ids;
282 282
         }
283 283
 
284 284
         if ($ppt2lpHost == 'localhost') {
285 285
             if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
286
-                $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
287
-                $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar';
288
-                $cmd = 'java -Dfile.encoding=UTF-8 -jar "' . $classPath . '/jodconverter-2.2.2.jar"';
286
+                $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png');
287
+                $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar';
288
+                $cmd = 'java -Dfile.encoding=UTF-8 -jar "'.$classPath.'/jodconverter-2.2.2.jar"';
289 289
             } else {
290
-                $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
290
+                $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png';
291 291
                 $classPath = ' -Dfile.encoding=UTF-8 -jar jodconverter-cli-2.2.2.jar';
292
-                $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' ';
292
+                $cmd = 'cd '.$converterPath.' && java '.$classPath.' ';
293 293
             }
294 294
 
295
-            $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
295
+            $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port');
296 296
             // Call to the function implemented by child.
297
-            $cmd .= ' "' . $this->base_work_dir . '/' . $this->file_path . '"  "' . $this->base_work_dir . '/' . $this->created_dir . '"';
297
+            $cmd .= ' "'.$this->base_work_dir.'/'.$this->file_path.'"  "'.$this->base_work_dir.'/'.$this->created_dir.'"';
298 298
             // To allow openoffice to manipulate docs.
299 299
             @chmod($this->base_work_dir, $permissionFolder);
300
-            @chmod($this->base_work_dir . '/' . $this->file_path, $permissionFile);
300
+            @chmod($this->base_work_dir.'/'.$this->file_path, $permissionFile);
301 301
 
302 302
             $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere.
303
-            putenv('LC_ALL=' . $locale);
303
+            putenv('LC_ALL='.$locale);
304 304
 
305 305
             $files = array();
306 306
             $return = 0;
307 307
             $shell = exec($cmd, $files, $return);
308 308
             // TODO: Chown is not working, root keep user privileges, should be www-data
309
-            @chown($this->base_work_dir . '/' . $this->created_dir, 'www-data');
310
-            @chmod($this->base_work_dir . '/' . $this->created_dir, $permissionFile);
309
+            @chown($this->base_work_dir.'/'.$this->created_dir, 'www-data');
310
+            @chmod($this->base_work_dir.'/'.$this->created_dir, $permissionFile);
311 311
 
312 312
             if ($return != 0) { // If the java application returns an error code.
313 313
                 switch ($return) {
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
             */
347 347
         }
348 348
 
349
-        if (file_exists($this->base_work_dir . '/' . $this->created_dir)) {
349
+        if (file_exists($this->base_work_dir.'/'.$this->created_dir)) {
350 350
 
351 351
             // Register Files to Document tool
352 352
             $ids[] = add_document(
353 353
                 $_course,
354
-                '/' . $this->created_dir,
354
+                '/'.$this->created_dir,
355 355
                 'file',
356
-                filesize($this->base_work_dir . '/' . $this->created_dir),
356
+                filesize($this->base_work_dir.'/'.$this->created_dir),
357 357
                 $convertedTitle,
358 358
                 sprintf(
359 359
                     get_lang('FileConvertedFromXToY'),
Please login to merge, or discard this patch.
main/lp/aicc_hacp.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 //$_user							= $_SESSION['_user'];
58 58
 $file = Session::read('file');
59 59
 $oLP = unserialize(Session::read('lpobject'));
60
-$oItem =& $oLP->items[$oLP->current];
60
+$oItem = & $oLP->items[$oLP->current];
61 61
 if (!is_object($oItem)) {
62 62
     error_log('New LP - aicc_hacp - Could not load oItem item', 0);
63 63
     exit;
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
     'evaluation' => array(),
72 72
     'student_data' => array(),
73 73
 );
74
-$convert_enc = array('%25','%0D','%0A','%09','%20','%2D','%2F','%3B','%3F','%7B','%7D','%7C','%5C','%5E','%7E','%5B','%5D','%60','%23','%3E','%3C','%22');
75
-$convert_dec = array('%',"\r","\n","\t",' ','-','/',';','?','{','}','|','\\','^','~','[',']','`','#','>','<','"');
74
+$convert_enc = array('%25', '%0D', '%0A', '%09', '%20', '%2D', '%2F', '%3B', '%3F', '%7B', '%7D', '%7C', '%5C', '%5E', '%7E', '%5B', '%5D', '%60', '%23', '%3E', '%3C', '%22');
75
+$convert_dec = array('%', "\r", "\n", "\t", ' ', '-', '/', ';', '?', '{', '}', '|', '\\', '^', '~', '[', ']', '`', '#', '>', '<', '"');
76 76
 $crlf = "\r\n";
77 77
 //$tab = "\t";
78 78
 $tab = "";
Please login to merge, or discard this patch.
main/admin/course_request_rejected.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
     $from = intval($from);
88 88
     $number_of_items = intval($number_of_items);
89 89
     $column = intval($column);
90
-    $direction = !in_array(strtolower(trim($direction)), ['asc','desc']) ? 'asc' : $direction;
90
+    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
91 91
 
92 92
     $sql = "SELECT
93 93
                 id AS col0,
Please login to merge, or discard this patch.
main/inc/lib/image.lib.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             return false;
115 115
         }
116 116
         $this->path = $path;
117
-        $this->set_image_wrapper();  //Creates image obj
117
+        $this->set_image_wrapper(); //Creates image obj
118 118
     }
119 119
 
120 120
     abstract function set_image_wrapper();
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         if ($this->debug) error_log('Image::set_image_wrapper loaded');
157 157
         try {
158 158
             if (file_exists($this->path)) {
159
-                $this->image     = new Imagick($this->path);
159
+                $this->image = new Imagick($this->path);
160 160
 
161 161
                 if ($this->image) {
162 162
                     $this->fill_image_info(); //Fills height, width and type
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             } else {
165 165
                 if ($this->debug) error_log('Image::image does not exist');
166 166
             }
167
-        } catch(ImagickException $e) {
167
+        } catch (ImagickException $e) {
168 168
             if ($this->debug) error_log($e->getMessage());
169 169
         }
170 170
     }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
 	public function get_image_size()
187 187
     {
188
-		$imagesize = array('width'=>0,'height'=>0);
188
+		$imagesize = array('width'=>0, 'height'=>0);
189 189
 	    if ($this->image_validated) {
190 190
             $imagesize = $this->image->getImageGeometry();
191 191
 	    }
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
             $height = $thumbh;
203 203
         } else {
204 204
             $scale  = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
205
-            $width  = (int)($this->width * $scale);
206
-            $height = (int)($this->height * $scale);
205
+            $width  = (int) ($this->width * $scale);
206
+            $height = (int) ($this->height * $scale);
207 207
         }
208 208
 		$result = $this->image->resizeImage($width, $height, $this->filter, 1);
209 209
 		$this->width  = $thumbw;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		$result = false;
250 250
 		try {
251 251
 		    $result = $this->image->writeImage($file);
252
-		} catch(ImagickException $e) {
252
+		} catch (ImagickException $e) {
253 253
             if ($this->debug) error_log($e->getMessage());
254 254
         }
255 255
 
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 
311 311
     public function get_image_size()
312 312
     {
313
-        $return_array = array('width'=>0,'height'=>0);
313
+        $return_array = array('width'=>0, 'height'=>0);
314 314
         if ($this->image_validated) {
315
-	        $return_array = array('width'=>$this->width,'height'=>$this->height);
315
+	        $return_array = array('width'=>$this->width, 'height'=>$this->height);
316 316
         }
317 317
         return $return_array;
318 318
 	}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     public function fill_image_info()
321 321
     {
322 322
     	if (file_exists($this->path)) {
323
-	        $image_info     = getimagesize($this->path);
323
+	        $image_info = getimagesize($this->path);
324 324
 			$this->width    = $image_info[0];
325 325
 			$this->height   = $image_info[1];
326 326
 			$this->type     = $image_info[2];
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
                 $height = $thumbh;
341 341
             } else {
342 342
                 $scale = min($thumbw / $this->width, $thumbh / $this->height);
343
-                $width = (int)($this->width * $scale);
344
-                $height = (int)($this->height * $scale);
343
+                $width = (int) ($this->width * $scale);
344
+                $height = (int) ($this->height * $scale);
345 345
             }
346
-			$deltaw = (int)(($thumbw - $width) / 2);
347
-			$deltah = (int)(($thumbh - $height) / 2);
346
+			$deltaw = (int) (($thumbw - $width) / 2);
347
+			$deltah = (int) (($thumbh - $height) / 2);
348 348
 			$dst_img = @ImageCreateTrueColor($thumbw, $thumbh);
349 349
             		@imagealphablending($dst_img, false);
350 350
 		        @imagesavealpha($dst_img, true);
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
                 $height = $thumbh;
360 360
             } else {
361 361
                 $scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
362
-                $width  = (int)($this->width * $scale);
363
-                $height = (int)($this->height * $scale);
362
+                $width  = (int) ($this->width * $scale);
363
+                $height = (int) ($this->height * $scale);
364 364
             }
365 365
 			$deltaw = 0;
366 366
 			$deltah = 0;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	public function send_image($file = '', $compress = -1, $convert_file_to = null)
419 419
     {
420 420
 	    if (!$this->image_validated) return false;
421
-        $compress = (int)$compress;
421
+        $compress = (int) $compress;
422 422
         $type = $this->type;
423 423
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
424 424
             $type = $convert_file_to;
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
          * so that we can use black (0,0,0) as transparent, which is what
463 463
          * the image is filled with when created.
464 464
          */
465
-        $transparent = imagecolorallocate($dest_img, 0,0,0);
465
+        $transparent = imagecolorallocate($dest_img, 0, 0, 0);
466 466
         imagealphablending($dest_img, false);
467 467
         imagesavealpha($dest_img, true);
468 468
         imagecolortransparent($dest_img, $transparent);
469
-        imagecopy($dest_img, $this->bg, 0,0, 0, 0,imagesx($this->bg), imagesx($this->bg));
469
+        imagecopy($dest_img, $this->bg, 0, 0, 0, 0, imagesx($this->bg), imagesx($this->bg));
470 470
         imagefilter($dest_img, IMG_FILTER_GRAYSCALE);
471 471
         $this->bg = $dest_img;
472 472
 
Please login to merge, or discard this patch.
main/webservices/additional_webservices.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     }
29 29
     $fileData = $pptData['file_data'];
30 30
     $dataInfo = pathinfo($pptData['file_name']);
31
-    $fileName =  basename($pptData['file_name'], '.' . $dataInfo['extension']);
31
+    $fileName = basename($pptData['file_name'], '.'.$dataInfo['extension']);
32 32
     $fullFileName = $pptData['file_name'];
33 33
     $size = $pptData['service_ppt2lp_size'];
34 34
     $w = '800';
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
     }
39 39
 
40 40
     $tempArchivePath = api_get_path(SYS_ARCHIVE_PATH);
41
-    $tempPath = $tempArchivePath . 'wsConvert/' . $fileName . '/';
42
-    $tempPathNewFiles = $tempArchivePath . 'wsConvert/' . $fileName . '-n/';
41
+    $tempPath = $tempArchivePath.'wsConvert/'.$fileName.'/';
42
+    $tempPathNewFiles = $tempArchivePath.'wsConvert/'.$fileName.'-n/';
43 43
 
44 44
     $oldumask = umask(0);
45 45
     //$perms = api_get_permissions_for_new_directories();
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
     pptConverterDirectoriesCreate($tempPath, $tempPathNewFiles, $fileName, $perms);
50 50
 
51 51
     $file = base64_decode($fileData);
52
-    file_put_contents($tempPath . $fullFileName, $file);
52
+    file_put_contents($tempPath.$fullFileName, $file);
53 53
 
54 54
     $cmd = pptConverterGetCommandBaseParams();
55
-    $cmd .= ' -w ' . $w . ' -h ' . $h . ' -d oogie "' . $tempPath . $fullFileName.'"  "' . $tempPathNewFiles . $fileName . '.html"';
55
+    $cmd .= ' -w '.$w.' -h '.$h.' -d oogie "'.$tempPath.$fullFileName.'"  "'.$tempPathNewFiles.$fileName.'.html"';
56 56
 
57 57
     //$perms = api_get_permissions_for_new_files();
58
-    chmod($tempPathNewFiles . $fileName, $perms);
58
+    chmod($tempPathNewFiles.$fileName, $perms);
59 59
 
60 60
     $files = array();
61 61
     $return = 0;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         if (is_array($files) && !empty($files)) {
68 68
             foreach ($files as $file) {
69 69
                 $imageData = explode('||', $file);
70
-                $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles . $fileName . '/' . $imageData[1]));
70
+                $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles.$fileName.'/'.$imageData[1]));
71 71
             }
72 72
         }
73 73
         $data = array(
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
  */
94 94
 function deleteDirectory($directoryPath)
95 95
 {
96
-    $files = array_diff(scandir($directoryPath), array('.','..'));
96
+    $files = array_diff(scandir($directoryPath), array('.', '..'));
97 97
     foreach ($files as $file) {
98 98
         if (is_dir("$directoryPath/$file")) {
99 99
             deleteDirectory("$directoryPath/$file");
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
     if (!is_dir($tempPathNewFiles)) {
122 122
         mkdir($tempPathNewFiles, $perms, true);
123 123
     }
124
-    if (!is_dir($tempPathNewFiles . $fileName)) {
125
-        mkdir($tempPathNewFiles . $fileName, $perms, true);
124
+    if (!is_dir($tempPathNewFiles.$fileName)) {
125
+        mkdir($tempPathNewFiles.$fileName, $perms, true);
126 126
     }
127 127
 }
128 128
 
@@ -133,16 +133,16 @@  discard block
 block discarded – undo
133 133
 function pptConverterGetCommandBaseParams()
134 134
 {
135 135
     if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
136
-        $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
137
-        $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar';
138
-        $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $classPath . '" DokeosConverter';
136
+        $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png');
137
+        $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar';
138
+        $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$classPath.'" DokeosConverter';
139 139
     } else {
140
-        $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
140
+        $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png';
141 141
         $classPath = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar';
142
-        $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' DokeosConverter';
142
+        $cmd = 'cd '.$converterPath.' && java '.$classPath.' DokeosConverter';
143 143
     }
144 144
 
145
-    $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
145
+    $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port');
146 146
     return $cmd;
147 147
 }
148 148
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 $webCodePath = api_get_path(WEB_CODE_PATH);
152 152
 $options = array(
153 153
     'uri' => $webPath,
154
-    'location' => $webCodePath . 'webservices/additional_webservices.php'
154
+    'location' => $webCodePath.'webservices/additional_webservices.php'
155 155
 );
156 156
 
157 157
 $soapServer = new SoapServer(NULL, $options);
Please login to merge, or discard this patch.
main/webservices/api/v2.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -163,8 +163,8 @@
 block discarded – undo
163 163
             $restResponse->setData($data);
164 164
             break;
165 165
         case Rest::SAVE_COURSE_NOTEBOOK:
166
-            $title = !empty($_POST['title'])? $_POST['title'] : null;
167
-            $text = !empty($_POST['text'])? $_POST['text'] : null;
166
+            $title = !empty($_POST['title']) ? $_POST['title'] : null;
167
+            $text = !empty($_POST['text']) ? $_POST['text'] : null;
168 168
             $data = $restApi->saveCourseNotebook($title, $text);
169 169
             $restResponse->setData($data);
170 170
             break;
Please login to merge, or discard this patch.