Completed
Push — master ( 565c08...93d030 )
by José
125:33 queued 71:22
created
main/webservices/webservice_user.php 1 patch
Indentation   +416 added lines, -416 removed lines patch added patch discarded remove patch
@@ -11,232 +11,232 @@  discard block
 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
 
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) {
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 236
 
237
-		    return new WSError(104, 'There was an error creating the user');
237
+            return new WSError(104, 'There was an error creating the user');
238 238
 
239
-			/*$failure = $api_failureList[0];
239
+            /*$failure = $api_failureList[0];
240 240
 			if($failure == 'login-pass already taken') {
241 241
 				return new WSError(102, 'This username is already taken');
242 242
 			} else if($failure == 'encrypt_method invalid') {
@@ -244,227 +244,227 @@  discard block
 block discarded – undo
244 244
 			} else {
245 245
 				return new WSError(104, 'There was an error creating the user');
246 246
 			}*/
247
-		} else {
248
-			return $result;
249
-		}
250
-	}
247
+        } else {
248
+            return $result;
249
+        }
250
+    }
251 251
 
252
-	/**
253
-	 * Creates a user
254
-	 *
255
-	 * @param string API secret key
256
-	 * @param string User first name
257
-	 * @param string User last name
258
-	 * @param int User status
259
-	 * @param string Login name
260
-	 * @param string Password (encrypted or not)
261
-	 * @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
262
-	 * to include the salt in the extra fields if you are encrypting the password
263
-	 * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
264
-	 * @param string User id value. Leave blank if you are using the internal user_id
265
-	 * @param int Visibility. Set by default to 1
266
-	 * @param string User email. Set by default to an empty string
267
-	 * @param string Language. Set by default to english
268
-	 * @param string Phone. Set by default to an empty string
269
-	 * @param string Expiration date. Set to null by default
270
-	 * @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
271
-	 * @return int New user id generated by the system
272
-	 */
273
-	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()) {
274
-		// First, verify the secret key
275
-		$verifKey = $this->verifyKey($secret_key);
276
-		if($verifKey instanceof WSError) {
277
-			$this->handleError($verifKey);
278
-		} else {
279
-			$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
280
-			if($result instanceof WSError) {
281
-				$this->handleError($result);
282
-			} else {
283
-				return $result;
284
-			}
285
-		}
286
-	}
252
+    /**
253
+     * Creates a user
254
+     *
255
+     * @param string API secret key
256
+     * @param string User first name
257
+     * @param string User last name
258
+     * @param int User status
259
+     * @param string Login name
260
+     * @param string Password (encrypted or not)
261
+     * @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
262
+     * to include the salt in the extra fields if you are encrypting the password
263
+     * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
264
+     * @param string User id value. Leave blank if you are using the internal user_id
265
+     * @param int Visibility. Set by default to 1
266
+     * @param string User email. Set by default to an empty string
267
+     * @param string Language. Set by default to english
268
+     * @param string Phone. Set by default to an empty string
269
+     * @param string Expiration date. Set to null by default
270
+     * @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
271
+     * @return int New user id generated by the system
272
+     */
273
+    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()) {
274
+        // First, verify the secret key
275
+        $verifKey = $this->verifyKey($secret_key);
276
+        if($verifKey instanceof WSError) {
277
+            $this->handleError($verifKey);
278
+        } else {
279
+            $result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
280
+            if($result instanceof WSError) {
281
+                $this->handleError($result);
282
+            } else {
283
+                return $result;
284
+            }
285
+        }
286
+    }
287 287
 
288
-	/**
289
-	 * Creates multiple users
290
-	 *
291
-	 * @param string API secret key
292
-	 * @param array Users array. Each member of this array must follow the structure imposed by the CreateUser method
293
-	 * @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'))
294
-	 */
295
-	public function CreateUsers($secret_key, $users) {
296
-		$verifKey = $this->verifyKey($secret_key);
297
-		if($verifKey instanceof WSError) {
298
-			$this->handleError($verifKey);
299
-		} else {
300
-			$results = array();
301
-			foreach($users as $user) {
302
-				$result_tmp = array();
288
+    /**
289
+     * Creates multiple users
290
+     *
291
+     * @param string API secret key
292
+     * @param array Users array. Each member of this array must follow the structure imposed by the CreateUser method
293
+     * @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'))
294
+     */
295
+    public function CreateUsers($secret_key, $users) {
296
+        $verifKey = $this->verifyKey($secret_key);
297
+        if($verifKey instanceof WSError) {
298
+            $this->handleError($verifKey);
299
+        } else {
300
+            $results = array();
301
+            foreach($users as $user) {
302
+                $result_tmp = array();
303 303
                 // re-initialize variables just in case
304 304
                 $firstname = $lastname = $status = $login = $password = $encrypt_method = $user_id_field_name = $user_id_value = $visibility = $email = $language = $phone = $expiration_date = $extras = null;
305
-				extract($user);
306
-				$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
307
-				if($result instanceof WSError) {
308
-					$result_tmp['result'] = $result->toArray();
309
-					$result_tmp['user_id_value'] = $user_id_value;
310
-					$result_tmp['user_id_generated'] = 0;
311
-				} else {
312
-					$result_tmp['result'] = $this->getSuccessfulResult();
313
-					$result_tmp['user_id_value'] = $user_id_value;
314
-					$result_tmp['user_id_generated'] = $result;
315
-				}
316
-				$results[] = $result_tmp;
317
-			}
318
-			return $results;
319
-		}
320
-	}
305
+                extract($user);
306
+                $result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
307
+                if($result instanceof WSError) {
308
+                    $result_tmp['result'] = $result->toArray();
309
+                    $result_tmp['user_id_value'] = $user_id_value;
310
+                    $result_tmp['user_id_generated'] = 0;
311
+                } else {
312
+                    $result_tmp['result'] = $this->getSuccessfulResult();
313
+                    $result_tmp['user_id_value'] = $user_id_value;
314
+                    $result_tmp['user_id_generated'] = $result;
315
+                }
316
+                $results[] = $result_tmp;
317
+            }
318
+            return $results;
319
+        }
320
+    }
321 321
 
