Completed
Push — 1.10.x ( c82817...6a93c3 )
by Yannick
202:42 queued 149:59
created
main/webservices/courses_list.soap.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
         'all',
29 29
         '',
30 30
         array(
31
-          'name'=>'code'  , 'type'=>'xsd:string',
32
-          'name'=>'title'  , 'type'=>'xsd:string',
33
-          'name'=>'url'    , 'type'=>'xsd:string',
31
+          'name'=>'code', 'type'=>'xsd:string',
32
+          'name'=>'title', 'type'=>'xsd:string',
33
+          'name'=>'url', 'type'=>'xsd:string',
34 34
           'name'=>'teacher', 'type'=>'xsd:string',
35
-          'name'=>'language','type'=>'xsd:string',
35
+          'name'=>'language', 'type'=>'xsd:string',
36 36
         )
37 37
 );
38 38
 
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 );
52 52
 
53 53
 // Register the method to expose
54
-$server->register('WSCourseList',         // method name
54
+$server->register('WSCourseList', // method name
55 55
     array('username' => 'xsd:string',
56 56
           'signature' => 'xsd:string',
57
-          'visibilities' => 'xsd:string'),      // input parameters
58
-    array('return' => 'xsd:Array'),             // output parameters
59
-    'urn:WSCourseList',                         // namespace
60
-    'urn:WSCourseList#WSCourseList',      // soapaction
61
-    'rpc',                                      // style
62
-    'encoded',                                  // use
57
+          'visibilities' => 'xsd:string'), // input parameters
58
+    array('return' => 'xsd:Array'), // output parameters
59
+    'urn:WSCourseList', // namespace
60
+    'urn:WSCourseList#WSCourseList', // soapaction
61
+    'rpc', // style
62
+    'encoded', // use
63 63
     'This service returns a list of courses'    // documentation
64 64
 );
65 65
 
Please login to merge, or discard this patch.
main/webservices/user_import/service.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,5 +59,5 @@
 block discarded – undo
59 59
 
60 60
 $server->register('import_users_from_file');
61 61
 
