Completed
Push — master ( 349104...1d1df5 )
by Jesus
02:37
created
bbb_view.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 
179 179
 function bigbluebutton_bbb_view_create_meeting_data(&$bbbsession, $bigbluebuttonbn) {
180 180
     $data = ['meetingID' => $bbbsession['meetingid'],
181
-              'name' => $bbbsession['meetingname'],
182
-              'attendeePW' => $bbbsession['viewerPW'],
183
-              'moderatorPW' => $bbbsession['modPW'],
184
-              'logoutURL' => $bbbsession['logoutURL'],
181
+                'name' => $bbbsession['meetingname'],
182
+                'attendeePW' => $bbbsession['viewerPW'],
183
+                'moderatorPW' => $bbbsession['modPW'],
184
+                'logoutURL' => $bbbsession['logoutURL'],
185 185
             ];
186 186
 
187 187
     $data['record'] = 'false';
@@ -218,16 +218,16 @@  discard block
 block discarded – undo
218 218
 }
219 219
 
220 220
 function bigbluebutton_bbb_view_create_meeting_metadata(&$bbbsession) {
221
-      $metadata = ['bbb-origin' => $bbbsession['origin'],
222
-                   'bbb-origin-version' => $bbbsession['originVersion'],
223
-                   'bbb-origin-server-name' => $bbbsession['originServerName'],
224
-                   'bbb-origin-server-common-name' => $bbbsession['originServerCommonName'],
225
-                   'bbb-origin-tag' => $bbbsession['originTag'],
226
-                   'bbb-context' => $bbbsession['course']->fullname,
227
-                   'bbb-recording-name' => $bbbsession['meetingname'],
228
-                   'bbb-recording-description' => bigbluebuttonbn_html2text($bbbsession['meetingdescription'], 64),
229
-                   'bbb-recording-tags' => bigbluebuttonbn_get_tags($bbbsession['cm']->id), // Same as $id.
230
-                  ];
221
+        $metadata = ['bbb-origin' => $bbbsession['origin'],
222
+                    'bbb-origin-version' => $bbbsession['originVersion'],
223
+                    'bbb-origin-server-name' => $bbbsession['originServerName'],
224
+                    'bbb-origin-server-common-name' => $bbbsession['originServerCommonName'],
225
+                    'bbb-origin-tag' => $bbbsession['originTag'],
226
+                    'bbb-context' => $bbbsession['course']->fullname,
227
+                    'bbb-recording-name' => $bbbsession['meetingname'],
228
+                    'bbb-recording-description' => bigbluebuttonbn_html2text($bbbsession['meetingdescription'], 64),
229
+                    'bbb-recording-tags' => bigbluebuttonbn_get_tags($bbbsession['cm']->id), // Same as $id.
230
+                    ];
231 231
 
232 232
     if (bigbluebuttonbn_get_cfg_recordingstatus_enabled()) {
233 233
         $metadata["meta_bn-recording-status-email"] = json_encode(bigbluebuttonbn_get_moderator_email($bbbsession['context']));
Please login to merge, or discard this patch.
Switch Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -62,106 +62,106 @@
 block discarded – undo
62 62
 }
63 63
 
64 64
 switch (strtolower($action)) {
65
-    case 'logout':
66
-        if (isset($errors) && $errors != '') {
67
-            bigbluebutton_bbb_view_errors($errors, $id);
68
-            break;
69
-        }
65
+        case 'logout':
66
+            if (isset($errors) && $errors != '') {
67
+                bigbluebutton_bbb_view_errors($errors, $id);
68
+                break;
69
+            }
70 70
 
71
-        if (is_null($bbbsession)) {
72
-            bigbluebutton_bbb_view_close_window_manually();
73
-            break;
74
-        }
71
+            if (is_null($bbbsession)) {
72
+                bigbluebutton_bbb_view_close_window_manually();
73
+                break;
74
+            }
75 75
 
76
-        // Moodle event logger: Create an event for meeting left.
77
-        bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $cm);
76
+            // Moodle event logger: Create an event for meeting left.
77
+            bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $cm);
78 78
 
79
-        // Update the cache.
80
-        $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED);
79
+            // Update the cache.
80
+            $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED);
81 81
 
82
-        // Close the tab or window where BBB was opened.
83
-        bigbluebutton_bbb_view_close_window();
84
-        break;
85
-    case 'join':
86
-        if (is_null($bbbsession)) {
87
-            print_error('view_error_unable_join', 'bigbluebuttonbn');
82
+            // Close the tab or window where BBB was opened.
83
+            bigbluebutton_bbb_view_close_window();
88 84
             break;
89
-        }
85
+        case 'join':
86
+            if (is_null($bbbsession)) {
87
+                print_error('view_error_unable_join', 'bigbluebuttonbn');
88
+                break;
89
+            }
90 90
 
