Completed
Pull Request — 1.11.x (#1599)
by José
28:19
created
main/webservices/access_url.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
main/webservices/webservice.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 {
Please login to merge, or discard this patch.
main/webservices/client_soap.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>';
Please login to merge, or discard this patch.
main/webservices/user_info.soap.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
         'all',
27 27
         '',
28 28
         array(
29
-          'name'=>'code'  , 'type'=>'xsd:string',
30
-          'name'=>'title'  , 'type'=>'xsd:string',
31
-          'name'=>'url'    , 'type'=>'xsd:string',
29
+          'name'=>'code', 'type'=>'xsd:string',
30
+          'name'=>'title', 'type'=>'xsd:string',
31
+          'name'=>'url', 'type'=>'xsd:string',
32 32
           'name'=>'teacher', 'type'=>'xsd:string',
33
-          'name'=>'language','type'=>'xsd:string',
33
+          'name'=>'language', 'type'=>'xsd:string',
34 34
         )
35 35
 );
36 36
 
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 );
50 50
 
51 51
 // Register the method to expose
52
-$server->register('WSCourseListOfUser',   // method name
52
+$server->register('WSCourseListOfUser', // method name
53 53
     array('username' => 'xsd:string',
54
-          'signature' => 'xsd:string'),         // input parameters
55
-    array('return' => 'xsd:Array'),             // output parameters
56
-    'urn:WSUserInfo',                           // namespace
57
-    'urn:WSUserInfo#WSUserInfo',          // soapaction
58
-    'rpc',                                      // style
59
-    'encoded',                                  // use
54
+          'signature' => 'xsd:string'), // input parameters
55
+    array('return' => 'xsd:Array'), // output parameters
56
+    'urn:WSUserInfo', // namespace
57
+    'urn:WSUserInfo#WSUserInfo', // soapaction
58
+    'rpc', // style
59
+    'encoded', // use
60 60
     'This service returns a list of courses'    // documentation
61 61
 );
62 62
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
     'all',
105 105
     '',
106 106
     array(
107
-        'name'=>'datestart','type'=>'xsd:string',
108
-        'name'=>'dateend','type'=>'xsd:string',
109
-        'name'=>'title','type'=>'xsd:string',
110
-        'name'=>'link','type'=>'xsd:string',
111
-        'name'=>'coursetitle','type'=>'xsd:string',
107
+        'name'=>'datestart', 'type'=>'xsd:string',
108
+        'name'=>'dateend', 'type'=>'xsd:string',
109
+        'name'=>'title', 'type'=>'xsd:string',
110
+        'name'=>'link', 'type'=>'xsd:string',
111
+        'name'=>'coursetitle', 'type'=>'xsd:string',
112 112
     )
113 113
 );
114 114
 
@@ -127,16 +127,16 @@  discard block
 block discarded – undo
127 127
 );
128 128
 
129 129
 // Register the method to expose
130
-$server->register('WSEventsList',       // method name
130
+$server->register('WSEventsList', // method name
131 131
     array('username' => 'xsd:string',
132 132
           'signature' => 'xsd:string',
133 133
           'datestart' => 'xsd:int',
134
-          'dateend'   => 'xsd:int'),          // input parameters
135
-    array('return' => 'xsd:Array'),           // output parameters
136
-    'urn:WSUserInfo',                         // namespace
137
-    'urn:WSUserInfo#WSEventsList',      // soapaction
138
-    'rpc',                                    // style
139
-    'encoded',                                // use
134
+          'dateend'   => 'xsd:int'), // input parameters
135
+    array('return' => 'xsd:Array'), // output parameters
136
+    'urn:WSUserInfo', // namespace
137
+    'urn:WSUserInfo#WSEventsList', // soapaction
138
+    'rpc', // style
139
+    'encoded', // use
140 140
     'This service returns a list of events of the courses the given user is subscribed to'      // documentation
141 141
 );
142 142
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 
172 172
     $user_id = UserManager::get_user_id_from_username($username);