322
-	/**
323
-	 * Edits user info (helper method)
324
-	 *
325
-	 * @param string User id field name. Use "chamilo_user_id" in order to use internal system id
326
-	 * @param string User id value
327
-	 * @param string First name
328
-	 * @param string Last name
329
-	 * @param int User status
330
-	 * @param string Login name
331
-	 * @param string Password. Leave blank if you don't want to update it
332
-	 * @param string Encrypt method
333
-	 * @param string User email
334
-	 * @param string Language. Set by default to english
335
-	 * @param string Phone. Set by default to an empty string
336
-	 * @param string Expiration date. Set to null by default
337
-	 * @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
338
-	 * @return mixed True if user was successfully updated, WSError otherwise
339
-	 */
340
-	protected function editUserHelper(
341
-		$user_id_field_name,
342
-		$user_id_value,
343
-		$firstname,
344
-		$lastname,
345
-		$status,
346
-		$loginname,
347
-		$password,
348
-		$encrypt_method,
349
-		$email,
350
-		$language,
351
-		$phone,
352
-		$expiration_date,
353
-		$extras
354
-	) {
355
-		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
356
-		if($user_id instanceof WSError) {
357
-			return $user_id;
358
-		} else {
359
-			if($password == '') {
360
-				$password = null;
361
-			}
362
-			$user_info = api_get_user_info($user_id);
363
-			if (count($extras) == 0) {
364
-				$extras = null;
365
-			}
322
+    /**
323
+     * Edits user info (helper method)
324
+     *
325
+     * @param string User id field name. Use "chamilo_user_id" in order to use internal system id
326
+     * @param string User id value
327
+     * @param string First name
328
+     * @param string Last name
329
+     * @param int User status
330
+     * @param string Login name
331
+     * @param string Password. Leave blank if you don't want to update it
332
+     * @param string Encrypt method
333
+     * @param string User email
334
+     * @param string Language. Set by default to english
335
+     * @param string Phone. Set by default to an empty string
336
+     * @param string Expiration date. Set to null by default
337
+     * @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
338
+     * @return mixed True if user was successfully updated, WSError otherwise
339
+     */
340
+    protected function editUserHelper(
341
+        $user_id_field_name,
342
+        $user_id_value,
343
+        $firstname,
344
+        $lastname,
345
+        $status,
346
+        $loginname,
347
+        $password,
348
+        $encrypt_method,
349
+        $email,
350
+        $language,
351
+        $phone,
352
+        $expiration_date,
353
+        $extras
354
+    ) {
355
+        $user_id = $this->getUserId($user_id_field_name, $user_id_value);
356
+        if($user_id instanceof WSError) {
357
+            return $user_id;
358
+        } else {
359
+            if($password == '') {
360
+                $password = null;
361
+            }
362
+            $user_info = api_get_user_info($user_id);
363
+            if (count($extras) == 0) {
364
+                $extras = null;
365
+            }
366 366
 
367
-			$result = UserManager::update_user(
368
-				$user_id,
369
-				$firstname,
370
-				$lastname,
371
-				$loginname,
372
-				$password,
373
-				PLATFORM_AUTH_SOURCE,
374
-				$email,
375
-				$status,
376
-				'',
377
-				$phone,
378
-				$user_info['picture_uri'],
379
-				$expiration_date,
380
-				$user_info['active'],
381
-				null,
382
-				$user_info['hr_dept_id'],
383
-				$extras,
384
-				$encrypt_method
385
-			);
386
-			if (!$result) {
387
-				/*if($failure == 'encrypt_method invalid') {
367
+            $result = UserManager::update_user(
368
+                $user_id,
369
+                $firstname,
370
+                $lastname,
371
+                $loginname,
372
+                $password,
373
+                PLATFORM_AUTH_SOURCE,
374
+                $email,
375
+                $status,
376
+                '',
377
+                $phone,
378
+                $user_info['picture_uri'],
379
+                $expiration_date,
380
+                $user_info['active'],
381
+                null,
382
+                $user_info['hr_dept_id'],
383
+                $extras,
384
+                $encrypt_method
385
+            );
386
+            if (!$result) {
387
+                /*if($failure == 'encrypt_method invalid') {
388 388
 					return new WSError(103, 'The encryption of the password is invalid');
389 389
 				} else {
390 390
 					return new WSError(105, 'There was an error updating the user');
391 391
 				}*/
392
-				return new WSError(105, 'There was an error updating the user');
393
-			} else {
394
-				return $result;
395
-			}
396
-		}
397
-	}
392
+                return new WSError(105, 'There was an error updating the user');
393
+            } else {
394
+                return $result;
395
+            }
396
+        }
397
+    }
398 398
 
