Completed
Push — 1.11.x ( 3ebade...c47d58 )
by José
213:48 queued 162:56
created
main/webservices/webservice.php 2 patches
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.
Indentation   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -11,237 +11,237 @@
 block discarded – undo
11 11
  */
12 12
 class WSError
13 13
 {
14
-	/**
15
-	 * Error handler. This needs to be a class that implements the interface WSErrorHandler
16
-	 *
17
-	 * @var WSErrorHandler
18
-	 */
19
-	protected static $_handler;
20
-
21
-	/**
22
-	 * Error code
23
-	 *
24
-	 * @var int
25
-	 */
26
-	public $code;
27
-
28
-	/**
29
-	 * Error message
30
-	 *
31
-	 * @var string
32
-	 */
33
-	public $message;
34
-
35
-	/**
36
-	 * Constructor
37
-	 *
38
-	 * @param int Error code
39
-	 * @param string Error message
40
-	 */
41
-	public function __construct($code, $message) {
42
-		$this->code = $code;
43
-		$this->message = $message;
44
-	}
45
-
46
-	/**
47
-	 * Sets the error handler
48
-	 *
49
-	 * @param WSErrorHandler Error handler
50
-	 */
51
-	public static function setErrorHandler($handler) {
52
-		if($handler instanceof WSErrorHandler) {
53
-			self::$_handler = $handler;
54
-		}
55
-	}
56
-
57
-	/**
58
-	 * Returns the error handler
59
-	 *
60
-	 * @return WSErrorHandler Error handler
61
-	 */
62
-	public static function getErrorHandler() {
63
-		return self::$_handler;
64
-	}
65
-
66
-	/**
67
-	 * Transforms the error into an array
68
-	 *
69
-	 * @return array Associative array with code and message
70
-	 */
71
-	public function toArray() {
72
-		return array('code' => $this->code, 'message' => $this->message);
73
-	}
14
+    /**
15
+     * Error handler. This needs to be a class that implements the interface WSErrorHandler
16
+     *
17
+     * @var WSErrorHandler
18
+     */
19
+    protected static $_handler;
20
+
21
+    /**
22
+     * Error code
23
+     *
24
+     * @var int
25
+     */
26
+    public $code;
27
+
28
+    /**
29
+     * Error message
30
+     *
31
+     * @var string
32
+     */
33
+    public $message;
34
+
35
+    /**
36
+     * Constructor
37
+     *
38
+     * @param int Error code
39
+     * @param string Error message
40
+     */
41
+    public function __construct($code, $message) {
42
+        $this->code = $code;
43
+        $this->message = $message;
44
+    }
45
+
46
+    /**
47
+     * Sets the error handler
48
+     *
49
+     * @param WSErrorHandler Error handler
50
+     */
51
+    public static function setErrorHandler($handler) {
52
+        if($handler instanceof WSErrorHandler) {
53
+            self::$_handler = $handler;
54
+        }
55
+    }
56
+
57
+    /**
58
+     * Returns the error handler
59
+     *
60
+     * @return WSErrorHandler Error handler
61
+     */
62
+    public static function getErrorHandler() {
63
+        return self::$_handler;
64
+    }
65
+
66
+    /**
67
+     * Transforms the error into an array
68
+     *
69
+     * @return array Associative array with code and message
70
+     */
71
+    public function toArray() {
72
+        return array('code' => $this->code, 'message' => $this->message);
73
+    }
74 74
 }
75 75
 
76 76
 /**
77 77
  * Interface that must be implemented by any error handler
78 78
  */
79 79
 interface WSErrorHandler {
80
-	/**
81
-	 * Handle method
82
-	 *
83
-	 * @param WSError Error
84
-	 */
85
-	public function handle($error);
80
+    /**
81
+     * Handle method
82
+     *
83
+     * @param WSError Error
84
+     */
85
+    public function handle($error);
86 86
 }
87 87
 
88 88
 /**
89 89
  * Main class of the webservice. Webservice classes extend this class
90 90
  */
91 91
 class WS {
92
-	/**
93
-	 * Chamilo configuration
94
-	 *
95
-	 * @var array
96
-	 */
97
-	protected $_configuration;
98
-
99
-	/**
100
-	 * Constructor
101
-	 */
102
-	public function __construct() {
103
-		$this->_configuration = $GLOBALS['_configuration'];
104
-	}
105
-
106
-	/**
107
-	 * Verifies the API key
108
-	 *
109
-	 * @param string Secret key
110
-	 * @return mixed WSError in case of failure, null in case of success
111
-	 */
112
-	protected function verifyKey($secret_key) {
113
-		$ip = trim($_SERVER['REMOTE_ADDR']);
114
-		// if we are behind a reverse proxy, assume it will send the
115
-		// HTTP_X_FORWARDED_FOR header and use this IP instead
116
-		if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
117
-			list($ip1,$ip2) = preg_split('/,/',$_SERVER['HTTP_X_FORWARDED_FOR']);
118
-			$ip = trim($ip1);
119
-		}
120
-		$security_key = $ip.$this->_configuration['security_key'];
121
-
122
-		if(!api_is_valid_secret_key($secret_key, $security_key)) {
123
-			return new WSError(1, "API key is invalid");
124
-		} else {
125
-			return null;
126
-		}
127
-	}
128
-
129
-	/**
130
-	 * Gets the real user id based on the user id field name and value.
131
-	 * Note that if the user id field name is "chamilo_user_id", it will use the user id
132
-	 * in the system database
133
-	 *
134
-	 * @param string User id field name
135
-	 * @param string User id value
136
-	 * @return mixed System user id if the user was found, WSError otherwise
137
-	 */
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))) {
141
-				return intval($user_id_value);
142
-			} else {
143
-				return new WSError(100, "User not found");
144
-			}
145
-		} else {
146
-			$user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name);
147
-			if($user_id == 0) {
148
-				return new WSError(100, "User not found");
149
-			} else {
150
-				return $user_id;
151
-			}
152
-		}
153
-	}
154
-
155
-	/**
156
-	 * Gets the real course id based on the course id field name and value.
157
-	 * Note that if the course id field name is "chamilo_course_id", it will use the course id
158
-	 * in the system database
159
-	 *
160
-	 * @param string Course id field name
161
-	 * @param string Course id value
162
-	 * @return mixed System course id if the course was found, WSError otherwise
163
-	 */
164
-	protected function getCourseId($course_id_field_name, $course_id_value)
165
-	{
166
-		if ($course_id_field_name == "chamilo_course_id") {
167
-			if (CourseManager::get_course_code_from_course_id(
168
-					intval($course_id_value)
169
-				) != null
170
-			) {
171
-				return intval($course_id_value);
172
-			} else {
173
-				return new WSError(200, "Course not found");
174
-			}
175
-		} else {
176
-			$courseId = CourseManager::get_course_code_from_original_id(
177
-				$course_id_value,
178
-				$course_id_field_name
179
-			);
180
-			if (!empty($courseId)) {
181
-				return $courseId;
182
-			} else {
183
-				return new WSError(200, "Course not found");
184
-			}
185
-		}
186
-	}
187
-
188
-	/**
189
-	 * Gets the real session id based on the session id field name and value.
190
-	 * Note that if the session id field name is "chamilo_session_id", it will use the session id
191
-	 * in the system database
192
-	 *
193
-	 * @param string Session id field name
194
-	 * @param string Session id value
195
-	 * @return mixed System session id if the session was found, WSError otherwise
196
-	 */
197
-	protected function getSessionId($session_id_field_name, $session_id_value)
198
-	{
199
-		if ($session_id_field_name == "chamilo_session_id") {
200
-			$session = SessionManager::fetch((int)$session_id_value);
201
-			if (!empty($session)) {
202
-				return intval($session_id_value);
203
-			} else {
204
-				return new WSError(300, "Session not found");
205
-			}
206
-		} else {
207
-			$session_id = SessionManager::getSessionIdFromOriginalId(
208
-				$session_id_value,
209
-				$session_id_field_name
210
-			);
211
-			if ($session_id == 0) {
212
-				return new WSError(300, "Session not found");
213
-			} else {
214
-				return $session_id;
215
-			}
216
-		}
217
-	}
218
-
219
-	/**
220
-	 * Handles an error by calling the WSError error handler
221
-	 *
222
-	 * @param WSError Error
223
-	 */
224
-	protected function handleError($error) {
225
-		$handler = WSError::getErrorHandler();
226
-		$handler->handle($error);
227
-	}
228
-
229
-	/**
230
-	 * Gets a successful result
231
-	 *
232
-	 * @return array Array with a code of 0 and a message 'Operation was successful'
233
-	 */
234
-	protected function getSuccessfulResult() {
235
-		return array('code' => 0, 'message' => 'Operation was successful');
236
-	}
237
-
238
-	/**
239
-	 * Test function. Returns the string success
240
-	 *
241
-	 * @return string Success
242
-	 */
243
-	public function test() {
244
-		return "success";
245
-	}
92
+    /**
93
+     * Chamilo configuration
94
+     *
95
+     * @var array
96
+     */
97
+    protected $_configuration;
98
+
99
+    /**
100
+     * Constructor
101
+     */
102
+    public function __construct() {
103
+        $this->_configuration = $GLOBALS['_configuration'];
104
+    }
105
+
106
+    /**
107
+     * Verifies the API key
108
+     *
109
+     * @param string Secret key
110
+     * @return mixed WSError in case of failure, null in case of success
111
+     */
112
+    protected function verifyKey($secret_key) {
113
+        $ip = trim($_SERVER['REMOTE_ADDR']);
114
+        // if we are behind a reverse proxy, assume it will send the
115
+        // HTTP_X_FORWARDED_FOR header and use this IP instead
116
+        if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
117
+            list($ip1,$ip2) = preg_split('/,/',$_SERVER['HTTP_X_FORWARDED_FOR']);
118
+            $ip = trim($ip1);
119
+        }
120
+        $security_key = $ip.$this->_configuration['security_key'];
121
+
122
+        if(!api_is_valid_secret_key($secret_key, $security_key)) {
123
+            return new WSError(1, "API key is invalid");
124
+        } else {
125
+            return null;
126
+        }
127
+    }
128
+
129
+    /**
130
+     * Gets the real user id based on the user id field name and value.
131
+     * Note that if the user id field name is "chamilo_user_id", it will use the user id
132
+     * in the system database
133
+     *
134
+     * @param string User id field name
135
+     * @param string User id value
136
+     * @return mixed System user id if the user was found, WSError otherwise
137
+     */
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))) {
141
+                return intval($user_id_value);
142
+            } else {
143
+                return new WSError(100, "User not found");
144
+            }
145
+        } else {
146
+            $user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name);
147
+            if($user_id == 0) {
148
+                return new WSError(100, "User not found");
149
+            } else {
150
+                return $user_id;
151
+            }
152
+        }
153
+    }
154
+
155
+    /**
156
+     * Gets the real course id based on the course id field name and value.
157
+     * Note that if the course id field name is "chamilo_course_id", it will use the course id
158
+     * in the system database
159
+     *
160
+     * @param string Course id field name
161
+     * @param string Course id value
162
+     * @return mixed System course id if the course was found, WSError otherwise
163
+     */
164
+    protected function getCourseId($course_id_field_name, $course_id_value)
165
+    {
166
+        if ($course_id_field_name == "chamilo_course_id") {
167
+            if (CourseManager::get_course_code_from_course_id(
168
+                    intval($course_id_value)
169
+                ) != null
170
+            ) {
171
+                return intval($course_id_value);
172
+            } else {
173
+                return new WSError(200, "Course not found");
174
+            }
175
+        } else {
176
+            $courseId = CourseManager::get_course_code_from_original_id(
177
+                $course_id_value,
178
+                $course_id_field_name
179
+            );
180
+            if (!empty($courseId)) {
181
+                return $courseId;
182
+            } else {
183
+                return new WSError(200, "Course not found");
184
+            }
185
+        }
186
+    }
187
+
188
+    /**
189
+     * Gets the real session id based on the session id field name and value.
190
+     * Note that if the session id field name is "chamilo_session_id", it will use the session id
191
+     * in the system database
192
+     *
193
+     * @param string Session id field name
194
+     * @param string Session id value
195
+     * @return mixed System session id if the session was found, WSError otherwise
196
+     */
197
+    protected function getSessionId($session_id_field_name, $session_id_value)
198
+    {
199
+        if ($session_id_field_name == "chamilo_session_id") {
200
+            $session = SessionManager::fetch((int)$session_id_value);
201
+            if (!empty($session)) {
202
+                return intval($session_id_value);
203
+            } else {
204
+                return new WSError(300, "Session not found");
205
+            }
206
+        } else {
207
+            $session_id = SessionManager::getSessionIdFromOriginalId(
208
+                $session_id_value,
209
+                $session_id_field_name
210
+            );
211
+            if ($session_id == 0) {
212
+                return new WSError(300, "Session not found");
213
+            } else {
214
+                return $session_id;
215
+            }
216
+        }
217
+    }
218
+
219
+    /**
220
+     * Handles an error by calling the WSError error handler
221
+     *
222
+     * @param WSError Error
223
+     */
224
+    protected function handleError($error) {
225
+        $handler = WSError::getErrorHandler();
226
+        $handler->handle($error);
227
+    }
228
+
229
+    /**
230
+     * Gets a successful result
231
+     *
232
+     * @return array Array with a code of 0 and a message 'Operation was successful'
233
+     */
234
+    protected function getSuccessfulResult() {
235
+        return array('code' => 0, 'message' => 'Operation was successful');
236
+    }
237
+
238
+    /**
239
+     * Test function. Returns the string success
240
+     *
241
+     * @return string Success
242
+     */
243
+    public function test() {
244
+        return "success";
245
+    }
246 246
 }
247 247
 
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/lp.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -581,7 +581,7 @@
 block discarded – undo
581 581
     /*$sessionIdName = isset($params['session_id_name']) ? $params['session_id_name'] : null;
582 582
     $sessionIdValue = isset($params['session_id_value']) ? $params['session_id_value'] : null;*/
583 583
 
584
-     $courseInfo = CourseManager::getCourseInfoFromOriginalId(
584
+        $courseInfo = CourseManager::getCourseInfoFromOriginalId(
585 585
         $courseIdValue,
586 586
         $courseIdName
587 587
     );
Please login to merge, or discard this patch.
Braces   +48 added lines, -20 removed lines patch added patch discarded remove patch
@@ -48,19 +48,22 @@  discard block
 block discarded – undo
48 48
         list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
49 49
         $ip = trim($ip1);
50 50
     }
51
-    if ($debug)
52
-        error_log("ip: $ip");
51
+    if ($debug) {
52
+            error_log("ip: $ip");
53
+    }
53 54
     // Check if a file that limits access from webservices exists and contains
54 55
     // the restraining check
55 56
     if (is_file('webservice-auth-ip.conf.php')) {
56 57
         include 'webservice-auth-ip.conf.php';
57
-        if ($debug)
58
-            error_log("webservice-auth-ip.conf.php file included");
58
+        if ($debug) {
59
+                    error_log("webservice-auth-ip.conf.php file included");
60
+        }
59 61
         if (!empty($ws_auth_ip)) {
60 62
             $check_ip = true;
61 63
             $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip);
62
-            if ($debug)
63
-                error_log("ip_matches: $ip_matches");
64
+            if ($debug) {
65
+                            error_log("ip_matches: $ip_matches");
66
+            }
64 67
         }
65 68
     }
66 69
 
@@ -76,8 +79,9 @@  discard block
 block discarded – undo
76 79
     }
77 80
     $result = api_is_valid_secret_key($secret_key, $security_key);
78 81
     //error_log($secret_key.'-'.$security_key);
79
-    if ($debug)
80
-        error_log('WSHelperVerifyKey result: '.intval($result));
82
+    if ($debug) {
83
+            error_log('WSHelperVerifyKey result: '.intval($result));
84
+    }
81 85
     return $result;
82 86
 }
83 87
 
@@ -140,7 +144,9 @@  discard block
 block discarded – undo
140 144
     if (!WSHelperVerifyKey($params)) {
141 145
         return return_error(WS_ERROR_SECRET_KEY);
142 146
     }
143
-    if ($debug) error_log('WSImportLP');
147
+    if ($debug) {
148
+        error_log('WSImportLP');
149
+    }
144 150
 
145 151
     $courseIdName = $params['course_id_name'];
146 152
     $courseIdValue = $params['course_id_value'];
@@ -156,7 +162,9 @@  discard block
 block discarded – undo
156 162
     $courseId = $courseInfo['real_id'];
157 163
 
158 164
     if (empty($courseInfo)) {
159
-        if ($debug) error_log('Course not found');
165
+        if ($debug) {
166
+            error_log('Course not found');
167
+        }
160 168
         return 'Course not found';
161 169
     }
162 170
 
@@ -169,7 +177,9 @@  discard block
 block discarded – undo
169 177
 
170 178
         if (empty($sessionId)) {
171 179
 
172
-            if ($debug) error_log('Session not found');
180
+            if ($debug) {
181
+                error_log('Session not found');
182
+            }
173 183
             return 'Session not found';
174 184
         }
175 185
     }
@@ -196,7 +206,9 @@  discard block
 block discarded – undo
196 206
     $manifest = $oScorm->import_package($fileInfo, '', $courseInfo);
197 207
 
198 208
     if (!$manifest) {
199
-        if ($debug) error_log('manifest.xml file not found');
209
+        if ($debug) {
210
+            error_log('manifest.xml file not found');
211
+        }
200 212
         //if api_set_failure
201 213
         return 'manifest.xml file not found';
202 214
     }
@@ -215,10 +227,14 @@  discard block
 block discarded – undo
215 227
         $oScorm->set_maker($maker, $courseId);
216 228
         //$oScorm->set_jslib('scorm_api.php');
217 229
 
218
-        if ($debug) error_log('scorm was added');
230
+        if ($debug) {
231
+            error_log('scorm was added');
232
+        }
219 233
         return 1;
220 234
     } else {
221
-        if ($debug) error_log('manifest data empty');
235
+        if ($debug) {
236
+            error_log('manifest data empty');
237
+        }
222 238
         return 'manifest data empty';
223 239
     }
224 240
 }
@@ -311,7 +327,9 @@  discard block
 block discarded – undo
311 327
     );
312 328
 
313 329
     if (empty($courseInfo)) {
314
-        if ($debug) error_log("Course not found: $courseIdName : $courseIdValue");
330
+        if ($debug) {
331
+            error_log("Course not found: $courseIdName : $courseIdValue");
332
+        }
315 333
         return 'Course not found';
316 334
     }
317 335
 
@@ -326,7 +344,9 @@  discard block
 block discarded – undo
326 344
 
327 345
         if (empty($sessionId)) {
328 346
 
329
-            if ($debug) error_log('Session not found');
347
+            if ($debug) {
348
+                error_log('Session not found');
349
+            }
330 350
             return 'Session not found';
331 351
         }
332 352
     }
@@ -407,7 +427,9 @@  discard block
 block discarded – undo
407 427
     );
408 428
 
409 429
     if (empty($courseInfo)) {
410
-        if ($debug) error_log("Course not found: $courseIdName : $courseIdValue");
430
+        if ($debug) {
431
+            error_log("Course not found: $courseIdName : $courseIdValue");
432
+        }
411 433
         return 'Course not found';
412 434
     }
413 435
     $courseId = $courseInfo['real_id'];
@@ -432,7 +454,9 @@  discard block
 block discarded – undo
432 454
 
433 455
     $lp = new learnpath($courseCode, $lpId, null);
434 456
     if ($lp) {
435
-        if ($debug) error_log("LP deleted $lpId");
457
+        if ($debug) {
458
+            error_log("LP deleted $lpId");
459
+        }
436 460
 
437 461
         $course_dir = $courseInfo['directory'] . '/document';
438 462
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
@@ -448,7 +472,9 @@  discard block
 block discarded – undo
448 472
                 if ($item) {
449 473
                     $documentId = $item->get_path();
450 474
 
451
-                    if ($debug) error_log("lp item id found #$itemId");
475
+                    if ($debug) {
476
+                        error_log("lp item id found #$itemId");
477
+                    }
452 478
 
453 479
                     $documentInfo = DocumentManager::get_document_data_by_id(
454 480
                         $documentId,
@@ -474,7 +500,9 @@  discard block
 block discarded – undo
474 500
                         }
475 501
                     }
476 502
                 } else {
477
-                    if ($debug) error_log("Document not found #$itemId");
503
+                    if ($debug) {
504
+                        error_log("Document not found #$itemId");
505
+                    }
478 506
                 }
479 507
             }
480 508
         }
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 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
 
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
         return return_error(WS_ERROR_SECRET_KEY);
296 296
     }
297 297
 
298
-    require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathList.class.php';
299
-    require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php';
300
-    require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php';
298
+    require_once api_get_path(SYS_CODE_PATH).'lp/learnpathList.class.php';
299
+    require_once api_get_path(SYS_CODE_PATH).'lp/learnpath.class.php';
300
+    require_once api_get_path(SYS_CODE_PATH).'lp/learnpathItem.class.php';
301 301
 
302 302
     $courseIdName = $params['course_id_name'];
303 303
     $courseIdValue = $params['course_id_value'];
@@ -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
 
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
         return return_error(WS_ERROR_SECRET_KEY);
391 391
     }
392 392
 
393
-    require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathList.class.php';
394
-    require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php';
395
-    require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php';
393
+    require_once api_get_path(SYS_CODE_PATH).'lp/learnpathList.class.php';
394
+    require_once api_get_path(SYS_CODE_PATH).'lp/learnpath.class.php';
395
+    require_once api_get_path(SYS_CODE_PATH).'lp/learnpathItem.class.php';
396 396
 
397 397
     $courseIdName = $params['course_id_name'];
398 398
     $courseIdValue = $params['course_id_value'];
@@ -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_soap_course.php 1 patch
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -9,255 +9,255 @@  discard block
 block discarded – undo
9 9
 $s = WSCMSoapServer::singleton();
10 10
 
11 11
 $s->wsdl->addComplexType(
12
-	'course_id',
13
-	'complexType',
14
-	'struct',
15
-	'all',
16
-	'',
17
-	array(
18
-		'course_id_field_name' => array('name' => 'course_id_field_name', 'type' => 'xsd:string'),
19
-		'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string')
20
-	)
12
+    'course_id',
13
+    'complexType',
14
+    'struct',
15
+    'all',
16
+    '',
17
+    array(
18
+        'course_id_field_name' => array('name' => 'course_id_field_name', 'type' => 'xsd:string'),
19
+        'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string')
20
+    )
21 21
 );
22 22
 
23 23
 $s->wsdl->addComplexType(
24
-	'course_result',
25
-	'complexType',
26
-	'struct',
27
-	'all',
28
-	'',
29
-	array(
30
-		'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'),
31
-		'result' => array('name' => 'result', 'type' => 'tns:result')
32
-	)
24
+    'course_result',
25
+    'complexType',
26
+    'struct',
27
+    'all',
28
+    '',
29
+    array(
30
+        'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'),
31
+        'result' => array('name' => 'result', 'type' => 'tns:result')
32
+    )
33 33
 );
34 34
 
35 35
 $s->wsdl->addComplexType(
36
-	'course_result_array',
37
-	'complexType',
38
-	'array',
39
-	'',
40
-	'SOAP-ENC:Array',
41
-	array(),
42
-	array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_result[]')),
43
-	'tns:course_result'
36
+    'course_result_array',
37
+    'complexType',
38
+    'array',
39
+    '',
40
+    'SOAP-ENC:Array',
41
+    array(),
42
+    array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_result[]')),
43
+    'tns:course_result'
44 44
 );
45 45
 
46 46
 $s->register(
47
-	'WSCMCourse.DeleteCourse',
48
-	array('secret_key' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string')
47
+    'WSCMCourse.DeleteCourse',
48
+    array('secret_key' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string')
49 49
 );
50 50
 
51 51
 $s->register(
52
-	'WSCMCourse.DeleteCourses',
53
-	array('secret_key' => 'xsd:string', 'courses' => 'tns:course_id[]'),
54
-	array('return' => 'tns:course_result_array')
52
+    'WSCMCourse.DeleteCourses',
53
+    array('secret_key' => 'xsd:string', 'courses' => 'tns:course_id[]'),
54
+    array('return' => 'tns:course_result_array')
55 55
 );
56 56
 
57 57
 $s->register(
58
-	'WSCMCourse.CreateCourse',
59
-	array(
60
-		'secret_key' => 'xsd:string',
61
-		'title' => 'xsd:string',
62
-		'category_code' => 'xsd:string',
63
-		'wanted_code' => 'xsd:string',
64
-		'tutor_name' => 'xsd:string',
65
-		'course_admin_user_id_field_name' => 'xsd:string',
66
-		'course_admin_user_id_value' => 'xsd:string',
67
-		'language' => 'xsd:string',
68
-		'course_id_field_name' => 'xsd:string',
69
-		'course_id_value' => 'xsd:string',
70
-		'extras' => 'tns:extra_field[]'
71
-	),
72
-	array('return' => 'xsd:int')
58
+    'WSCMCourse.CreateCourse',
59
+    array(
60
+        'secret_key' => 'xsd:string',
61
+        'title' => 'xsd:string',
62
+        'category_code' => 'xsd:string',
63
+        'wanted_code' => 'xsd:string',
64
+        'tutor_name' => 'xsd:string',
65
+        'course_admin_user_id_field_name' => 'xsd:string',
66
+        'course_admin_user_id_value' => 'xsd:string',
67
+        'language' => 'xsd:string',
68
+        'course_id_field_name' => 'xsd:string',
69
+        'course_id_value' => 'xsd:string',
70
+        'extras' => 'tns:extra_field[]'
71
+    ),
72
+    array('return' => 'xsd:int')
73 73
 );
74 74
 
75 75
 $s->wsdl->addComplexType(
76
-	'course_create',
77
-	'complexType',
78
-	'struct',
79
-	'all',
80
-	'',
81
-	array(
82
-		'title' => array('name' => 'title', 'type' => 'xsd:string'),
83
-		'category_code' => array('name' => 'category_code', 'type' => 'xsd:string'),
84
-		'wanted_code' => array('name' => 'wanted_code', 'type' => 'xsd:int'),
85
-		'tutor_name' => array('name' => 'tutor_name', 'type' => 'xsd:string'),
86
-		'course_admin_user_id_field_name' => array('name' => 'course_admin_user_id_field_name', 'type' => 'xsd:string'),
87
-		'course_admin_user_id_value' => array('name' => 'course_admin_user_id_value', 'type' => 'xsd:string'),
88
-		'language' => array('name' => 'language', 'type' => 'xsd:string'),
89
-		'course_id_field_name' => array('name' => 'course_id_field_name', 'type' => 'xsd:string'),
90
-		'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'),
91
-		'extras' => array('name' => 'extras', 'type' => 'tns:extra_field[]')
92
-	)
76
+    'course_create',
77
+    'complexType',
78
+    'struct',
79
+    'all',
80
+    '',
81
+    array(
82
+        'title' => array('name' => 'title', 'type' => 'xsd:string'),
83
+        'category_code' => array('name' => 'category_code', 'type' => 'xsd:string'),
84
+        'wanted_code' => array('name' => 'wanted_code', 'type' => 'xsd:int'),
85
+        'tutor_name' => array('name' => 'tutor_name', 'type' => 'xsd:string'),
86
+        'course_admin_user_id_field_name' => array('name' => 'course_admin_user_id_field_name', 'type' => 'xsd:string'),
87
+        'course_admin_user_id_value' => array('name' => 'course_admin_user_id_value', 'type' => 'xsd:string'),
88
+        'language' => array('name' => 'language', 'type' => 'xsd:string'),
89
+        'course_id_field_name' => array('name' => 'course_id_field_name', 'type' => 'xsd:string'),
90
+        'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'),
91
+        'extras' => array('name' => 'extras', 'type' => 'tns:extra_field[]')
92
+    )
93 93
 );
94 94
 
95 95
 $s->wsdl->addComplexType(
96
-	'course_create_result',
97
-	'complexType',
98
-	'struct',
99
-	'all',
100
-	'',
101
-	array(
102
-		'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'),
103
-		'course_id_generated' => array('name' => 'course_id_generated', 'type' => 'xsd:int'),
104
-		'result' => array('name' => 'result', 'type' => 'tns:result')
105
-	)
96
+    'course_create_result',
97
+    'complexType',
98
+    'struct',
99
+    'all',
100
+    '',
101
+    array(
102
+        'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'),
103
+        'course_id_generated' => array('name' => 'course_id_generated', 'type' => 'xsd:int'),
104
+        'result' => array('name' => 'result', 'type' => 'tns:result')
105
+    )
106 106
 );
107 107
 
108 108
 $s->wsdl->addComplexType(
109
-	'course_create_result_array',
110
-	'complexType',
111
-	'array',
112
-	'',
113
-	'SOAP-ENC:Array',
114
-	array(),
115
-	array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_create_result[]')),
116
-	'tns:course_create_result'
109
+    'course_create_result_array',
110
+    'complexType',
111
+    'array',
112
+    '',
113
+    'SOAP-ENC:Array',
114
+    array(),
115
+    array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_create_result[]')),
116
+    'tns:course_create_result'
117 117
 );
118 118
 
119 119
 $s->register(
120
-	'WSCMCourse.CreateCourses',
121
-	array(
122
-		'secret_key' => 'xsd:string',
123
-		'courses' => 'tns:course_create[]'
124
-	),
125
-	array('return' => 'tns:course_create_result_array')
120
+    'WSCMCourse.CreateCourses',
121
+    array(
122
+        'secret_key' => 'xsd:string',
123
+        'courses' => 'tns:course_create[]'
124
+    ),
125
+    array('return' => 'tns:course_create_result_array')
126 126
 );
127 127
 
128 128
 $s->register(
129
-	'WSCMCourse.EditCourse',
130
-	array(
131
-		'secret_key' => 'xsd:string',
132
-		'course_id_field_name' => 'xsd:string',
133
-		'course_id_value' => 'xsd:string',
134
-		'title' => 'xsd:string',
135
-		'category_code' => 'xsd:string',
136
-		'department_name' => 'xsd:string',
137
-		'department_url' => 'xsd:string',
138
-		'language' => 'xsd:string',
139
-		'visibility' => 'xsd:int',
140
-		'subscribe' => 'xsd:int',
141
-		'unsubscribe' => 'xsd:int',
142
-		'visual_code' => 'xsd:string',
143
-		'extras' => 'tns:extra_field[]'
144
-	)
129
+    'WSCMCourse.EditCourse',
130
+    array(
131
+        'secret_key' => 'xsd:string',
132
+        'course_id_field_name' => 'xsd:string',
133
+        'course_id_value' => 'xsd:string',
134
+        'title' => 'xsd:string',
135
+        'category_code' => 'xsd:string',
136
+        'department_name' => 'xsd:string',
137
+        'department_url' => 'xsd:string',
138
+        'language' => 'xsd:string',
139
+        'visibility' => 'xsd:int',
140
+        'subscribe' => 'xsd:int',
141
+        'unsubscribe' => 'xsd:int',
142
+        'visual_code' => 'xsd:string',
143
+        'extras' => 'tns:extra_field[]'
144
+    )
145 145
 );
