Completed
Pull Request — 1.11.x (#1628)
by José
97:30 queued 69:06
created
src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                                 $params['lastedit_date'] = self::DBUTF8($property['lastedit_date']);
218 218
                                 $params['ref'] = $resource->destination_id;
219 219
                                 $params['lastedit_type'] = self::DBUTF8($property['lastedit_type']);
220
-                                $params['lastedit_user_id'] =  $this->checkUserId($property['lastedit_user_id']);
220
+                                $params['lastedit_user_id'] = $this->checkUserId($property['lastedit_user_id']);
221 221
                                 $params['visibility'] = self::DBUTF8($property['visibility']);
222 222
                                 $params['start_visible'] = self::DBUTF8($property['start_visible']);
223 223
                                 $params['end_visible'] = self::DBUTF8($property['end_visible']);
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
                             $new_file_name = $file_name_no_ext.'_'.$i.$ext;
579 579
                             $file_exists = file_exists($path.$new_file_name);
580 580
                             while ($file_exists) {
581
-                                $i ++;
581
+                                $i++;
582 582
                                 $new_file_name = $file_name_no_ext.'_'.$i.$ext;
583 583
                                 $file_exists = file_exists($path.$new_file_name);
584 584
                             }
@@ -622,9 +622,9 @@  discard block
 block discarded – undo
622 622
                                         $new_base_path = $_SESSION['new_base_path'];
623 623
                                     }
624 624
 
625
-                                    $dest_document_path = $new_base_path.'/'.$document_path[2];		// e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1/collaborative.png"
626
-                                    $basedir_dest_path 	= dirname($dest_document_path);				// e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1"
627
-                                    $base_path_document = $course_path.$document_path[0];			// e.g: "/var/www/wiener/courses/CURSO4/document"
625
+                                    $dest_document_path = $new_base_path.'/'.$document_path[2]; // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1/collaborative.png"
626
+                                    $basedir_dest_path 	= dirname($dest_document_path); // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1"
627
+                                    $base_path_document = $course_path.$document_path[0]; // e.g: "/var/www/wiener/courses/CURSO4/document"
628 628
                                     $path_title = '/'.$new_base_foldername.'/'.$document_path[2];
629 629
 
