@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | //the plugin title |
13 | -$plugin_info['title'] = 'Add a button to login using CAS'; |
|
13 | +$plugin_info['title'] = 'Add a button to login using CAS'; |
|
14 | 14 | |
15 | 15 | //the comments that go with the plugin |
16 | 16 | $plugin_info['comment'] = "If CAS is activated, this plugin add a text and a button on the login page to login with CAS. Configure plugin to add title, comment and logo."; |
@@ -38,4 +38,4 @@ discard block |
||
38 | 38 | $plugin_info['settings_form'] = $form; |
39 | 39 | |
40 | 40 | //set the templates that are going to be used |
41 | -$plugin_info['templates'] = array('template.tpl'); |
|
41 | +$plugin_info['templates'] = array('template.tpl'); |
@@ -6,4 +6,4 @@ |
||
6 | 6 | * @package chamilo.plugin.skype |
7 | 7 | */ |
8 | 8 | |
9 | -require_once api_get_path(SYS_PATH) . 'main/inc/global.inc.php'; |
|
9 | +require_once api_get_path(SYS_PATH).'main/inc/global.inc.php'; |
@@ -5,6 +5,6 @@ |
||
5 | 5 | * @author Imanol Losada Oriol <[email protected]> |
6 | 6 | * @package chamilo.plugin.skype |
7 | 7 | */ |
8 | -require_once __DIR__ . '/config.php'; |
|
8 | +require_once __DIR__.'/config.php'; |
|
9 | 9 | |
10 | 10 | Skype::create()->install(); |
@@ -19,6 +19,6 @@ |
||
19 | 19 | { |
20 | 20 | $this->_user = CONFIG_OPENMEETINGS_USER; |
21 | 21 | $this->_pass = CONFIG_OPENMEETINGS_PASS; |
22 | - $this->_serverBaseUrl = CONFIG_OPENMEETINGS_SERVER_URL; |
|
22 | + $this->_serverBaseUrl = CONFIG_OPENMEETINGS_SERVER_URL; |
|
23 | 23 | } |
24 | 24 | } |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | global $_configuration; |
50 | 50 | $this->name = 'C'.api_get_real_course_id().'-'.api_get_session_id(); |
51 | 51 | $accessUrl = api_get_access_url($_configuration['access_url']); |
52 | - $this->externalRoomType = substr($accessUrl['url'], strpos($accessUrl['url'],'://')+3,-1); |
|
52 | + $this->externalRoomType = substr($accessUrl['url'], strpos($accessUrl['url'], '://') + 3, -1); |
|
53 | 53 | if (strcmp($this->externalRoomType, 'localhost') == 0) { |
54 | - $this->externalRoomType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH),'://')+3, -1); |
|
54 | + $this->externalRoomType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://') + 3, -1); |
|
55 | 55 | } |
56 | 56 | $this->externalRoomType = 'chamilolms.'.$this->externalRoomType; |
57 | 57 | } |
@@ -110,6 +110,6 @@ discard block |
||
110 | 110 | if (!isset($this->$attribute)) { |
111 | 111 | return $voidReturn; |
112 | 112 | } |
113 | - return $this->$attribute?'true':'false'; |
|
113 | + return $this->$attribute ? 'true' : 'false'; |
|
114 | 114 | } |
115 | 115 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | $this->rest = new OpenMeetingsRestService(); |
48 | 48 | $err = $this->rest->getError(); |
49 | 49 | if ($err) { |
50 | - error_log('Constructor error: ' . $err); |
|
51 | - error_log('Debug: ' . $this->rest->getDebug());; |
|
50 | + error_log('Constructor error: '.$err); |
|
51 | + error_log('Debug: '.$this->rest->getDebug()); ; |
|
52 | 52 | exit(); |
53 | 53 | } |
54 | 54 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getRestUrl($name) |
61 | 61 | { |
62 | - return $this->getUrl() . "/services/" . $name . "/"; |
|
62 | + return $this->getUrl()."/services/".$name."/"; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -89,30 +89,30 @@ discard block |
||
89 | 89 | public function loginUser() |
90 | 90 | { |
91 | 91 | $returnValue = 0; |
92 | - $response = $this->rest->call($this->getRestUrl("UserService") . "getSession", "session_id"); |
|
92 | + $response = $this->rest->call($this->getRestUrl("UserService")."getSession", "session_id"); |
|
93 | 93 | |
94 | 94 | if ($this->rest->getError()) { |
95 | 95 | error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($response, 1)); |
96 | 96 | } else { |
97 | 97 | $err = $this->rest->getError(); |
98 | 98 | if ($err) { |
99 | - error_log('Error: ' . $err); |
|
99 | + error_log('Error: '.$err); |
|
100 | 100 | } else { |
101 | 101 | //error_log('getSession returned '.$response. ' - Storing as sessionId'); |
102 | 102 | $this->sessionId = $response; |
103 | 103 | |
104 | 104 | $url = $this->getRestUrl("UserService") |
105 | 105 | . "loginUser?" |
106 | - . "SID=" . $this->sessionId |
|
107 | - . "&username=" . $this->_user |
|
108 | - . "&userpass=" . $this->_pass; |
|
106 | + . "SID=".$this->sessionId |
|
107 | + . "&username=".$this->_user |
|
108 | + . "&userpass=".$this->_pass; |
|
109 | 109 | $result = $this->rest->call($url); |
110 | 110 | if ($this->rest->getError()) { |
111 | 111 | error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1)); |
112 | 112 | } else { |
113 | 113 | $err = $this->rest->getError(); |
114 | 114 | if ($err) { |
115 | - error_log('Error '. $err); |
|
115 | + error_log('Error '.$err); |
|
116 | 116 | } else { |
117 | 117 | $returnValue = $result; |
118 | 118 | } |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | { |
136 | 136 | $err = $this->rest->getError(); |
137 | 137 | if ($err) { |
138 | - error_log('Constructor error: ' . $err); |
|
139 | - error_log('Debug: ' . $this->rest->getDebug()); |
|
138 | + error_log('Constructor error: '.$err); |
|
139 | + error_log('Debug: '.$this->rest->getDebug()); |
|
140 | 140 | exit(); |
141 | 141 | } |
142 | 142 | |
@@ -146,17 +146,17 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | $url = $this->getRestUrl($this->getRestUrl("RoomService") |
149 | - . "updateRoomWithModeration?SID=" . $this->sessionId |
|
150 | - . "&room_id=" . $room->room_id |
|
151 | - . "&name=" . urlencode($room->name) |
|
152 | - . "&roomtypes_id=" . $room->roomtypes_id |
|
153 | - . "&comment=" . $room->comment |
|
154 | - . "&numberOfPartizipants=" . $room->numberOfPartizipants |
|
149 | + . "updateRoomWithModeration?SID=".$this->sessionId |
|
150 | + . "&room_id=".$room->room_id |
|
151 | + . "&name=".urlencode($room->name) |
|
152 | + . "&roomtypes_id=".$room->roomtypes_id |
|
153 | + . "&comment=".$room->comment |
|
154 | + . "&numberOfPartizipants=".$room->numberOfPartizipants |
|
155 | 155 | . "&ispublic=false" |
156 | 156 | . "&appointment=false" |
157 | 157 | . "&isDemoRoom=false" |
158 | 158 | . "&demoTime=0" |
159 | - . "&isModeratedRoom=" . $this->var_to_str($isModeratedRoom)); |
|
159 | + . "&isModeratedRoom=".$this->var_to_str($isModeratedRoom)); |
|
160 | 160 | //error_log($url); |
161 | 161 | $result = $this->rest->call($url); |
162 | 162 | |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | } else { |
166 | 166 | $err = $this->rest->getError(); |
167 | 167 | if ($err) { |
168 | - error_log('Error: ' . $err); |
|
168 | + error_log('Error: '.$err); |
|
169 | 169 | } else { |
170 | 170 | // echo '<h2>Result</h2><pre>'; print_r($result["return"]); echo '</pre>'; |
171 | 171 | //error_log('Room updated successfully '.print_r($result,1)); |
172 | 172 | return $result; |
173 | 173 | } |
174 | 174 | } |
175 | - return - 1; |
|
175 | + return -1; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | { |
189 | 189 | $result = $this->rest->call($this->getRestUrl("UserService") |
190 | 190 | . 'setUserObjectAndGenerateRecordingHashByURL?' |
191 | - . 'SID=' . $this->sessionId |
|
192 | - . '&username=' . urlencode($username) |
|
193 | - . '&firstname=' . urlencode($firstname) |
|
194 | - . '&lastname=' . urlencode($lastname) |
|
195 | - . '&externalUserId=' . $userId |
|
196 | - . '&externalUserType=' . urlencode($systemType) |
|
197 | - . '&recording_id=' . $recording_id, 'return'); |
|
191 | + . 'SID='.$this->sessionId |
|
192 | + . '&username='.urlencode($username) |
|
193 | + . '&firstname='.urlencode($firstname) |
|
194 | + . '&lastname='.urlencode($lastname) |
|
195 | + . '&externalUserId='.$userId |
|
196 | + . '&externalUserType='.urlencode($systemType) |
|
197 | + . '&recording_id='.$recording_id, 'return'); |
|
198 | 198 | |
199 | 199 | if ($result->fault) { |
200 | 200 | error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1)); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | return $result; |
207 | 207 | } |
208 | 208 | } |
209 | - return - 1; |
|
209 | + return -1; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -226,28 +226,28 @@ discard block |
||
226 | 226 | { |
227 | 227 | $err = $this->rest->getError(); |
228 | 228 | if ($err) { |
229 | - error_log('Constructor error: ' . $err); |
|
230 | - error_log('Debug: ' . $this->rest->getDebug());; |
|
229 | + error_log('Constructor error: '.$err); |
|
230 | + error_log('Debug: '.$this->rest->getDebug()); ; |
|
231 | 231 | exit(); |
232 | 232 | } |
233 | 233 | |
234 | 234 | $result = $this->rest->call($this->getRestUrl("UserService") |
235 | 235 | . "setUserObjectAndGenerateRoomHashByURLAndRecFlag?" |
236 | - . "SID=" . $this->sessionId |
|
237 | - . "&username=" . urlencode($username) |
|
238 | - . "&firstname=" . urlencode($firstname) |
|
239 | - . "&lastname=" . urlencode($lastname) |
|
240 | - . "&profilePictureUrl=" . urlencode($profilePictureUrl) |
|
241 | - . "&email=" . urlencode($email) |
|
242 | - . "&externalUserId=" . urlencode($userId) |
|
243 | - . "&externalUserType=" . urlencode($systemType) |
|
244 | - . "&room_id=" . urlencode($room_id) |
|
245 | - . "&becomeModeratorAsInt=" . $becomeModerator |
|
236 | + . "SID=".$this->sessionId |
|
237 | + . "&username=".urlencode($username) |
|
238 | + . "&firstname=".urlencode($firstname) |
|
239 | + . "&lastname=".urlencode($lastname) |
|
240 | + . "&profilePictureUrl=".urlencode($profilePictureUrl) |
|
241 | + . "&email=".urlencode($email) |
|
242 | + . "&externalUserId=".urlencode($userId) |
|
243 | + . "&externalUserType=".urlencode($systemType) |
|
244 | + . "&room_id=".urlencode($room_id) |
|
245 | + . "&becomeModeratorAsInt=".$becomeModerator |
|
246 | 246 | . "&showAudioVideoTestAsInt=1" |
247 | - . "&allowRecording=" . $this->var_to_str($allowRecording)); |
|
247 | + . "&allowRecording=".$this->var_to_str($allowRecording)); |
|
248 | 248 | |
249 | 249 | if ($result->fault) { |
250 | - error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1)); |
|
250 | + error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1)); |
|
251 | 251 | } else { |
252 | 252 | $err = $this->rest->getError(); |
253 | 253 | if ($err) { |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | return $result; |
258 | 258 | } |
259 | 259 | } |
260 | - return - 1; |
|
260 | + return -1; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -268,15 +268,15 @@ discard block |
||
268 | 268 | { |
269 | 269 | $err = $this->rest->getError(); |
270 | 270 | if ($err) { |
271 | - error_log('Constructor error: ' . $err); |
|
272 | - error_log('Debug: ' . $this->rest->getDebug()); |
|
271 | + error_log('Constructor error: '.$err); |
|
272 | + error_log('Debug: '.$this->rest->getDebug()); |
|
273 | 273 | exit(); |
274 | 274 | } |
275 | 275 | $url = $this->getRestUrl("RoomService")."deleteRoom?SID=".$this->sessionId."&rooms_id=".$openmeetings->room_id; |
276 | 276 | $result = $this->rest->call($url); |
277 | 277 | |
278 | 278 | if ($result->fault) { |
279 | - error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1)); |
|
279 | + error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1)); |
|
280 | 280 | } else { |
281 | 281 | $err = $this->rest->getError(); |
282 | 282 | if ($err) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | return $result; |
288 | 288 | } |
289 | 289 | } |
290 | - return - 1; |
|
290 | + return -1; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -297,20 +297,20 @@ discard block |
||
297 | 297 | { |
298 | 298 | $result = $this->rest->call($this->getRestUrl("UserService") |
299 | 299 | . "setUserObjectAndGenerateRoomHash?" |
300 | - . "SID=" . $this->sessionId |
|
301 | - . "&username=" . urlencode($username) |
|
302 | - . "&firstname=" . urlencode($firstname) |
|
303 | - . "&lastname=" . urlencode($lastname) |
|
304 | - . "&profilePictureUrl=" . urlencode($profilePictureUrl) |
|
305 | - . "&email=" . urlencode($email) |
|
306 | - . "&externalUserId=" . urlencode($externalUserId) |
|
307 | - . "&externalUserType=" . urlencode($externalUserType) |
|
308 | - . "&room_id=" . $room_id |
|
309 | - . "&becomeModeratorAsInt=" . $becomeModeratorAsInt |
|
310 | - . "&showAudioVideoTestAsInt=" . $showAudioVideoTestAsInt); |
|
300 | + . "SID=".$this->sessionId |
|
301 | + . "&username=".urlencode($username) |
|
302 | + . "&firstname=".urlencode($firstname) |
|
303 | + . "&lastname=".urlencode($lastname) |
|
304 | + . "&profilePictureUrl=".urlencode($profilePictureUrl) |
|
305 | + . "&email=".urlencode($email) |
|
306 | + . "&externalUserId=".urlencode($externalUserId) |
|
307 | + . "&externalUserType=".urlencode($externalUserType) |
|
308 | + . "&room_id=".$room_id |
|
309 | + . "&becomeModeratorAsInt=".$becomeModeratorAsInt |
|
310 | + . "&showAudioVideoTestAsInt=".$showAudioVideoTestAsInt); |
|
311 | 311 | |
312 | 312 | if ($result->getError()) { |
313 | - error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1)); |
|
313 | + error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1)); |
|
314 | 314 | } else { |
315 | 315 | $err = $this->rest->getError(); |
316 | 316 | if ($err) { |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | return $result; |
321 | 321 | } |
322 | 322 | } |
323 | - return - 1; |
|
323 | + return -1; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -338,29 +338,29 @@ discard block |
||
338 | 338 | } |
339 | 339 | $url = $this->getRestUrl("RoomService") |
340 | 340 | . $service.'?' |
341 | - . 'SID=' . $room->SID |
|
342 | - . '&name=' . $room->name |
|
343 | - . '&roomtypes_id=' . $room->roomtypes_id |
|
344 | - . '&comment='. $room->comment |
|
345 | - . '&numberOfPartizipants=' . $room->numberOfPartizipants |
|
346 | - . '&ispublic=' . $this->var_to_str($room->ispublic) |
|
347 | - . '&appointment=' . $this->var_to_str($room->appointment) |
|
348 | - . '&isDemoRoom=' . $this->var_to_str($room->isDemoRoom) |
|
349 | - . '&demoTime=' . $room->demoTime |
|
350 | - . '&isModeratedRoom=' . $this->var_to_str($room->isModeratedRoom) |
|
351 | - . '&externalRoomType=' . $room->externalRoomType; |
|
341 | + . 'SID='.$room->SID |
|
342 | + . '&name='.$room->name |
|
343 | + . '&roomtypes_id='.$room->roomtypes_id |
|
344 | + . '&comment='.$room->comment |
|
345 | + . '&numberOfPartizipants='.$room->numberOfPartizipants |
|
346 | + . '&ispublic='.$this->var_to_str($room->ispublic) |
|
347 | + . '&appointment='.$this->var_to_str($room->appointment) |
|
348 | + . '&isDemoRoom='.$this->var_to_str($room->isDemoRoom) |
|
349 | + . '&demoTime='.$room->demoTime |
|
350 | + . '&isModeratedRoom='.$this->var_to_str($room->isModeratedRoom) |
|
351 | + . '&externalRoomType='.$room->externalRoomType; |
|
352 | 352 | if ($room->allowRecording) { |
353 | - $url .= '&allowUserQuestions=' . $this->var_to_str($room->allowUserQuestions) |
|
354 | - . '&isAudioOnly=' . $this->var_to_str($room->isAudioOnly) |
|
355 | - . '&waitForRecording=' . $this->var_to_str($room->waitForRecording) |
|
356 | - . '&allowRecording=' . $this->var_to_str($room->allowRecording); |
|
353 | + $url .= '&allowUserQuestions='.$this->var_to_str($room->allowUserQuestions) |
|
354 | + . '&isAudioOnly='.$this->var_to_str($room->isAudioOnly) |
|
355 | + . '&waitForRecording='.$this->var_to_str($room->waitForRecording) |
|
356 | + . '&allowRecording='.$this->var_to_str($room->allowRecording); |
|
357 | 357 | } elseif ($room->isAudioOnly) { |
358 | - $url .= '&isAudioOnly=' . $this->var_to_str($room->isAudioOnly); |
|
358 | + $url .= '&isAudioOnly='.$this->var_to_str($room->isAudioOnly); |
|
359 | 359 | } |
360 | 360 | $result = $this->rest->call($url); |
361 | 361 | |
362 | 362 | if ($this->rest->fault) { |
363 | - error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1)); |
|
363 | + error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1)); |
|
364 | 364 | } else { |
365 | 365 | $err = $this->rest->getError(); |
366 | 366 | if ($err) { |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | return false; |
386 | 386 | } |
387 | 387 | |
388 | - $url = $this->getRestUrl("RoomService") . "getRoomsWithCurrentUsersByListAndType?SID=" . $this->sessionId |
|
388 | + $url = $this->getRestUrl("RoomService")."getRoomsWithCurrentUsersByListAndType?SID=".$this->sessionId |
|
389 | 389 | . "&start=1&max=1000&orderby=name&asc=true&externalRoomType=chamilolms"; |
390 | 390 | //$url = $this->getRestUrl("RoomService") |
391 | 391 | // . "getRoomTypes?" |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | $rooms = array(); |
397 | 397 | foreach ($result as $room) { |
398 | 398 | //error_log(__FILE__.'+'.__LINE__.': one room found on remote: '.print_r($room,1)); |
399 | - if ($room['externalRoomType'] == $type && count($room['currentusers']) > 0 ) { |
|
399 | + if ($room['externalRoomType'] == $type && count($room['currentusers']) > 0) { |
|
400 | 400 | $rooms[] = $room; |
401 | 401 | } |
402 | 402 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | |
419 | 419 | $url = $this->getRestUrl("RoomService") |
420 | 420 | . "getRoomById?" |
421 | - . "SID=" . $this->sessionId |
|
421 | + . "SID=".$this->sessionId |
|
422 | 422 | . "&rooms_id=".$roomId; |
423 | 423 | //error_log(__FILE__.'+'.__LINE__.' Calling WS: '.$url); |
424 | 424 | $result = $this->rest->call($url, "return"); |
@@ -432,8 +432,8 @@ discard block |
||
432 | 432 | { |
433 | 433 | $url = $this->getRestUrl("RoomService") |
434 | 434 | . "getFlvRecordingByExternalRoomType?" |
435 | - . "SID=" . $this->sessionId |
|
436 | - . "&externalRoomType=" . urlencode($this->config["moduleKey"]); |
|
435 | + . "SID=".$this->sessionId |
|
436 | + . "&externalRoomType=".urlencode($this->config["moduleKey"]); |
|
437 | 437 | |
438 | 438 | $result = $this->rest->call($url, "return"); |
439 | 439 | |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | { |
450 | 450 | $url = $this->getRestUrl("RoomService") |
451 | 451 | . "getFlvRecordingByRoomId?" |
452 | - . "SID=" . $this->sessionId |
|
453 | - . "&roomId=" . urlencode($id); |
|
452 | + . "SID=".$this->sessionId |
|
453 | + . "&roomId=".urlencode($id); |
|
454 | 454 | |
455 | 455 | $result = $this->rest->call($url, "return"); |
456 | 456 | |
@@ -464,8 +464,8 @@ discard block |
||
464 | 464 | { |
465 | 465 | $url = $this->getRestUrl("RoomService") |
466 | 466 | . "getFlvRecordingByExternalUserId?" |
467 | - . "SID=" . $this->sessionId |
|
468 | - . "&externalUserId=" . $id; |
|
467 | + . "SID=".$this->sessionId |
|
468 | + . "&externalUserId=".$id; |
|
469 | 469 | |
470 | 470 | $result = $this->rest->call($url, "return"); |
471 | 471 |
@@ -40,31 +40,31 @@ discard block |
||
40 | 40 | // $request |
41 | 41 | |
42 | 42 | // Initialize the session by passing the request as a parameter |
43 | - $session = curl_init ( $request ); |
|
43 | + $session = curl_init($request); |
|
44 | 44 | |
45 | 45 | // Set curl options by passing session and flags |
46 | 46 | // CURLOPT_HEADER allows us to receive the HTTP header |
47 | - curl_setopt ( $session, CURLOPT_HEADER, true ); |
|
47 | + curl_setopt($session, CURLOPT_HEADER, true); |
|
48 | 48 | |
49 | 49 | // CURLOPT_RETURNTRANSFER will return the response |
50 | - curl_setopt ( $session, CURLOPT_RETURNTRANSFER, true ); |
|
50 | + curl_setopt($session, CURLOPT_RETURNTRANSFER, true); |
|
51 | 51 | |
52 | 52 | // Make the request |
53 | - $response = curl_exec ( $session ); |
|
53 | + $response = curl_exec($session); |
|
54 | 54 | |
55 | 55 | // Close the curl session |
56 | - curl_close ( $session ); |
|
56 | + curl_close($session); |
|
57 | 57 | |
58 | 58 | // Confirm that the request was transmitted to the OpenMeetings! Image Search Service |
59 | - if (! $response) { |
|
60 | - die ( "Request OpenMeetings! OpenMeetings Service failed and no response was returned in ".__CLASS__.'::'.__FUNCTION__.'()' ); |
|
59 | + if (!$response) { |
|
60 | + die ("Request OpenMeetings! OpenMeetings Service failed and no response was returned in ".__CLASS__.'::'.__FUNCTION__.'()'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Create an array to store the HTTP response codes |
64 | - $status_code = array (); |
|
64 | + $status_code = array(); |
|
65 | 65 | |
66 | 66 | // Use regular expressions to extract the code from the header |
67 | - preg_match ( '/\d\d\d/', $response, $status_code ); |
|
67 | + preg_match('/\d\d\d/', $response, $status_code); |
|
68 | 68 | $bt = debug_backtrace(); |
69 | 69 | $caller = array_shift($bt); |
70 | 70 | $extra = ' (from '.$caller['file'].' at line '.$caller['line'].') '; |
@@ -74,24 +74,24 @@ discard block |
||
74 | 74 | // Success |
75 | 75 | break; |
76 | 76 | case 503 : |
77 | - error_log( 'Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 503. |
|
77 | + error_log('Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 503. |
|
78 | 78 | That means: Service unavailable. An internal problem prevented us from returning data to you.' ); |
79 | 79 | return false; |
80 | 80 | break; |
81 | 81 | case 403 : |
82 | - error_log( 'Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 403. |
|
82 | + error_log('Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 403. |
|
83 | 83 | That means: Forbidden. You do not have permission to access this resource, or are over your rate limit.' ); |
84 | 84 | return false; |
85 | 85 | break; |
86 | 86 | case 400 : |
87 | 87 | // You may want to fall through here and read the specific XML error |
88 | - error_log( 'Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 400. |
|
88 | + error_log('Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 400. |
|
89 | 89 | That means: Bad request. The parameters passed to the service did not match as expected. |
90 | 90 | The exact error is returned in the XML response.' ); |
91 | 91 | return false; |
92 | 92 | break; |
93 | 93 | default : |
94 | - error_log( 'Your call to OpenMeetings Web Services '.$extra.' returned an unexpected HTTP status of: ' . $status_code [0] . " Request " . $request ); |
|
94 | + error_log('Your call to OpenMeetings Web Services '.$extra.' returned an unexpected HTTP status of: '.$status_code [0]." Request ".$request); |
|
95 | 95 | return false; |
96 | 96 | } |
97 | 97 |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | $om_user = $plugin->get('user'); |
50 | 50 | $om_pass = $plugin->get('pass'); |
51 | 51 | $accessUrl = api_get_access_url($_configuration['access_url']); |
52 | - $this->externalType = substr($accessUrl['url'], strpos($accessUrl['url'], '://')+3, -1); |
|
52 | + $this->externalType = substr($accessUrl['url'], strpos($accessUrl['url'], '://') + 3, -1); |
|
53 | 53 | if (strcmp($this->externalType, 'localhost') == 0) { |
54 | - $this->externalType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://')+3, -1); |
|
54 | + $this->externalType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://') + 3, -1); |
|
55 | 55 | } |
56 | 56 | $this->externalType = 'chamilolms.'.$this->externalType; |
57 | 57 | $this->table = \Database::get_main_table('plugin_openmeetings'); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | // This fills the following attributes: status, name, comment, chamiloCourseId, chamiloSessionId |
162 | 162 | $room = new Room(); |
163 | 163 | $room->loadRoomId($meetingData['room_id']); |
164 | - $roomArray = (array)$room; |
|
164 | + $roomArray = (array) $room; |
|
165 | 165 | $roomArray['SID'] = $this->sessionId; |
166 | 166 | $roomId = $this->gateway->updateRoomWithModeration($room); |
167 | 167 | if ($roomId != $meetingData['room_id']) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $room->SID = $this->sessionId; |
177 | 177 | $room->name = $this->roomName; |
178 | 178 | //$room->roomtypes_id = $room->roomtypes_id; |
179 | - $room->comment = urlencode(get_lang('Course').': ' . $params['meeting_name'] . ' - '.$_configuration['software_name']); |
|
179 | + $room->comment = urlencode(get_lang('Course').': '.$params['meeting_name'].' - '.$_configuration['software_name']); |
|
180 | 180 | //$room->numberOfPartizipants = $room->numberOfPartizipants; |
181 | 181 | $room->ispublic = $room->getString('isPublic', 'false'); |
182 | 182 | //$room->appointment = $room->getString('appointment'); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $params['room_id'] = $roomId; |
201 | 201 | $params['c_id'] = api_get_course_int_id(); |
202 | 202 | $params['session_id'] = api_get_session_id(); |
203 | - $params['record'] = ($room->allowRecording?1:0); |
|
203 | + $params['record'] = ($room->allowRecording ? 1 : 0); |
|
204 | 204 | |
205 | 205 | $id = \Database::insert($this->table, $params); |
206 | 206 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | $params = array('room_id' => $meetingData['room_id']); |
240 | 240 | $returnVal = $this->setUserObjectAndGenerateRoomHashByURLAndRecFlag($params); |
241 | - $iframe = $this->url . "/?" ."secureHash=" . $returnVal; |
|
241 | + $iframe = $this->url."/?"."secureHash=".$returnVal; |
|
242 | 242 | printf("<iframe src='%s' width='%s' height = '%s' />", $iframe, "100%", 640); |
243 | 243 | } |
244 | 244 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $userId = $_SESSION['_user']['user_id']; |
347 | 347 | $systemType = 'Chamilo'; |
348 | 348 | $room_id = $params['room_id']; |
349 | - $becomeModerator = ( $this->isTeacher() ? 1 : 0 ); |
|
349 | + $becomeModerator = ($this->isTeacher() ? 1 : 0); |
|
350 | 350 | $allowRecording = 1; //Provisional |
351 | 351 | |
352 | 352 | $urlWsdl = $this->url."/services/UserService?wsdl"; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | error_log(__FILE__.'+'.__LINE__.' Meetings found: '.print_r($meetingDb, 1)); |
421 | 421 | $remoteMeeting = array(); |
422 | 422 | $meetingDb['created_at'] = api_get_local_time($meetingDb['created_at']); |
423 | - $meetingDb['closed_at'] = (!empty($meetingDb['closed_at']) ? api_get_local_time($meetingDb['closed_at']):''); |
|
423 | + $meetingDb['closed_at'] = (!empty($meetingDb['closed_at']) ? api_get_local_time($meetingDb['closed_at']) : ''); |
|
424 | 424 | // Fixed value for now |
425 | 425 | $meetingDb['participantCount'] = 40; |
426 | 426 | $rec = $this->gateway->getFlvRecordingByRoomId($meetingDb['room_id']); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | \Display::url('[.avi]', $link2, array('target' => '_blank')); |
437 | 437 | |
438 | 438 | } |
439 | - $item['show_links'] = implode('<br />', $links); |
|
439 | + $item['show_links'] = implode('<br />', $links); |
|
440 | 440 | |
441 | 441 | // The following code is currently commented because the web service |
442 | 442 | // says this is not allowed by the SOAP user. |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $remoteMeeting = $current_room; |
487 | 487 | */ |
488 | 488 | |
489 | - if (empty( $remoteMeeting )) { |
|
489 | + if (empty($remoteMeeting)) { |
|
490 | 490 | /* |
491 | 491 | error_log(__FILE__.'+'.__LINE__.' Empty remote Meeting for now'); |
492 | 492 | if ($meetingDb['status'] == 1 && $this->isTeacher()) { |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @version 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( !class_exists('KannelException') ) { |
|
12 | +if (!class_exists('KannelException')) { |
|
13 | 13 | require_once('exception.php'); |
14 | 14 | } |
15 | 15 | |
@@ -24,25 +24,25 @@ discard block |
||
24 | 24 | /* |
25 | 25 | * Version of this class |
26 | 26 | */ |
27 | - const VERSION = '1.3.1'; |
|
27 | + const VERSION = '1.3.1'; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * All Kannel API calls start with BASE_URL |
31 | 31 | * @author Martin Steel |
32 | 32 | */ |
33 | - const API_BASE_URL = 'api.kannelsms.com/xml/'; |
|
33 | + const API_BASE_URL = 'api.kannelsms.com/xml/'; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * string to append to API_BASE_URL to check authentication |
37 | 37 | * @author Martin Steel |
38 | 38 | */ |
39 | - const API_AUTH_METHOD = 'authenticate'; |
|
39 | + const API_AUTH_METHOD = 'authenticate'; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * string to append to API_BASE_URL for sending SMS |
43 | 43 | * @author Martin Steel |
44 | 44 | */ |
45 | - const API_SMS_METHOD = 'sms'; |
|
45 | + const API_SMS_METHOD = 'sms'; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * string to append to API_BASE_URL for checking message credit |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | $err_no = null; |
259 | 259 | $err_desc = null; |
260 | 260 | |
261 | - foreach($resp_doc->documentElement->childNodes AS $doc_child) { |
|
262 | - switch(strtolower($doc_child->nodeName)) { |
|
261 | + foreach ($resp_doc->documentElement->childNodes AS $doc_child) { |
|
262 | + switch (strtolower($doc_child->nodeName)) { |
|
263 | 263 | case 'sms_resp': |
264 | 264 | $resp = array(); |
265 | 265 | $wrapper_id = null; |
266 | - foreach($doc_child->childNodes AS $resp_node) { |
|
267 | - switch(strtolower($resp_node->nodeName)) { |
|
266 | + foreach ($doc_child->childNodes AS $resp_node) { |
|
267 | + switch (strtolower($resp_node->nodeName)) { |
|
268 | 268 | case 'messageid': |
269 | 269 | $resp['id'] = $resp_node->nodeValue; |
270 | 270 | break; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | break; |
280 | 280 | } |
281 | 281 | } |
282 | - if( array_key_exists('error_code', $resp ) ) |
|
282 | + if (array_key_exists('error_code', $resp)) |
|
283 | 283 | { |
284 | 284 | $resp['success'] = 0; |
285 | 285 | } else { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | throw new KannelException($err_desc, $err_no); |
416 | 416 | } |
417 | 417 | |
418 | - return array( 'symbol' => $symbol, 'balance' => $balance, 'code' => $code ); |
|
418 | + return array('symbol' => $symbol, 'balance' => $balance, 'code' => $code); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
@@ -480,14 +480,14 @@ discard block |
||
480 | 480 | $this->logXML("API $method Request XML", $data); |
481 | 481 | } |
482 | 482 | |
483 | - if( isset( $this->ssl ) ) { |
|
483 | + if (isset($this->ssl)) { |
|
484 | 484 | $ssl = $this->ssl; |
485 | 485 | } else { |
486 | 486 | $ssl = $this->sslSupport(); |
487 | 487 | } |
488 | 488 | |
489 | 489 | $url = $ssl ? 'https://' : 'http://'; |
490 | - $url .= self::API_BASE_URL . $method; |
|
490 | + $url .= self::API_BASE_URL.$method; |
|
491 | 491 | |
492 | 492 | $response = $this->xmlPost($url, $data); |
493 | 493 | |
@@ -509,12 +509,12 @@ discard block |
||
509 | 509 | * @author Martin Steel |
510 | 510 | */ |
511 | 511 | protected function xmlPost($url, $data) { |
512 | - if(extension_loaded('curl')) { |
|
512 | + if (extension_loaded('curl')) { |
|
513 | 513 | $ch = curl_init($url); |
514 | 514 | curl_setopt($ch, CURLOPT_POST, 1); |
515 | 515 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
516 | 516 | curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); |
517 | - curl_setopt($ch, CURLOPT_USERAGENT, 'Kannel PHP Wrapper/1.0' . self::VERSION); |
|
517 | + curl_setopt($ch, CURLOPT_USERAGENT, 'Kannel PHP Wrapper/1.0'.self::VERSION); |
|
518 | 518 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
519 | 519 | if (isset($this->proxy_host) && isset($this->proxy_port)) { |
520 | 520 | curl_setopt($ch, CURLOPT_PROXY, $this->proxy_host); |
@@ -525,9 +525,9 @@ discard block |
||
525 | 525 | $info = curl_getinfo($ch); |
526 | 526 | |
527 | 527 | if ($response === false || $info['http_code'] != 200) { |
528 | - throw new \Exception('HTTP Error calling Kannel API - HTTP Status: ' . $info['http_code'] . ' - cURL Erorr: ' . curl_error($ch)); |
|
528 | + throw new \Exception('HTTP Error calling Kannel API - HTTP Status: '.$info['http_code'].' - cURL Erorr: '.curl_error($ch)); |
|
529 | 529 | } elseif (curl_errno($ch) > 0) { |
530 | - throw new \Exception('HTTP Error calling Kannel API - cURL Error: ' . curl_error($ch)); |
|
530 | + throw new \Exception('HTTP Error calling Kannel API - cURL Error: '.curl_error($ch)); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | curl_close($ch); |
@@ -536,31 +536,31 @@ discard block |
||
536 | 536 | } elseif (function_exists('stream_get_contents')) { |
537 | 537 | // Enable error Track Errors |
538 | 538 | $track = ini_get('track_errors'); |
539 | - ini_set('track_errors',true); |
|
539 | + ini_set('track_errors', true); |
|
540 | 540 | |
541 | 541 | $params = array('http' => array( |
542 | 542 | 'method' => 'POST', |
543 | - 'header' => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/" . self::VERSION . "\r\n", |
|
543 | + 'header' => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/".self::VERSION."\r\n", |
|
544 | 544 | 'content' => $data |
545 | 545 | )); |
546 | 546 | |
547 | 547 | if (isset($this->proxy_host) && isset($this->proxy_port)) { |
548 | - $params['http']['proxy'] = 'tcp://'.$this->proxy_host . ':' . $this->proxy_port; |
|
548 | + $params['http']['proxy'] = 'tcp://'.$this->proxy_host.':'.$this->proxy_port; |
|
549 | 549 | $params['http']['request_fulluri'] = True; |
550 | 550 | } |
551 | 551 | |
552 | 552 | $ctx = stream_context_create($params); |
553 | 553 | $fp = @fopen($url, 'rb', false, $ctx); |
554 | 554 | if (!$fp) { |
555 | - ini_set('track_errors',$track); |
|
555 | + ini_set('track_errors', $track); |
|
556 | 556 | throw new \Exception("HTTP Error calling Kannel API - fopen Error: $php_errormsg"); |
557 | 557 | } |
558 | 558 | $response = @stream_get_contents($fp); |
559 | 559 | if ($response === false) { |
560 | - ini_set('track_errors',$track); |
|
560 | + ini_set('track_errors', $track); |
|
561 | 561 | throw new \Exception("HTTP Error calling Kannel API - stream Error: $php_errormsg"); |
562 | 562 | } |
563 | - ini_set('track_errors',$track); |
|
563 | + ini_set('track_errors', $track); |
|
564 | 564 | return $response; |
565 | 565 | } else { |
566 | 566 | throw new \Exception("Kannel requires PHP5 with cURL or HTTP stream support"); |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | * @author Martin Steel |
625 | 625 | */ |
626 | 626 | protected function is_assoc($array) { |
627 | - return (bool)count(array_filter(array_keys($array), 'is_string')); |
|
627 | + return (bool) count(array_filter(array_keys($array), 'is_string')); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | /** |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | * @todo Take an optional country code and check that the number starts with it |
638 | 638 | */ |
639 | 639 | public static function is_valid_msisdn($val) { |
640 | - return preg_match( '/^[1-9][0-9]{7,12}$/', $val ); |
|
640 | + return preg_match('/^[1-9][0-9]{7,12}$/', $val); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | } |