Passed
Push — 1.10.x ( e37d9e...d684ae )
by Angel Fernando Quiroz
226:38 queued 187:01
created
main/webservices/webservice_user.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -36,6 +36,7 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @param array Users
38 38
 	 * @param int Set to 1 to enable and to 0 to disable
39
+	 * @param integer $state
39 40
 	 * @return array Array of results
40 41
 	 */
41 42
 	protected function changeUsersActiveState($users, $state) {
@@ -217,6 +218,11 @@  discard block
 block discarded – undo
217 218
 	 * @param string Phone.
218 219
 	 * @param string Expiration date
219 220
 	 * @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field').
221
+	 * @param integer|null $visibility
222
+	 * @param string|null $email
223
+	 * @param string|null $language
224
+	 * @param string|null $phone
225
+	 * @param string|null $expiration_date
220 226
 	 * @return mixed New user id generated by the system, WSError otherwise
221 227
 	 */
222 228
 	protected function createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras = array()) {
Please login to merge, or discard this patch.
Indentation   +426 added lines, -426 removed lines patch added patch discarded remove patch
@@ -11,458 +11,458 @@
 block discarded – undo
11 11
  */
12 12
 class WSUser extends WS {
13 13
 
14
-	/**
15
-	 * Enables or disables a user
16
-	 *
17
-	 * @param string User id field name
18
-	 * @param string User id value
19
-	 * @param int Set to 1 to enable and to 0 to disable
20
-	 */
21
-	protected function changeUserActiveState($user_id_field_name, $user_id_value, $state) {
22
-		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
23
-		if($user_id instanceof WSError) {
24
-			return $user_id;
25
-		} else {
26
-			if($state == 0) {
27
-				UserManager::disable($user_id);
28
-			} else if($state == 1) {
29
-				UserManager::enable($user_id);
30
-			}
31
-		}
32
-	}
14
+    /**
15
+     * Enables or disables a user
16
+     *
17
+     * @param string User id field name
18
+     * @param string User id value
19
+     * @param int Set to 1 to enable and to 0 to disable
20
+     */
21
+    protected function changeUserActiveState($user_id_field_name, $user_id_value, $state) {
22
+        $user_id = $this->getUserId($user_id_field_name, $user_id_value);
23
+        if($user_id instanceof WSError) {
24
+            return $user_id;
25
+        } else {
26
+            if($state == 0) {
27
+                UserManager::disable($user_id);
28
+            } else if($state == 1) {
29
+                UserManager::enable($user_id);
30
+            }
31
+        }
32
+    }
33 33
 
34
-	/**
35
-	 * Enables or disables multiple users
36
-	 *
37
-	 * @param array Users
38
-	 * @param int Set to 1 to enable and to 0 to disable
39
-	 * @return array Array of results
40
-	 */
41
-	protected function changeUsersActiveState($users, $state) {
42
-		$results = array();
43
-		foreach($users as $user) {
44
-			$result_tmp = array();
45
-			$result_op = $this->changeUserActiveState($user['user_id_field_name'], $user['user_id_value'], $state);
46
-			$result_tmp['user_id_value'] = $user['user_id_value'];
47
-			if($result_op instanceof WSError) {
48
-				// Return the error in the results
49
-				$result_tmp['result'] = $result_op->toArray();
50
-			} else {
51
-				$result_tmp['result'] = $this->getSuccessfulResult();
52
-			}
53
-			$results[] = $result_tmp;
54
-		}
55
-		return $results;
56
-	}
34
+    /**
35
+     * Enables or disables multiple users
36
+     *
37
+     * @param array Users
38
+     * @param int Set to 1 to enable and to 0 to disable
39
+     * @return array Array of results
40
+     */
41
+    protected function changeUsersActiveState($users, $state) {
42
+        $results = array();
43
+        foreach($users as $user) {
44
+            $result_tmp = array();
45
+            $result_op = $this->changeUserActiveState($user['user_id_field_name'], $user['user_id_value'], $state);
46
+            $result_tmp['user_id_value'] = $user['user_id_value'];
47
+            if($result_op instanceof WSError) {
48
+                // Return the error in the results
49
+                $result_tmp['result'] = $result_op->toArray();
50
+            } else {
51
+                $result_tmp['result'] = $this->getSuccessfulResult();
52
+            }
53
+            $results[] = $result_tmp;
54
+        }
55
+        return $results;
56
+    }
57 57
 
58
-	/**
59
-	 * Disables a user
60
-	 *
61
-	 * @param string API secret key
62
-	 * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
63
-	 * @param string User id value
64
-	 */
65
-	public function DisableUser($secret_key, $user_id_field_name, $user_id_value) {
66
-		$verifKey = $this->verifyKey($secret_key);
67
-		if($verifKey instanceof WSError) {
68
-			// Let the implementation handle it
69
-			$this->handleError($verifKey);
70
-		} else {
71
-			$result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 0);
72
-			if($result instanceof WSError) {
73
-				$this->handleError($result);
74
-			}
75
-		}
76
-	}
58
+    /**
59
+     * Disables a user
60
+     *
61
+     * @param string API secret key
62
+     * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
63
+     * @param string User id value
64
+     */
65
+    public function DisableUser($secret_key, $user_id_field_name, $user_id_value) {
66
+        $verifKey = $this->verifyKey($secret_key);
67
+        if($verifKey instanceof WSError) {
68
+            // Let the implementation handle it
69
+            $this->handleError($verifKey);
70
+        } else {
71
+            $result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 0);
72
+            if($result instanceof WSError) {
73
+                $this->handleError($result);
74
+            }
75
+        }
76
+    }
77 77
 
78
-	/**
79
-	 * Disables multiple users
80
-	 *
81
-	 * @param string API secret key
82
-	 * @param array Array of users with elements of the form array('user_id_field_name' => 'name_of_field', 'user_id_value' => 'value')
83
-	 * @return array Array with elements like array('user_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different
84
-	 * than 0, an error occured
85
-	 */
86
-	public function DisableUsers($secret_key, $users) {
87
-		$verifKey = $this->verifyKey($secret_key);
88
-		if($verifKey instanceof WSError) {
89
-			// Let the implementation handle it
90
-			$this->handleError($verifKey);
91
-		} else {
92
-			return $this->changeUsersActiveState($users, 0);
93
-		}
94
-	}
78
+    /**
79
+     * Disables multiple users
80
+     *
81
+     * @param string API secret key
82
+     * @param array Array of users with elements of the form array('user_id_field_name' => 'name_of_field', 'user_id_value' => 'value')
83
+     * @return array Array with elements like array('user_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different
84
+     * than 0, an error occured
85
+     */
86
+    public function DisableUsers($secret_key, $users) {
87
+        $verifKey = $this->verifyKey($secret_key);
88
+        if($verifKey instanceof WSError) {
89
+            // Let the implementation handle it
90
+            $this->handleError($verifKey);
91
+        } else {
92
+            return $this->changeUsersActiveState($users, 0);
93
+        }
94
+    }
95 95
 
96
-	/**
97
-	 * Enables a user
98
-	 *
99
-	 * @param string API secret key
100
-	 * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
101
-	 * @param string User id value
102
-	 */
103
-	public function EnableUser($secret_key, $user_id_field_name, $user_id_value) {
104
-		$verifKey = $this->verifyKey($secret_key);
105
-		if($verifKey instanceof WSError) {
106
-			$this->handleError($verifKey);
107
-		} else {
108
-			$result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 1);
109
-			if($result instanceof WSError) {
110
-				$this->handleError($result);
111
-			}
112
-		}
113
-	}
96
+    /**
97
+     * Enables a user
98
+     *
99
+     * @param string API secret key
100
+     * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
101
+     * @param string User id value
102
+     */
103
+    public function EnableUser($secret_key, $user_id_field_name, $user_id_value) {
104
+        $verifKey = $this->verifyKey($secret_key);
105
+        if($verifKey instanceof WSError) {
106
+            $this->handleError($verifKey);
107
+        } else {
108
+            $result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 1);
109
+            if($result instanceof WSError) {
110
+                $this->handleError($result);
111
+            }
112
+        }
113
+    }
114 114
 
115
-	/**
116
-	 * Enables multiple users
117
-	 *
118
-	 * @param string API secret key
119
-	 * @param array Array of users with elements of the form array('user_id_field_name' => 'name_of_field', 'user_id_value' => 'value')
120
-	 * @return array Array with elements like array('user_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different
121
-	 * than 0, an error occured
122
-	 */
123
-	public function EnableUsers($secret_key, $users) {
124
-		$verifKey = $this->verifyKey($secret_key);
125
-		if($verifKey instanceof WSError) {
126
-			// Let the implementation handle it
127
-			$this->handleError($verifKey);
128
-		} else {
129
-			return $this->changeUsersActiveState($users, 1);
130
-		}
131
-	}
115
+    /**
116
+     * Enables multiple users
117
+     *
118
+     * @param string API secret key
119
+     * @param array Array of users with elements of the form array('user_id_field_name' => 'name_of_field', 'user_id_value' => 'value')
120
+     * @return array Array with elements like array('user_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different
121
+     * than 0, an error occured
122
+     */
123
+    public function EnableUsers($secret_key, $users) {
124
+        $verifKey = $this->verifyKey($secret_key);
125
+        if($verifKey instanceof WSError) {
126
+            // Let the implementation handle it
127
+            $this->handleError($verifKey);
128
+        } else {
129
+            return $this->changeUsersActiveState($users, 1);
130
+        }
131
+    }
132 132
 
133
-	/**
134
-	 * Deletes a user (helper method)
135
-	 *
136
-	 * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
137
-	 * @param string User id value
138
-	 * @return mixed True if user was successfully deleted, WSError otherwise
139
-	 */
140
-	protected function deleteUserHelper($user_id_field_name, $user_id_value) {
141
-		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
142
-		if($user_id instanceof WSError) {
143
-			return $user_id;
144
-		} else {
145
-			if(!UserManager::delete_user($user_id)) {
146
-				return new WSError(101, "There was a problem while deleting this user");
147
-			} else {
148
-				return true;
149
-			}
150
-		}
151
-	}
133
+    /**
134
+     * Deletes a user (helper method)
135
+     *
136
+     * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
137
+     * @param string User id value
138
+     * @return mixed True if user was successfully deleted, WSError otherwise
139
+     */
140
+    protected function deleteUserHelper($user_id_field_name, $user_id_value) {
141
+        $user_id = $this->getUserId($user_id_field_name, $user_id_value);
142
+        if($user_id instanceof WSError) {
143
+            return $user_id;
144
+        } else {
145
+            if(!UserManager::delete_user($user_id)) {
146
+                return new WSError(101, "There was a problem while deleting this user");
147
+            } else {
148
+                return true;
149
+            }
150
+        }
151
+    }
152 152
 
153
-	/**
154
-	 * Deletes a user
155
-	 *
156
-	 * @param string API secret key
157
-	 * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
158
-	 * @param string User id value
159
-	 */
160
-	public function DeleteUser($secret_key, $user_id_field_name, $user_id_value) {
161
-		$verifKey = $this->verifyKey($secret_key);
162
-		if($verifKey instanceof WSError) {
163
-			$this->handleError($verifKey);
164
-		} else {
165
-			$result = $this->deleteUserHelper($user_id_field_name, $user_id_value);
166
-			if($result instanceof WSError) {
167
-				$this->handleError($result);
168
-			}
169
-		}
170
-	}
153
+    /**
154
+     * Deletes a user
155
+     *
156
+     * @param string API secret key
157
+     * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
158
+     * @param string User id value
159
+     */
160
+    public function DeleteUser($secret_key, $user_id_field_name, $user_id_value) {
161
+        $verifKey = $this->verifyKey($secret_key);
162
+        if($verifKey instanceof WSError) {
163
+            $this->handleError($verifKey);
164
+        } else {
165
+            $result = $this->deleteUserHelper($user_id_field_name, $user_id_value);
166
+            if($result instanceof WSError) {
167
+                $this->handleError($result);
168
+            }
169
+        }
170
+    }
171 171
 
172
-	/**
173
-	 * Deletes multiple users
174
-	 *
175
-	 * @param string API secret key
176
-	 * @param array Array of users with elements of the form array('user_id_field_name' => 'name_of_field', 'user_id_value' => 'value')
177
-	 * @return array Array with elements like array('user_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different
178
-	 * than 0, an error occured
179
-	 */
180
-	public function DeleteUsers($secret_key, $users) {
181
-		$verifKey = $this->verifyKey($secret_key);
182
-		if($verifKey instanceof WSError) {
183
-			$this->handleError($verifKey);
184
-		} else {
185
-			$results = array();
186
-			foreach($users as $user) {
187
-				$result_tmp = array();
188
-				$result_op = $this->deleteUserHelper($user['user_id_field_name'], $user['user_id_value']);
189
-				$result_tmp['user_id_value'] = $user['user_id_value'];
190
-				if($result_op instanceof WSError) {
191
-					// Return the error in the results
192
-					$result_tmp['result'] = $result_op->toArray();
193
-				} else {
194
-					$result_tmp['result'] = $this->getSuccessfulResult();
195
-				}
196
-				$results[] = $result_tmp;
197
-			}
198
-			return $results;
199
-		}
200
-	}
172
+    /**
173
+     * Deletes multiple users
174
+     *
175
+     * @param string API secret key
176
+     * @param array Array of users with elements of the form array('user_id_field_name' => 'name_of_field', 'user_id_value' => 'value')
177
+     * @return array Array with elements like array('user_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different
178
+     * than 0, an error occured
179
+     */
180
+    public function DeleteUsers($secret_key, $users) {
181
+        $verifKey = $this->verifyKey($secret_key);
182
+        if($verifKey instanceof WSError) {
183
+            $this->handleError($verifKey);
184
+        } else {
185
+            $results = array();
186
+            foreach($users as $user) {
187
+                $result_tmp = array();
188
+                $result_op = $this->deleteUserHelper($user['user_id_field_name'], $user['user_id_value']);
189
+                $result_tmp['user_id_value'] = $user['user_id_value'];
190
+                if($result_op instanceof WSError) {
191
+                    // Return the error in the results
192
+                    $result_tmp['result'] = $result_op->toArray();
193
+                } else {
194
+                    $result_tmp['result'] = $this->getSuccessfulResult();
195
+                }
196
+                $results[] = $result_tmp;
197
+            }
198
+            return $results;
199
+        }
200
+    }
201 201
 
202
-	/**
203
-	 * Creates a user (helper method)
204
-	 *
205
-	 * @param string User first name
206
-	 * @param string User last name
207
-	 * @param int User status
208
-	 * @param string Login name
209
-	 * @param string Password (encrypted or not)
210
-	 * @param string Encrypt method. Leave blank if you are passing the password in clear text, set to the encrypt method used to encrypt the password otherwise. Remember
211
-	 * to include the salt in the extra fields if you are encrypting the password
212
-	 * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
213
-	 * @param string User id value. Leave blank if you are using the internal user_id
214
-	 * @param int Visibility.
215
-	 * @param string User email.
216
-	 * @param string Language.
217
-	 * @param string Phone.
218
-	 * @param string Expiration date
219
-	 * @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field').
220
-	 * @return mixed New user id generated by the system, WSError otherwise
221
-	 */
222
-	protected function createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras = array()) {
202
+    /**
203
+     * Creates a user (helper method)
204
+     *
205
+     * @param string User first name
206
+     * @param string User last name
207
+     * @param int User status
208
+     * @param string Login name
209
+     * @param string Password (encrypted or not)
210
+     * @param string Encrypt method. Leave blank if you are passing the password in clear text, set to the encrypt method used to encrypt the password otherwise. Remember
211
+     * to include the salt in the extra fields if you are encrypting the password
212
+     * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
213
+     * @param string User id value. Leave blank if you are using the internal user_id
214
+     * @param int Visibility.
215
+     * @param string User email.
216
+     * @param string Language.
217
+     * @param string Phone.
218
+     * @param string Expiration date
219
+     * @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field').
220
+     * @return mixed New user id generated by the system, WSError otherwise
221
+     */
222
+    protected function createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras = array()) {
223 223
         global $api_failureList;
224
-		// Add the original user id field name and value to the extra fields if needed
225
-		$extras_associative = array();
226
-		if($user_id_field_name != "chamilo_user_id") {
227
-			$extras_associative[$user_id_field_name] = $user_id_value;
228
-		}
224
+        // Add the original user id field name and value to the extra fields if needed
225
+        $extras_associative = array();
226
+        if($user_id_field_name != "chamilo_user_id") {
227
+            $extras_associative[$user_id_field_name] = $user_id_value;
228
+        }
229 229
                 if (!empty($extras)) {
230 230
                     foreach($extras as $extra) {
231 231
                         $extras_associative[$extra['field_name']] = $extra['field_value'];
232 232
                     }
233 233
                 }
234
-		$result = UserManager::create_user($firstname, $lastname, $status, $email, $login, $password, '', $language, $phone, '', PLATFORM_AUTH_SOURCE, $expiration_date, $visibility, 0, $extras_associative, $encrypt_method);
235
-		if (!$result) {
236
-			$failure = $api_failureList[0];
237
-			if($failure == 'login-pass already taken') {
238
-				return new WSError(102, 'This username is already taken');
239
-			} else if($failure == 'encrypt_method invalid') {
240
-				return new WSError(103, 'The encryption of the password is invalid');
241
-			} else {
242
-				return new WSError(104, 'There was an error creating the user');
243
-			}
244
-		} else {
245
-			return $result;
246
-		}
247
-	}
234
+        $result = UserManager::create_user($firstname, $lastname, $status, $email, $login, $password, '', $language, $phone, '', PLATFORM_AUTH_SOURCE, $expiration_date, $visibility, 0, $extras_associative, $encrypt_method);
235
+        if (!$result) {
236
+            $failure = $api_failureList[0];
237
+            if($failure == 'login-pass already taken') {
238
+                return new WSError(102, 'This username is already taken');
239
+            } else if($failure == 'encrypt_method invalid') {
240
+                return new WSError(103, 'The encryption of the password is invalid');
241
+            } else {
242
+                return new WSError(104, 'There was an error creating the user');
243
+            }
244
+        } else {
245
+            return $result;
246
+        }
247
+    }
248 248
 
249
-	/**
250
-	 * Creates a user
251
-	 *
252
-	 * @param string API secret key
253
-	 * @param string User first name
254
-	 * @param string User last name
255
-	 * @param int User status
256
-	 * @param string Login name
257
-	 * @param string Password (encrypted or not)
258
-	 * @param string Encrypt method. Leave blank if you are passing the password in clear text, set to the encrypt method used to encrypt the password otherwise. Remember
259
-	 * to include the salt in the extra fields if you are encrypting the password
260
-	 * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
261
-	 * @param string User id value. Leave blank if you are using the internal user_id
262
-	 * @param int Visibility. Set by default to 1
263
-	 * @param string User email. Set by default to an empty string
264
-	 * @param string Language. Set by default to english
265
-	 * @param string Phone. Set by default to an empty string
266
-	 * @param string Expiration date. Set to null by default
267
-	 * @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field'). Set to an empty array by default
268
-	 * @return int New user id generated by the system
269
-	 */
270
-	public function CreateUser($secret_key, $firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility = 1, $email = '', $language = 'english', $phone = '', $expiration_date = '0000-00-00 00:00:00', $extras = array()) {
271
-		// First, verify the secret key
272
-		$verifKey = $this->verifyKey($secret_key);
273
-		if($verifKey instanceof WSError) {
274
-			$this->handleError($verifKey);
275
-		} else {
276
-			$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
277
-			if($result instanceof WSError) {
278
-				$this->handleError($result);
279
-			} else {
280
-				return $result;
281
-			}
282
-		}
283
-	}
249
+    /**
250
+     * Creates a user
251
+     *
252
+     * @param string API secret key
253
+     * @param string User first name
254
+     * @param string User last name
255
+     * @param int User status
256
+     * @param string Login name
257
+     * @param string Password (encrypted or not)
258
+     * @param string Encrypt method. Leave blank if you are passing the password in clear text, set to the encrypt method used to encrypt the password otherwise. Remember
259
+     * to include the salt in the extra fields if you are encrypting the password
260
+     * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
261
+     * @param string User id value. Leave blank if you are using the internal user_id
262
+     * @param int Visibility. Set by default to 1
263
+     * @param string User email. Set by default to an empty string
264
+     * @param string Language. Set by default to english
265
+     * @param string Phone. Set by default to an empty string
266
+     * @param string Expiration date. Set to null by default
267
+     * @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field'). Set to an empty array by default
268
+     * @return int New user id generated by the system
269
+     */
270
+    public function CreateUser($secret_key, $firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility = 1, $email = '', $language = 'english', $phone = '', $expiration_date = '0000-00-00 00:00:00', $extras = array()) {
271
+        // First, verify the secret key
272
+        $verifKey = $this->verifyKey($secret_key);
273
+        if($verifKey instanceof WSError) {
274
+            $this->handleError($verifKey);
275
+        } else {
276
+            $result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
277
+            if($result instanceof WSError) {
278
+                $this->handleError($result);
279
+            } else {
280
+                return $result;
281
+            }
282
+        }
283
+    }
284 284
 