399
-	/**
400
-	 * Edits user info
401
-	 *
402
-	 * @param string API secret key
403
-	 * @param string User id field name. Use "chamilo_user_id" in order to use internal system id
404
-	 * @param string User id value
405
-	 * @param string First name
406
-	 * @param string Last name
407
-	 * @param int User status
408
-	 * @param string Login name
409
-	 * @param string Password. Leave blank if you don't want to update it
410
-	 * @param string Encrypt method
411
-	 * @param string User email
412
-	 * @param string Language. Set by default to english
413
-	 * @param string Phone. Set by default to an empty string
414
-	 * @param string Expiration date. Set to null by default
415
-	 * @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
416
-	 */
417
-	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) {
418
-		// First, verify the secret key
419
-		$verifKey = $this->verifyKey($secret_key);
420
-		if($verifKey instanceof WSError) {
421
-			$this->handleError($verifKey);
422
-		} else {
399
+    /**
400
+     * Edits user info
401
+     *
402
+     * @param string API secret key
403
+     * @param string User id field name. Use "chamilo_user_id" in order to use internal system id
404
+     * @param string User id value
405
+     * @param string First name
406
+     * @param string Last name
407
+     * @param int User status
408
+     * @param string Login name
409
+     * @param string Password. Leave blank if you don't want to update it
410
+     * @param string Encrypt method
411
+     * @param string User email
412
+     * @param string Language. Set by default to english
413
+     * @param string Phone. Set by default to an empty string
414
+     * @param string Expiration date. Set to null by default
415
+     * @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
416
+     */
417
+    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) {
418
+        // First, verify the secret key
419
+        $verifKey = $this->verifyKey($secret_key);
420
+        if($verifKey instanceof WSError) {
421
+            $this->handleError($verifKey);
422
+        } else {
423 423
 
424
-			$extras_associative = array();
425
-			if (!empty($extras)) {
426
-				foreach($extras as $extra) {
427
-					$extras_associative[$extra['field_name']] = $extra['field_value'];
428
-				}
429
-			}
424
+            $extras_associative = array();
425
+            if (!empty($extras)) {
426
+                foreach($extras as $extra) {
427
+                    $extras_associative[$extra['field_name']] = $extra['field_value'];
428
+                }
429
+            }
430 430
 
431
-			$result = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras_associative);
432
-			if($result instanceof WSError) {
433
-				$this->handleError($result);
434
-			}
435
-		}
436
-	}
431
+            $result = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras_associative);
432
+            if($result instanceof WSError) {
433
+                $this->handleError($result);
434
+            }
435
+        }
436
+    }
437 437
 
438
-	/**
439
-	 * Edits multiple users
440
-	 *
441
-	 * @param string API secret key
442
-	 * @param array Users array. Each member of this array must follow the structure imposed by the EditUser method
443
-	 * @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
444
-	 * than 0, an error occured
445
-	 */
446
-	public function EditUsers($secret_key, $users) {
447
-		$verifKey = $this->verifyKey($secret_key);
448
-		if($verifKey instanceof WSError) {
449
-			$this->handleError($verifKey);
450
-		} else {
451
-			$results = array();
452
-			foreach($users as $user) {
453
-				$result_tmp = array();
438
+    /**
439
+     * Edits multiple users
440
+     *
441
+     * @param string API secret key
442
+     * @param array Users array. Each member of this array must follow the structure imposed by the EditUser method
443
+     * @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
444
+     * than 0, an error occured
445
+     */
446
+    public function EditUsers($secret_key, $users) {
447
+        $verifKey = $this->verifyKey($secret_key);
448
+        if($verifKey instanceof WSError) {
449
+            $this->handleError($verifKey);
450
+        } else {
451
+            $results = array();
452
+            foreach($users as $user) {
453
+                $result_tmp = array();
454 454
                 // re-initialize variables just in case
455 455
                 $user_id_field_name = $user_id_value = $firstname = $lastname = $status = $loginname = $password = $encrypt_method = $email = $language = $phone = $expiration_date = $extras = null;
456
-				extract($user);
457
-				$result_op = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras);
458
-				$result_tmp['user_id_value'] = $user['user_id_value'];
459
-				if($result_op instanceof WSError) {
460
-					// Return the error in the results
461
-					$result_tmp['result'] = $result_op->toArray();
462
-				} else {
463
-					$result_tmp['result'] = $this->getSuccessfulResult();
464
-				}
465
-				$results[] = $result_tmp;
466
-			}
467
-			return $results;
468
-		}
469
-	}
456
+                extract($user);
457
+                $result_op = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras);
458
+                $result_tmp['user_id_value'] = $user['user_id_value'];
459
+                if($result_op instanceof WSError) {
460
+                    // Return the error in the results
461
+                    $result_tmp['result'] = $result_op->toArray();
462
+                } else {
463
+                    $result_tmp['result'] = $this->getSuccessfulResult();
464
+                }
465
+                $results[] = $result_tmp;
466
+            }
467
+            return $results;
468
+        }
469
+    }
470 470
 }
