Completed
Push — master ( 041992...a5f3d4 )
by Jesus
02:43
created
bbb_broker.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 
25 25
 defined('MOODLE_INTERNAL') || die();
26 26
 
27
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
28
-require_once(dirname(__FILE__).'/locallib.php');
27
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
28
+require_once(dirname(__FILE__) . '/locallib.php');
29 29
 
30 30
 use \Firebase\JWT\JWT;
31 31
 
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
                     break;
119 119
             }
120 120
         } catch (Exception $e) {
121
-            header('HTTP/1.0 500 Internal Server Error. '.$e->getMessage());
121
+            header('HTTP/1.0 500 Internal Server Error. ' . $e->getMessage());
122 122
             return;
123 123
         }
124 124
     }
125 125
 } else {
126
-    header('HTTP/1.0 400 Bad Request. '.$error);
126
+    header('HTTP/1.0 400 Bad Request. ' . $error);
127 127
 }
128 128
 
129 129
 function bigbluebuttonbn_broker_meeting_info($bbbsession, $params) {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
         if ($bbbsession['administrator'] || $bbbsession['moderator']) {
146 146
             $endbuttontext = get_string('view_conference_action_end', 'bigbluebuttonbn');
147
-            $statuscanend = '"can_end": true, "endbuttontext": "'.$endbuttontext.'"';
147
+            $statuscanend = '"can_end": true, "endbuttontext": "' . $endbuttontext . '"';
148 148
         }
149 149
     } else {
150 150
         // If user is administrator, moderator or if is viewer and no waiting is required.
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) {
155 155
             $initialmessage = get_string('view_message_conference_not_started', 'bigbluebuttonbn');
156 156
             if ($bbbsession['wait']) {
157
-                $initialmessage .= ' '.get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn');
157
+                $initialmessage .= ' ' . get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn');
158 158
             }
159 159
             $canjoin = false;
160 160
         }
@@ -163,17 +163,17 @@  discard block
 block discarded – undo
163 163
         if ($bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator'])) {
164 164
             $cantag = true;
165 165
         }
166
-        $statuscanend = '"can_tag": '.($cantag ? 'true' : 'false');
166
+        $statuscanend = '"can_tag": ' . ($cantag ? 'true' : 'false');
167 167
     }
168
-    $statuscanjoin = '"can_join": '.($canjoin ? 'true' : 'false');
169
-    echo $params['callback'].'({"running": '.($meetingrunning ? 'true' : 'false').
170
-                              ',"info": '.json_encode($meetinginfo).
171
-                              ',"status": {'.'"join_url": "'.$bbbsession['joinURL'].'", '.
172
-                                             '"joinbuttontext": "'.$joinbuttontext.'", '.
173
-                                             '"message": "'.$initialmessage.'", '.
174
-                                             $statuscanjoin.', '.
175
-                                             $statuscanend.', '.
176
-                                             $statuscantag.', '.
168
+    $statuscanjoin = '"can_join": ' . ($canjoin ? 'true' : 'false');
169
+    echo $params['callback'] . '({"running": ' . ($meetingrunning ? 'true' : 'false') .
170
+                              ',"info": ' . json_encode($meetinginfo) .
171
+                              ',"status": {' . '"join_url": "' . $bbbsession['joinURL'] . '", ' .
172
+                                             '"joinbuttontext": "' . $joinbuttontext . '", ' .
173
+                                             '"message": "' . $initialmessage . '", ' .
174
+                                             $statuscanjoin . ', ' .
175
+                                             $statuscanend . ', ' .
176
+                                             $statuscantag . ', ' .
177 177
                                           '}});';
178 178
 }
179 179
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     // Update the cache.
194 194
     bigbluebuttonbn_get_meetinginfo($params['id'], BIGBLUEBUTTONBN_FORCED);
195 195
 
196
-    echo $params['callback'].'({ "status": true });';
196
+    echo $params['callback'] . '({ "status": true });';
197 197
 }
198 198
 
199 199
 function bigbluebuttonbn_broker_recording_links($bbbsession, $params) {
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
         return;
204 204
     }
205 205
 
206
-    $out = $params['callback'].'({"status": "false"});';
206
+    $out = $params['callback'] . '({"status": "false"});';
207 207
     if (isset($params['id']) && $params['id'] != '') {
208 208
         $importedall = bigbluebuttonbn_get_recording_imported_instances($params['id']);
209
-        $out = $params['callback'].'({ "status": "true", "links": '.count($importedall).'});';
209
+        $out = $params['callback'] . '({ "status": "true", "links": ' . count($importedall) . '});';
210 210
     }
211 211
     echo $out;