285
-	/**
286
-	 * Creates multiple users
287
-	 *
288
-	 * @param string API secret key
289
-	 * @param array Users array. Each member of this array must follow the structure imposed by the CreateUser method
290
-	 * @return array Array with elements of the form array('user_id_value' => 'original value sent', 'user_id_generated' => 'value_generated', 'result' => array('code' => 0, 'message' => 'Operation was successful'))
291
-	 */
292
-	public function CreateUsers($secret_key, $users) {
293
-		$verifKey = $this->verifyKey($secret_key);
294
-		if($verifKey instanceof WSError) {
295
-			$this->handleError($verifKey);
296
-		} else {
297
-			$results = array();
298
-			foreach($users as $user) {
299
-				$result_tmp = array();
285
+    /**
286
+     * Creates multiple users
287
+     *
288
+     * @param string API secret key
289
+     * @param array Users array. Each member of this array must follow the structure imposed by the CreateUser method
290
+     * @return array Array with elements of the form array('user_id_value' => 'original value sent', 'user_id_generated' => 'value_generated', 'result' => array('code' => 0, 'message' => 'Operation was successful'))
291
+     */
292
+    public function CreateUsers($secret_key, $users) {
293
+        $verifKey = $this->verifyKey($secret_key);
294
+        if($verifKey instanceof WSError) {
295
+            $this->handleError($verifKey);
296
+        } else {
297
+            $results = array();
298
+            foreach($users as $user) {
299
+                $result_tmp = array();
300 300
                 // re-initialize variables just in case
301 301
                 $firstname = $lastname = $status = $login = $password = $encrypt_method = $user_id_field_name = $user_id_value = $visibility = $email = $language = $phone = $expiration_date = $extras = null;
302
-				extract($user);
303
-				$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
304
-				if($result instanceof WSError) {
305
-					$result_tmp['result'] = $result->toArray();
306
-					$result_tmp['user_id_value'] = $user_id_value;
307
-					$result_tmp['user_id_generated'] = 0;
308
-				} else {
309
-					$result_tmp['result'] = $this->getSuccessfulResult();
310
-					$result_tmp['user_id_value'] = $user_id_value;
311
-					$result_tmp['user_id_generated'] = $result;
312
-				}
313
-				$results[] = $result_tmp;
314
-			}
315
-			return $results;
316
-		}
317
-	}
302
+                extract($user);
303
+                $result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
304
+                if($result instanceof WSError) {
305
+                    $result_tmp['result'] = $result->toArray();
306
+                    $result_tmp['user_id_value'] = $user_id_value;
307
+                    $result_tmp['user_id_generated'] = 0;
308
+                } else {
309
+                    $result_tmp['result'] = $this->getSuccessfulResult();
310
+                    $result_tmp['user_id_value'] = $user_id_value;
311
+                    $result_tmp['user_id_generated'] = $result;
312
+                }
313
+                $results[] = $result_tmp;
314
+            }
315
+            return $results;
316
+        }
317
+    }
318 318
 
319
-	/**
320
-	 * Edits user info (helper method)
321
-	 *
322
-	 * @param string User id field name. Use "chamilo_user_id" in order to use internal system id
323
-	 * @param string User id value
324
-	 * @param string First name
325
-	 * @param string Last name
326
-	 * @param int User status
327
-	 * @param string Login name
328
-	 * @param string Password. Leave blank if you don't want to update it
329
-	 * @param string Encrypt method
330
-	 * @param string User email
331
-	 * @param string Language. Set by default to english
332
-	 * @param string Phone. Set by default to an empty string
333
-	 * @param string Expiration date. Set to null by default
334
-	 * @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field'). Leave empty if you don't want to update
335
-	 * @return mixed True if user was successfully updated, WSError otherwise
336
-	 */
337
-	protected function editUserHelper(
338
-		$user_id_field_name,
339
-		$user_id_value,
340
-		$firstname,
341
-		$lastname,
342
-		$status,
343
-		$loginname,
344
-		$password,
345
-		$encrypt_method,
346
-		$email,
347
-		$language,
348
-		$phone,
349
-		$expiration_date,
350
-		$extras
351
-	) {
319
+    /**
320
+     * Edits user info (helper method)
321
+     *
322
+     * @param string User id field name. Use "chamilo_user_id" in order to use internal system id
323
+     * @param string User id value
324
+     * @param string First name
325
+     * @param string Last name
326
+     * @param int User status
327
+     * @param string Login name
328
+     * @param string Password. Leave blank if you don't want to update it
329
+     * @param string Encrypt method
330
+     * @param string User email
331
+     * @param string Language. Set by default to english
332
+     * @param string Phone. Set by default to an empty string
333
+     * @param string Expiration date. Set to null by default
334
+     * @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field'). Leave empty if you don't want to update
335
+     * @return mixed True if user was successfully updated, WSError otherwise
336
+     */
337
+    protected function editUserHelper(
338
+        $user_id_field_name,
339
+        $user_id_value,
340
+        $firstname,
341
+        $lastname,
342
+        $status,
343
+        $loginname,
344
+        $password,
345
+        $encrypt_method,
346
+        $email,
347
+        $language,
348
+        $phone,
349
+        $expiration_date,
350
+        $extras
351
+    ) {
352 352
         global $api_failureList;
353
-		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
354
-		if($user_id instanceof WSError) {
355
-			return $user_id;
356
-		} else {
357
-			if($password == '') {
358
-				$password = null;
359
-			}
360
-			$user_info = api_get_user_info($user_id);
361
-			if (count($extras) == 0) {
362
-				$extras = null;
363
-			}
353
+        $user_id = $this->getUserId($user_id_field_name, $user_id_value);
354
+        if($user_id instanceof WSError) {
355
+            return $user_id;
356
+        } else {
357
+            if($password == '') {
358
+                $password = null;
359
+            }
360
+            $user_info = api_get_user_info($user_id);
361
+            if (count($extras) == 0) {
362
+                $extras = null;
363
+            }
364 364
 
365
-			$result = UserManager::update_user(
366
-				$user_id,
367
-				$firstname,
368
-				$lastname,
369
-				$loginname,
370
-				$password,
371
-				PLATFORM_AUTH_SOURCE,
372
-				$email,
373
-				$status,
374
-				'',
375
-				$phone,
376
-				$user_info['picture_uri'],
377
-				$expiration_date,
378
-				$user_info['active'],
379
-				null,
380
-				$user_info['hr_dept_id'],
381
-				$extras,
382
-				$encrypt_method
383
-			);
384
-			if (!$result) {
385
-				$failure = $api_failureList[0];
386
-				if($failure == 'encrypt_method invalid') {
387
-					return new WSError(103, 'The encryption of the password is invalid');
388
-				} else {
389
-					return new WSError(105, 'There was an error updating the user');
390
-				}
391
-			} else {
392
-				return $result;
393
-			}
394
-		}
395
-	}
365
+            $result = UserManager::update_user(
366
+                $user_id,
367
+                $firstname,
368
+                $lastname,
369
+                $loginname,
370
+                $password,
371
+                PLATFORM_AUTH_SOURCE,
372
+                $email,
373
+                $status,
374
+                '',
375
+                $phone,
376
+                $user_info['picture_uri'],
377
+                $expiration_date,
378
+                $user_info['active'],
379
+                null,
380
+                $user_info['hr_dept_id'],
381
+                $extras,
382
+                $encrypt_method
383
+            );
384
+            if (!$result) {
385
+                $failure = $api_failureList[0];
386
+                if($failure == 'encrypt_method invalid') {
387
+                    return new WSError(103, 'The encryption of the password is invalid');
388
+                } else {
389
+                    return new WSError(105, 'There was an error updating the user');
390
+                }
391
+            } else {
392
+                return $result;
393
+            }
394
+        }
395
+    }
396 396
 
397
-	/**
398
-	 * Edits user info
399
-	 *
400
-	 * @param string API secret key
401
-	 * @param string User id field name. Use "chamilo_user_id" in order to use internal system id
402
-	 * @param string User id value
403
-	 * @param string First name
404
-	 * @param string Last name
405
-	 * @param int User status
406
-	 * @param string Login name
407
-	 * @param string Password. Leave blank if you don't want to update it
408
-	 * @param string Encrypt method
409
-	 * @param string User email
410
-	 * @param string Language. Set by default to english
411
-	 * @param string Phone. Set by default to an empty string
412
-	 * @param string Expiration date. Set to null by default
413
-	 * @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field'). Leave empty if you don't want to update
414
-	 */
415
-	public function EditUser($secret_key, $user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras) {
416
-		// First, verify the secret key
417
-		$verifKey = $this->verifyKey($secret_key);
418
-		if($verifKey instanceof WSError) {
419
-			$this->handleError($verifKey);
420
-		} else {
397
+    /**
398
+     * Edits user info
399
+     *
400
+     * @param string API secret key
401
+     * @param string User id field name. Use "chamilo_user_id" in order to use internal system id
402
+     * @param string User id value
403
+     * @param string First name
404
+     * @param string Last name
405
+     * @param int User status
406
+     * @param string Login name
407
+     * @param string Password. Leave blank if you don't want to update it
408
+     * @param string Encrypt method
409
+     * @param string User email
410
+     * @param string Language. Set by default to english
411
+     * @param string Phone. Set by default to an empty string
412
+     * @param string Expiration date. Set to null by default
413
+     * @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field'). Leave empty if you don't want to update
414
+     */
415
+    public function EditUser($secret_key, $user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras) {
416
+        // First, verify the secret key
417
+        $verifKey = $this->verifyKey($secret_key);
418
+        if($verifKey instanceof WSError) {
419
+            $this->handleError($verifKey);
420
+        } else {
421 421
 
422
-			$extras_associative = array();
423
-			if (!empty($extras)) {
424
-				foreach($extras as $extra) {
425
-					$extras_associative[$extra['field_name']] = $extra['field_value'];
426
-				}
427
-			}
422
+            $extras_associative = array();
423
+            if (!empty($extras)) {
424
+                foreach($extras as $extra) {
425
+                    $extras_associative[$extra['field_name']] = $extra['field_value'];
426
+                }
427
+            }
428 428
 
429
-			$result = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras_associative);
430
-			if($result instanceof WSError) {
431
-				$this->handleError($result);
432
-			}
433
-		}
434
-	}
429
+            $result = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras_associative);
430
+            if($result instanceof WSError) {
431
+                $this->handleError($result);
432
+            }
433
+        }
434
+    }
435 435
 
