Passed
Push — 1.10.x ( 767d99...288426 )
by Yannick
44:51
created
main/webservices/testip.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
main/webservices/webservice_report.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
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/cm_webservice_user.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function find_id_user($username, $password, $name)
15 15
     {
16
-        if($this->verifyUserPass($username, $password) == "valid")
16
+        if ($this->verifyUserPass($username, $password) == "valid")
17 17
         {
18 18
 
19 19
             $listResult = "#";
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
             }
41 41
 
42 42
             $listArrayResult = array_unique($listArray);
43
-            foreach($listArrayResult as $result)
43
+            foreach ($listArrayResult as $result)
44 44
             {
45
-                $listResult .= $result . "#";
45
+                $listResult .= $result."#";
46 46
             }
47 47
 
48 48
             return $listResult;
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
         if ($this->verifyUserPass($username, $password) == "valid") {
98 98
 		    $user_id = UserManager::get_user_id_from_username($username);
99 99
             $message_title = get_lang('Invitation');
100
-            $count_is_true = SocialManager::send_invitation_friend($user_id,$userfriend_id, $message_title, $content_message);
100
+            $count_is_true = SocialManager::send_invitation_friend($user_id, $userfriend_id, $message_title, $content_message);
101 101
 
102 102
             if ($count_is_true) {
103
-                return Display::display_normal_message(api_htmlentities(get_lang('InvitationHasBeenSent'), ENT_QUOTES,$charset),false);
103
+                return Display::display_normal_message(api_htmlentities(get_lang('InvitationHasBeenSent'), ENT_QUOTES, $charset), false);
104 104
             } else {
105
-                return Display::display_error_message(api_htmlentities(get_lang('YouAlreadySentAnInvitation'), ENT_QUOTES,$charset),false);
105
+                return Display::display_error_message(api_htmlentities(get_lang('YouAlreadySentAnInvitation'), ENT_QUOTES, $charset), false);
106 106
             }
107 107
         }
108 108
         return get_lang('InvalidId');
Please login to merge, or discard this patch.
main/webservices/lp.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     }
66 66
 
67 67
     if ($debug) {
68
-        error_log("checkip " . intval($check_ip));
68
+        error_log("checkip ".intval($check_ip));
69 69
     }
70 70
 
71 71
     if ($check_ip) {
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 );
121 121
 
122 122
 // Register the method to expose
123
-$server->register('WSImportLP',                            // method name
124
-    array('params' => 'tns:params'),  // input parameters
125
-    array('return' => 'xsd:string'),                                        // output parameters
126
-    'urn:WSLP',                                                   // namespace
127
-    'urn:WSLP#WSImportLP',                       // soapaction
128
-    'rpc',                                                                  // style
129
-    'encoded',                                                              // use
123
+$server->register('WSImportLP', // method name
124
+    array('params' => 'tns:params'), // input parameters
125
+    array('return' => 'xsd:string'), // output parameters
126
+    'urn:WSLP', // namespace
127
+    'urn:WSLP#WSImportLP', // soapaction
128
+    'rpc', // style
129
+    'encoded', // use
130 130
     'This service adds users'                                               // documentation
131 131
 );
132 132
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
     $uniqueFile = uniqid();
185 185
     $userId = 1; // admin
186
-    $filePath = api_get_path(SYS_ARCHIVE_PATH) . $uniqueFile;
186
+    $filePath = api_get_path(SYS_ARCHIVE_PATH).$uniqueFile;
187 187
     file_put_contents($filePath, $fileData);
188 188
 
189 189
     $fileName = $params['filename'];
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
     'all',
258 258
     '',
259 259
     array(
260
-        'id'    => array('name' => 'id',    'type' => 'xsd:string'),
261
-        'name'  => array('name' => 'name',  'type' => 'xsd:string'),
260
+        'id'    => array('name' => 'id', 'type' => 'xsd:string'),
261
+        'name'  => array('name' => 'name', 'type' => 'xsd:string'),
262 262
     )
263 263
 );
264 264
 
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
 );
275 275
 
276 276
 // Register the method to expose