62
-$http_request = (isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:'');
62
+$http_request = (isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
63 63
 $server->service($http_request);
Please login to merge, or discard this patch.
main/webservices/user_import/import.lib.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,12 +4,12 @@  discard block
 block discarded – undo
4 4
  */
5 5
 function validate_data($users) {
6 6
 	global $defined_auth_sources;
7
-	$errors = array ();
8
-	$usernames = array ();
9
-	if(is_array($users)) {
7
+	$errors = array();
8
+	$usernames = array();
9
+	if (is_array($users)) {
10 10
 		foreach ($users as $index => $user) {
11 11
 			// 1. Check whether mandatory fields have been set.
12
-			$mandatory_fields = array ('LastName', 'FirstName');
12
+			$mandatory_fields = array('LastName', 'FirstName');
13 13
 			if (api_get_setting('registration', 'email') == 'true') {
14 14
 				$mandatory_fields[] = 'Email';
15 15
 			}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
  */
91 91
 function save_data($users) {
92 92
 	$user_table = Database :: get_main_table(TABLE_MAIN_USER);
93
-	if(is_array($users)) {
93
+	if (is_array($users)) {
94 94
 		foreach ($users as $index => $user) {
95 95
 			$user = complete_missing_data($user);
96 96
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 
99 99
 			$user_id = UserManager :: create_user($user['FirstName'], $user['LastName'], $user['Status'], $user['Email'], $user['UserName'], $user['Password'], $user['OfficialCode'], api_get_setting('PlatformLanguage'), $user['PhoneNumber'], '', $user['AuthSource']);
100 100
 			foreach ($user['Courses'] as $index => $course) {
101
-				if(CourseManager :: course_exists($course))
102
-					CourseManager :: subscribe_user($user_id, $course,$user['Status']);
101
+				if (CourseManager :: course_exists($course))
102
+					CourseManager :: subscribe_user($user_id, $course, $user['Status']);
103 103
 			}
104 104
 			if (strlen($user['ClassName']) > 0) {
105 105
 				$class_id = ClassManager :: get_class_id($user['ClassName']);
Please login to merge, or discard this patch.
main/webservices/cm_webservice_announcements.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
     public function get_announcements_id($username, $password, $course_code)
17 17
     {
18
-        if($this->verifyUserPass($username, $password) == "valid")
18
+        if ($this->verifyUserPass($username, $password) == "valid")
19 19
         {
20 20
 
21 21
             $result = self::get_announcements($username, $course_code);
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function get_announcement_data($username, $password, $course_code, $announcement_id, $field)
35 35
     {
36
-        if($this->verifyUserPass($username, $password) == "valid")
36
+        if ($this->verifyUserPass($username, $password) == "valid")
37 37
         {
38 38
             $htmlcode = false;
39 39
             $user_id = UserManager::get_user_id_from_username($username);
40 40
 
41 41
             $result = self::get_announcements($username, $course_code, $announcement_id);
42
-            while($announcement = Database::fetch_array($result))
42
+            while ($announcement = Database::fetch_array($result))
43 43
             {
44 44
                 $announcements[] = $announcement;
45 45
             }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
             return (htmlcode) ? html_entity_decode($announcements[0][$field_table]) : $announcements[0][$field_table];
71 71
 
72
-        }else
72
+        } else
73 73
             return get_lang('InvalidId');
74 74
     }
75 75
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
         $announcement_id = ($announcement_id == 0) ? "" : "AND announcement.id=".$announcement_id;
83 83
         $user_id = UserManager::get_user_id_from_username($username);
84 84
         $course_info = CourseManager::get_course_information($course_code);
85
-        $tbl_item_property  	= Database::get_course_table(TABLE_ITEM_PROPERTY);
86
-        $tbl_announcement		= Database::get_course_table(TABLE_ANNOUNCEMENT);
87
-        $maximum 	= '12';
85
+        $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
86
+        $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
87
+        $maximum = '12';
88 88
 
89
-        $group_memberships=GroupManager::get_group_ids($course_info['real_id'], $user_id);
89
+        $group_memberships = GroupManager::get_group_ids($course_info['real_id'], $user_id);
90 90
 
91 91
         if (api_get_group_id() == 0) {
92 92
             $cond_user_id = " AND (
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
         // the user is member of several groups => display personal
106 106
         // announcements AND his group announcements AND the general announcements
107
-        if (is_array($group_memberships) && count($group_memberships)>0) {
108
-            $sql="SELECT
107
+        if (is_array($group_memberships) && count($group_memberships) > 0) {
108
+            $sql = "SELECT
109 109
                     announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id
110 110
                 FROM $tbl_announcement announcement, $tbl_item_property ip
111 111
                 WHERE
Please login to merge, or discard this patch.
main/webservices/cm_webservice_course.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	protected function deleteCourseHelper($course_id_field_name, $course_id_value) {
21 21
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
22
-		if($course_id instanceof WSCMError) {
22
+		if ($course_id instanceof WSCMError) {
23 23
 			return $course_id;
24 24
 		} else {
25 25
 			$course_code = CourseManager::get_course_code_from_course_id($course_id);
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) {
39 39
 		$verifKey = $this->verifyKey($secret_key);
40
-		if($verifKey instanceof WSError) {
40
+		if ($verifKey instanceof WSError) {
41 41
 			$this->handleError($verifKey);
42 42
 		} else {
43 43
 			$result = $this->deleteCourseHelper($course_id_field_name, $course_id_value);
44
-			if($result instanceof WSError) {
44
+			if ($result instanceof WSError) {
45 45
 				$this->handleError($result);
46 46
 			}
47 47
 		}
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function DeleteCourses($secret_key, $courses) {
59 59
 		$verifKey = $this->verifyKey($secret_key);
60
-		if($verifKey instanceof WSError) {
60
+		if ($verifKey instanceof WSError) {
61 61
 			$this->handleError($verifKey);
62 62
 		} else {
63 63
 			$results = array();
64
-			foreach($courses as $course) {
64
+			foreach ($courses as $course) {
65 65
 				$result_tmp = array();
66 66
 				$result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']);
67 67
 				$result_tmp['course_id_value'] = $course['course_id_value'];
68
-				if($result_op instanceof WSCMError) {
68
+				if ($result_op instanceof WSCMError) {
69 69
 					// Return the error in the results
70 70
 					$result_tmp['result'] = $result_op->toArray();
71 71
 				} else {
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 	protected function createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
96 96
 		// Add the original course id field name and value to the extra fields if needed
97 97
 		$extras_associative = array();
98
-		if($course_id_field_name != "chamilo_course_id") {
98
+		if ($course_id_field_name != "chamilo_course_id") {
99 99
 			$extras_associative[$course_id_field_name] = $course_id_value;
100 100
 		}
101
-		foreach($extras as $extra) {
101
+		foreach ($extras as $extra) {
102 102
 			$extras_associative[$extra['field_name']] = $extra['field_value'];
103 103
 		}
104 104
 		$course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value);
105
-		if($course_admin_id instanceof WSError) {
105
+		if ($course_admin_id instanceof WSError) {
106 106
 			return $course_admin_id;
107 107
 		}
108
-		if($wanted_code == '') {
108
+		if ($wanted_code == '') {
109 109
 			$wanted_code = CourseManager::generate_course_code($title);
110 110
 		}
111 111
 		$result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			return new WSError(202, 'There was an error creating the course');
114 114
 		} else {
115 115
 			// Update extra fields
116
-			foreach($extras_associative as $fname => $fvalue) {
116
+			foreach ($extras_associative as $fname => $fvalue) {
117 117
 				CourseManager::update_course_extra_field_value($result, $fname, $fvalue);
118 118
 			}
119 119
 			// Get course id
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 	public function CreateCourse($secret_key, $title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
142 142
 		// First, verify the secret key
143 143
 		$verifKey = $this->verifyKey($secret_key);
144
-		if($verifKey instanceof WSError) {
144
+		if ($verifKey instanceof WSError) {
145 145
 			$this->handleError($verifKey);
146 146
 		} else {
147 147
 			$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
148
-			if($result instanceof WSError) {
148
+			if ($result instanceof WSError) {
149 149
 				$this->handleError($result);
150 150
 			} else {
151 151
 				return $result;
@@ -163,17 +163,17 @@  discard block
 block discarded – undo
163 163
 	public function CreateCourses($secret_key, $courses) {
164 164
 		// First, verify the secret key
165 165
 		$verifKey = $this->verifyKey($secret_key);
166
-		if($verifKey instanceof WSCMError) {
166
+		if ($verifKey instanceof WSCMError) {
167 167
 			$this->handleError($verifKey);
168 168
 		} else {
169 169
 			$results = array();
170
-			foreach($courses as $course) {
170
+			foreach ($courses as $course) {
171 171
 				$result_tmp = array();
172 172
 				//reinitialize variables just in case
173 173
 				$title = $category_code = $wanted_code = $tutor_name = $course_admin_user_id_field_name = $course_admin_user_id_value = $language = $course_id_field_name = $course_id_value = $extras = null;
174 174
 				extract($course);
175 175
 				$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
176
-				if($result instanceof WSCMError) {
176
+				if ($result instanceof WSCMError) {
177 177
 					$result_tmp['result'] = $result->toArray();
178 178
 					$result_tmp['course_id_value'] = $course_id_value;
179 179
 					$result_tmp['course_id_generated'] = 0;
@@ -207,47 +207,47 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
209 209
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
210
-		if($course_id instanceof WSCMError) {
210
+		if ($course_id instanceof WSCMError) {
211 211
 			return $course_id;
212 212
 		} else {
213 213
 			$attributes = array();
214
-			if(!is_empty($title)) {
214
+			if (!is_empty($title)) {
215 215
 				$attributes['title'] = $title;
216 216
 			}
217
-			if(!is_empty($category_code)) {
217
+			if (!is_empty($category_code)) {
218 218
 				$attributes['category_code'] = $category_code;
219 219
 			}
220
-			if(!is_empty($department_name)) {
220
+			if (!is_empty($department_name)) {
221 221
 				$attributes['department_name'] = $department_name;
222 222
 			}
223
-			if(!is_empty($department_url)) {
223
+			if (!is_empty($department_url)) {
224 224
 				$attributes['department_url'] = $department_url;
225 225
 			}
226
-			if(!is_empty($language)) {
226
+			if (!is_empty($language)) {
227 227
 				$attributes['course_language'] = $language;
228 228
 			}
229
-			if($visibility != '') {
230
-				$attributes['visibility'] = (int)$visibility;
229
+			if ($visibility != '') {
230
+				$attributes['visibility'] = (int) $visibility;
231 231
 			}
232
-			if($subscribe != '') {
233
-				$attributes['subscribe'] = (int)$subscribe;
232
+			if ($subscribe != '') {
233
+				$attributes['subscribe'] = (int) $subscribe;
234 234
 			}
235
-			if($unsubscribe != '') {
236
-				$attributes['unsubscribe'] = (int)$unsubscribe;
235
+			if ($unsubscribe != '') {
236
+				$attributes['unsubscribe'] = (int) $unsubscribe;
237 237
 			}
238
-			if(!is_empty($visual_code)) {
238
+			if (!is_empty($visual_code)) {
239 239
 				$attributes['visual_code'] = $visual_code;
240 240
 			}
241
-			if(!is_empty($attributes)) {
241
+			if (!is_empty($attributes)) {
242 242
 				CourseManager::update_attributes($course_id, $attributes);
243 243
 			}
244
-			if(!empty($extras)) {
244
+			if (!empty($extras)) {
245 245
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
246 246
 				$extras_associative = array();
247
-				foreach($extras as $extra) {
247
+				foreach ($extras as $extra) {
248 248
 					$extras_associative[$extra['field_name']] = $extra['field_value'];
249 249
 				}
250
-				foreach($extras_associative as $fname => $fvalue) {
250
+				foreach ($extras_associative as $fname => $fvalue) {
251 251
 					CourseManager::update_extra_field_value($course_code, $fname, $fvalue);
252 252
 				}
253 253
 			}
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 	 */
275 275
 	public function EditCourse($secret_key, $course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
276 276
 		$verifKey = $this->verifyKey($secret_key);
277
-		if($verifKey instanceof WSCMError) {
277
+		if ($verifKey instanceof WSCMError) {
278 278
 			$this->handleError($verifKey);
279 279
 		} else {
280 280
 			$result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras);
281
-			if($result instanceof WSCMError) {
281
+			if ($result instanceof WSCMError) {
282 282
 				$this->handleError($result);
283 283
 			}
284 284
 		}
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	public function ListCourses($secret_key, $course_id_field_name) {
296 296
 		$verifKey = $this->verifyKey($secret_key);
297
-		if($verifKey instanceof WSError) {
297
+		if ($verifKey instanceof WSError) {
298 298
 			$this->handleError($verifKey);
299 299
 		} else {
300 300
 			$courses_result = array();
301 301
 			$category_names = array();
302 302
 
303 303
 			$courses = CourseManager::get_courses_list();
304
-			foreach($courses as $course) {
304
+			foreach ($courses as $course) {
305 305
 				$course_tmp = array();
306 306
 				$course_tmp['id'] = $course['id'];
307 307
 				$course_tmp['code'] = $course['code'];
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 				$course_tmp['visibility'] = $course['visibility'];
311 311
 
312 312
 				// Determining category name
313
-				if($category_names[$course['category_code']]) {
313
+				if ($category_names[$course['category_code']]) {
314 314
 					$course_tmp['category_name'] = $category_names[$course['category_code']];
315 315
 				} else {
316 316
 					$category = CourseManager::get_course_category($course['category_code']);
@@ -346,21 +346,21 @@  discard block
 block discarded – undo
346 346
 	 */
347 347
 	protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) {
348 348
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
349
-		if($course_id instanceof WSError) {
349
+		if ($course_id instanceof WSError) {
350 350
 			return $course_id;
351 351
 		} else {
352 352
 			$user_id = $this->getUserId($user_id_field_name, $user_id_value);
353
-			if($user_id instanceof WSError) {
353
+			if ($user_id instanceof WSError) {
354 354
 				return $user_id;
355 355
 			} else {
356 356
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
357
-				if($state == 0) {
357
+				if ($state == 0) {
358 358
 					// Unsubscribe user
359 359
 					CourseManager::unsubscribe_user($user_id, $course_code);
360 360
 					return true;
361 361
 				} else {
362 362
 					// Subscribe user
363
-					if(CourseManager::subscribe_user($user_id, $course_code, $status)) {
363
+					if (CourseManager::subscribe_user($user_id, $course_code, $status)) {
364 364
 						return true;
365 365
 					} else {
366 366
 						return new WSError(203, 'An error occured subscribing to this course');
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) {
384 384
 		$verifKey = $this->verifyKey($secret_key);
385
-		if($verifKey instanceof WSError) {
385
+		if ($verifKey instanceof WSError) {
386 386
 			$this->handleError($verifKey);
387 387
 		} else {
388 388
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status);
389
-			if($result instanceof WSError) {
389
+			if ($result instanceof WSError) {
390 390
 				$this->handleError($result);
391 391
 			}
392 392
 		}
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) {
405 405
 		$verifKey = $this->verifyKey($secret_key);
406
-		if($verifKey instanceof WSError) {
406
+		if ($verifKey instanceof WSError) {
407 407
 			$this->handleError($verifKey);
408 408
 		} else {
409 409
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0);
410
-			if($result instanceof WSError) {
410
+			if ($result instanceof WSError) {
411 411
 				$this->handleError($result);
412 412
 			}
413 413
 		}
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 	 */
424 424
 	public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) {
425 425
 		$verifKey = $this->verifyKey($secret_key);
426
-		if($verifKey instanceof WSError) {
426
+		if ($verifKey instanceof WSError) {
427 427
 			$this->handleError($verifKey);
428 428
 		} else {
429 429
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
430
-			if($course_id instanceof WSError) {
430
+			if ($course_id instanceof WSError) {
431 431
 				return $course_id;
432 432
 			} else {
433 433
 				// Course exists, get its descriptions
434 434
 				$descriptions = CourseDescription::get_descriptions($course_id);
435 435
 				$results = array();
436
-				foreach($descriptions as $description) {
436
+				foreach ($descriptions as $description) {
437 437
 					$results[] = array('course_desc_id' => $description->get_description_type(),
438 438
 						'course_desc_title' => $description->get_title(),
439 439
 						'course_desc_content' => $description->get_content());
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) {
458 458
 		$verifKey = $this->verifyKey($secret_key);
459
-		if($verifKey instanceof WSError) {
459
+		if ($verifKey instanceof WSError) {
460 460
 			$this->handleError($verifKey);
461 461
 		} else {
462 462
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
463
-			if($course_id instanceof WSError) {
463
+			if ($course_id instanceof WSError) {
464 464
 				return $course_id;
465 465
 			} else {
466 466
 				// Create the new course description
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 				// Check if this course description exists
478 478
 				$descriptions = CourseDescription::get_descriptions($course_id);
479 479
 				$exists = false;
480
-				foreach($descriptions as $description) {
481
-					if($description->get_description_type() == $course_desc_id) {
480
+				foreach ($descriptions as $description) {
481
+					if ($description->get_description_type() == $course_desc_id) {
482 482
 						$exists = true;
483 483
 					}
484 484
 				}
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 	}
495 495
 	public function unreadMessage($username, $password)
496 496
 	{
497
-		if($this->verifyUserPass($username, $password) == "valid")
497
+		if ($this->verifyUserPass($username, $password) == "valid")
498 498
 		{
499 499
 			$table_message = Database::get_main_table(TABLE_MESSAGE);
500 500
 			$user_id = UserManager::get_user_id_from_username($username);
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
 	public function get_message_data($username, $password)
513 513
 	{
514
-		if($this->verifyUserPass($username, $password) == "valid")
514
+		if ($this->verifyUserPass($username, $password) == "valid")
515 515
 		{
516 516
 			$user_id = get_user_id_from_username($username);
517 517
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 
522 522
 	public function nada($username, $password)
523 523
 	{
524
-		if($this->verifyUserPass($username, $password) == "valid")
524
+		if ($this->verifyUserPass($username, $password) == "valid")
525 525
 			return $username.$password;
526 526
 		return $username;
527 527
 	}
Please login to merge, or discard this patch.
main/webservices/soap_course.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@
 block discarded – undo
51 51
 	'WSCourse.DeleteCourse',
52 52
 	array('secret_key' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string'),
53 53
 	array(),
54
-    'urn:WSService',                               // namespace
55
-    'urn:WSService#WSCourse.DeleteCourse',         // soapaction
56
-    'rpc',                                         // style
57
-    'encoded',                                     // use
54
+    'urn:WSService', // namespace
55
+    'urn:WSService#WSCourse.DeleteCourse', // soapaction
56
+    'rpc', // style
57
+    'encoded', // use
58 58
     'Delete a course in chamilo'                   // documentation
59 59
 
60 60
 );
Please login to merge, or discard this patch.
main/webservices/courses_list.rest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@
 block discarded – undo
60 60
 	$courses_list = courses_list($_POST['security-key'], $_POST['visibility']);
61 61
 	foreach ($courses_list as $code => $cd) {
62 62
 		echo '<course>';
63
-		echo '<code>' , $code , '</code>';
64
-		echo '<title>' , $cd['title'] , '</title>';
65
-		echo '<url>' , $cd['url'] , '</url>';
66
-		echo '<teacher>' , $cd['teacher'] , '</teacher>';
67
-		echo '<language>' , $cd['language'] , '</language>';
63
+		echo '<code>', $code, '</code>';
64
+		echo '<title>', $cd['title'], '</title>';
65
+		echo '<url>', $cd['url'], '</url>';
66
+		echo '<teacher>', $cd['teacher'], '</teacher>';
67
+		echo '<language>', $cd['language'], '</language>';
68 68
 		echo '</course>';
69 69
 	}
70 70
 }
Please login to merge, or discard this patch.
main/webservices/cm_soap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 	 * Singleton method
41 41
 	 */
42 42
 	public static function singleton() {
43
-		if(!isset(self::$_instance)) {
43
+		if (!isset(self::$_instance)) {
44 44
 			self::$_instance = new soap_server();
45 45
 			// Set the error handler
46 46
 			WSCMError::setErrorHandler(new WSCMSoapErrorHandler());
Please login to merge, or discard this patch.
main/webservices/webservice_user.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	protected function changeUserActiveState($user_id_field_name, $user_id_value, $state) {
22 22
 		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
23
-		if($user_id instanceof WSError) {
23
+		if ($user_id instanceof WSError) {
24 24
 			return $user_id;
25 25
 		} else {
26
-			if($state == 0) {
26
+			if ($state == 0) {
27 27
 				UserManager::disable($user_id);
28
-			} else if($state == 1) {
28
+			} else if ($state == 1) {
29 29
 				UserManager::enable($user_id);
30 30
 			}
31 31
 		}
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	protected function changeUsersActiveState($users, $state) {
42 42
 		$results = array();
43
-		foreach($users as $user) {
43
+		foreach ($users as $user) {
44 44
 			$result_tmp = array();
45 45
 			$result_op = $this->changeUserActiveState($user['user_id_field_name'], $user['user_id_value'], $state);
46 46
 			$result_tmp['user_id_value'] = $user['user_id_value'];
47
-			if($result_op instanceof WSError) {
47
+			if ($result_op instanceof WSError) {
48 48
 				// Return the error in the results
49 49
 				$result_tmp['result'] = $result_op->toArray();
50 50
 			} else {
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function DisableUser($secret_key, $user_id_field_name, $user_id_value) {
66 66
 		$verifKey = $this->verifyKey($secret_key);
67
-		if($verifKey instanceof WSError) {
67
+		if ($verifKey instanceof WSError) {
68 68
 			// Let the implementation handle it
69 69
 			$this->handleError($verifKey);
70 70
 		} else {
71 71
 			$result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 0);
72
-			if($result instanceof WSError) {
72
+			if ($result instanceof WSError) {
73 73
 				$this->handleError($result);
74 74
 			}
75 75
 		}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function DisableUsers($secret_key, $users) {
87 87
 		$verifKey = $this->verifyKey($secret_key);
88
-		if($verifKey instanceof WSError) {
88
+		if ($verifKey instanceof WSError) {
89 89
 			// Let the implementation handle it
90 90
 			$this->handleError($verifKey);
91 91
 		} else {
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function EnableUser($secret_key, $user_id_field_name, $user_id_value) {
104 104
 		$verifKey = $this->verifyKey($secret_key);
105
-		if($verifKey instanceof WSError) {
105
+		if ($verifKey instanceof WSError) {
106 106
 			$this->handleError($verifKey);
107 107
 		} else {
108 108
 			$result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 1);
109
-			if($result instanceof WSError) {
109
+			if ($result instanceof WSError) {
110 110
 				$this->handleError($result);
111 111
 			}
112 112
 		}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function EnableUsers($secret_key, $users) {
124 124
 		$verifKey = $this->verifyKey($secret_key);
125
-		if($verifKey instanceof WSError) {
125
+		if ($verifKey instanceof WSError) {
126 126
 			// Let the implementation handle it
127 127
 			$this->handleError($verifKey);
128 128
 		} else {
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function deleteUserHelper($user_id_field_name, $user_id_value) {
141 141
 		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
142
-		if($user_id instanceof WSError) {
142
+		if ($user_id instanceof WSError) {
143 143
 			return $user_id;
144 144
 		} else {
145
-			if(!UserManager::delete_user($user_id)) {
145
+			if (!UserManager::delete_user($user_id)) {
146 146
 				return new WSError(101, "There was a problem while deleting this user");
147 147
 			} else {
148 148
 				return true;
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function DeleteUser($secret_key, $user_id_field_name, $user_id_value) {
161 161
 		$verifKey = $this->verifyKey($secret_key);
162
-		if($verifKey instanceof WSError) {
162
+		if ($verifKey instanceof WSError) {
163 163
 			$this->handleError($verifKey);
164 164
 		} else {
165 165
 			$result = $this->deleteUserHelper($user_id_field_name, $user_id_value);
166
-			if($result instanceof WSError) {
166
+			if ($result instanceof WSError) {
167 167
 				$this->handleError($result);
168 168
 			}
169 169
 		}
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function DeleteUsers($secret_key, $users) {
181 181
 		$verifKey = $this->verifyKey($secret_key);
182
-		if($verifKey instanceof WSError) {
182
+		if ($verifKey instanceof WSError) {
183 183
 			$this->handleError($verifKey);
184 184
 		} else {
185 185
 			$results = array();
186
-			foreach($users as $user) {
186
+			foreach ($users as $user) {
187 187
 				$result_tmp = array();
188 188
 				$result_op = $this->deleteUserHelper($user['user_id_field_name'], $user['user_id_value']);
189 189
 				$result_tmp['user_id_value'] = $user['user_id_value'];
190
-				if($result_op instanceof WSError) {
190
+				if ($result_op instanceof WSError) {
191 191
 					// Return the error in the results
192 192
 					$result_tmp['result'] = $result_op->toArray();
193 193
 				} else {
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
         global $api_failureList;
224 224
 		// Add the original user id field name and value to the extra fields if needed
225 225
 		$extras_associative = array();
226
-		if($user_id_field_name != "chamilo_user_id") {
226
+		if ($user_id_field_name != "chamilo_user_id") {
227 227
 			$extras_associative[$user_id_field_name] = $user_id_value;
228 228
 		}
229 229
                 if (!empty($extras)) {
230
-                    foreach($extras as $extra) {
230
+                    foreach ($extras as $extra) {
231 231
                         $extras_associative[$extra['field_name']] = $extra['field_value'];
232 232
                     }
233 233
                 }
234 234
 		$result = UserManager::create_user($firstname, $lastname, $status, $email, $login, $password, '', $language, $phone, '', PLATFORM_AUTH_SOURCE, $expiration_date, $visibility, 0, $extras_associative, $encrypt_method);
235 235
 		if (!$result) {
236 236
 			$failure = $api_failureList[0];
237
-			if($failure == 'login-pass already taken') {
237
+			if ($failure == 'login-pass already taken') {
238 238
 				return new WSError(102, 'This username is already taken');
239
-			} else if($failure == 'encrypt_method invalid') {
239
+			} else if ($failure == 'encrypt_method invalid') {
240 240
 				return new WSError(103, 'The encryption of the password is invalid');
241 241
 			} else {
242 242
 				return new WSError(104, 'There was an error creating the user');
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	public function CreateUser($secret_key, $firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility = 1, $email = '', $language = 'english', $phone = '', $expiration_date = '0000-00-00 00:00:00', $extras = array()) {
271 271
 		// First, verify the secret key
272 272
 		$verifKey = $this->verifyKey($secret_key);
273
-		if($verifKey instanceof WSError) {
273
+		if ($verifKey instanceof WSError) {
274 274
 			$this->handleError($verifKey);
275 275
 		} else {
276 276
 			$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
277
-			if($result instanceof WSError) {
277
+			if ($result instanceof WSError) {
278 278
 				$this->handleError($result);
279 279
 			} else {
280 280
 				return $result;
@@ -291,17 +291,17 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	public function CreateUsers($secret_key, $users) {
293 293
 		$verifKey = $this->verifyKey($secret_key);
294
-		if($verifKey instanceof WSError) {
294
+		if ($verifKey instanceof WSError) {
295 295
 			$this->handleError($verifKey);
296 296
 		} else {
297 297
 			$results = array();
298
-			foreach($users as $user) {
298
+			foreach ($users as $user) {
299 299
 				$result_tmp = array();
300 300
                 // re-initialize variables just in case
301 301
                 $firstname = $lastname = $status = $login = $password = $encrypt_method = $user_id_field_name = $user_id_value = $visibility = $email = $language = $phone = $expiration_date = $extras = null;
302 302
 				extract($user);
303 303
 				$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
304
-				if($result instanceof WSError) {
304
+				if ($result instanceof WSError) {
305 305
 					$result_tmp['result'] = $result->toArray();
306 306
 					$result_tmp['user_id_value'] = $user_id_value;
307 307
 					$result_tmp['user_id_generated'] = 0;
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
 	) {
352 352
         global $api_failureList;
353 353
 		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
354
-		if($user_id instanceof WSError) {
354
+		if ($user_id instanceof WSError) {
355 355
 			return $user_id;
356 356
 		} else {
357
-			if($password == '') {
357
+			if ($password == '') {
358 358
 				$password = null;
359 359
 			}
360 360
 			$user_info = api_get_user_info($user_id);
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			);
384 384
 			if (!$result) {
385 385
 				$failure = $api_failureList[0];
386
-				if($failure == 'encrypt_method invalid') {
386
+				if ($failure == 'encrypt_method invalid') {
387 387
 					return new WSError(103, 'The encryption of the password is invalid');
388 388
 				} else {
389 389
 					return new WSError(105, 'There was an error updating the user');
@@ -415,19 +415,19 @@  discard block
 block discarded – undo
415 415
 	public function EditUser($secret_key, $user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras) {
416 416
 		// First, verify the secret key
417 417
 		$verifKey = $this->verifyKey($secret_key);
418
-		if($verifKey instanceof WSError) {
418
+		if ($verifKey instanceof WSError) {
419 419
 			$this->handleError($verifKey);
420 420
 		} else {
421 421
 
422 422
 			$extras_associative = array();
423 423
 			if (!empty($extras)) {
424
-				foreach($extras as $extra) {
424
+				foreach ($extras as $extra) {
425 425
 					$extras_associative[$extra['field_name']] = $extra['field_value'];
426 426
 				}
427 427
 			}
428 428
 
429 429
 			$result = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras_associative);
430
-			if($result instanceof WSError) {
430
+			if ($result instanceof WSError) {
431 431
 				$this->handleError($result);
432 432
 			}
433 433
 		}
@@ -443,18 +443,18 @@  discard block
 block discarded – undo
443 443
 	 */
444 444
 	public function EditUsers($secret_key, $users) {
445 445
 		$verifKey = $this->verifyKey($secret_key);
446
-		if($verifKey instanceof WSError) {
446
+		if ($verifKey instanceof WSError) {
447 447
 			$this->handleError($verifKey);
448 448
 		} else {
449 449
 			$results = array();
450
-			foreach($users as $user) {
450
+			foreach ($users as $user) {
451 451
 				$result_tmp = array();
452 452
                 // re-initialize variables just in case
453 453
                 $user_id_field_name = $user_id_value = $firstname = $lastname = $status = $loginname = $password = $encrypt_method = $email = $language = $phone = $expiration_date = $extras = null;
454 454
 				extract($user);
455 455
 				$result_op = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras);
456 456
 				$result_tmp['user_id_value'] = $user['user_id_value'];
457
-				if($result_op instanceof WSError) {
457
+				if ($result_op instanceof WSError) {
458 458
 					// Return the error in the results
459 459
 					$result_tmp['result'] = $result_op->toArray();
460 460
 				} else {
Please login to merge, or discard this patch.