146 146
 
147 147
 $s->wsdl->addComplexType(
148
-	'course',
149
-	'complexType',
150
-	'struct',
151
-	'all',
152
-	'',
153
-	array(
154
-		'id' => array('name' => 'id', 'type' => 'xsd:int'),
155
-		'code' => array('name' => 'code', 'type' => 'xsd:string'),
156
-		'title' => array('name' => 'title', 'type' => 'xsd:string'),
157
-		'language' => array('name' => 'language', 'type' => 'xsd:string'),
158
-		'visibility' => array('name' => 'visibility', 'type' => 'xsd:int'),
159
-		'category_name' => array('name' => 'category_name', 'type' => 'xsd:string'),
160
-		'number_students' => array('name' => 'number_students', 'type' => 'xsd:int'),
161
-		'external_course_id' => array('name' => 'external_course_id', 'type' => 'xsd:string'),
162
-	)
148
+    'course',
149
+    'complexType',
150
+    'struct',
151
+    'all',
152
+    '',
153
+    array(
154
+        'id' => array('name' => 'id', 'type' => 'xsd:int'),
155
+        'code' => array('name' => 'code', 'type' => 'xsd:string'),
156
+        'title' => array('name' => 'title', 'type' => 'xsd:string'),
157
+        'language' => array('name' => 'language', 'type' => 'xsd:string'),
158
+        'visibility' => array('name' => 'visibility', 'type' => 'xsd:int'),
159
+        'category_name' => array('name' => 'category_name', 'type' => 'xsd:string'),
160
+        'number_students' => array('name' => 'number_students', 'type' => 'xsd:int'),
161
+        'external_course_id' => array('name' => 'external_course_id', 'type' => 'xsd:string'),
162
+    )
163 163
 );
164 164
 
165 165
 $s->wsdl->addComplexType(
166
-	'course_array',
167
-	'complexType',
168
-	'array',
169
-	'',
170
-	'SOAP-ENC:Array',
171
-	array(),
172
-	array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course[]')),
173
-	'tns:course'
166
+    'course_array',
167
+    'complexType',
168
+    'array',
169
+    '',
170
+    'SOAP-ENC:Array',
171
+    array(),
172
+    array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course[]')),
173
+    'tns:course'
174 174
 );
175 175
 
176 176
 $s->register(
177
-	'WSCMCourse.ListCourses',
178
-	array(
179
-		'secret_key' => 'xsd:string',
180
-		'course_id_field_name' => 'xsd:string'
181
-	),
182
-	array('return' => 'tns:course_array')
177
+    'WSCMCourse.ListCourses',
178
+    array(
179
+        'secret_key' => 'xsd:string',
180
+        'course_id_field_name' => 'xsd:string'
181
+    ),
182
+    array('return' => 'tns:course_array')
183 183
 );
184 184
 
185 185
 $s->register(
186
-	'WSCMCourse.SubscribeUserToCourse',
187
-	array(
188
-		'secret_key' => 'xsd:string',
189
-		'course_id_field_name' => 'xsd:string',
190
-		'course_id_value' => 'xsd:string',
191
-		'user_id_field_name' => 'xsd:string',
192
-		'user_id_value' => 'xsd:string',
193
-		'status' => 'xsd:int'
194
-	)
186
+    'WSCMCourse.SubscribeUserToCourse',
187
+    array(
188
+        'secret_key' => 'xsd:string',
189
+        'course_id_field_name' => 'xsd:string',
190
+        'course_id_value' => 'xsd:string',
191
+        'user_id_field_name' => 'xsd:string',
192
+        'user_id_value' => 'xsd:string',
193
+        'status' => 'xsd:int'
194
+    )
195 195
 );
196 196
 
197 197
 $s->register(
198
-	'WSCMCourse.UnsubscribeUserFromCourse',
199
-	array(
200
-		'secret_key' => 'xsd:string',
201
-		'course_id_field_name' => 'xsd:string',
202
-		'course_id_value' => 'xsd:string',
203
-		'user_id_field_name' => 'xsd:string',
204
-		'user_id_value' => 'xsd:string'
205
-	)
198
+    'WSCMCourse.UnsubscribeUserFromCourse',
199
+    array(
200
+        'secret_key' => 'xsd:string',
201
+        'course_id_field_name' => 'xsd:string',
202
+        'course_id_value' => 'xsd:string',
203
+        'user_id_field_name' => 'xsd:string',
204
+        'user_id_value' => 'xsd:string'
205
+    )
206 206
 );
207 207
 
208 208
 $s->wsdl->addComplexType(
209
-	'course_description',
210
-	'complexType',
211
-	'struct',
212
-	'all',
213
-	'',
214
-	array(
215
-		'course_desc_id' => array('name' => 'course_desc_id', 'type' => 'xsd:int'),
216
-		'course_desc_title' => array('name' => 'course_desc_title', 'type' => 'xsd:string'),
217
-		'course_desc_content' => array('name' => 'course_desc_content', 'type' => 'xsd:string')
218
-	)
209
+    'course_description',
210
+    'complexType',
211
+    'struct',
212
+    'all',
213
+    '',
214
+    array(
215
+        'course_desc_id' => array('name' => 'course_desc_id', 'type' => 'xsd:int'),
216
+        'course_desc_title' => array('name' => 'course_desc_title', 'type' => 'xsd:string'),
217
+        'course_desc_content' => array('name' => 'course_desc_content', 'type' => 'xsd:string')
218
+    )
219 219
 );
220 220
 
221 221
 $s->wsdl->addComplexType(
222
-	'course_description_array',
223
-	'complexType',
224
-	'array',
225
-	'',
226
-	'SOAP-ENC:Array',
227
-	array(),
228
-	array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_description[]')),
229
-	'tns:course_description'
222
+    'course_description_array',
223
+    'complexType',
224
+    'array',
225
+    '',
226
+    'SOAP-ENC:Array',
227
+    array(),
228
+    array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_description[]')),
229
+    'tns:course_description'
230 230
 );
231 231
 
232 232
 $s->register(
233
-	'WSCMCourse.GetCourseDescriptions',
234
-	array(
235
-		'secret_key' => 'xsd:string',
236
-		'course_id_field_name' => 'xsd:string',
237
-		'course_id_value' => 'xsd:string'
238
-	),
239
-	array('return' => 'tns:course_description_array')
233
+    'WSCMCourse.GetCourseDescriptions',
234
+    array(
235
+        'secret_key' => 'xsd:string',
236
+        'course_id_field_name' => 'xsd:string',
237
+        'course_id_value' => 'xsd:string'
238
+    ),
239
+    array('return' => 'tns:course_description_array')
240 240
 );
241 241
 
242 242
 $s->register(
243
-	'WSCMCourse.EditCourseDescription',
244
-	array(
245
-		'secret_key' => 'xsd:string',
246
-		'course_id_field_name' => 'xsd:string',
247
-		'course_id_value' => 'xsd:string',
248
-		'course_desc_id' => 'xsd:int',
249
-		'course_desc_title' => 'xsd:string',
250
-		'course_desc_content' => 'xsd:string'
251
-	)
243
+    'WSCMCourse.EditCourseDescription',
244
+    array(
245
+        'secret_key' => 'xsd:string',
246
+        'course_id_field_name' => 'xsd:string',
247
+        'course_id_value' => 'xsd:string',
248
+        'course_desc_id' => 'xsd:int',
249
+        'course_desc_title' => 'xsd:string',
250
+        'course_desc_content' => 'xsd:string'
251
+    )
252 252
 );
253 253
 
254 254
 $s->register(
255
-	'WSCMCourse.unreadMessage',
256
-	array(
257
-		'username' => 'xsd:string',
258
-		'password' => 'xsd:string',
259
-	),
260
-	array('return' => 'xsd:string'),
255
+    'WSCMCourse.unreadMessage',
256
+    array(
257
+        'username' => 'xsd:string',
258
+        'password' => 'xsd:string',
259
+    ),
260
+    array('return' => 'xsd:string'),
261 261
         'urn:WSCMService',
262 262
         '',
263 263
         '',
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 
269 269
 
270 270
 $s->register(
271
-	'WSCMCourse.getIdMessage',
272
-	array(
273
-		'username' => 'xsd:string',
274
-		'password' => 'xsd:string',
275
-	),
276
-	array('return' => 'xsd:string'),
271
+    'WSCMCourse.getIdMessage',
272
+    array(
273
+        'username' => 'xsd:string',
274
+        'password' => 'xsd:string',
275
+    ),
276
+    array('return' => 'xsd:string'),
277 277
         'urn:WSCMService',
278 278
         '',
279 279
         '',
Please login to merge, or discard this patch.
main/webservices/cm_webservice_forum.php 2 patches
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@  discard block
 block discarded – undo
32 32
                 }
33 33
             }
34 34
             return $foruns_id;
35
-        } else
36
-            return get_lang('InvalidId');
35
+        } else {
36
+                    return get_lang('InvalidId');
37
+        }
37 38
     }
38 39
 
39 40
     public function get_forum_title($username, $password, $course_code, $forum_id)
@@ -54,8 +55,9 @@  discard block
 block discarded – undo
54 55
 
55 56
             $forum_title = utf8_decode($forum_info['forum_title']);
56 57
             return $forum_title;
57
-        } else
58
-            return get_lang('InvalidId');
58
+        } else {
59
+                    return get_lang('InvalidId');
60
+        }
59 61
     }
60 62
 
61 63
     public function get_forum_threads_id($username, $password, $course_code, $forum_id)
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
 
74 76
             return $threads_id;
75 77
 
76
-        } else
77
-            return get_lang('InvalidId');
78
+        } else {
79
+                    return get_lang('InvalidId');
80
+        }
78 81
     }
79 82
 
80 83
     public function get_forum_thread_data($username, $password, $course_code, $thread_id, $field)
@@ -115,8 +118,9 @@  discard block
 block discarded – undo
115 118
 
116 119
             return $thread_info[$field_table];
117 120
 
118
-        } else
119
-            return get_lang('InvalidId');
121
+        } else {
122
+                    return get_lang('InvalidId');
123
+        }
120 124
     }
121 125
 
122 126
     public function get_forum_thread_title($username, $password, $course_code, $thread_id)
@@ -139,8 +143,9 @@  discard block
 block discarded – undo
139 143
 
140 144
             return $thread_info[$field_table];
141 145
 
142
-        } else
143
-            return get_lang('InvalidId');
146
+        } else {
147
+                    return get_lang('InvalidId');
148
+        }
144 149
     }
145 150
 
146 151
 
@@ -184,8 +189,9 @@  discard block
 block discarded – undo
184 189
                 }
185 190
             }
186 191
             return $posts_id;
187
-        } else
188
-            return get_lang('InvalidId');
192
+        } else {
193
+                    return get_lang('InvalidId');
194
+        }
189 195
     }
190 196
 
191 197
     public function get_post_data($username, $password, $course_code, $post_id, $field)
@@ -226,8 +232,9 @@  discard block
 block discarded – undo
226 232
                     $field_table = "title";
227 233
             }
228 234
             return (htmlcode) ? html_entity_decode($post_info[$field_table]) : $post_info[$field_table];
229
-        } else
230
-            return get_lang('InvalidId');
235
+        } else {
236
+                    return get_lang('InvalidId');
237
+        }
231 238
     }
232 239
 
233 240
     public function send_post($username, $password, $course_code, $forum_id, $thread_id, $title, $content)
@@ -269,8 +276,9 @@  discard block
 block discarded – undo
269 276
 
270 277
             //send_notification_mails($thread_id, $values);
271 278
 
272
-        } else
273
-            return get_lang('InvalidId');
279
+        } else {
280
+                    return get_lang('InvalidId');
281
+        }
274 282
 
275 283
     }
276 284
 
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 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
             $em = Database::getManager();
238 238
             $course_db = CourseManager::get_course_information($course_code);
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
             $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']);
242 242
             $forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT, $course_db['db_name']);
243 243
             $table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']);
244
-            $post_date=date('Y-m-d H:i:s');
245
-            $visible=1;
246
-            $has_attachment=false;
244
+            $post_date = date('Y-m-d H:i:s');
245
+            $visible = 1;
246
+            $has_attachment = false;
247 247
             $my_post = '';
248 248
             $post_notification = '';
249 249
 
Please login to merge, or discard this patch.
main/webservices/user_info.soap.php 2 patches
Indentation   +11 added lines, -11 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',
32
-          'name'=>'teacher', 'type'=>'xsd:string',
33
-          'name'=>'language','type'=>'xsd:string',
29
+            'name'=>'code'  , 'type'=>'xsd:string',
30
+            'name'=>'title'  , 'type'=>'xsd:string',
31
+            'name'=>'url'    , 'type'=>'xsd:string',
32
+            'name'=>'teacher', 'type'=>'xsd:string',
33
+            'name'=>'language','type'=>'xsd:string',
34 34
         )
35 35
 );
36 36
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 // Register the method to expose
52 52
 $server->register('WSCourseListOfUser',   // method name
53 53
     array('username' => 'xsd:string',
54
-          'signature' => 'xsd:string'),         // input parameters
54
+            'signature' => 'xsd:string'),         // input parameters
55 55
     array('return' => 'xsd:Array'),             // output parameters
56 56
     'urn:WSUserInfo',                           // namespace
57 57
     'urn:WSUserInfo#WSUserInfo',          // soapaction
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     $list = UserManager::get_api_keys($user_id, 'dokeos');
78 78
     $key = '';
79 79
     foreach ($list as $key) {
80
-    	break;
80
+        break;
81 81
     }
82 82
 
83 83
     $local_key = $username.$key;
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 // Register the method to expose
130 130
 $server->register('WSEventsList',       // method name
131 131
     array('username' => 'xsd:string',
132
-          'signature' => 'xsd:string',
133
-          'datestart' => 'xsd:int',
134
-          'dateend'   => 'xsd:int'),          // input parameters
132
+            'signature' => 'xsd:string',
133
+            'datestart' => 'xsd:int',
134
+            'dateend'   => 'xsd:int'),          // input parameters
135 135
     array('return' => 'xsd:Array'),           // output parameters
136 136
     'urn:WSUserInfo',                         // namespace
137 137
     'urn:WSUserInfo#WSEventsList',      // soapaction
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     $list = UserManager::get_api_keys($user_id, 'dokeos');
160 160
     $key = '';
161 161
     foreach ($list as $key) {
162
-    	break;
162
+        break;
163 163
     }
164 164
 
165 165
     $local_key = $username.$key;
Please login to merge, or discard this 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 2 patches
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.
Indentation   +361 added lines, -361 removed lines patch added patch discarded remove patch
@@ -14,177 +14,177 @@  discard block
 block discarded – undo
14 14
 class WSSession extends WS
15 15
 {
16 16
 
17
-	/**
18
-	 * Creates a session (helper method)
19
-	 *
20
-	 * @param string Name of the session
21
-	 * @param string Start date, use the 'YYYY-MM-DD' format
22
-	 * @param string End date, use the 'YYYY-MM-DD' format
23
-	 * @param int Access delays of the coach (days before)
24
-	 * @param int Access delays of the coach (days after)
25
-	 * @param int Nolimit (0 = no limit of time, 1 = limit of time)
26
-	 * @param int Visibility
27
-	 * @param string User id field name for the coach
28
-	 * @param string User id value for the coach
29
-	 * @param string Original session id field name (use "chamilo_session_id" to use internal id)
30
-	 * @param string Original session id value
31
-	 * @param array Array of extra fields
32
-	 * @return mixed Generated id in case of success, WSError otherwise
33
-	 */
34
-	protected function createSessionHelper(
35
-		$name,
36
-		$start_date,
37
-		$end_date,
38
-		$nb_days_access_before,
39
-		$nb_days_access_after,
40
-		$nolimit,
41
-		$visibility,
42
-		$user_id_field_name,
43
-		$user_id_value,
44
-		$session_id_field_name,
45
-		$session_id_value,
46
-		$extras
47
-	) {
48
-		// Verify that coach exists and get its id
49
-		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
50
-		if ($user_id instanceof WSError) {
51
-			return $user_id;
52
-		}
17
+    /**
18
+     * Creates a session (helper method)
19
+     *
20
+     * @param string Name of the session
21
+     * @param string Start date, use the 'YYYY-MM-DD' format
22
+     * @param string End date, use the 'YYYY-MM-DD' format
23
+     * @param int Access delays of the coach (days before)
24
+     * @param int Access delays of the coach (days after)
25
+     * @param int Nolimit (0 = no limit of time, 1 = limit of time)
26
+     * @param int Visibility
27
+     * @param string User id field name for the coach
28
+     * @param string User id value for the coach
29
+     * @param string Original session id field name (use "chamilo_session_id" to use internal id)
30
+     * @param string Original session id value
31
+     * @param array Array of extra fields
32
+     * @return mixed Generated id in case of success, WSError otherwise
33
+     */
34
+    protected function createSessionHelper(
35
+        $name,
36
+        $start_date,
37
+        $end_date,
38
+        $nb_days_access_before,
39
+        $nb_days_access_after,
40
+        $nolimit,
41
+        $visibility,
42
+        $user_id_field_name,
43
+        $user_id_value,
44
+        $session_id_field_name,
45
+        $session_id_value,
46
+        $extras
47
+    ) {
48
+        // Verify that coach exists and get its id
49
+        $user_id = $this->getUserId($user_id_field_name, $user_id_value);
50
+        if ($user_id instanceof WSError) {
51
+            return $user_id;
52
+        }
53 53
 
54
-		$coachStartDate = null;
55
-		if (!empty($nb_days_access_before)) {
56
-			$day = intval($nb_days_access_before);
57
-			$coachStartDate = date('Y-m-d ', strtotime($start_date. ' + '.$day.' days'));
58
-		}
54
+        $coachStartDate = null;
55
+        if (!empty($nb_days_access_before)) {
56
+            $day = intval($nb_days_access_before);
57
+            $coachStartDate = date('Y-m-d ', strtotime($start_date. ' + '.$day.' days'));
58
+        }
59 59
 
60
-		$coachEndDate = null;
61
-		if (!empty($nb_days_access_after)) {
62
-			$day = intval($nb_days_access_after);
63
-			$coachEndDate = date('Y-m-d ', strtotime($end_date. ' + '.$day.' days'));
64
-		}
60
+        $coachEndDate = null;
61
+        if (!empty($nb_days_access_after)) {
62
+            $day = intval($nb_days_access_after);
63
+            $coachEndDate = date('Y-m-d ', strtotime($end_date. ' + '.$day.' days'));
64
+        }
65 65
 
66
-		// Try to create the session
67
-		$session_id = SessionManager::create_session(
68
-			$name,
69
-			$start_date,
70
-			$end_date,
71
-			$start_date,
72
-			$end_date,
73
-			$coachStartDate,
74
-			$coachEndDate,
75
-			$user_id,
76
-			0,
77
-			$visibility
78
-		);
79
-		if(!is_int($session_id)) {
80
-			return new WSError(301, 'Could not create the session');
81
-		} else {
82
-			// Add the Original session id to the extra fields
83
-			$extras_associative = array();
84
-			if($session_id_field_name != "chamilo_session_id") {
85
-				$extras_associative[$session_id_field_name] = $session_id_value;
86
-			}
87
-			foreach($extras as $extra) {
88
-				$extras_associative[$extra['field_name']] = $extra['field_value'];
89
-			}
90
-			// Create the extra fields
91
-			foreach($extras_associative as $fname => $fvalue) {
92
-				SessionManager::create_session_extra_field($fname, 1, $fname);
93
-				SessionManager::update_session_extra_field_value(
94
-					$session_id,
95
-					$fname,
96
-					$fvalue
97
-				);
98
-			}
99
-			return $session_id;
100
-		}
101
-	}
66
+        // Try to create the session
67
+        $session_id = SessionManager::create_session(
68
+            $name,
69
+            $start_date,
70
+            $end_date,
71
+            $start_date,
72
+            $end_date,
73
+            $coachStartDate,
74
+            $coachEndDate,
75
+            $user_id,
76
+            0,
77
+            $visibility
78
+        );
79
+        if(!is_int($session_id)) {
80
+            return new WSError(301, 'Could not create the session');
81
+        } else {
82
+            // Add the Original session id to the extra fields
83
+            $extras_associative = array();
84
+            if($session_id_field_name != "chamilo_session_id") {
85
+                $extras_associative[$session_id_field_name] = $session_id_value;
86
+            }
87
+            foreach($extras as $extra) {
88
+                $extras_associative[$extra['field_name']] = $extra['field_value'];
89
+            }
90
+            // Create the extra fields
91
+            foreach($extras_associative as $fname => $fvalue) {
92
+                SessionManager::create_session_extra_field($fname, 1, $fname);
93
+                SessionManager::update_session_extra_field_value(
94
+                    $session_id,
95
+                    $fname,
96
+                    $fvalue
97
+                );
98
+            }
99
+            return $session_id;
100
+        }
101
+    }
102 102
 
103
-	/**
104
-	 * Creates a session
105
-	 *
106
-	 * @param string API secret key
107
-	 * @param string Name of the session
108
-	 * @param string Start date, use the 'YYYY-MM-DD' format
109
-	 * @param string End date, use the 'YYYY-MM-DD' format
110
-	 * @param int Access delays of the coach (days before)
111
-	 * @param int Access delays of the coach (days after)
112
-	 * @param int Nolimit (0 = no limit of time, 1 = limit of time)
113
-	 * @param int Visibility
114
-	 * @param string User id field name for the coach
115
-	 * @param string User id value for the coach
116
-	 * @param string Original session id field name (use "chamilo_session_id" to use internal id)
117
-	 * @param string Original session id value
118
-	 * @param array Array of extra fields
119
-	 * @return int Session id generated
120
-	 */
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
-		$verifKey = $this->verifyKey($secret_key);
123
-		if($verifKey instanceof WSError) {
124
-			$this->handleError($verifKey);
125
-		} else {
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) {
128
-				$this->handleError($session_id);
129
-			} else {
130
-				return $session_id;
131
-			}
132
-		}
133
-	}
103
+    /**
104
+     * Creates a session
105
+     *
106
+     * @param string API secret key
107
+     * @param string Name of the session
108
+     * @param string Start date, use the 'YYYY-MM-DD' format
109
+     * @param string End date, use the 'YYYY-MM-DD' format
110
+     * @param int Access delays of the coach (days before)
111
+     * @param int Access delays of the coach (days after)
112
+     * @param int Nolimit (0 = no limit of time, 1 = limit of time)
113
+     * @param int Visibility
114
+     * @param string User id field name for the coach
115
+     * @param string User id value for the coach
116
+     * @param string Original session id field name (use "chamilo_session_id" to use internal id)
117
+     * @param string Original session id value
118
+     * @param array Array of extra fields
119
+     * @return int Session id generated
120
+     */
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
+        $verifKey = $this->verifyKey($secret_key);
123
+        if($verifKey instanceof WSError) {
124
+            $this->handleError($verifKey);
125
+        } else {
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) {
128
+                $this->handleError($session_id);
129
+            } else {
130
+                return $session_id;
131
+            }
132
+        }
133
+    }
134 134
 
135
-	/**
136
-	 * Deletes a session (helper method)
137
-	 *
138
-	 * @param string Session id field name
139
-	 * @param string Session id value
140
-	 * @return mixed True in case of success, WSError otherwise
141
-	 */
142
-	protected function deleteSessionHelper($session_id_field_name, $session_id_value) {
143
-		$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
144
-		if($session_id instanceof WSError) {
145
-			return $session_id;
146
-		} else {
147
-			SessionManager::delete($session_id, true);
148
-			return true;
149
-		}
150
-	}
135
+    /**
136
+     * Deletes a session (helper method)
137
+     *
138
+     * @param string Session id field name
139
+     * @param string Session id value
140
+     * @return mixed True in case of success, WSError otherwise
141
+     */
142
+    protected function deleteSessionHelper($session_id_field_name, $session_id_value) {
143
+        $session_id = $this->getSessionId($session_id_field_name, $session_id_value);
144
+        if($session_id instanceof WSError) {
145
+            return $session_id;
146
+        } else {
147
+            SessionManager::delete($session_id, true);
148
+            return true;
149
+        }
150
+    }
151 151
 
152
-	/**
153
-	 * Deletes a session
154
-	 *
155
-	 * @param string API secret key
156
-	 * @param string Session id field name
157
-	 * @param string Session id value
158
-	 */
159
-	public function DeleteSession($secret_key, $session_id_field_name, $session_id_value) {
160
-		$verifKey = $this->verifyKey($secret_key);
161
-		if($verifKey instanceof WSError) {
162
-			$this->handleError($verifKey);
163
-		} else {
164
-			$result = $this->deleteSessionHelper($session_id_field_name, $session_id_value);
165
-			if($result instanceof WSError) {
166
-				$this->handleError($result);
167
-			}
168
-		}
169
-	}
152
+    /**
153
+     * Deletes a session
154
+     *
155
+     * @param string API secret key
156
+     * @param string Session id field name
157
+     * @param string Session id value
158
+     */
159
+    public function DeleteSession($secret_key, $session_id_field_name, $session_id_value) {
160
+        $verifKey = $this->verifyKey($secret_key);
161
+        if($verifKey instanceof WSError) {
162
+            $this->handleError($verifKey);
163
+        } else {
164
+            $result = $this->deleteSessionHelper($session_id_field_name, $session_id_value);
165
+            if($result instanceof WSError) {
166
+                $this->handleError($result);
167
+            }
168
+        }
169
+    }
170 170
 
171
-	/**
172
-	 * Edits a session (helper method)
173
-	 *
174
-	 * @param string Name of the session
175
-	 * @param string Start date, use the 'YYYY-MM-DD' format
176
-	 * @param string End date, use the 'YYYY-MM-DD' format
177
-	 * @param int Access delays of the coach (days before)
178
-	 * @param int Access delays of the coach (days after)
179
-	 * @param int Nolimit (0 = no limit of time, 1 = limit of time)
180
-	 * @param int Visibility
181
-	 * @param string User id field name for the coach
182
-	 * @param string User id value for the coach
183
-	 * @param string Original session id field name (use "chamilo_session_id" to use internal id)
184
-	 * @param string Original session id value
185
-	 * @param array Array of extra fields
186
-	 * @return mixed True on success, WSError otherwise
187
-	 */
171
+    /**
172
+     * Edits a session (helper method)
173
+     *
174
+     * @param string Name of the session
175
+     * @param string Start date, use the 'YYYY-MM-DD' format
176
+     * @param string End date, use the 'YYYY-MM-DD' format
177
+     * @param int Access delays of the coach (days before)
178
+     * @param int Access delays of the coach (days after)
179
+     * @param int Nolimit (0 = no limit of time, 1 = limit of time)
180
+     * @param int Visibility
181
+     * @param string User id field name for the coach
182
+     * @param string User id value for the coach
183
+     * @param string Original session id field name (use "chamilo_session_id" to use internal id)
184
+     * @param string Original session id value
185
+     * @param array Array of extra fields
186
+     * @return mixed True on success, WSError otherwise
187
+     */
188 188
     protected function editSessionHelper(
189 189
         $name,
190 190
         $start_date,
@@ -199,15 +199,15 @@  discard block
 block discarded – undo
199 199
         $session_id_value,
200 200
         $extras
201 201
     ) {
202
-		$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
203
-		if($session_id instanceof WSError) {
204
-			return $session_id;
205
-		} else {
206
-			// Verify that coach exists and get its id
207
-			$user_id = $this->getUserId($user_id_field_name, $user_id_value);
208
-			if ($user_id instanceof WSError) {
209
-				return $user_id;
210
-			}
202
+        $session_id = $this->getSessionId($session_id_field_name, $session_id_value);
203
+        if($session_id instanceof WSError) {
204
+            return $session_id;
205
+        } else {
206
+            // Verify that coach exists and get its id
207
+            $user_id = $this->getUserId($user_id_field_name, $user_id_value);
208
+            if ($user_id instanceof WSError) {
209
+                return $user_id;
210
+            }
211 211
 
212 212
             $coachStartDate = null;
213 213
             if (!empty($nb_days_access_before)) {
@@ -234,127 +234,127 @@  discard block
 block discarded – undo
234 234
                 0,
235 235
                 (int)$visibility
236 236
             );
237
-			if(!is_int($result_id)) {
238
-				return new WSError(302, 'Could not edit the session');
239
-			} else {
240
-				if(!empty($extras)) {
241
-					$extras_associative = array();
242
-					foreach($extras as $extra) {
243
-						$extras_associative[$extra['field_name']] = $extra['field_value'];
244
-					}
245
-					// Create the extra fields
246
-					foreach($extras_associative as $fname => $fvalue) {
247
-						SessionManager::create_session_extra_field($fname, 1, $fname);
248
-						SessionManager::update_session_extra_field_value($session_id, $fname, $fvalue);
249
-					}
250
-				}
251
-				return true;
252
-			}
253
-		}
254
-	}
237
+            if(!is_int($result_id)) {
238
+                return new WSError(302, 'Could not edit the session');
239
+            } else {
240
+                if(!empty($extras)) {
241
+                    $extras_associative = array();
242
+                    foreach($extras as $extra) {
243
+                        $extras_associative[$extra['field_name']] = $extra['field_value'];
244
+                    }
245
+                    // Create the extra fields
246
+                    foreach($extras_associative as $fname => $fvalue) {
247
+                        SessionManager::create_session_extra_field($fname, 1, $fname);
248
+                        SessionManager::update_session_extra_field_value($session_id, $fname, $fvalue);
249
+                    }
250
+                }
251
+                return true;
252
+            }
253
+        }
254
+    }
255 255
 
256
-	/**
257
-	 * Edits a session
258
-	 *
259
-	 * @param string API secret key
260
-	 * @param string Name of the session
261
-	 * @param string Start date, use the 'YYYY-MM-DD' format
262
-	 * @param string End date, use the 'YYYY-MM-DD' format
263
-	 * @param int Access delays of the coach (days before)
264
-	 * @param int Access delays of the coach (days after)
265
-	 * @param int Nolimit (0 = no limit of time, 1 = limit of time)
266
-	 * @param int Visibility
267
-	 * @param string User id field name for the coach
268
-	 * @param string User id value for the coach
269
-	 * @param string Original session id field name (use "chamilo_session_id" to use internal id)
270
-	 * @param string Original session id value
271
-	 * @param array Array of extra fields
272
-	 */
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
-		$verifKey = $this->verifyKey($secret_key);
275
-		if($verifKey instanceof WSError) {
276
-			$this->handleError($verifKey);
277
-		} else {
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) {
280
-				$this->handleError($result);
281
-			}
282
-		}
283
-	}
256
+    /**
257
+     * Edits a session
258
+     *
259
+     * @param string API secret key
260
+     * @param string Name of the session
261
+     * @param string Start date, use the 'YYYY-MM-DD' format
262
+     * @param string End date, use the 'YYYY-MM-DD' format
263
+     * @param int Access delays of the coach (days before)
264
+     * @param int Access delays of the coach (days after)
265
+     * @param int Nolimit (0 = no limit of time, 1 = limit of time)
266
+     * @param int Visibility
267
+     * @param string User id field name for the coach
268
+     * @param string User id value for the coach
269
+     * @param string Original session id field name (use "chamilo_session_id" to use internal id)
270
+     * @param string Original session id value
271
+     * @param array Array of extra fields
272
+     */
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
+        $verifKey = $this->verifyKey($secret_key);
275
+        if($verifKey instanceof WSError) {
276
+            $this->handleError($verifKey);
277
+        } else {
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) {
280
+                $this->handleError($result);
281
+            }
282
+        }
283
+    }
284 284
 