91
-        // See if the session is in progress.
92
-        if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) {
93
-            // Since the meeting is already running, we just join the session.
94
-            bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);
95
-            break;
96
-        }
91
+            // See if the session is in progress.
92
+            if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) {
93
+                // Since the meeting is already running, we just join the session.
94
+                bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);
95
+                break;
96
+            }
97 97
 
98
-        // If user is not administrator nor moderator (user is steudent) and waiting is required.
99
-        if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) {
100
-            header('Location: '.$bbbsession['logoutURL']);
101
-            break;
102
-        }
103
-
104
-        // As the meeting doesn't exist, try to create it.
105
-        $response = bigbluebuttonbn_get_create_meeting_array(
106
-            bigbluebutton_bbb_view_create_meeting_data($bbbsession, $bigbluebuttonbn),
107
-            bigbluebutton_bbb_view_create_meeting_metadata($bbbsession),
108
-            $bbbsession['presentation']['name'],
109
-            $bbbsession['presentation']['url']
110
-        );
111
-
112
-        if (!$response) {
113
-            // The server is unreachable.
114
-            if ($bbbsession['administrator']) {
115
-                print_error('view_error_unable_join', 'bigbluebuttonbn',
116
-                    $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
98
+            // If user is not administrator nor moderator (user is steudent) and waiting is required.
99
+            if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) {
100
+                header('Location: '.$bbbsession['logoutURL']);
117 101
                 break;
118 102
             }
119
-            if ($bbbsession['moderator']) {
120
-                print_error('view_error_unable_join_teacher', 'bigbluebuttonbn',
103
+
104
+            // As the meeting doesn't exist, try to create it.
105
+            $response = bigbluebuttonbn_get_create_meeting_array(
106
+                bigbluebutton_bbb_view_create_meeting_data($bbbsession, $bigbluebuttonbn),
107
+                bigbluebutton_bbb_view_create_meeting_metadata($bbbsession),
108
+                $bbbsession['presentation']['name'],
109
+                $bbbsession['presentation']['url']
110
+            );
111
+
112
+            if (!$response) {
113
+                // The server is unreachable.
114
+                if ($bbbsession['administrator']) {
115
+                    print_error('view_error_unable_join', 'bigbluebuttonbn',
116
+                        $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
117
+                    break;
118
+                }
119
+                if ($bbbsession['moderator']) {
120
+                    print_error('view_error_unable_join_teacher', 'bigbluebuttonbn',
121
+                        $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
122
+                    break;
123
+                }
124
+
125
+                print_error('view_error_unable_join_student', 'bigbluebuttonbn',
121 126
                     $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
122 127
                 break;
123 128
             }
124 129
 
125
-            print_error('view_error_unable_join_student', 'bigbluebuttonbn',
126
-                $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
127
-            break;
128
-        }
130
+            if ($response['returncode'] == 'FAILED') {
131
+                // The meeting was not created.
132
+                if (!$printerrorkey) {
133
+                    print_error($response['message'], 'bigbluebuttonbn');
134
+                    break;
135
+                }
136
+                $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');
137
+                print_error($printerrorkey, 'bigbluebuttonbn');
138
+                break;
139
+            }
129 140
 
130
-        if ($response['returncode'] == 'FAILED') {
131
-            // The meeting was not created.
132
-            if (!$printerrorkey) {
133
-                print_error($response['message'], 'bigbluebuttonbn');
141
+            if ($response['hasBeenForciblyEnded'] == 'true') {
142
+                print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn'));
134 143
                 break;
135 144
             }
136
-            $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');
137
-            print_error($printerrorkey, 'bigbluebuttonbn');
138
-            break;
139
-        }
140 145
 
141
-        if ($response['hasBeenForciblyEnded'] == 'true') {
142
-            print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn'));
146
+            // Moodle event logger: Create an event for meeting created.
147
+            bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $cm);
148
+            // Internal logger: Insert a record with the meeting created.
149
+            bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE);
150
+            // Since the meeting is already running, we just join the session.
151
+            bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);
152
+            break;
153
+        case 'playback':
154
+            if ($href == '') {
155
+                bigbluebutton_bbb_view_close_window();
156
+                return;
157
+            }
158
+            // Moodle event logger: Create an event for meeting left.
159
+            bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_VIEWED, $bigbluebuttonbn, $cm, ['other' => $rid]);
160
+            // Execute the redirect.
161
+            header('Location: '.urldecode($href));
143 162
             break;
144
-        }
145
-
146
-        // Moodle event logger: Create an event for meeting created.
147
-        bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $cm);
148
-        // Internal logger: Insert a record with the meeting created.
149
-        bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE);
150
-        // Since the meeting is already running, we just join the session.
151
-        bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);
152
-        break;
153
-    case 'playback':
154
-        if ($href == '') {
163
+        default:
155 164
             bigbluebutton_bbb_view_close_window();
156
-            return;
157
-        }
158
-        // Moodle event logger: Create an event for meeting left.
159
-        bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_VIEWED, $bigbluebuttonbn, $cm, ['other' => $rid]);
160
-        // Execute the redirect.
161
-        header('Location: '.urldecode($href));
162
-        break;
163
-    default:
164
-        bigbluebutton_bbb_view_close_window();
165 165
 }