Please login to merge, or discard this patch.
main/admin/access_url_edit_course_category_to_url.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 }
121 121
 
122 122
 if ($add_type == 'multiple') {
123
-	$link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
123
+    $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
124 124
         get_lang('SessionAddTypeUnique').'</a>';
125
-	$link_add_type_multiple = get_lang('SessionAddTypeMultiple');
125
+    $link_add_type_multiple = get_lang('SessionAddTypeMultiple');
126 126
 } else {
127
-	$link_add_type_unique = get_lang('SessionAddTypeUnique');
128
-	$link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
127
+    $link_add_type_unique = get_lang('SessionAddTypeUnique');
128
+    $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
129 129
         get_lang('SessionAddTypeMultiple').'</a>';
130 130
 }
131 131
 
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 	<td colspan="3" align="center">
224 224
 		<br />
225 225
 		<?php
226
-		if(isset($_GET['add']))
227
-			echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>';
228
-		else
229
-			echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
230
-		?>
226
+        if(isset($_GET['add']))
227
+            echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>';
228
+        else
229
+            echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
230
+        ?>
231 231
 	</td>
232 232
 </tr>
233 233
 </table>
Please login to merge, or discard this patch.
main/admin/access_url_edit_courses_to_url.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 $xajax = new xajax();
13 13
 $xajax->registerFunction(
14
-	array('search_courses', 'Accessurleditcoursestourl', 'search_courses')
14
+    array('search_courses', 'Accessurleditcoursestourl', 'search_courses')
15 15
 );
16 16
 
17 17
 // setting the section (for the tabs)
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 // Access restrictions
21 21
 api_protect_global_admin_script();
22 22
 if (!api_get_multiple_access_url()) {
23
-	header('Location: index.php');
24
-	exit;
23
+    header('Location: index.php');
24
+    exit;
25 25
 }
26 26
 
27 27
 // Database Table Definitions
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 
37 37
 $add_type = 'multiple';
38 38
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
39
-	$add_type = Security::remove_XSS($_REQUEST['add_type']);
39
+    $add_type = Security::remove_XSS($_REQUEST['add_type']);
40 40
 }
41 41
 
42 42
 $access_url_id = 1;
43 43
 if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!='') {
44
-	$access_url_id = Security::remove_XSS($_REQUEST['access_url_id']);
44
+    $access_url_id = Security::remove_XSS($_REQUEST['access_url_id']);
45 45
 }
46 46
 
47 47
 $xajax -> processRequests();
@@ -162,22 +162,22 @@  discard block
 block discarded – undo
162 162
 		<select name="access_url_id" onchange="javascript:send();">
163 163
 			<option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option>
164 164
 			<?php
165
-			$url_selected='';
166
-			foreach ($url_list as $url_obj) {
167
-				$checked = '';
168
-				if (!empty($access_url_id)) {
169
-					if ($url_obj[0]==$access_url_id) {
170
-						$checked = 'selected=true';
171
-						$url_selected=$url_obj[1];
172
-					}
173
-				}
174
-				if ($url_obj['active']==1) {
175
-					?>
165
+            $url_selected='';
166
+            foreach ($url_list as $url_obj) {
167
+                $checked = '';
168
+                if (!empty($access_url_id)) {
169
+                    if ($url_obj[0]==$access_url_id) {
170
+                        $checked = 'selected=true';
171
+                        $url_selected=$url_obj[1];
172
+                    }
173
+                }
174
+                if ($url_obj['active']==1) {
175
+                    ?>
176 176
 					<option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option>
177 177
 				<?php
178
-				}
179
-			}
180
-			?>
178
+                }
179
+            }
180
+            ?>
181 181
 		</select>
182 182
 		<br /><br />
183 183
 		<input type="hidden" name="form_sent" value="1" />
@@ -196,38 +196,38 @@  discard block
 block discarded – undo
196 196
 				<td align="center">
197 197
 					<div id="content_source">
198 198
 						<?php
199
-						if($ajax_search) {
200
-							?>
199
+                        if($ajax_search) {
200
+                            ?>
201 201
 							<input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
202 202
 							<div id="ajax_list_courses"></div>
203 203
 						<?php
204
-						} else {
205
-							?>
204
+                        } else {
205
+                            ?>
206 206
 							<select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;">
207 207
 								<?php
208
-								foreach($no_course_list as $no_course) {
209
-									?>
208
+                                foreach($no_course_list as $no_course) {
209
+                                    ?>
210 210
 									<option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option>
211 211
 								<?php
212
-								}
213
-								unset($no_course_list);
214
-								?>
212
+                                }
213
+                                unset($no_course_list);
214
+                                ?>
215 215
 							</select>
216 216
 						<?php
217
-						}
218
-						?>
217
+                        }
218
+                        ?>
219 219
 					</div>