212 212
 }
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
     if (isset($recordings[$params['id']])) {
229 229
         // Look up for an update on the imported recording.
230 230
         $recording = $recordings[$params['id']];
231
-        $out = $params['callback'].'({ "status": "false" });';
231
+        $out = $params['callback'] . '({ "status": "false" });';
232 232
         if (isset($recording) && !empty($recording) && !array_key_exists('messageKey', $recording)) {
233 233
             // The recording was found.
234
-            $out = $params['callback'].'({ "status": "true", "published": "'.$recording['published'].'"});';
234
+            $out = $params['callback'] . '({ "status": "true", "published": "' . $recording['published'] . '"});';
235 235
         }
236 236
         echo $out;
237 237
         return;
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 
240 240
     // As the recordingid was not identified as imported recording link, look up for a real recording.
241 241
     $recording = bigbluebuttonbn_get_recordings_array($params['idx'], $params['id']);
242
-    $out = $params['callback'].'({"status": "false"});';
242
+    $out = $params['callback'] . '({"status": "false"});';
243 243
     if (isset($recording) && !empty($recording) && array_key_exists($params['id'], $recording)) {
244 244
         // The recording was found.
245
-        $out = $params['callback'].'({ "status": "true", "published": "'.$recording[$params['id']]['published'].'"});';
245
+        $out = $params['callback'] . '({ "status": "true", "published": "' . $recording[$params['id']]['published'] . '"});';
246 246
     }
247 247
     echo $out;
248 248
 }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             $eventlog = BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED;
274 274
             break;
275 275
         case 'recording_unpublish':
276
-            $callbackresponse = bigbluebuttonbn_broker_recording_action_unpublish($bbbsession, $params, $recordings);;
276
+            $callbackresponse = bigbluebuttonbn_broker_recording_action_unpublish($bbbsession, $params, $recordings); ;
277 277
             $eventlog = BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED;
278 278
             break;
279 279
         case 'recording_delete':
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
         $decodedparameters = JWT::decode($params['signed_parameters'], bigbluebuttonbn_get_cfg_shared_secret(),
377 377
             array('HS256'));
378 378
     } catch (Exception $e) {
379
-        $error = 'Caught exception: '.$e->getMessage();
380
-        header('HTTP/1.0 400 Bad Request. '.$error);
379
+        $error = 'Caught exception: ' . $e->getMessage();
380
+        header('HTTP/1.0 400 Bad Request. ' . $error);
381 381
         return;
382 382
     }
383 383
 
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
     $meetingidelements = explode('-', $meetingidelements[0]);
387 387
 
388 388
     if (!isset($bigbluebuttonbn) || $bigbluebuttonbn->meetingid != $meetingidelements[0]) {
389
-        $error = 'Caught exception: '.$e->getMessage();
390
-        header('HTTP/1.0 410 Gone. '.$error);
389
+        $error = 'Caught exception: ' . $e->getMessage();
390
+        header('HTTP/1.0 410 Gone. ' . $error);
391 391
         return;
392 392
     }
393 393
 
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
         bigbluebuttonbn_send_notification_recording_ready($bigbluebuttonbn);
397 397
         header('HTTP/1.0 202 Accepted');
398 398
     } catch (Exception $e) {
399
-        $error = 'Caught exception: '.$e->getMessage();
400
-        header('HTTP/1.0 503 Service Unavailable. '.$error);
399
+        $error = 'Caught exception: ' . $e->getMessage();
400
+        header('HTTP/1.0 503 Service Unavailable. ' . $error);
401 401
     }
402 402
 }
403 403
 
@@ -412,13 +412,13 @@  discard block
 block discarded – undo
412 412
     $importrecordings = $SESSION->bigbluebuttonbn_importrecordings;
413 413
     if (!isset($importrecordings[$params['id']])) {
414 414
         $error = "Recording {$params['id']} could not be found. It can not be imported";
415
-        header('HTTP/1.0 404 Not found. '.$error);
415
+        header('HTTP/1.0 404 Not found. ' . $error);
416 416
         return;
417 417
     }
418 418
 
419 419
     $importrecordings[$params['id']]['imported'] = true;
420 420
     $overrides['meetingid'] = $importrecordings[$params['id']]['meetingID'];
421
-    $meta = '{"recording":'.json_encode($importrecordings[$params['id']]).'}';
421
+    $meta = '{"recording":' . json_encode($importrecordings[$params['id']]) . '}';
422 422
     bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, $overrides, $meta);
423 423
     // Moodle event logger: Create an event for recording imported.
