@@ -20,49 +20,49 @@ discard block |
||
20 | 20 | { |
21 | 21 | if (!empty($_POST['role_name'])) |
22 | 22 | { |
23 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
24 | - $sql="INSERT INTO $table_role (role_name, role_comment, default_role) |
|
23 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
24 | + $sql = "INSERT INTO $table_role (role_name, role_comment, default_role) |
|
25 | 25 | VALUES ('".Database::escape_string($_POST['role_name'])."','".Database::escape_string($_POST['role_comment'])."','".Database::escape_string($_POST['default_role'])."')"; |
26 | - $result=Database::query($sql); |
|
27 | - $role_id=Database::insert_id(); |
|
28 | - $result_message=store_permissions('role', $role_id); |
|
26 | + $result = Database::query($sql); |
|
27 | + $role_id = Database::insert_id(); |
|
28 | + $result_message = store_permissions('role', $role_id); |
|
29 | 29 | } |
30 | 30 | else |
31 | 31 | { |
32 | - $result_message=get_lang('ErrorPleaseGiveRoleName'); |
|
32 | + $result_message = get_lang('ErrorPleaseGiveRoleName'); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | // storing a permission for a given role when the image approach is used |
36 | 36 | if (isset($_GET['action']) AND isset($_GET['permission']) AND isset($_GET['tool'])) |
37 | 37 | { |
38 | - if ($_GET['action']=='grant' OR $_GET['action']=='revoke') |
|
38 | + if ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke') |
|
39 | 39 | { |
40 | - $result_message=store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']); |
|
40 | + $result_message = store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | // deleting a role |
45 | -if (isset($_GET['action']) AND isset($_GET['role_id']) AND $_GET['action']=='delete') { |
|
45 | +if (isset($_GET['action']) AND isset($_GET['role_id']) AND $_GET['action'] == 'delete') { |
|
46 | 46 | //deleting the assignments fo this role: users |
47 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
48 | - $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
49 | - $result=Database::query($sql); |
|
47 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
48 | + $sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
49 | + $result = Database::query($sql); |
|
50 | 50 | |
51 | 51 | // deleting the assignments of this role: groups |
52 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
53 | - $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
54 | - $result=Database::query($sql); |
|
52 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
53 | + $sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
54 | + $result = Database::query($sql); |
|
55 | 55 | |
56 | 56 | // deleting the permissions of this role |
57 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
58 | - $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
59 | - $result=Database::query($sql); |
|
57 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
58 | + $sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
59 | + $result = Database::query($sql); |
|
60 | 60 | |
61 | 61 | // deleting the role |
62 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
63 | - $sql="DELETE FROM $table_role WHERE role_id='".intval($_GET['role_id'])."'"; |
|
64 | - $result=Database::query($sql); |
|
65 | - $result_message=get_lang('RoleDeleted'); |
|
62 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
63 | + $sql = "DELETE FROM $table_role WHERE role_id='".intval($_GET['role_id'])."'"; |
|
64 | + $result = Database::query($sql); |
|
65 | + $result_message = get_lang('RoleDeleted'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // displaying the return message of the actions |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // ADDING A NEW ROLE (FORM AND LINK) |
74 | 74 | echo '<img src="../img/add.png" /> <a href="roles.php?action=add">'.get_lang('AddRole').'</a>'; |
75 | 75 | |
76 | -if ($_GET['action']=='add') |
|
76 | +if ($_GET['action'] == 'add') |
|
77 | 77 | { |
78 | 78 | echo "<form method=\"post\" action=\"".api_get_self()."\">"; |
79 | 79 | echo "\n<table>"; |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | echo "<table class=\"data_table\">\n"; |
106 | 106 | |
107 | 107 | // the header |
108 | - if (api_get_setting('permissions')=='limited') |
|
108 | + if (api_get_setting('permissions') == 'limited') |
|
109 | 109 | { |
110 | - $header_array=$rights_limited; |
|
110 | + $header_array = $rights_limited; |
|
111 | 111 | } |
112 | - if (api_get_setting('permissions')=='full') |
|
112 | + if (api_get_setting('permissions') == 'full') |
|
113 | 113 | { |
114 | - $header_array=$rights_full; |
|
114 | + $header_array = $rights_full; |
|
115 | 115 | } |
116 | 116 | echo "\t<tr>\n"; |
117 | 117 | echo "\t\t<th>".get_lang('Module')."</th>\n"; |
@@ -151,25 +151,25 @@ discard block |
||
151 | 151 | // DISPLAYING THE EXISTING ROLES |
152 | 152 | // =================================================== |
153 | 153 | // platform roles |
154 | -$all_roles=get_all_roles('platform'); |
|
154 | +$all_roles = get_all_roles('platform'); |
|
155 | 155 | foreach ($all_roles as $role) |
156 | 156 | { |
157 | 157 | echo '<div><a href="roles.php?action=view&role_id='.$role['role_id'].'&scope=platform">'.$role['role_name'].'</a></div>'; |
158 | 158 | echo '<div>'.$role['role_comment'].'</div><br />'; |
159 | - if ($role['role_id']==$_GET['role_id']) |
|
159 | + if ($role['role_id'] == $_GET['role_id']) |
|
160 | 160 | { |
161 | - $current_role_info=$role; |
|
161 | + $current_role_info = $role; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | // course roles |
165 | -$all_roles=get_all_roles(); |
|
165 | +$all_roles = get_all_roles(); |
|
166 | 166 | foreach ($all_roles as $role) |
167 | 167 | { |
168 | 168 | echo '<div><a href="roles.php?action=view&role_id='.$role['role_id'].'">'.$role['role_name'].'</a><a href="roles.php?action=delete&role_id='.$role['role_id'].'"><img src="../img/delete.gif" /></a></div>'; |
169 | 169 | echo '<div>'.$role['role_comment'].'</div><br />'; |
170 | - if ($role['role_id']==$_GET['role_id']) |
|
170 | + if ($role['role_id'] == $_GET['role_id']) |
|
171 | 171 | { |
172 | - $current_role_info=$role; |
|
172 | + $current_role_info = $role; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | // =================================================== |
179 | 179 | if ($_GET['role_id']) |
180 | 180 | { |
181 | - $current_role_permissions=get_permissions('role',$_GET['role_id']); |
|
181 | + $current_role_permissions = get_permissions('role', $_GET['role_id']); |
|
182 | 182 | |
183 | 183 | // --------------------------------------------------- |
184 | 184 | // LIMITED OR FULL |
185 | 185 | // --------------------------------------------------- |
186 | - $current_role_permissions=limited_or_full($current_role_permissions); |
|
187 | - if (api_get_setting('permissions')=='limited') |
|
186 | + $current_role_permissions = limited_or_full($current_role_permissions); |
|
187 | + if (api_get_setting('permissions') == 'limited') |
|
188 | 188 | { |
189 | - $header_array=$rights_limited; |
|
189 | + $header_array = $rights_limited; |
|
190 | 190 | } |
191 | - if (api_get_setting('permissions')=='full') |
|
191 | + if (api_get_setting('permissions') == 'full') |
|
192 | 192 | { |
193 | - $header_array=$rights_full; |
|
193 | + $header_array = $rights_full; |
|
194 | 194 | } |
195 | 195 | // --------------------------------------------------- |
196 | 196 | // DISPLAYING THE MATRIX |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | // the list of the roles for the user |
201 | 201 | echo get_lang('PermissionsOfRole').':'.$current_role_info['role_name'].'<br />'; |
202 | - if ($_GET['scope']=='platform') |
|
202 | + if ($_GET['scope'] == 'platform') |
|
203 | 203 | { |
204 | 204 | echo get_lang('IsPlatformRoleNotEditable').'<br />'; |
205 | 205 | } |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | foreach ($header_array as $key=>$value) |
227 | 227 | { |
228 | 228 | echo "\t\t<td align='center'>\n"; |
229 | - if (in_array($value,$rights)) |
|
229 | + if (in_array($value, $rights)) |
|
230 | 230 | { |
231 | - if ($setting_visualisation=='checkbox') |
|
231 | + if ($setting_visualisation == 'checkbox') |
|
232 | 232 | { |
233 | 233 | display_checkbox_matrix($current_role_permissions, $tool, $value); |
234 | 234 | } |
235 | - if ($setting_visualisation=='image') |
|
235 | + if ($setting_visualisation == 'image') |
|
236 | 236 | { |
237 | - if ($_GET['scope']=='platform') |
|
237 | + if ($_GET['scope'] == 'platform') |
|
238 | 238 | { |
239 | - $roles_editable=false; |
|
239 | + $roles_editable = false; |
|
240 | 240 | } |
241 | 241 | else |
242 | 242 | { |
243 | - $roles_editable=true; |
|
243 | + $roles_editable = true; |
|
244 | 244 | } |
245 | - display_image_matrix($current_role_permissions, $tool, $value, '','',$roles_editable); |
|
245 | + display_image_matrix($current_role_permissions, $tool, $value, '', '', $roles_editable); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | echo "\t\t</td>\n"; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | } |
252 | 252 | |
253 | 253 | echo "</table>\n"; |
254 | - if ($setting_visualisation=='checkbox') |
|
254 | + if ($setting_visualisation == 'checkbox') |
|
255 | 255 | { |
256 | 256 | echo "<input type=\"Submit\" name=\"StoreRolePermissions\" value=\"".get_lang('StorePermissions')."\">"; |
257 | 257 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | protected function deleteCourseHelper($course_id_field_name, $course_id_value) { |
23 | 23 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
24 | - if($course_id instanceof WSError) { |
|
24 | + if ($course_id instanceof WSError) { |
|
25 | 25 | return $course_id; |
26 | 26 | } else { |
27 | 27 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) { |
41 | 41 | $verifKey = $this->verifyKey($secret_key); |
42 | - if($verifKey instanceof WSError) { |
|
42 | + if ($verifKey instanceof WSError) { |
|
43 | 43 | $this->handleError($verifKey); |
44 | 44 | } else { |
45 | 45 | $result = $this->deleteCourseHelper($course_id_field_name, $course_id_value); |
46 | - if($result instanceof WSError) { |
|
46 | + if ($result instanceof WSError) { |
|
47 | 47 | $this->handleError($result); |
48 | 48 | } |
49 | 49 | } |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function DeleteCourses($secret_key, $courses) { |
61 | 61 | $verifKey = $this->verifyKey($secret_key); |
62 | - if($verifKey instanceof WSError) { |
|
62 | + if ($verifKey instanceof WSError) { |
|
63 | 63 | $this->handleError($verifKey); |
64 | 64 | } else { |
65 | 65 | $results = array(); |
66 | - foreach($courses as $course) { |
|
66 | + foreach ($courses as $course) { |
|
67 | 67 | $result_tmp = array(); |
68 | 68 | $result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']); |
69 | 69 | $result_tmp['course_id_value'] = $course['course_id_value']; |
70 | - if($result_op instanceof WSError) { |
|
70 | + if ($result_op instanceof WSError) { |
|
71 | 71 | // Return the error in the results |
72 | 72 | $result_tmp['result'] = $result_op->toArray(); |
73 | 73 | } else { |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | 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) { |
98 | 98 | // Add the original course id field name and value to the extra fields if needed |
99 | 99 | $extras_associative = array(); |
100 | - if($course_id_field_name != "chamilo_course_id") { |
|
100 | + if ($course_id_field_name != "chamilo_course_id") { |
|
101 | 101 | $extras_associative[$course_id_field_name] = $course_id_value; |
102 | 102 | } |
103 | - foreach($extras as $extra) { |
|
103 | + foreach ($extras as $extra) { |
|
104 | 104 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
105 | 105 | } |
106 | 106 | $course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value); |
107 | - if($course_admin_id instanceof WSError) { |
|
107 | + if ($course_admin_id instanceof WSError) { |
|
108 | 108 | return $course_admin_id; |
109 | 109 | } |
110 | - if($wanted_code == '') { |
|
110 | + if ($wanted_code == '') { |
|
111 | 111 | $wanted_code = CourseManager::generate_course_code($title); |
112 | 112 | } |
113 | 113 | $result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return new WSError(202, 'There was an error creating the course'); |
116 | 116 | } else { |
117 | 117 | // Update extra fields |
118 | - foreach($extras_associative as $fname => $fvalue) { |
|
118 | + foreach ($extras_associative as $fname => $fvalue) { |
|
119 | 119 | CourseManager::update_course_extra_field_value($result, $fname, $fvalue); |
120 | 120 | } |
121 | 121 | // Get course id |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | 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) { |
144 | 144 | // First, verify the secret key |
145 | 145 | $verifKey = $this->verifyKey($secret_key); |
146 | - if($verifKey instanceof WSError) { |
|
146 | + if ($verifKey instanceof WSError) { |
|
147 | 147 | $this->handleError($verifKey); |
148 | 148 | } else { |
149 | 149 | $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); |
150 | - if($result instanceof WSError) { |
|
150 | + if ($result instanceof WSError) { |
|
151 | 151 | $this->handleError($result); |
152 | 152 | } else { |
153 | 153 | return $result; |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | public function CreateCourses($secret_key, $courses) { |
166 | 166 | // First, verify the secret key |
167 | 167 | $verifKey = $this->verifyKey($secret_key); |
168 | - if($verifKey instanceof WSError) { |
|
168 | + if ($verifKey instanceof WSError) { |
|
169 | 169 | $this->handleError($verifKey); |
170 | 170 | } else { |
171 | 171 | $results = array(); |
172 | - foreach($courses as $course) { |
|
172 | + foreach ($courses as $course) { |
|
173 | 173 | $result_tmp = array(); |
174 | 174 | // re-initialize variables just in case |
175 | 175 | $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 = 0; |
176 | 176 | extract($course); |
177 | 177 | $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); |
178 | - if($result instanceof WSError) { |
|
178 | + if ($result instanceof WSError) { |
|
179 | 179 | $result_tmp['result'] = $result->toArray(); |
180 | 180 | $result_tmp['course_id_value'] = $course_id_value; |
181 | 181 | $result_tmp['course_id_generated'] = 0; |
@@ -209,47 +209,47 @@ discard block |
||
209 | 209 | */ |
210 | 210 | protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) { |
211 | 211 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
212 | - if($course_id instanceof WSError) { |
|
212 | + if ($course_id instanceof WSError) { |
|
213 | 213 | return $course_id; |
214 | 214 | } else { |
215 | 215 | $attributes = array(); |
216 | - if(!is_empty($title)) { |
|
216 | + if (!is_empty($title)) { |
|
217 | 217 | $attributes['title'] = $title; |
218 | 218 | } |
219 | - if(!is_empty($category_code)) { |
|
219 | + if (!is_empty($category_code)) { |
|
220 | 220 | $attributes['category_code'] = $category_code; |
221 | 221 | } |
222 | - if(!is_empty($department_name)) { |
|
222 | + if (!is_empty($department_name)) { |
|
223 | 223 | $attributes['department_name'] = $department_name; |
224 | 224 | } |
225 | - if(!is_empty($department_url)) { |
|
225 | + if (!is_empty($department_url)) { |
|
226 | 226 | $attributes['department_url'] = $department_url; |
227 | 227 | } |
228 | - if(!is_empty($language)) { |
|
228 | + if (!is_empty($language)) { |
|
229 | 229 | $attributes['course_language'] = $language; |
230 | 230 | } |
231 | - if($visibility != '') { |
|
232 | - $attributes['visibility'] = (int)$visibility; |
|
231 | + if ($visibility != '') { |
|
232 | + $attributes['visibility'] = (int) $visibility; |
|
233 | 233 | } |
234 | - if($subscribe != '') { |
|
235 | - $attributes['subscribe'] = (int)$subscribe; |
|
234 | + if ($subscribe != '') { |
|
235 | + $attributes['subscribe'] = (int) $subscribe; |
|
236 | 236 | } |
237 | - if($unsubscribe != '') { |
|
238 | - $attributes['unsubscribe'] = (int)$unsubscribe; |
|
237 | + if ($unsubscribe != '') { |
|
238 | + $attributes['unsubscribe'] = (int) $unsubscribe; |
|
239 | 239 | } |
240 | - if(!is_empty($visual_code)) { |
|
240 | + if (!is_empty($visual_code)) { |
|
241 | 241 | $attributes['visual_code'] = $visual_code; |
242 | 242 | } |
243 | - if(!is_empty($attributes)) { |
|
243 | + if (!is_empty($attributes)) { |
|
244 | 244 | CourseManager::update_attributes($course_id, $attributes); |
245 | 245 | } |
246 | - if(!empty($extras)) { |
|
246 | + if (!empty($extras)) { |
|
247 | 247 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
248 | 248 | $extras_associative = array(); |
249 | - foreach($extras as $extra) { |
|
249 | + foreach ($extras as $extra) { |
|
250 | 250 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
251 | 251 | } |
252 | - foreach($extras_associative as $fname => $fvalue) { |
|
252 | + foreach ($extras_associative as $fname => $fvalue) { |
|
253 | 253 | CourseManager::update_extra_field_value($course_code, $fname, $fvalue); |
254 | 254 | } |
255 | 255 | } |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | */ |
277 | 277 | 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) { |
278 | 278 | $verifKey = $this->verifyKey($secret_key); |
279 | - if($verifKey instanceof WSError) { |
|
279 | + if ($verifKey instanceof WSError) { |
|
280 | 280 | $this->handleError($verifKey); |
281 | 281 | } else { |
282 | 282 | $result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras); |
283 | - if($result instanceof WSError) { |
|
283 | + if ($result instanceof WSError) { |
|
284 | 284 | $this->handleError($result); |
285 | 285 | } |
286 | 286 | } |
@@ -296,10 +296,10 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function ListCourses($secret_key, $visibility = 'public,public-registered,private,closed') { |
298 | 298 | $verifKey = $this->verifyKey($secret_key); |
299 | - if($verifKey instanceof WSError) { |
|
299 | + if ($verifKey instanceof WSError) { |
|
300 | 300 | $this->handleError($verifKey); |
301 | 301 | } else { |
302 | - $visibilities = split(',',$visibility); |
|
302 | + $visibilities = split(',', $visibility); |
|
303 | 303 | $vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0'); |
304 | 304 | foreach ($visibilities as $p => $visibility) { |
305 | 305 | $visibilities[$p] = $vis[$visibility]; |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | $category_names = array(); |
309 | 309 | |
310 | 310 | $courses = CourseManager::get_courses_list(); |
311 | - foreach($courses as $course) { |
|
311 | + foreach ($courses as $course) { |
|
312 | 312 | //skip elements that do not match required visibility |
313 | - if (!in_array($course['visibility'],$visibilities)) { continue; } |
|
313 | + if (!in_array($course['visibility'], $visibilities)) { continue; } |
|
314 | 314 | $course_tmp = array(); |
315 | 315 | $course_tmp['id'] = $course['id']; |
316 | 316 | $course_tmp['code'] = $course['code']; |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $course_tmp['visibility'] = $course['visibility']; |
320 | 320 | |
321 | 321 | // Determining category name |
322 | - if($category_names[$course['category_code']]) { |
|
322 | + if ($category_names[$course['category_code']]) { |
|
323 | 323 | $course_tmp['category_name'] = $category_names[$course['category_code']]; |
324 | 324 | } else { |
325 | 325 | $category = CourseManager::get_course_category($course['category_code']); |
@@ -355,21 +355,21 @@ discard block |
||
355 | 355 | */ |
356 | 356 | protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) { |
357 | 357 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
358 | - if($course_id instanceof WSError) { |
|
358 | + if ($course_id instanceof WSError) { |
|
359 | 359 | return $course_id; |
360 | 360 | } else { |
361 | 361 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
362 | - if($user_id instanceof WSError) { |
|
362 | + if ($user_id instanceof WSError) { |
|
363 | 363 | return $user_id; |
364 | 364 | } else { |
365 | 365 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
366 | - if($state == 0) { |
|
366 | + if ($state == 0) { |
|
367 | 367 | // Unsubscribe user |
368 | 368 | CourseManager::unsubscribe_user($user_id, $course_code); |
369 | 369 | return true; |
370 | 370 | } else { |
371 | 371 | // Subscribe user |
372 | - if(CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
372 | + if (CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
373 | 373 | return true; |
374 | 374 | } else { |
375 | 375 | return new WSError(203, 'An error occured subscribing to this course'); |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) { |
393 | 393 | $verifKey = $this->verifyKey($secret_key); |
394 | - if($verifKey instanceof WSError) { |
|
394 | + if ($verifKey instanceof WSError) { |
|
395 | 395 | $this->handleError($verifKey); |
396 | 396 | } else { |
397 | 397 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status); |
398 | - if($result instanceof WSError) { |
|
398 | + if ($result instanceof WSError) { |
|
399 | 399 | $this->handleError($result); |
400 | 400 | } |
401 | 401 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | */ |
413 | 413 | public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) { |
414 | 414 | $verifKey = $this->verifyKey($secret_key); |
415 | - if($verifKey instanceof WSError) { |
|
415 | + if ($verifKey instanceof WSError) { |
|
416 | 416 | $this->handleError($verifKey); |
417 | 417 | } else { |
418 | 418 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0); |
419 | - if($result instanceof WSError) { |
|
419 | + if ($result instanceof WSError) { |
|
420 | 420 | $this->handleError($result); |
421 | 421 | } |
422 | 422 | } |
@@ -432,17 +432,17 @@ discard block |
||
432 | 432 | */ |
433 | 433 | public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) { |
434 | 434 | $verifKey = $this->verifyKey($secret_key); |
435 | - if($verifKey instanceof WSError) { |
|
435 | + if ($verifKey instanceof WSError) { |
|
436 | 436 | $this->handleError($verifKey); |
437 | 437 | } else { |
438 | 438 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
439 | - if($course_id instanceof WSError) { |
|
439 | + if ($course_id instanceof WSError) { |
|
440 | 440 | return $course_id; |
441 | 441 | } else { |
442 | 442 | // Course exists, get its descriptions |
443 | 443 | $descriptions = CourseDescription::get_descriptions($course_id); |
444 | 444 | $results = array(); |
445 | - foreach($descriptions as $description) { |
|
445 | + foreach ($descriptions as $description) { |
|
446 | 446 | $results[] = array('course_desc_id' => $description->get_description_type(), |
447 | 447 | 'course_desc_title' => $description->get_title(), |
448 | 448 | 'course_desc_content' => $description->get_content()); |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | */ |
466 | 466 | public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) { |
467 | 467 | $verifKey = $this->verifyKey($secret_key); |
468 | - if($verifKey instanceof WSError) { |
|
468 | + if ($verifKey instanceof WSError) { |
|
469 | 469 | $this->handleError($verifKey); |
470 | 470 | } else { |
471 | 471 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
472 | - if($course_id instanceof WSError) { |
|
472 | + if ($course_id instanceof WSError) { |
|
473 | 473 | return $course_id; |
474 | 474 | } else { |
475 | 475 | // Create the new course description |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | // Check if this course description exists |
485 | 485 | $descriptions = CourseDescription::get_descriptions($course_id); |
486 | 486 | $exists = false; |
487 | - foreach($descriptions as $description) { |
|
488 | - if($description->get_description_type() == $course_desc_id) { |
|
487 | + foreach ($descriptions as $description) { |
|
488 | + if ($description->get_description_type() == $course_desc_id) { |
|
489 | 489 | $exists = true; |
490 | 490 | } |
491 | 491 | } |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | { |
20 | 20 | $fileData = $pptData['file_data']; |
21 | 21 | $dataInfo = pathinfo($pptData['file_name']); |
22 | - $fileName = basename($pptData['file_name'], '.' . $dataInfo['extension']); |
|
22 | + $fileName = basename($pptData['file_name'], '.'.$dataInfo['extension']); |
|
23 | 23 | $fullFileName = $pptData['file_name']; |
24 | 24 | |
25 | 25 | $tempArchivePath = api_get_path(SYS_ARCHIVE_PATH); |
26 | - $tempPath = $tempArchivePath . 'wsConvert/' . $fileName . '/'; |
|
27 | - $tempPathNewFiles = $tempArchivePath . 'wsConvert/' . $fileName . '-n/'; |
|
26 | + $tempPath = $tempArchivePath.'wsConvert/'.$fileName.'/'; |
|
27 | + $tempPathNewFiles = $tempArchivePath.'wsConvert/'.$fileName.'-n/'; |
|
28 | 28 | |
29 | 29 | $perms = api_get_permissions_for_new_directories(); |
30 | 30 | if (!is_dir($tempPath)) { |
@@ -33,28 +33,28 @@ discard block |
||
33 | 33 | if (!is_dir($tempPathNewFiles)) { |
34 | 34 | mkdir($tempPathNewFiles, $perms, true); |
35 | 35 | } |
36 | - if (!is_dir($tempPathNewFiles . $fileName)) { |
|
37 | - mkdir($tempPathNewFiles . $fileName, $perms, true); |
|
36 | + if (!is_dir($tempPathNewFiles.$fileName)) { |
|
37 | + mkdir($tempPathNewFiles.$fileName, $perms, true); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $file = base64_decode($fileData); |
41 | - file_put_contents($tempPath . $fullFileName, $file); |
|
41 | + file_put_contents($tempPath.$fullFileName, $file); |
|
42 | 42 | |
43 | 43 | if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php |
44 | - $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); |
|
45 | - $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar'; |
|
46 | - $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $classPath . '" DokeosConverter'; |
|
44 | + $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); |
|
45 | + $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar'; |
|
46 | + $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$classPath.'" DokeosConverter'; |
|
47 | 47 | } else { |
48 | - $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; |
|
48 | + $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; |
|
49 | 49 | $classPath = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar'; |
50 | - $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' DokeosConverter'; |
|
50 | + $cmd = 'cd '.$converterPath.' && java '.$classPath.' DokeosConverter'; |
|
51 | 51 | } |
52 | 52 | |
53 | - $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); |
|
54 | - $cmd .= ' -w 720 -h 540 -d oogie "' . $tempPath . $fullFileName.'" "' . $tempPathNewFiles . $fileName . '.html"'; |
|
53 | + $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); |
|
54 | + $cmd .= ' -w 720 -h 540 -d oogie "'.$tempPath.$fullFileName.'" "'.$tempPathNewFiles.$fileName.'.html"'; |
|
55 | 55 | |
56 | 56 | $perms = api_get_permissions_for_new_files(); |
57 | - chmod($tempPathNewFiles . $fileName, $perms, true); |
|
57 | + chmod($tempPathNewFiles.$fileName, $perms, true); |
|
58 | 58 | |
59 | 59 | $files = array(); |
60 | 60 | $return = 0; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $images = array(); |
65 | 65 | foreach ($files as $file) { |
66 | 66 | $imageData = explode('||', $file); |
67 | - $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles . $fileName . '/' . $imageData[1])); |
|
67 | + $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles.$fileName.'/'.$imageData[1])); |
|
68 | 68 | } |
69 | 69 | $data = array( |
70 | 70 | 'files' => $files, |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | function deleteDirectory($directoryPath) |
91 | 91 | { |
92 | - $files = array_diff(scandir($directoryPath), array('.','..')); |
|
92 | + $files = array_diff(scandir($directoryPath), array('.', '..')); |
|
93 | 93 | foreach ($files as $file) { |
94 | 94 | if (is_dir("$directoryPath/$file")) { |
95 | 95 | deleteDirectory("$directoryPath/$file"); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $webCodePath = api_get_path(WEB_CODE_PATH); |
107 | 107 | $options = array( |
108 | 108 | 'uri' => $webPath, |
109 | - 'location' => $webCodePath . 'webservices/additional_webservices.php' |
|
109 | + 'location' => $webCodePath.'webservices/additional_webservices.php' |
|
110 | 110 | ); |
111 | 111 | |
112 | 112 | $soapServer = new SoapServer(NULL, $options); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | */ |
6 | 6 | $ip = trim($_SERVER['REMOTE_ADDR']); |
7 | 7 | if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
8 | - list($ip1,$ip2) = preg_split('/,/',$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
8 | + list($ip1, $ip2) = preg_split('/,/', $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
9 | 9 | $ip = trim($ip1); |
10 | 10 | } |
11 | 11 | echo htmlentities($ip); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function GetTimeSpentOnPlatform($user_id_field_name, $user_id_value) { |
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 | 26 | return Tracking::get_time_spent_on_the_platform($user_id); |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function GetTimeSpentOnCourse($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value) { |
40 | 40 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
41 | - if($user_id instanceof WSError) { |
|
41 | + if ($user_id instanceof WSError) { |
|
42 | 42 | return $user_id; |
43 | 43 | } |
44 | 44 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
45 | - if($course_id instanceof WSError) { |
|
45 | + if ($course_id instanceof WSError) { |
|
46 | 46 | return $course_id; |
47 | 47 | } else { |
48 | 48 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function GetTimeSpentOnCourseInSession($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) { |
63 | 63 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
64 | - if($user_id instanceof WSError) { |
|
64 | + if ($user_id instanceof WSError) { |
|
65 | 65 | return $user_id; |
66 | 66 | } |
67 | 67 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
68 | - if($course_id instanceof WSError) { |
|
68 | + if ($course_id instanceof WSError) { |
|
69 | 69 | return $course_id; |
70 | 70 | } else { |
71 | 71 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
72 | 72 | } |
73 | 73 | $session_id = $this->getSessionId($session_id_field_name, $session_id_value); |
74 | - if($session_id instanceof WSError) { |
|
74 | + if ($session_id instanceof WSError) { |
|
75 | 75 | return $session_id; |
76 | 76 | } |
77 | 77 | return Tracking::get_time_spent_on_the_course($user_id, $course_id, $session_id); |
@@ -87,17 +87,17 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function GetLearnpathsByCourse($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value) { |
89 | 89 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
90 | - if($user_id instanceof WSError) { |
|
90 | + if ($user_id instanceof WSError) { |
|
91 | 91 | return $user_id; |
92 | 92 | } |
93 | 93 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
94 | - if($course_id instanceof WSError) { |
|
94 | + if ($course_id instanceof WSError) { |
|
95 | 95 | return $course_id; |
96 | 96 | } else { |
97 | 97 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
98 | 98 | } |
99 | 99 | |
100 | - $lp = new LearnpathList($user_id,$course_code); |
|
100 | + $lp = new LearnpathList($user_id, $course_code); |
|
101 | 101 | $list = $lp->list; |
102 | 102 | $return = array(); |
103 | 103 | foreach ($list as $id => $item) { |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function GetLearnpathProgress($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id) { |
119 | 119 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
120 | - if($user_id instanceof WSError) { |
|
120 | + if ($user_id instanceof WSError) { |
|
121 | 121 | return $user_id; |
122 | 122 | } |
123 | 123 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
124 | - if($course_id instanceof WSError) { |
|
124 | + if ($course_id instanceof WSError) { |
|
125 | 125 | return $course_id; |
126 | 126 | } else { |
127 | 127 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function GetLearnpathHighestLessonLocation($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id) { |
152 | 152 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
153 | - if($user_id instanceof WSError) { |
|
153 | + if ($user_id instanceof WSError) { |
|
154 | 154 | return $user_id; |
155 | 155 | } |
156 | 156 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
157 | - if($course_id instanceof WSError) { |
|
157 | + if ($course_id instanceof WSError) { |
|
158 | 158 | return $course_id; |
159 | 159 | } else { |
160 | 160 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function GetLearnpathScoreSingleItem($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id, $learnpath_item_id) { |
181 | 181 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
182 | - if($user_id instanceof WSError) { |
|
182 | + if ($user_id instanceof WSError) { |
|
183 | 183 | return $user_id; |
184 | 184 | } |
185 | 185 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
186 | - if($course_id instanceof WSError) { |
|
186 | + if ($course_id instanceof WSError) { |
|
187 | 187 | return $course_id; |
188 | 188 | } else { |
189 | 189 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -213,15 +213,15 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function GetLearnpathStatusSingleItem($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id, $learnpath_item_id) { |
215 | 215 | $verifKey = $this->verifyKey($secret_key); |
216 | - if($verifKey instanceof WSError) { |
|
216 | + if ($verifKey instanceof WSError) { |
|
217 | 217 | $this->handleError($verifKey); |
218 | 218 | } else { |
219 | 219 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
220 | - if($user_id instanceof WSError) { |
|
220 | + if ($user_id instanceof WSError) { |
|
221 | 221 | return $user_id; |
222 | 222 | } |
223 | 223 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
224 | - if($course_id instanceof WSError) { |
|
224 | + if ($course_id instanceof WSError) { |
|
225 | 225 | return $course_id; |
226 | 226 | } else { |
227 | 227 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | if ($debug) { |
83 | - error_log("checkip " . intval($check_ip)); |
|
83 | + error_log("checkip ".intval($check_ip)); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | if ($check_ip) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | '', |
139 | 139 | 'SOAP-ENC:Array', |
140 | 140 | array(), |
141 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:extras[]')), |
|
141 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:extras[]')), |
|
142 | 142 | 'tns:extras' |
143 | 143 | ); |
144 | 144 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | '', |
172 | 172 | 'SOAP-ENC:Array', |
173 | 173 | array(), |
174 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:usersParams[]')), |
|
174 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:usersParams[]')), |
|
175 | 175 | 'tns:usersParams' |
176 | 176 | ); |
177 | 177 | |
@@ -210,17 +210,17 @@ discard block |
||
210 | 210 | '', |
211 | 211 | 'SOAP-ENC:Array', |
212 | 212 | array(), |
213 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:result_createUsers[]')),'tns:result_createUsers' |
|
213 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:result_createUsers[]')), 'tns:result_createUsers' |
|
214 | 214 | ); |
215 | 215 | |
216 | 216 | // Register the method to expose |
217 | -$server->register('WSCreateUsers', // method name |
|
218 | - array('createUsers' => 'tns:createUsers'), // input parameters |
|
219 | - array('return' => 'tns:results_createUsers'), // output parameters |
|
220 | - 'urn:WSRegistration', // namespace |
|
221 | - 'urn:WSRegistration#WSCreateUsers', // soapaction |
|
222 | - 'rpc', // style |
|
223 | - 'encoded', // use |
|
217 | +$server->register('WSCreateUsers', // method name |
|
218 | + array('createUsers' => 'tns:createUsers'), // input parameters |
|
219 | + array('return' => 'tns:results_createUsers'), // output parameters |
|
220 | + 'urn:WSRegistration', // namespace |
|
221 | + 'urn:WSRegistration#WSCreateUsers', // soapaction |
|
222 | + 'rpc', // style |
|
223 | + 'encoded', // use |
|
224 | 224 | 'This service adds a user' // documentation |
225 | 225 | ); |
226 | 226 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | continue; |
402 | 402 | } |
403 | 403 | |
404 | - $results[] = $userId; |
|
404 | + $results[] = $userId; |
|
405 | 405 | |
406 | 406 | } // end principal foreach |
407 | 407 | |
@@ -447,13 +447,13 @@ discard block |
||
447 | 447 | |
448 | 448 | |
449 | 449 | // Register the method to expose |
450 | -$server->register('WSCreateUser', // method name |
|
451 | - array('createUser' => 'tns:createUser'), // input parameters |
|
452 | - array('return' => 'xsd:string'), // output parameters |
|
453 | - 'urn:WSRegistration', // namespace |
|
454 | - 'urn:WSRegistration#WSCreateUser', // soapaction |
|
455 | - 'rpc', // style |
|
456 | - 'encoded', // use |
|
450 | +$server->register('WSCreateUser', // method name |
|
451 | + array('createUser' => 'tns:createUser'), // input parameters |
|
452 | + array('return' => 'xsd:string'), // output parameters |
|
453 | + 'urn:WSRegistration', // namespace |
|
454 | + 'urn:WSRegistration#WSCreateUser', // soapaction |
|
455 | + 'rpc', // style |
|
456 | + 'encoded', // use |
|
457 | 457 | 'This service adds a user' // documentation |
458 | 458 | ); |
459 | 459 | |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | if (isset($original_user_id_name) && isset($original_user_id_value)) { |
561 | - $_SESSION['ws_' . $original_user_id_name] = $original_user_id_value; |
|
561 | + $_SESSION['ws_'.$original_user_id_name] = $original_user_id_value; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | /** @var User $user */ |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | ); |
607 | 607 | |
608 | 608 | if (isset($original_user_id_name) && isset($original_user_id_value)) { |
609 | - unset($_SESSION['ws_' . $original_user_id_name]); |
|
609 | + unset($_SESSION['ws_'.$original_user_id_name]); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
659 | 659 | 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), |
660 | 660 | 'expiration_date' => array('name' => 'expiration_date', 'type' => 'xsd:string'), |
661 | - 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
661 | + 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
662 | 662 | 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
663 | 663 | 'original_user_id_value'=> array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
664 | 664 | 'extra' => array('name' => 'extra', 'type' => 'tns:extrasList') |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | 'all', |
687 | 687 | '', |
688 | 688 | array( |
689 | - 'users' => array('name' => 'users', 'type' => 'tns:createUsersPassEncryptParamsList'), |
|
689 | + 'users' => array('name' => 'users', 'type' => 'tns:createUsersPassEncryptParamsList'), |
|
690 | 690 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
691 | 691 | ) |
692 | 692 | ); |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | ); |
717 | 717 | |
718 | 718 | // Register the method to expose |
719 | -$server->register('WSCreateUsersPasswordCrypted', // method name |
|
719 | +$server->register('WSCreateUsersPasswordCrypted', // method name |
|
720 | 720 | array('createUsersPasswordCrypted' => 'tns:createUsersPasswordCrypted'), // input parameters |
721 | - array('return' => 'tns:results_createUsersPassEncrypt'), // output parameters |
|
722 | - 'urn:WSRegistration', // namespace |
|
723 | - 'urn:WSRegistration#WSCreateUsersPasswordCrypted', // soapaction |
|
724 | - 'rpc', // style |
|
725 | - 'encoded', // use |
|
721 | + array('return' => 'tns:results_createUsersPassEncrypt'), // output parameters |
|
722 | + 'urn:WSRegistration', // namespace |
|
723 | + 'urn:WSRegistration#WSCreateUsersPasswordCrypted', // soapaction |
|
724 | + 'rpc', // style |
|
725 | + 'encoded', // use |
|
726 | 726 | 'This service adds users to the system' // documentation |
727 | 727 | ); |
728 | 728 | |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | $salt = ''; |
770 | 770 | |
771 | 771 | if (!empty($_configuration['password_encryption'])) { |
772 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
772 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
773 | 773 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
774 | 774 | $msg = "Encryption $encrypt_method is invalid"; |
775 | 775 | $results[] = $msg; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | if (is_array($extra_list) && count($extra_list) > 0) { |
794 | 794 | foreach ($extra_list as $extra) { |
795 | - if($extra['field_name'] == 'salt') { |
|
795 | + if ($extra['field_name'] == 'salt') { |
|
796 | 796 | $salt = $extra['field_value']; |
797 | 797 | break; |
798 | 798 | } |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | active='1', |
848 | 848 | hr_dept_id=".intval($hr_dept_id); |
849 | 849 | |
850 | - $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
850 | + $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
851 | 851 | Database::query($sql); |
852 | 852 | |
853 | 853 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | |
968 | 968 | $count_results = count($results); |
969 | 969 | $output = array(); |
970 | - for($i = 0; $i < $count_results; $i++) { |
|
970 | + for ($i = 0; $i < $count_results; $i++) { |
|
971 | 971 | $output[] = array( |
972 | 972 | 'original_user_id_value' => $orig_user_id_value[$i], |
973 | 973 | 'result' => $results[$i], |
@@ -986,9 +986,9 @@ discard block |
||
986 | 986 | 'all', |
987 | 987 | '', |
988 | 988 | array( |
989 | - 'user_id' => array('name' => 'course', 'type' => 'xsd:string'), // Chamilo user Id |
|
990 | - 'session_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Current Session course ID |
|
991 | - 'course_id' =>array('name' => 'courseId', 'type' => 'xsd:string'), // Course Real Id |
|
989 | + 'user_id' => array('name' => 'course', 'type' => 'xsd:string'), // Chamilo user Id |
|
990 | + 'session_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Current Session course ID |
|
991 | + 'course_id' =>array('name' => 'courseId', 'type' => 'xsd:string'), // Course Real Id |
|
992 | 992 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string'), |
993 | 993 | |
994 | 994 | // optional |
@@ -1044,9 +1044,9 @@ discard block |
||
1044 | 1044 | ); |
1045 | 1045 | } |
1046 | 1046 | |
1047 | - if ($debug) error_log('$userId found: '. $userId); |
|
1048 | - if ($debug) error_log('$courseId found: '. $courseId); |
|
1049 | - if ($debug) error_log('$sessionId found: '. $sessionId); |
|
1047 | + if ($debug) error_log('$userId found: '.$userId); |
|
1048 | + if ($debug) error_log('$courseId found: '.$courseId); |
|
1049 | + if ($debug) error_log('$sessionId found: '.$sessionId); |
|
1050 | 1050 | |
1051 | 1051 | return [ |
1052 | 1052 | 'user_id' => $userId, |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | return returnError(WS_ERROR_SECRET_KEY); |
1083 | 1083 | } |
1084 | 1084 | |
1085 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1085 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
1086 | 1086 | |
1087 | 1087 | $params = parseCourseSessionUserParams($params); |
1088 | 1088 | |
@@ -1095,13 +1095,13 @@ discard block |
||
1095 | 1095 | $result = 0; |
1096 | 1096 | |
1097 | 1097 | if (!empty($coaches)) { |
1098 | - if ($debug) error_log('Coaches: '. print_r($coaches, 1)); |
|
1098 | + if ($debug) error_log('Coaches: '.print_r($coaches, 1)); |
|
1099 | 1099 | if (in_array($userId, $coaches)) { |
1100 | 1100 | $result = 1; |
1101 | 1101 | } |
1102 | 1102 | } |
1103 | 1103 | |
1104 | - if ($debug) error_log('Result: '. $result); |
|
1104 | + if ($debug) error_log('Result: '.$result); |
|
1105 | 1105 | |
1106 | 1106 | return $result; |
1107 | 1107 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | return returnError(WS_ERROR_SECRET_KEY); |
1134 | 1134 | } |
1135 | 1135 | |
1136 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1136 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
1137 | 1137 | |
1138 | 1138 | $params = parseCourseSessionUserParams($params); |
1139 | 1139 | |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | $result = 0; |
1148 | 1148 | |
1149 | 1149 | if (!empty($coaches)) { |
1150 | - if ($debug) error_log('Coaches: ' . print_r($coaches, 1)); |
|
1150 | + if ($debug) error_log('Coaches: '.print_r($coaches, 1)); |
|
1151 | 1151 | if (!in_array($userId, $coaches)) { |
1152 | 1152 | $result = 1; |
1153 | 1153 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $result = 1; |
1156 | 1156 | } |
1157 | 1157 | |
1158 | - if ($debug) error_log('Final Result: '. $result); |
|
1158 | + if ($debug) error_log('Final Result: '.$result); |
|
1159 | 1159 | |
1160 | 1160 | return $result; |
1161 | 1161 | } |
@@ -1173,32 +1173,32 @@ discard block |
||
1173 | 1173 | 'all', |
1174 | 1174 | '', |
1175 | 1175 | array( |
1176 | - 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
1177 | - 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
1178 | - 'status' => array('name' => 'status', 'type' => 'xsd:string'), |
|
1179 | - 'email' => array('name' => 'email', 'type' => 'xsd:string'), |
|
1180 | - 'loginname' => array('name' => 'loginname', 'type' => 'xsd:string'), |
|
1181 | - 'password' => array('name' => 'password', 'type' => 'xsd:string'), //encripted password using the encrypt_method |
|
1182 | - 'encrypt_method' => array('name' => 'encrypt_method', 'type' => 'xsd:string'), |
|
1183 | - 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
1184 | - 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), |
|
1185 | - 'expiration_date' => array('name' => 'expiration_date', 'type' => 'xsd:string'), |
|
1186 | - 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
1187 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
1188 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
1189 | - 'extra' => array('name' => 'extra', 'type' => 'tns:extrasList'), |
|
1190 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
1176 | + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
1177 | + 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
1178 | + 'status' => array('name' => 'status', 'type' => 'xsd:string'), |
|
1179 | + 'email' => array('name' => 'email', 'type' => 'xsd:string'), |
|
1180 | + 'loginname' => array('name' => 'loginname', 'type' => 'xsd:string'), |
|
1181 | + 'password' => array('name' => 'password', 'type' => 'xsd:string'), //encripted password using the encrypt_method |
|
1182 | + 'encrypt_method' => array('name' => 'encrypt_method', 'type' => 'xsd:string'), |
|
1183 | + 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
1184 | + 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), |
|
1185 | + 'expiration_date' => array('name' => 'expiration_date', 'type' => 'xsd:string'), |
|
1186 | + 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
1187 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
1188 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
1189 | + 'extra' => array('name' => 'extra', 'type' => 'tns:extrasList'), |
|
1190 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
1191 | 1191 | ) |
1192 | 1192 | ); |
1193 | 1193 | |
1194 | 1194 | // Register the method to expose |
1195 | -$server->register('WSCreateUserPasswordCrypted', // method name |
|
1196 | - array('createUserPasswordCrypted' => 'tns:createUserPasswordCrypted'), // input parameters |
|
1197 | - array('return' => 'xsd:string'), // output parameters |
|
1198 | - 'urn:WSRegistration', // namespace |
|
1199 | - 'urn:WSRegistration#WSCreateUserPasswordCrypted', // soapaction |
|
1200 | - 'rpc', // style |
|
1201 | - 'encoded', // use |
|
1195 | +$server->register('WSCreateUserPasswordCrypted', // method name |
|
1196 | + array('createUserPasswordCrypted' => 'tns:createUserPasswordCrypted'), // input parameters |
|
1197 | + array('return' => 'xsd:string'), // output parameters |
|
1198 | + 'urn:WSRegistration', // namespace |
|
1199 | + 'urn:WSRegistration#WSCreateUserPasswordCrypted', // soapaction |
|
1200 | + 'rpc', // style |
|
1201 | + 'encoded', // use |
|
1202 | 1202 | 'This service adds users' // documentation |
1203 | 1203 | ); |
1204 | 1204 | |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | global $_user, $_configuration, $debug; |
1209 | 1209 | $debug = 1; |
1210 | 1210 | if ($debug) error_log('WSCreateUserPasswordCrypted'); |
1211 | - if ($debug) error_log(print_r($params,1)); |
|
1211 | + if ($debug) error_log(print_r($params, 1)); |
|
1212 | 1212 | |
1213 | 1213 | if (!WSHelperVerifyKey($params)) { |
1214 | 1214 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | $extra_list = isset($params['extra']) ? $params['extra'] : ''; |
1242 | 1242 | |
1243 | 1243 | if (!empty($_configuration['password_encryption'])) { |
1244 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
1244 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
1245 | 1245 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
1246 | 1246 | $msg = "Encryption $encrypt_method is invalid"; |
1247 | 1247 | if ($debug) error_log($msg); |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | if (!is_null($auth_source)) { |
1304 | 1304 | $sql .= " auth_source='".Database::escape_string($auth_source)."',"; |
1305 | 1305 | } |
1306 | - $sql .= " |
|
1306 | + $sql .= " |
|
1307 | 1307 | password='".Database::escape_string($password)."', |
1308 | 1308 | email='".Database::escape_string($email)."', |
1309 | 1309 | status='".Database::escape_string($status)."', |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | expiration_date='".Database::escape_string($expiration_date)."', |
1313 | 1313 | active='1', |
1314 | 1314 | hr_dept_id=".intval($hr_dept_id); |
1315 | - $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
1315 | + $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
1316 | 1316 | if ($debug) error_log($sql); |
1317 | 1317 | Database::query($sql); |
1318 | 1318 | |
@@ -1492,13 +1492,13 @@ discard block |
||
1492 | 1492 | ); |
1493 | 1493 | |
1494 | 1494 | // Register the method to expose |
1495 | -$server->register('WSEditUserCredentials', // method name |
|
1496 | - array('editUserCredentials' => 'tns:editUserCredentials'), // input parameters |
|
1497 | - array('return' => 'xsd:string'), // output parameters |
|
1498 | - 'urn:WSRegistration', // namespace |
|
1499 | - 'urn:WSRegistration#WSEditUserCredentials', // soapaction |
|
1500 | - 'rpc', // style |
|
1501 | - 'encoded', // use |
|
1495 | +$server->register('WSEditUserCredentials', // method name |
|
1496 | + array('editUserCredentials' => 'tns:editUserCredentials'), // input parameters |
|
1497 | + array('return' => 'xsd:string'), // output parameters |
|
1498 | + 'urn:WSRegistration', // namespace |
|
1499 | + 'urn:WSRegistration#WSEditUserCredentials', // soapaction |
|
1500 | + 'rpc', // style |
|
1501 | + 'encoded', // use |
|
1502 | 1502 | 'This service edits the username and password of a user' // documentation |
1503 | 1503 | ); |
1504 | 1504 | |
@@ -1597,13 +1597,13 @@ discard block |
||
1597 | 1597 | ); |
1598 | 1598 | |
1599 | 1599 | // Register the method to expose |
1600 | -$server->register('WSEditUsers', // method name |
|
1601 | - array('editUsers' => 'tns:editUsers'), // input parameters |
|
1600 | +$server->register('WSEditUsers', // method name |
|
1601 | + array('editUsers' => 'tns:editUsers'), // input parameters |
|
1602 | 1602 | array('return' => 'tns:results_editUsers'), // output parameters |
1603 | - 'urn:WSRegistration', // namespace |
|
1604 | - 'urn:WSRegistration#WSEditUsers', // soapaction |
|
1605 | - 'rpc', // style |
|
1606 | - 'encoded', // use |
|
1603 | + 'urn:WSRegistration', // namespace |
|
1604 | + 'urn:WSRegistration#WSEditUsers', // soapaction |
|
1605 | + 'rpc', // style |
|
1606 | + 'encoded', // use |
|
1607 | 1607 | 'This service edits a user from wiener' // documentation |
1608 | 1608 | ); |
1609 | 1609 | |
@@ -1795,13 +1795,13 @@ discard block |
||
1795 | 1795 | ); |
1796 | 1796 | |
1797 | 1797 | // Register the method to expose |
1798 | -$server->register('WSEditUser', // method name |
|
1799 | - array('editUser' => 'tns:editUser'), // input parameters |
|
1800 | - array('return' => 'xsd:string'), // output parameters |
|
1801 | - 'urn:WSRegistration', // namespace |
|
1802 | - 'urn:WSRegistration#WSEditUser', // soapaction |
|
1803 | - 'rpc', // style |
|
1804 | - 'encoded', // use |
|
1798 | +$server->register('WSEditUser', // method name |
|
1799 | + array('editUser' => 'tns:editUser'), // input parameters |
|
1800 | + array('return' => 'xsd:string'), // output parameters |
|
1801 | + 'urn:WSRegistration', // namespace |
|
1802 | + 'urn:WSRegistration#WSEditUser', // soapaction |
|
1803 | + 'rpc', // style |
|
1804 | + 'encoded', // use |
|
1805 | 1805 | 'This service edits a user from wiener' // documentation |
1806 | 1806 | ); |
1807 | 1807 | |
@@ -1972,13 +1972,13 @@ discard block |
||
1972 | 1972 | ); |
1973 | 1973 | |
1974 | 1974 | // Register the method to expose |
1975 | -$server->register('WSEditUserWithPicture', // method name |
|
1976 | - array('editUserWithPicture' => 'tns:editUserWithPicture'), // input parameters |
|
1977 | - array('return' => 'xsd:string'), // output parameters |
|
1978 | - 'urn:WSRegistration', // namespace |
|
1979 | - 'urn:WSRegistration#WSEditUserWithPicture', // soapaction |
|
1980 | - 'rpc', // style |
|
1981 | - 'encoded', // use |
|
1975 | +$server->register('WSEditUserWithPicture', // method name |
|
1976 | + array('editUserWithPicture' => 'tns:editUserWithPicture'), // input parameters |
|
1977 | + array('return' => 'xsd:string'), // output parameters |
|
1978 | + 'urn:WSRegistration', // namespace |
|
1979 | + 'urn:WSRegistration#WSEditUserWithPicture', // soapaction |
|
1980 | + 'rpc', // style |
|
1981 | + 'encoded', // use |
|
1982 | 1982 | 'This service edits a user from wiener' // documentation |
1983 | 1983 | ); |
1984 | 1984 | |
@@ -2036,8 +2036,8 @@ discard block |
||
2036 | 2036 | $tempDir = api_get_path(SYS_ARCHIVE_PATH); |
2037 | 2037 | // Make sure the file download was OK by checking the HTTP headers for OK |
2038 | 2038 | if (strpos(get_headers($picture_url)[0], "OK")) { |
2039 | - file_put_contents($tempDir . $filename, file_get_contents($picture_url)); |
|
2040 | - $pictureUri = UserManager::update_user_picture($user_id, $filename, $tempDir . $filename); |
|
2039 | + file_put_contents($tempDir.$filename, file_get_contents($picture_url)); |
|
2040 | + $pictureUri = UserManager::update_user_picture($user_id, $filename, $tempDir.$filename); |
|
2041 | 2041 | } |
2042 | 2042 | |
2043 | 2043 | if ($user_id == 0) { |
@@ -2108,7 +2108,7 @@ discard block |
||
2108 | 2108 | ->setExpirationDate($expiration_date) |
2109 | 2109 | ->setHrDeptId($hr_dept_id) |
2110 | 2110 | ->setActive(true) |
2111 | - ->setPictureUri($pictureUri);; |
|
2111 | + ->setPictureUri($pictureUri); ; |
|
2112 | 2112 | |
2113 | 2113 | if (!is_null($creator_id)) { |
2114 | 2114 | $user->setCreatorId($creator_id); |
@@ -2205,13 +2205,13 @@ discard block |
||
2205 | 2205 | ); |
2206 | 2206 | |
2207 | 2207 | // Register the method to expose |
2208 | -$server->register('WSEditUsersPasswordCrypted', // method name |
|
2209 | - array('editUsersPasswordCrypted' => 'tns:editUsersPasswordCrypted'), // input parameters |
|
2210 | - array('return' => 'tns:results_editUsersPasswordCrypted'), // output parameters |
|
2211 | - 'urn:WSRegistration', // namespace |
|
2212 | - 'urn:WSRegistration#WSEditUsersPasswordCrypted', // soapaction |
|
2213 | - 'rpc', // style |
|
2214 | - 'encoded', // use |
|
2208 | +$server->register('WSEditUsersPasswordCrypted', // method name |
|
2209 | + array('editUsersPasswordCrypted' => 'tns:editUsersPasswordCrypted'), // input parameters |
|
2210 | + array('return' => 'tns:results_editUsersPasswordCrypted'), // output parameters |
|
2211 | + 'urn:WSRegistration', // namespace |
|
2212 | + 'urn:WSRegistration#WSEditUsersPasswordCrypted', // soapaction |
|
2213 | + 'rpc', // style |
|
2214 | + 'encoded', // use |
|
2215 | 2215 | 'This service edits a user' // documentation |
2216 | 2216 | ); |
2217 | 2217 | |
@@ -2219,7 +2219,7 @@ discard block |
||
2219 | 2219 | function WSEditUsersPasswordCrypted($params) { |
2220 | 2220 | global $_configuration; |
2221 | 2221 | |
2222 | - if(!WSHelperVerifyKey($params)) { |
|
2222 | + if (!WSHelperVerifyKey($params)) { |
|
2223 | 2223 | return returnError(WS_ERROR_SECRET_KEY); |
2224 | 2224 | } |
2225 | 2225 | |
@@ -2256,7 +2256,7 @@ discard block |
||
2256 | 2256 | |
2257 | 2257 | $password = $user_param['password']; |
2258 | 2258 | $encrypt_method = $user_param['encrypt_method']; |
2259 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
2259 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
2260 | 2260 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
2261 | 2261 | $msg = "Encryption $encrypt_method is invalid"; |
2262 | 2262 | $results[] = $msg; |
@@ -2271,11 +2271,11 @@ discard block |
||
2271 | 2271 | $results[] = $msg; |
2272 | 2272 | continue; |
2273 | 2273 | } |
2274 | - } elseif (!empty($user_param['password']) && empty($user_param['encrypt_method'])){ |
|
2274 | + } elseif (!empty($user_param['password']) && empty($user_param['encrypt_method'])) { |
|
2275 | 2275 | $msg = "If password is not empty the encrypt_method param is required "; |
2276 | 2276 | $results[] = $msg; |
2277 | 2277 | continue; |
2278 | - } elseif (empty($user_param['password']) && !empty($user_param['encrypt_method'])){ |
|
2278 | + } elseif (empty($user_param['password']) && !empty($user_param['encrypt_method'])) { |
|
2279 | 2279 | $msg = "If encrypt_method is not empty the password param is required "; |
2280 | 2280 | $results[] = $msg; |
2281 | 2281 | continue; |
@@ -2411,13 +2411,13 @@ discard block |
||
2411 | 2411 | ); |
2412 | 2412 | |
2413 | 2413 | // Register the method to expose |
2414 | -$server->register('WSEditUserPasswordCrypted', // method name |
|
2414 | +$server->register('WSEditUserPasswordCrypted', // method name |
|
2415 | 2415 | array('editUserPasswordCrypted' => 'tns:editUserPasswordCrypted'), // input parameters |
2416 | - array('return' => 'xsd:string'), // output parameters |
|
2417 | - 'urn:WSRegistration', // namespace |
|
2418 | - 'urn:WSRegistration#WSEditUserPasswordCrypted', // soapaction |
|
2419 | - 'rpc', // style |
|
2420 | - 'encoded', // use |
|
2416 | + array('return' => 'xsd:string'), // output parameters |
|
2417 | + 'urn:WSRegistration', // namespace |
|
2418 | + 'urn:WSRegistration#WSEditUserPasswordCrypted', // soapaction |
|
2419 | + 'rpc', // style |
|
2420 | + 'encoded', // use |
|
2421 | 2421 | 'This service edits a user' // documentation |
2422 | 2422 | ); |
2423 | 2423 | |
@@ -2461,7 +2461,7 @@ discard block |
||
2461 | 2461 | if (!empty($params['password']) && !empty($params['encrypt_method'])) { |
2462 | 2462 | $password = $params['password']; |
2463 | 2463 | $encrypt_method = $params['encrypt_method']; |
2464 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
2464 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
2465 | 2465 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
2466 | 2466 | $msg = "Encryption $encrypt_method is invalid"; |
2467 | 2467 | return $msg; |
@@ -2602,7 +2602,7 @@ discard block |
||
2602 | 2602 | '', |
2603 | 2603 | 'SOAP-ENC:Array', |
2604 | 2604 | array(), |
2605 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:user_id[]')),'tns:user_id' |
|
2605 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:user_id[]')), 'tns:user_id' |
|
2606 | 2606 | ); |
2607 | 2607 | |
2608 | 2608 | $server->wsdl->addComplexType( |
@@ -2618,35 +2618,35 @@ discard block |
||
2618 | 2618 | ); |
2619 | 2619 | |
2620 | 2620 | function WSHelperActionOnUsers($params, $type) { |
2621 | - if(!WSHelperVerifyKey($params)) { |
|
2621 | + if (!WSHelperVerifyKey($params)) { |
|
2622 | 2622 | return returnError(WS_ERROR_SECRET_KEY); |
2623 | 2623 | } |
2624 | 2624 | |
2625 | 2625 | $original_user_ids = $params['ids']; |
2626 | - foreach($original_user_ids as $original_user_id) { |
|
2626 | + foreach ($original_user_ids as $original_user_id) { |
|
2627 | 2627 | $user_id = UserManager::get_user_id_from_original_id( |
2628 | 2628 | $original_user_id['original_user_id_value'], |
2629 | 2629 | $original_user_id['original_user_id_name'] |
2630 | 2630 | ); |
2631 | - if($user_id > 0) { |
|
2632 | - if($type == "delete") { |
|
2631 | + if ($user_id > 0) { |
|
2632 | + if ($type == "delete") { |
|
2633 | 2633 | UserManager::delete_user($user_id); |
2634 | - } else if($type == "disable") { |
|
2634 | + } else if ($type == "disable") { |
|
2635 | 2635 | UserManager::disable($user_id); |
2636 | - } else if($type == "enable") { |
|
2636 | + } else if ($type == "enable") { |
|
2637 | 2637 | UserManager::enable($user_id); |
2638 | 2638 | } |
2639 | 2639 | } |
2640 | 2640 | } |
2641 | 2641 | } |
2642 | 2642 | |
2643 | -$server->register('WSDeleteUsers', // method name |
|
2644 | - array('user_ids' => 'tns:user_ids'), // input parameters |
|
2645 | - array(), // output parameters |
|
2646 | - 'urn:WSRegistration', // namespace |
|
2647 | - 'urn:WSRegistration#WSDeleteUsers', // soapaction |
|
2648 | - 'rpc', // style |
|
2649 | - 'encoded', // use |
|
2643 | +$server->register('WSDeleteUsers', // method name |
|
2644 | + array('user_ids' => 'tns:user_ids'), // input parameters |
|
2645 | + array(), // output parameters |
|
2646 | + 'urn:WSRegistration', // namespace |
|
2647 | + 'urn:WSRegistration#WSDeleteUsers', // soapaction |
|
2648 | + 'rpc', // style |
|
2649 | + 'encoded', // use |
|
2650 | 2650 | 'Deletes users provided as parameters from the system' // documentation |
2651 | 2651 | ); |
2652 | 2652 | |
@@ -2655,13 +2655,13 @@ discard block |
||
2655 | 2655 | } |
2656 | 2656 | |
2657 | 2657 | /** WSDisableUsers **/ |
2658 | -$server->register('WSDisableUsers', // method name |
|
2659 | - array('user_ids' => 'tns:user_ids'), // input parameters |
|
2660 | - array(), // output parameters |
|
2661 | - 'urn:WSRegistration', // namespace |
|
2662 | - 'urn:WSRegistration#WSDisableUsers', // soapaction |
|
2663 | - 'rpc', // style |
|
2664 | - 'encoded', // use |
|
2658 | +$server->register('WSDisableUsers', // method name |
|
2659 | + array('user_ids' => 'tns:user_ids'), // input parameters |
|
2660 | + array(), // output parameters |
|
2661 | + 'urn:WSRegistration', // namespace |
|
2662 | + 'urn:WSRegistration#WSDisableUsers', // soapaction |
|
2663 | + 'rpc', // style |
|
2664 | + 'encoded', // use |
|
2665 | 2665 | 'Disables users provided as parameters from the system' // documentation |
2666 | 2666 | ); |
2667 | 2667 | |
@@ -2670,13 +2670,13 @@ discard block |
||
2670 | 2670 | } |
2671 | 2671 | |
2672 | 2672 | /** WSEnableUsers **/ |
2673 | -$server->register('WSEnableUsers', // method name |
|
2674 | - array('user_ids' => 'tns:user_ids'), // input parameters |
|
2675 | - array(), // output parameters |
|
2676 | - 'urn:WSRegistration', // namespace |
|
2677 | - 'urn:WSRegistration#WSEnableUsers', // soapaction |
|
2678 | - 'rpc', // style |
|
2679 | - 'encoded', // use |
|
2673 | +$server->register('WSEnableUsers', // method name |
|
2674 | + array('user_ids' => 'tns:user_ids'), // input parameters |
|
2675 | + array(), // output parameters |
|
2676 | + 'urn:WSRegistration', // namespace |
|
2677 | + 'urn:WSRegistration#WSEnableUsers', // soapaction |
|
2678 | + 'rpc', // style |
|
2679 | + 'encoded', // use |
|
2680 | 2680 | 'Enables users provided as parameters' // documentation |
2681 | 2681 | ); |
2682 | 2682 | |
@@ -2726,7 +2726,7 @@ discard block |
||
2726 | 2726 | '', |
2727 | 2727 | 'SOAP-ENC:Array', |
2728 | 2728 | array(), |
2729 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:createCourseParams[]')),'tns:createCourseParams' |
|
2729 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:createCourseParams[]')), 'tns:createCourseParams' |
|
2730 | 2730 | ); |
2731 | 2731 | |
2732 | 2732 | // Register the data structures used by the service |
@@ -2767,13 +2767,13 @@ discard block |
||
2767 | 2767 | ); |
2768 | 2768 | |
2769 | 2769 | // Register the method to expose |
2770 | -$server->register('WSCreateCourse', // method name |
|
2771 | - array('createCourse' => 'tns:createCourse'), // input parameters |
|
2770 | +$server->register('WSCreateCourse', // method name |
|
2771 | + array('createCourse' => 'tns:createCourse'), // input parameters |
|
2772 | 2772 | array('return' => 'tns:results_createCourse'), // output parameters |
2773 | - 'urn:WSRegistration', // namespace |
|
2774 | - 'urn:WSRegistration#WSCreateCourse', // soapaction |
|
2775 | - 'rpc', // style |
|
2776 | - 'encoded', // use |
|
2773 | + 'urn:WSRegistration', // namespace |
|
2774 | + 'urn:WSRegistration#WSCreateCourse', // soapaction |
|
2775 | + 'rpc', // style |
|
2776 | + 'encoded', // use |
|
2777 | 2777 | 'This service adds a course' // documentation |
2778 | 2778 | ); |
2779 | 2779 | |
@@ -2829,7 +2829,7 @@ discard block |
||
2829 | 2829 | category_code='".Database::escape_string($category_code)."', |
2830 | 2830 | tutor_name='".Database::escape_string($tutor_name)."', |
2831 | 2831 | visual_code='".Database::escape_string($wanted_code)."'"; |
2832 | - if($visibility !== null) { |
|
2832 | + if ($visibility !== null) { |
|
2833 | 2833 | $sql .= ", visibility = '$visibility' "; |
2834 | 2834 | } |
2835 | 2835 | $sql .= " WHERE id='".$courseInfo['real_id']."'"; |
@@ -2879,7 +2879,7 @@ discard block |
||
2879 | 2879 | $params['title'] = $title; |
2880 | 2880 | $params['wanted_code'] = $wanted_code; |
2881 | 2881 | $params['category_code'] = $category_code; |
2882 | - $params['course_category'] = $category_code; |
|
2882 | + $params['course_category'] = $category_code; |
|
2883 | 2883 | $params['tutor_name'] = $tutor_name; |
2884 | 2884 | $params['course_language'] = $course_language; |
2885 | 2885 | $params['user_id'] = api_get_user_id(); |
@@ -3010,13 +3010,13 @@ discard block |
||
3010 | 3010 | |
3011 | 3011 | |
3012 | 3012 | // Register the method to expose |
3013 | -$server->register('WSCreateCourseByTitle', // method name |
|
3013 | +$server->register('WSCreateCourseByTitle', // method name |
|
3014 | 3014 | array('createCourseByTitle' => 'tns:createCourseByTitle'), // input parameters |
3015 | - array('return' => 'tns:results_createCourseByTitle'), // output parameters |
|
3016 | - 'urn:WSRegistration', // namespace |
|
3017 | - 'urn:WSRegistration#WSCreateCourseByTitle', // soapaction |
|
3018 | - 'rpc', // style |
|
3019 | - 'encoded', // use |
|
3015 | + array('return' => 'tns:results_createCourseByTitle'), // output parameters |
|
3016 | + 'urn:WSRegistration', // namespace |
|
3017 | + 'urn:WSRegistration#WSCreateCourseByTitle', // soapaction |
|
3018 | + 'rpc', // style |
|
3019 | + 'encoded', // use |
|
3020 | 3020 | 'This service adds a course by title' // documentation |
3021 | 3021 | ); |
3022 | 3022 | |
@@ -3247,18 +3247,18 @@ discard block |
||
3247 | 3247 | ); |
3248 | 3248 | |
3249 | 3249 | // Register the method to expose |
3250 | -$server->register('WSEditCourse', // method name |
|
3251 | - array('editCourse' => 'tns:editCourse'), // input parameters |
|
3250 | +$server->register('WSEditCourse', // method name |
|
3251 | + array('editCourse' => 'tns:editCourse'), // input parameters |
|
3252 | 3252 | array('return' => 'tns:results_editCourse'), // output parameters |
3253 | - 'urn:WSRegistration', // namespace |
|
3254 | - 'urn:WSRegistration#WSEditCourse', // soapaction |
|
3255 | - 'rpc', // style |
|
3256 | - 'encoded', // use |
|
3253 | + 'urn:WSRegistration', // namespace |
|
3254 | + 'urn:WSRegistration#WSEditCourse', // soapaction |
|
3255 | + 'rpc', // style |
|
3256 | + 'encoded', // use |
|
3257 | 3257 | 'This service edits a course' // documentation |
3258 | 3258 | ); |
3259 | 3259 | |
3260 | 3260 | // Define the method WSEditCourse |
3261 | -function WSEditCourse($params){ |
|
3261 | +function WSEditCourse($params) { |
|
3262 | 3262 | |
3263 | 3263 | global $_configuration; |
3264 | 3264 | if (!WSHelperVerifyKey($params)) { |
@@ -3413,13 +3413,13 @@ discard block |
||
3413 | 3413 | |
3414 | 3414 | |
3415 | 3415 | // Register the method to expose |
3416 | -$server->register('WSCourseDescription', // method name |
|
3417 | - array('courseDescription' => 'tns:courseDescription'), // input parameters |
|
3418 | - array('return' => 'tns:fields_course_desc_list'), // output parameters |
|
3419 | - 'urn:WSRegistration', // namespace |
|
3420 | - 'urn:WSRegistration#WSCourseDescription', // soapaction |
|
3421 | - 'rpc', // style |
|
3422 | - 'encoded', // use |
|
3416 | +$server->register('WSCourseDescription', // method name |
|
3417 | + array('courseDescription' => 'tns:courseDescription'), // input parameters |
|
3418 | + array('return' => 'tns:fields_course_desc_list'), // output parameters |
|
3419 | + 'urn:WSRegistration', // namespace |
|
3420 | + 'urn:WSRegistration#WSCourseDescription', // soapaction |
|
3421 | + 'rpc', // style |
|
3422 | + 'encoded', // use |
|
3423 | 3423 | 'This service edits a course description' // documentation |
3424 | 3424 | ); |
3425 | 3425 | |
@@ -3472,14 +3472,14 @@ discard block |
||
3472 | 3472 | } |
3473 | 3473 | |
3474 | 3474 | while ($row = Database::fetch_array($result)) { |
3475 | - $ind = (int)$row['id']; |
|
3475 | + $ind = (int) $row['id']; |
|
3476 | 3476 | $array_course_desc_title[$ind] = $row['title']; |
3477 | 3477 | $array_course_desc_content[$ind] = $row['content']; |
3478 | 3478 | } |
3479 | 3479 | |
3480 | 3480 | $count_results = count($default_titles); |
3481 | 3481 | $output = array(); |
3482 | - for($i = 1; $i <= $count_results; $i++) { |
|
3482 | + for ($i = 1; $i <= $count_results; $i++) { |
|
3483 | 3483 | $output[] = array( |
3484 | 3484 | 'course_desc_id' => $array_course_desc_id[$i], |
3485 | 3485 | 'course_desc_default_title' => $array_course_desc_default_title[$i], |
@@ -3559,13 +3559,13 @@ discard block |
||
3559 | 3559 | |
3560 | 3560 | |
3561 | 3561 | // Register the method to expose |
3562 | -$server->register('WSEditCourseDescription', // method name |
|
3562 | +$server->register('WSEditCourseDescription', // method name |
|
3563 | 3563 | array('editCourseDescription' => 'tns:editCourseDescription'), // input parameters |
3564 | - array('return' => 'tns:results_editCourseDescription'), // output parameters |
|
3565 | - 'urn:WSRegistration', // namespace |
|
3566 | - 'urn:WSRegistration#WSEditCourseDescription', // soapaction |
|
3567 | - 'rpc', // style |
|
3568 | - 'encoded', // use |
|
3564 | + array('return' => 'tns:results_editCourseDescription'), // output parameters |
|
3565 | + 'urn:WSRegistration', // namespace |
|
3566 | + 'urn:WSRegistration#WSEditCourseDescription', // soapaction |
|
3567 | + 'rpc', // style |
|
3568 | + 'encoded', // use |
|
3569 | 3569 | 'This service edits a course description' // documentation |
3570 | 3570 | ); |
3571 | 3571 | |
@@ -3609,7 +3609,7 @@ discard block |
||
3609 | 3609 | $course_desc_title = Database::escape_string($course_desc_title); |
3610 | 3610 | $course_desc_content = Database::escape_string($course_desc_content); |
3611 | 3611 | |
3612 | - $course_desc_id = (int)$course_desc_id; |
|
3612 | + $course_desc_id = (int) $course_desc_id; |
|
3613 | 3613 | if ($course_desc_id > 8 && $course_desc_id < 1) { |
3614 | 3614 | $results[] = 0; // course_desc_id invalid. |
3615 | 3615 | continue; |
@@ -3643,7 +3643,7 @@ discard block |
||
3643 | 3643 | |
3644 | 3644 | $count_results = count($results); |
3645 | 3645 | $output = array(); |
3646 | - for($i = 0; $i < $count_results; $i++) { |
|
3646 | + for ($i = 0; $i < $count_results; $i++) { |
|
3647 | 3647 | $output[] = array( |
3648 | 3648 | 'original_course_id_value' => $orig_course_id_value[$i], |
3649 | 3649 | 'result' => $results[$i], |
@@ -3715,13 +3715,13 @@ discard block |
||
3715 | 3715 | 'tns:result_deleteCourse' |
3716 | 3716 | ); |
3717 | 3717 | |
3718 | -$server->register('WSDeleteCourse', // method name |
|
3719 | - array('deleteCourse' => 'tns:deleteCourse'), // input parameters |
|
3718 | +$server->register('WSDeleteCourse', // method name |
|
3719 | + array('deleteCourse' => 'tns:deleteCourse'), // input parameters |
|
3720 | 3720 | array('return' => 'tns:results_deleteCourse'), // output parameters |
3721 | - 'urn:WSRegistration', // namespace |
|
3722 | - 'urn:WSRegistration#WSDeleteCourse', // soapaction |
|
3723 | - 'rpc', // style |
|
3724 | - 'encoded', // use |
|
3721 | + 'urn:WSRegistration', // namespace |
|
3722 | + 'urn:WSRegistration#WSDeleteCourse', // soapaction |
|
3723 | + 'rpc', // style |
|
3724 | + 'encoded', // use |
|
3725 | 3725 | 'This service deletes a course ' // documentation |
3726 | 3726 | ); |
3727 | 3727 | |
@@ -3847,13 +3847,13 @@ discard block |
||
3847 | 3847 | ); |
3848 | 3848 | |
3849 | 3849 | // Register the method to expose |
3850 | -$server->register('WSCreateSession', // method name |
|
3851 | - array('createSession' => 'tns:createSession'), // input parameters |
|
3850 | +$server->register('WSCreateSession', // method name |
|
3851 | + array('createSession' => 'tns:createSession'), // input parameters |
|
3852 | 3852 | array('return' => 'tns:results_createSession'), // output parameters |
3853 | - 'urn:WSRegistration', // namespace |
|
3854 | - 'urn:WSRegistration#WSCreateSession', // soapaction |
|
3855 | - 'rpc', // style |
|
3856 | - 'encoded', // use |
|
3853 | + 'urn:WSRegistration', // namespace |
|
3854 | + 'urn:WSRegistration#WSCreateSession', // soapaction |
|
3855 | + 'rpc', // style |
|
3856 | + 'encoded', // use |
|
3857 | 3857 | 'This service edits a session' // documentation |
3858 | 3858 | ); |
3859 | 3859 | |
@@ -3907,8 +3907,8 @@ discard block |
||
3907 | 3907 | } |
3908 | 3908 | |
3909 | 3909 | if (empty($nolimit)) { |
3910 | - $date_start = "$year_start-".(($month_start < 10)?"0$month_start":$month_start)."-".(($day_start < 10)?"0$day_start":$day_start) . ' 00:00:00'; |
|
3911 | - $date_end = "$year_end-".(($month_end < 10)?"0$month_end":$month_end)."-".(($day_end < 10)?"0$day_end":$day_end) . ' 23:59:59'; |
|
3910 | + $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start).' 00:00:00'; |
|
3911 | + $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end).' 23:59:59'; |
|
3912 | 3912 | } else { |
3913 | 3913 | $date_start = ""; |
3914 | 3914 | $date_end = ""; |
@@ -3926,7 +3926,7 @@ discard block |
||
3926 | 3926 | } |
3927 | 3927 | $results[] = 0; |
3928 | 3928 | continue; |
3929 | - } elseif (empty($nolimit) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end, $day_end, $year_end))) { |
|
3929 | + } elseif (empty($nolimit) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end, $day_end, $year_end))) { |
|
3930 | 3930 | $results[] = 0; |
3931 | 3931 | if ($debug) { |
3932 | 3932 | error_log("There's an error with the end date: $month_end - $day_end - $year_end"); |
@@ -4029,7 +4029,7 @@ discard block |
||
4029 | 4029 | |
4030 | 4030 | $count_results = count($results); |
4031 | 4031 | $output = array(); |
4032 | - for($i = 0; $i < $count_results; $i++) { |
|
4032 | + for ($i = 0; $i < $count_results; $i++) { |
|
4033 | 4033 | $output[] = array( |
4034 | 4034 | 'original_session_id_value' => $orig_session_id_value[$i], |
4035 | 4035 | 'result' => $results[$i], |
@@ -4114,13 +4114,13 @@ discard block |
||
4114 | 4114 | |
4115 | 4115 | |
4116 | 4116 | // Register the method to expose |
4117 | -$server->register('WSEditSession', // method name |
|
4118 | - array('editSession' => 'tns:editSession'), // input parameters |
|
4117 | +$server->register('WSEditSession', // method name |
|
4118 | + array('editSession' => 'tns:editSession'), // input parameters |
|
4119 | 4119 | array('return' => 'tns:results_editSession'), // output parameters |
4120 | - 'urn:WSRegistration', // namespace |
|
4121 | - 'urn:WSRegistration#WSEditSession', // soapaction |
|
4122 | - 'rpc', // style |
|
4123 | - 'encoded', // use |
|
4120 | + 'urn:WSRegistration', // namespace |
|
4121 | + 'urn:WSRegistration#WSEditSession', // soapaction |
|
4122 | + 'rpc', // style |
|
4123 | + 'encoded', // use |
|
4124 | 4124 | 'This service edits a session' // documentation |
4125 | 4125 | ); |
4126 | 4126 | |
@@ -4170,11 +4170,11 @@ discard block |
||
4170 | 4170 | } |
4171 | 4171 | |
4172 | 4172 | if (empty($nolimit)) { |
4173 | - $date_start="$year_start-".(($month_start < 10)?"0$month_start":$month_start)."-".(($day_start < 10)?"0$day_start":$day_start); |
|
4174 | - $date_end="$year_end-".(($month_end < 10)?"0$month_end":$month_end)."-".(($day_end < 10)?"0$day_end":$day_end); |
|
4173 | + $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start); |
|
4174 | + $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end); |
|
4175 | 4175 | } else { |
4176 | - $date_start=""; |
|
4177 | - $date_end=""; |
|
4176 | + $date_start = ""; |
|
4177 | + $date_end = ""; |
|
4178 | 4178 | } |
4179 | 4179 | if (empty($name)) { |
4180 | 4180 | $results[] = 0; //SessionNameIsRequired |
@@ -4318,13 +4318,13 @@ discard block |
||
4318 | 4318 | 'tns:result_deleteSession' |
4319 | 4319 | ); |
4320 | 4320 | |
4321 | -$server->register('WSDeleteSession', // method name |
|
4322 | - array('deleteSession' => 'tns:deleteSession'), // input parameters |
|
4321 | +$server->register('WSDeleteSession', // method name |
|
4322 | + array('deleteSession' => 'tns:deleteSession'), // input parameters |
|
4323 | 4323 | array('return' => 'tns:results_deleteSession'), // output parameters |
4324 | - 'urn:WSRegistration', // namespace |
|
4325 | - 'urn:WSRegistration#WSDeleteSession', // soapaction |
|
4326 | - 'rpc', // style |
|
4327 | - 'encoded', // use |
|
4324 | + 'urn:WSRegistration', // namespace |
|
4325 | + 'urn:WSRegistration#WSDeleteSession', // soapaction |
|
4326 | + 'rpc', // style |
|
4327 | + 'encoded', // use |
|
4328 | 4328 | 'This service deletes a session ' // documentation |
4329 | 4329 | ); |
4330 | 4330 | |
@@ -4406,10 +4406,10 @@ discard block |
||
4406 | 4406 | 'struct', |
4407 | 4407 | 'all', |
4408 | 4408 | '', |
4409 | - array ( |
|
4409 | + array( |
|
4410 | 4410 | 'course_id' => array('name' => 'course_id', 'type' => 'tns:course_id'), |
4411 | - 'user_id' => array('name' => 'user_id', 'type' => 'tns:user_id'), |
|
4412 | - 'status' => array('name' => 'status', 'type' => 'xsd:int') |
|
4411 | + 'user_id' => array('name' => 'user_id', 'type' => 'tns:user_id'), |
|
4412 | + 'status' => array('name' => 'status', 'type' => 'xsd:int') |
|
4413 | 4413 | ) |
4414 | 4414 | ); |
4415 | 4415 | |
@@ -4419,9 +4419,9 @@ discard block |
||
4419 | 4419 | 'struct', |
4420 | 4420 | 'all', |
4421 | 4421 | '', |
4422 | - array ( |
|
4423 | - 'userscourses' => array('name' => 'userscourses', 'type' => 'tns:user_course_status_array'), //removed [] |
|
4424 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4422 | + array( |
|
4423 | + 'userscourses' => array('name' => 'userscourses', 'type' => 'tns:user_course_status_array'), //removed [] |
|
4424 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4425 | 4425 | ) |
4426 | 4426 | ); |
4427 | 4427 | |
@@ -4446,9 +4446,9 @@ discard block |
||
4446 | 4446 | 'all', |
4447 | 4447 | '', |
4448 | 4448 | array( |
4449 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4450 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4451 | - 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
4449 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4450 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4451 | + 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
4452 | 4452 | ) |
4453 | 4453 | ); |
4454 | 4454 | |
@@ -4464,13 +4464,13 @@ discard block |
||
4464 | 4464 | ); |
4465 | 4465 | |
4466 | 4466 | // Register the method to expose |
4467 | -$server->register('WSSubscribeUserToCourse', // method name |
|
4468 | - array('subscribeUserToCourse' => 'tns:subscribeUserToCourse_arg'), // input parameters |
|
4467 | +$server->register('WSSubscribeUserToCourse', // method name |
|
4468 | + array('subscribeUserToCourse' => 'tns:subscribeUserToCourse_arg'), // input parameters |
|
4469 | 4469 | array('return' => 'tns:subscribeUserToCourse_return_global'), |
4470 | - 'urn:WSRegistration', // namespace |
|
4471 | - 'urn:WSRegistration#WSSubscribeUserToCourse', // soapaction |
|
4472 | - 'rpc', // style |
|
4473 | - 'encoded', // use |
|
4470 | + 'urn:WSRegistration', // namespace |
|
4471 | + 'urn:WSRegistration#WSSubscribeUserToCourse', // soapaction |
|
4472 | + 'rpc', // style |
|
4473 | + 'encoded', // use |
|
4474 | 4474 | 'This service subscribes a user to a course' // documentation |
4475 | 4475 | ); |
4476 | 4476 | |
@@ -4480,7 +4480,7 @@ discard block |
||
4480 | 4480 | if (!WSHelperVerifyKey($params)) { |
4481 | 4481 | return returnError(WS_ERROR_SECRET_KEY); |
4482 | 4482 | } |
4483 | - if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4483 | + if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params, 1)); |
|
4484 | 4484 | |
4485 | 4485 | $results = array(); |
4486 | 4486 | $userscourses = $params['userscourses']; |
@@ -4548,8 +4548,8 @@ discard block |
||
4548 | 4548 | 'all', |
4549 | 4549 | '', |
4550 | 4550 | array( |
4551 | - 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
4552 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
4551 | + 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
4552 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
4553 | 4553 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
4554 | 4554 | ) |
4555 | 4555 | ); |
@@ -4562,18 +4562,18 @@ discard block |
||
4562 | 4562 | 'struct', |
4563 | 4563 | 'all', |
4564 | 4564 | '', |
4565 | - array('message' => array('name' => 'message', 'type' => 'xsd:string')) |
|
4565 | + array('message' => array('name' => 'message', 'type' => 'xsd:string')) |
|
4566 | 4566 | ); |
4567 | 4567 | |
4568 | 4568 | |
4569 | 4569 | // Register the method to expose |
4570 | -$server->register('WSSubscribeUserToCourseSimple', // method name |
|
4570 | +$server->register('WSSubscribeUserToCourseSimple', // method name |
|
4571 | 4571 | array('subscribeUserToCourseSimple' => 'tns:subscribeUserToCourseSimple_arg'), // input parameters |
4572 | - array('return' => 'xsd:string'), // output parameters |
|
4573 | - 'urn:WSRegistration', // namespace |
|
4574 | - 'urn:WSRegistration#WSSubscribeUserToCourseSimple', // soapaction |
|
4575 | - 'rpc', // style |
|
4576 | - 'encoded', // use |
|
4572 | + array('return' => 'xsd:string'), // output parameters |
|
4573 | + 'urn:WSRegistration', // namespace |
|
4574 | + 'urn:WSRegistration#WSSubscribeUserToCourseSimple', // soapaction |
|
4575 | + 'rpc', // style |
|
4576 | + 'encoded', // use |
|
4577 | 4577 | 'This service subscribes a user to a course in a simple way' // documentation |
4578 | 4578 | ); |
4579 | 4579 | |
@@ -4582,7 +4582,7 @@ discard block |
||
4582 | 4582 | global $debug; |
4583 | 4583 | |
4584 | 4584 | if ($debug) error_log('WSSubscribeUserToCourseSimple'); |
4585 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
4585 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
4586 | 4586 | if (!WSHelperVerifyKey($params)) { |
4587 | 4587 | return returnError(WS_ERROR_SECRET_KEY); |
4588 | 4588 | } |
@@ -4630,9 +4630,9 @@ discard block |
||
4630 | 4630 | 'all', |
4631 | 4631 | '', |
4632 | 4632 | array( |
4633 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4634 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4635 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4633 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4634 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4635 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4636 | 4636 | ) |
4637 | 4637 | ); |
4638 | 4638 | |
@@ -4643,21 +4643,21 @@ discard block |
||
4643 | 4643 | 'struct', |
4644 | 4644 | 'all', |
4645 | 4645 | '', |
4646 | - array ( |
|
4647 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), |
|
4648 | - 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
4649 | - 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
4646 | + array( |
|
4647 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), |
|
4648 | + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
4649 | + 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
4650 | 4650 | ) |
4651 | 4651 | ); |
4652 | 4652 | |
4653 | 4653 | // Register the method to expose |
4654 | -$server->register('WSGetUser', // method name |
|
4655 | - array('GetUser' => 'tns:GetUserArg'), // input parameters |
|
4656 | - array('return' => 'tns:User'), // output parameters |
|
4657 | - 'urn:WSRegistration', // namespace |
|
4658 | - 'urn:WSRegistration#WSGetUser', // soapaction |
|
4659 | - 'rpc', // style |
|
4660 | - 'encoded', // use |
|
4654 | +$server->register('WSGetUser', // method name |
|
4655 | + array('GetUser' => 'tns:GetUserArg'), // input parameters |
|
4656 | + array('return' => 'tns:User'), // output parameters |
|
4657 | + 'urn:WSRegistration', // namespace |
|
4658 | + 'urn:WSRegistration#WSGetUser', // soapaction |
|
4659 | + 'rpc', // style |
|
4660 | + 'encoded', // use |
|
4661 | 4661 | 'This service get user information by id' // documentation |
4662 | 4662 | ); |
4663 | 4663 | |
@@ -4701,17 +4701,17 @@ discard block |
||
4701 | 4701 | '', |
4702 | 4702 | array( |
4703 | 4703 | 'username' => array('name' => 'username', 'type' => 'xsd:string'), |
4704 | - 'secret_key' => array('name' => 'secret_key','type' => 'xsd:string') |
|
4704 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4705 | 4705 | ) |
4706 | 4706 | ); |
4707 | 4707 | // Register the method to expose |
4708 | -$server->register('WSGetUserFromUsername', // method name |
|
4709 | - array('GetUserFromUsername' => 'tns:GetUserArgUsername'), // input params |
|
4710 | - array('return' => 'tns:User'), // output parameters |
|
4711 | - 'urn:WSRegistration', // namespace |
|
4712 | - 'urn:WSRegistration#WSGetUserFromUsername', // soapaction |
|
4713 | - 'rpc', // style |
|
4714 | - 'encoded', // use |
|
4708 | +$server->register('WSGetUserFromUsername', // method name |
|
4709 | + array('GetUserFromUsername' => 'tns:GetUserArgUsername'), // input params |
|
4710 | + array('return' => 'tns:User'), // output parameters |
|
4711 | + 'urn:WSRegistration', // namespace |
|
4712 | + 'urn:WSRegistration#WSGetUserFromUsername', // soapaction |
|
4713 | + 'rpc', // style |
|
4714 | + 'encoded', // use |
|
4715 | 4715 | 'This service get user information by username' // documentation |
4716 | 4716 | ); |
4717 | 4717 | |
@@ -4752,10 +4752,10 @@ discard block |
||
4752 | 4752 | 'all', |
4753 | 4753 | '', |
4754 | 4754 | array( |
4755 | - 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
4756 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4757 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4758 | - 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
4755 | + 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
4756 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4757 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4758 | + 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
4759 | 4759 | ) |
4760 | 4760 | ); |
4761 | 4761 | |
@@ -4808,13 +4808,13 @@ discard block |
||
4808 | 4808 | ); |
4809 | 4809 | |
4810 | 4810 | // Register the method to expose |
4811 | -$server->register('WSUnsubscribeUserFromCourse', // method name |
|
4811 | +$server->register('WSUnsubscribeUserFromCourse', // method name |
|
4812 | 4812 | array('unsuscribeUserFromCourse' => 'tns:unsuscribeUserFromCourse'), // input parameters |
4813 | - array('return' => 'tns:results_unsuscribeUserFromCourse'), // output parameters |
|
4814 | - 'urn:WSRegistration', // namespace |
|
4815 | - 'urn:WSRegistration#WSUnsubscribeUserFromCourse', // soapaction |
|
4816 | - 'rpc', // style |
|
4817 | - 'encoded', // use |
|
4813 | + array('return' => 'tns:results_unsuscribeUserFromCourse'), // output parameters |
|
4814 | + 'urn:WSRegistration', // namespace |
|
4815 | + 'urn:WSRegistration#WSUnsubscribeUserFromCourse', // soapaction |
|
4816 | + 'rpc', // style |
|
4817 | + 'encoded', // use |
|
4818 | 4818 | 'This service unsubscribes a user from a course' // documentation |
4819 | 4819 | ); |
4820 | 4820 | |
@@ -4826,7 +4826,7 @@ discard block |
||
4826 | 4826 | } |
4827 | 4827 | |
4828 | 4828 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
4829 | - $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
4829 | + $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
4830 | 4830 | $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
4831 | 4831 | |
4832 | 4832 | $userscourses_params = $params['userscourses']; |
@@ -4836,8 +4836,8 @@ discard block |
||
4836 | 4836 | foreach ($userscourses_params as $usercourse_param) { |
4837 | 4837 | |
4838 | 4838 | $original_user_id_values = $usercourse_param['original_user_id_values']; |
4839 | - $original_user_id_name = $usercourse_param['original_user_id_name']; |
|
4840 | - $original_course_id_value = $usercourse_param['original_course_id_value']; |
|
4839 | + $original_user_id_name = $usercourse_param['original_user_id_name']; |
|
4840 | + $original_course_id_value = $usercourse_param['original_course_id_value']; |
|
4841 | 4841 | $original_course_id_name = $usercourse_param['original_course_id_name']; |
4842 | 4842 | $orig_course_id_value[] = $original_course_id_value; |
4843 | 4843 | |
@@ -4858,7 +4858,7 @@ discard block |
||
4858 | 4858 | $usersList[] = $user_id; |
4859 | 4859 | } |
4860 | 4860 | |
4861 | - $orig_user_id_value[] = implode(',',$usersList); |
|
4861 | + $orig_user_id_value[] = implode(',', $usersList); |
|
4862 | 4862 | |
4863 | 4863 | $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
4864 | 4864 | $original_course_id_value, |
@@ -4891,7 +4891,7 @@ discard block |
||
4891 | 4891 | |
4892 | 4892 | $count_results = count($results); |
4893 | 4893 | $output = array(); |
4894 | - for($i = 0; $i < $count_results; $i++) { |
|
4894 | + for ($i = 0; $i < $count_results; $i++) { |
|
4895 | 4895 | $output[] = array( |
4896 | 4896 | 'original_user_id_values' => $orig_user_id_value[$i], |
4897 | 4897 | 'original_course_id_value' => $orig_course_id_value[$i], |
@@ -4920,13 +4920,13 @@ discard block |
||
4920 | 4920 | |
4921 | 4921 | |
4922 | 4922 | // Register the method to expose |
4923 | -$server->register('WSUnSubscribeUserFromCourseSimple', // method name |
|
4923 | +$server->register('WSUnSubscribeUserFromCourseSimple', // method name |
|
4924 | 4924 | array('unSubscribeUserFromCourseSimple' => 'tns:unSubscribeUserFromCourseSimple'), // input parameters |
4925 | - array('return' => 'tns:result_createUsersPassEncrypt'), // output parameters |
|
4926 | - 'urn:WSRegistration', // namespace |
|
4927 | - 'urn:WSRegistration#WSUnSubscribeUserFromCourseSimple', // soapaction |
|
4928 | - 'rpc', // style |
|
4929 | - 'encoded', // use |
|
4925 | + array('return' => 'tns:result_createUsersPassEncrypt'), // output parameters |
|
4926 | + 'urn:WSRegistration', // namespace |
|
4927 | + 'urn:WSRegistration#WSUnSubscribeUserFromCourseSimple', // soapaction |
|
4928 | + 'rpc', // style |
|
4929 | + 'encoded', // use |
|
4930 | 4930 | 'This service unsubscribe a user from a course' // documentation |
4931 | 4931 | ); |
4932 | 4932 | /** |
@@ -4996,10 +4996,10 @@ discard block |
||
4996 | 4996 | 'all', |
4997 | 4997 | '', |
4998 | 4998 | array( |
4999 | - 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
5000 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5001 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
5002 | - 'original_course_id_name' => array('name' => 'original_course_id_value', 'type' => 'xsd:string') |
|
4999 | + 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
5000 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5001 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
5002 | + 'original_course_id_name' => array('name' => 'original_course_id_value', 'type' => 'xsd:string') |
|
5003 | 5003 | ) |
5004 | 5004 | ); |
5005 | 5005 | |
@@ -5093,13 +5093,13 @@ discard block |
||
5093 | 5093 | |
5094 | 5094 | |
5095 | 5095 | // Register the method to expose |
5096 | -$server->register('WSSuscribeUsersToSession', // method name |
|
5096 | +$server->register('WSSuscribeUsersToSession', // method name |
|
5097 | 5097 | array('subscribeUsersToSession' => 'tns:subscribeUsersToSession'), // input parameters |
5098 | - array('return' => 'tns:results_subscribeUsersToSession'), // output parameters |
|
5099 | - 'urn:WSRegistration', // namespace |
|
5100 | - 'urn:WSRegistration#WSSuscribeUsersToSession', // soapaction |
|
5101 | - 'rpc', // style |
|
5102 | - 'encoded', // use |
|
5098 | + array('return' => 'tns:results_subscribeUsersToSession'), // output parameters |
|
5099 | + 'urn:WSRegistration', // namespace |
|
5100 | + 'urn:WSRegistration#WSSuscribeUsersToSession', // soapaction |
|
5101 | + 'rpc', // style |
|
5102 | + 'encoded', // use |
|
5103 | 5103 | 'This service subscribes a user to a session' // documentation |
5104 | 5104 | ); |
5105 | 5105 | |
@@ -5176,7 +5176,7 @@ discard block |
||
5176 | 5176 | |
5177 | 5177 | $count_results = count($results); |
5178 | 5178 | $output = array(); |
5179 | - for($i = 0; $i < $count_results; $i++) { |
|
5179 | + for ($i = 0; $i < $count_results; $i++) { |
|
5180 | 5180 | $output[] = array( |
5181 | 5181 | 'original_user_id_values' => $orig_user_id_value[$i], |
5182 | 5182 | 'original_session_id_value' => $orig_session_id_value[$i], |
@@ -5196,25 +5196,25 @@ discard block |
||
5196 | 5196 | 'all', |
5197 | 5197 | '', |
5198 | 5198 | array( |
5199 | - 'session' => array('name' => 'session', 'type' => 'xsd:string'), // Session ID |
|
5200 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Chamilo user_id |
|
5199 | + 'session' => array('name' => 'session', 'type' => 'xsd:string'), // Session ID |
|
5200 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Chamilo user_id |
|
5201 | 5201 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
5202 | 5202 | ) |
5203 | 5203 | ); |
5204 | -$server->register('WSSubscribeUserToSessionSimple', // method name |
|
5205 | - array('subscribeUserToSessionSimple' => 'tns:subscribeUserToSessionSimple_arg'), // input parameters |
|
5206 | - array('return' => 'xsd:string'), // output parameters |
|
5207 | - 'urn:WSRegistration', // namespace |
|
5208 | - 'urn:WSRegistration#WSSubscribeUserToSessionSimple', // soapaction |
|
5209 | - 'rpc', // style |
|
5210 | - 'encoded', // use |
|
5204 | +$server->register('WSSubscribeUserToSessionSimple', // method name |
|
5205 | + array('subscribeUserToSessionSimple' => 'tns:subscribeUserToSessionSimple_arg'), // input parameters |
|
5206 | + array('return' => 'xsd:string'), // output parameters |
|
5207 | + 'urn:WSRegistration', // namespace |
|
5208 | + 'urn:WSRegistration#WSSubscribeUserToSessionSimple', // soapaction |
|
5209 | + 'rpc', // style |
|
5210 | + 'encoded', // use |
|
5211 | 5211 | 'This service subscribes a user to a session in a simple way' // documentation |
5212 | 5212 | ); |
5213 | 5213 | function WSSubscribeUserToSessionSimple($params) { |
5214 | 5214 | global $debug; |
5215 | 5215 | |
5216 | 5216 | if ($debug) { |
5217 | - error_log('WSSubscribeUserToSessionSimple with params=[' . serialize($params). ']'); |
|
5217 | + error_log('WSSubscribeUserToSessionSimple with params=['.serialize($params).']'); |
|
5218 | 5218 | } |
5219 | 5219 | |
5220 | 5220 | // Check security key |
@@ -5223,8 +5223,8 @@ discard block |
||
5223 | 5223 | } |
5224 | 5224 | |
5225 | 5225 | // Get input parameters |
5226 | - $session_id = intval($params['session']); // Session ID |
|
5227 | - $user_id = intval($params['user_id']); // Chamilo user id |
|
5226 | + $session_id = intval($params['session']); // Session ID |
|
5227 | + $user_id = intval($params['user_id']); // Chamilo user id |
|
5228 | 5228 | |
5229 | 5229 | // Get user id |
5230 | 5230 | $user_data = api_get_user_info($user_id); |
@@ -5325,13 +5325,13 @@ discard block |
||
5325 | 5325 | ); |
5326 | 5326 | |
5327 | 5327 | // Register the method to expose |
5328 | -$server->register('WSUnsuscribeUsersFromSession', // method name |
|
5328 | +$server->register('WSUnsuscribeUsersFromSession', // method name |
|
5329 | 5329 | array('unsubscribeUsersFromSession' => 'tns:unsubscribeUsersFromSession'), // input parameters |
5330 | - array('return' => 'tns:results_unsubscribeUsersFromSession'), // output parameters |
|
5331 | - 'urn:WSRegistration', // namespace |
|
5332 | - 'urn:WSRegistration#WSUnsuscribeUsersFromSession', // soapaction |
|
5333 | - 'rpc', // style |
|
5334 | - 'encoded', // use |
|
5330 | + array('return' => 'tns:results_unsubscribeUsersFromSession'), // output parameters |
|
5331 | + 'urn:WSRegistration', // namespace |
|
5332 | + 'urn:WSRegistration#WSUnsuscribeUsersFromSession', // soapaction |
|
5333 | + 'rpc', // style |
|
5334 | + 'encoded', // use |
|
5335 | 5335 | 'This service unsubscribes a user to a session' // documentation |
5336 | 5336 | ); |
5337 | 5337 | |
@@ -5345,7 +5345,7 @@ discard block |
||
5345 | 5345 | global $debug; |
5346 | 5346 | |
5347 | 5347 | if ($debug) { |
5348 | - error_log('WSUnsuscribeUsersFromSession with params=[' . serialize($params). ']'); |
|
5348 | + error_log('WSUnsuscribeUsersFromSession with params=['.serialize($params).']'); |
|
5349 | 5349 | } |
5350 | 5350 | |
5351 | 5351 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
@@ -5437,7 +5437,7 @@ discard block |
||
5437 | 5437 | 'all', |
5438 | 5438 | '', |
5439 | 5439 | array( |
5440 | - 'course_code' => array('name' => 'course_code', 'type' => 'xsd:string'), |
|
5440 | + 'course_code' => array('name' => 'course_code', 'type' => 'xsd:string'), |
|
5441 | 5441 | ) |
5442 | 5442 | ); |
5443 | 5443 | |
@@ -5473,9 +5473,9 @@ discard block |
||
5473 | 5473 | '', |
5474 | 5474 | array( |
5475 | 5475 | 'original_course_id_values' => array('name' => 'original_course_id_values', 'type' => 'tns:originalCoursesList'), |
5476 | - 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
5476 | + 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
5477 | 5477 | 'original_session_id_value' => array('name' => 'original_session_id_value', 'type' => 'xsd:string'), |
5478 | - 'original_session_id_name' => array('name' => 'original_session_id_name', 'type' => 'xsd:string') |
|
5478 | + 'original_session_id_name' => array('name' => 'original_session_id_name', 'type' => 'xsd:string') |
|
5479 | 5479 | ) |
5480 | 5480 | ); |
5481 | 5481 | |
@@ -5528,13 +5528,13 @@ discard block |
||
5528 | 5528 | ); |
5529 | 5529 | |
5530 | 5530 | // Register the method to expose |
5531 | -$server->register('WSSuscribeCoursesToSession', // method name |
|
5531 | +$server->register('WSSuscribeCoursesToSession', // method name |
|
5532 | 5532 | array('subscribeCoursesToSession' => 'tns:subscribeCoursesToSession'), // input parameters |
5533 | - array('return' => 'tns:results_subscribeCoursesToSession'), // output parameters |
|
5534 | - 'urn:WSRegistration', // namespace |
|
5535 | - 'urn:WSRegistration#WSSuscribeCoursesToSession', // soapaction |
|
5536 | - 'rpc', // style |
|
5537 | - 'encoded', // use |
|
5533 | + array('return' => 'tns:results_subscribeCoursesToSession'), // output parameters |
|
5534 | + 'urn:WSRegistration', // namespace |
|
5535 | + 'urn:WSRegistration#WSSuscribeCoursesToSession', // soapaction |
|
5536 | + 'rpc', // style |
|
5537 | + 'encoded', // use |
|
5538 | 5538 | 'This service subscribes a course to a session' // documentation |
5539 | 5539 | ); |
5540 | 5540 | |
@@ -5672,13 +5672,13 @@ discard block |
||
5672 | 5672 | |
5673 | 5673 | |
5674 | 5674 | // Register the method to expose |
5675 | -$server->register('WSUnsuscribeCoursesFromSession', // method name |
|
5675 | +$server->register('WSUnsuscribeCoursesFromSession', // method name |
|
5676 | 5676 | array('unsubscribeCoursesFromSession' => 'tns:unsubscribeCoursesFromSession'), // input parameters |
5677 | - array('return' => 'tns:results_unsubscribeCoursesFromSession'), // output parameters |
|
5678 | - 'urn:WSRegistration', // namespace |
|
5679 | - 'urn:WSRegistration#WSUnsuscribeCoursesFromSession', // soapaction |
|
5680 | - 'rpc', // style |
|
5681 | - 'encoded', // use |
|
5677 | + array('return' => 'tns:results_unsubscribeCoursesFromSession'), // output parameters |
|
5678 | + 'urn:WSRegistration', // namespace |
|
5679 | + 'urn:WSRegistration#WSUnsuscribeCoursesFromSession', // soapaction |
|
5680 | + 'rpc', // style |
|
5681 | + 'encoded', // use |
|
5682 | 5682 | 'This service subscribes a course to a session' // documentation |
5683 | 5683 | ); |
5684 | 5684 | |
@@ -5785,7 +5785,7 @@ discard block |
||
5785 | 5785 | |
5786 | 5786 | $count_results = count($results); |
5787 | 5787 | $output = array(); |
5788 | - for($i = 0; $i < $count_results; $i++) { |
|
5788 | + for ($i = 0; $i < $count_results; $i++) { |
|
5789 | 5789 | $output[] = array( |
5790 | 5790 | 'original_course_id_values' => $orig_course_id_value[$i], |
5791 | 5791 | 'original_session_id_value' => $orig_session_id_value[$i], |
@@ -5829,13 +5829,13 @@ discard block |
||
5829 | 5829 | |
5830 | 5830 | |
5831 | 5831 | // Register the method to expose |
5832 | -$server->register('WSListCourses', // method name |
|
5832 | +$server->register('WSListCourses', // method name |
|
5833 | 5833 | array('secret_key' => 'xsd:string', 'original_course_id_name' => 'xsd:string'), // input parameters |
5834 | - array('return' => 'tns:courses'), // output parameters |
|
5835 | - 'urn:WSRegistration', // namespace |
|
5836 | - 'urn:WSRegistration#WSListCourses', // soapaction |
|
5837 | - 'rpc', // style |
|
5838 | - 'encoded', // use |
|
5834 | + array('return' => 'tns:courses'), // output parameters |
|
5835 | + 'urn:WSRegistration', // namespace |
|
5836 | + 'urn:WSRegistration#WSListCourses', // soapaction |
|
5837 | + 'rpc', // style |
|
5838 | + 'encoded', // use |
|
5839 | 5839 | 'This service list courses available on the system' // documentation |
5840 | 5840 | ); |
5841 | 5841 | |
@@ -5902,27 +5902,27 @@ discard block |
||
5902 | 5902 | 'all', |
5903 | 5903 | '', |
5904 | 5904 | array( |
5905 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5906 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
5907 | - 'chamilo_username' => array('name' => 'chamilo_username', 'type' => 'xsd:string'), |
|
5908 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5905 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5906 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
5907 | + 'chamilo_username' => array('name' => 'chamilo_username', 'type' => 'xsd:string'), |
|
5908 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5909 | 5909 | ) |
5910 | 5910 | ); |
5911 | 5911 | |
5912 | 5912 | // Register the method to expose |
5913 | -$server->register('WSUpdateUserApiKey', // method name |
|
5913 | +$server->register('WSUpdateUserApiKey', // method name |
|
5914 | 5914 | array('userApiKey' => 'tns:userApiKey'), // input parameters |
5915 | - array('return' => 'xsd:string'), // output parameters |
|
5916 | - 'urn:WSRegistration', // namespace |
|
5917 | - 'urn:WSRegistration#WSListCourses', // soapaction |
|
5918 | - 'rpc', // style |
|
5919 | - 'encoded', // use |
|
5915 | + array('return' => 'xsd:string'), // output parameters |
|
5916 | + 'urn:WSRegistration', // namespace |
|
5917 | + 'urn:WSRegistration#WSListCourses', // soapaction |
|
5918 | + 'rpc', // style |
|
5919 | + 'encoded', // use |
|
5920 | 5920 | 'This service return user api key' // documentation |
5921 | 5921 | ); |
5922 | 5922 | |
5923 | 5923 | |
5924 | 5924 | function WSUpdateUserApiKey($params) { |
5925 | - if(!WSHelperVerifyKey($params)) { |
|
5925 | + if (!WSHelperVerifyKey($params)) { |
|
5926 | 5926 | return returnError(WS_ERROR_SECRET_KEY); |
5927 | 5927 | } |
5928 | 5928 | |
@@ -5964,9 +5964,9 @@ discard block |
||
5964 | 5964 | 'all', |
5965 | 5965 | '', |
5966 | 5966 | array( |
5967 | - 'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
5968 | - 'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
5969 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5967 | + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
5968 | + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
5969 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5970 | 5970 | ) |
5971 | 5971 | ); |
5972 | 5972 | |
@@ -5977,11 +5977,11 @@ discard block |
||
5977 | 5977 | 'all', |
5978 | 5978 | '', |
5979 | 5979 | array( |
5980 | - 'id' => array ('name' => 'id' , 'type' => 'xsd:int'), |
|
5981 | - 'title' => array ('name' => 'title', 'type' => 'xsd:string'), |
|
5982 | - 'url' => array ('name' => 'url', 'type' => 'xsd:string'), |
|
5983 | - 'date_start' => array ('name' => 'date_start', 'type' => 'xsd:string'), |
|
5984 | - 'date_end' => array ('name' => 'date_end', 'type' => 'xsd:string'), |
|
5980 | + 'id' => array('name' => 'id', 'type' => 'xsd:int'), |
|
5981 | + 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
5982 | + 'url' => array('name' => 'url', 'type' => 'xsd:string'), |
|
5983 | + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
5984 | + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
5985 | 5985 | ) |
5986 | 5986 | ); |
5987 | 5987 | |
@@ -6000,13 +6000,13 @@ discard block |
||
6000 | 6000 | ); |
6001 | 6001 | |
6002 | 6002 | // Register the method to expose |
6003 | -$server->register('WSListSessions', // method name |
|
6004 | - array('input' => 'tns:session_arg'), // input parameters |
|
6005 | - array('return' => 'tns:sessions'), // output parameters |
|
6006 | - 'urn:WSRegistration', // namespace |
|
6007 | - 'urn:WSRegistration#WSListSessions', // soapaction |
|
6008 | - 'rpc', // style |
|
6009 | - 'encoded', // use |
|
6003 | +$server->register('WSListSessions', // method name |
|
6004 | + array('input' => 'tns:session_arg'), // input parameters |
|
6005 | + array('return' => 'tns:sessions'), // output parameters |
|
6006 | + 'urn:WSRegistration', // namespace |
|
6007 | + 'urn:WSRegistration#WSListSessions', // soapaction |
|
6008 | + 'rpc', // style |
|
6009 | + 'encoded', // use |
|
6010 | 6010 | 'This service returns a list of sessions' // documentation |
6011 | 6011 | ); |
6012 | 6012 | |
@@ -6021,7 +6021,7 @@ discard block |
||
6021 | 6021 | * @return array Sessions list (id=>[title=>'title',url='http://...',date_start=>'...',date_end=>'']) |
6022 | 6022 | */ |
6023 | 6023 | function WSListSessions($params) { |
6024 | - if(!WSHelperVerifyKey($params)) { |
|
6024 | + if (!WSHelperVerifyKey($params)) { |
|
6025 | 6025 | return returnError(WS_ERROR_SECRET_KEY); |
6026 | 6026 | } |
6027 | 6027 | $sql_params = array(); |
@@ -6060,20 +6060,20 @@ discard block |
||
6060 | 6060 | 'all', |
6061 | 6061 | '', |
6062 | 6062 | array( |
6063 | - 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
6064 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
6063 | + 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
6064 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
6065 | 6065 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
6066 | 6066 | ) |
6067 | 6067 | ); |
6068 | 6068 | |
6069 | 6069 | // Register the method to expose |
6070 | -$server->register('WSUserSubscribedInCourse', // method name |
|
6071 | - array('UserSubscribedInCourse' => 'tns:UserSubscribedInCourse'), // input parameters |
|
6072 | - array('return' => 'xsd:string'), // output parameters |
|
6073 | - 'urn:WSRegistration', // namespace |
|
6074 | - 'urn:WSRegistration#WSUserSubscribedInCourse', // soapaction |
|
6075 | - 'rpc', // style |
|
6076 | - 'encoded', // use |
|
6070 | +$server->register('WSUserSubscribedInCourse', // method name |
|
6071 | + array('UserSubscribedInCourse' => 'tns:UserSubscribedInCourse'), // input parameters |
|
6072 | + array('return' => 'xsd:string'), // output parameters |
|
6073 | + 'urn:WSRegistration', // namespace |
|
6074 | + 'urn:WSRegistration#WSUserSubscribedInCourse', // soapaction |
|
6075 | + 'rpc', // style |
|
6076 | + 'encoded', // use |
|
6077 | 6077 | 'This service checks if user assigned to course' // documentation |
6078 | 6078 | ); |
6079 | 6079 | |
@@ -6087,7 +6087,7 @@ discard block |
||
6087 | 6087 | global $debug; |
6088 | 6088 | |
6089 | 6089 | if ($debug) error_log('WSUserSubscribedInCourse'); |
6090 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
6090 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
6091 | 6091 | if (!WSHelperVerifyKey($params)) { |
6092 | 6092 | |
6093 | 6093 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -6095,7 +6095,7 @@ discard block |
||
6095 | 6095 | $courseCode = $params['course']; //Course code |
6096 | 6096 | $userId = $params['user_id']; //chamilo user id |
6097 | 6097 | |
6098 | - return (CourseManager::is_user_subscribed_in_course($userId,$courseCode)); |
|
6098 | + return (CourseManager::is_user_subscribed_in_course($userId, $courseCode)); |
|
6099 | 6099 | } |
6100 | 6100 | |
6101 | 6101 | |
@@ -6123,8 +6123,8 @@ discard block |
||
6123 | 6123 | 'all', |
6124 | 6124 | '', |
6125 | 6125 | array( |
6126 | - 'variable' => array('name'=>'variable','type'=>'xsd:string'), |
|
6127 | - 'value' => array('name'=>'value','type'=>'xsd:string') |
|
6126 | + 'variable' => array('name'=>'variable', 'type'=>'xsd:string'), |
|
6127 | + 'value' => array('name'=>'value', 'type'=>'xsd:string') |
|
6128 | 6128 | ) |
6129 | 6129 | ); |
6130 | 6130 | |
@@ -6186,12 +6186,12 @@ discard block |
||
6186 | 6186 | //Reister WSSearchSession |
6187 | 6187 | $server->register( |
6188 | 6188 | 'WSSearchSession', |
6189 | - array('SearchSession' => 'tns:SearchSession'), // input parameters |
|
6190 | - array('return' => 'tns:searchedSessionList'), // output parameters |
|
6191 | - 'urn:WSRegistration', // namespace |
|
6192 | - 'urn:WSRegistration#WSSearchSession', // soapaction |
|
6193 | - 'rpc', // style |
|
6194 | - 'encoded', // use |
|
6189 | + array('SearchSession' => 'tns:SearchSession'), // input parameters |
|
6190 | + array('return' => 'tns:searchedSessionList'), // output parameters |
|
6191 | + 'urn:WSRegistration', // namespace |
|
6192 | + 'urn:WSRegistration#WSSearchSession', // soapaction |
|
6193 | + 'rpc', // style |
|
6194 | + 'encoded', // use |
|
6195 | 6195 | 'This service to get a session list filtered by name, description or short description extra field' // documentation |
6196 | 6196 | ); |
6197 | 6197 | |
@@ -6246,12 +6246,12 @@ discard block |
||
6246 | 6246 | //Reister WSFetchSession |
6247 | 6247 | $server->register( |
6248 | 6248 | 'WSFetchSession', |
6249 | - array('SearchSession' => 'tns:FetchSession'), // input parameters |
|
6250 | - array('return' => 'tns:searchedSessionList'), // output parameters |
|
6251 | - 'urn:WSRegistration', // namespace |
|
6252 | - 'urn:WSRegistration#WSFetchSession', // soapaction |
|
6253 | - 'rpc', // style |
|
6254 | - 'encoded', // use |
|
6249 | + array('SearchSession' => 'tns:FetchSession'), // input parameters |
|
6250 | + array('return' => 'tns:searchedSessionList'), // output parameters |
|
6251 | + 'urn:WSRegistration', // namespace |
|
6252 | + 'urn:WSRegistration#WSFetchSession', // soapaction |
|
6253 | + 'rpc', // style |
|
6254 | + 'encoded', // use |
|
6255 | 6255 | 'This service get a session by its id. Optionally can get its extra fields values' // documentation |
6256 | 6256 | ); |
6257 | 6257 | |
@@ -6328,16 +6328,16 @@ discard block |
||
6328 | 6328 | ); |
6329 | 6329 | // Register the method to expose |
6330 | 6330 | $server->register( |
6331 | - 'WSCertificatesList', // method name |
|
6331 | + 'WSCertificatesList', // method name |
|
6332 | 6332 | array( |
6333 | - 'startingDate' => 'xsd:string', // input parameters |
|
6333 | + 'startingDate' => 'xsd:string', // input parameters |
|
6334 | 6334 | 'endingDate' => 'xsd:string' |
6335 | 6335 | ), |
6336 | - array('return' => 'tns:certificatesList'), // output parameters |
|
6337 | - 'urn:WSRegistration', // namespace |
|
6338 | - 'urn:WSRegistration#WSCertificatesList', // soapaction |
|
6339 | - 'rpc', // style |
|
6340 | - 'encoded', // use |
|
6336 | + array('return' => 'tns:certificatesList'), // output parameters |
|
6337 | + 'urn:WSRegistration', // namespace |
|
6338 | + 'urn:WSRegistration#WSCertificatesList', // soapaction |
|
6339 | + 'rpc', // style |
|
6340 | + 'encoded', // use |
|
6341 | 6341 | 'This service returns a list of certificates' // documentation |
6342 | 6342 | ); |
6343 | 6343 | |
@@ -6403,13 +6403,13 @@ discard block |
||
6403 | 6403 | ); |
6404 | 6404 | |
6405 | 6405 | // Register the method to expose |
6406 | -$server->register('WSCreateGroup', // method name |
|
6407 | - array('createGroup' => 'tns:createGroup'), // input parameters |
|
6408 | - array('return' => 'xsd:string'), // output parameters |
|
6409 | - 'urn:WSRegistration', // namespace |
|
6410 | - 'urn:WSRegistration#WSCreateGroup', // soapaction |
|
6411 | - 'rpc', // style |
|
6412 | - 'encoded', // use |
|
6406 | +$server->register('WSCreateGroup', // method name |
|
6407 | + array('createGroup' => 'tns:createGroup'), // input parameters |
|
6408 | + array('return' => 'xsd:string'), // output parameters |
|
6409 | + 'urn:WSRegistration', // namespace |
|
6410 | + 'urn:WSRegistration#WSCreateGroup', // soapaction |
|
6411 | + 'rpc', // style |
|
6412 | + 'encoded', // use |
|
6413 | 6413 | 'This service adds a group' // documentation |
6414 | 6414 | ); |
6415 | 6415 | |
@@ -6452,13 +6452,13 @@ discard block |
||
6452 | 6452 | ); |
6453 | 6453 | |
6454 | 6454 | // Register the method to expose |
6455 | -$server->register('WSUpdateGroup', // method name |
|
6456 | - array('updateGroup' => 'tns:updateGroup'), // input parameters |
|
6457 | - array('return' => 'xsd:string'), // output parameters |
|
6458 | - 'urn:WSRegistration', // namespace |
|
6459 | - 'urn:WSRegistration#WSUpdateGroup', // soapaction |
|
6460 | - 'rpc', // style |
|
6461 | - 'encoded', // use |
|
6455 | +$server->register('WSUpdateGroup', // method name |
|
6456 | + array('updateGroup' => 'tns:updateGroup'), // input parameters |
|
6457 | + array('return' => 'xsd:string'), // output parameters |
|
6458 | + 'urn:WSRegistration', // namespace |
|
6459 | + 'urn:WSRegistration#WSUpdateGroup', // soapaction |
|
6460 | + 'rpc', // style |
|
6461 | + 'encoded', // use |
|
6462 | 6462 | 'This service updates a group' // documentation |
6463 | 6463 | ); |
6464 | 6464 | |
@@ -6503,13 +6503,13 @@ discard block |
||
6503 | 6503 | ); |
6504 | 6504 | |
6505 | 6505 | // Register the method to expose |
6506 | -$server->register('WSDeleteGroup', // method name |
|
6507 | - array('deleteGroup' => 'tns:deleteGroup'), // input parameters |
|
6508 | - array('return' => 'xsd:string'), // output parameters |
|
6509 | - 'urn:WSRegistration', // namespace |
|
6510 | - 'urn:WSRegistration#WSDeleteGroup', // soapaction |
|
6511 | - 'rpc', // style |
|
6512 | - 'encoded', // use |
|
6506 | +$server->register('WSDeleteGroup', // method name |
|
6507 | + array('deleteGroup' => 'tns:deleteGroup'), // input parameters |
|
6508 | + array('return' => 'xsd:string'), // output parameters |
|
6509 | + 'urn:WSRegistration', // namespace |
|
6510 | + 'urn:WSRegistration#WSDeleteGroup', // soapaction |
|
6511 | + 'rpc', // style |
|
6512 | + 'encoded', // use |
|
6513 | 6513 | 'This service deletes a group' // documentation |
6514 | 6514 | ); |
6515 | 6515 | |
@@ -6546,13 +6546,13 @@ discard block |
||
6546 | 6546 | ); |
6547 | 6547 | |
6548 | 6548 | // Register the method to expose |
6549 | -$server->register('GroupBindToParent', // method name |
|
6550 | - array('groupBindToParent' => 'tns:groupBindToParent'), // input parameters |
|
6551 | - array('return' => 'xsd:string'), // output parameters |
|
6552 | - 'urn:WSRegistration', // namespace |
|
6553 | - 'urn:WSRegistration#GroupBindToParent', // soapaction |
|
6554 | - 'rpc', // style |
|
6555 | - 'encoded', // use |
|
6549 | +$server->register('GroupBindToParent', // method name |
|
6550 | + array('groupBindToParent' => 'tns:groupBindToParent'), // input parameters |
|
6551 | + array('return' => 'xsd:string'), // output parameters |
|
6552 | + 'urn:WSRegistration', // namespace |
|
6553 | + 'urn:WSRegistration#GroupBindToParent', // soapaction |
|
6554 | + 'rpc', // style |
|
6555 | + 'encoded', // use |
|
6556 | 6556 | 'This service binds a group to a parent' // documentation |
6557 | 6557 | ); |
6558 | 6558 | |
@@ -6588,13 +6588,13 @@ discard block |
||
6588 | 6588 | ); |
6589 | 6589 | |
6590 | 6590 | // Register the method to expose |
6591 | -$server->register('GroupUnbindFromParent', // method name |
|
6592 | - array('groupUnbindFromParent' => 'tns:groupUnbindFromParent'), // input parameters |
|
6593 | - array('return' => 'xsd:string'), // output parameters |
|
6594 | - 'urn:WSRegistration', // namespace |
|
6595 | - 'urn:WSRegistration#GroupUnbindFromParent', // soapaction |
|
6596 | - 'rpc', // style |
|
6597 | - 'encoded', // use |
|
6591 | +$server->register('GroupUnbindFromParent', // method name |
|
6592 | + array('groupUnbindFromParent' => 'tns:groupUnbindFromParent'), // input parameters |
|
6593 | + array('return' => 'xsd:string'), // output parameters |
|
6594 | + 'urn:WSRegistration', // namespace |
|
6595 | + 'urn:WSRegistration#GroupUnbindFromParent', // soapaction |
|
6596 | + 'rpc', // style |
|
6597 | + 'encoded', // use |
|
6598 | 6598 | 'This service unbinds a group from its parent' // documentation |
6599 | 6599 | ); |
6600 | 6600 | |
@@ -6628,13 +6628,13 @@ discard block |
||
6628 | 6628 | ); |
6629 | 6629 | |
6630 | 6630 | // Register the method to expose |
6631 | -$server->register('WSAddUserToGroup', // method name |
|
6632 | - array('addUserToGroup' => 'tns:addUserToGroup'), // input parameters |
|
6633 | - array('return' => 'xsd:string'), // output parameters |
|
6634 | - 'urn:WSRegistration', // namespace |
|
6635 | - 'urn:WSRegistration#WSAddUserToGroup', // soapaction |
|
6636 | - 'rpc', // style |
|
6637 | - 'encoded', // use |
|
6631 | +$server->register('WSAddUserToGroup', // method name |
|
6632 | + array('addUserToGroup' => 'tns:addUserToGroup'), // input parameters |
|
6633 | + array('return' => 'xsd:string'), // output parameters |
|
6634 | + 'urn:WSRegistration', // namespace |
|
6635 | + 'urn:WSRegistration#WSAddUserToGroup', // soapaction |
|
6636 | + 'rpc', // style |
|
6637 | + 'encoded', // use |
|
6638 | 6638 | 'This service adds a user to a group' // documentation |
6639 | 6639 | ); |
6640 | 6640 | |
@@ -6671,13 +6671,13 @@ discard block |
||
6671 | 6671 | ); |
6672 | 6672 | |
6673 | 6673 | // Register the method to expose |
6674 | -$server->register('WSUpdateUserRoleInGroup', // method name |
|
6675 | - array('updateUserRoleInGroup' => 'tns:updateUserRoleInGroup'), // input parameters |
|
6676 | - array('return' => 'xsd:string'), // output parameters |
|
6677 | - 'urn:WSRegistration', // namespace |
|
6678 | - 'urn:WSRegistration#WSUpdateUserRoleInGroup', // soapaction |
|
6679 | - 'rpc', // style |
|
6680 | - 'encoded', // use |
|
6674 | +$server->register('WSUpdateUserRoleInGroup', // method name |
|
6675 | + array('updateUserRoleInGroup' => 'tns:updateUserRoleInGroup'), // input parameters |
|
6676 | + array('return' => 'xsd:string'), // output parameters |
|
6677 | + 'urn:WSRegistration', // namespace |
|
6678 | + 'urn:WSRegistration#WSUpdateUserRoleInGroup', // soapaction |
|
6679 | + 'rpc', // style |
|
6680 | + 'encoded', // use |
|
6681 | 6681 | 'This service updates a user role in group' // documentation |
6682 | 6682 | ); |
6683 | 6683 | |
@@ -6716,13 +6716,13 @@ discard block |
||
6716 | 6716 | ); |
6717 | 6717 | |
6718 | 6718 | // Register the method to expose |
6719 | -$server->register('WSDeleteUserFromGroup', // method name |
|
6720 | - array('deleteUserFromGroup' => 'tns:deleteUserFromGroup'), // input parameters |
|
6721 | - array('return' => 'xsd:string'), // output parameters |
|
6722 | - 'urn:WSRegistration', // namespace |
|
6723 | - 'urn:WSRegistration#WSDeleteUserFromGroup', // soapaction |
|
6724 | - 'rpc', // style |
|
6725 | - 'encoded', // use |
|
6719 | +$server->register('WSDeleteUserFromGroup', // method name |
|
6720 | + array('deleteUserFromGroup' => 'tns:deleteUserFromGroup'), // input parameters |
|
6721 | + array('return' => 'xsd:string'), // output parameters |
|
6722 | + 'urn:WSRegistration', // namespace |
|
6723 | + 'urn:WSRegistration#WSDeleteUserFromGroup', // soapaction |
|
6724 | + 'rpc', // style |
|
6725 | + 'encoded', // use |
|
6726 | 6726 | 'This service deletes a user from a group' // documentation |
6727 | 6727 | ); |
6728 | 6728 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | if ($debug) { |
78 | - error_log("checkip " . intval($check_ip)); |
|
78 | + error_log("checkip ".intval($check_ip)); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if ($check_ip) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | '', |
132 | 132 | 'SOAP-ENC:Array', |
133 | 133 | array(), |
134 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:portalItem[]')),'tns:portalItem' |
|
134 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:portalItem[]')), 'tns:portalItem' |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | $server->wsdl->addComplexType( |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | ); |
147 | 147 | |
148 | 148 | // Register the method to expose |
149 | -$server->register('WSGetPortals', // method name |
|
150 | - array('getPortals' => 'tns:getPortals'), // input parameters |
|
151 | - array('return' => 'tns:portalList'), // output parameters |
|
152 | - 'urn:WSAccessUrl', // namespace |
|
153 | - 'urn:WSAccessUrl#WSGetPortals', // soapaction |
|
154 | - 'rpc', // style |
|
155 | - 'encoded', // use |
|
149 | +$server->register('WSGetPortals', // method name |
|
150 | + array('getPortals' => 'tns:getPortals'), // input parameters |
|
151 | + array('return' => 'tns:portalList'), // output parameters |
|
152 | + 'urn:WSAccessUrl', // namespace |
|
153 | + 'urn:WSAccessUrl#WSGetPortals', // soapaction |
|
154 | + 'rpc', // style |
|
155 | + 'encoded', // use |
|
156 | 156 | 'This service adds a user to portal' // documentation |
157 | 157 | ); |
158 | 158 | |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | ); |
194 | 194 | |
195 | 195 | // Register the method to expose |
196 | -$server->register('WSAddUserToPortal', // method name |
|
197 | - array('addUserToPortal' => 'tns:AddUserToPortal'), // input parameters |
|
198 | - array('return' => 'xsd:string'), // output parameters |
|
199 | - 'urn:WSAccessUrl', // namespace |
|
200 | - 'urn:WSAccessUrl#WSAddUserToPortal', // soapaction |
|
201 | - 'rpc', // style |
|
202 | - 'encoded', // use |
|
196 | +$server->register('WSAddUserToPortal', // method name |
|
197 | + array('addUserToPortal' => 'tns:AddUserToPortal'), // input parameters |
|
198 | + array('return' => 'xsd:string'), // output parameters |
|
199 | + 'urn:WSAccessUrl', // namespace |
|
200 | + 'urn:WSAccessUrl#WSAddUserToPortal', // soapaction |
|
201 | + 'rpc', // style |
|
202 | + 'encoded', // use |
|
203 | 203 | 'This service adds a user to portal' // documentation |
204 | 204 | ); |
205 | 205 | |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | // Register the method to expose |
227 | -$server->register('WSRemoveUserFromPortal', // method name |
|
228 | - array('removeUserFromPortal' => 'tns:AddUserToPortal'), // input parameters |
|
229 | - array('return' => 'xsd:string'), // output parameters |
|
230 | - 'urn:WSAccessUrl', // namespace |
|
231 | - 'urn:WSAccessUrl#WSRemoveUserFromPortal', // soapaction |
|
232 | - 'rpc', // style |
|
233 | - 'encoded', // use |
|
227 | +$server->register('WSRemoveUserFromPortal', // method name |
|
228 | + array('removeUserFromPortal' => 'tns:AddUserToPortal'), // input parameters |
|
229 | + array('return' => 'xsd:string'), // output parameters |
|
230 | + 'urn:WSAccessUrl', // namespace |
|
231 | + 'urn:WSAccessUrl#WSRemoveUserFromPortal', // soapaction |
|
232 | + 'rpc', // style |
|
233 | + 'encoded', // use |
|
234 | 234 | 'This service remove a user from a portal' // documentation |
235 | 235 | ); |
236 | 236 | |
@@ -267,13 +267,13 @@ discard block |
||
267 | 267 | ); |
268 | 268 | |
269 | 269 | // Register the method to expose |
270 | -$server->register('WSGetPortalListFromUser', // method name |
|
271 | - array('getPortalListFromUser' => 'tns:getPortalListFromUser'), // input parameters |
|
272 | - array('return' => 'tns:portalList'), // output parameters |
|
273 | - 'urn:WSAccessUrl', // namespace |
|
274 | - 'urn:WSAccessUrl#WSGetPortalListFromUser', // soapaction |
|
275 | - 'rpc', // style |
|
276 | - 'encoded', // use |
|
270 | +$server->register('WSGetPortalListFromUser', // method name |
|
271 | + array('getPortalListFromUser' => 'tns:getPortalListFromUser'), // input parameters |
|
272 | + array('return' => 'tns:portalList'), // output parameters |
|
273 | + 'urn:WSAccessUrl', // namespace |
|
274 | + 'urn:WSAccessUrl#WSGetPortalListFromUser', // soapaction |
|
275 | + 'rpc', // style |
|
276 | + 'encoded', // use |
|
277 | 277 | 'This service remove a user from a portal' // documentation |
278 | 278 | ); |
279 | 279 | |
@@ -311,13 +311,13 @@ discard block |
||
311 | 311 | ); |
312 | 312 | |
313 | 313 | // Register the method to expose |
314 | -$server->register('WSGetPortalListFromCourse', // method name |
|
315 | - array('getPortalListFromCourse' => 'tns:getPortalListFromCourse'), // input parameters |
|
316 | - array('return' => 'tns:portalList'), // output parameters |
|
317 | - 'urn:WSAccessUrl', // namespace |
|
318 | - 'urn:WSAccessUrl#getPortalListFromCourse', // soapaction |
|
319 | - 'rpc', // style |
|
320 | - 'encoded', // use |
|
314 | +$server->register('WSGetPortalListFromCourse', // method name |
|
315 | + array('getPortalListFromCourse' => 'tns:getPortalListFromCourse'), // input parameters |
|
316 | + array('return' => 'tns:portalList'), // output parameters |
|
317 | + 'urn:WSAccessUrl', // namespace |
|
318 | + 'urn:WSAccessUrl#getPortalListFromCourse', // soapaction |
|
319 | + 'rpc', // style |
|
320 | + 'encoded', // use |
|
321 | 321 | 'This service remove a user from a portal' // documentation |
322 | 322 | ); |
323 | 323 | |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | ); |
362 | 362 | |
363 | 363 | // Register the method to expose |
364 | -$server->register('WSAddCourseToPortal', // method name |
|
365 | - array('addCourseToPortal' => 'tns:addCourseToPortal'), // input parameters |
|
366 | - array('return' => 'xsd:string'), // output parameters |
|
367 | - 'urn:WSAccessUrl', // namespace |
|
368 | - 'urn:WSAccessUrl#WSAddCourseToPortal', // soapaction |
|
369 | - 'rpc', // style |
|
370 | - 'encoded', // use |
|
364 | +$server->register('WSAddCourseToPortal', // method name |
|
365 | + array('addCourseToPortal' => 'tns:addCourseToPortal'), // input parameters |
|
366 | + array('return' => 'xsd:string'), // output parameters |
|
367 | + 'urn:WSAccessUrl', // namespace |
|
368 | + 'urn:WSAccessUrl#WSAddCourseToPortal', // soapaction |
|
369 | + 'rpc', // style |
|
370 | + 'encoded', // use |
|
371 | 371 | 'This service adds a course to portal' // documentation |
372 | 372 | ); |
373 | 373 | |
@@ -394,13 +394,13 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | // Register the method to expose |
397 | -$server->register('WSRemoveCourseFromPortal', // method name |
|
398 | - array('removeCourseFromPortal' => 'tns:addCourseToPortal'), // input parameters |
|
399 | - array('return' => 'xsd:string'), // output parameters |
|
400 | - 'urn:WSAccessUrl', // namespace |
|
401 | - 'urn:WSAccessUrl#WSRemoveCourseFromPortal', // soapaction |
|
402 | - 'rpc', // style |
|
403 | - 'encoded', // use |
|
397 | +$server->register('WSRemoveCourseFromPortal', // method name |
|
398 | + array('removeCourseFromPortal' => 'tns:addCourseToPortal'), // input parameters |
|
399 | + array('return' => 'xsd:string'), // output parameters |
|
400 | + 'urn:WSAccessUrl', // namespace |
|
401 | + 'urn:WSAccessUrl#WSRemoveCourseFromPortal', // soapaction |
|
402 | + 'rpc', // style |
|
403 | + 'encoded', // use |
|
404 | 404 | 'This service remove a course from a portal' // documentation |
405 | 405 | ); |
406 | 406 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param WSErrorHandler Error handler |
50 | 50 | */ |
51 | 51 | public static function setErrorHandler($handler) { |
52 | - if($handler instanceof WSErrorHandler) { |
|
52 | + if ($handler instanceof WSErrorHandler) { |
|
53 | 53 | self::$_handler = $handler; |
54 | 54 | } |
55 | 55 | } |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | // if we are behind a reverse proxy, assume it will send the |
115 | 115 | // HTTP_X_FORWARDED_FOR header and use this IP instead |
116 | 116 | if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
117 | - list($ip1,$ip2) = preg_split('/,/',$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
117 | + list($ip1, $ip2) = preg_split('/,/', $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
118 | 118 | $ip = trim($ip1); |
119 | 119 | } |
120 | 120 | $security_key = $ip.$this->_configuration['security_key']; |
121 | 121 | |
122 | - if(!api_is_valid_secret_key($secret_key, $security_key)) { |
|
122 | + if (!api_is_valid_secret_key($secret_key, $security_key)) { |
|
123 | 123 | return new WSError(1, "API key is invalid"); |
124 | 124 | } else { |
125 | 125 | return null; |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | * @return mixed System user id if the user was found, WSError otherwise |
137 | 137 | */ |
138 | 138 | protected function getUserId($user_id_field_name, $user_id_value) { |
139 | - if($user_id_field_name == "chamilo_user_id") { |
|
140 | - if(UserManager::is_user_id_valid(intval($user_id_value))) { |
|
139 | + if ($user_id_field_name == "chamilo_user_id") { |
|
140 | + if (UserManager::is_user_id_valid(intval($user_id_value))) { |
|
141 | 141 | return intval($user_id_value); |
142 | 142 | } else { |
143 | 143 | return new WSError(100, "User not found"); |
144 | 144 | } |
145 | 145 | } else { |
146 | 146 | $user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name); |
147 | - if($user_id == 0) { |
|
147 | + if ($user_id == 0) { |
|
148 | 148 | return new WSError(100, "User not found"); |
149 | 149 | } else { |
150 | 150 | return $user_id; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | protected function getSessionId($session_id_field_name, $session_id_value) |
198 | 198 | { |
199 | 199 | if ($session_id_field_name == "chamilo_session_id") { |
200 | - $session = SessionManager::fetch((int)$session_id_value); |
|
200 | + $session = SessionManager::fetch((int) $session_id_value); |
|
201 | 201 | if (!empty($session)) { |
202 | 202 | return intval($session_id_value); |
203 | 203 | } else { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $soap_error = $client->getError(); |
34 | 34 | |
35 | 35 | if (!empty($soap_error)) { |
36 | - $error_message = 'Nusoap object creation failed: ' . $soap_error; |
|
36 | + $error_message = 'Nusoap object creation failed: '.$soap_error; |
|
37 | 37 | throw new Exception($error_message); |
38 | 38 | } |
39 | 39 | $client->setDebugLevel(10000); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $ip_address = "127.0.0.1"; |
46 | 46 | |
47 | 47 | //Secret key |
48 | -$secret_key = sha1($ip_address.$security_key);// Hash of the combination of IP Address + Chamilo security key |
|
48 | +$secret_key = sha1($ip_address.$security_key); // Hash of the combination of IP Address + Chamilo security key |
|
49 | 49 | //$secret_key = sha1($security_key); |
50 | 50 | |
51 | 51 | //Creating a random user_id, this values need to be provided from your system |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | if ($err) { |
95 | 95 | // Display the error |
96 | - echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; |
|
96 | + echo '<h2>Constructor error</h2><pre>'.$err.'</pre>'; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -325,14 +325,14 @@ discard block |
||
325 | 325 | |
326 | 326 | if ($err) { |
327 | 327 | // Display the error |
328 | - echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; |
|
328 | + echo '<h2>Constructor error</h2><pre>'.$err.'</pre>'; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
332 | 332 | //1. Create user webservice |
333 | 333 | $result = $client->call( |
334 | 334 | 'WSGetPortals', |
335 | - array('getPortals' => [ 'secret_key' => $secret_key]) |
|
335 | + array('getPortals' => ['secret_key' => $secret_key]) |
|
336 | 336 | ); |
337 | 337 | |
338 | 338 | $result = $client->call( |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | ); |
364 | 364 | |
365 | 365 | |
366 | -var_dump($user_id);exit; |
|
366 | +var_dump($user_id); exit; |
|
367 | 367 | |
368 | 368 | |
369 | 369 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $err = $client->getError(); |
383 | 383 | if ($err) { |
384 | 384 | // Display the error |
385 | - echo '<h2>Error</h2><pre>' . $err . '</pre>'; |
|
385 | + echo '<h2>Error</h2><pre>'.$err.'</pre>'; |
|
386 | 386 | } else { |
387 | 387 | // Display the result |
388 | 388 | echo '<h2>There are no errors</h2>'; |