630 630
                                     copy_folder_course_session(
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
                                     // Replace old course code with the new destination code see BT#1985
644 644
                                     if (file_exists($dest_document_path)) {
645 645
                                         $file_info = pathinfo($dest_document_path);
646
-                                        if (in_array($file_info['extension'], array('html','htm'))) {
646
+                                        if (in_array($file_info['extension'], array('html', 'htm'))) {
647 647
                                             $content = file_get_contents($dest_document_path);
648 648
                                             if (UTF8_CONVERT) {
649 649
                                                 $content = utf8_encode($content);
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
                                     //Replace old course code with the new destination code see BT#1985
706 706
                                     if (file_exists($path.$new_file_name)) {
707 707
                                         $file_info = pathinfo($path.$new_file_name);
708
-                                        if (in_array($file_info['extension'], array('html','htm'))) {
709
-                                            $content    = file_get_contents($path.$new_file_name);
708
+                                        if (in_array($file_info['extension'], array('html', 'htm'))) {
709
+                                            $content = file_get_contents($path.$new_file_name);
710 710
                                             if (UTF8_CONVERT) {
711 711
                                                 $content = utf8_encode($content);
712 712
                                             }
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
                                 // Replace old course code with the new destination code see BT#1985
771 771
                                 if (file_exists($path.$new_file_name)) {
772 772
                                     $file_info = pathinfo($path.$new_file_name);
773
-                                    if (in_array($file_info['extension'], array('html','htm'))) {
773
+                                    if (in_array($file_info['extension'], array('html', 'htm'))) {
774 774
                                         $content = file_get_contents($path.$new_file_name);
775 775
                                         if (UTF8_CONVERT) {
776 776
                                             $content = utf8_encode($content);
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
                         // Replace old course code with the new destination code see BT#1985
846 846
                         if (file_exists($path.$document->path)) {
847 847
                             $file_info = pathinfo($path.$document->path);
848
-                            if (isset($file_info['extension']) && in_array($file_info['extension'], array('html','htm'))) {
848
+                            if (isset($file_info['extension']) && in_array($file_info['extension'], array('html', 'htm'))) {
849 849
                                 $content = file_get_contents($path.$document->path);
850 850
                                 if (UTF8_CONVERT) {
851 851
                                     $content = utf8_encode($content);
@@ -945,8 +945,8 @@  discard block
 block discarded – undo
945 945
 						case FILE_OVERWRITE:
946 946
 							rmdirr($path.$document->path);
947 947
                             copyDirTo(
948
-                                $this->course->backup_path . '/' . $document->path,
949
-                                $path . dirname($document->path),
948
+                                $this->course->backup_path.'/'.$document->path,
949
+                                $path.dirname($document->path),
950 950
                                 false
951 951
                             );
952 952
 							break;
@@ -968,23 +968,23 @@  discard block
 block discarded – undo
968 968
 							$file_exists = file_exists($path.$new_file_name);
969 969
 
970 970
 							while ($file_exists) {
971
-								$i ++;
971
+								$i++;
972 972
 								$new_file_name = $file_name_no_ext.'_'.$i.$ext;
973 973
 								$file_exists = file_exists($path.$new_file_name);
974 974
 							}
975 975
 
976 976
                             rename(
977
-                                $this->course->backup_path . '/' . $document->path,
978
-                                $this->course->backup_path . '/' . $new_file_name
977
+                                $this->course->backup_path.'/'.$document->path,
978
+                                $this->course->backup_path.'/'.$new_file_name
979 979
                             );
980 980
                             copyDirTo(
981
-                                $this->course->backup_path . '/' . $new_file_name,
982
-                                $path . dirname($new_file_name),
981
+                                $this->course->backup_path.'/'.$new_file_name,
982
+                                $path.dirname($new_file_name),
983 983
                                 false
984 984
                             );
985 985
                             rename(
986
-                                $this->course->backup_path . '/' . $new_file_name,
987
-                                $this->course->backup_path . '/' . $document->path
986
+                                $this->course->backup_path.'/'.$new_file_name,
987
+                                $this->course->backup_path.'/'.$document->path
988 988
                             );
989 989
 
990 990
 							break;
@@ -992,8 +992,8 @@  discard block
 block discarded – undo
992 992
 				} else {
993 993
                     // end if file exists
994 994
                     copyDirTo(
995
-                        $this->course->backup_path . '/' . $document->path,
996
-                        $path . dirname($document->path),
995
+                        $this->course->backup_path.'/'.$document->path,
996
+                        $path.dirname($document->path),
997 997
                         false
998 998
                     );
999 999
 				}
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 			$table_forum = Database::get_course_table(TABLE_FORUM);
1014 1014
 			$resources = $this->course->resources;
1015 1015
 			foreach ($resources[RESOURCE_FORUM] as $id => $forum) {
1016
-                $params = (array)$forum->obj;
1016
+                $params = (array) $forum->obj;
1017 1017
                 $cat_id = '';
1018 1018
                 if (isset($this->course->resources[RESOURCE_FORUMCATEGORY]) &&
1019 1019
                     isset($this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']])) {
@@ -1066,13 +1066,13 @@  discard block
 block discarded – undo
1066 1066
 					foreach ($this->course->resources[RESOURCE_FORUMTOPIC] as $topic_id => $topic) {
1067 1067
 						if ($topic->obj->forum_id == $id) {
1068 1068
 							$this->restore_topic($topic_id, $new_id, $sessionId);
1069
-							$forum_topics ++;
1069
+							$forum_topics++;
1070 1070
 						}
1071 1071
 					}
1072 1072
 				}
1073 1073
 				if ($forum_topics > 0) {
1074 1074
 					$sql = "UPDATE ".$table_forum." SET forum_threads = ".$forum_topics."
1075
-                            WHERE c_id = {$this->destination_course_id} AND forum_id = ".(int)$new_id;
1075
+                            WHERE c_id = {$this->destination_course_id} AND forum_id = ".(int) $new_id;
1076 1076
 					Database::query($sql);
1077 1077
 				}
1078 1078
 			}
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 		$table = Database :: get_course_table(TABLE_FORUM_THREAD);
1135 1135
 		$topic = $this->course->resources[RESOURCE_FORUMTOPIC][$thread_id];
1136 1136
 
1137
-        $params = (array)$topic->obj;
1137
+        $params = (array) $topic->obj;
1138 1138
         $params = self::DBUTF8_array($params);
1139 1139
         $params['c_id'] = $this->destination_course_id;
1140 1140
         $params['forum_id'] = $forum_id;
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 				        FROM $link_table
1249 1249
 				        WHERE
1250 1250
 				            c_id = ".$this->destination_course_id." AND
1251
-				            category_id='" . intval($cat_id). "'";
1251
+				            category_id='" . intval($cat_id)."'";
1252 1252
 				$result = Database::query($sql);
1253 1253
     			list($max_order) = Database::fetch_array($result);
1254 1254
 
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
                 $params['description'] = self::DBUTF8($link->description);
1264 1264
                 $params['category_id'] = $cat_id;
1265 1265
                 $params['on_homepage'] = $link->on_homepage;
1266
-                $params['display_order'] = $max_order+1;
1266
+                $params['display_order'] = $max_order + 1;
1267 1267
 
1268 1268
                 $id = Database::insert($link_table, $params);
1269 1269
 
@@ -1686,7 +1686,7 @@  discard block
 block discarded – undo
1686 1686
                         $this->course->resources[RESOURCE_DOCUMENT][$quiz->sound]->is_restored()) {
1687 1687
                         $sql = "SELECT path FROM $table_doc
1688 1688
                                 WHERE
1689
-                                    c_id = " . $this->destination_course_id . "  AND
1689
+                                    c_id = ".$this->destination_course_id."  AND
1690 1690
                                     id = " . $resources[RESOURCE_DOCUMENT][$quiz->sound]->destination_id;
1691 1691
 						$doc = Database::query($sql);
1692 1692
 						$doc = Database::fetch_object($doc);
@@ -1723,17 +1723,17 @@  discard block
 block discarded – undo
1723 1723
                         'random' => $quiz->random,
1724 1724
                         'active' => $quiz->active,
1725 1725
                         'sound' => self::DBUTF8($doc),
1726
-                        'max_attempt' => (int)$quiz->max_attempt,
1727
-                        'results_disabled' => (int)$quiz->results_disabled,
1726
+                        'max_attempt' => (int) $quiz->max_attempt,
1727
+                        'results_disabled' => (int) $quiz->results_disabled,
1728 1728
                         'access_condition' => $quiz->access_condition,
1729 1729
                         'pass_percentage' => $quiz->pass_percentage,
1730
-                        'feedback_type' => (int)$quiz->feedback_type,
1731
-                        'random_answers' => (int)$quiz->random_answers,
1730
+                        'feedback_type' => (int) $quiz->feedback_type,
1731
+                        'random_answers' => (int) $quiz->random_answers,
1732 1732
                         'random_by_category' => $quiz->random_by_category,
1733 1733
                         'review_answers' => $quiz->review_answers,
1734 1734
                         'propagate_neg' => $quiz->propagate_neg,
1735 1735
                         'text_when_finished' => $quiz->text_when_finished,
1736
-                        'expired_time' => (int)$quiz->expired_time,
1736
+                        'expired_time' => (int) $quiz->expired_time,
1737 1737
                         'start_time' => $quiz->start_time,
1738 1738
                         'end_time' => $quiz->end_time,
1739 1739
                         'save_correct_answers' => 0,
@@ -1773,10 +1773,10 @@  discard block
 block discarded – undo
1773 1773
                         $qid = $this->restore_quiz_question($question_id);
1774 1774
                         $question_order = $quiz->question_orders[$index] ? $quiz->question_orders[$index] : ++$order;
1775 1775
                         $sql = "INSERT IGNORE INTO $table_rel SET
1776
-                                c_id = " . $this->destination_course_id . ",
1776
+                                c_id = ".$this->destination_course_id.",
1777 1777
                                 question_id = $qid ,
1778 1778
                                 exercice_id = $new_id ,
1779
-                                question_order = " . $question_order;
1779
+                                question_order = ".$question_order;
1780 1780
                         Database::query($sql);
1781 1781
                     }
1782 1782
                 }
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
                             $sql = "UPDATE $table_que SET
1849 1849
                                         picture = '$picture_name'
1850 1850
                                     WHERE
1851
-                                        c_id = " . $this->destination_course_id . " AND
1851
+                                        c_id = ".$this->destination_course_id." AND
1852 1852
                                         id = $new_id ";
1853 1853
                             Database::query($sql);
1854 1854
                         }
@@ -2082,7 +2082,7 @@  discard block
 block discarded – undo
2082 2082
         $tab_test_category_id_old_new = array(); // used to build the quiz_question_rel_category table
2083 2083
         if ($this->course->has_resources(RESOURCE_TEST_CATEGORY)) {
2084 2084
             $resources = $this->course->resources;
2085
-            foreach ($resources[RESOURCE_TEST_CATEGORY] as $id => $CourseCopyTestCategory ) {
2085
+            foreach ($resources[RESOURCE_TEST_CATEGORY] as $id => $CourseCopyTestCategory) {
2086 2086
                 $tab_test_category_id_old_new[$CourseCopyTestCategory->source_id] = $id;
2087 2087
                 // check if this test_category already exist in the destination BDD
2088 2088
                 // do not Database::escape_string $title and $description, it will be done later
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
 							break;
2234 2234
 						case FILE_RENAME:
2235 2235
 							$survey_code = $survey->code.'_';
2236
-							$i=1;
2236
+							$i = 1;
2237 2237
 							$temp_survey_code = $survey_code.$i;
2238 2238
 							while (!$this->is_survey_code_available($temp_survey_code)) {
2239 2239
 								$temp_survey_code = $survey_code.++$i;
@@ -2265,15 +2265,15 @@  discard block
 block discarded – undo
2265 2265
 							$sql = "SELECT * FROM $table_sur
2266 2266
 							        WHERE
2267 2267
 							            c_id = ".$this->destination_course_id." AND
2268
-							            survey_id='".self::DBUTF8escapestring(Database::result($result_check,0,0))."'";
2268
+							            survey_id='".self::DBUTF8escapestring(Database::result($result_check, 0, 0))."'";
2269 2269
 							$result = Database::query($sql);
2270
-							$survey_data = Database::fetch_array($result,'ASSOC');
2270
+							$survey_data = Database::fetch_array($result, 'ASSOC');
2271 2271
 
2272 2272
 							// if the survey is shared => also delete the shared content
2273 2273
 							if (isset($survey_data['survey_share']) && is_numeric($survey_data['survey_share'])) {
2274
-                                SurveyManager::delete_survey($survey_data['survey_share'], true,$this->destination_course_id);
2274
+                                SurveyManager::delete_survey($survey_data['survey_share'], true, $this->destination_course_id);
2275 2275
 							}
2276
-							SurveyManager :: delete_survey($survey_data['survey_id'],false,$this->destination_course_id);
2276
+							SurveyManager :: delete_survey($survey_data['survey_id'], false, $this->destination_course_id);
2277 2277
 
2278 2278
 							// Insert the new source survey
2279 2279
                             $new_id = Database::insert($table_sur, $params);
@@ -2458,13 +2458,13 @@  discard block
 block discarded – undo
2458 2458
 
2459 2459
 				// Adding the author's image
2460 2460
 				if (!empty($lp->preview_image)) {
2461
-					$new_filename = uniqid('').substr($lp->preview_image,strlen($lp->preview_image)-7, strlen($lp->preview_image));
2461
+					$new_filename = uniqid('').substr($lp->preview_image, strlen($lp->preview_image) - 7, strlen($lp->preview_image));
2462 2462
 					if (file_exists($origin_path.$lp->preview_image) && !is_dir($origin_path.$lp->preview_image)) {
2463 2463
 						$copy_result = copy($origin_path.$lp->preview_image, $destination_path.$new_filename);
2464 2464
 						if ($copy_result) {
2465 2465
 							$lp->preview_image = $new_filename;
2466 2466
 						} else {
2467
-							$lp->preview_image ='';
2467
+							$lp->preview_image = '';
2468 2468
 						}
2469 2469
 					}
2470 2470
 				}
@@ -2638,20 +2638,20 @@  discard block
 block discarded – undo
2638 2638
 					$next_item_ids[$new_item_id] = $item['next_item_id'];
2639 2639
 
2640 2640
 					if (!empty($item['prerequisite'])) {
2641
-						if ($lp->lp_type =='2') {
2641
+						if ($lp->lp_type == '2') {
2642 2642
 							// if is an sco
2643
-							$old_prerequisite[$new_item_id]= $item['prerequisite'];
2643
+							$old_prerequisite[$new_item_id] = $item['prerequisite'];
2644 2644
 						} else {
2645
-							$old_prerequisite[$new_item_id]= $new_item_ids[$item['prerequisite']];
2645
+							$old_prerequisite[$new_item_id] = $new_item_ids[$item['prerequisite']];
2646 2646
 						}
2647 2647
 					}
2648 2648
 
2649 2649
 					if (!empty($ref)) {
2650
-						if ($lp->lp_type =='2') {
2650
+						if ($lp->lp_type == '2') {
2651 2651
 							// if is an sco
2652
-							$old_refs[$new_item_id]= $ref;
2652
+							$old_refs[$new_item_id] = $ref;
2653 2653
 						} elseif (isset($new_item_ids[$ref])) {
2654
-                            $old_refs[$new_item_id]= $new_item_ids[$ref];
2654
+                            $old_refs[$new_item_id] = $new_item_ids[$ref];
2655 2655
                         }
2656 2656
 					}
2657 2657
 
@@ -2660,7 +2660,7 @@  discard block
 block discarded – undo
2660 2660
 
2661 2661
 				// Updating prerequisites
2662 2662
 				foreach ($old_prerequisite  as $key=>$my_old_prerequisite) {
2663
-					if ($my_old_prerequisite != ''){
2663
+					if ($my_old_prerequisite != '') {
2664 2664
 						$sql = "UPDATE ".$table_item." SET prerequisite = '".$my_old_prerequisite."'
2665 2665
 						        WHERE c_id = ".$this->destination_course_id." AND id = '".$key."'  ";
2666 2666
 						Database::query($sql);
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
 
2679 2679
 				foreach ($parent_item_ids as $new_item_id => $parent_item_old_id) {
2680 2680
 					$parent_new_id = 0;
2681
-					if($parent_item_old_id != 0){
2681
+					if ($parent_item_old_id != 0) {
2682 2682
 						$parent_new_id = $new_item_ids[$parent_item_old_id];
2683 2683
 					}
2684 2684
 					$sql = "UPDATE ".$table_item." SET parent_item_id = '".$parent_new_id."'
@@ -2687,7 +2687,7 @@  discard block
 block discarded – undo
2687 2687
 				}
2688 2688
 				foreach ($previous_item_ids as $new_item_id => $previous_item_old_id) {
2689 2689
 					$previous_new_id = 0;
2690
-					if ($previous_item_old_id != 0){
2690
+					if ($previous_item_old_id != 0) {
2691 2691
 						$previous_new_id = $new_item_ids[$previous_item_old_id];
2692 2692
 					}
2693 2693
 					$sql = "UPDATE ".$table_item." SET previous_item_id = '".$previous_new_id."'
@@ -2697,7 +2697,7 @@  discard block
 block discarded – undo
2697 2697
 
2698 2698
 				foreach ($next_item_ids as $new_item_id => $next_item_old_id) {
2699 2699
 					$next_new_id = 0;
2700
-					if ($next_item_old_id != 0){
2700
+					if ($next_item_old_id != 0) {
2701 2701
 						$next_new_id = $new_item_ids[$next_item_old_id];
2702 2702
 					}
2703 2703
 					$sql = "UPDATE ".$table_item." SET next_item_id = '".$next_new_id."'
@@ -2707,7 +2707,7 @@  discard block
 block discarded – undo
2707 2707
 
2708 2708
 				foreach ($prerequisite_ids as $new_item_id => $prerequisite_old_id) {
2709 2709
 					$prerequisite_new_id = 0;
2710
-					if ($prerequisite_old_id != 0){
2710
+					if ($prerequisite_old_id != 0) {
2711 2711
 						$prerequisite_new_id = $new_item_ids[$prerequisite_old_id];
2712 2712
 					}
2713 2713
 					$sql = "UPDATE ".$table_item." SET prerequisite = '".$prerequisite_new_id."'
@@ -2828,16 +2828,16 @@  discard block
 block discarded – undo
2828 2828
         if ($handle = opendir($source)) {        // if the folder exploration is sucsessful, continue
2829 2829
             while (false !== ($file = readdir($handle))) { // as long as storing the next file to $file is successful, continue
2830 2830
                 if ($file != '.' && $file != '..') {
2831
-                    $path = $source . '/' . $file;
2831
+                    $path = $source.'/'.$file;
2832 2832
                     if (is_file($path)) {
2833 2833
                        /* if (!is_file($dest . '/' . $file) || $overwrite)
2834 2834
                         if (!@copy($path, $dest . '/' . $file)) {
2835 2835
                             echo '<font color="red">File ('.$path.') '.get_lang('NotHavePermission').'</font>';
2836 2836
                         }*/
2837
-                    } elseif(is_dir($path)) {
2838
-                        if (!is_dir($dest . '/' . $file))
2839
-                        mkdir($dest . '/' . $file);
2840
-                        self:: allow_create_all_directory($path, $dest . '/' . $file, $overwrite);
2837
+                    } elseif (is_dir($path)) {
2838
+                        if (!is_dir($dest.'/'.$file))
2839
+                        mkdir($dest.'/'.$file);
2840
+                        self:: allow_create_all_directory($path, $dest.'/'.$file, $overwrite);
2841 2841
                     }
2842 2842
                 }
2843 2843
             }
@@ -3035,7 +3035,7 @@  discard block
 block discarded – undo
3035 3035
                     $this->course->backup_path,
3036 3036
                     $this->course->info['path']
3037 3037
                 );
3038
-				$thematic->params['c_id']  = $this->destination_course_id;
3038
+				$thematic->params['c_id'] = $this->destination_course_id;
3039 3039
 				unset($thematic->params['id']);
3040 3040
                 unset($thematic->params['iid']);
3041 3041
 
@@ -3059,7 +3059,7 @@  discard block
 block discarded – undo
3059 3059
                         unset($thematic_advance['iid']);
3060 3060
 						$thematic_advance['attendance_id'] = 0;
3061 3061
 						$thematic_advance['thematic_id'] = $last_id;
3062
-						$thematic_advance['c_id']  = $this->destination_course_id;
3062
+						$thematic_advance['c_id'] = $this->destination_course_id;
3063 3063
 
3064 3064
                         $my_id = Database::insert(
3065 3065
                             $table_thematic_advance,
@@ -3082,7 +3082,7 @@  discard block
 block discarded – undo
3082 3082
 						}
3083 3083
 					}
3084 3084
 
3085
-					foreach($thematic->thematic_plan_list as $thematic_plan) {
3085
+					foreach ($thematic->thematic_plan_list as $thematic_plan) {
3086 3086
 						unset($thematic_plan['id']);
3087 3087
                         unset($thematic_plan['iid']);
3088 3088
 						$thematic_plan['thematic_id'] = $last_id;
@@ -3198,7 +3198,7 @@  discard block
 block discarded – undo
3198 3198
                 // re-create dir
3199 3199
                 // @todo check security against injection of dir in crafted course backup here!
3200 3200
                 $path = $obj->params['url'];
3201
-                $path = '/'.str_replace('/','',substr($path,1));
3201
+                $path = '/'.str_replace('/', '', substr($path, 1));
3202 3202
 
3203 3203
                 $workData = array();
3204 3204
                 switch ($this->file_option) {
@@ -3220,9 +3220,9 @@  discard block
 block discarded – undo
3220 3220
                         $obj->params['new_dir'] = $obj->params['title'];
3221 3221
 
3222 3222
                         if (!empty($this->course_origin_id)) {
3223
-                            $sql = 'SELECT * FROM ' . $table_work_assignment . '
3223
+                            $sql = 'SELECT * FROM '.$table_work_assignment.'
3224 3224
                                     WHERE
3225
-                                        c_id = ' . $this->course_origin_id . ' AND
3225
+                                        c_id = ' . $this->course_origin_id.' AND
3226 3226
                                         publication_id = ' . $id_work;
3227 3227
 
3228 3228
                             $result = Database::query($sql);
@@ -3333,7 +3333,7 @@  discard block
 block discarded – undo
3333 3333
     public function DBUTF8_array($array)
3334 3334
     {
3335 3335
         if (UTF8_CONVERT) {
3336
-            foreach ($array as &$item)  {
3336
+            foreach ($array as &$item) {
3337 3337
                 $item = utf8_encode($item);
3338 3338
             }
3339 3339
             return $array;
Please login to merge, or discard this patch.
src/Chamilo/CourseBundle/Component/CourseCopy/Course.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
                     if ($resource->links_to($resource_to_check)) {
44 44
                         return true;
45 45
                     }
46
-                    if ($type == RESOURCE_LEARNPATH && get_class($resource)=='CourseCopyLearnpath') {
46
+                    if ($type == RESOURCE_LEARNPATH && get_class($resource) == 'CourseCopyLearnpath') {
47 47
                         if ($resource->has_item($resource_to_check)) {
48 48
                             return true;
49 49
                         }
Please login to merge, or discard this patch.
main/calendar/agenda_list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 if (!empty($currentCourseId) && $currentCourseId != -1) {
30 30
     // Agenda is inside a course tool
31
-    $url = api_get_self() . '?' . api_get_cidreq();
31
+    $url = api_get_self().'?'.api_get_cidreq();
32 32
     $this_section = SECTION_COURSES;
33 33
 
34 34
     // Order by start date
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     if (!empty($events)) {
52 52
         foreach ($events as &$event) {
53 53
             $courseId = isset($event['course_id']) ? $event['course_id'] : '';
54
-            $event['url'] = api_get_self() . '?cid=' . $courseId . '&type=' . $event['type'];
54
+            $event['url'] = api_get_self().'?cid='.$courseId.'&type='.$event['type'];
55 55
         }
56 56
     }
57 57
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         } else {
78 78
             $courseCondition = '&'.api_get_cidreq();
79 79
         }
80
-        header('Location: '. api_get_self().'?type='.$agenda->type.$courseCondition);
80
+        header('Location: '.api_get_self().'?type='.$agenda->type.$courseCondition);
81 81
         exit;
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/Proxy/HTTP.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @see fsockopen_header
83 83
 	 * @param Requests_Hooks $hooks Hook system
84 84
 	 */
85
-	public function register(Requests_Hooks &$hooks) {
85
+	public function register(Requests_Hooks & $hooks) {
86 86
 		$hooks->register('curl.before_send', array(&$this, 'curl_before_send'));
87 87
 
88 88
 		$hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket'));
@@ -146,6 +146,6 @@  discard block
 block discarded – undo
146 146
 	 * @return string
147 147
 	 */
148 148
 	public function get_auth_string() {
149
-		return $this->user . ':' . $this->pass;
149
+		return $this->user.':'.$this->pass;
150 150
 	}
151 151
 }
152 152
\ No newline at end of file
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/IDNAEncoder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 		$string = self::punycode_encode($string);
94 94
 
95 95
 		// Step 7: Prepend ACE prefix
96
-		$string = self::ACE_PREFIX . $string;
96
+		$string = self::ACE_PREFIX.$string;
97 97
 
98 98
 		// Step 8: Check size
99 99
 		if (strlen($string) < 64) {
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/Auth.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,5 +29,5 @@
 block discarded – undo
29 29
 	 * @see Requests_Hooks::register
30 30
 	 * @param Requests_Hooks $hooks Hook system
31 31
 	 */
32
-	public function register(Requests_Hooks &$hooks);
32
+	public function register(Requests_Hooks & $hooks);
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/Auth/Basic.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @see fsockopen_header
54 54
 	 * @param Requests_Hooks $hooks Hook system
55 55
 	 */
56
-	public function register(Requests_Hooks &$hooks) {
56
+	public function register(Requests_Hooks & $hooks) {
57 57
 		$hooks->register('curl.before_send', array(&$this, 'curl_before_send'));
58 58
 		$hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header'));
59 59
 	}
@@ -83,6 +83,6 @@  discard block
 block discarded – undo
83 83
 	 * @return string
84 84
 	 */
85 85
 	public function getAuthString() {
86
-		return $this->user . ':' . $this->pass;
86
+		return $this->user.':'.$this->pass;
87 87
 	}
88 88
 }
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/Cookie/Jar.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@
 block discarded – undo
162 162
 	 *
163 163
 	 * @var Requests_Response $response
164 164
 	 */
165
-	public function before_redirect_check(Requests_Response &$return) {
165
+	public function before_redirect_check(Requests_Response & $return) {
166 166
 		$url = $return->url;
167 167
 		if (!$url instanceof Requests_IRI) {
168 168
 			$url = new Requests_IRI($url);
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/Cookie.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -344,7 +344,7 @@
 block discarded – undo
344 344
 				}
345 345
 			}
346 346
 
347
-			$header_value .= '; ' . implode('; ', $parts);
347
+			$header_value .= '; '.implode('; ', $parts);
348 348
 		}
349 349
 		return $header_value;
350 350
 	}
Please login to merge, or discard this patch.