277
-$server->register('WSGetLpList',                            // method name
278
-    array('params' => 'tns:paramsGetLpList'),  // input parameters
279
-    array('return' => 'tns:lpList'),                                        // output parameters
280
-    'urn:WSLP',                                                   // namespace
281
-    'urn:WSLP#WSGetLpList',                       // soapaction
282
-    'rpc',                                                                  // style
283
-    'encoded',                                                              // use
277
+$server->register('WSGetLpList', // method name
278
+    array('params' => 'tns:paramsGetLpList'), // input parameters
279
+    array('return' => 'tns:lpList'), // output parameters
280
+    'urn:WSLP', // namespace
281
+    'urn:WSLP#WSGetLpList', // soapaction
282
+    'rpc', // style
283
+    'encoded', // use
284 284
     'This service adds users'                                               // documentation
285 285
 );
286 286
 
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
 );
370 370
 
371 371
 // Register the method to expose
372
-$server->register('WSDeleteLp',                            // method name
373
-    array('params' => 'tns:paramsDeleteLp'),  // input parameters
374
-    array('return' => 'xsd:string'),                                        // output parameters
375
-    'urn:WSLP',                                                   // namespace
376
-    'urn:WSLP#WSDeleteLp',                       // soapaction
377
-    'rpc',                                                                  // style
378
-    'encoded',                                                              // use
372
+$server->register('WSDeleteLp', // method name
373
+    array('params' => 'tns:paramsDeleteLp'), // input parameters
374
+    array('return' => 'xsd:string'), // output parameters
375
+    'urn:WSLP', // namespace
376
+    'urn:WSLP#WSDeleteLp', // soapaction
377
+    'rpc', // style
378
+    'encoded', // use
379 379
     'This service deletes a LP'                                               // documentation
380 380
 );
381 381
 
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
     if ($lp) {
435 435
         if ($debug) error_log("LP deleted $lpId");
436 436
 
437
-        $course_dir = $courseInfo['directory'] . '/document';
437
+        $course_dir = $courseInfo['directory'].'/document';
438 438
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
439
-        $base_work_dir = $sys_course_path . $course_dir;
439
+        $base_work_dir = $sys_course_path.$course_dir;
440 440
 
441 441
         $items = $lp->get_flat_ordered_items_list($lpId, 0, $courseId);
442 442
 
@@ -495,9 +495,9 @@  discard block
 block discarded – undo
495 495
     'all',
496 496
     '',
497 497
     array(
498
-        'data'  => array('name' => 'data',  'type' => 'xsd:string'),
499
-        'title'  => array('name' => 'title',  'type' => 'xsd:string'),
500
-        'filename'  => array('name' => 'filename',  'type' => 'xsd:string'),
498
+        'data'  => array('name' => 'data', 'type' => 'xsd:string'),
499
+        'title'  => array('name' => 'title', 'type' => 'xsd:string'),
500
+        'filename'  => array('name' => 'filename', 'type' => 'xsd:string'),
501 501
     )
502 502
 );
503 503
 
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
 );
549 549
 
550 550
 // Register the method to expose