220 220
 				</td>
221 221
 				<td width="10%" valign="middle" align="center">
222 222
 					<?php
223
-					if($ajax_search) {
224
-						?>
223
+                    if($ajax_search) {
224
+                        ?>
225 225
 						<button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" >
226 226
                             <em class="fa fa-arrow-left"></em>
227 227
 						</button>
228 228
 					<?php
229
-					} else {
230
-						?>
229
+                    } else {
230
+                        ?>
231 231
 						<button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" >
232 232
                             <em class="fa fa-arrow-right"></em>
233 233
 						</button>
@@ -236,21 +236,21 @@  discard block
 block discarded – undo
236 236
                             <em class="fa fa-arrow-left"></em>
237 237
 						</button>
238 238
 					<?php
239
-					}
240
-					?>
239
+                    }
240
+                    ?>
241 241
 					<br /><br /><br /><br /><br /><br />
242 242
 				</td>
243 243
 				<td align="center">
244 244
 					<select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;">
245 245
 						<?php
246
-						foreach($course_list as $course) {
247
-							$courseInfo = api_get_course_info_by_id($course['id']);
248
-							?>
246
+                        foreach($course_list as $course) {
247
+                            $courseInfo = api_get_course_info_by_id($course['id']);
248
+                            ?>
249 249
 							<option value="<?php echo $course['id']; ?>"><?php echo $course['title'].' ('.$courseInfo['code'].')'; ?></option>
250 250
 						<?php
251
-						}
252
-						unset($course_list);
253
-						?>
251
+                        }
252
+                        unset($course_list);
253
+                        ?>
254 254
 
255 255
 					</select></td>
256 256
 			</tr>
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 				<td colspan="3" align="center">
259 259
 					<br />
260 260
 					<?php
261
-					if(isset($_GET['add']))
262
-						echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
263
-					else
264
-						echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
265
-					?>
261
+                    if(isset($_GET['add']))
262
+                        echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
263
+                    else
264
+                        echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
265
+                    ?>
266 266
 				</td>
267 267
 			</tr>
268 268
 		</table>
Please login to merge, or discard this patch.
main/lp/lp_controller.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -544,17 +544,17 @@  discard block
 block discarded – undo
544 544
                 if (isset($_REQUEST['activate_start_date_check']) &&
545 545
                     $_REQUEST['activate_start_date_check'] == 1
546 546
                 ) {
547
-                	$publicated_on = $_REQUEST['publicated_on'];
547
+                    $publicated_on = $_REQUEST['publicated_on'];
548 548
                 } else {
549
-                	$publicated_on = null;
549
+                    $publicated_on = null;
550 550
                 }
551 551
 
552 552
                 if (isset($_REQUEST['activate_end_date_check']) &&
553 553
                     $_REQUEST['activate_end_date_check'] == 1
554 554
                 ) {
555
-                	$expired_on = $_REQUEST['expired_on'];
555
+                    $expired_on = $_REQUEST['expired_on'];
556 556
                 } else {
557
-                	$expired_on = null;
557
+                    $expired_on = null;
558 558
                 }
559 559
 
560 560
                 $new_lp_id = learnpath::add_lp(
@@ -958,9 +958,9 @@  discard block
 block discarded – undo
958 958
             $_SESSION['oLP']->setAccumulateScormTime($accumulateScormTime);
959 959
 
960 960
             if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
961
-            	$publicated_on  = $_REQUEST['publicated_on'];
961
+                $publicated_on  = $_REQUEST['publicated_on'];
962 962
             } else {
963
-            	$publicated_on = null;
963
+                $publicated_on = null;
964 964
             }
965 965
 
966 966
             if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
         } elseif ($mode == 'embedded') {
1179 1179
             $_SESSION['oLP']->mode = 'embedded';
1180 1180
         } elseif ($mode == 'embedframe') {
1181
-        	$_SESSION['oLP']->mode = 'embedframe';
1181
+            $_SESSION['oLP']->mode = 'embedframe';
1182 1182
         } elseif ($mode == 'impress') {
1183 1183
             $_SESSION['oLP']->mode = 'impress';
1184 1184
         }
@@ -1219,10 +1219,10 @@  discard block
 block discarded – undo
1219 1219
 		require 'lp_list.php';
1220 1220
 		break;
1221 1221
      */
1222
-	case 'switch_attempt_mode':
1223
-		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1224
-		$_SESSION['refresh'] = 1;
1225
-		$_SESSION['oLP']->switch_attempt_mode();
1222
+    case 'switch_attempt_mode':
1223
+        if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1224
+        $_SESSION['refresh'] = 1;
1225
+        $_SESSION['oLP']->switch_attempt_mode();
1226 1226
         require 'lp_list.php';
1227 1227
         break;