436
-	/**
437
-	 * Edits multiple users
438
-	 *
439
-	 * @param string API secret key
440
-	 * @param array Users array. Each member of this array must follow the structure imposed by the EditUser method
441
-	 * @return array Array with elements like array('user_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different
442
-	 * than 0, an error occured
443
-	 */
444
-	public function EditUsers($secret_key, $users) {
445
-		$verifKey = $this->verifyKey($secret_key);
446
-		if($verifKey instanceof WSError) {
447
-			$this->handleError($verifKey);
448
-		} else {
449
-			$results = array();
450
-			foreach($users as $user) {
451
-				$result_tmp = array();
436
+    /**
437
+     * Edits multiple users
438
+     *
439
+     * @param string API secret key
440
+     * @param array Users array. Each member of this array must follow the structure imposed by the EditUser method
441
+     * @return array Array with elements like array('user_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different
442
+     * than 0, an error occured
443
+     */
444
+    public function EditUsers($secret_key, $users) {
445
+        $verifKey = $this->verifyKey($secret_key);
446
+        if($verifKey instanceof WSError) {
447
+            $this->handleError($verifKey);
448
+        } else {
449
+            $results = array();
450
+            foreach($users as $user) {
451
+                $result_tmp = array();
452 452
                 // re-initialize variables just in case
453 453
                 $user_id_field_name = $user_id_value = $firstname = $lastname = $status = $loginname = $password = $encrypt_method = $email = $language = $phone = $expiration_date = $extras = null;
454
-				extract($user);
455
-				$result_op = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras);
456
-				$result_tmp['user_id_value'] = $user['user_id_value'];
457
-				if($result_op instanceof WSError) {
458
-					// Return the error in the results
459
-					$result_tmp['result'] = $result_op->toArray();
460
-				} else {
461
-					$result_tmp['result'] = $this->getSuccessfulResult();
462
-				}
463
-				$results[] = $result_tmp;
464
-			}
465
-			return $results;
466
-		}
467
-	}
454
+                extract($user);
455
+                $result_op = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras);
456
+                $result_tmp['user_id_value'] = $user['user_id_value'];
457
+                if($result_op instanceof WSError) {
458
+                    // Return the error in the results
459
+                    $result_tmp['result'] = $result_op->toArray();
460
+                } else {
461
+                    $result_tmp['result'] = $this->getSuccessfulResult();
462
+                }
463
+                $results[] = $result_tmp;
464
+            }
465
+            return $results;
466
+        }
467
+    }
468 468
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	protected function changeUserActiveState($user_id_field_name, $user_id_value, $state) {
22 22
 		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
23
-		if($user_id instanceof WSError) {
23
+		if ($user_id instanceof WSError) {
24 24
 			return $user_id;
25 25
 		} else {
26
-			if($state == 0) {
26
+			if ($state == 0) {
27 27
 				UserManager::disable($user_id);
28
-			} else if($state == 1) {
28
+			} else if ($state == 1) {
29 29
 				UserManager::enable($user_id);
30 30
 			}
31 31
 		}
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	protected function changeUsersActiveState($users, $state) {
42 42
 		$results = array();
43
-		foreach($users as $user) {
43
+		foreach ($users as $user) {
44 44
 			$result_tmp = array();
45 45
 			$result_op = $this->changeUserActiveState($user['user_id_field_name'], $user['user_id_value'], $state);
46 46
 			$result_tmp['user_id_value'] = $user['user_id_value'];
47
-			if($result_op instanceof WSError) {
47
+			if ($result_op instanceof WSError) {
48 48
 				// Return the error in the results
49 49
 				$result_tmp['result'] = $result_op->toArray();
50 50
 			} else {
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function DisableUser($secret_key, $user_id_field_name, $user_id_value) {
66 66
 		$verifKey = $this->verifyKey($secret_key);
67
-		if($verifKey instanceof WSError) {
67
+		if ($verifKey instanceof WSError) {
68 68
 			// Let the implementation handle it
69 69
 			$this->handleError($verifKey);
70 70
 		} else {
71 71
 			$result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 0);
72
-			if($result instanceof WSError) {
72
+			if ($result instanceof WSError) {
73 73
 				$this->handleError($result);
74 74
 			}
75 75
 		}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function DisableUsers($secret_key, $users) {
87 87
 		$verifKey = $this->verifyKey($secret_key);
88
-		if($verifKey instanceof WSError) {
88
+		if ($verifKey instanceof WSError) {
89 89
 			// Let the implementation handle it
90 90
 			$this->handleError($verifKey);
91 91
 		} else {
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function EnableUser($secret_key, $user_id_field_name, $user_id_value) {
104 104
 		$verifKey = $this->verifyKey($secret_key);
105
-		if($verifKey instanceof WSError) {
105
+		if ($verifKey instanceof WSError) {
106 106
 			$this->handleError($verifKey);
107 107
 		} else {
108 108
 			$result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 1);
109
-			if($result instanceof WSError) {
109
+			if ($result instanceof WSError) {
110 110
 				$this->handleError($result);
111 111
 			}
112 112
 		}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function EnableUsers($secret_key, $users) {
124 124
 		$verifKey = $this->verifyKey($secret_key);
125
-		if($verifKey instanceof WSError) {
125
+		if ($verifKey instanceof WSError) {
126 126
 			// Let the implementation handle it
127 127
 			$this->handleError($verifKey);
128 128
 		} else {
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function deleteUserHelper($user_id_field_name, $user_id_value) {
141 141
 		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
142
-		if($user_id instanceof WSError) {
142
+		if ($user_id instanceof WSError) {
143 143
 			return $user_id;
144 144
 		} else {
145
-			if(!UserManager::delete_user($user_id)) {
145
+			if (!UserManager::delete_user($user_id)) {
146 146
 				return new WSError(101, "There was a problem while deleting this user");
147 147
 			} else {
148 148
 				return true;
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function DeleteUser($secret_key, $user_id_field_name, $user_id_value) {
161 161
 		$verifKey = $this->verifyKey($secret_key);
162
-		if($verifKey instanceof WSError) {
162
+		if ($verifKey instanceof WSError) {
163 163
 			$this->handleError($verifKey);
164 164
 		} else {
165 165
 			$result = $this->deleteUserHelper($user_id_field_name, $user_id_value);
166
-			if($result instanceof WSError) {
166
+			if ($result instanceof WSError) {
167 167
 				$this->handleError($result);
168 168
 			}
169 169
 		}
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function DeleteUsers($secret_key, $users) {
181 181
 		$verifKey = $this->verifyKey($secret_key);
182
-		if($verifKey instanceof WSError) {
182
+		if ($verifKey instanceof WSError) {
183 183
 			$this->handleError($verifKey);
184 184
 		} else {
185 185
 			$results = array();
186
-			foreach($users as $user) {
186
+			foreach ($users as $user) {
187 187
 				$result_tmp = array();
188 188
 				$result_op = $this->deleteUserHelper($user['user_id_field_name'], $user['user_id_value']);
189 189
 				$result_tmp['user_id_value'] = $user['user_id_value'];
190
-				if($result_op instanceof WSError) {
190
+				if ($result_op instanceof WSError) {
191 191
 					// Return the error in the results
192 192
 					$result_tmp['result'] = $result_op->toArray();
193 193
 				} else {
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
         global $api_failureList;
224 224
 		// Add the original user id field name and value to the extra fields if needed
225 225
 		$extras_associative = array();
226
-		if($user_id_field_name != "chamilo_user_id") {
226
+		if ($user_id_field_name != "chamilo_user_id") {
227 227
 			$extras_associative[$user_id_field_name] = $user_id_value;
228 228
 		}
229 229
                 if (!empty($extras)) {
230
-                    foreach($extras as $extra) {
230
+                    foreach ($extras as $extra) {
231 231
                         $extras_associative[$extra['field_name']] = $extra['field_value'];
232 232
                     }
233 233
                 }
234 234
 		$result = UserManager::create_user($firstname, $lastname, $status, $email, $login, $password, '', $language, $phone, '', PLATFORM_AUTH_SOURCE, $expiration_date, $visibility, 0, $extras_associative, $encrypt_method);
235 235
 		if (!$result) {
236 236
 			$failure = $api_failureList[0];
237
-			if($failure == 'login-pass already taken') {
237
+			if ($failure == 'login-pass already taken') {
238 238
 				return new WSError(102, 'This username is already taken');
239
-			} else if($failure == 'encrypt_method invalid') {
239
+			} else if ($failure == 'encrypt_method invalid') {
240 240
 				return new WSError(103, 'The encryption of the password is invalid');
241 241
 			} else {
242 242
 				return new WSError(104, 'There was an error creating the user');
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	public function CreateUser($secret_key, $firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility = 1, $email = '', $language = 'english', $phone = '', $expiration_date = '0000-00-00 00:00:00', $extras = array()) {
271 271
 		// First, verify the secret key
272 272
 		$verifKey = $this->verifyKey($secret_key);
273
-		if($verifKey instanceof WSError) {
273
+		if ($verifKey instanceof WSError) {
274 274
 			$this->handleError($verifKey);
275 275
 		} else {
276 276
 			$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
277
-			if($result instanceof WSError) {
277
+			if ($result instanceof WSError) {
278 278
 				$this->handleError($result);
279 279
 			} else {
280 280
 				return $result;
@@ -291,17 +291,17 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	public function CreateUsers($secret_key, $users) {
293 293
 		$verifKey = $this->verifyKey($secret_key);
294
-		if($verifKey instanceof WSError) {
294
+		if ($verifKey instanceof WSError) {
295 295
 			$this->handleError($verifKey);
296 296
 		} else {
297 297
 			$results = array();
298
-			foreach($users as $user) {
298
+			foreach ($users as $user) {
299 299
 				$result_tmp = array();
300 300
                 // re-initialize variables just in case
301 301
                 $firstname = $lastname = $status = $login = $password = $encrypt_method = $user_id_field_name = $user_id_value = $visibility = $email = $language = $phone = $expiration_date = $extras = null;
302 302
 				extract($user);
303 303
 				$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
304
-				if($result instanceof WSError) {
304
+				if ($result instanceof WSError) {
305 305
 					$result_tmp['result'] = $result->toArray();
306 306
 					$result_tmp['user_id_value'] = $user_id_value;
307 307
 					$result_tmp['user_id_generated'] = 0;
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
 	) {
352 352
         global $api_failureList;
353 353
 		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
354
-		if($user_id instanceof WSError) {
354
+		if ($user_id instanceof WSError) {
355 355
 			return $user_id;
356 356
 		} else {
357
-			if($password == '') {
357
+			if ($password == '') {
358 358
 				$password = null;
359 359
 			}
360 360
 			$user_info = api_get_user_info($user_id);
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			);
384 384
 			if (!$result) {
385 385
 				$failure = $api_failureList[0];
386
-				if($failure == 'encrypt_method invalid') {
386
+				if ($failure == 'encrypt_method invalid') {
387 387
 					return new WSError(103, 'The encryption of the password is invalid');
388 388
 				} else {
389 389
 					return new WSError(105, 'There was an error updating the user');
@@ -415,19 +415,19 @@  discard block
 block discarded – undo
415 415
 	public function EditUser($secret_key, $user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras) {
416 416
 		// First, verify the secret key
417 417
 		$verifKey = $this->verifyKey($secret_key);
418
-		if($verifKey instanceof WSError) {
418
+		if ($verifKey instanceof WSError) {
419 419
 			$this->handleError($verifKey);
420 420
 		} else {
421 421
 
422 422
 			$extras_associative = array();
423 423
 			if (!empty($extras)) {
424
-				foreach($extras as $extra) {
424
+				foreach ($extras as $extra) {
425 425
 					$extras_associative[$extra['field_name']] = $extra['field_value'];
426 426
 				}
427 427
 			}
428 428
 
429 429
 			$result = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras_associative);
430
-			if($result instanceof WSError) {
430
+			if ($result instanceof WSError) {
431 431
 				$this->handleError($result);
432 432
 			}
433 433
 		}
@@ -443,18 +443,18 @@  discard block
 block discarded – undo
443 443
 	 */
444 444
 	public function EditUsers($secret_key, $users) {
445 445
 		$verifKey = $this->verifyKey($secret_key);
446
-		if($verifKey instanceof WSError) {
446
+		if ($verifKey instanceof WSError) {
447 447
 			$this->handleError($verifKey);
448 448
 		} else {
449 449
 			$results = array();
450
-			foreach($users as $user) {
450
+			foreach ($users as $user) {
451 451
 				$result_tmp = array();
452 452
                 // re-initialize variables just in case
453 453
                 $user_id_field_name = $user_id_value = $firstname = $lastname = $status = $loginname = $password = $encrypt_method = $email = $language = $phone = $expiration_date = $extras = null;
454 454
 				extract($user);
455 455
 				$result_op = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras);
456 456
 				$result_tmp['user_id_value'] = $user['user_id_value'];
457
-				if($result_op instanceof WSError) {
457
+				if ($result_op instanceof WSError) {
458 458
 					// Return the error in the results
459 459
 					$result_tmp['result'] = $result_op->toArray();
460 460
 				} else {
Please login to merge, or discard this patch.
main/work/downloadfolder.inc.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@
 block discarded – undo
212 212
  * @param array $arr1 first array
213 213
  * @param array $arr2 second array
214 214
  *
215
- * @return array difference between the two arrays
215
+ * @return string difference between the two arrays
216 216
  */
217 217
 function diff($arr1, $arr2)
218 218
 {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
 if (api_is_allowed_to_edit() || api_is_coach()) {
64 64
     //Search for all files that are not deleted => visibility != 2
65
-   $sql = "SELECT DISTINCT
65
+    $sql = "SELECT DISTINCT
66 66
                 url,
67 67
                 title,
68 68
                 description,
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 $work_id = $_GET['id'];
11 11
 require_once '../inc/global.inc.php';
12
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
12
+$current_course_tool = TOOL_STUDENTPUBLICATION;
13 13
 $_course = api_get_course_info();
14 14
 
15 15
 // Protection
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 if (!empty($files)) {
179 179
     $fileName = api_replace_dangerous_char($work_data['title']);
180 180
     // Logging
181
-    Event::event_download($fileName .'.zip (folder)');
181
+    Event::event_download($fileName.'.zip (folder)');
182 182
 
183 183
     //start download of created file
184
-    $name = $fileName .'.zip';
184
+    $name = $fileName.'.zip';
185 185
     if (Security::check_abs_path($temp_zip_file, api_get_path(SYS_ARCHIVE_PATH))) {
186 186
         DocumentManager::file_send_for_download($temp_zip_file, true, $name);
187 187
         @unlink($temp_zip_file);
Please login to merge, or discard this patch.
main/work/work.lib.php 2 patches
Doc Comments   +18 added lines, -17 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
  * Create a group of select from a date
159 159
  * @param FormValidator $form
160 160
  * @param string $prefix
161
- * @return array
161
+ * @return HTML_QuickForm_element[]
162 162
  */
163 163
 function create_group_date_select($form, $prefix = '')
164 164
 {
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
  * @author Bert Vanderkimpen
753 753
  * @author Yannick Warnier <[email protected]> Adaptation for work tool
754 754
  * @param   string $base_work_dir Base work dir (.../work)
755
- * @param   string $desiredDirName complete path of the desired name
755
+ * @param   string $desired_dir_name complete path of the desired name
756 756
  *
757 757
  * @return  string actual directory name if it succeeds, boolean false otherwise
758 758
  */
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 /**
775 775
  * Delete a work-tool directory
776 776
  * @param   int  $id work directory id to delete
777
- * @return  integer -1 on error
777
+ * @return  boolean|null -1 on error
778 778
  */
779 779
 function deleteDirWork($id)
780 780
 {
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
  * Update the url of a dir in the student_publication table
918 918
  * @param  array $work_data work original data
919 919
  * @param  string $newPath Example: "folder1"
920
- * @return bool
920
+ * @return boolean|null
921 921
  */
922 922
 function updateDirName($work_data, $newPath)
923 923
 {
@@ -974,6 +974,7 @@  discard block
 block discarded – undo
974 974
 /**
975 975
  * Transform an all directory structure (only directories) in an array
976 976
  * @param   string path of the directory
977
+ * @param string $directory
977 978
  * @return  array the directory structure into an array
978 979
  * @author  Julio Montoya Dokeos
979 980
  * @version April 2008
@@ -1043,7 +1044,7 @@  discard block
 block discarded – undo
1043 1044
  * @param   string the path of the directory
1044 1045
  * @param   boolean true if we want the total quantity of files
1045 1046
  * include in others child directories, false only  files in the directory
1046
- * @return  array the first element is an integer with the number of files
1047
+ * @return  integer[] the first element is an integer with the number of files
1047 1048
  * in the folder, the second element is the number of directories
1048 1049
  * @author  Julio Montoya
1049 1050
  * @version April 2008
@@ -2319,7 +2320,7 @@  discard block
 block discarded – undo
2319 2320
 }
2320 2321
 
2321 2322
 /**
2322
- * @param $name
2323
+ * @param string $name
2323 2324
  * @param $values
2324 2325
  * @param string $checked
2325 2326
  * @return string
@@ -2845,7 +2846,7 @@  discard block
 block discarded – undo
2845 2846
  * @param int $userId
2846 2847
  * @param int $workId
2847 2848
  * @param int $courseId
2848
- * @return bool
2849
+ * @return boolean|null
2849 2850
  */
2850 2851
 function allowOnlySubscribedUser($userId, $workId, $courseId)
2851 2852
 {
@@ -2963,7 +2964,7 @@  discard block
 block discarded – undo
2963 2964
 /**
2964 2965
  * Get total score from a work list
2965 2966
  * @param $workList
2966
- * @return int|null
2967
+ * @return integer
2967 2968
  */
2968 2969
 function getTotalWorkScore($workList)
2969 2970
 {
@@ -2979,7 +2980,7 @@  discard block
 block discarded – undo
2979 2980
  * Get comment count from a work list (docs sent by students)
2980 2981
  * @param array $workList
2981 2982
  * @param array $courseInfo
2982
- * @return int|null
2983
+ * @return integer
2983 2984
  */
2984 2985
 function getTotalWorkComment($workList, $courseInfo = array())
2985 2986
 {
@@ -3122,6 +3123,7 @@  discard block
 block discarded – undo
3122 3123
  * @param int $parentId
3123 3124
  * @param array $courseInfo
3124 3125
  * @param int $sessionId
3126
+ * @param integer $userId
3125 3127
  * @return int
3126 3128
  */
3127 3129
 function getLastWorkStudentFromParentByUser(
@@ -3738,12 +3740,11 @@  discard block
 block discarded – undo
3738 3740
 
3739 3741
 /**
3740 3742
  * Creates a new task (directory) in the assignment tool
3741
- * @param array $params
3742 3743
  * @param int $user_id
3743 3744
  * @param array $courseInfo
3744 3745
  * @param int $group_id
3745 3746
  * @param int $session_id
3746
- * @return bool|int
3747
+ * @return string|false
3747 3748
  * @note $params can have the following elements, but should at least have the 2 first ones: (
3748 3749
  *       'new_dir' => 'some-name',
3749 3750
  *       'description' => 'some-desc',
@@ -4239,7 +4240,7 @@  discard block
 block discarded – undo
4239 4240
 }
4240 4241
 
4241 4242
 /**
4242
- * @return array
4243
+ * @return string[]
4243 4244
  */
4244 4245
 function getUploadDocumentType()
4245 4246
 {
@@ -4611,7 +4612,7 @@  discard block
 block discarded – undo
4611 4612
  * @param int Session ID
4612 4613
  * @param $correction
4613 4614
  *
4614
- * @return array|bool
4615
+ * @return boolean
4615 4616
  */
4616 4617
 function getFileContents($id, $course_info, $sessionId = 0, $correction = false)
4617 4618
 {
@@ -4729,7 +4730,7 @@  discard block
 block discarded – undo
4729 4730
  * @param int $userId
4730 4731
  * @param array $courseInfo
4731 4732
  * @param string $format
4732
- * @return bool
4733
+ * @return false|null
4733 4734
  */
4734 4735
 function exportAllWork($userId, $courseInfo, $format = 'pdf')
4735 4736
 {
@@ -4777,7 +4778,7 @@  discard block
 block discarded – undo
4777 4778
  * @param array $courseInfo
4778 4779
  * @param int $sessionId
4779 4780
  * @param string $format
4780
- * @return bool
4781
+ * @return false|null
4781 4782
  */
4782 4783
 function exportAllStudentWorkFromPublication(
4783 4784
     $workId,
@@ -4915,7 +4916,7 @@  discard block
 block discarded – undo
4915 4916
  * Downloads all user files per user
4916 4917
  * @param int $userId
4917 4918
  * @param array $courseInfo
4918
- * @return bool
4919
+ * @return false|null
4919 4920
  */
4920 4921
 function downloadAllFilesPerUser($userId, $courseInfo)
4921 4922
 {
@@ -5029,7 +5030,7 @@  discard block
 block discarded – undo
5029 5030
 /**
5030 5031
  * @param array $courseInfo
5031 5032
  * @param int $workId
5032
- * @return bool
5033
+ * @return boolean|null
5033 5034
  */
5034 5035
 function protectWork($courseInfo, $workId)
5035 5036
 {
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 
36 36
     if (!empty($id)) {
37 37
         $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'&id='.$my_back_id.'">'.
38
-            Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
38
+            Display::return_icon('back.png', get_lang('BackToWorksList'), '', ICON_SIZE_MEDIUM).'</a>';
39 39
     }
40 40
 
41 41
     if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') {
42 42
         // Create dir
43 43
         if (empty($id)) {
44 44
             $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=create_dir&origin='.$origin.'&gradebook='.$gradebook.'">';
45
-            $display_output .= Display::return_icon('new_work.png', get_lang('CreateAssignment'),'',ICON_SIZE_MEDIUM).'</a>';
45
+            $display_output .= Display::return_icon('new_work.png', get_lang('CreateAssignment'), '', ICON_SIZE_MEDIUM).'</a>';
46 46
         }
47 47
         if (empty($id)) {
48 48
             // Options
49 49
             $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=settings&origin='.$origin.'&gradebook='.$gradebook.'">';
50
-            $display_output .= Display::return_icon('settings.png', get_lang('EditToolOptions'),'',ICON_SIZE_MEDIUM).'</a>';
50
+            $display_output .= Display::return_icon('settings.png', get_lang('EditToolOptions'), '', ICON_SIZE_MEDIUM).'</a>';
51 51
         }
52
-        $display_output .= '<a id="open-view-list" href="#">' . Display::return_icon('listwork.png', get_lang('ViewStudents'),'',ICON_SIZE_MEDIUM) . '</a>';
52
+        $display_output .= '<a id="open-view-list" href="#">'.Display::return_icon('listwork.png', get_lang('ViewStudents'), '', ICON_SIZE_MEDIUM).'</a>';
53 53
 
54 54
     }
55 55
 
56 56
     if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath' && api_is_allowed_to_session_edit(false, true)) {
57 57
         // Delete all files
58
-        if (api_get_setting('permanently_remove_deleted_files') == 'true'){
58
+        if (api_get_setting('permanently_remove_deleted_files') == 'true') {
59 59
             $message = get_lang('ConfirmYourChoiceDeleteAllfiles');
60 60
         } else {
61 61
             $message = get_lang('ConfirmYourChoice');
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function two_digits($number)
114 114
 {
115
-    $number = (int)$number;
115
+    $number = (int) $number;
116 116
     return ($number < 10) ? '0'.$number : $number;
117 117
 }
118 118
 
@@ -547,11 +547,11 @@  discard block
 block discarded – undo
547 547
     );
548 548
 
549 549
     $columnModel = array(
550
-        array('name'=>'type', 'index'=>'type', 'width'=>'30',   'align'=>'center', 'sortable' => 'false'),
551
-        array('name'=>'title', 'index'=>'title', 'width'=>'250',   'align'=>'left'),
552
-        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'80',  'align'=>'center', 'sortable'=>'false'),
553
-        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80',  'align'=>'center'),
554
-        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125',  'align'=>'center'),
550
+        array('name'=>'type', 'index'=>'type', 'width'=>'30', 'align'=>'center', 'sortable' => 'false'),
551
+        array('name'=>'title', 'index'=>'title', 'width'=>'250', 'align'=>'left'),
552
+        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'80', 'align'=>'center', 'sortable'=>'false'),
553
+        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80', 'align'=>'center'),
554
+        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125', 'align'=>'center'),
555 555
     );
556 556
 
557 557
     if ($courseInfo['show_score'] == 0) {
@@ -588,10 +588,10 @@  discard block
 block discarded – undo
588 588
 {
589 589
     $columnModel = array(
590 590
         array('name'=>'type', 'index'=>'type', 'width'=>'35', 'align'=>'center', 'sortable' => 'false'),
591
-        array('name'=>'title', 'index'=>'title',  'width'=>'300',   'align'=>'left', 'wrap_cell' => "true"),
592
-        array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'125',  'align'=>'center'),
593
-        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'125',  'align'=>'center'),
594
-        array('name'=>'amount', 'index'=>'end_on', 'width'=>'110',  'align'=>'center'),
591
+        array('name'=>'title', 'index'=>'title', 'width'=>'300', 'align'=>'left', 'wrap_cell' => "true"),
592
+        array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'125', 'align'=>'center'),
593
+        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'125', 'align'=>'center'),
594
+        array('name'=>'amount', 'index'=>'end_on', 'width'=>'110', 'align'=>'center'),
595 595
         array('name'=>'actions', 'index'=>'actions', 'width'=>'110', 'align'=>'left', 'sortable'=>'false')
596 596
     );
597 597
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
         return false;
794 794
     }
795 795
 
796
-    $base_work_dir = api_get_path(SYS_COURSE_PATH) .$_course['path'].'/work';
796
+    $base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/work';
797 797
     $work_data_url = $base_work_dir.$work_data['url'];
798 798
     $check = Security::check_abs_path($work_data_url.'/', $base_work_dir.'/');
799 799
 
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 function get_work_path($id)
864 864
 {
865 865
     $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
866
-    $course_id  = api_get_course_int_id();
866
+    $course_id = api_get_course_int_id();
867 867
     $sql = 'SELECT url FROM '.$table.'
868 868
             WHERE c_id = '.$course_id.' AND id='.intval($id);
869 869
     $res = Database::query($sql);
@@ -984,9 +984,9 @@  discard block
 block discarded – undo
984 984
     if ($handle = @opendir($directory)) {
985 985
         while (false !== ($file = readdir($handle))) {
986 986
             if ($file != '.' && $file != '..') {
987
-                if (is_dir($directory. '/' . $file)) {
988
-                    $array_items = array_merge($array_items, directory_to_array($directory. '/' . $file));
989
-                    $file = $directory . '/' . $file;
987
+                if (is_dir($directory.'/'.$file)) {
988
+                    $array_items = array_merge($array_items, directory_to_array($directory.'/'.$file));
989
+                    $file = $directory.'/'.$file;
990 990
                     $array_items[] = preg_replace("/\/\//si", '/', $file);
991 991
                 }
992 992
             }
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 
1019 1019
     $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
1020 1020
 
1021
-    for($i = 0; $i < count($only_dir); $i++) {
1021
+    for ($i = 0; $i < count($only_dir); $i++) {
1022 1022
         $url = $only_dir[$i];
1023 1023
 
1024 1024
         $params = [
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
             if (is_dir($path_dir.'/'.$entry)) {
1059 1059
                 $count_dir++;
1060 1060
                 if ($recurse) {
1061
-                    $count += count_dir($path_dir . '/' . $entry, $recurse);
1061
+                    $count += count_dir($path_dir.'/'.$entry, $recurse);
1062 1062
                 }
1063 1063
             } else {
1064 1064
                 $count++;
@@ -1323,11 +1323,11 @@  discard block
 block discarded – undo
1323 1323
         $courseInfo
1324 1324
     );
1325 1325
 
1326
-    if (!in_array($direction, array('asc','desc'))) {
1326
+    if (!in_array($direction, array('asc', 'desc'))) {
1327 1327
         $direction = 'desc';
1328 1328
     }
1329 1329
     if (!empty($where_condition)) {
1330
-        $where_condition = ' AND ' . $where_condition;
1330
+        $where_condition = ' AND '.$where_condition;
1331 1331
     }
1332 1332
 
1333 1333
     $column = !empty($column) ? Database::escape_string($column) : 'sent_date';
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
         $direction = 'desc';
1471 1471
     }
1472 1472
     if (!empty($where_condition)) {
1473
-        $where_condition = ' AND ' . $where_condition;
1473
+        $where_condition = ' AND '.$where_condition;
1474 1474
     }
1475 1475
 
1476 1476
     $column = !empty($column) ? Database::escape_string($column) : 'sent_date';
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
             );
1528 1528
 
1529 1529
             $work['amount'] = Display::label(
1530
-                $countUniqueAttempts . '/' .
1530
+                $countUniqueAttempts.'/'.
1531 1531
                 $totalUsers,
1532 1532
                 'success'
1533 1533
             );
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
                         array(),
1577 1577
                         ICON_SIZE_SMALL
1578 1578
                     ),
1579
-                    api_get_path(WEB_CODE_PATH) . 'work/downloadfolder.inc.php?id=' . $workId . '&' . api_get_cidreq()
1579
+                    api_get_path(WEB_CODE_PATH).'work/downloadfolder.inc.php?id='.$workId.'&'.api_get_cidreq()
1580 1580
                 );
1581 1581
             } else {
1582 1582
                 $downloadLink = Display::url(
@@ -1660,7 +1660,7 @@  discard block
 block discarded – undo
1660 1660
     $userCondition = " AND u.user_id = $studentId ";
1661 1661
     $sessionCondition = " AND w.session_id = $sessionId ";
1662 1662
     $workCondition = " AND w_rel.work_id = $workId";
1663
-    $workParentCondition  = " AND w.parent_id = $workId";
1663
+    $workParentCondition = " AND w.parent_id = $workId";
1664 1664
 
1665 1665
     $sql = "(
1666 1666
                 $select1 FROM $userTable u
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
         }
1769 1769
 
1770 1770
         if ($allowEdition && !empty($itemId)) {
1771
-            $deleteLink  = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId);
1771
+            $deleteLink = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId);
1772 1772
         } else {
1773 1773
             $deleteLink = null;
1774 1774
         }
@@ -1849,7 +1849,7 @@  discard block
 block discarded – undo
1849 1849
     $start = intval($start);
1850 1850
     $limit = intval($limit);
1851 1851
 
1852
-    if (!in_array($direction, array('asc','desc'))) {
1852
+    if (!in_array($direction, array('asc', 'desc'))) {
1853 1853
         $direction = 'desc';
1854 1854
     }
1855 1855
 
@@ -1917,13 +1917,13 @@  discard block
 block discarded – undo
1917 1917
         $work_assignment = get_work_assignment_by_id($work_id);
1918 1918
 
1919 1919
         if (!empty($studentId)) {
1920
-            $where_condition.= " AND u.user_id = ".intval($studentId);
1920
+            $where_condition .= " AND u.user_id = ".intval($studentId);
1921 1921
         }
1922 1922
 
1923 1923
         $sql = " $select
1924 1924
                 FROM $work_condition  $user_condition
1925 1925
                 WHERE $extra_conditions $where_condition $condition_session
1926
-                    AND u.status != " . INVITEE . "
1926
+                    AND u.status != ".INVITEE."
1927 1927
                 ORDER BY $column $direction";
1928 1928
 
1929 1929
         if (!empty($start) && !empty($limit)) {
@@ -1980,7 +1980,7 @@  discard block
 block discarded – undo
1980 1980
                     $qualification_string = Display::label('-');
1981 1981
                 } else {
1982 1982
                     $label = 'info';
1983
-                    $relativeScore = $work['qualification']/$work_data['qualification'];
1983
+                    $relativeScore = $work['qualification'] / $work_data['qualification'];
1984 1984
                     if ($relativeScore < 0.5) {
1985 1985
                         $label = 'important';
1986 1986
                     } elseif ($relativeScore < 0.75) {
@@ -2036,10 +2036,10 @@  discard block
 block discarded – undo
2036 2036
                 // If URL is present then there's a file to download keep BC.
2037 2037
                 if ($work['contains_file'] || !empty($work['url'])) {
2038 2038
                     $link_to_download = '<a href="'.$url.'download.php?id='.$item_id.'&'.api_get_cidreq().'">'.
2039
-                        Display::return_icon('save.png', get_lang('Save'),array(), ICON_SIZE_SMALL).'</a> ';
2039
+                        Display::return_icon('save.png', get_lang('Save'), array(), ICON_SIZE_SMALL).'</a> ';
2040 2040
                 }
2041 2041
 
2042
-                $send_to = Portfolio::share('work', $work['id'],  array('style' => 'white-space:nowrap;'));
2042
+                $send_to = Portfolio::share('work', $work['id'], array('style' => 'white-space:nowrap;'));
2043 2043
 
2044 2044
                 $feedback = null;
2045 2045
                 $count = getWorkCommentCount($item_id, $course_info);
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
                 $work_date = api_convert_and_format_date($work['sent_date']);
2059 2059
 
2060 2060
                 $work['sent_date_from_db'] = $work['sent_date'];
2061
-                $work['sent_date'] = '<div class="date-time">' . date_to_str_ago(api_get_local_time($work['sent_date'])) . ' ' . $add_string . ' ' . $work_date . '</div>';
2061
+                $work['sent_date'] = '<div class="date-time">'.date_to_str_ago(api_get_local_time($work['sent_date'])).' '.$add_string.' '.$work_date.'</div>';
2062 2062
 
2063 2063
                 // Actions.
2064 2064
                 $correction = '';
@@ -2076,8 +2076,8 @@  discard block
 block discarded – undo
2076 2076
                         Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a> ';
2077 2077
 
2078 2078
                     if ($unoconv && empty($work['contains_file'])) {
2079
-                        $action .=  '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'" title="'.get_lang('ExportToDoc').'" >'.
2080
-                            Display::return_icon('export_doc.png', get_lang('ExportToDoc'),array(), ICON_SIZE_SMALL).'</a> ';
2079
+                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'" title="'.get_lang('ExportToDoc').'" >'.
2080
+                            Display::return_icon('export_doc.png', get_lang('ExportToDoc'), array(), ICON_SIZE_SMALL).'</a> ';
2081 2081
                     }
2082 2082
 
2083 2083
                     $correction = '
@@ -2120,9 +2120,9 @@  discard block
 block discarded – undo
2120 2120
 
2121 2121
                     if ($locked) {
2122 2122
                         if ($qualification_exists) {
2123
-                            $action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'),array(), ICON_SIZE_SMALL);
2123
+                            $action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'), array(), ICON_SIZE_SMALL);
2124 2124
                         } else {
2125
-                            $action .= Display::return_icon('edit_na.png', get_lang('Comment'),array(), ICON_SIZE_SMALL);
2125
+                            $action .= Display::return_icon('edit_na.png', get_lang('Comment'), array(), ICON_SIZE_SMALL);
2126 2126
                         }
2127 2127
                     } else {
2128 2128
                         if ($qualification_exists) {
@@ -2136,45 +2136,45 @@  discard block
 block discarded – undo
2136 2136
 
2137 2137
                     if ($work['contains_file']) {
2138 2138
                         if ($locked) {
2139
-                            $action .= Display::return_icon('move_na.png', get_lang('Move'),array(), ICON_SIZE_SMALL);
2139
+                            $action .= Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
2140 2140
                         } else {
2141 2141
                             $action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=move&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Move').'">'.
2142
-                                Display::return_icon('move.png', get_lang('Move'),array(), ICON_SIZE_SMALL).'</a>';
2142
+                                Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
2143 2143
                         }
2144 2144
                     }
2145 2145
 
2146 2146
                     if ($work['accepted'] == '1') {
2147 2147
                         $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_invisible&item_id='.$item_id.'" title="'.get_lang('Invisible').'" >'.
2148
-                            Display::return_icon('visible.png', get_lang('Invisible'),array(), ICON_SIZE_SMALL).'</a>';
2148
+                            Display::return_icon('visible.png', get_lang('Invisible'), array(), ICON_SIZE_SMALL).'</a>';
2149 2149
                     } else {
2150 2150
                         $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_visible&item_id='.$item_id.'" title="'.get_lang('Visible').'" >'.
2151
-                            Display::return_icon('invisible.png', get_lang('Visible'),array(), ICON_SIZE_SMALL).'</a> ';
2151
+                            Display::return_icon('invisible.png', get_lang('Visible'), array(), ICON_SIZE_SMALL).'</a> ';
2152 2152
                     }
2153 2153
 
2154 2154
                     if ($locked) {
2155 2155
                         $action .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
2156 2156
                     } else {
2157
-                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
2158
-                            Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
2157
+                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
2158
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
2159 2159
                     }
2160 2160
                 } elseif ($is_author && (empty($work['qualificator_id']) || $work['qualificator_id'] == 0)) {
2161 2161
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
2162
-                        Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a>';
2162
+                        Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
2163 2163
 
2164 2164
                     if (api_get_course_setting('student_delete_own_publication') == 1) {
2165 2165
                         if (api_is_allowed_to_session_edit(false, true)) {
2166 2166
                             $action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
2167
-                                Display::return_icon('edit.png', get_lang('Comment'),array(), ICON_SIZE_SMALL).'</a>';
2167
+                                Display::return_icon('edit.png', get_lang('Comment'), array(), ICON_SIZE_SMALL).'</a>';
2168 2168
                         }
2169
-                        $action .= ' <a href="'.$url.'work_list.php?'.api_get_cidreq().'&action=delete&item_id='.$item_id.'&id='.$work['parent_id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'"  >'.
2170
-                            Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
2169
+                        $action .= ' <a href="'.$url.'work_list.php?'.api_get_cidreq().'&action=delete&item_id='.$item_id.'&id='.$work['parent_id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'"  >'.
2170
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
2171 2171
                     } else {
2172
-                        $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
2172
+                        $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
2173 2173
                     }
2174 2174
                 } else {
2175 2175
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
2176
-                        Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a>';
2177
-                    $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
2176
+                        Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
2177
+                    $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
2178 2178
                 }
2179 2179
 
2180 2180
                 // Status.
@@ -2207,7 +2207,7 @@  discard block
 block discarded – undo
2207 2207
     $_course = api_get_course_info();
2208 2208
     $task_id = $task_data['id'];
2209 2209
     $task_title = !empty($task_data['title']) ? $task_data['title'] : basename($task_data['url']);
2210
-    $subject = '[' . api_get_setting('siteName') . '] ';
2210
+    $subject = '['.api_get_setting('siteName').'] ';
2211 2211
 
2212 2212
     // The body can be as long as you wish, and any combination of text and variables
2213 2213
     $content = get_lang('ReminderToSubmitPendingTask')."\n".get_lang('CourseName').' : '.$_course['name']."\n";
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
     $mails_sent_to = array();
2219 2219
     foreach ($list_users as $user) {
2220 2220
         $name_user = api_get_person_name($user[1], $user[0], null, PERSON_NAME_EMAIL_ADDRESS);
2221
-        $dear_line = get_lang('Dear')." ".api_get_person_name($user[1], $user[0]) .", \n\n";
2221
+        $dear_line = get_lang('Dear')." ".api_get_person_name($user[1], $user[0]).", \n\n";
2222 2222
         $body      = $dear_line.$content;
2223 2223
         MessageManager::send_message($user[3], $subject, $body);
2224 2224
         $mails_sent_to[] = $name_user;
@@ -2247,22 +2247,22 @@  discard block
 block discarded – undo
2247 2247
     } else {
2248 2248
         $students = CourseManager::get_student_list_from_course_code($courseCode, true, $sessionId);
2249 2249
     }
2250
-    $emailsubject = '[' . api_get_setting('siteName') . '] '.get_lang('HomeworkCreated');
2250
+    $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('HomeworkCreated');
2251 2251
     $currentUser = api_get_user_info(api_get_user_id());
2252 2252
     if (!empty($students)) {
2253
-        foreach($students as $student) {
2253
+        foreach ($students as $student) {
2254 2254
             $user_info = api_get_user_info($student["user_id"]);
2255
-            if(!empty($user_info["mail"])) {
2255
+            if (!empty($user_info["mail"])) {
2256 2256
                 $name_user = api_get_person_name(
2257 2257
                     $user_info["firstname"],
2258 2258
                     $user_info["lastname"],
2259 2259
                     null,
2260 2260
                     PERSON_NAME_EMAIL_ADDRESS
2261 2261
                 );
2262
-                $link = api_get_path(WEB_CODE_PATH) . 'work/work_list_all.php?' . api_get_cidreq() . '&id=' . $workId;
2262
+                $link = api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId;
2263 2263
                 $emailbody = get_lang('Dear')." ".$name_user.",\n\n";
2264 2264
                 $emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse')." ".$courseCode.". "."\n\n".
2265
-                    '<a href="'. $link . '">' . get_lang('PleaseCheckHomeworkPage') . '</a>';
2265
+                    '<a href="'.$link.'">'.get_lang('PleaseCheckHomeworkPage').'</a>';
2266 2266
                 $emailbody .= "\n\n".api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);
2267 2267
 
2268 2268
                 $additionalParameters = array(
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
     $url = Database::escape_string($url);
2305 2305
     $sql = "SELECT id FROM $work_table WHERE url='$url'";
2306 2306
     $result = Database::query($sql);
2307
-    if (Database::num_rows($result)> 0) {
2307
+    if (Database::num_rows($result) > 0) {
2308 2308
         $row = Database::fetch_row($result);
2309 2309
         if (empty($row)) {
2310 2310
             return false;
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 {
2327 2327
     $output = '<select name="'.$name.'" id="'.$name.'">';
2328 2328
     foreach ($values as $key => $value) {
2329
-        $output .= '<option value="'.$key.'" '.(($checked==$key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2329
+        $output .= '<option value="'.$key.'" '.(($checked == $key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2330 2330
     }
2331 2331
     $output .= '</select>';
2332 2332
     return $output;
@@ -2340,9 +2340,9 @@  discard block
 block discarded – undo
2340 2340
  */
2341 2341
 function make_checkbox($name, $checked = '', $label = null)
2342 2342
 {
2343
-    $check = '<input id ="'.$name.'" type="checkbox" value="1" name="'.$name.'" '.((!empty($checked))?'checked="checked"':'').'/>';
2343
+    $check = '<input id ="'.$name.'" type="checkbox" value="1" name="'.$name.'" '.((!empty($checked)) ? 'checked="checked"' : '').'/>';
2344 2344
     if (!empty($label)) {
2345
-        $check .="<label for ='$name'>$label</label>";
2345
+        $check .= "<label for ='$name'>$label</label>";
2346 2346
     }
2347 2347
     return $check;
2348 2348
 }
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
     }
2497 2497
 
2498 2498
     if (!empty($studentId)) {
2499
-        $sql_users.= " AND u.user_id = ".intval($studentId);
2499
+        $sql_users .= " AND u.user_id = ".intval($studentId);
2500 2500
     }
2501 2501
 
2502 2502
     $group_id = api_get_group_id();
@@ -2506,7 +2506,7 @@  discard block
 block discarded – undo
2506 2506
     if ($group_id) {
2507 2507
         $group_user_list = GroupManager::get_subscribed_users($group_id);
2508 2508
         if (!empty($group_user_list)) {
2509
-            foreach($group_user_list as $group_user) {
2509
+            foreach ($group_user_list as $group_user) {
2510 2510
                 $new_group_user_list[] = $group_user['user_id'];
2511 2511
             }
2512 2512
         }
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
 function getWorkComments($work)
2928 2928
 {
2929 2929
     $commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT);
2930
-    $userTable= Database::get_main_table(TABLE_MAIN_USER);
2930
+    $userTable = Database::get_main_table(TABLE_MAIN_USER);
2931 2931
 
2932 2932
     $courseId = intval($work['c_id']);
2933 2933
     $workId = intval($work['id']);
@@ -3610,7 +3610,7 @@  discard block
 block discarded – undo
3610 3610
             null,
3611 3611
             PERSON_NAME_EMAIL_ADDRESS
3612 3612
         );
3613
-        $subject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']."  ";
3613
+        $subject = "[".api_get_setting('siteName')."] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']."  ";
3614 3614
         foreach ($user_list as $user_data) {
3615 3615
             $to_user_id = $user_data['user_id'];
3616 3616
             $user_info = api_get_user_info($to_user_id);
@@ -3659,7 +3659,7 @@  discard block
 block discarded – undo
3659 3659
 
3660 3660
     $title = $values['title'];
3661 3661
     $description = $values['description'];
3662
-    $contains_file = isset($values['contains_file']) && !empty($values['contains_file']) ? intval($values['contains_file']): 0;
3662
+    $contains_file = isset($values['contains_file']) && !empty($values['contains_file']) ? intval($values['contains_file']) : 0;
3663 3663
 
3664 3664
     $saveWork = true;
3665 3665
     $message = null;
@@ -4026,8 +4026,8 @@  discard block
 block discarded – undo
4026 4026
                     LINK_STUDENTPUBLICATION,
4027 4027
                     $workId,
4028 4028
                     $params['new_dir'],
4029
-                    (float)$params['weight'],
4030
-                    (float)$params['qualification'],
4029
+                    (float) $params['weight'],
4030
+                    (float) $params['qualification'],
4031 4031
                     $params['description'],
4032 4032
                     1,
4033 4033
                     api_get_session_id()
@@ -4287,15 +4287,15 @@  discard block
 block discarded – undo
4287 4287
     // changing the tool setting: is a student allowed to delete his/her own document
4288 4288
 
4289 4289
     // counting the number of occurrences of this setting (if 0 => add, if 1 => update)
4290
-    $query = "SELECT * FROM " . $table_course_setting . "
4290
+    $query = "SELECT * FROM ".$table_course_setting."
4291 4291
               WHERE c_id = $courseId AND variable = 'student_delete_own_publication'";
4292 4292
 
4293 4293
     $result = Database::query($query);
4294 4294
     $number_of_setting = Database::num_rows($result);
4295 4295
 
4296 4296
     if ($number_of_setting == 1) {
4297
-        $query = "UPDATE " . $table_course_setting . " SET
4298
-                  value='" . Database::escape_string($studentDeleteOwnPublication) . "'
4297
+        $query = "UPDATE ".$table_course_setting." SET
4298
+                  value='" . Database::escape_string($studentDeleteOwnPublication)."'
4299 4299
                   WHERE variable = 'student_delete_own_publication' AND c_id = $courseId";
4300 4300
         Database::query($query);
4301 4301
     } else {
@@ -4334,9 +4334,9 @@  discard block
 block discarded – undo
4334 4334
     $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
4335 4335
     $item_id = intval($item_id);
4336 4336
     $course_id = $course_info['real_id'];
4337
-    $sql = "UPDATE  " . $work_table . "
4337
+    $sql = "UPDATE  ".$work_table."
4338 4338
             SET accepted = 0
4339
-            WHERE c_id = $course_id AND id = '" . $item_id . "'";
4339
+            WHERE c_id = $course_id AND id = '".$item_id."'";
4340 4340
     Database::query($sql);
4341 4341
     api_item_property_update(
4342 4342
         $course_info,
@@ -4480,7 +4480,7 @@  discard block
 block discarded – undo
4480 4480
                 $courseCode,
4481 4481
                 $sessionId,
4482 4482
                 $limitString,
4483
-                $orderBy ,
4483
+                $orderBy,
4484 4484
                 STUDENT,
4485 4485
                 $getCount
4486 4486
             );
@@ -4817,8 +4817,8 @@  discard block
 block discarded – undo
4817 4817
     if (!empty($sessionId)) {
4818 4818
         $sessionInfo = api_get_session_info($sessionId);
4819 4819
         if (!empty($sessionInfo)) {
4820
-            $header .= ' - ' . $sessionInfo['name'];
4821
-            $header .= '<br />' . $sessionInfo['description'];
4820
+            $header .= ' - '.$sessionInfo['name'];
4821
+            $header .= '<br />'.$sessionInfo['description'];
4822 4822
             $teachers = SessionManager::getCoachesByCourseSessionToString(
4823 4823
                 $sessionId,
4824 4824
                 $courseInfo['real_id']
@@ -4834,12 +4834,12 @@  discard block
 block discarded – undo
4834 4834
     $expiresOn = null;
4835 4835
 
4836 4836
     if (!empty($assignment) && isset($assignment['expires_on'])) {
4837
-        $content .= '<br /><strong>' . get_lang('ExpirationDate') . '</strong>: ' . api_get_local_time($assignment['expires_on']);
4837
+        $content .= '<br /><strong>'.get_lang('ExpirationDate').'</strong>: '.api_get_local_time($assignment['expires_on']);
4838 4838
         $expiresOn = api_get_local_time($assignment['expires_on']);
4839 4839
     }
4840 4840
 
4841 4841
     if (!empty($workData['description'])) {
4842
-        $content .= '<br /><strong>' . get_lang('Description') . '</strong>: ' . $workData['description'];
4842
+        $content .= '<br /><strong>'.get_lang('Description').'</strong>: '.$workData['description'];
4843 4843
     }
4844 4844
 
4845 4845
     $workList = get_work_user_list(null, null, null, null, $workId);
@@ -4860,7 +4860,7 @@  discard block
 block discarded – undo
4860 4860
                 );
4861 4861
 
4862 4862
                 $column = 0;
4863
-                foreach($headers as $header) {
4863
+                foreach ($headers as $header) {
4864 4864
                     $table->setHeaderContents(0, $column, $header);
4865 4865
                     $column++;
4866 4866
                 }
@@ -4908,7 +4908,7 @@  discard block
 block discarded – undo
4908 4908
 
4909 4909
                 if (!empty($content)) {
4910 4910
                     $params = array(
4911
-                        'filename' => $workData['title'] . '_' . api_get_local_time(),
4911
+                        'filename' => $workData['title'].'_'.api_get_local_time(),
4912 4912
                         'pdf_title' => api_replace_dangerous_char($workData['title']),
4913 4913
                         'course_code' => $courseInfo['code'],
4914 4914
                         'add_signatures' => false
@@ -4939,7 +4939,7 @@  discard block
 block discarded – undo
4939 4939
     $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip";
4940 4940
     $coursePath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/work/';
4941 4941
 
4942
-    $zip  = new PclZip($tempZipFile);
4942
+    $zip = new PclZip($tempZipFile);
4943 4943
 
4944 4944
     $workPerUser = getWorkPerUser($userId);
4945 4945
 
Please login to merge, or discard this patch.
plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php 3 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
      * Register a user into a queue for a session
371 371
      * @param $userId
372 372
      * @param $sessionId
373
-     * @return bool|int
373
+     * @return false|string
374 374
      */
375 375
     public function addToQueue($userId, $sessionId)
376 376
     {
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
      * Register message with type and status
397 397
      * @param $mailId
398 398
      * @param $userId
399
-     * @param $sessionId
399
+     * @param integer $sessionId
400 400
      * @return bool|int
401 401
      */
402 402
     public function saveLastMessage($mailId, $userId, $sessionId)
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 
510 510
     /**
511 511
      * Check if session is open for subscription
512
-     * @param $sessionId
512
+     * @param integer $sessionId
513 513
      * @param string $fieldVariable
514 514
      * @return bool
515 515
      */
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
 
532 532
     /**
533 533
      * Check if user is in the session's target group based on its area
534
-     * @param $userId
535
-     * @param $sessionId
534
+     * @param integer $userId
535
+     * @param integer $sessionId
536 536
      * @param string $userFieldVariable
537 537
      * @param string $sessionFieldVariable
538 538
      * @return bool
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
     /**
1003 1003
      * Return the session details data from a session ID (including the extra
1004 1004
      * fields used for the advanced subscription mechanism)
1005
-     * @param $sessionId
1005
+     * @param integer $sessionId
1006 1006
      * @return bool|mixed
1007 1007
      */
1008 1008
     public function getSessionDetails($sessionId)
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
     /**
1104 1104
      * Return the url to go to session
1105
-     * @param $sessionId
1105
+     * @param integer $sessionId
1106 1106
      *
1107 1107
      * @return string
1108 1108
      */
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1069,7 +1069,7 @@
 block discarded – undo
1069 1069
      */
1070 1070
     public function getStatusMessage($status, $isAble = true)
1071 1071
     {
1072
-	$message = '';
1072
+    $message = '';
1073 1073
         switch ($status) {
1074 1074
             case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE:
1075 1075
                 if ($isAble) {
Please login to merge, or discard this patch.
Spacing   +41 added lines, -42 removed lines patch added patch discarded remove patch
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
108 108
 
109
-        $sql = "CREATE TABLE IF NOT EXISTS $advancedSubscriptionQueueTable (" .
110
-            "id int UNSIGNED NOT NULL AUTO_INCREMENT, " .
111
-            "session_id int UNSIGNED NOT NULL, " .
112
-            "user_id int UNSIGNED NOT NULL, " .
113
-            "status int UNSIGNED NOT NULL, " .
114
-            "last_message_id int UNSIGNED NOT NULL, " .
115
-            "created_at datetime NOT NULL, " .
116
-            "updated_at datetime NULL, " .
117
-            "PRIMARY KEY PK_advanced_subscription_queue (id), " .
109
+        $sql = "CREATE TABLE IF NOT EXISTS $advancedSubscriptionQueueTable (".
110
+            "id int UNSIGNED NOT NULL AUTO_INCREMENT, ".
111
+            "session_id int UNSIGNED NOT NULL, ".
112
+            "user_id int UNSIGNED NOT NULL, ".
113
+            "status int UNSIGNED NOT NULL, ".
114
+            "last_message_id int UNSIGNED NOT NULL, ".
115
+            "created_at datetime NOT NULL, ".
116
+            "updated_at datetime NULL, ".
117
+            "PRIMARY KEY PK_advanced_subscription_queue (id), ".
118 118
             "UNIQUE KEY UK_advanced_subscription_queue (user_id, session_id)); ";
119 119
         Database::query($sql);
120 120
     }
@@ -265,11 +265,10 @@  discard block
 block discarded – undo
265 265
         $now = new DateTime(api_get_utc_datetime());
266 266
         $newYearDate = $plugin->get('course_session_credit_year_start_date');
267 267
         $newYearDate = !empty($newYearDate) ?
268
-            new \DateTime($newYearDate . $now->format('/Y')) :
269
-            $now;
268
+            new \DateTime($newYearDate.$now->format('/Y')) : $now;
270 269
         $extra = new ExtraFieldValue('session');
271
-        $joinSessionTable = Database::get_main_table(TABLE_MAIN_SESSION_USER) . ' su INNER JOIN ' .
272
-            Database::get_main_table(TABLE_MAIN_SESSION) . ' s ON s.id = su.session_id';
270
+        $joinSessionTable = Database::get_main_table(TABLE_MAIN_SESSION_USER).' su INNER JOIN '.
271
+            Database::get_main_table(TABLE_MAIN_SESSION).' s ON s.id = su.session_id';
273 272
         $whereSessionParams = 'su.relation_type = ? AND s.access_start_date >= ? AND su.user_id = ?';
274 273
         $whereSessionParamsValues = array(
275 274
             0,
@@ -734,14 +733,14 @@  discard block
 block discarded – undo
734 733
                     $tpl->assign('termsContent', $termsAndConditions);
735 734
                     $termsAndConditions = $tpl->fetch('/advanced_subscription/views/terms_and_conditions_to_pdf.tpl');
736 735
                     $pdf = new PDF();
737
-                    $filename = 'terms' . sha1(rand(0,99999));
736
+                    $filename = 'terms'.sha1(rand(0, 99999));
738 737
                     $pdf->content_to_pdf($termsAndConditions, null, $filename, null, 'F');
739 738
                     $fileAttachments['file'][] = array(
740
-                        'name' => $filename . '.pdf',
741
-                        'application/pdf' => $filename . '.pdf',
742
-                        'tmp_name' => api_get_path(SYS_ARCHIVE_PATH) . $filename . '.pdf',
739
+                        'name' => $filename.'.pdf',
740
+                        'application/pdf' => $filename.'.pdf',
741
+                        'tmp_name' => api_get_path(SYS_ARCHIVE_PATH).$filename.'.pdf',
743 742
                         'error' => UPLOAD_ERR_OK,
744
-                        'size' => filesize(api_get_path(SYS_ARCHIVE_PATH) . $filename . '.pdf'),
743
+                        'size' => filesize(api_get_path(SYS_ARCHIVE_PATH).$filename.'.pdf'),
745 744
                     );
746 745
                     $fileAttachments['comments'][] = get_lang('TermsAndConditions');
747 746
                 }
@@ -1032,7 +1031,7 @@  discard block
 block discarded – undo
1032 1031
 
1033 1032
             $mergedArray = array_merge(array($sessionId), array_keys($fields));
1034 1033
 
1035
-            $sql = "SELECT * FROM " . Database::get_main_table(TABLE_EXTRA_FIELD_VALUES) ."
1034
+            $sql = "SELECT * FROM ".Database::get_main_table(TABLE_EXTRA_FIELD_VALUES)."
1036 1035
                     WHERE item_id = %d AND field_id IN (%d, %d, %d, %d, %d, %d, %d)";
1037 1036
             $sql = vsprintf($sql, $mergedArray);
1038 1037
             $sessionFieldValueList = Database::query($sql);
@@ -1048,10 +1047,10 @@  discard block
 block discarded – undo
1048 1047
             $sessionArray['description'] = SessionManager::getDescriptionFromSessionId($sessionId);
1049 1048
 
1050 1049
             if (isset($sessionArray['brochure'])) {
1051
-                $sessionArray['brochure'] = api_get_path(WEB_UPLOAD_PATH) . $sessionArray['brochure'];
1050
+                $sessionArray['brochure'] = api_get_path(WEB_UPLOAD_PATH).$sessionArray['brochure'];
1052 1051
             }
1053 1052
             if (isset($sessionArray['banner'])) {
1054
-                $sessionArray['banner'] = api_get_path(WEB_UPLOAD_PATH) . $sessionArray['banner'];
1053
+                $sessionArray['banner'] = api_get_path(WEB_UPLOAD_PATH).$sessionArray['banner'];
1055 1054
             }
1056 1055
 
1057 1056
             return $sessionArray;
@@ -1108,7 +1107,7 @@  discard block
 block discarded – undo
1108 1107
      */
1109 1108
     public function getSessionUrl($sessionId)
1110 1109
     {
1111
-        $url = api_get_path(WEB_CODE_PATH) . 'session/?session_id=' . intval($sessionId);
1110
+        $url = api_get_path(WEB_CODE_PATH).'session/?session_id='.intval($sessionId);
1112 1111
 
1113 1112
         return $url;
1114 1113
     }
@@ -1157,16 +1156,16 @@  discard block
 block discarded – undo
1157 1156
      */
1158 1157
     public function getQueueUrl($params)
1159 1158
     {
1160
-        $url = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/ajax/advanced_subscription.ajax.php?' .
1161
-            'a=' . Security::remove_XSS($params['action']) . '&' .
1162
-            's=' . intval($params['sessionId']) . '&' .
1163
-            'current_user_id=' . intval($params['currentUserId']) . '&' .
1164
-            'e=' . intval($params['newStatus']) . '&' .
1165
-            'u=' . intval($params['studentUserId']) . '&' .
1166
-            'q=' . intval($params['queueId']) . '&' .
1167
-            'is_connected=' . 1 . '&' .
1168
-            'profile_completed=' . intval($params['profile_completed']) . '&' .
1169
-            'v=' . $this->generateHash($params);
1159
+        $url = api_get_path(WEB_PLUGIN_PATH).'advanced_subscription/ajax/advanced_subscription.ajax.php?'.
1160
+            'a='.Security::remove_XSS($params['action']).'&'.
1161
+            's='.intval($params['sessionId']).'&'.
1162
+            'current_user_id='.intval($params['currentUserId']).'&'.
1163
+            'e='.intval($params['newStatus']).'&'.
1164
+            'u='.intval($params['studentUserId']).'&'.
1165
+            'q='.intval($params['queueId']).'&'.
1166
+            'is_connected='.1.'&'.
1167
+            'profile_completed='.intval($params['profile_completed']).'&'.
1168
+            'v='.$this->generateHash($params);
1170 1169
 
1171 1170
         return $url;
1172 1171
     }
@@ -1219,7 +1218,7 @@  discard block
 block discarded – undo
1219 1218
         }
1220 1219
         $queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
1221 1220
         $userTable = Database::get_main_table(TABLE_MAIN_USER);
1222
-        $userJoinTable = $queueTable . ' q INNER JOIN ' . $userTable . ' u ON q.user_id = u.user_id';
1221
+        $userJoinTable = $queueTable.' q INNER JOIN '.$userTable.' u ON q.user_id = u.user_id';
1223 1222
         $where = array(
1224 1223
             'where' => array(
1225 1224
                 'q.session_id = ?' => array(
@@ -1232,7 +1231,7 @@  discard block
 block discarded – undo
1232 1231
         $students = Database::select($select, $userJoinTable, $where);
1233 1232
         foreach ($students as &$student) {
1234 1233
             $status = intval($student['status']);
1235
-            switch($status) {
1234
+            switch ($status) {
1236 1235
                 case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE:
1237 1236
                 case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START:
1238 1237
                     $student['validation'] = '';
@@ -1246,7 +1245,7 @@  discard block
 block discarded – undo
1246 1245
                     $student['validation'] = 'Yes';
1247 1246
                     break;
1248 1247
                 default:
1249
-                    error_log(__FILE__ . ' ' . __FUNCTION__ . ' Student status no detected');
1248
+                    error_log(__FILE__.' '.__FUNCTION__.' Student status no detected');
1250 1249
             }
1251 1250
         }
1252 1251
         $return = array(
@@ -1295,7 +1294,7 @@  discard block
 block discarded – undo
1295 1294
         $dataPrepared['queueId'] = intval($data['queueId']);
1296 1295
         $dataPrepared['newStatus'] = intval($data['newStatus']);
1297 1296
         $dataPrepared = serialize($dataPrepared);
1298
-        return sha1($dataPrepared . $key);
1297
+        return sha1($dataPrepared.$key);
1299 1298
     }
1300 1299
 
1301 1300
     /**
@@ -1350,12 +1349,12 @@  discard block
 block discarded – undo
1350 1349
                 break;
1351 1350
         }
1352 1351
 
1353
-        $url = api_get_path(WEB_PLUGIN_PATH) . "advanced_subscription/src/terms_and_conditions.php?";
1352
+        $url = api_get_path(WEB_PLUGIN_PATH)."advanced_subscription/src/terms_and_conditions.php?";
1354 1353
         $url .= http_build_query($urlParams);
1355 1354
 
1356 1355
         // Launch popup
1357 1356
         if ($mode == ADVANCED_SUBSCRIPTION_TERMS_MODE_POPUP) {
1358
-            $url = 'javascript:void(window.open(\'' . $url .'\',\'AdvancedSubscriptionTerms\', \'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700px,height=600px\', \'100\' ))';
1357
+            $url = 'javascript:void(window.open(\''.$url.'\',\'AdvancedSubscriptionTerms\', \'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700px,height=600px\', \'100\' ))';
1359 1358
         }
1360 1359
         return $url;
1361 1360
     }
@@ -1367,9 +1366,9 @@  discard block
 block discarded – undo
1367 1366
      */
1368 1367
     public function getRenderMailUrl($params)
1369 1368
     {
1370
-        $url = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/src/render_mail.php?' .
1371
-            'q=' . $params['queueId'] . '&' .
1372
-            'v=' . $this->generateHash($params);
1369
+        $url = api_get_path(WEB_PLUGIN_PATH).'advanced_subscription/src/render_mail.php?'.
1370
+            'q='.$params['queueId'].'&'.
1371
+            'v='.$this->generateHash($params);
1373 1372
         return $url;
1374 1373
     }
1375 1374
 
@@ -1440,7 +1439,7 @@  discard block
 block discarded – undo
1440 1439
                 sf.extra_field_type = $extraFieldType AND
1441 1440
                 sf.variable = 'is_induction_session' AND
1442 1441
                 su.relation_type = 0 AND
1443
-                su.user_id = " . intval($userId);
1442
+                su.user_id = ".intval($userId);
1444 1443
 
1445 1444
         $result = Database::query($sql);
1446 1445
 
Please login to merge, or discard this patch.
plugin/bbb/lib/bbb.lib.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     /**
241 241
      * Returns a meeting "join" URL
242 242
      * @param string The name of the meeting (usually the course code)
243
-     * @return mixed The URL to join the meeting, or false on error
243
+     * @return false|string The URL to join the meeting, or false on error
244 244
      * @todo implement moderator pass
245 245
      * @assert ('') === false
246 246
      * @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
      * Closes a meeting (usually when the user click on the close button from
648 648
      * the conferences listing.
649 649
      * @param string The internal ID of the meeting (id field for this meeting)
650
-     * @return void
650
+     * @return false|null
651 651
      * @assert (0) === false
652 652
      */
653 653
     public function endMeeting($id)
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
         }
167 167
 
168 168
         $params['attendee_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $courseCode;
169
-        $attendeePassword =  $params['attendee_pw'];
169
+        $attendeePassword = $params['attendee_pw'];
170 170
         $params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword();
171 171
         $moderatorPassword = $params['moderator_pw'];
172 172
 
173 173
         $params['record'] = api_get_course_setting('big_blue_button_record_and_store', $courseCode) == 1 ? true : false;
174 174
         $max = api_get_course_setting('big_blue_button_max_students_allowed', $courseCode);
175
-        $max =  isset($max) ? $max : -1;
175
+        $max = isset($max) ? $max : -1;
176 176
 
177 177
         $params['status'] = 1;
178 178
         // Generate a pseudo-global-unique-id to avoid clash of conferences on
@@ -203,23 +203,23 @@  discard block
 block discarded – undo
203 203
             $duration = 300;
204 204
 
205 205
             $bbbParams = array(
206
-                'meetingId' => $params['remote_id'], 					// REQUIRED
207
-                'meetingName' => $meetingName, 	// REQUIRED
208
-                'attendeePw' => $attendeePassword, 					// Match this value in getJoinMeetingURL() to join as attendee.
209
-                'moderatorPw' => $moderatorPassword, 					// Match this value in getJoinMeetingURL() to join as moderator.
210
-                'welcomeMsg' => $welcomeMessage, 					// ''= use default. Change to customize.
211
-                'dialNumber' => '', 					// The main number to call into. Optional.
212
-                'voiceBridge' => $params['voice_bridge'], 					// PIN to join voice. Required.
213
-                'webVoice' => '', 						// Alphanumeric to join voice. Optional.
206
+                'meetingId' => $params['remote_id'], // REQUIRED
207
+                'meetingName' => $meetingName, // REQUIRED
208
+                'attendeePw' => $attendeePassword, // Match this value in getJoinMeetingURL() to join as attendee.
209
+                'moderatorPw' => $moderatorPassword, // Match this value in getJoinMeetingURL() to join as moderator.
210
+                'welcomeMsg' => $welcomeMessage, // ''= use default. Change to customize.
211
+                'dialNumber' => '', // The main number to call into. Optional.
212
+                'voiceBridge' => $params['voice_bridge'], // PIN to join voice. Required.
213
+                'webVoice' => '', // Alphanumeric to join voice. Optional.
214 214
                 'logoutUrl' =>  $this->logoutUrl,
215
-                'maxParticipants' => $max, 				// Optional. -1 = unlimitted. Not supported in BBB. [number]
216
-                'record' => $record, 					// New. 'true' will tell BBB to record the meeting.
217
-                'duration' => $duration, 				// Default = 0 which means no set duration in minutes. [number]
215
+                'maxParticipants' => $max, // Optional. -1 = unlimitted. Not supported in BBB. [number]
216
+                'record' => $record, // New. 'true' will tell BBB to record the meeting.
217
+                'duration' => $duration, // Default = 0 which means no set duration in minutes. [number]
218 218
                 //'meta_category' => '', 				// Use to pass additional info to BBB server. See API docs.
219 219
             );
220 220
 
221 221
             if ($this->debug) {
222
-                error_log("create_meeting params: ".print_r($bbbParams,1));
222
+                error_log("create_meeting params: ".print_r($bbbParams, 1));
223 223
             }
224 224
 
225 225
             $status = false;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
                 if (isset($result) && strval($result['returncode']) == 'SUCCESS') {
233 233
                     if ($this->debug) {
234 234
                         error_log(
235
-                            "create_meeting result: " . print_r($result, 1)
235
+                            "create_meeting result: ".print_r($result, 1)
236 236
                         );
237 237
                     }
238 238
                     $meeting = $this->joinMeeting($meetingName, true);
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
         $courseId = api_get_course_int_id();
265 265
         $sessionId = api_get_session_id();
266
-        $conditions =  array(
266
+        $conditions = array(
267 267
             'where' => array(
268 268
                 'c_id = ? AND session_id = ? AND meeting_name = ? AND status = 1 ' =>
269 269
                     array($courseId, $sessionId, $meetingName)
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         if ($this->hasGroupSupport()) {
274 274
             $groupId = api_get_group_id();
275
-            $conditions =  array(
275
+            $conditions = array(
276 276
                 'where' => array(
277 277
                     'c_id = ? AND session_id = ? AND meeting_name = ? AND group_id = ? AND status = 1 ' =>
278 278
                         array($courseId, $sessionId, $meetingName, $groupId)
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 
370 370
             if ($this->debug) {
371 371
                 error_log(
372
-                    "meeting is running: " . intval($meetingInfoExists)
372
+                    "meeting is running: ".intval($meetingInfoExists)
373 373
                 );
374 374
             }
375 375
 
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 
387 387
         if ($meetingInfoExists) {
388 388
             $joinParams = array(
389
-                'meetingId' => $meetingData['remote_id'],	//	-- REQUIRED - A unique id for the meeting
390
-                'username' => $this->userCompleteName,	//-- REQUIRED - The name that will display for the user in the meeting
391
-                'password' => $pass,			//-- REQUIRED - The attendee or moderator password, depending on what's passed here
389
+                'meetingId' => $meetingData['remote_id'], //	-- REQUIRED - A unique id for the meeting
390
+                'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting
391
+                'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here
392 392
                 //'createTime' => api_get_utc_datetime(),			//-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
393
-                'userID' => api_get_user_id(),				//-- OPTIONAL - string
393
+                'userID' => api_get_user_id(), //-- OPTIONAL - string
394 394
                 'webVoiceConf' => ''	//	-- OPTIONAL - string
395 395
             );
396 396
             $url = $this->api->getJoinMeetingURL($joinParams);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
             $url = $this->logoutUrl;
400 400
         }
401 401
         if ($this->debug) {
402
-            error_log("return url :" . $url);
402
+            error_log("return url :".$url);
403 403
         }
404 404
 
405 405
         return $url;
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
         $courseId = api_get_course_int_id();
442 442
         $sessionId = api_get_session_id();
443 443
 
444
-        $conditions =  array(
444
+        $conditions = array(
445 445
             'where' => array(
446 446
                 'c_id = ? AND session_id = ? ' => array(
447 447
                     $courseId,
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 
453 453
         if ($this->hasGroupSupport()) {
454 454
             $groupId = api_get_group_id();
455
-            $conditions =  array(
455
+            $conditions = array(
456 456
                 'where' => array(
457 457
                     'c_id = ? AND session_id = ? AND group_id = ? ' =>
458 458
                         array($courseId, $sessionId, $groupId)
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
             }
488 488
             $meetingBBB['end_url'] = $this->endUrl($meetingDB);
489 489
 
490
-            if ((string)$meetingBBB['returncode'] == 'FAILED') {
490
+            if ((string) $meetingBBB['returncode'] == 'FAILED') {
491 491
                 if ($meetingDB['status'] == 1 && $this->isConferenceManager()) {
492 492
                     $this->endMeeting($meetingDB['id']);
493 493
                 }
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                     $item['action_links'] = implode('<br />', $actionLinksArray);
658 658
                 }
659 659
                 //var_dump($recordArray);
660
-                $item['show_links']  = implode('<br />', $recordArray);
660
+                $item['show_links'] = implode('<br />', $recordArray);
661 661
                 $item['action_links'] = implode('<br />', $actionLinksArray);
662 662
             }
663 663
 
@@ -670,11 +670,11 @@  discard block
 block discarded – undo
670 670
 
671 671
             if ($meetingDB['status'] == 1) {
672 672
                 $joinParams = array(
673
-                    'meetingId' => $meetingDB['remote_id'],		//-- REQUIRED - A unique id for the meeting
674
-                    'username' => $this->userCompleteName,	//-- REQUIRED - The name that will display for the user in the meeting
675
-                    'password' => $pass,			//-- REQUIRED - The attendee or moderator password, depending on what's passed here
676
-                    'createTime' => '',			//-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
677
-                    'userID' => '',			//	-- OPTIONAL - string
673
+                    'meetingId' => $meetingDB['remote_id'], //-- REQUIRED - A unique id for the meeting
674
+                    'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting
675
+                    'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here
676
+                    'createTime' => '', //-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
677
+                    'userID' => '', //	-- OPTIONAL - string
678 678
                     'webVoiceConf' => ''	//	-- OPTIONAL - string
679 679
                 );
680 680
                 $item['go_url'] = $this->protocol.$this->api->getJoinMeetingURL($joinParams);
@@ -735,8 +735,8 @@  discard block
 block discarded – undo
735 735
         $pass = $this->getUserMeetingPassword();
736 736
 
737 737
         $endParams = array(
738
-            'meetingId' => $meetingData['remote_id'],   // REQUIRED - We have to know which meeting to end.
739
-            'password' => $pass,        // REQUIRED - Must match moderator pass for meeting.
738
+            'meetingId' => $meetingData['remote_id'], // REQUIRED - We have to know which meeting to end.
739
+            'password' => $pass, // REQUIRED - Must match moderator pass for meeting.
740 740
         );
741 741
         $this->api->endMeetingWithXmlResponseArray($endParams);
742 742
         Database::update(
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
      */
962 962
     public function redirectToBBB($url)
963 963
     {
964
-        if (file_exists(__DIR__ . '/../config.vm.php')) {
964
+        if (file_exists(__DIR__.'/../config.vm.php')) {
965 965
             // Using VM
966 966
             echo Display::url(get_lang('ClickToContinue'), $url);
967 967
             exit;
Please login to merge, or discard this patch.
plugin/bbb/lib/bbb_api.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -59,6 +59,9 @@
 block discarded – undo
59 59
 		$this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
60 60
 	}
61 61
 
62
+	/**
63
+	 * @param string $url
64
+	 */
62 65
 	private function _processXmlResponse($url){
63 66
 	/*
64 67
 	A private utility method used by other public methods to process XML responses.
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 	*/
56 56
 		// BASE CONFIGS - set these for your BBB server in config.php and they will
57 57
 		// simply flow in here via the constants:
58
-		$this->_securitySalt 		= CONFIG_SECURITY_SALT;
59
-		$this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
58
+		$this->_securitySalt = CONFIG_SECURITY_SALT;
59
+		$this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL;
60 60
 	}
61 61
 
62
-	private function _processXmlResponse($url){
62
+	private function _processXmlResponse($url) {
63 63
 	/*
64 64
 	A private utility method used by other public methods to process XML responses.
65 65
 	*/
66 66
 		if (extension_loaded('curl')) {
67
-			$ch = curl_init() or die ( curl_error($ch) );
67
+			$ch = curl_init() or die (curl_error($ch));
68 68
 			$timeout = 10;
69
-			curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
70
-			curl_setopt( $ch, CURLOPT_URL, $url );
71
-			curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
72
-			curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
-			$data = curl_exec( $ch );
74
-			curl_close( $ch );
75
-
76
-			if($data)
69
+			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
70
+			curl_setopt($ch, CURLOPT_URL, $url);
71
+			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
72
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
+			$data = curl_exec($ch);
74
+			curl_close($ch);
75
+
76
+			if ($data)
77 77
 				return (new SimpleXMLElement($data));
78 78
 			else
79 79
 				return false;
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 		'&duration='.urlencode($creationParams['duration']);
138 138
 		//'&meta_category='.urlencode($creationParams['meta_category']);
139 139
 		$welcomeMessage = $creationParams['welcomeMsg'];
140
-		if(trim($welcomeMessage))
140
+		if (trim($welcomeMessage))
141 141
 			$params .= '&welcome='.urlencode($welcomeMessage);
142 142
 		// Return the complete URL:
143
-		return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
143
+		return ($creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt));
144 144
 	}
145 145
 
146 146
 	public function createMeetingWithXmlResponseArray($creationParams) {
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		$xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
166 166
 
167 167
         if ($xml) {
168
-			if($xml->meetingID)
168
+			if ($xml->meetingID)
169 169
 				return array(
170 170
 					'returncode' => $xml->returncode,
171 171
 					'message' => $xml->message,
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		$meetingId = '1234'		-- REQUIRED - The unique id for the meeting
284 284
 		*/
285 285
 		$xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId));
286
-		if($xml) {
286
+		if ($xml) {
287 287
 			return array(
288 288
 				'returncode' => $xml->returncode,
289 289
 				'running' => $xml->running 	// -- Returns true/false.
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		and then handle the results that we get in the XML response.
311 311
 		*/
312 312
 		$xml = $this->_processXmlResponse($this->getGetMeetingsUrl());
313
-		if($xml) {
313
+		if ($xml) {
314 314
 			// If we don't get a success code, stop processing and return just the returncode:
315 315
 			if ($xml->returncode != 'SUCCESS') {
316 316
 				$result = array(
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		);
380 380
 		*/
381 381
 		$xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
382
-		if($xml) {
382
+		if ($xml) {
383 383
 			// If we don't get a success code or messageKey, find out why:
384 384
 			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
385 385
 				$result = array(
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 		probably be required in user code when 'recording' is set to true.
455 455
 		*/
456 456
 		$xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
457
-		if($xml) {
457
+		if ($xml) {
458 458
 			// If we don't get a success code or messageKey, find out why:
459 459
 			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
460 460
 				$result = array(
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		);
525 525
 		*/
526 526
 		$xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams));
527
-		if($xml) {
527
+		if ($xml) {
528 528
 			return array(
529 529
 				'returncode' => $xml->returncode,
530 530
 				'published' => $xml->published 	// -- Returns true/false.
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		*/
558 558
 
559 559
 		$xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
560
-		if($xml) {
560
+		if ($xml) {
561 561
 			return array(
562 562
 				'returncode' => $xml->returncode,
563 563
 				'deleted' => $xml->deleted 	// -- Returns true/false.
Please login to merge, or discard this patch.
Braces   +28 added lines, -40 removed lines patch added patch discarded remove patch
@@ -73,10 +73,11 @@  discard block
 block discarded – undo
73 73
 			$data = curl_exec( $ch );
74 74
 			curl_close( $ch );
75 75
 
76
-			if($data)
77
-				return (new SimpleXMLElement($data));
78
-			else
79
-				return false;
76
+			if($data) {
77
+							return (new SimpleXMLElement($data));
78
+			} else {
79
+							return false;
80
+			}
80 81
 		}
81 82
 		return (simplexml_load_file($url));
82 83
 	}
@@ -85,11 +86,9 @@  discard block
 block discarded – undo
85 86
 		/* Process required params and throw errors if we don't get values */
86 87
 		if ((isset($param)) && ($param != '')) {
87 88
 			return $param;
88
-		}
89
-		elseif (!isset($param)) {
89
+		} elseif (!isset($param)) {
90 90
 			throw new Exception('Missing parameter.');
91
-		}
92
-		else {
91
+		} else {
93 92
 			throw new Exception(''.$param.' is required.');
94 93
 		}
95 94
 	}
@@ -99,8 +98,7 @@  discard block
 block discarded – undo
99 98
 		/* Don't know if we'll use this one, but let's build it in case. */
100 99
 		if ((isset($param)) && ($param != '')) {
101 100
 			return $param;
102
-		}
103
-		else {
101
+		} else {
104 102
 			$param = '';
105 103
 			return $param;
106 104
 		}
@@ -137,8 +135,9 @@  discard block
 block discarded – undo
137 135
 		'&duration='.urlencode($creationParams['duration']);
138 136
 		//'&meta_category='.urlencode($creationParams['meta_category']);
139 137
 		$welcomeMessage = $creationParams['welcomeMsg'];
140
-		if(trim($welcomeMessage))
141
-			$params .= '&welcome='.urlencode($welcomeMessage);
138
+		if(trim($welcomeMessage)) {
139
+					$params .= '&welcome='.urlencode($welcomeMessage);
140
+		}
142 141
 		// Return the complete URL:
143 142
 		return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
144 143
 	}
@@ -165,8 +164,8 @@  discard block
 block discarded – undo
165 164
 		$xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
166 165
 
167 166
         if ($xml) {
168
-			if($xml->meetingID)
169
-				return array(
167
+			if($xml->meetingID) {
168
+							return array(
170 169
 					'returncode' => $xml->returncode,
171 170
 					'message' => $xml->message,
172 171
 					'messageKey' => $xml->messageKey,
@@ -176,14 +175,14 @@  discard block
 block discarded – undo
176 175
 					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
177 176
 					'createTime' => $xml->createTime
178 177
 					);
179
-			else
180
-				return array(
178
+			} else {
179
+							return array(
181 180
 					'returncode' => $xml->returncode,
182 181
 					'message' => $xml->message,
183 182
 					'messageKey' => $xml->messageKey
184 183
 					);
185
-		}
186
-		else {
184
+			}
185
+		} else {
187 186
 			return null;
188 187
 		}
189 188
 	}
@@ -253,8 +252,7 @@  discard block
 block discarded – undo
253 252
 				'message' => $xml->message,
254 253
 				'messageKey' => $xml->messageKey
255 254
 				);
256
-		}
257
-		else {
255
+		} else {
258 256
 			return null;
259 257
 		}
260 258
 
@@ -288,8 +286,7 @@  discard block
 block discarded – undo
288 286
 				'returncode' => $xml->returncode,
289 287
 				'running' => $xml->running 	// -- Returns true/false.
290 288
 				);
291
-		}
292
-		else {
289
+		} else {
293 290
 			return null;
294 291
 		}
295 292
 
@@ -317,8 +314,7 @@  discard block
 block discarded – undo
317 314
 					'returncode' => $xml->returncode
318 315
 				);
319 316
 				return $result;
320
-			}
321
-			elseif ($xml->messageKey == 'noMeetings') {
317
+			} elseif ($xml->messageKey == 'noMeetings') {
322 318
 				/* No meetings on server, so return just this info: */
323 319
 				$result = array(
324 320
 					'returncode' => $xml->returncode,
@@ -326,8 +322,7 @@  discard block
 block discarded – undo
326 322
 					'message' => $xml->message
327 323
 				);
328 324
 				return $result;
329
-			}
330
-			else {
325
+			} else {
331 326
 				// In this case, we have success and meetings. First return general response:
332 327
 				$result = array(
333 328
 					'returncode' => $xml->returncode,
@@ -348,8 +343,7 @@  discard block
 block discarded – undo
348 343
 					}
349 344
 				return $result;
350 345
 			}
351
-		}
352
-		else {
346
+		} else {
353 347
 			return null;
354 348
 		}
355 349
 
@@ -388,8 +382,7 @@  discard block
 block discarded – undo
388 382
 					'message' => $xml->message
389 383
 				);
390 384
 				return $result;
391
-			}
392
-			else {
385
+			} else {
393 386
 				// In this case, we have success and meeting info:
394 387
 				$result = array(
395 388
 					'returncode' => $xml->returncode,
@@ -418,8 +411,7 @@  discard block
 block discarded – undo
418 411
 					}
419 412
 				return $result;
420 413
 			}
421
-		}
422
-		else {
414
+		} else {
423 415
 			return null;
424 416
 		}
425 417
 
@@ -463,8 +455,7 @@  discard block
 block discarded – undo
463 455
 					'message' => $xml->message
464 456
 				);
465 457
 				return $result;
466
-			}
467
-			else {
458
+			} else {
468 459
 				// In this case, we have success and recording info:
469 460
 				$result = array(
470 461
 					'returncode' => $xml->returncode,
@@ -495,8 +486,7 @@  discard block
 block discarded – undo
495 486
 					}
496 487
 				return $result;
497 488
 			}
498
-		}
499
-		else {
489
+		} else {
500 490
 			return null;
501 491
 		}
502 492
 	}
@@ -529,8 +519,7 @@  discard block
 block discarded – undo
529 519
 				'returncode' => $xml->returncode,
530 520
 				'published' => $xml->published 	// -- Returns true/false.
531 521
 				);
532
-		}
533
-		else {
522
+		} else {
534 523
 			return null;
535 524
 		}
536 525
 
@@ -562,8 +551,7 @@  discard block
 block discarded – undo
562 551
 				'returncode' => $xml->returncode,
563 552
 				'deleted' => $xml->deleted 	// -- Returns true/false.
564 553
 				);
565
-		}
566
-		else {
554
+		} else {
567 555
 			return null;
568 556
 		}
569 557
 
Please login to merge, or discard this patch.
Indentation   +403 added lines, -403 removed lines patch added patch discarded remove patch
@@ -44,107 +44,107 @@  discard block
 block discarded – undo
44 44
 
45 45
 class BigBlueButtonBN {
46 46
 
47
-	private $_securitySalt;
48
-	private $_bbbServerBaseUrl;
47
+    private $_securitySalt;
48
+    private $_bbbServerBaseUrl;
49 49
 
50
-	/* ___________ General Methods for the BigBlueButton Class __________ */
50
+    /* ___________ General Methods for the BigBlueButton Class __________ */
51 51
 
52
-	function __construct() {
53
-	/*
52
+    function __construct() {
53
+    /*
54 54
 	Establish just our basic elements in the constructor:
55 55
 	*/
56
-		// BASE CONFIGS - set these for your BBB server in config.php and they will
57
-		// simply flow in here via the constants:
58
-		$this->_securitySalt 		= CONFIG_SECURITY_SALT;
59
-		$this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
60
-	}
61
-
62
-	private function _processXmlResponse($url){
63
-	/*
56
+        // BASE CONFIGS - set these for your BBB server in config.php and they will
57
+        // simply flow in here via the constants:
58
+        $this->_securitySalt 		= CONFIG_SECURITY_SALT;
59
+        $this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
60
+    }
61
+
62
+    private function _processXmlResponse($url){
63
+    /*
64 64
 	A private utility method used by other public methods to process XML responses.
65 65
 	*/
66
-		if (extension_loaded('curl')) {
67
-			$ch = curl_init() or die ( curl_error($ch) );
68
-			$timeout = 10;
69
-			curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
70
-			curl_setopt( $ch, CURLOPT_URL, $url );
71
-			curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
72
-			curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
-			$data = curl_exec( $ch );
74
-			curl_close( $ch );
75
-
76
-			if($data)
77
-				return (new SimpleXMLElement($data));
78
-			else
79
-				return false;
80
-		}
81
-		return (simplexml_load_file($url));
82
-	}
83
-
84
-	private function _requiredParam($param) {
85
-		/* Process required params and throw errors if we don't get values */
86
-		if ((isset($param)) && ($param != '')) {
87
-			return $param;
88
-		}
89
-		elseif (!isset($param)) {
90
-			throw new Exception('Missing parameter.');
91
-		}
92
-		else {
93
-			throw new Exception(''.$param.' is required.');
94
-		}
95
-	}
96
-
97
-	private function _optionalParam($param) {
98
-		/* Pass most optional params through as set value, or set to '' */
99
-		/* Don't know if we'll use this one, but let's build it in case. */
100
-		if ((isset($param)) && ($param != '')) {
101
-			return $param;
102
-		}
103
-		else {
104
-			$param = '';
105
-			return $param;
106
-		}
107
-	}
108
-
109
-	/* __________________ BBB ADMINISTRATION METHODS _________________ */
110
-	/* The methods in the following section support the following categories of the BBB API:
66
+        if (extension_loaded('curl')) {
67
+            $ch = curl_init() or die ( curl_error($ch) );
68
+            $timeout = 10;
69
+            curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
70
+            curl_setopt( $ch, CURLOPT_URL, $url );
71
+            curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
72
+            curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
+            $data = curl_exec( $ch );
74
+            curl_close( $ch );
75
+
76
+            if($data)
77
+                return (new SimpleXMLElement($data));
78
+            else
79
+                return false;
80
+        }
81
+        return (simplexml_load_file($url));
82
+    }
83
+
84
+    private function _requiredParam($param) {
85
+        /* Process required params and throw errors if we don't get values */
86
+        if ((isset($param)) && ($param != '')) {
87
+            return $param;
88
+        }
89
+        elseif (!isset($param)) {
90
+            throw new Exception('Missing parameter.');
91
+        }
92
+        else {
93
+            throw new Exception(''.$param.' is required.');
94
+        }
95
+    }
96
+
97
+    private function _optionalParam($param) {
98
+        /* Pass most optional params through as set value, or set to '' */
99
+        /* Don't know if we'll use this one, but let's build it in case. */
100
+        if ((isset($param)) && ($param != '')) {
101
+            return $param;
102
+        }
103
+        else {
104
+            $param = '';
105
+            return $param;
106
+        }
107
+    }
108
+
109
+    /* __________________ BBB ADMINISTRATION METHODS _________________ */
110
+    /* The methods in the following section support the following categories of the BBB API:
111 111
 	-- create
112 112
 	-- join
113 113
 	-- end
114 114
 	*/
115 115
 
116
-	public function getCreateMeetingUrl($creationParams) {
117
-		/*
116
+    public function getCreateMeetingUrl($creationParams) {
117
+        /*
118 118
 		USAGE:
119 119
 		(see $creationParams array in createMeetingArray method.)
120 120
 		*/
121
-		$this->_meetingId = $this->_requiredParam($creationParams['meetingId']);
122
-		$this->_meetingName = $this->_requiredParam($creationParams['meetingName']);
123
-		// Set up the basic creation URL:
124
-		$creationUrl = $this->_bbbServerBaseUrl."api/create?";
125
-		// Add params:
126
-		$params =
127
-		'name='.urlencode($this->_meetingName).
128
-		'&meetingID='.urlencode($this->_meetingId).
129
-		'&attendeePW='.urlencode($creationParams['attendeePw']).
130
-		'&moderatorPW='.urlencode($creationParams['moderatorPw']).
131
-		'&dialNumber='.urlencode($creationParams['dialNumber']).
132
-		'&voiceBridge='.urlencode($creationParams['voiceBridge']).
133
-		'&webVoice='.urlencode($creationParams['webVoice']).
134
-		'&logoutURL='.urlencode($creationParams['logoutUrl']).
135
-		'&maxParticipants='.urlencode($creationParams['maxParticipants']).
136
-		'&record='.urlencode($creationParams['record']).
137
-		'&duration='.urlencode($creationParams['duration']);
138
-		//'&meta_category='.urlencode($creationParams['meta_category']);
139
-		$welcomeMessage = $creationParams['welcomeMsg'];
140
-		if(trim($welcomeMessage))
141
-			$params .= '&welcome='.urlencode($welcomeMessage);
142
-		// Return the complete URL:
143
-		return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
144
-	}
145
-
146
-	public function createMeetingWithXmlResponseArray($creationParams) {
147
-		/*
121
+        $this->_meetingId = $this->_requiredParam($creationParams['meetingId']);
122
+        $this->_meetingName = $this->_requiredParam($creationParams['meetingName']);
123
+        // Set up the basic creation URL:
124
+        $creationUrl = $this->_bbbServerBaseUrl."api/create?";
125
+        // Add params:
126
+        $params =
127
+        'name='.urlencode($this->_meetingName).
128
+        '&meetingID='.urlencode($this->_meetingId).
129
+        '&attendeePW='.urlencode($creationParams['attendeePw']).
130
+        '&moderatorPW='.urlencode($creationParams['moderatorPw']).
131
+        '&dialNumber='.urlencode($creationParams['dialNumber']).
132
+        '&voiceBridge='.urlencode($creationParams['voiceBridge']).
133
+        '&webVoice='.urlencode($creationParams['webVoice']).
134
+        '&logoutURL='.urlencode($creationParams['logoutUrl']).
135
+        '&maxParticipants='.urlencode($creationParams['maxParticipants']).
136
+        '&record='.urlencode($creationParams['record']).
137
+        '&duration='.urlencode($creationParams['duration']);
138
+        //'&meta_category='.urlencode($creationParams['meta_category']);
139
+        $welcomeMessage = $creationParams['welcomeMsg'];
140
+        if(trim($welcomeMessage))
141
+            $params .= '&welcome='.urlencode($welcomeMessage);
142
+        // Return the complete URL:
143
+        return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
144
+    }
145
+
146
+    public function createMeetingWithXmlResponseArray($creationParams) {
147
+        /*
148 148
 		USAGE:
149 149
 		$creationParams = array(
150 150
 			'name' => 'Meeting Name',	-- A name for the meeting (or username)
@@ -162,34 +162,34 @@  discard block
 block discarded – undo
162 162
 			'meta_category' => '', 		-- Use to pass additional info to BBB server. See API docs to enable.
163 163
 		);
164 164
 		*/
165
-		$xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
165
+        $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
166 166
 
167 167
         if ($xml) {
168
-			if($xml->meetingID)
169
-				return array(
170
-					'returncode' => $xml->returncode,
171
-					'message' => $xml->message,
172
-					'messageKey' => $xml->messageKey,
173
-					'meetingId' => $xml->meetingID,
174
-					'attendeePw' => $xml->attendeePW,
175
-					'moderatorPw' => $xml->moderatorPW,
176
-					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
177
-					'createTime' => $xml->createTime
178
-					);
179
-			else
180
-				return array(
181
-					'returncode' => $xml->returncode,
182
-					'message' => $xml->message,
183
-					'messageKey' => $xml->messageKey
184
-					);
185
-		}
186
-		else {
187
-			return null;
188
-		}
189
-	}
190
-
191
-	public function getJoinMeetingURL($joinParams) {
192
-		/*
168
+            if($xml->meetingID)
169
+                return array(
170
+                    'returncode' => $xml->returncode,
171
+                    'message' => $xml->message,
172
+                    'messageKey' => $xml->messageKey,
173
+                    'meetingId' => $xml->meetingID,
174
+                    'attendeePw' => $xml->attendeePW,
175
+                    'moderatorPw' => $xml->moderatorPW,
176
+                    'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
177
+                    'createTime' => $xml->createTime
178
+                    );
179
+            else
180
+                return array(
181
+                    'returncode' => $xml->returncode,
182
+                    'message' => $xml->message,
183
+                    'messageKey' => $xml->messageKey
184
+                    );
185
+        }
186
+        else {
187
+            return null;
188
+        }
189
+    }
190
+
191
+    public function getJoinMeetingURL($joinParams) {
192
+        /*
193 193
 		NOTE: At this point, we don't use a corresponding joinMeetingWithXmlResponse here because the API
194 194
 		doesn't respond on success, but you can still code that method if you need it. Or, you can take the URL
195 195
 		that's returned from this method and simply send your users off to that URL in your code.
@@ -203,249 +203,249 @@  discard block
 block discarded – undo
203 203
 			'webVoiceConf' => ''		-- OPTIONAL - string
204 204
 		);
205 205
 		*/
206
-		$this->_meetingId = $this->_requiredParam($joinParams['meetingId']);
207
-		$this->_username = $this->_requiredParam($joinParams['username']);
208
-		$this->_password = $this->_requiredParam($joinParams['password']);
209
-		// Establish the basic join URL:
210
-		$joinUrl = $this->_bbbServerBaseUrl."api/join?";
211
-		// Add parameters to the URL:
212
-		$params =
213
-		'meetingID='.urlencode($this->_meetingId).
214
-		'&fullName='.urlencode($this->_username).
215
-		'&password='.urlencode($this->_password).
216
-		'&userID='.urlencode($joinParams['userID']).
217
-		'&webVoiceConf='.urlencode($joinParams['webVoiceConf']);
218
-		// Only use createTime if we really want to use it. If it's '', then don't pass it:
219
-		if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) {
220
-			$params .= '&createTime='.urlencode($joinParams['createTime']);
221
-		}
222
-		// Return the URL:
223
-		return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt));
224
-	}
225
-
226
-	public function getEndMeetingURL($endParams) {
227
-		/* USAGE:
206
+        $this->_meetingId = $this->_requiredParam($joinParams['meetingId']);
207
+        $this->_username = $this->_requiredParam($joinParams['username']);
208
+        $this->_password = $this->_requiredParam($joinParams['password']);
209
+        // Establish the basic join URL:
210
+        $joinUrl = $this->_bbbServerBaseUrl."api/join?";
211
+        // Add parameters to the URL:
212
+        $params =
213
+        'meetingID='.urlencode($this->_meetingId).
214
+        '&fullName='.urlencode($this->_username).
215
+        '&password='.urlencode($this->_password).
216
+        '&userID='.urlencode($joinParams['userID']).
217
+        '&webVoiceConf='.urlencode($joinParams['webVoiceConf']);
218
+        // Only use createTime if we really want to use it. If it's '', then don't pass it:
219
+        if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) {
220
+            $params .= '&createTime='.urlencode($joinParams['createTime']);
221
+        }
222
+        // Return the URL:
223
+        return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt));
224
+    }
225
+
226
+    public function getEndMeetingURL($endParams) {
227
+        /* USAGE:
228 228
 		$endParams = array (
229 229
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
230 230
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
231 231
 		);
232 232
 		*/
233
-		$this->_meetingId = $this->_requiredParam($endParams['meetingId']);
234
-		$this->_password = $this->_requiredParam($endParams['password']);
235
-		$endUrl = $this->_bbbServerBaseUrl."api/end?";
236
-		$params =
237
-		'meetingID='.urlencode($this->_meetingId).
238
-		'&password='.urlencode($this->_password);
239
-		return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt));
240
-	}
241
-
242
-	public function endMeetingWithXmlResponseArray($endParams) {
243
-		/* USAGE:
233
+        $this->_meetingId = $this->_requiredParam($endParams['meetingId']);
234
+        $this->_password = $this->_requiredParam($endParams['password']);
235
+        $endUrl = $this->_bbbServerBaseUrl."api/end?";
236
+        $params =
237
+        'meetingID='.urlencode($this->_meetingId).
238
+        '&password='.urlencode($this->_password);
239
+        return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt));
240
+    }
241
+
242
+    public function endMeetingWithXmlResponseArray($endParams) {
243
+        /* USAGE:
244 244
 		$endParams = array (
245 245
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
246 246
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
247 247
 		);
248 248
 		*/
249
-		$xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams));
250
-		if ($xml) {
251
-			return array(
252
-				'returncode' => $xml->returncode,
253
-				'message' => $xml->message,
254
-				'messageKey' => $xml->messageKey
255
-				);
256
-		}
257
-		else {
258
-			return null;
259
-		}
260
-
261
-	}
262
-
263
-	/* __________________ BBB MONITORING METHODS _________________ */
264
-	/* The methods in the following section support the following categories of the BBB API:
249
+        $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams));
250
+        if ($xml) {
251
+            return array(
252
+                'returncode' => $xml->returncode,
253
+                'message' => $xml->message,
254
+                'messageKey' => $xml->messageKey
255
+                );
256
+        }
257
+        else {
258
+            return null;
259
+        }
260
+
261
+    }
262
+
263
+    /* __________________ BBB MONITORING METHODS _________________ */
264
+    /* The methods in the following section support the following categories of the BBB API:
265 265
 	-- isMeetingRunning
266 266
 	-- getMeetings
267 267
 	-- getMeetingInfo
268 268
 	*/
269 269
 
270
-	public function getIsMeetingRunningUrl($meetingId) {
271
-		/* USAGE:
270
+    public function getIsMeetingRunningUrl($meetingId) {
271
+        /* USAGE:
272 272
 		$meetingId = '1234'		-- REQUIRED - The unique id for the meeting
273 273
 		*/
274
-		$this->_meetingId = $this->_requiredParam($meetingId);
275
-		$runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?";
276
-		$params =
277
-		'meetingID='.urlencode($this->_meetingId);
278
-		return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt));
279
-	}
280
-
281
-	public function isMeetingRunningWithXmlResponseArray($meetingId) {
282
-		/* USAGE:
274
+        $this->_meetingId = $this->_requiredParam($meetingId);
275
+        $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?";
276
+        $params =
277
+        'meetingID='.urlencode($this->_meetingId);
278
+        return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt));
279
+    }
280
+
281
+    public function isMeetingRunningWithXmlResponseArray($meetingId) {
282
+        /* USAGE:
283 283
 		$meetingId = '1234'		-- REQUIRED - The unique id for the meeting
284 284
 		*/
285
-		$xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId));
286
-		if($xml) {
287
-			return array(
288
-				'returncode' => $xml->returncode,
289
-				'running' => $xml->running 	// -- Returns true/false.
290
-				);
291
-		}
292
-		else {
293
-			return null;
294
-		}
295
-
296
-	}
297
-
298
-	public function getGetMeetingsUrl() {
299
-		/* Simply formulate the getMeetings URL
285
+        $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId));
286
+        if($xml) {
287
+            return array(
288
+                'returncode' => $xml->returncode,
289
+                'running' => $xml->running 	// -- Returns true/false.
290
+                );
291
+        }
292
+        else {
293
+            return null;
294
+        }
295
+
296
+    }
297
+
298
+    public function getGetMeetingsUrl() {
299
+        /* Simply formulate the getMeetings URL
300 300
 		We do this in a separate function so we have the option to just get this
301 301
 		URL and print it if we want for some reason.
302 302
 		*/
303
-		$getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt);
304
-		return $getMeetingsUrl;
305
-	}
303
+        $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt);
304
+        return $getMeetingsUrl;
305
+    }
306 306
 
307
-	public function getMeetingsWithXmlResponseArray() {
308
-		/* USAGE:
307
+    public function getMeetingsWithXmlResponseArray() {
308
+        /* USAGE:
309 309
 		We don't need to pass any parameters with this one, so we just send the query URL off to BBB
310 310
 		and then handle the results that we get in the XML response.
311 311
 		*/
312
-		$xml = $this->_processXmlResponse($this->getGetMeetingsUrl());
313
-		if($xml) {
314
-			// If we don't get a success code, stop processing and return just the returncode:
315
-			if ($xml->returncode != 'SUCCESS') {
316
-				$result = array(
317
-					'returncode' => $xml->returncode
318
-				);
319
-				return $result;
320
-			}
321
-			elseif ($xml->messageKey == 'noMeetings') {
322
-				/* No meetings on server, so return just this info: */
323
-				$result = array(
324
-					'returncode' => $xml->returncode,
325
-					'messageKey' => $xml->messageKey,
326
-					'message' => $xml->message
327
-				);
328
-				return $result;
329
-			}
330
-			else {
331
-				// In this case, we have success and meetings. First return general response:
332
-				$result = array(
333
-					'returncode' => $xml->returncode,
334
-					'messageKey' => $xml->messageKey,
335
-					'message' => $xml->message
336
-				);
337
-				// Then interate through meeting results and return them as part of the array:
338
-				foreach ($xml->meetings->meeting as $m) {
339
-					$result[] = array(
340
-						'meetingId' => $m->meetingID,
341
-						'meetingName' => $m->meetingName,
342
-						'createTime' => $m->createTime,
343
-						'attendeePw' => $m->attendeePW,
344
-						'moderatorPw' => $m->moderatorPW,
345
-						'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded,
346
-						'running' => $m->running
347
-						);
348
-					}
349
-				return $result;
350
-			}
351
-		}
352
-		else {
353
-			return null;
354
-		}
355
-
356
-	}
357
-
358
-	public function getMeetingInfoUrl($infoParams) {
359
-		/* USAGE:
312
+        $xml = $this->_processXmlResponse($this->getGetMeetingsUrl());
313
+        if($xml) {
314
+            // If we don't get a success code, stop processing and return just the returncode:
315
+            if ($xml->returncode != 'SUCCESS') {
316
+                $result = array(
317
+                    'returncode' => $xml->returncode
318
+                );
319
+                return $result;
320
+            }
321
+            elseif ($xml->messageKey == 'noMeetings') {
322
+                /* No meetings on server, so return just this info: */
323
+                $result = array(
324
+                    'returncode' => $xml->returncode,
325
+                    'messageKey' => $xml->messageKey,
326
+                    'message' => $xml->message
327
+                );
328
+                return $result;
329
+            }
330
+            else {
331
+                // In this case, we have success and meetings. First return general response:
332
+                $result = array(
333
+                    'returncode' => $xml->returncode,
334
+                    'messageKey' => $xml->messageKey,
335
+                    'message' => $xml->message
336
+                );
337
+                // Then interate through meeting results and return them as part of the array:
338
+                foreach ($xml->meetings->meeting as $m) {
339
+                    $result[] = array(
340
+                        'meetingId' => $m->meetingID,
341
+                        'meetingName' => $m->meetingName,
342
+                        'createTime' => $m->createTime,
343
+                        'attendeePw' => $m->attendeePW,
344
+                        'moderatorPw' => $m->moderatorPW,
345
+                        'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded,
346
+                        'running' => $m->running
347
+                        );
348
+                    }
349
+                return $result;
350
+            }
351
+        }
352
+        else {
353
+            return null;
354
+        }
355
+
356
+    }
357
+
358
+    public function getMeetingInfoUrl($infoParams) {
359
+        /* USAGE:
360 360
 		$infoParams = array(
361 361
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
362 362
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
363 363
 		);
364 364
 		*/
365
-		$this->_meetingId = $this->_requiredParam($infoParams['meetingId']);
366
-		$this->_password = $this->_requiredParam($infoParams['password']);
367
-		$infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?";
368
-		$params =
369
-		'meetingID='.urlencode($this->_meetingId).
370
-		'&password='.urlencode($this->_password);
371
-		return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt));
372
-	}
373
-
374
-	public function getMeetingInfoWithXmlResponseArray($infoParams) {
375
-		/* USAGE:
365
+        $this->_meetingId = $this->_requiredParam($infoParams['meetingId']);
366
+        $this->_password = $this->_requiredParam($infoParams['password']);
367
+        $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?";
368
+        $params =
369
+        'meetingID='.urlencode($this->_meetingId).
370
+        '&password='.urlencode($this->_password);
371
+        return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt));
372
+    }
373
+
374
+    public function getMeetingInfoWithXmlResponseArray($infoParams) {
375
+        /* USAGE:
376 376
 		$infoParams = array(
377 377
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
378 378
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
379 379
 		);
380 380
 		*/
381
-		$xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
382
-		if($xml) {
383
-			// If we don't get a success code or messageKey, find out why:
384
-			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
385
-				$result = array(
386
-					'returncode' => $xml->returncode,
387
-					'messageKey' => $xml->messageKey,
388
-					'message' => $xml->message
389
-				);
390
-				return $result;
391
-			}
392
-			else {
393
-				// In this case, we have success and meeting info:
394
-				$result = array(
395
-					'returncode' => $xml->returncode,
396
-					'meetingName' => $xml->meetingName,
397
-					'meetingId' => $xml->meetingID,
398
-					'createTime' => $xml->createTime,
399
-					'voiceBridge' => $xml->voiceBridge,
400
-					'attendeePw' => $xml->attendeePW,
401
-					'moderatorPw' => $xml->moderatorPW,
402
-					'running' => $xml->running,
403
-					'recording' => $xml->recording,
404
-					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
405
-					'startTime' => $xml->startTime,
406
-					'endTime' => $xml->endTime,
407
-					'participantCount' => $xml->participantCount,
408
-					'maxUsers' => $xml->maxUsers,
409
-					'moderatorCount' => $xml->moderatorCount,
410
-				);
411
-				// Then interate through attendee results and return them as part of the array:
412
-				foreach ($xml->attendees->attendee as $a) {
413
-					$result[] = array(
414
-						'userId' => $a->userID,
415
-						'fullName' => $a->fullName,
416
-						'role' => $a->role
417
-						);
418
-					}
419
-				return $result;
420
-			}
421
-		}
422
-		else {
423
-			return null;
424
-		}
425
-
426
-	}
427
-
428
-	/* __________________ BBB RECORDING METHODS _________________ */
429
-	/* The methods in the following section support the following categories of the BBB API:
381
+        $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
382
+        if($xml) {
383
+            // If we don't get a success code or messageKey, find out why:
384
+            if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
385
+                $result = array(
386
+                    'returncode' => $xml->returncode,
387
+                    'messageKey' => $xml->messageKey,
388
+                    'message' => $xml->message
389
+                );
390
+                return $result;
391
+            }
392
+            else {
393
+                // In this case, we have success and meeting info:
394
+                $result = array(
395
+                    'returncode' => $xml->returncode,
396
+                    'meetingName' => $xml->meetingName,
397
+                    'meetingId' => $xml->meetingID,
398
+                    'createTime' => $xml->createTime,
399
+                    'voiceBridge' => $xml->voiceBridge,
400
+                    'attendeePw' => $xml->attendeePW,
401
+                    'moderatorPw' => $xml->moderatorPW,
402
+                    'running' => $xml->running,
403
+                    'recording' => $xml->recording,
404
+                    'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
405
+                    'startTime' => $xml->startTime,
406
+                    'endTime' => $xml->endTime,
407
+                    'participantCount' => $xml->participantCount,
408
+                    'maxUsers' => $xml->maxUsers,
409
+                    'moderatorCount' => $xml->moderatorCount,
410
+                );
411
+                // Then interate through attendee results and return them as part of the array:
412
+                foreach ($xml->attendees->attendee as $a) {
413
+                    $result[] = array(
414
+                        'userId' => $a->userID,
415
+                        'fullName' => $a->fullName,
416
+                        'role' => $a->role
417
+                        );
418
+                    }
419
+                return $result;
420
+            }
421
+        }
422
+        else {
423
+            return null;
424
+        }
425
+
426
+    }
427
+
428
+    /* __________________ BBB RECORDING METHODS _________________ */
429
+    /* The methods in the following section support the following categories of the BBB API:
430 430
 	-- getRecordings
431 431
 	-- publishRecordings
432 432
 	-- deleteRecordings
433 433
 	*/
434 434
 
435
-	public function getRecordingsUrl($recordingParams) {
436
-		/* USAGE:
435
+    public function getRecordingsUrl($recordingParams) {
436
+        /* USAGE:
437 437
 		$recordingParams = array(
438 438
 			'meetingId' => '1234',		-- OPTIONAL - comma separate if multiple ids
439 439
 		);
440 440
 		*/
441
-		$recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?";
442
-		$params = 'meetingID='.urlencode($recordingParams['meetingId']);
443
-		return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt));
441
+        $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?";
442
+        $params = 'meetingID='.urlencode($recordingParams['meetingId']);
443
+        return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt));
444 444
 
445
-	}
445
+    }
446 446
 
447
-	public function getRecordingsWithXmlResponseArray($recordingParams) {
448
-		/* USAGE:
447
+    public function getRecordingsWithXmlResponseArray($recordingParams) {
448
+        /* USAGE:
449 449
 		$recordingParams = array(
450 450
 			'meetingId' => '1234',		-- OPTIONAL - comma separate if multiple ids
451 451
 		);
@@ -453,121 +453,121 @@  discard block
 block discarded – undo
453 453
 		when creating a meeting, it will kick users out after the duration. Should
454 454
 		probably be required in user code when 'recording' is set to true.
455 455
 		*/
456
-		$xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
457
-		if($xml) {
458
-			// If we don't get a success code or messageKey, find out why:
459
-			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
460
-				$result = array(
461
-					'returncode' => $xml->returncode,
462
-					'messageKey' => $xml->messageKey,
463
-					'message' => $xml->message
464
-				);
465
-				return $result;
466
-			}
467
-			else {
468
-				// In this case, we have success and recording info:
469
-				$result = array(
470
-					'returncode' => $xml->returncode,
471
-					'messageKey' => $xml->messageKey,
472
-					'message' => $xml->message
473
-				);
474
-
475
-				foreach ($xml->recordings->recording as $r) {
476
-					$result[] = array(
477
-						'recordId' => $r->recordID,
478
-						'meetingId' => $r->meetingID,
479
-						'name' => $r->name,
480
-						'published' => $r->published,
481
-						'startTime' => $r->startTime,
482
-						'endTime' => $r->endTime,
483
-						'playbackFormatType' => $r->playback->format->type,
484
-						'playbackFormatUrl' => $r->playback->format->url,
485
-						'playbackFormatLength' => $r->playback->format->length,
486
-						'metadataTitle' => $r->metadata->title,
487
-						'metadataSubject' => $r->metadata->subject,
488
-						'metadataDescription' => $r->metadata->description,
489
-						'metadataCreator' => $r->metadata->creator,
490
-						'metadataContributor' => $r->metadata->contributor,
491
-						'metadataLanguage' => $r->metadata->language,
492
-						// Add more here as needed for your app depending on your
493
-						// use of metadata when creating recordings.
494
-						);
495
-					}
496
-				return $result;
497
-			}
498
-		}
499
-		else {
500
-			return null;
501
-		}
502
-	}
503
-
504
-	public function getPublishRecordingsUrl($recordingParams) {
505
-		/* USAGE:
456
+        $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
457
+        if($xml) {
458
+            // If we don't get a success code or messageKey, find out why:
459
+            if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
460
+                $result = array(
461
+                    'returncode' => $xml->returncode,
462
+                    'messageKey' => $xml->messageKey,
463
+                    'message' => $xml->message
464
+                );
465
+                return $result;
466
+            }
467
+            else {
468
+                // In this case, we have success and recording info:
469
+                $result = array(
470
+                    'returncode' => $xml->returncode,
471
+                    'messageKey' => $xml->messageKey,
472
+                    'message' => $xml->message
473
+                );
474
+
475
+                foreach ($xml->recordings->recording as $r) {
476
+                    $result[] = array(
477
+                        'recordId' => $r->recordID,
478
+                        'meetingId' => $r->meetingID,
479
+                        'name' => $r->name,
480
+                        'published' => $r->published,
481
+                        'startTime' => $r->startTime,
482
+                        'endTime' => $r->endTime,
483
+                        'playbackFormatType' => $r->playback->format->type,
484
+                        'playbackFormatUrl' => $r->playback->format->url,
485
+                        'playbackFormatLength' => $r->playback->format->length,
486
+                        'metadataTitle' => $r->metadata->title,
487
+                        'metadataSubject' => $r->metadata->subject,
488
+                        'metadataDescription' => $r->metadata->description,
489
+                        'metadataCreator' => $r->metadata->creator,
490
+                        'metadataContributor' => $r->metadata->contributor,
491
+                        'metadataLanguage' => $r->metadata->language,
492
+                        // Add more here as needed for your app depending on your
493
+                        // use of metadata when creating recordings.
494
+                        );
495
+                    }
496
+                return $result;
497
+            }
498
+        }
499
+        else {
500
+            return null;
501
+        }
502
+    }
503
+
504
+    public function getPublishRecordingsUrl($recordingParams) {
505
+        /* USAGE:
506 506
 		$recordingParams = array(
507 507
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
508 508
 			'publish' => 'true',		-- REQUIRED - boolean: true/false
509 509
 		);
510 510
 		*/
511
-		$recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?";
512
-		$params =
513
-		'recordID='.urlencode($recordingParams['recordId']).
514
-		'&publish='.urlencode($recordingParams['publish']);
515
-		return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt));
511
+        $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?";
512
+        $params =
513
+        'recordID='.urlencode($recordingParams['recordId']).
514
+        '&publish='.urlencode($recordingParams['publish']);
515
+        return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt));
516 516
 
517
-	}
517
+    }
518 518
 
519
-	public function publishRecordingsWithXmlResponseArray($recordingParams) {
520
-		/* USAGE:
519
+    public function publishRecordingsWithXmlResponseArray($recordingParams) {
520
+        /* USAGE:
521 521
 		$recordingParams = array(
522 522
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
523 523
 			'publish' => 'true',		-- REQUIRED - boolean: true/false
524 524
 		);
525 525
 		*/
526
-		$xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams));
527
-		if($xml) {
528
-			return array(
529
-				'returncode' => $xml->returncode,
530
-				'published' => $xml->published 	// -- Returns true/false.
531
-				);
532
-		}
533
-		else {
534
-			return null;
535
-		}
536
-
537
-
538
-	}
539
-
540
-	public function getDeleteRecordingsUrl($recordingParams) {
541
-		/* USAGE:
526
+        $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams));
527
+        if($xml) {
528
+            return array(
529
+                'returncode' => $xml->returncode,
530
+                'published' => $xml->published 	// -- Returns true/false.
531
+                );
532
+        }
533
+        else {
534
+            return null;
535
+        }
536
+
537
+
538
+    }
539
+
540
+    public function getDeleteRecordingsUrl($recordingParams) {
541
+        /* USAGE:
542 542
 		$recordingParams = array(
543 543
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
544 544
 		);
545 545
 		*/
546
-		$recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?";
547
-		$params =
548
-		'recordID='.urlencode($recordingParams['recordId']);
549
-		return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt));
550
-	}
551
-
552
-	public function deleteRecordingsWithXmlResponseArray($recordingParams) {
553
-		/* USAGE:
546
+        $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?";
547
+        $params =
548
+        'recordID='.urlencode($recordingParams['recordId']);
549
+        return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt));
550
+    }
551
+
552
+    public function deleteRecordingsWithXmlResponseArray($recordingParams) {
553
+        /* USAGE:
554 554
 		$recordingParams = array(
555 555
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
556 556
 		);
557 557
 		*/
558 558
 
559
-		$xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
560
-		if($xml) {
561
-			return array(
562
-				'returncode' => $xml->returncode,
563
-				'deleted' => $xml->deleted 	// -- Returns true/false.
564
-				);
565
-		}
566
-		else {
567
-			return null;
568
-		}
569
-
570
-	}
559
+        $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
560
+        if($xml) {
561
+            return array(
562
+                'returncode' => $xml->returncode,
563
+                'deleted' => $xml->deleted 	// -- Returns true/false.
564
+                );
565
+        }
566
+        else {
567
+            return null;
568
+        }
569
+
570
+    }
571 571
 
572 572
 
573 573
 
Please login to merge, or discard this patch.
plugin/buycourses/src/buy_course_plugin.class.php 2 patches
Doc Comments   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     /**
34 34
      *
35
-     * @return StaticPlugin
35
+     * @return BuyCoursesPlugin
36 36
      */
37 37
     static function create()
38 38
     {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     /**
200 200
      * Save a transfer account information
201 201
      * @param array $params The transfer account
202
-     * @return int Rows affected. Otherwise return false
202
+     * @return false|string Rows affected. Otherwise return false
203 203
      */
204 204
     public function saveTransferAccount($params)
205 205
     {
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
     /**
610 610
      * Get session info
611 611
      * @param array $sessionId The session ID
612
-     * @return array
612
+     * @return Chamilo\CoreBundle\Entity\Session
613 613
      */
614 614
     public function getSessionInfo($sessionId)
615 615
     {
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
      * Register a sale
703 703
      * @param int $itemId The product ID
704 704
      * @param int $paymentType The payment type
705
-     * @return boolean
705
+     * @return false|string
706 706
      */
707 707
     public function registerSale($itemId, $paymentType)
708 708
     {
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 
885 885
     /**
886 886
      * Get payment types
887
-     * @return array
887
+     * @return string[]
888 888
      */
889 889
     public function getPaymentTypes()
890 890
     {
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 
923 923
     /**
924 924
      * Get the statuses for sales
925
-     * @return array
925
+     * @return string[]
926 926
      */
927 927
     public function getSaleStatuses()
928 928
     {
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
     
936 936
     /**
937 937
      * Get the statuses for Payouts
938
-     * @return array
938
+     * @return string[]
939 939
      */
940 940
     public function getPayoutStatuses()
941 941
     {
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 
949 949
     /**
950 950
      * Get the list of product types
951
-     * @return array
951
+     * @return string[]
952 952
      */
953 953
     public function getProductTypes()
954 954
     {
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
     /**
1330 1330
      * Register a item
1331 1331
      * @param array $itemData The item data
1332
-     * @return int The item ID. Otherwise return false
1332
+     * @return false|string The item ID. Otherwise return false
1333 1333
      */
1334 1334
     public function registerItem(array $itemData)
1335 1335
     {
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
     /**
1488 1488
      * Verify if the beneficiary have a paypal account
1489 1489
      * @param int $userId
1490
-     * @return true if the user have a paypal account, false if not
1490
+     * @return boolean if the user have a paypal account, false if not
1491 1491
      */
1492 1492
     public function verifyPaypalAccountByBeneficiary($userId)
1493 1493
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             return false;
88 88
         }
89 89
 
90
-        require_once api_get_path(SYS_PLUGIN_PATH) . 'buycourses/database.php';
90
+        require_once api_get_path(SYS_PLUGIN_PATH).'buycourses/database.php';
91 91
     }
92 92
 
93 93
     /**
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
         );
653 653
 
654 654
         if (!empty($sessionImage)) {
655
-            $sessionInfo['image'] = api_get_path(WEB_UPLOAD_PATH) . $sessionImage['value'];
655
+            $sessionInfo['image'] = api_get_path(WEB_UPLOAD_PATH).$sessionImage['value'];
656 656
         }
657 657
 
658 658
         $sessionCourses = $session->getCourses();
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 
1095 1095
         $str = '';
1096 1096
 
1097
-        srand((double)microtime() * 1000000);
1097
+        srand((double) microtime() * 1000000);
1098 1098
 
1099 1099
         for ($i = 0; $i < $length; $i++) {
1100 1100
             $numbers = rand(0, strlen($salt) - 1);
@@ -1441,8 +1441,8 @@  discard block
 block discarded – undo
1441 1441
      */
1442 1442
     public function getPayouts($status = self::PAYOUT_STATUS_PENDING, $payoutId = false, $userId = false)
1443 1443
     {
1444
-        $condition = ($payoutId) ? 'AND p.id = '. intval($payoutId) : '';
1445
-        $condition2 = ($userId) ? ' AND p.user_id = ' . intval($userId) : '';
1444
+        $condition = ($payoutId) ? 'AND p.id = '.intval($payoutId) : '';
1445
+        $condition2 = ($userId) ? ' AND p.user_id = '.intval($userId) : '';
1446 1446
         $typeResult = ($condition) ? 'first' : 'all';
1447 1447
         $payoutsTable = Database::get_main_table(BuyCoursesPlugin::TABLE_PAYPAL_PAYOUTS);
1448 1448
         $saleTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SALE);
@@ -1469,14 +1469,14 @@  discard block
 block discarded – undo
1469 1469
             INNER JOIN $saleTable s ON s.id = p.sale_id
1470 1470
             INNER JOIN $currencyTable c ON s.currency_id = c.id
1471 1471
             LEFT JOIN  $extraFieldValues efv ON p.user_id = efv.item_id 
1472
-            AND field_id = " . intval($paypalExtraField['id']) . "
1472
+            AND field_id = ".intval($paypalExtraField['id'])."
1473 1473
         ";
1474 1474
         
1475 1475
         $payouts = Database::select(
1476 1476
             "p.* , u.firstname, u.lastname, efv.value as paypal_account, s.reference as sale_reference, s.price as item_price, c.iso_code",
1477 1477
             "$payoutsTable p $innerJoins",
1478 1478
             [
1479
-                'where' => ['p.status = ? '.$condition . ' ' .$condition2 => $status]
1479
+                'where' => ['p.status = ? '.$condition.' '.$condition2 => $status]
1480 1480
             ],
1481 1481
             $typeResult
1482 1482
         );
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
         $platformCommission = $this->getPlatformCommission();
1541 1541
 
1542 1542
         $sale = $this->getSale($saleId);
1543
-        $teachersCommission = number_format((floatval($sale['price']) * intval($platformCommission['commission']))/100, 2);
1543
+        $teachersCommission = number_format((floatval($sale['price']) * intval($platformCommission['commission'])) / 100, 2);
1544 1544
         
1545 1545
         
1546 1546
         $beneficiaries = $this->getBeneficiariesBySale($saleId);
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
                     'payout_date' => getdate(),
1553 1553
                     'sale_id' => intval($saleId),
1554 1554
                     'user_id' => $beneficiary['user_id'],
1555
-                    'commission' => number_format((floatval($teachersCommission) * intval($beneficiary['commissions']))/100, 2),
1555
+                    'commission' => number_format((floatval($teachersCommission) * intval($beneficiary['commissions'])) / 100, 2),
1556 1556
                     'status' => self::PAYOUT_STATUS_PENDING
1557 1557
                 ]
1558 1558
             );
Please login to merge, or discard this patch.
plugin/buycourses/src/paypalfunctions.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -324,6 +324,8 @@
 block discarded – undo
324 324
  * @nvpStr is nvp string.
325 325
  * returns an associtive array containing the response from the server.
326 326
  *
327
+ * @param string $methodName
328
+ * @param string $nvpStr
327 329
  */
328 330
 function hash_call($methodName, $nvpStr)
329 331
 {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
  *		phoneNum:			the phoneNum  entered on the merchant's site
112 112
  */
113 113
 function CallMarkExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL,
114
-                                 $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState,
115
-                                 $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum
114
+                                    $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState,
115
+                                    $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum
116 116
 )
117 117
 {
118 118
     // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
  */
266 266
 
267 267
 function DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCardNumber,
268
-                       $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip,
269
-                       $countryCode, $currencyCode)
268
+                        $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip,
269
+                        $countryCode, $currencyCode)
270 270
 {
271 271
     //Construct the parameter string that describes DoDirectPayment
272 272
     $nvpstr = "&AMT=" . $paymentAmount;
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 function CallShortcutExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $extra)
68 68
 {
69 69
     // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
70
-    $nvpstr = "&PAYMENTREQUEST_0_AMT=" . $paymentAmount;
71
-    $nvpstr .= "&PAYMENTREQUEST_0_ITEMAMT=" . $paymentAmount;
72
-    $nvpstr .= "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
73
-    $nvpstr .= "&RETURNURL=" . $returnURL;
74
-    $nvpstr .= "&CANCELURL=" . $cancelURL;
75
-    $nvpstr .= "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
70
+    $nvpstr = "&PAYMENTREQUEST_0_AMT=".$paymentAmount;
71
+    $nvpstr .= "&PAYMENTREQUEST_0_ITEMAMT=".$paymentAmount;
72
+    $nvpstr .= "&PAYMENTREQUEST_0_PAYMENTACTION=".$paymentType;
73
+    $nvpstr .= "&RETURNURL=".$returnURL;
74
+    $nvpstr .= "&CANCELURL=".$cancelURL;
75
+    $nvpstr .= "&PAYMENTREQUEST_0_CURRENCYCODE=".$currencyCodeType;
76 76
     $nvpstr .= $extra;
77 77
 
78 78
     $_SESSION["currencyCodeType"] = $currencyCodeType;
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
 )
117 117
 {
118 118
     // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
119
-    $nvpstr = "&PAYMENTREQUEST_0_AMT=" . $paymentAmount;
120
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
121
-    $nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
122
-    $nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
123
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
124
-    $nvpstr = $nvpstr . "&ADDROVERRIDE=1";
125
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTONAME=" . $shipToName;
126
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOSTREET=" . $shipToStreet;
127
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOSTREET2=" . $shipToStreet2;
128
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOCITY=" . $shipToCity;
129
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOSTATE=" . $shipToState;
130
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=" . $shipToCountryCode;
131
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOZIP=" . $shipToZip;
132
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOPHONENUM=" . $phoneNum;
119
+    $nvpstr = "&PAYMENTREQUEST_0_AMT=".$paymentAmount;
120
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_PAYMENTACTION=".$paymentType;
121
+    $nvpstr = $nvpstr."&RETURNURL=".$returnURL;
122
+    $nvpstr = $nvpstr."&CANCELURL=".$cancelURL;
123
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_CURRENCYCODE=".$currencyCodeType;
124
+    $nvpstr = $nvpstr."&ADDROVERRIDE=1";
125
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTONAME=".$shipToName;
126
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOSTREET=".$shipToStreet;
127
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOSTREET2=".$shipToStreet2;
128
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOCITY=".$shipToCity;
129
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOSTATE=".$shipToState;
130
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=".$shipToCountryCode;
131
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOZIP=".$shipToZip;
132
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOPHONENUM=".$phoneNum;
133 133
 
134 134
     $_SESSION["currencyCodeType"] = $currencyCodeType;
135 135
     $_SESSION["PaymentType"] = $paymentType;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * Build a second API request to PayPal, using the token as the
173 173
      * ID to get the details on the payment authorization
174 174
      */
175
-    $nvpstr = "&TOKEN=" . $token;
175
+    $nvpstr = "&TOKEN=".$token;
176 176
 
177 177
     /**
178 178
      * Make the API call and store the results in an array.
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
     $payerID = urlencode($_SESSION['payer_id']);
214 214
     $serverName = urlencode($_SERVER['SERVER_NAME']);
215 215
 
216
-    $nvpstr = '&TOKEN=' . $token . '&PAYERID=' . $payerID . '&PAYMENTREQUEST_0_PAYMENTACTION=' . $paymentType . '&PAYMENTREQUEST_0_AMT=' . $FinalPaymentAmt;
217
-    $nvpstr .= '&PAYMENTREQUEST_0_CURRENCYCODE=' . $currencyCodeType . '&IPADDRESS=' . $serverName;
218
-    $nvpstr = '&' . http_build_query([
216
+    $nvpstr = '&TOKEN='.$token.'&PAYERID='.$payerID.'&PAYMENTREQUEST_0_PAYMENTACTION='.$paymentType.'&PAYMENTREQUEST_0_AMT='.$FinalPaymentAmt;
217
+    $nvpstr .= '&PAYMENTREQUEST_0_CURRENCYCODE='.$currencyCodeType.'&IPADDRESS='.$serverName;
218
+    $nvpstr = '&'.http_build_query([
219 219
         'TOKEN' => $token,
220 220
         'PAYERID' => $payerID,
221 221
         'PAYMENTACTION' => $paymentType,
@@ -269,20 +269,20 @@  discard block
 block discarded – undo
269 269
                        $countryCode, $currencyCode)
270 270
 {
271 271
     //Construct the parameter string that describes DoDirectPayment
272
-    $nvpstr = "&AMT=" . $paymentAmount;
273
-    $nvpstr = $nvpstr . "&CURRENCYCODE=" . $currencyCode;
274
-    $nvpstr = $nvpstr . "&PAYMENTACTION=" . $paymentType;
275
-    $nvpstr = $nvpstr . "&CREDITCARDTYPE=" . $creditCardType;
276
-    $nvpstr = $nvpstr . "&ACCT=" . $creditCardNumber;
277
-    $nvpstr = $nvpstr . "&EXPDATE=" . $expDate;
278
-    $nvpstr = $nvpstr . "&CVV2=" . $cvv2;
279
-    $nvpstr = $nvpstr . "&FIRSTNAME=" . $firstName;
280
-    $nvpstr = $nvpstr . "&LASTNAME=" . $lastName;
281
-    $nvpstr = $nvpstr . "&STREET=" . $street;
282
-    $nvpstr = $nvpstr . "&CITY=" . $city;
283
-    $nvpstr = $nvpstr . "&STATE=" . $state;
284
-    $nvpstr = $nvpstr . "&COUNTRYCODE=" . $countryCode;
285
-    $nvpstr = $nvpstr . "&IPADDRESS=" . $_SERVER['REMOTE_ADDR'];
272
+    $nvpstr = "&AMT=".$paymentAmount;
273
+    $nvpstr = $nvpstr."&CURRENCYCODE=".$currencyCode;
274
+    $nvpstr = $nvpstr."&PAYMENTACTION=".$paymentType;
275
+    $nvpstr = $nvpstr."&CREDITCARDTYPE=".$creditCardType;
276
+    $nvpstr = $nvpstr."&ACCT=".$creditCardNumber;
277
+    $nvpstr = $nvpstr."&EXPDATE=".$expDate;
278
+    $nvpstr = $nvpstr."&CVV2=".$cvv2;
279
+    $nvpstr = $nvpstr."&FIRSTNAME=".$firstName;
280
+    $nvpstr = $nvpstr."&LASTNAME=".$lastName;
281
+    $nvpstr = $nvpstr."&STREET=".$street;
282
+    $nvpstr = $nvpstr."&CITY=".$city;
283
+    $nvpstr = $nvpstr."&STATE=".$state;
284
+    $nvpstr = $nvpstr."&COUNTRYCODE=".$countryCode;
285
+    $nvpstr = $nvpstr."&IPADDRESS=".$_SERVER['REMOTE_ADDR'];
286 286
 
287 287
     $resArray = hash_call("DoDirectPayment", $nvpstr);
288 288
 
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
     //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
346 346
     //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php
347 347
     if ($USE_PROXY) {
348
-        curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST . ":" . $PROXY_PORT);
348
+        curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST.":".$PROXY_PORT);
349 349
     }
350 350
 
351 351
     //NVPRequest for submitting to server
352
-    $nvpreq = "METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) .
353
-        "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) .
354
-        "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
352
+    $nvpreq = "METHOD=".urlencode($methodName)."&VERSION=".urlencode($version).
353
+        "&PWD=".urlencode($API_Password)."&USER=".urlencode($API_UserName).
354
+        "&SIGNATURE=".urlencode($API_Signature).$nvpStr."&BUTTONSOURCE=".urlencode($sBNCode);
355 355
 
356 356
     //setting the nvpreq as POST FIELD to curl
357 357
     curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 {
386 386
     global $PAYPAL_URL;
387 387
     // Redirect to paypal.com here
388
-    $payPalURL = $PAYPAL_URL . $token;
389
-    header("Location: " . $payPalURL);
388
+    $payPalURL = $PAYPAL_URL.$token;
389
+    header("Location: ".$payPalURL);
390 390
     exit;
391 391
 }
392 392
 
Please login to merge, or discard this patch.
plugin/clockworksms/lib/clockworksms_plugin.class.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     /**
15 15
      * create (a singleton function that ensures ClockworksmsPlugin instance is
16 16
      * created only once. If it is already created, it returns the instance)
17
-     * @return  object  ClockworksmsPlugin instance
17
+     * @return  ClockworksmsPlugin  ClockworksmsPlugin instance
18 18
      */
19 19
     public static function create()
20 20
     {
Please login to merge, or discard this patch.