Completed
Push — 1.11.x ( 3ca1af...7f27ad )
by José
93:15 queued 54:45
created
main/inc/lib/array.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 {
111 111
 	$old_locale = setlocale(LC_ALL, null);
112 112
 	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
113
+	$locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8');
114 114
 	$try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
116
+	foreach ($locale_list as $locale) {
117 117
 		$my_local = setlocale(LC_COLLATE, $locale);
118 118
 		if ($my_local) {
119 119
 			$try_sort = true;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     $flatten = array();
152 152
     array_walk_recursive(
153 153
         $array,
154
-        function ($value) use (&$flatten) {
154
+        function($value) use (&$flatten) {
155 155
             $flatten[] = $value;
156 156
         }
157 157
     );
Please login to merge, or discard this patch.
main/inc/lib/events.lib.php 1 patch
Spacing   +10 added lines, -12 removed lines patch added patch discarded remove patch
@@ -78,9 +78,7 @@  discard block
 block discarded – undo
78 78
         Database::query($sql);
79 79
 
80 80
         // Auto subscribe
81
-        $user_status = $userInfo['status']  == SESSIONADMIN ? 'sessionadmin' :
82
-            $userInfo['status'] == COURSEMANAGER ? 'teacher' :
83
-                $userInfo['status'] == DRH ? 'DRH' : 'student';
81
+        $user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : $userInfo['status'] == COURSEMANAGER ? 'teacher' : $userInfo['status'] == DRH ? 'DRH' : 'student';
84 82
         $autoSubscribe = api_get_setting($user_status.'_autosubscribe');
85 83
         if ($autoSubscribe) {
86 84
             $autoSubscribe = explode('|', $autoSubscribe);
@@ -334,7 +332,7 @@  discard block
 block discarded – undo
334 332
         global $debug;
335 333
 
336 334
         if ($debug) error_log('Called to update_event_exercice');
337
-        if ($debug) error_log('duration:' . $duration);
335
+        if ($debug) error_log('duration:'.$duration);
338 336
 
339 337
         if ($exeid != '') {
340 338
             /*
@@ -382,7 +380,7 @@  discard block
 block discarded – undo
382 380
         		   status = '".$status."',
383 381
         		   questions_to_check = '".$remind_list."',
384 382
         		   data_tracking = '".implode(',', $question_list)."',
385
-                   user_ip = '" . Database::escape_string(api_get_real_ip()) . "'
383
+                   user_ip = '" . Database::escape_string(api_get_real_ip())."'
386 384
         		 WHERE exe_id = '".Database::escape_string($exeid)."'";
387 385
             $res = Database::query($sql);
388 386
 
@@ -1036,15 +1034,15 @@  discard block
 block discarded – undo
1036 1034
 
1037 1035
         if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) {
1038 1036
             $sql = "DELETE FROM $track_e_exercises
1039
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1037
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1040 1038
             Database::query($sql);
1041 1039
 
1042 1040
             $sql = "DELETE FROM $track_attempts
1043
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1041
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1044 1042
             Database::query($sql);
1045 1043
 
1046 1044
             $sql = "DELETE FROM $recording_table
1047
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1045
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1048 1046
             Database::query($sql);
1049 1047
         }
1050 1048
 
@@ -1086,7 +1084,7 @@  discard block
 block discarded – undo
1086 1084
             Event::addEvent(
1087 1085
                 LOG_EXERCISE_RESULT_DELETE,
1088 1086
                 LOG_EXERCISE_AND_USER_ID,
1089
-                $exercise_id . '-' . $user_id,
1087
+                $exercise_id.'-'.$user_id,
1090 1088
                 null,
1091 1089
                 null,
1092 1090
                 $course_id,
@@ -1458,7 +1456,7 @@  discard block
 block discarded – undo
1458 1456
         $res = Database::query($sql);
1459 1457
         $list = array();
1460 1458
         while ($row = Database::fetch_array($res, 'ASSOC')) {
1461
-            $list[$row['exe_id']] = $row;  /*
1459
+            $list[$row['exe_id']] = $row; /*
1462 1460
               $sql = "SELECT * FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}";
1463 1461
               $res_question = Database::query($sql);
1464 1462
               while($row_q = Database::fetch_array($res_question,'ASSOC')) {
@@ -1684,7 +1682,7 @@  discard block
 block discarded – undo
1684 1682
         Event::addEvent(
1685 1683
             LOG_QUESTION_RESULT_DELETE,
1686 1684
             LOG_EXERCISE_ATTEMPT_QUESTION_ID,
1687
-            $exe_id . '-' . $question_id,
1685
+            $exe_id.'-'.$question_id,
1688 1686
             null,
1689 1687
             null,
1690 1688
             $courseId,
@@ -1720,7 +1718,7 @@  discard block
 block discarded – undo
1720 1718
         Event::addEvent(
1721 1719
             LOG_QUESTION_RESULT_DELETE,
1722 1720
             LOG_EXERCISE_ATTEMPT_QUESTION_ID,
1723
-            $exe_id . '-' . $question_id,
1721
+            $exe_id.'-'.$question_id,
1724 1722
             null,
1725 1723
             null,
1726 1724
             $courseId,
Please login to merge, or discard this patch.
main/inc/lib/course_description.lib.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
         $sql = "SELECT MAX(description_type) as MAX
178 178
                 FROM $tbl_course_description
179
-		        WHERE c_id = $course_id AND session_id='" . $this->session_id . "'";
179
+		        WHERE c_id = $course_id AND session_id='".$this->session_id."'";
180 180
         $rs = Database::query($sql);
181 181
         $max = Database::fetch_array($rs);
182 182
         $description_type = $max['MAX'] + 1;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             'session_id' => $this->session_id
212 212
         ];
213 213
 
214
-        $last_id  = Database::insert($table, $params);
214
+        $last_id = Database::insert($table, $params);
215 215
 
216 216
         if ($last_id > 0) {
217 217
             $sql = "UPDATE $table SET id = iid WHERE iid = $last_id";
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
         $sql = "DELETE FROM $tbl_course_description
320 320
 			 	WHERE
321 321
 			 	    c_id = $course_id AND
322
-			 	    id = '" . intval($this->id) . "' AND
323
-			 	    session_id = '" . intval($this->session_id) . "'";
322
+			 	    id = '".intval($this->id)."' AND
323
+			 	    session_id = '" . intval($this->session_id)."'";
324 324
         $result = Database::query($sql);
325 325
         $affected_rows = Database::affected_rows($result);
326 326
         if ($this->id > 0) {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         $course_id = api_get_course_int_id();
350 350
 
351 351
         $sql = "SELECT id FROM $tbl_course_description
352
-		        WHERE c_id = $course_id AND description_type = '" . intval($description_type) . "'";
352
+		        WHERE c_id = $course_id AND description_type = '".intval($description_type)."'";
353 353
         $rs = Database::query($sql);
354 354
         $row = Database::fetch_array($rs);
355 355
         $description_id = $row['id'];
Please login to merge, or discard this patch.
main/inc/lib/skill.lib.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
     {
735 735
         $skill_rel_skill = new SkillRelSkill();
736 736
         $skills = $skill_rel_skill->get_direct_parents($skill_id, true);
737
-        foreach($skills as &$skill) {
737
+        foreach ($skills as &$skill) {
738 738
             $skill['data'] = self::get($skill['skill_id']);
739 739
             $skill_info2 = $skill_rel_skill->get_skill_info($skill['skill_id']);
740 740
             $skill['data']['parent_id'] = $skill_info2['parent_id'];
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
                     $attributes = array(
773 773
                         'skill_id'      => $skill_id,
774 774
                         'parent_id'     => $parent_id,
775
-                        'relation_type' => (isset($params['relation_type'])?$params['relation_type']:0),
775
+                        'relation_type' => (isset($params['relation_type']) ? $params['relation_type'] : 0),
776 776
                         //'level'         => $params['level'],
777 777
                     );
778 778
                     $skill_rel_skill->save($attributes);
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
                     // 2nd node
970 970
                     $skills[$skill_id] = $skill_info;
971 971
                     // Uncomment code below to hide the searched skill
972
-                    $skills[$skill_id]['data']['parent_id'] =  $skill_info['extra']['parent_id'];
973
-                    $skills[$skill_id]['parent_id'] =  1;
972
+                    $skills[$skill_id]['data']['parent_id'] = $skill_info['extra']['parent_id'];
973
+                    $skills[$skill_id]['parent_id'] = 1;
974 974
                 }
975 975
             }
976 976
         }
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
                     $skill['data']['skill_has_gradebook'] = true;
1034 1034
                 }
1035 1035
                 $refs[$skill['id']] = &$skill;
1036
-                $flat_array[$skill['id']] =  &$skill;
1036
+                $flat_array[$skill['id']] = &$skill;
1037 1037
             }
1038 1038
 
1039 1039
             // Checking family value
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
                 $refs['root']['children'][0] = $skills[1];
1055 1055
                 $skills[$skill_id]['data']['family_id'] = 1;
1056 1056
                 $refs['root']['children'][0]['children'][0] = $skills[$skill_id];
1057
-                $flat_array[$skill_id] =  $skills[$skill_id];
1057
+                $flat_array[$skill_id] = $skills[$skill_id];
1058 1058
             } else {
1059 1059
                 // Moving node to the children index of their parents
1060 1060
 
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
                         $skill['data']['family_id'] = $new_family_array[$skill['id']];
1064 1064
                     }
1065 1065
                     $refs[$skill['parent_id']]['children'][] = &$skill;
1066
-                    $flat_array[$my_skill_id] =  $skill;
1066
+                    $flat_array[$my_skill_id] = $skill;
1067 1067
                 }
1068 1068
             }
1069 1069
 
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
                 INNER JOIN {$this->table_skill_rel_user} su
1162 1162
                 ON (s.id = su.skill_id)
1163 1163
                 WHERE user_id = $user_id";
1164
-        $result  = Database::query($sql);
1164
+        $result = Database::query($sql);
1165 1165
         if (Database::num_rows($result)) {
1166 1166
             $result = Database::fetch_row($result);
1167 1167
             return $result[0];
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
      */
1204 1204
     public function get_user_list_skill_ranking_count()
1205 1205
     {
1206
-        $sql    = "SELECT count(*) FROM (
1206
+        $sql = "SELECT count(*) FROM (
1207 1207
                         SELECT count(distinct 1)
1208 1208
                         FROM {$this->table} s
1209 1209
                         INNER JOIN {$this->table_skill_rel_user} su
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
                 ON c.code = g.course_code
1257 1257
                 WHERE sg.skill_id = $skill_id
1258 1258
                 AND (g.session_id IS NULL OR g.session_id = 0)";
1259
-        $result   = Database::query($sql);
1259
+        $result = Database::query($sql);
1260 1260
 
1261 1261
         return Database::store_result($result, 'ASSOC');
1262 1262
     }
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
                 WHERE sg.skill_id = $skillId
1444 1444
                 AND g.session_id > 0";
1445 1445
 
1446
-        $result   = Database::query($sql);
1446
+        $result = Database::query($sql);
1447 1447
 
1448 1448
         return Database::store_result($result, 'ASSOC');
1449 1449
     }
Please login to merge, or discard this patch.
main/inc/lib/search/xapian/XapianIndexer.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 require_once 'xapian.php';
9
-require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
9
+require_once dirname(__FILE__).'/../IndexableChunk.class.php';
10 10
 
11 11
 /**
12 12
  * Abstract helper class
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                     if (!empty($chunk->terms)) {
131 131
                         foreach ($chunk->terms as $term) {
132 132
                             /* FIXME: think of getting weight */
133
-                            $doc->add_term($term['flag'] . $term['name'], 1);
133
+                            $doc->add_term($term['flag'].$term['name'], 1);
134 134
                         }
135 135
                     }
136 136
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $doc->clear_terms();
216 216
         foreach ($terms as $term) {
217 217
             //add directly
218
-            $doc->add_term($prefix . $term, 1);
218
+            $doc->add_term($prefix.$term, 1);
219 219
         }
220 220
         $this->db->replace_document($did, $doc);
221 221
         $this->db->flush();
Please login to merge, or discard this patch.
main/inc/lib/search/xapian/XapianQuery.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  * Code
9 9
  */
10 10
 require_once 'xapian.php';
11
-require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
11
+require_once dirname(__FILE__).'/../IndexableChunk.class.php';
12 12
 //TODO: think another way without including specific fields here
13
-require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
13
+require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
14 14
 
15
-define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH) . 'plugins/xapian/searchdb/');
15
+define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/');
16 16
 
17 17
 /**
18 18
  * Queries the database.
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
                 // process each specific field prefix
97 97
                 foreach ($specific_fields as $specific_field) {
98
-                    $results[$count]['sf-' . $specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
98
+                    $results[$count]['sf-'.$specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
99 99
                 }
100 100
 
101 101
                 // rest of data
@@ -261,6 +261,6 @@  discard block
 block discarded – undo
261 261
     } else {
262 262
         $message_error = get_lang('SearchOtherXapianError');
263 263
     }
264
-    $display_message = get_lang('Error') . ' : ' . $message_error;
264
+    $display_message = get_lang('Error').' : '.$message_error;
265 265
     Display::display_error_message($display_message);
266 266
 }
Please login to merge, or discard this patch.
main/inc/lib/search/ChamiloIndexer.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * code
9 9
  */
10
-require_once dirname(__FILE__) . '/../../global.inc.php';
10
+require_once dirname(__FILE__).'/../../global.inc.php';
11 11
 include_once 'xapian/XapianIndexer.class.php';
12 12
 
13 13
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
40 40
             return FALSE;
41 41
 
42
-        require_once api_get_path(LIBRARY_PATH) . 'search/xapian/XapianQuery.php';
42
+        require_once api_get_path(LIBRARY_PATH).'search/xapian/XapianQuery.php';
43 43
 
44 44
         // compare terms
45 45
         $doc = $this->get_document($search_did);
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 
56 56
         // save it to search engine
57 57
         foreach ($missing_terms as $term) {
58
-            $this->add_term_to_doc($prefix . $term, $doc);
58
+            $this->add_term_to_doc($prefix.$term, $doc);
59 59
         }
60 60
         foreach ($deprecated_terms as $term) {
61
-            $this->remove_term_from_doc($prefix . $term, $doc);
61
+            $this->remove_term_from_doc($prefix.$term, $doc);
62 62
         }
63 63
 
64 64
         // don't do anything if no change
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @return  array Array of terms
75 75
      */
76 76
     function get_terms_on_db($prefix, $course_code, $tool_id, $ref_id) {
77
-        require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
77
+        require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
78 78
         $terms = get_specific_field_values_list_by_prefix($prefix, $course_code, $tool_id, $ref_id);
79 79
         $prefix_terms = array();
80 80
         foreach ($terms as $term) {
Please login to merge, or discard this patch.
main/inc/lib/search/ChamiloQuery.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
  * @param   array     extra           Extra queries to join with. Optional
19 19
  * @return  array
20 20
  */
21
-function chamilo_query_query($query_string, $offset=0, $length=10, $extra=NULL) {
21
+function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) {
22 22
     list($count, $results) = xapian_query($query_string, NULL, $offset, $length, $extra);
23 23
     return chamilo_preprocess_results($results);
24 24
 }
25 25
 
26
-function chamilo_query_simple_query($query_string, $offset=0, $length=10, $extra=NULL) {
26
+function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) {
27 27
     return xapian_query($query_string, NULL, $offset, $length, $extra);
28 28
 }
29 29
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 function chamilo_preprocess_results($results) {
43 43
     // group by toolid
44 44
     $results_by_tool = array();
45
-    if (count($results)>0) {
45
+    if (count($results) > 0) {
46 46
 
47 47
 	    foreach ($results as $key => $row) {
48 48
 	        $results_by_tool[$row['toolid']][] = $row;
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 
51 51
 	    $processed_results = array();
52 52
 	    foreach ($results_by_tool as $toolid => $rows) {
53
-	        $tool_processor_class = $toolid .'_processor';
54
-	        $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php';
53
+	        $tool_processor_class = $toolid.'_processor';
54
+	        $tool_processor_path = api_get_path(LIBRARY_PATH).'search/tool_processors/'.$tool_processor_class.'.class.php';
55 55
 	        if (file_exists($tool_processor_path)) {
56 56
 	            require_once($tool_processor_path);
57 57
 	            $tool_processor = new $tool_processor_class($rows);
@@ -71,6 +71,6 @@  discard block
 block discarded – undo
71 71
  * @param string $op
72 72
  * @return XapianQuery query joined
73 73
  */
74
-function chamilo_join_queries($query1, $query2=NULL, $op='or') {
74
+function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') {
75 75
 	return xapian_join_queries($query1, $query2, $op);
76 76
 }
Please login to merge, or discard this patch.
main/inc/lib/search/get_terms.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
     return;
18 18
 }
19 19
 
20
-require_once dirname(__FILE__) . '../../../global.inc.php';
21
-require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloQuery.php';
20
+require_once dirname(__FILE__).'../../../global.inc.php';
21
+require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
22 22
 
23 23
 /**
24 24
  * search with filter and build base array avoding repeated terms
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     if (is_array($dkterms) && is_array($dkterms[1])) {
34 34
         foreach ($specific_fields as $specific_field) {
35 35
             foreach ($dkterms[1] as $obj) {
36
-                foreach ($obj['sf-' . $specific_field['code']] as $raw_term) {
36
+                foreach ($obj['sf-'.$specific_field['code']] as $raw_term) {
37 37
                     if (count($raw_term['name']) > 1) {
38 38
                         $normal_term = substr($raw_term['name'], 1);
39 39
                         $sf_terms[$specific_field['code']][$normal_term] = $normal_term;
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 
55 55
 if (($cid = api_get_course_id()) != -1) { // with cid
56 56
     // course filter
57
-    $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
57
+    $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
58 58
     // term filter
59 59
     if ($term != '__all__') {
60
-        $filter[] = chamilo_get_boolean_query($prefix . $term);
60
+        $filter[] = chamilo_get_boolean_query($prefix.$term);
61 61
         // always and between term and courseid
62 62
         $filter = chamilo_join_queries($filter, null, 'and');
63 63
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     $sf_terms = get_usual_sf_terms($filter, $specific_fields);
66 66
 } else { // without cid
67 67
     if ($term != '__all__') {
68
-        $filter[] = chamilo_get_boolean_query($prefix . $term);
68
+        $filter[] = chamilo_get_boolean_query($prefix.$term);
69 69
 
70 70
         $sf_terms = get_usual_sf_terms($filter, $specific_fields);
71 71
     } else { // no cid and all/any terms
Please login to merge, or discard this patch.