424 424
     if (isset($bigbluebuttonbn)) {
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
         $decodedparameters = JWT::decode($params['signed_parameters'], bigbluebuttonbn_get_cfg_shared_secret(),
437 437
             array('HS256'));
438 438
     } catch (Exception $e) {
439
-        $error = 'Caught exception: '.$e->getMessage();
440
-        header('HTTP/1.0 400 Bad Request. '.$error);
439
+        $error = 'Caught exception: ' . $e->getMessage();
440
+        header('HTTP/1.0 400 Bad Request. ' . $error);
441 441
         return;
442 442
     }
443 443
 
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
     $meetingidelements = explode('-', $meetingidelements[0]);
447 447
 
448 448
     if (!isset($bigbluebuttonbn) || $bigbluebuttonbn->meetingid != $meetingidelements[0]) {
449
-        $error = 'Caught exception: '.$e->getMessage();
450
-        header('HTTP/1.0 410 Gone. '.$error);
449
+        $error = 'Caught exception: ' . $e->getMessage();
450
+        header('HTTP/1.0 410 Gone. ' . $error);
451 451
         return;
452 452
     }
453 453
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_activity_viewed.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
      * @return string
53 53
      */
54 54
     public function get_description() {
55
-        $a = (object) array('userid' => $this->userid,
55
+        $a = (object)array('userid' => $this->userid,
56 56
                             'bigbluebuttonbnid' => $this->objectid,
57 57
                             'courseid' => $this->contextinstanceid);
58 58
 
59
-        return "The user with id '$a->userid' viewed the bigbluebuttonbn activity ".
59
+        return "The user with id '$a->userid' viewed the bigbluebuttonbn activity " .
60 60
         "with id '$a->bigbluebuttonbnid' for the course id '$a->courseid'.";
61 61
     }
62 62
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function get_legacy_logdata() {
69 69
         return array($this->courseid, 'bigbluebuttonbn', 'activity viewed',
70
-                'view.php?pageid='.$this->objectid, 'BigBlueButtonBN activity viewed',
70
+                'view.php?pageid=' . $this->objectid, 'BigBlueButtonBN activity viewed',
71 71
                 $this->contextinstanceid);
72 72
     }
73 73
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_imported.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function get_description() {
55 55
         $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
56
-        $a = (object) array('userid' => $this->userid,
56
+        $a = (object)array('userid' => $this->userid,
57 57
                             'recordingid' => $rid,
58 58
                             'courseid' => $this->contextinstanceid);
59 59
 
60
-        return "The user with id '$a->userid' has imported a recording with id ".
60
+        return "The user with id '$a->userid' has imported a recording with id " .
61 61
         "'$a->recordingid' into the course id '$a->courseid'.";
62 62
     }
63 63
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected function get_legacy_logdata() {
70 70
         return array($this->courseid, 'bigbluebuttonbn', 'recording imported',
71
-                'view.php?pageid='.$this->objectid, 'Recording imported',
71
+                'view.php?pageid=' . $this->objectid, 'Recording imported',
72 72
                 $this->contextinstanceid);
73 73
     }
74 74
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_published.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function get_description() {
55 55
         $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
56
-        $a = (object) array('userid' => $this->userid,
56
+        $a = (object)array('userid' => $this->userid,
57 57
                             'recordingid' => $rid,
58 58
                             'courseid' => $this->contextinstanceid);
59 59
 
60
-        return "The user with id '$a->userid' has published a recording with id ".
60
+        return "The user with id '$a->userid' has published a recording with id " .
61 61
         "'$a->recordingid' in the course id '$a->courseid'.";
62 62
     }
63 63
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected function get_legacy_logdata() {
70 70
         return array($this->courseid, 'bigbluebuttonbn', 'recording published',
71
-                'view.php?pageid='.$this->objectid, 'Recording published',
71
+                'view.php?pageid=' . $this->objectid, 'Recording published',
72 72
                 $this->contextinstanceid);
73 73
     }
74 74
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_unpublished.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function get_description() {
55 55
         $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
56
-        $a = (object) array('userid' => $this->userid,
56
+        $a = (object)array('userid' => $this->userid,
57 57
                             'recordingid' => $rid,
58 58
                             'courseid' => $this->contextinstanceid);
59 59
 
60
-        return "The user with id '$a->userid' has unpublished a recording with id ".
60
+        return "The user with id '$a->userid' has unpublished a recording with id " .
61 61
         "'$a->recordingid' in the course id '$a->courseid'.";
62 62
     }
63 63
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected function get_legacy_logdata() {
70 70
         return array($this->courseid, 'bigbluebuttonbn', 'recording unpublished',
71
-                'view.php?pageid='.$this->objectid, 'Recording unpublished',
71
+                'view.php?pageid=' . $this->objectid, 'Recording unpublished',
72 72
                 $this->contextinstanceid);
73 73
     }
74 74
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_meeting_event.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
      * @return string
53 53
      */
54 54
     public function get_description() {
55
-        $a = (object) array('userid' => $this->userid,
55
+        $a = (object)array('userid' => $this->userid,
56 56
                             'bigbluebuttonbnid' => $this->objectid,
57 57
                             'courseid' => $this->contextinstanceid,
58 58
                             'action' => $this->other);
59 59
 
60
-        return "The user with id '$a->userid' triggered action $a->action in a ".
61
-        "bigbluebutton meeting for the bigbluebuttonbn activity with id ".
60
+        return "The user with id '$a->userid' triggered action $a->action in a " .
61
+        "bigbluebutton meeting for the bigbluebuttonbn activity with id " .
62 62
         "'$a->bigbluebuttonbnid' for the course id '$a->courseid'.";
63 63
     }
64 64
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     protected function get_legacy_logdata() {
71 71
         return array($this->courseid, 'bigbluebuttonbn', 'meeting left',
72
-                'view.php?pageid='.$this->objectid, 'BigBlueButtonBN meeting live session event',
72
+                'view.php?pageid=' . $this->objectid, 'BigBlueButtonBN meeting live session event',
73 73
                 $this->contextinstanceid);
74 74
     }
75 75
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_meeting_left.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
      * @return string
53 53
      */
54 54
     public function get_description() {
55
-        $a = (object) array('userid' => $this->userid,
55
+        $a = (object)array('userid' => $this->userid,
56 56
                             'bigbluebuttonbnid' => $this->objectid,
57 57
                             'courseid' => $this->contextinstanceid);
58 58
 
59
-        return "The user with id '$a->userid' has left a bigbluebutton meeting for ".
60
-        "the bigbluebuttonbn activity with id '$a->bigbluebuttonbnid' for the course id ".
59
+        return "The user with id '$a->userid' has left a bigbluebutton meeting for " .
60
+        "the bigbluebuttonbn activity with id '$a->bigbluebuttonbnid' for the course id " .
61 61
         "'$a->courseid'.";
62 62
     }
63 63
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected function get_legacy_logdata() {
70 70
         return array($this->courseid, 'bigbluebuttonbn', 'meeting left',
71
-                'view.php?pageid='.$this->objectid, 'BigBlueButtonBN meeting left',
71
+                'view.php?pageid=' . $this->objectid, 'BigBlueButtonBN meeting left',
72 72
                 $this->contextinstanceid);
73 73
     }
74 74
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_meeting_ended.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
      * @return string
53 53
      */
54 54
     public function get_description() {
55
-        $a = (object) array('userid' => $this->userid,
55
+        $a = (object)array('userid' => $this->userid,
56 56
                             'bigbluebuttonbnid' => $this->objectid,
57 57
                             'courseid' => $this->contextinstanceid);
58 58
 
59
-        return "A bigbluebutton meeting for the bigbluebuttonbn activity with id ".
60
-        "'$a->bigbluebuttonbnid' for the course id '$a->courseid' has been forcibly ".
59
+        return "A bigbluebutton meeting for the bigbluebuttonbn activity with id " .
60
+        "'$a->bigbluebuttonbnid' for the course id '$a->courseid' has been forcibly " .
61 61
         "ended by the user with id '$a->userid'.";
62 62
     }
63 63
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected function get_legacy_logdata() {
70 70
         return array($this->courseid, 'bigbluebuttonbn', 'meeting ended',
71
-                'view.php?pageid='.$this->objectid, 'BigBlueButtonBN meeting forcibly ended',
71
+                'view.php?pageid=' . $this->objectid, 'BigBlueButtonBN meeting forcibly ended',
72 72
                 $this->contextinstanceid);
73 73
     }
74 74
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_deleted.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function get_description() {
55 55
         $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
56
-        $a = (object) array('userid' => $this->userid,
56
+        $a = (object)array('userid' => $this->userid,
57 57
                             'recordingid' => $rid,
58 58
                             'courseid' => $this->contextinstanceid);
59 59
 
60
-        return "The user with id '$a->userid' has deleted a recording with id ".
60
+        return "The user with id '$a->userid' has deleted a recording with id " .
61 61
         "'$a->recordingid' from the course id '$a->courseid'.";
62 62
     }
63 63
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected function get_legacy_logdata() {
70 70
         return array($this->courseid, 'bigbluebuttonbn', 'recording deleted',
71
-                'view.php?pageid='.$this->objectid, 'Recording deleted',
71
+                'view.php?pageid=' . $this->objectid, 'Recording deleted',
72 72
                 $this->contextinstanceid);
73 73
     }
74 74
 
Please login to merge, or discard this patch.