173 173
     if ($user_id === false) { return $events_list; } // Error in user id recovery.
174
-    $ds = substr($datestart,0,4).'-'.substr($datestart,4,2).'-'.substr($datestart,6,2).' 00:00:00';
175
-    $de = substr($dateend,0,4).'-'.substr($dateend,4,2).'-'.substr($dateend,6,2).' 00:00:00';
174
+    $ds = substr($datestart, 0, 4).'-'.substr($datestart, 4, 2).'-'.substr($datestart, 6, 2).' 00:00:00';
175
+    $de = substr($dateend, 0, 4).'-'.substr($dateend, 4, 2).'-'.substr($dateend, 6, 2).' 00:00:00';
176 176
     $events_list = Agenda::get_personal_agenda_items_between_dates($user_id, $ds, $de);
177 177
     return $events_list;
178 178
 }
Please login to merge, or discard this patch.
main/webservices/webservice_session.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 		$coachStartDate = null;
55 55
 		if (!empty($nb_days_access_before)) {
56 56
 			$day = intval($nb_days_access_before);
57
-			$coachStartDate = date('Y-m-d ', strtotime($start_date. ' + '.$day.' days'));
57
+			$coachStartDate = date('Y-m-d ', strtotime($start_date.' + '.$day.' days'));
58 58
 		}
59 59
 
60 60
 		$coachEndDate = null;
61 61
 		if (!empty($nb_days_access_after)) {
62 62
 			$day = intval($nb_days_access_after);
63
-			$coachEndDate = date('Y-m-d ', strtotime($end_date. ' + '.$day.' days'));
63
+			$coachEndDate = date('Y-m-d ', strtotime($end_date.' + '.$day.' days'));
64 64
 		}
65 65
 
66 66
 		// Try to create the session
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 			0,
77 77
 			$visibility
78 78
 		);