1228 1228
     case 'switch_scorm_debug':
Please login to merge, or discard this patch.
main/lp/lp_edit.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -178,8 +178,8 @@
 block discarded – undo
178 178
 );
179 179
 $display_date = 'none';
180 180
 if (!empty($expired_on)) {
181
-	$display_date = 'block';
182
-	$defaults['activate_end_date_check'] = 1;
181
+    $display_date = 'block';
182
+    $defaults['activate_end_date_check'] = 1;
183 183
 }
184 184
 
185 185
 $form->addElement('html', '<div id="end_date_div" style="display:'.$display_date.';">');
Please login to merge, or discard this patch.
main/admin/configure_extensions.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -17,56 +17,56 @@  discard block
 block discarded – undo
17 17
 $message = '';
18 18
 
19 19
 if (isset($_POST['activeExtension'])) {
20
-	switch ($_POST['extension_code']) {
21
-		case 'ppt2lp':
22
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
20
+    switch ($_POST['extension_code']) {
21
+        case 'ppt2lp':
22
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
23 23
 					selected_value="true"
24 24
 					WHERE variable="service_ppt2lp"
25 25
 					AND subkey="active"';
26 26
 
27
-			$rs = Database::query($sql);
27
+            $rs = Database::query($sql);
28 28
 
29
-			if (Database::affected_rows($rs)>0){
30
-				$message = get_lang('ServiceActivated');
31
-			}
29
+            if (Database::affected_rows($rs)>0){
30
+                $message = get_lang('ServiceActivated');
31
+            }
32 32
 
33
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
33
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
34 34
 					selected_value="'.addslashes($_POST['host']).'"
35 35
 					WHERE variable="service_ppt2lp"
36 36
 					AND subkey="host"';
37
-			Database::query($sql);
37
+            Database::query($sql);
38 38
 
39
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
39
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
40 40
 					selected_value="'.addslashes($_POST['port']).'"
41 41
 					WHERE variable="service_ppt2lp"
42 42
 					AND subkey="port"';
43
-			Database::query($sql);
43
+            Database::query($sql);
44 44
 
45
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
45
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
46 46
 					selected_value="'.addslashes($_POST['ftp_password']).'"
47 47
 					WHERE variable="service_ppt2lp"
48 48
 					AND subkey="ftp_password"';
49
-			Database::query($sql);
49
+            Database::query($sql);
50 50
 
51
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
51
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
52 52
 					selected_value="'.addslashes($_POST['user']).'"
53 53
 					WHERE variable="service_ppt2lp"
54 54
 					AND subkey="user"';
55
-			Database::query($sql);
55
+            Database::query($sql);
56 56
 
57
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
57
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
58 58
 					selected_value="'.addslashes($_POST['path_to_lzx']).'"
59 59
 					WHERE variable="service_ppt2lp"
60 60
 					AND subkey="path_to_lzx"';
61
-			Database::query($sql);
61
+            Database::query($sql);
62 62
 
63
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
63
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
64 64
 					selected_value="'.addslashes($_POST['size']).'"
65 65
 					WHERE variable="service_ppt2lp"
66 66
 					AND subkey="size"';
67
-			Database::query($sql);
68
-			break;
69
-	}
67
+            Database::query($sql);
68
+            break;
69
+    }
70 70
 }
71 71
 
72 72
 $listActiveServices = array();
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 
78 78
 $rs = Database::query($sql);
79 79
 while($row = Database::fetch_array($rs)){
80
-	$listActiveServices[] = $row['variable'];
80
+    $listActiveServices[] = $row['variable'];
81 81
 }
82 82
 
83 83
 // javascript to handle accordion behaviour
84 84
 $javascript_message = '';
85 85
 if(!empty($message)){
86
-	$javascript_message = '
86
+    $javascript_message = '
87 87
 	document.getElementById("message").style.display = "block";
88 88
 	var timer = setTimeout(hideMessage, 5000);';
89 89
 }
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 ?>
136 136
 <div id="message" style="display: none">
137 137
 	<?php
138
-	if(!empty($message))
139
-		Display::display_normal_message($message)
140
-	?>
138
+    if(!empty($message))
139
+        Display::display_normal_message($message)
140
+    ?>
141 141
 </div>
142 142
 
143 143
 <div id="content" align="center">
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         </div>
201 201
     </div>
202 202
 	<?php