166 166
 
167 167
 function bigbluebutton_bbb_view_close_window() {
Please login to merge, or discard this patch.
locallib.php 1 patch
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 global $CFG;
29 29
 
30
-require_once(dirname(__FILE__).'/lib.php');
30
+require_once(dirname(__FILE__) . '/lib.php');
31 31
 
32 32
 const BIGBLUEBUTTONBN_FORCED = true;
33 33
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     if (isset($meta)) {
77 77
         $log->meta = $meta;
78 78
     } else if ($event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) {
79
-        $log->meta = '{"record":'.($bbbsession['record'] ? 'true' : 'false').'}';
79
+        $log->meta = '{"record":' . ($bbbsession['record'] ? 'true' : 'false') . '}';
80 80
     }
81 81
 
82 82
     $DB->insert_record('bigbluebuttonbn_logs', $log);
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
  * @param array  $metadata
115 115
  */
116 116
 function bigbluebuttonbn_bigbluebutton_action_url($action = '', $data = array(), $metadata = array()) {
117
-    $baseurl = bigbluebuttonbn_get_cfg_server_url().'api/'.$action.'?';
117
+    $baseurl = bigbluebuttonbn_get_cfg_server_url() . 'api/' . $action . '?';
118 118
     $params = '';
119 119
 
120 120
     foreach ($data as $key => $value) {
121
-        $params .= '&'.$key.'='.urlencode($value);
121
+        $params .= '&' . $key . '=' . urlencode($value);
122 122
     }
123 123
 
124 124
     foreach ($metadata as $key => $value) {
125
-        $params .= '&'.'meta_'.$key.'='.urlencode($value);
125
+        $params .= '&' . 'meta_' . $key . '=' . urlencode($value);
126 126
     }
127 127
 
128
-    return $baseurl.$params.'&checksum='.sha1($action.$params.bigbluebuttonbn_get_cfg_shared_secret());
128
+    return $baseurl . $params . '&checksum=' . sha1($action . $params . bigbluebuttonbn_get_cfg_shared_secret());
129 129
 }
130 130
 
131 131
 function bigbluebuttonbn_get_create_meeting_array($data, $metadata = array(), $pname = null, $purl = null) {
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 
136 136
     if (!is_null($pname) && !is_null($purl)) {
137 137
         $method = BIGBLUEBUTTONBN_METHOD_POST;
138
-        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".
139
-            $purl."' /></module></modules>";
138
+        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" .
139
+            $purl . "' /></module></modules>";
140 140
     }
141 141
 
142 142
     $xml = bigbluebuttonbn_wrap_xml_load_file($createmeetingurl, $method, $data);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                                 'moderatorPW' => $meeting->moderatorPW,
182 182
                                 'attendeePW' => $meeting->attendeePW,
183 183
                                 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded,
184
-                                'running' => $meeting->running, );
184
+                                'running' => $meeting->running,);
185 185
         }
186 186
 
187 187
         return $meetings;
@@ -322,12 +322,12 @@  discard block
 block discarded – undo