79
-		if(!is_int($session_id)) {
79
+		if (!is_int($session_id)) {
80 80
 			return new WSError(301, 'Could not create the session');
81 81
 		} else {
82 82
 			// Add the Original session id to the extra fields
83 83
 			$extras_associative = array();
84
-			if($session_id_field_name != "chamilo_session_id") {
84
+			if ($session_id_field_name != "chamilo_session_id") {
85 85
 				$extras_associative[$session_id_field_name] = $session_id_value;
86 86
 			}
87
-			foreach($extras as $extra) {
87
+			foreach ($extras as $extra) {
88 88
 				$extras_associative[$extra['field_name']] = $extra['field_value'];
89 89
 			}
90 90
 			// Create the extra fields
91
-			foreach($extras_associative as $fname => $fvalue) {
91
+			foreach ($extras_associative as $fname => $fvalue) {
92 92
 				SessionManager::create_session_extra_field($fname, 1, $fname);
93 93
 				SessionManager::update_session_extra_field_value(
94 94
 					$session_id,
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function CreateSession($secret_key, $name, $start_date, $end_date, $nb_days_access_before, $nb_days_access_after, $nolimit, $visibility, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $extras) {
122 122
 		$verifKey = $this->verifyKey($secret_key);
123
-		if($verifKey instanceof WSError) {
123
+		if ($verifKey instanceof WSError) {
124 124
 			$this->handleError($verifKey);
125 125
 		} else {
126 126
 			$session_id = $this->createSessionHelper($name, $start_date, $end_date, $nb_days_access_before, $nb_days_access_after, $nolimit, $visibility, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $extras);
127
-			if($session_id instanceof WSError) {
127
+			if ($session_id instanceof WSError) {
128 128
 				$this->handleError($session_id);
129 129
 			} else {
130 130
 				return $session_id;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	protected function deleteSessionHelper($session_id_field_name, $session_id_value) {
143 143
 		$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
144
-		if($session_id instanceof WSError) {
144
+		if ($session_id instanceof WSError) {
145 145
 			return $session_id;
146 146
 		} else {
147 147
 			SessionManager::delete($session_id, true);
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function DeleteSession($secret_key, $session_id_field_name, $session_id_value) {
160 160
 		$verifKey = $this->verifyKey($secret_key);
161
-		if($verifKey instanceof WSError) {
161
+		if ($verifKey instanceof WSError) {
162 162
 			$this->handleError($verifKey);
163 163
 		} else {
164 164
 			$result = $this->deleteSessionHelper($session_id_field_name, $session_id_value);
165
-			if($result instanceof WSError) {
165
+			if ($result instanceof WSError) {
166 166
 				$this->handleError($result);
167 167
 			}
168 168
 		}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         $extras
201 201
     ) {
202 202
 		$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
203
-		if($session_id instanceof WSError) {
203
+		if ($session_id instanceof WSError) {
204 204
 			return $session_id;
205 205
 		} else {
206 206
 			// Verify that coach exists and get its id
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
             $coachStartDate = null;
213 213
             if (!empty($nb_days_access_before)) {
214 214
                 $day = intval($nb_days_access_before);
215
-                $coachStartDate = date('Y-m-d ', strtotime($start_date. ' + '.$day.' days'));
215
+                $coachStartDate = date('Y-m-d ', strtotime($start_date.' + '.$day.' days'));
216 216
             }
217 217
 
218 218
             $coachEndDate = null;
219 219
             if (!empty($nb_days_access_after)) {
220 220
                 $day = intval($nb_days_access_after);
221
-                $coachEndDate = date('Y-m-d ', strtotime($end_date. ' + '.$day.' days'));
221
+                $coachEndDate = date('Y-m-d ', strtotime($end_date.' + '.$day.' days'));
222 222
             }
223 223
 
224 224
             $result_id = SessionManager::edit_session(
@@ -232,18 +232,18 @@  discard block
 block discarded – undo
232 232
                 $coachEndDate,
233 233
                 $user_id,
234 234
                 0,
235
-                (int)$visibility
235
+                (int) $visibility
236 236
             );
237
-			if(!is_int($result_id)) {
237
+			if (!is_int($result_id)) {
238 238
 				return new WSError(302, 'Could not edit the session');
239 239
 			} else {
240
-				if(!empty($extras)) {
240
+				if (!empty($extras)) {
241 241
 					$extras_associative = array();
242
-					foreach($extras as $extra) {
242
+					foreach ($extras as $extra) {
243 243
 						$extras_associative[$extra['field_name']] = $extra['field_value'];
244 244
 					}
245 245
 					// Create the extra fields
246
-					foreach($extras_associative as $fname => $fvalue) {
246
+					foreach ($extras_associative as $fname => $fvalue) {
247 247
 						SessionManager::create_session_extra_field($fname, 1, $fname);
248 248
 						SessionManager::update_session_extra_field_value($session_id, $fname, $fvalue);
249 249
 					}
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function EditSession($secret_key, $name, $start_date, $end_date, $nb_days_access_before, $nb_days_access_after, $nolimit, $visibility, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $extras) {
274 274
 		$verifKey = $this->verifyKey($secret_key);
275
-		if($verifKey instanceof WSError) {
275
+		if ($verifKey instanceof WSError) {
276 276
 			$this->handleError($verifKey);
277 277
 		} else {
278 278
 			$result = $this->editSessionHelper($name, $start_date, $end_date, $nb_days_access_before, $nb_days_access_after, $nolimit, $visibility, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $extras);
279
-			if($session_id_value instanceof WSError) {
279
+			if ($session_id_value instanceof WSError) {
280 280
 				$this->handleError($result);
281 281
 			}
282 282
 		}
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	protected function changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $state) {
296 296
 		$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
297
-		if($session_id instanceof WSError) {
297
+		if ($session_id instanceof WSError) {
298 298
 			return $session_id;
299 299
 		} else {
300 300
 			$user_id = $this->getUserId($user_id_field_name, $user_id_value);
301
-			if($user_id instanceof WSError) {
301
+			if ($user_id instanceof WSError) {
302 302
 				return $user_id;
303 303
 			} else {
304
-				if($state  == 1) {
304
+				if ($state == 1) {
305 305
 					SessionManager::suscribe_users_to_session($session_id, array($user_id));
306 306
 				} else {
307 307
 					$result = SessionManager::unsubscribe_user_from_session($session_id, $user_id);
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	public function SubscribeUserToSession($secret_key, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value) {
327 327
 		$verifKey = $this->verifyKey($secret_key);
328
-		if($verifKey instanceof WSError) {
328
+		if ($verifKey instanceof WSError) {
329 329
 			$this->handleError($verifKey);
330 330
 		} else {
331 331
 			$result = $this->changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, 1);
332
-			if($result instanceof WSError) {
332
+			if ($result instanceof WSError) {
333 333
 				$this->handleError($result);
334 334
 			}
335 335
 		}
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
 	 */
347 347
 	public function UnsubscribeUserFromSession($secret_key, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value) {
348 348
 		$verifKey = $this->verifyKey($secret_key);
349
-		if($verifKey instanceof WSError) {
349
+		if ($verifKey instanceof WSError) {
350 350
 			$this->handleError($verifKey);
351 351
 		} else {
352 352
 			$result = $this->changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, 0);
353
-			if($result instanceof WSError) {
353
+			if ($result instanceof WSError) {
354 354
 				$this->handleError($result);
355 355
 			}
356 356
 		}
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                     if ($state == 1) {
386 386
                         SessionManager::set_coach_to_course_session($user_id, $session_id, $course_id);
387 387
                     } else {
388
-                        $user_id = array (0 => $user_id);
388
+                        $user_id = array(0 => $user_id);
389 389
                         $result = SessionManager::removeUsersFromCourseSession($user_id, $session_id, $course_id);
390 390
                         if (!$result) {
391 391
                             return new WSError(303, 'There was an error unsubscribing this Teacher from the session');
@@ -457,14 +457,14 @@  discard block
 block discarded – undo
457 457
 	 */
458 458
 	protected function changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, $state) {
459 459
 		$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
460
-		if($session_id instanceof WSError) {
460
+		if ($session_id instanceof WSError) {
461 461
 			return $session_id;
462 462
 		} else {
463 463
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
464
-			if($course_id instanceof WSError) {
464
+			if ($course_id instanceof WSError) {
465 465
 				return $course_id;
466 466
 			} else {
467
-				if($state  == 1) {
467
+				if ($state == 1) {
468 468
 					SessionManager::add_courses_to_session($session_id, array($course_id));
469 469
 					return true;
470 470
 				} else {
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	public function SubscribeCourseToSession($secret_key, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) {
492 492
 		$verifKey = $this->verifyKey($secret_key);
493
-		if($verifKey instanceof WSError) {
493
+		if ($verifKey instanceof WSError) {
494 494
 			$this->handleError($verifKey);
495 495
 		} else {
496 496
 			$result = $this->changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, 1);
497
-			if($result instanceof WSError) {
497
+			if ($result instanceof WSError) {
498 498
 				$this->handleError($result);
499 499
 			}
500 500
 		}
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
 	 */
512 512
 	public function UnsubscribeCourseFromSession($secret_key, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) {
513 513
 		$verifKey = $this->verifyKey($secret_key);
514
-		if($verifKey instanceof WSError) {
514
+		if ($verifKey instanceof WSError) {
515 515
 			$this->handleError($verifKey);
516 516
 		} else {
517 517
 			$result = $this->changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, 0);
518
-			if($result instanceof WSError) {
518
+			if ($result instanceof WSError) {
519 519
 				$this->handleError($result);
520 520
 			}
521 521
 		}
Please login to merge, or discard this patch.
main/webservices/soap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * Singleton method
44 44
 	 */
45 45
 	public static function singleton() {
46
-		if(!isset(self::$_instance)) {
46
+		if (!isset(self::$_instance)) {
47 47
 			self::$_instance = new soap_server();
48 48
 			// Set the error handler
49 49
 			WSError::setErrorHandler(new WSSoapErrorHandler());
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
   '',
89 89
   'SOAP-ENC:Array',
90 90
   array(),
91
-  array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:extras[]')),'tns:extras'
91
+  array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:extras[]')), 'tns:extras'
92 92
 );
93 93
 
94 94
 /*
Please login to merge, or discard this patch.
main/webservices/test.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
 $script = isset($_POST['script']) ? $_POST['script'] : false;
16 16
 $function = isset($_POST['function']) ? $_POST['function'] : false;
17 17
 
18
-$contact= $server.$script.'?wsdl';
18
+$contact = $server.$script.'?wsdl';
19 19
 
20 20
 $client = new nusoap_client($contact);
21 21
 $err = $client->getError();
22 22
 if ($err) {
23 23
     // Display the error
24
-    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
24
+    echo '<h2>Constructor error</h2><pre>'.$err.'</pre>';
25 25
     // At this point, you know the call that follows will fail
26 26
 }
27 27
 $response = array();
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 $list = scandir($serversys);
38 38
 $scripts = array();
39 39
 foreach ($list as $item) {
40
-    if (substr($item,0,1) == '.') { continue; }
41
-    if (substr($item,-8)=='soap.php') {
40
+    if (substr($item, 0, 1) == '.') { continue; }
41
+    if (substr($item, -8) == 'soap.php') {
42 42
         $scripts[] = $item;
43 43
     }
44 44
 }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 ?>
56 56
 </select><br />
57 57
 <label for="function">Function</label>
58
-<input type="text" name="function" value="<?php echo $function;?>"></input><br />
58
+<input type="text" name="function" value="<?php echo $function; ?>"></input><br />
59 59
 <label for="param[0]">Param 0</label>
60 60
 <input type="text" name="param[0]" ></input><br />
61 61
 <input type="submit" name="submit" value="Send"/>
Please login to merge, or discard this patch.
main/webservices/courses_list.soap.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
         'all',
29 29
         '',
30 30
         array(
31
-          'name'=>'code'  , 'type'=>'xsd:string',
32
-          'name'=>'title'  , 'type'=>'xsd:string',
33
-          'name'=>'url'    , 'type'=>'xsd:string',
31
+          'name'=>'code', 'type'=>'xsd:string',
32
+          'name'=>'title', 'type'=>'xsd:string',
33
+          'name'=>'url', 'type'=>'xsd:string',
34 34
           'name'=>'teacher', 'type'=>'xsd:string',
35
-          'name'=>'language','type'=>'xsd:string',
35
+          'name'=>'language', 'type'=>'xsd:string',
36 36
         )
37 37
 );
38 38
 
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 );
52 52
 
53 53
 // Register the method to expose
54
-$server->register('WSCourseList',         // method name
54
+$server->register('WSCourseList', // method name
55 55
     array('username' => 'xsd:string',
56 56
           'signature' => 'xsd:string',
57
-          'visibilities' => 'xsd:string'),      // input parameters
58
-    array('return' => 'xsd:Array'),             // output parameters
59
-    'urn:WSCourseList',                         // namespace
60
-    'urn:WSCourseList#WSCourseList',      // soapaction
61
-    'rpc',                                      // style
62
-    'encoded',                                  // use
57
+          'visibilities' => 'xsd:string'), // input parameters
58
+    array('return' => 'xsd:Array'), // output parameters
59
+    'urn:WSCourseList', // namespace
60
+    'urn:WSCourseList#WSCourseList', // soapaction
61
+    'rpc', // style
62
+    'encoded', // use
63 63
     'This service returns a list of courses'    // documentation
64 64
 );
65 65
 
Please login to merge, or discard this patch.
main/webservices/user_import/service.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,5 +59,5 @@
 block discarded – undo
59 59
 
60 60
 $server->register('import_users_from_file');
61 61
 
62
-$http_request = (isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:'');
62
+$http_request = (isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
63 63
 $server->service($http_request);
Please login to merge, or discard this patch.