203
-	/*
203
+    /*
204 204
 	<!-- EPHORUS -->
205 205
 	<div id="main_ephorus">
206 206
 		<div id="extension_header_ephorus" class="accordion_header">
Please login to merge, or discard this patch.
plugin/bbb/lib/bbb_api.php 1 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->__toString(),
171
-					'message' => $xml->message->__toString(),
172
-					'messageKey' => $xml->messageKey->__toString(),
173
-					'meetingId' => $xml->meetingID->__toString(),
174
-					'attendeePw' => $xml->attendeePW->__toString(),
175
-					'moderatorPw' => $xml->moderatorPW->__toString(),
176
-					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
177
-					'createTime' => $xml->createTime->__toString()
178
-					);
179
-			else
180
-				return array(
181
-					'returncode' => $xml->returncode->__toString(),
182
-					'message' => $xml->message->__toString(),
183
-					'messageKey' => $xml->messageKey->__toString()
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->__toString(),
171
+                    'message' => $xml->message->__toString(),
172
+                    'messageKey' => $xml->messageKey->__toString(),
173
+                    'meetingId' => $xml->meetingID->__toString(),
174
+                    'attendeePw' => $xml->attendeePW->__toString(),
175
+                    'moderatorPw' => $xml->moderatorPW->__toString(),
176
+                    'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
177
+                    'createTime' => $xml->createTime->__toString()
178
+                    );
179
+            else
180
+                return array(
181
+                    'returncode' => $xml->returncode->__toString(),
182
+                    'message' => $xml->message->__toString(),
183
+                    'messageKey' => $xml->messageKey->__toString()
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->__toString(),
253
-				'message' => $xml->message->__toString(),
254
-				'messageKey' => $xml->messageKey->__toString()
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->__toString(),
253
+                'message' => $xml->message->__toString(),
254
+                'messageKey' => $xml->messageKey->__toString()
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->__toString(),
289
-				'running' => $xml->running->__toString() 	// -- 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->__toString(),
289
+                'running' => $xml->running->__toString() 	// -- 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->__toString()
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->__toString(),
325
-					'messageKey' => $xml->messageKey->__toString(),
326
-					'message' => $xml->message->__toString()
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->__toString(),
334
-					'messageKey' => $xml->messageKey->__toString(),
335
-					'message' => $xml->message->__toString()
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->__toString(),
341
-						'meetingName' => $m->meetingName->__toString(),
342
-						'createTime' => $m->createTime->__toString(),
343
-						'attendeePw' => $m->attendeePW->__toString(),
344
-						'moderatorPw' => $m->moderatorPW->__toString(),
345
-						'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(),
346
-						'running' => $m->running->__toString()
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->__toString()
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->__toString(),
325
+                    'messageKey' => $xml->messageKey->__toString(),
326
+                    'message' => $xml->message->__toString()
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->__toString(),
334
+                    'messageKey' => $xml->messageKey->__toString(),
335
+                    'message' => $xml->message->__toString()
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->__toString(),
341
+                        'meetingName' => $m->meetingName->__toString(),
342
+                        'createTime' => $m->createTime->__toString(),
343
+                        'attendeePw' => $m->attendeePW->__toString(),
344
+                        'moderatorPw' => $m->moderatorPW->__toString(),
345
+                        'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(),
346
+                        'running' => $m->running->__toString()
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->__toString(),
387
-					'messageKey' => $xml->messageKey->__toString(),
388
-					'message' => $xml->message->__toString()
389
-				);
390
-				return $result;
391
-			}
392
-			else {
393
-				// In this case, we have success and meeting info:
394
-				$result = array(
395
-					'returncode' => $xml->returncode->__toString(),
396
-					'meetingName' => $xml->meetingName->__toString(),
397
-					'meetingId' => $xml->meetingID->__toString(),
398
-					'createTime' => $xml->createTime->__toString(),
399
-					'voiceBridge' => $xml->voiceBridge->__toString(),
400
-					'attendeePw' => $xml->attendeePW->__toString(),
401
-					'moderatorPw' => $xml->moderatorPW->__toString(),
402
-					'running' => $xml->running->__toString(),
403
-					'recording' => $xml->recording->__toString(),
404
-					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
405
-					'startTime' => $xml->startTime->__toString(),
406
-					'endTime' => $xml->endTime->__toString(),
407
-					'participantCount' => $xml->participantCount->__toString(),
408
-					'maxUsers' => $xml->maxUsers->__toString(),
409
-					'moderatorCount' => $xml->moderatorCount->__toString(),
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->__toString(),
415
-						'fullName' => $a->fullName->__toString(),
416
-						'role' => $a->role->__toString()
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->__toString(),
387
+                    'messageKey' => $xml->messageKey->__toString(),
388
+                    'message' => $xml->message->__toString()
389
+                );
390
+                return $result;
391
+            }
392
+            else {
393
+                // In this case, we have success and meeting info:
394
+                $result = array(
395
+                    'returncode' => $xml->returncode->__toString(),
396
+                    'meetingName' => $xml->meetingName->__toString(),
397
+                    'meetingId' => $xml->meetingID->__toString(),
398
+                    'createTime' => $xml->createTime->__toString(),
399
+                    'voiceBridge' => $xml->voiceBridge->__toString(),
400
+                    'attendeePw' => $xml->attendeePW->__toString(),
401
+                    'moderatorPw' => $xml->moderatorPW->__toString(),
402
+                    'running' => $xml->running->__toString(),
403
+                    'recording' => $xml->recording->__toString(),
404
+                    'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
405
+                    'startTime' => $xml->startTime->__toString(),
406
+                    'endTime' => $xml->endTime->__toString(),
407
+                    'participantCount' => $xml->participantCount->__toString(),
408
+                    'maxUsers' => $xml->maxUsers->__toString(),
409
+                    'moderatorCount' => $xml->moderatorCount->__toString(),
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->__toString(),
415
+                        'fullName' => $a->fullName->__toString(),
416
+                        'role' => $a->role->__toString()
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->__toString(),
462
-					'messageKey' => $xml->messageKey->__toString(),
463
-					'message' => $xml->message->__toString()
464
-				);
465
-				return $result;
466
-			}
467
-			else {
468
-				// In this case, we have success and recording info:
469
-				$result = array(
470
-					'returncode' => $xml->returncode->__toString(),
471
-					'messageKey' => $xml->messageKey->__toString(),
472
-					'message' => $xml->message->__toString()
473
-				);
474
-
475
-				foreach ($xml->recordings->recording as $r) {
476
-					$result[] = array(
477
-						'recordId' => $r->recordID->__toString(),
478
-						'meetingId' => $r->meetingID->__toString(),
479
-						'name' => $r->name->__toString(),
480
-						'published' => $r->published->__toString(),
481
-						'startTime' => $r->startTime->__toString(),
482
-						'endTime' => $r->endTime->__toString(),
483
-						'playbackFormatType' => $r->playback->format->type->__toString(),
484
-						'playbackFormatUrl' => $r->playback->format->url->__toString(),
485
-						'playbackFormatLength' => $r->playback->format->length->__toString(),
486
-						'metadataTitle' => $r->metadata->title->__toString(),
487
-						'metadataSubject' => $r->metadata->subject->__toString(),
488
-						'metadataDescription' => $r->metadata->description->__toString(),
489
-						'metadataCreator' => $r->metadata->creator->__toString(),
490
-						'metadataContributor' => $r->metadata->contributor->__toString(),
491
-						'metadataLanguage' => $r->metadata->language->__toString(),
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->__toString(),
462
+                    'messageKey' => $xml->messageKey->__toString(),
463
+                    'message' => $xml->message->__toString()
464
+                );
465
+                return $result;
466
+            }
467
+            else {
468
+                // In this case, we have success and recording info:
469
+                $result = array(
470
+                    'returncode' => $xml->returncode->__toString(),
471
+                    'messageKey' => $xml->messageKey->__toString(),
472
+                    'message' => $xml->message->__toString()
473
+                );
474
+
475
+                foreach ($xml->recordings->recording as $r) {
476
+                    $result[] = array(
477
+                        'recordId' => $r->recordID->__toString(),
478
+                        'meetingId' => $r->meetingID->__toString(),
479
+                        'name' => $r->name->__toString(),
480
+                        'published' => $r->published->__toString(),
481
+                        'startTime' => $r->startTime->__toString(),
482
+                        'endTime' => $r->endTime->__toString(),
483
+                        'playbackFormatType' => $r->playback->format->type->__toString(),
484
+                        'playbackFormatUrl' => $r->playback->format->url->__toString(),
485
+                        'playbackFormatLength' => $r->playback->format->length->__toString(),
486
+                        'metadataTitle' => $r->metadata->title->__toString(),
487
+                        'metadataSubject' => $r->metadata->subject->__toString(),
488
+                        'metadataDescription' => $r->metadata->description->__toString(),
489
+                        'metadataCreator' => $r->metadata->creator->__toString(),
490
+                        'metadataContributor' => $r->metadata->contributor->__toString(),
491
+                        'metadataLanguage' => $r->metadata->language->__toString(),
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->__toString(),
530
-				'published' => $xml->published->__toString() 	// -- 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->__toString(),
530
+                'published' => $xml->published->__toString() 	// -- 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->__toString(),
563
-				'deleted' => $xml->deleted->__toString() 	// -- 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->__toString(),
563
+                'deleted' => $xml->deleted->__toString() 	// -- 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.
src/Chamilo/ContactBundle/Entity/Category.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@
 block discarded – undo
43 43
         return $this->proxyCurrentLocaleTranslation($method, $arguments);
44 44
     }
45 45
 
46
-     /**
47
-     * @return string
48
-     */
46
+        /**
47
+         * @return string
48
+         */
49 49
     public function __toString()
50 50
     {
51 51
         return (string) $this->getName();
Please login to merge, or discard this patch.
main/inc/lib/certificate.lib.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
     }
254 254
 
255 255
     /**
256
-    * update user info about certificate
257
-    * @param int $cat_id category id
258
-    * @param int $user_id user id
259
-    * @param string $path_certificate the path name of the certificate
260
-    * @return void
261
-    */
256
+     * update user info about certificate
257
+     * @param int $cat_id category id
258
+     * @param int $user_id user id
259
+     * @param string $path_certificate the path name of the certificate
260
+     * @return void
261
+     */
262 262
     public function update_user_info_about_certificate(
263 263
         $cat_id,
264 264
         $user_id,
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
     }
419 419
 
420 420
     /**
421
-    * Shows the student's certificate (HTML file)
422
-    */
421
+     * Shows the student's certificate (HTML file)
422
+     */
423 423
     public function show()
424 424
     {
425 425
         header('Content-Type: text/html; charset='. api_get_system_encoding());
Please login to merge, or discard this patch.