322 322
 function bigbluebuttonbn_get_recordings_imported_array($courseid, $bigbluebuttonbnid = null, $subset = true) {
323 323
     global $DB;
324 324
 
325
-    $select = "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '".
326
-        BIGBLUEBUTTONBN_LOG_EVENT_IMPORT."'";
325
+    $select = "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '" .
326
+        BIGBLUEBUTTONBN_LOG_EVENT_IMPORT . "'";
327 327
     if ($bigbluebuttonbnid === null) {
328
-        $select = "courseid = '{$courseid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_IMPORT."'";
328
+        $select = "courseid = '{$courseid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_IMPORT . "'";
329 329
     } else if ($subset) {
330
-        $select = "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_IMPORT."'";
330
+        $select = "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_IMPORT . "'";
331 331
     }
332 332
     $recordsimported = $DB->get_records_select('bigbluebuttonbn_logs', $select);
333 333
 
@@ -354,37 +354,37 @@  discard block
 block discarded – undo
354 354
 function bigbluebuttonbn_get_default_config_xml_array() {
355 355
     $defaultconfigxml = bigbluebuttonbn_getDefaultConfigXML();
356 356
 
357
-    return (array) $defaultconfigxml;
357
+    return (array)$defaultconfigxml;
358 358
 }
359 359
 
360 360
 function bigbluebuttonbn_get_recording_array_value($recording) {
361 361
     // Add formats.
362 362
     $playbackarray = array();
363 363
     foreach ($recording->playback->format as $format) {
364
-        $playbackarray[(string) $format->type] = array('type' => (string) $format->type,
365
-            'url' => (string) $format->url, 'length' => (string) $format->length);
364
+        $playbackarray[(string)$format->type] = array('type' => (string)$format->type,
365
+            'url' => (string)$format->url, 'length' => (string)$format->length);
366 366
         // Add preview per format when existing.
367 367
         if ($format->preview) {
368 368
             $imagesarray = array();
369 369
             foreach ($format->preview->images->image as $image) {
370
-                $imagearray = array('url' => (string) $image);
370
+                $imagearray = array('url' => (string)$image);
371 371
                 foreach ($image->attributes() as $attkey => $attvalue) {
372
-                    $imagearray[$attkey] = (string) $attvalue;
372
+                    $imagearray[$attkey] = (string)$attvalue;
373 373
                 }
374 374
                 array_push($imagesarray, $imagearray);
375 375
             }
376
-            $playbackarray[(string) $format->type]['preview'] = $imagesarray;
376
+            $playbackarray[(string)$format->type]['preview'] = $imagesarray;
377 377
         }
378 378
     }
379 379
 
380 380
     // Add the metadata to the recordings array.
381 381
     $metadataarray = bigbluebuttonbn_get_recording_array_meta(get_object_vars($recording->metadata));
382
-    $recordingarray = array('recordID' => (string) $recording->recordID,
383
-        'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name,
384
-        'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime,
385
-        'endTime' => (string) $recording->endTime, 'playbacks' => $playbackarray);
382
+    $recordingarray = array('recordID' => (string)$recording->recordID,
383
+        'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name,
384
+        'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime,
385
+        'endTime' => (string)$recording->endTime, 'playbacks' => $playbackarray);
386 386
     if (isset($recording->protected)) {
387
-        $recordingarray['protected'] = (string) $recording->protected;
387
+        $recordingarray['protected'] = (string)$recording->protected;
388 388
     }
389 389
     //FORCE protected
390 390
     $recordingarray['protected'] = 'false';
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
         if (is_object($value)) {
398 398
             $value = '';
399 399
         }
400
-        $metadataarray['meta_'.$key] = $value;
400
+        $metadataarray['meta_' . $key] = $value;
401 401
     }
402 402
     return $metadataarray;
403 403
 }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     $ids = explode(',', $recordids);