551
-$server->register('WSCreateLp',                            // method name
552
-    array('params' => 'tns:paramsCreateLp'),  // input parameters
553
-    array('return' => 'xsd:string'),                                        // output parameters
554
-    'urn:WSLP',                                                   // namespace
555
-    'urn:WSLP#WSCreateLp',                       // soapaction
556
-    'rpc',                                                                  // style
557
-    'encoded',                                                              // use
551
+$server->register('WSCreateLp', // method name
552
+    array('params' => 'tns:paramsCreateLp'), // input parameters
553
+    array('return' => 'xsd:string'), // output parameters
554
+    'urn:WSLP', // namespace
555
+    'urn:WSLP#WSCreateLp', // soapaction
556
+    'rpc', // style
557
+    'encoded', // use
558 558
     'This service creates a LP'                                               // documentation
559 559
 );
560 560
 
Please login to merge, or discard this patch.
main/webservices/cm_webservice_forum.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 
20 20
     public function get_foruns_id($username, $password, $course_code)
21 21
     {
22
-        if($this->verifyUserPass($username, $password) == "valid")
22
+        if ($this->verifyUserPass($username, $password) == "valid")
23 23
         {
24 24
             $course_db = CourseManager::get_course_information($course_code);
25
-            $foruns_info = get_forums($id='', $course_db['code']);
25
+            $foruns_info = get_forums($id = '', $course_db['code']);
26 26
             $foruns_id = '#';
27 27
             foreach ($foruns_info as $forum)
28 28
             {
29
-                if( isset($forum['forum_id']))
29
+                if (isset($forum['forum_id']))
30 30
                 {
31 31
                     $foruns_id .= $forum['forum_id']."#";
32 32
                 }
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function get_forum_title($username, $password, $course_code, $forum_id)
40 40
     {
41
-        if($this->verifyUserPass($username, $password) == "valid")
41
+        if ($this->verifyUserPass($username, $password) == "valid")
42 42
         {
43 43
             $course_db = CourseManager::get_course_information($course_code);
44 44
             $table_forums = Database :: get_course_table(TABLE_FORUM, $course_db['db_name']);
45 45
             $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']);
46 46
 
47
-            $sql="SELECT * FROM ".$table_forums." forums, ".$table_item_property." item_properties
47
+            $sql = "SELECT * FROM ".$table_forums." forums, ".$table_item_property." item_properties
48 48
                             WHERE item_properties.tool='".TOOL_FORUM."'
49 49
                             AND item_properties.ref='".Database::escape_string($forum_id)."'
50 50
                             AND forums.forum_id='".Database::escape_string($forum_id)."'";
51
-            $result=Database::query($sql);
52
-            $forum_info=Database::fetch_array($result);
51
+            $result = Database::query($sql);
52
+            $forum_info = Database::fetch_array($result);
53 53
             $forum_info['approval_direct_post'] = 0; // we can't anymore change this option, so it should always be activated
54 54
 
55 55
             $forum_title = utf8_decode($forum_info['forum_title']);
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 
61 61
     public function get_forum_threads_id($username, $password, $course_code, $forum_id)
62 62
     {
63
-        if($this->verifyUserPass($username, $password) == "valid") {
63
+        if ($this->verifyUserPass($username, $password) == "valid") {
64 64
             $threads_info = get_threads($forum_id, $course_code);
65 65
             $threads_id = '#';
66 66
             foreach ($threads_info as $thread)
67 67
             {
68
-                if( isset($thread['thread_id']))
68
+                if (isset($thread['thread_id']))
69 69
                 {
70 70
                     $threads_id .= $thread['thread_id']."#";
71 71
                 }
@@ -79,18 +79,18 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function get_forum_thread_data($username, $password, $course_code, $thread_id, $field)
81 81
     {
82
-        if($this->verifyUserPass($username, $password) == "valid")
82
+        if ($this->verifyUserPass($username, $password) == "valid")
83 83
         {
84 84
             $course_db = CourseManager::get_course_information($course_code);
85 85
             $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']);
86 86
             $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']);
87 87
 
88
-            $sql="SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties
88
+            $sql = "SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties
89 89
                             WHERE item_properties.tool='".TOOL_FORUM_THREAD."'
90 90
                             AND item_properties.ref='".Database::escape_string($thread_id)."'
91 91
                             AND threads.thread_id='".Database::escape_string($thread_id)."'";
92
-            $result=Database::query($sql);
93
-            $thread_info=Database::fetch_array($result);
92
+            $result = Database::query($sql);
93
+            $thread_info = Database::fetch_array($result);
94 94
 
95 95
             switch ($field)
96 96
             {
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 
122 122
     public function get_forum_thread_title($username, $password, $course_code, $thread_id)
123 123
     {
124
-        if($this->verifyUserPass($username, $password) == "valid")
124
+        if ($this->verifyUserPass($username, $password) == "valid")
125 125
         {
126 126
             $course_db = CourseManager::get_course_information($course_code);
127 127
             $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']);
128 128
             $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']);
129 129
 
130
-            $sql="SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties
130
+            $sql = "SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties
131 131
                             WHERE item_properties.tool='".TOOL_FORUM_THREAD."'
132 132
                             AND item_properties.ref='".Database::escape_string($thread_id)."'
133 133
                             AND threads.thread_id='".Database::escape_string($thread_id)."'";
134
-            $result=Database::query($sql);
135
-            $thread_info=Database::fetch_array($result);
134
+            $result = Database::query($sql);
135
+            $thread_info = Database::fetch_array($result);
136 136
 
137 137
             $htmlcode = true;
138 138
             $field_table = "thread_title";
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     public function get_posts_id($username, $password, $course_code, $thread_id)
148 148
     {
149
-        if($this->verifyUserPass($username, $password) == "valid")
149
+        if ($this->verifyUserPass($username, $password) == "valid")
150 150
         {
151 151
             $course_db = CourseManager::get_course_information($course_code);
152 152
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             $table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']);
155 155
 
156 156
             // note: change these SQL so that only the relevant fields of the user table are used
157
-            if (api_is_allowed_to_edit(null,true)) {
157
+            if (api_is_allowed_to_edit(null, true)) {
158 158
                 $sql = "SELECT * FROM $table_posts posts
159 159
                                     LEFT JOIN  $table_users users
160 160
                                             ON posts.poster_id=users.user_id
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
                                     AND posts.visible='1'
170 170
                                     ORDER BY posts.post_id ASC";
171 171
             }
172
-            $result=Database::query($sql);
173
-            while ($row=Database::fetch_array($result)) {
174
-                $posts_info[]=$row;
172
+            $result = Database::query($sql);
173
+            while ($row = Database::fetch_array($result)) {
174
+                $posts_info[] = $row;
175 175
             }
176 176
 
177 177
             $posts_id = '#';
178 178
 
179 179
             foreach ($posts_info as $post)
180 180
             {
181
-                if( isset($post['post_id']))
181
+                if (isset($post['post_id']))
182 182
                 {
183 183
                     $posts_id .= $post['post_id']."#";
184 184
                 }
@@ -190,16 +190,16 @@  discard block
 block discarded – undo
190 190
 
191 191
     public function get_post_data($username, $password, $course_code, $post_id, $field)
192 192
     {
193
-        if($this->verifyUserPass($username, $password) == "valid")
193
+        if ($this->verifyUserPass($username, $password) == "valid")
194 194
         {
195 195
             $course_db = CourseManager::get_course_information($course_code);
196 196
 
197 197
             $table_posts 	= Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']);
198 198
             $table_users 	= Database :: get_main_table(TABLE_MAIN_USER);
199 199
 
200
-            $sql="SELECT * FROM ".$table_posts."posts, ".$table_users." users WHERE posts.poster_id=users.user_id AND posts.post_id='".Database::escape_string($post_id)."'";
201
-            $result=Database::query($sql);
202
-            $post_info =Database::fetch_array($result);
200
+            $sql = "SELECT * FROM ".$table_posts."posts, ".$table_users." users WHERE posts.poster_id=users.user_id AND posts.post_id='".Database::escape_string($post_id)."'";
201
+            $result = Database::query($sql);
202
+            $post_info = Database::fetch_array($result);
203 203
 
204 204
             $htmlcode = false;
205 205
             switch ($field)
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
     public function send_post($username, $password, $course_code, $forum_id, $thread_id, $title, $content)
234 234
     {
235
-        if($this->verifyUserPass($username, $password) == "valid")
235
+        if ($this->verifyUserPass($username, $password) == "valid")
236 236
         {
237 237
             $course_db = CourseManager::get_course_information($course_code);
238 238
 
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
             $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']);
241 241
             $forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT, $course_db['db_name']);
242 242
             $table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']);
243
-            $post_date=date('Y-m-d H:i:s');
244
-            $visible=1;
245
-            $has_attachment=false;
243
+            $post_date = date('Y-m-d H:i:s');
244
+            $visible = 1;
245
+            $has_attachment = false;
246 246
             $my_post = '';
247 247
             $post_notification = '';
248 248
 
@@ -251,19 +251,19 @@  discard block
 block discarded – undo
251 251
             $title = htmlentities($title);
252 252
             $content = htmlentities($content);
253 253
 
254
-            $sql="INSERT INTO $table_posts (post_title, post_text, thread_id, forum_id, poster_id, post_date, post_notification, post_parent_id, visible)
254
+            $sql = "INSERT INTO $table_posts (post_title, post_text, thread_id, forum_id, poster_id, post_date, post_notification, post_parent_id, visible)
255 255
                             VALUES ('".Database::escape_string($title)."',
256 256
                                             '".Database::escape_string(isset($content) ? (api_html_entity_decode($content)) : null)."',
257 257
                                             '".Database::escape_string($thread_id)."',
258 258
                                             '".Database::escape_string($forum_id)."',
259 259
                                             '".Database::escape_string($user_id)."',
260 260
                                             '".Database::escape_string($post_date)."',
261
-                                            '".Database::escape_string(isset($post_notification)?$post_notification:null)."',
262
-                                            '".Database::escape_string(isset($my_post)?$my_post:null)."',
261
+                                            '".Database::escape_string(isset($post_notification) ? $post_notification : null)."',
262
+                                            '".Database::escape_string(isset($my_post) ? $my_post : null)."',
263 263
                                             '".Database::escape_string($visible)."')";
264 264
 
265 265
 
266
-            $result=Database::query($sql);
266
+            $result = Database::query($sql);
267 267
             return "Post enviado!";
268 268
 //return $sql;
269 269
 
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.