285
-	/**
286
-	 * Change user subscription (helper method)
287
-	 *
288
-	 * @param string User id field name
289
-	 * @param string User id value
290
-	 * @param string Session id field name
291
-	 * @param string Session id value
292
-	 * @param int State (1 to subscribe, 0 to unsubscribe)
293
-	 * @return mixed True on success, WSError otherwise
294
-	 */
295
-	protected function changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $state) {
296
-		$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
297
-		if($session_id instanceof WSError) {
298
-			return $session_id;
299
-		} else {
300
-			$user_id = $this->getUserId($user_id_field_name, $user_id_value);
301
-			if($user_id instanceof WSError) {
302
-				return $user_id;
303
-			} else {
304
-				if($state  == 1) {
305
-					SessionManager::subscribe_users_to_session($session_id, array($user_id));
306
-				} else {
307
-					$result = SessionManager::unsubscribe_user_from_session($session_id, $user_id);
308
-					if (!$result) {
309
-						return new WSError(303, 'There was an error unsubscribing this user from the session');
310
-					}
311
-				}
312
-				return true;
313
-			}
314
-		}
315
-	}
285
+    /**
286
+     * Change user subscription (helper method)
287
+     *
288
+     * @param string User id field name
289
+     * @param string User id value
290
+     * @param string Session id field name
291
+     * @param string Session id value
292
+     * @param int State (1 to subscribe, 0 to unsubscribe)
293
+     * @return mixed True on success, WSError otherwise
294
+     */
295
+    protected function changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $state) {
296
+        $session_id = $this->getSessionId($session_id_field_name, $session_id_value);
297
+        if($session_id instanceof WSError) {
298
+            return $session_id;
299
+        } else {
300
+            $user_id = $this->getUserId($user_id_field_name, $user_id_value);
301
+            if($user_id instanceof WSError) {
302
+                return $user_id;
303
+            } else {
304
+                if($state  == 1) {
305
+                    SessionManager::subscribe_users_to_session($session_id, array($user_id));
306
+                } else {
307
+                    $result = SessionManager::unsubscribe_user_from_session($session_id, $user_id);
308
+                    if (!$result) {
309
+                        return new WSError(303, 'There was an error unsubscribing this user from the session');
310
+                    }
311
+                }
312
+                return true;
313
+            }
314
+        }
315
+    }
316 316
 
317
-	/**
318
-	 * Subscribe user to a session
319
-	 *
320
-	 * @param string API secret key
321
-	 * @param string User id field name
322
-	 * @param string User id value
323
-	 * @param string Session id field name
324
-	 * @param string Session id value
325
-	 */
326
-	public function SubscribeUserToSession($secret_key, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value) {
327
-		$verifKey = $this->verifyKey($secret_key);
328
-		if($verifKey instanceof WSError) {
329
-			$this->handleError($verifKey);
330
-		} else {
331
-			$result = $this->changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, 1);
332
-			if($result instanceof WSError) {
333
-				$this->handleError($result);
334
-			}
335
-		}
336
-	}
317
+    /**
318
+     * Subscribe user to a session
319
+     *
320
+     * @param string API secret key
321
+     * @param string User id field name
322
+     * @param string User id value
323
+     * @param string Session id field name
324
+     * @param string Session id value
325
+     */
326
+    public function SubscribeUserToSession($secret_key, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value) {
327
+        $verifKey = $this->verifyKey($secret_key);
328
+        if($verifKey instanceof WSError) {
329
+            $this->handleError($verifKey);
330
+        } else {
331
+            $result = $this->changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, 1);
332
+            if($result instanceof WSError) {
333
+                $this->handleError($result);
334
+            }
335
+        }
336
+    }
337 337
 
338
-	/**
339
-	 * Subscribe user to a session
340
-	 *
341
-	 * @param string API secret key
342
-	 * @param string User id field name
343
-	 * @param string User id value
344
-	 * @param string Session id field name
345
-	 * @param string Session id value
346
-	 */
347
-	public function UnsubscribeUserFromSession($secret_key, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value) {
348
-		$verifKey = $this->verifyKey($secret_key);
349
-		if($verifKey instanceof WSError) {
350
-			$this->handleError($verifKey);
351
-		} else {
352
-			$result = $this->changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, 0);
353
-			if($result instanceof WSError) {
354
-				$this->handleError($result);
355
-			}
356
-		}
357
-	}
338
+    /**
339
+     * Subscribe user to a session
340
+     *
341
+     * @param string API secret key
342
+     * @param string User id field name
343
+     * @param string User id value
344
+     * @param string Session id field name
345
+     * @param string Session id value
346
+     */
347
+    public function UnsubscribeUserFromSession($secret_key, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value) {
348
+        $verifKey = $this->verifyKey($secret_key);
349
+        if($verifKey instanceof WSError) {
350
+            $this->handleError($verifKey);
351
+        } else {
352
+            $result = $this->changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, 0);
353
+            if($result instanceof WSError) {
354
+                $this->handleError($result);
355
+            }
356
+        }
357
+    }
358 358
     
359 359
     /**
360 360
      * Change Teacher subscription (helper method)
@@ -446,79 +446,79 @@  discard block
 block discarded – undo
446 446
     }
447 447
 
448 448
     /**
449
-	 * Change course subscription
450
-	 *
451
-	 * @param string Course id field name
452
-	 * @param string Course id value
453
-	 * @param string Session id field name
454
-	 * @param string Session id value
455
-	 * @param int State (1 to subscribe, 0 to unsubscribe)
456
-	 * @return mixed True on success, WSError otherwise
457
-	 */
458
-	protected function changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, $state) {
459
-		$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
460
-		if($session_id instanceof WSError) {
461
-			return $session_id;
462
-		} else {
463
-			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
464
-			if($course_id instanceof WSError) {
465
-				return $course_id;
466
-			} else {
467
-				if($state  == 1) {
468
-					SessionManager::add_courses_to_session($session_id, array($course_id));
469
-					return true;
470
-				} else {
471
-					$result = SessionManager::unsubscribe_course_from_session($session_id, $course_id);
472
-					if ($result) {
473
-						return true;
474
-					} else {
475
-						return new WSError(304, 'Error unsubscribing course from session');
476
-					}
477
-				}
478
-			}
479
-		}
449
+     * Change course subscription
450
+     *
451
+     * @param string Course id field name
452
+     * @param string Course id value
453
+     * @param string Session id field name
454
+     * @param string Session id value
455
+     * @param int State (1 to subscribe, 0 to unsubscribe)
456
+     * @return mixed True on success, WSError otherwise
457
+     */
458
+    protected function changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, $state) {
459
+        $session_id = $this->getSessionId($session_id_field_name, $session_id_value);
460
+        if($session_id instanceof WSError) {
461
+            return $session_id;
462
+        } else {
463
+            $course_id = $this->getCourseId($course_id_field_name, $course_id_value);
464
+            if($course_id instanceof WSError) {
465
+                return $course_id;
466
+            } else {
467
+                if($state  == 1) {
468
+                    SessionManager::add_courses_to_session($session_id, array($course_id));
469
+                    return true;
470
+                } else {
471
+                    $result = SessionManager::unsubscribe_course_from_session($session_id, $course_id);
472
+                    if ($result) {
473
+                        return true;
474
+                    } else {
475
+                        return new WSError(304, 'Error unsubscribing course from session');
476
+                    }
477
+                }
478
+            }
479
+        }
480 480
     }
481 481
 
482
-	/**
483
-	 * Subscribe course to session
484
-	 *
485
-	 * @param string API secret key
486
-	 * @param string Course id field name
487
-	 * @param string Course id value
488
-	 * @param string Session id field name
489
-	 * @param string Session id value
490
-	 */
491
-	public function SubscribeCourseToSession($secret_key, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) {
492
-		$verifKey = $this->verifyKey($secret_key);
493
-		if($verifKey instanceof WSError) {
494
-			$this->handleError($verifKey);
495
-		} else {
496
-			$result = $this->changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, 1);
497
-			if($result instanceof WSError) {
498
-				$this->handleError($result);
499
-			}
500
-		}
501
-	}
482
+    /**
483
+     * Subscribe course to session
484
+     *
485
+     * @param string API secret key
486
+     * @param string Course id field name
487
+     * @param string Course id value
488
+     * @param string Session id field name
489
+     * @param string Session id value
490
+     */
491
+    public function SubscribeCourseToSession($secret_key, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) {
492
+        $verifKey = $this->verifyKey($secret_key);
493
+        if($verifKey instanceof WSError) {
494
+            $this->handleError($verifKey);
495
+        } else {
496
+            $result = $this->changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, 1);
497
+            if($result instanceof WSError) {
498
+                $this->handleError($result);
499
+            }
500
+        }
501
+    }
502 502
 
503
-	/**
504
-	 * Unsubscribe course from session
505
-	 *
506
-	 * @param string API secret key
507
-	 * @param string Course id field name
508
-	 * @param string Course id value
509
-	 * @param string Session id field name
510
-	 * @param string Session id value
511
-	 */
512
-	public function UnsubscribeCourseFromSession($secret_key, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) {
513
-		$verifKey = $this->verifyKey($secret_key);
514
-		if($verifKey instanceof WSError) {
515
-			$this->handleError($verifKey);
516
-		} else {
517
-			$result = $this->changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, 0);
518
-			if($result instanceof WSError) {
519
-				$this->handleError($result);
520
-			}
521
-		}
522
-	}
503
+    /**
504
+     * Unsubscribe course from session
505
+     *
506
+     * @param string API secret key
507
+     * @param string Course id field name
508
+     * @param string Course id value
509
+     * @param string Session id field name
510
+     * @param string Session id value
511
+     */
512
+    public function UnsubscribeCourseFromSession($secret_key, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) {
513
+        $verifKey = $this->verifyKey($secret_key);
514
+        if($verifKey instanceof WSError) {
515
+            $this->handleError($verifKey);
516
+        } else {
517
+            $result = $this->changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, 0);
518
+            if($result instanceof WSError) {
519
+                $this->handleError($result);
520
+            }
521
+        }
522
+    }
523 523
 