456 456
     foreach ($ids as $id) {
457 457
         $xml = bigbluebuttonbn_wrap_xml_load_file(
458
-            bigbluebuttonbn_bigbluebutton_action_url('updateRecordings', ['recordID' => $id] + (array) $params)
458
+            bigbluebuttonbn_bigbluebutton_action_url('updateRecordings', ['recordID' => $id] + (array)$params)
459 459
           );
460 460
         if ($xml && $xml->returncode != 'SUCCESS') {
461 461
             return false;
@@ -610,8 +610,8 @@  discard block
 block discarded – undo
610 610
 
611 611
         $options = array();
612 612
         $options['CURLOPT_HTTPHEADER'] = array(
613
-                 'Content-Type: '.$contenttype,
614
-                 'Content-Length: '.strlen($data),
613
+                 'Content-Type: ' . $contenttype,
614
+                 'Content-Length: ' . strlen($data),
615 615
                  'Content-Language: en-US',
616 616
                );
617 617
 
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
     if ($userroles) {
629 629
         $where = '';
630 630
         foreach ($userroles as $value) {
631
-            $where .= (empty($where) ? ' WHERE' : ' AND').' id='.$value->roleid;
631
+            $where .= (empty($where) ? ' WHERE' : ' AND') . ' id=' . $value->roleid;
632 632
         }
633
-        $userroles = $DB->get_records_sql('SELECT * FROM {role}'.$where);
633
+        $userroles = $DB->get_records_sql('SELECT * FROM {role}' . $where);
634 634
     }
635 635
 
636 636
     return $userroles;
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 }
644 644
 
645 645
 function bigbluebuttonbn_get_users(context $context = null) {
646
-    $users = (array) get_enrolled_users($context);
646
+    $users = (array)get_enrolled_users($context);
647 647
     foreach ($users as $key => $value) {
648 648
         $users[$key] = fullname($value);
649 649
     }
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 }
652 652
 
653 653
 function bigbluebuttonbn_get_users_select(context $context = null) {
654
-    $users = (array) get_enrolled_users($context);
654
+    $users = (array)get_enrolled_users($context);
655 655
     foreach ($users as $key => $value) {
656 656
         $users[$key] = array('id' => $value->id, 'name' => fullname($value));
657 657
     }
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 }
660 660
 
661 661
 function bigbluebuttonbn_get_roles(context $context = null) {
662
-    $roles = (array) role_get_names($context);
662
+    $roles = (array)role_get_names($context);
663 663
     foreach ($roles as $key => $value) {
664 664
         $roles[$key] = $value->localname;
665 665
     }
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 }
668 668
 
669 669
 function bigbluebuttonbn_get_roles_select(context $context = null) {
670
-    $roles = (array) role_get_names($context);
670
+    $roles = (array)role_get_names($context);
671 671
     foreach ($roles as $key => $value) {
672 672
         $roles[$key] = array('id' => $value->id, 'name' => $value->localname);
673 673
     }
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
  }
676 676
 
677 677
 function bigbluebuttonbn_get_role($id) {
678
-    $roles = (array) role_get_names();
678
+    $roles = (array)role_get_names();
679 679
     if (is_numeric($id)) {
680 680
         return $roles[$id];
681 681
     }
@@ -839,9 +839,9 @@  discard block
 block discarded – undo
839 839
     $isunique = true;
840 840
     if ($voicebridge != 0) {
841 841
         $table = 'bigbluebuttonbn';
842
-        $select = 'voicebridge = '.$voicebridge;
842
+        $select = 'voicebridge = ' . $voicebridge;
843 843
         if ($id) {
844
-            $select .= ' AND id <> '.$id;
844
+            $select .= ' AND id <> ' . $id;
845 845
         }
846 846
         if ($DB->get_records_select($table, $select)) {
847 847
             $isunique = false;
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
     $mt = microtime();
910 910
     $rand = mt_rand();
911 911
 
912
-    return md5($mt.$rand);
912
+    return md5($mt . $rand);
913 913
 }
914 914
 
915 915
 function bigbluebuttonbn_random_password($length = 8) {
@@ -929,41 +929,41 @@  discard block
 block discarded – undo
929 929
 
930 930
 function bigbluebuttonbn_events() {
931 931
     return array(
932
-        (string) BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
933
-        (string) BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
934
-        (string) BIGBLUEBUTTON_EVENT_LIVE_SESSION,
935
-        (string) BIGBLUEBUTTON_EVENT_MEETING_CREATED,
936
-        (string) BIGBLUEBUTTON_EVENT_MEETING_ENDED,
937
-        (string) BIGBLUEBUTTON_EVENT_MEETING_JOINED,
938
-        (string) BIGBLUEBUTTON_EVENT_MEETING_LEFT,
939
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
940
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
941
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
942
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
943
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
944
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
945
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
946
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
932
+        (string)BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
933
+        (string)BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
934
+        (string)BIGBLUEBUTTON_EVENT_LIVE_SESSION,
935
+        (string)BIGBLUEBUTTON_EVENT_MEETING_CREATED,
936
+        (string)BIGBLUEBUTTON_EVENT_MEETING_ENDED,
937
+        (string)BIGBLUEBUTTON_EVENT_MEETING_JOINED,
938
+        (string)BIGBLUEBUTTON_EVENT_MEETING_LEFT,
939
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
940
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
941
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
942
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
943
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
944
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
945
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
946
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
947 947
     );
948 948
 }
949 949
 
950 950
 function bigbluebuttonbn_events_action() {
951 951
     return array(
952
-        'view' => (string) BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
953
-        'view_management' => (string) BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
954
-        'live_action' => (string) BIGBLUEBUTTON_EVENT_LIVE_SESSION,
955
-        'meeting_create' => (string) BIGBLUEBUTTON_EVENT_MEETING_CREATED,
956
-        'meeting_end' => (string) BIGBLUEBUTTON_EVENT_MEETING_ENDED,
957
-        'meeting_join' => (string) BIGBLUEBUTTON_EVENT_MEETING_JOINED,
958
-        'meeting_left' => (string) BIGBLUEBUTTON_EVENT_MEETING_LEFT,
959
-        'recording_delete' => (string) BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
960
-        'recording_import' => (string) BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
961
-        'recording_protect' => (string) BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
962
-        'recording_publish' => (string) BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
963
-        'recording_unprotect' => (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
964
-        'recording_unpublish' => (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
965
-        'recording_edit' => (string) BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
966
-        'recording_play' => (string) BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
952
+        'view' => (string)BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
953
+        'view_management' => (string)BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
954
+        'live_action' => (string)BIGBLUEBUTTON_EVENT_LIVE_SESSION,
955
+        'meeting_create' => (string)BIGBLUEBUTTON_EVENT_MEETING_CREATED,
956
+        'meeting_end' => (string)BIGBLUEBUTTON_EVENT_MEETING_ENDED,
957
+        'meeting_join' => (string)BIGBLUEBUTTON_EVENT_MEETING_JOINED,
958
+        'meeting_left' => (string)BIGBLUEBUTTON_EVENT_MEETING_LEFT,
959
+        'recording_delete' => (string)BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
960
+        'recording_import' => (string)BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
961
+        'recording_protect' => (string)BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
962
+        'recording_publish' => (string)BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
963
+        'recording_unprotect' => (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
964
+        'recording_unpublish' => (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
965
+        'recording_edit' => (string)BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
966
+        'recording_play' => (string)BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
967 967
     );
968 968
 }
969 969
 
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
         $eventproperties['other'] = $options['other'];
988 988
     }
989 989
 
990
-    $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_'.$eventtype.'::create',
990
+    $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_' . $eventtype . '::create',
991 991
       array($eventproperties));
992 992
     $event->trigger();
993 993
 }
@@ -1030,11 +1030,11 @@  discard block
 block discarded – undo
1030 1030
     $now = time();
1031 1031
     if (!$forced && isset($result) && $now < ($result['creation_time'] + $cachettl)) {
1032 1032
         // Use the value in the cache.
1033
-        return (array) json_decode($result['meeting_info']);
1033
+        return (array)json_decode($result['meeting_info']);
1034 1034
     }
1035 1035
 
1036 1036
     // Ping again and refresh the cache.
1037
-    $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
1037
+    $meetinginfo = (array)bigbluebuttonbn_wrap_xml_load_file(
1038 1038
         bigbluebuttonbn_bigbluebutton_action_url('getMeetingInfo', ['meetingID' => $meetingid])
1039 1039
       );
1040 1040
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
@@ -1088,8 +1088,8 @@  discard block
 block discarded – undo
1088 1088
  * @param string $configxml
1089 1089
  */
1090 1090
 function bigbluebuttonbn_set_config_xml_params($meetingid, $configxml) {
1091
-    $params = 'configXML='.urlencode($configxml).'&meetingID='.urlencode($meetingid);
1092
-    $configxmlparams = $params.'&checksum='.sha1('setConfigXML'.$params.bigbluebuttonbn_get_cfg_shared_secret());
1091
+    $params = 'configXML=' . urlencode($configxml) . '&meetingID=' . urlencode($meetingid);
1092
+    $configxmlparams = $params . '&checksum=' . sha1('setConfigXML' . $params . bigbluebuttonbn_get_cfg_shared_secret());
1093 1093
 
1094 1094
     return $configxmlparams;
1095 1095
 }
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
  * @param string $configxml
1100 1100
  */
1101 1101
 function bigbluebuttonbn_set_config_xml($meetingid, $configxml) {
1102
-    $urldefaultconfig = bigbluebuttonbn_get_cfg_server_url().'api/setConfigXML?';
1102
+    $urldefaultconfig = bigbluebuttonbn_get_cfg_server_url() . 'api/setConfigXML?';
1103 1103
     $configxmlparams = bigbluebuttonbn_set_config_xml_params($meetingid, $configxml);
1104 1104
     $xml = bigbluebuttonbn_wrap_xml_load_file($urldefaultconfig, BIGBLUEBUTTONBN_METHOD_POST,
1105 1105
         $configxmlparams, 'application/x-www-form-urlencoded');
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
  */
1114 1114
 function bigbluebuttonbn_set_config_xml_array($meetingid, $configxml) {
1115 1115
     $configxml = bigbluebuttonbn_setConfigXML($meetingid, $configxml);
1116
-    $configxmlarray = (array) $configxml;
1116
+    $configxmlarray = (array)$configxml;
1117 1117
     if ($configxmlarray['returncode'] != 'SUCCESS') {
1118 1118
         //debugging('BigBlueButton was not able to set the custom config.xml file', DEBUG_DEVELOPER);
1119 1119
         return '';
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
         $starttime = $starttime - ($starttime % 1000);
1151 1151
 
1152 1152
         // Set formatted date.
1153
-        $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z';
1153
+        $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
1154 1154
         $row->date_formatted = userdate($starttime / 1000, $dateformat, usertimezone($USER->timezone));
1155 1155
 
1156 1156
         // Set formatted duration.
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
     }
1222 1222
 
1223 1223
     $recordingpreview = html_writer::start_tag('div',
1224
-        array('id' => 'preview-'.$recording['recordID'], $visibility => $visibility));
1224
+        array('id' => 'preview-' . $recording['recordID'], $visibility => $visibility));
1225 1225
     foreach ($recording['playbacks'] as $playback) {
1226 1226
         if (isset($playback['preview'])) {
1227 1227
             foreach ($playback['preview'] as $image) {
@@ -1254,19 +1254,19 @@  discard block
 block discarded – undo
1254 1254
         $visibility = 'hidden ';
1255 1255
     }
1256 1256
 
1257
-    $id = 'playbacks-'.$recording['recordID'];
1257
+    $id = 'playbacks-' . $recording['recordID'];
1258 1258
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1259 1259
           'data-recordingid' => $recording['recordID'], 'data-meetingid' => $recording['meetingID'],
1260 1260
           'title' => $title, $visibility => $visibility));
1261 1261
     foreach ($recording['playbacks'] as $playback) {
1262 1262
         $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_play(this);';
1263
-        $href = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=playback&bn='.$bigbluebuttonbnid.
1264
-            '&href='.urlencode($playback['url']).'&rid='.$recording['recordID'];
1265
-        $linkattributes = array('title' => get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn'),
1263
+        $href = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=playback&bn=' . $bigbluebuttonbnid .
1264
+            '&href=' . urlencode($playback['url']) . '&rid=' . $recording['recordID'];
1265
+        $linkattributes = array('title' => get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'),
1266 1266
             'class' => 'btn btn-sm btn-default', 'onclick' => $onclick,
1267 1267
             'data-action' => 'play', 'data-href' => $href);
1268
-        $recordingtypes .= $OUTPUT->action_link('#', get_string('view_recording_format_'.$playback['type'],
1269
-            'bigbluebuttonbn'), null, $linkattributes).'&#32;';
1268
+        $recordingtypes .= $OUTPUT->action_link('#', get_string('view_recording_format_' . $playback['type'],
1269
+            'bigbluebuttonbn'), null, $linkattributes) . '&#32;';
1270 1270
     }
1271 1271
     $recordingtypes .= html_writer::end_tag('div');
1272 1272
 
@@ -1351,11 +1351,11 @@  discard block
 block discarded – undo
1351 1351
         $target .= '-' . $data['target'];
1352 1352
     }
1353 1353
     $id = 'recording-' . $target . '-' . $recording['recordID'];
1354
-    $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_'.$data['action'].'(this);';
1354
+    $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_' . $data['action'] . '(this);';
1355 1355
     if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1356 1356
         // With icon for $manageaction.
1357 1357
         $iconattributes = array('id' => $id, 'class' => 'iconsmall');
1358
-        $icon = new pix_icon('i/'.$data['tag'],
1358
+        $icon = new pix_icon('i/' . $data['tag'],
1359 1359
             get_string('view_recording_list_actionbar_' . $data['action'], 'bigbluebuttonbn'),
1360 1360
             'moodle', $iconattributes);
1361 1361
         $linkattributes = array(
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
         // There are recordings for this meeting.
1447 1447
         foreach ($recordings as $recording) {
1448 1448
             $row = new html_table_row();
1449
-            $row->id = 'recording-td-'.$recording['recordID'];
1449
+            $row->id = 'recording-td-' . $recording['recordID'];
1450 1450
             $row->attributes['data-imported'] = 'false';
1451 1451
             $texthead = '';
1452 1452
             $texttail = '';
@@ -1460,9 +1460,9 @@  discard block
 block discarded – undo
1460 1460
             $rowdata = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools);
1461 1461
             if ($rowdata != null) {
1462 1462
                 $rowdata->date_formatted = str_replace(' ', '&nbsp;', $rowdata->date_formatted);
1463
-                $row->cells = array($texthead.$rowdata->recording.$texttail,
1464
-                    $texthead.$rowdata->activity.$texttail, $texthead.$rowdata->description.$texttail,
1465
-                    $rowdata->preview, $texthead.$rowdata->date_formatted.$texttail,
1463
+                $row->cells = array($texthead . $rowdata->recording . $texttail,
1464
+                    $texthead . $rowdata->activity . $texttail, $texthead . $rowdata->description . $texttail,
1465
+                    $rowdata->preview, $texthead . $rowdata->date_formatted . $texttail,
1466 1466
                     $rowdata->duration_formatted);
1467 1467
                 if ($bbbsession['managerecordings']) {
1468 1468
                     $row->cells[] = $rowdata->actionbar;
@@ -1484,9 +1484,9 @@  discard block
 block discarded – undo
1484 1484
     // Build the message_body.
1485 1485
     $msg->activity_type = '';
1486 1486
     $msg->activity_title = $bigbluebuttonbn->name;
1487
-    $messagetext = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').' '.
1488
-        $msg->activity_type.' &quot;'.$msg->activity_title.'&quot; '.
1489
-        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
1487
+    $messagetext = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') . ' ' .
1488
+        $msg->activity_type . ' &quot;' . $msg->activity_title . '&quot; ' .
1489
+        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
1490 1490
 
1491 1491
     bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $messagetext);
1492 1492
 }
@@ -1512,15 +1512,15 @@  discard block
 block discarded – undo
1512 1512
     global $CFG;
1513 1513
 
1514 1514
     if (isset($CFG->bigbluebuttonbn['server_url'])) {
1515
-        return trim(trim($CFG->bigbluebuttonbn['server_url']), '/').'/';
1515
+        return trim(trim($CFG->bigbluebuttonbn['server_url']), '/') . '/';
1516 1516
     }
1517 1517
 
1518 1518
     if (isset($CFG->bigbluebuttonbn_server_url)) {
1519
-        return trim(trim($CFG->bigbluebuttonbn_server_url), '/').'/';
1519
+        return trim(trim($CFG->bigbluebuttonbn_server_url), '/') . '/';
1520 1520
     }
1521 1521
 
1522 1522
     if (isset($CFG->BigBlueButtonBNServerURL)) {
1523
-        return trim(trim($CFG->BigBlueButtonBNServerURL), '/').'/';
1523
+        return trim(trim($CFG->BigBlueButtonBNServerURL), '/') . '/';
1524 1524
     }
1525 1525
 
1526 1526
     return  BIGBLUEBUTTONBN_DEFAULT_SERVER_URL;
@@ -2076,15 +2076,15 @@  discard block
 block discarded – undo
2076 2076
 
2077 2077
     // Gather the bigbluebuttonbnids whose meetingids should be included in the getRecordings request'.
2078 2078
     $select = "id <> '{$bigbluebuttonbnid}' AND course = '{$courseid}'";
2079
-    $selectdeleted = "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '".
2080
-        BIGBLUEBUTTONBN_LOG_EVENT_DELETE."' AND meta like '%has_recordings%' AND meta like '%true%'";
2079
+    $selectdeleted = "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '" .
2080
+        BIGBLUEBUTTONBN_LOG_EVENT_DELETE . "' AND meta like '%has_recordings%' AND meta like '%true%'";
2081 2081
     if ($bigbluebuttonbnid === null) {
2082 2082
         $select = "course = '{$courseid}'";
2083
-        $selectdeleted = "courseid = '{$courseid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_DELETE.
2083
+        $selectdeleted = "courseid = '{$courseid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_DELETE .
2084 2084
             "' AND meta like '%has_recordings%' AND meta like '%true%'";
2085 2085
     } else if ($subset) {
2086 2086
         $select = "id = '{$bigbluebuttonbnid}'";
2087
-        $selectdeleted = "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_DELETE.
2087
+        $selectdeleted = "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_DELETE .
2088 2088
             "' AND meta like '%has_recordings%' AND meta like '%true%'";
2089 2089
     }
2090 2090
     $bigbluebuttonbns = $DB->get_records_select_menu('bigbluebuttonbn', $select, null, 'id', 'id, meetingid');
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
     if (!empty($bigbluebuttonbns)) {
2107 2107
         // Prepare select for loading records based on existent bigbluebuttonbns.
2108 2108
         $sql = 'SELECT DISTINCT meetingid, bigbluebuttonbnid FROM {bigbluebuttonbn_logs} WHERE ';
2109
-        $sql .= '(bigbluebuttonbnid='.implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)).')';
2109
+        $sql .= '(bigbluebuttonbnid=' . implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)) . ')';
2110 2110
         // Include only Create events and exclude those with record not true.
2111 2111
         $sql .= ' AND log = ? AND meta LIKE ? AND meta LIKE ?';
2112 2112
         // Execute select for loading records based on existent bigbluebuttonbns.
@@ -2198,8 +2198,8 @@  discard block
 block discarded – undo
2198 2198
 function bigbluebuttonbn_format_activity_time($time) {
2199 2199
     $activitytime = '';
2200 2200
     if ($time) {
2201
-        $activitytime = calendar_day_representation($time).' '.
2202
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
2201
+        $activitytime = calendar_day_representation($time) . ' ' .
2202
+          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn') . ' ' .
2203 2203
           calendar_time_representation($time);
2204 2204
     }
2205 2205
 
@@ -2232,13 +2232,13 @@  discard block
 block discarded – undo
2232 2232
 
2233 2233
 function bigbluebuttonbn_get_moderator_email($context) {
2234 2234
     $moderatoremails = array();
2235
-    $users = (array) get_enrolled_users($context);
2235
+    $users = (array)get_enrolled_users($context);
2236 2236
     $counter = 0;
2237 2237
     foreach ($users as $key => $user) {
2238 2238
         if ($counter == 5) {
2239 2239
             break;
2240 2240
         }
2241
-        if(has_capability('mod/bigbluebuttonbn:moderate', $context, $user)) {
2241
+        if (has_capability('mod/bigbluebuttonbn:moderate', $context, $user)) {
2242 2242
             array_push($moderatoremails, '"' . fullname($user) . '" <' . $user->email . '>');
2243 2243
             $counter += 1;
2244 2244
         }
Please login to merge, or discard this patch.