524 524
 }
Please login to merge, or discard this patch.
main/webservices/soap.php 2 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -11,84 +11,84 @@  discard block
 block discarded – undo
11 11
  * SOAP error handler. Handles an error sending a SOAP fault
12 12
  */
13 13
 class WSSoapErrorHandler implements WSErrorHandler {
14
-	/**
15
-	 * Handles the error by sending a SOAP fault through the server
16
-	 *
17
-	 * @param WSError Error to handle
18
-	 */
19
-	public function handle($error) {
20
-		$server = WSSoapServer::singleton();
21
-		$server->fault(strval($error->code), $error->message);
22
-	}
14
+    /**
15
+     * Handles the error by sending a SOAP fault through the server
16
+     *
17
+     * @param WSError Error to handle
18
+     */
19
+    public function handle($error) {
20
+        $server = WSSoapServer::singleton();
21
+        $server->fault(strval($error->code), $error->message);
22
+    }
23 23
 }
24 24
 
25 25
 /**
26 26
  * SOAP server wrapper implementing a Singleton
27 27
  */
28 28
 class WSSoapServer {
29
-	/**
30
-	 * SOAP server instance
31
-	 *
32
-	 * @var soap_server
33
-	 */
34
-	private static $_instance;
29
+    /**
30
+     * SOAP server instance
31
+     *
32
+     * @var soap_server
33
+     */
34
+    private static $_instance;
35 35
 
36
-	/**
37
-	 * Private constructor
38
-	 */
39
-	private function __construct() {
40
-	}
36
+    /**
37
+     * Private constructor
38
+     */
39
+    private function __construct() {
40
+    }
41 41
 
42
-	/**
43
-	 * Singleton method
44
-	 */
45
-	public static function singleton() {
46
-		if(!isset(self::$_instance)) {
47
-			self::$_instance = new soap_server();
48
-			// Set the error handler
49
-			WSError::setErrorHandler(new WSSoapErrorHandler());
50
-			// Configure the service
51
-			self::$_instance->configureWSDL('WSService', 'urn:WSService');
52
-		}
42
+    /**
43
+     * Singleton method
44
+     */
45
+    public static function singleton() {
46
+        if(!isset(self::$_instance)) {
47
+            self::$_instance = new soap_server();
48
+            // Set the error handler
49
+            WSError::setErrorHandler(new WSSoapErrorHandler());
50
+            // Configure the service
51
+            self::$_instance->configureWSDL('WSService', 'urn:WSService');
52
+        }
53 53
 
54
-		return self::$_instance;
55
-	}
54
+        return self::$_instance;
55
+    }
56 56
 }
57 57
 
58 58
 $s = WSSoapServer::singleton();
59 59
 
60 60
 $s->wsdl->addComplexType(
61
-	'result',
62
-	'complexType',
63
-	'struct',
64
-	'all',
65
-	'',
66
-	array(
67
-		'code' => array('name' => 'code', 'type' => 'xsd:int'),
68
-		'message' => array('name' => 'message', 'type' => 'xsd:string')
69
-	)
61
+    'result',
62
+    'complexType',
63
+    'struct',
64
+    'all',
65
+    '',
66
+    array(
67
+        'code' => array('name' => 'code', 'type' => 'xsd:int'),
68
+        'message' => array('name' => 'message', 'type' => 'xsd:string')
69
+    )
70 70
 );
71 71
 
72 72
 $s->wsdl->addComplexType(
73
-  'extras',
74
-  'complexType',
75
-  'struct',
76
-  'all',
77
-  '',
78
-  array(
79
-          'field_name' => array('name' => 'field_name', 'type' => 'xsd:string'),
80
-          'field_value' => array('name' => 'field_value', 'type' => 'xsd:string')
81
-       )
73
+    'extras',
74
+    'complexType',
75
+    'struct',
76
+    'all',
77
+    '',
78
+    array(
79
+            'field_name' => array('name' => 'field_name', 'type' => 'xsd:string'),
80
+            'field_value' => array('name' => 'field_value', 'type' => 'xsd:string')
81
+        )
82 82
 );
83 83
 
84 84
 $s->wsdl->addComplexType(
85
-  'extra_field',
86
-  'complexType',
87
-  'array',
88
-  '',
89
-  'SOAP-ENC:Array',
90
-  array(),
91
-  array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:extras[]')),'tns:extras'
85
+    'extra_field',
86
+    'complexType',
87
+    'array',
88
+    '',
89
+    'SOAP-ENC:Array',
90
+    array(),
91
+    array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:extras[]')),'tns:extras'
92 92
 );
93 93
 
94 94
 /*
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 */
107 107
 
108 108
 $s->register(
109
-	'WS.test',
110
-	array(),
111
-	array('return' => 'xsd:string')
109
+    'WS.test',
110
+    array(),
111
+    array('return' => 'xsd:string')
112 112
 );
113 113
 
114 114
 require_once(dirname(__FILE__).'/soap_user.php');
Please login to merge, or discard this 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/cm_soap_forum.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 
13 13
 $s->register(
14 14
         'WSCMForum.get_foruns_id',
15
-	array(
16
-		'username' => 'xsd:string',
17
-		'password' => 'xsd:string',
15
+    array(
16
+        'username' => 'xsd:string',
17
+        'password' => 'xsd:string',
18 18
                 'course_code' => 'xsd:string'
19
-	),
20
-	array('return' => 'xsd:string'),
19
+    ),
20
+    array('return' => 'xsd:string'),
21 21
         'urn:WSCMService',
22 22
         '',
23 23
         '',
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 );
27 27
 
28 28
 $s->register(
29
-	'WSCMForum.get_forum_title',
30
-	array(
31
-		'username' => 'xsd:string',
32
-		'password' => 'xsd:string',
29
+    'WSCMForum.get_forum_title',
30
+    array(
31
+        'username' => 'xsd:string',
32
+        'password' => 'xsd:string',
33 33
                 'course_code' => 'xsd:string',
34 34
                 'forum_id' => 'xsd:string'
35
-	),
36
-	array('return' => 'xsd:string'),
35
+    ),
36
+    array('return' => 'xsd:string'),
37 37
         'urn:WSCMService',
38 38
         '',
39 39
         '',
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 );
43 43
 
44 44
 $s->register(
45
-	'WSCMForum.get_forum_threads_id',
46
-	array(
47
-		'username' => 'xsd:string',
48
-		'password' => 'xsd:string',
45
+    'WSCMForum.get_forum_threads_id',
46
+    array(
47
+        'username' => 'xsd:string',
48
+        'password' => 'xsd:string',
49 49
                 'course_code' => 'xsd:string',
50 50
                 'forum_id' => 'xsd:string'
51
-	),
52
-	array('return' => 'xsd:string'),
51
+    ),
52
+    array('return' => 'xsd:string'),
53 53
         'urn:WSCMService',
54 54
         '',
55 55
         '',
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
 );
59 59
 
60 60
 $s->register(
61
-	'WSCMForum.get_forum_thread_data',
62
-	array(
63
-		'username' => 'xsd:string',
64
-		'password' => 'xsd:string',
61
+    'WSCMForum.get_forum_thread_data',
62
+    array(
63
+        'username' => 'xsd:string',
64
+        'password' => 'xsd:string',
65 65
                 'course_code' => 'xsd:string',
66 66
                 'thread_id' => 'xsd:string',
67 67
                 'field' => 'xsd:string'
68
-	),
69
-	array('return' => 'xsd:string'),
68
+    ),
69
+    array('return' => 'xsd:string'),
70 70
         'urn:WSCMService',
71 71
         '',
72 72
         '',
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
 );
76 76
 
77 77
 $s->register(
78
-	'WSCMForum.get_forum_thread_title',
79
-	array(
80
-		'username' => 'xsd:string',
81
-		'password' => 'xsd:string',
78
+    'WSCMForum.get_forum_thread_title',
79
+    array(
80
+        'username' => 'xsd:string',
81
+        'password' => 'xsd:string',
82 82
                 'course_code' => 'xsd:string',
83 83
                 'thread_id' => 'xsd:string'
84
-	),
85
-	array('return' => 'xsd:string'),
84
+    ),
85
+    array('return' => 'xsd:string'),
86 86
         'urn:WSCMService',
87 87
         '',
88 88
         '',
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 $s->register(
95
-	'WSCMForum.get_posts_id',
96
-	array(
97
-		'username' => 'xsd:string',
98
-		'password' => 'xsd:string',
95
+    'WSCMForum.get_posts_id',
96
+    array(
97
+        'username' => 'xsd:string',
98
+        'password' => 'xsd:string',
99 99
                 'course_code' => 'xsd:string',
100 100
                 'thread_id' => 'xsd:string'
101
-	),
102
-	array('return' => 'xsd:string'),
101
+    ),
102
+    array('return' => 'xsd:string'),
103 103
         'urn:WSCMService',
104 104
         '',
105 105
         '',
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 );
109 109
 
110 110
 $s->register(
111
-	'WSCMForum.get_post_data',
112
-	array(
113
-		'username' => 'xsd:string',
114
-		'password' => 'xsd:string',
111
+    'WSCMForum.get_post_data',
112
+    array(
113
+        'username' => 'xsd:string',
114
+        'password' => 'xsd:string',
115 115
                 'course_code' => 'xsd:string',
116 116
                 'post_id' => 'xsd:string',
117 117
                 'field' => 'xsd:string'
118
-	),
119
-	array('return' => 'xsd:string'),
118
+    ),
119
+    array('return' => 'xsd:string'),
120 120
         'urn:WSCMService',
121 121
         '',
122 122
         '',
@@ -126,17 +126,17 @@  discard block
 block discarded – undo
126 126
 
127 127
 
128 128
 $s->register(
129
-	'WSCMForum.send_post',
130
-	array(
131
-		'username' => 'xsd:string',
132
-		'password' => 'xsd:string',
129
+    'WSCMForum.send_post',
130
+    array(
131
+        'username' => 'xsd:string',
132
+        'password' => 'xsd:string',
133 133
                 'course_code' => 'xsd:string',
134 134
                 'forum_id' => 'xsd:string',
135 135
                 'thread_id' => 'xsd:string',
136 136
                 'title' => 'xsd:string',
137 137
                 'content' => 'xsd:string'
138
-	),
139
-	array('return' => 'xsd:string'),
138
+    ),
139
+    array('return' => 'xsd:string'),
140 140
         'urn:WSCMService',
141 141
         '',
142 142
         '',
Please login to merge, or discard this patch.