Completed
Branch master (0d964e)
by Jesus
03:25
created
view.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
10 10
  */
11 11
 
12
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
13
-require_once(dirname(__FILE__).'/locallib.php');
12
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
13
+require_once(dirname(__FILE__) . '/locallib.php');
14 14
 
15
-$id = required_param('id', PARAM_INT);              // Course Module ID, or
16
-$b  = optional_param('n', 0, PARAM_INT);            // bigbluebuttonbn instance ID
17
-$group  = optional_param('group', 0, PARAM_INT);    // group instance ID
15
+$id = required_param('id', PARAM_INT); // Course Module ID, or
16
+$b  = optional_param('n', 0, PARAM_INT); // bigbluebuttonbn instance ID
17
+$group  = optional_param('group', 0, PARAM_INT); // group instance ID
18 18
 
19 19
 if ($id) {
20 20
     $cm = get_coursemodule_from_id('bigbluebuttonbn', $id, 0, false, MUST_EXIST);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 require_login($course, true, $cm);
32 32
 
33 33
 $version_major = bigbluebuttonbn_get_moodle_version_major();
34
-if ( $version_major < '2013111800' ) {
34
+if ($version_major < '2013111800') {
35 35
     //This is valid before v2.6
36 36
     $module = $DB->get_record('modules', array('name' => 'bigbluebuttonbn'));
37 37
     $module_version = $module->version;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 $bbbsession['roles'] = get_user_roles($context, $USER->id, true);
58 58
 
59 59
 // User roles
60
-if( $bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]" ){
60
+if ($bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]") {
61 61
     //The room that is being used comes from a previous version
62 62
     $bbbsession['moderator'] = has_capability('mod/bigbluebuttonbn:moderate', $context);
63 63
 } else {
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
 // Database info related to the activity
78 78
 $bbbsession['meetingdescription'] = $bigbluebuttonbn->intro;
79 79
 $bbbsession['welcome'] = $bigbluebuttonbn->welcome;
80
-if( !isset($bbbsession['welcome']) || $bbbsession['welcome'] == '') {
80
+if (!isset($bbbsession['welcome']) || $bbbsession['welcome'] == '') {
81 81
     $bbbsession['welcome'] = get_string('mod_form_field_welcome_default', 'bigbluebuttonbn'); 
82 82
 }
83 83
 
84 84
 $bbbsession['userlimit'] = intval($bigbluebuttonbn->userlimit);
85
-$bbbsession['voicebridge'] = ($bigbluebuttonbn->voicebridge > 0)? 70000 + $bigbluebuttonbn->voicebridge: $bigbluebuttonbn->voicebridge;
85
+$bbbsession['voicebridge'] = ($bigbluebuttonbn->voicebridge > 0) ? 70000 + $bigbluebuttonbn->voicebridge : $bigbluebuttonbn->voicebridge;
86 86
 $bbbsession['wait'] = $bigbluebuttonbn->wait;
87 87
 $bbbsession['record'] = $bigbluebuttonbn->record;
88
-if( $bigbluebuttonbn->record )
89
-    $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn');
88
+if ($bigbluebuttonbn->record)
89
+    $bbbsession['welcome'] .= '<br><br>' . get_string('bbbrecordwarning', 'bigbluebuttonbn');
90 90
 $bbbsession['tagging'] = $bigbluebuttonbn->tagging;
91 91
 
92 92
 $bbbsession['openingtime'] = $bigbluebuttonbn->openingtime;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 $bbbsession['originServerName'] = $parsedUrl['host'];
107 107
 $bbbsession['originServerUrl'] = $CFG->wwwroot;
108 108
 $bbbsession['originServerCommonName'] = '';
109
-$bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn ('.$module_version.')';
109
+$bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn (' . $module_version . ')';
110 110
 // Metadata (context)
111 111
 $bbbsession['contextActivityName'] = "";
112 112
 $bbbsession['contextActivityDescription'] = "";
@@ -117,22 +117,22 @@  discard block
 block discarded – undo
117 117
 
118 118
 // Validates if the BigBlueButton server is running
119 119
 $serverVersion = bigbluebuttonbn_getServerVersion($bbbsession['endpoint']);
120
-if ( !isset($serverVersion) ) { //Server is not working
121
-    if ( $bbbsession['administrator'] )
122
-        print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
123
-    else if ( $bbbsession['moderator'] )
124
-        print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
120
+if (!isset($serverVersion)) { //Server is not working
121
+    if ($bbbsession['administrator'])
122
+        print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
123
+    else if ($bbbsession['moderator'])
124
+        print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
125 125
     else
126
-        print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
126
+        print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
127 127
 } else {
128
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL( $bbbsession['endpoint'], $bbbsession['shared_secret'] ) );
129
-    if ( !isset($xml) || !isset($xml->returncode) || $xml->returncode == 'FAILED' ){ // The shared secret is wrong
130
-        if ( $bbbsession['administrator'] )
131
-            print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
132
-        else if ( $bbbsession['moderator'] )
133
-            print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
128
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingsURL($bbbsession['endpoint'], $bbbsession['shared_secret']));
129
+    if (!isset($xml) || !isset($xml->returncode) || $xml->returncode == 'FAILED') { // The shared secret is wrong
130
+        if ($bbbsession['administrator'])
131
+            print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
132
+        else if ($bbbsession['moderator'])
133
+            print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
134 134
         else
135
-            print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
135
+            print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
136 136
     }
137 137
 }
138 138
 
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 
143 143
 // Print the page header
144 144
 $PAGE->set_context($context);
145
-$PAGE->set_url($CFG->wwwroot.'/mod/bigbluebuttonbn/view.php', array('id' => $cm->id));
145
+$PAGE->set_url($CFG->wwwroot . '/mod/bigbluebuttonbn/view.php', array('id' => $cm->id));
146 146
 $PAGE->set_title(format_string($bigbluebuttonbn->name));
147 147
 $PAGE->set_cacheable(false);
148 148
 $PAGE->set_heading($course->shortname);
149 149
 
150
-if( $bigbluebuttonbn->newwindow == 1 ) {
150
+if ($bigbluebuttonbn->newwindow == 1) {
151 151
     $PAGE->blocks->show_only_fake_blocks();
152 152
 
153 153
 } else {
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
 }
156 156
 
157 157
 // Validate if the user is in a role allowed to join
158
-if ( !has_capability('moodle/category:manage', $context) && !has_capability('mod/bigbluebuttonbn:join', $context) ) {
158
+if (!has_capability('moodle/category:manage', $context) && !has_capability('mod/bigbluebuttonbn:join', $context)) {
159 159
     echo $OUTPUT->header();
160 160
     if (isguestuser()) {
161
-        echo $OUTPUT->confirm('<p>'.get_string('view_noguests', 'bigbluebuttonbn').'</p>'.get_string('liketologin'),
162
-            get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
161
+        echo $OUTPUT->confirm('<p>' . get_string('view_noguests', 'bigbluebuttonbn') . '</p>' . get_string('liketologin'),
162
+            get_login_url(), $CFG->wwwroot . '/course/view.php?id=' . $course->id);
163 163
     } else { 
164
-        echo $OUTPUT->confirm('<p>'.get_string('view_nojoin', 'bigbluebuttonbn').'</p>'.get_string('liketologin'),
165
-            get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
164
+        echo $OUTPUT->confirm('<p>' . get_string('view_nojoin', 'bigbluebuttonbn') . '</p>' . get_string('liketologin'),
165
+            get_login_url(), $CFG->wwwroot . '/course/view.php?id=' . $course->id);
166 166
     }
167 167
 
168 168
     echo $OUTPUT->footer();
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 }
171 171
 
172 172
 // Operation URLs
173
-$bbbsession['courseURL'] = $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course;
174
-$bbbsession['logoutURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=logout&id='.$id.'&bn='.$bbbsession['bigbluebuttonbnid'];
175
-$bbbsession['recordingReadyURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_broker.php?action=recording_ready';
176
-$bbbsession['joinURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=join&id='.$id.'&bigbluebuttonbn='.$bbbsession['bigbluebuttonbnid'];
173
+$bbbsession['courseURL'] = $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course;
174
+$bbbsession['logoutURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=logout&id=' . $id . '&bn=' . $bbbsession['bigbluebuttonbnid'];
175
+$bbbsession['recordingReadyURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_broker.php?action=recording_ready';
176
+$bbbsession['joinURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=join&id=' . $id . '&bigbluebuttonbn=' . $bbbsession['bigbluebuttonbnid'];
177 177
 
178 178
 $bigbluebuttonbn_view = '';
179 179
 
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
 
183 183
 /// find out current groups mode
184 184
 $groupmode = groups_get_activity_groupmode($bbbsession['cm']);
185
-if ($groupmode == NOGROUPS ) {  //No groups mode
186
-    $bbbsession['meetingid'] = $bigbluebuttonbn->meetingid.'-'.$bbbsession['course']->id.'-'.$bbbsession['bigbluebuttonbnid'];
185
+if ($groupmode == NOGROUPS) {  //No groups mode
186
+    $bbbsession['meetingid'] = $bigbluebuttonbn->meetingid . '-' . $bbbsession['course']->id . '-' . $bbbsession['bigbluebuttonbnid'];
187 187
     $bbbsession['meetingname'] = $bigbluebuttonbn->name;
188 188
 
189 189
 } else {                                        // Separate or visible groups mode
190 190
     echo $OUTPUT->box_start('generalbox boxaligncenter');
191
-    echo '<br><div class="alert alert-warning">'.get_string('view_groups_selection_warning', 'bigbluebuttonbn').'</div>';
191
+    echo '<br><div class="alert alert-warning">' . get_string('view_groups_selection_warning', 'bigbluebuttonbn') . '</div>';
192 192
     echo $OUTPUT->box_end();
193 193
 
194 194
     $bbbsession['group'] = groups_get_activity_group($bbbsession['cm'], true);
195
-    if ($groupmode == SEPARATEGROUPS ) {
196
-        groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id, false, true);
197
-        if( $bbbsession['group'] == 0 ) {
198
-            if ( $bbbsession['administrator'] ) {
195
+    if ($groupmode == SEPARATEGROUPS) {
196
+        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id, false, true);
197
+        if ($bbbsession['group'] == 0) {
198
+            if ($bbbsession['administrator']) {
199 199
                 $my_groups = groups_get_all_groups($bbbsession['course']->id);
200 200
             } else {
201 201
                 $my_groups = groups_get_activity_allowed_groups($bbbsession['cm']);
@@ -205,21 +205,21 @@  discard block
 block discarded – undo
205 205
         }
206 206
 
207 207
     } else {
208
-        groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id);
208
+        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id);
209 209
     }
210 210
 
211
-    $bbbsession['meetingid'] = $bigbluebuttonbn->meetingid.'-'.$bbbsession['course']->id.'-'.$bbbsession['bigbluebuttonbnid'].'['.$bbbsession['group'].']';
212
-    if( $bbbsession['group'] > 0 )
211
+    $bbbsession['meetingid'] = $bigbluebuttonbn->meetingid . '-' . $bbbsession['course']->id . '-' . $bbbsession['bigbluebuttonbnid'] . '[' . $bbbsession['group'] . ']';
212
+    if ($bbbsession['group'] > 0)
213 213
         $group_name = groups_get_group_name($bbbsession['group']);
214 214
     else
215 215
         $group_name = get_string('allparticipants');
216
-    $bbbsession['meetingname'] = $bigbluebuttonbn->name.' ('.$group_name.')';
216
+    $bbbsession['meetingname'] = $bigbluebuttonbn->name . ' (' . $group_name . ')';
217 217
 }
218 218
 // Metadata (contextActivityName updated after meeting name is assigned)
219 219
 $bbbsession['contextActivityName'] = $bbbsession['meetingname'];
220 220
 
221 221
 $now = time();
222
-if (!empty($bigbluebuttonbn->openingtime) && $now < $bigbluebuttonbn->openingtime ) {
222
+if (!empty($bigbluebuttonbn->openingtime) && $now < $bigbluebuttonbn->openingtime) {
223 223
     //CALLING BEFORE
224 224
     $bigbluebuttonbn_view = 'before';
225 225
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         'meetingid' => $bbbsession['meetingid'],
253 253
         'bigbluebuttonbnid' => $bbbsession['bigbluebuttonbnid'],
254 254
         'bigbluebuttonbntype' => $bbbsession['bigbluebuttonbntype'],
255
-        'ping_interval' => ($waitformoderator_ping_interval > 0? $waitformoderator_ping_interval * 1000: 15000),
255
+        'ping_interval' => ($waitformoderator_ping_interval > 0 ? $waitformoderator_ping_interval * 1000 : 15000),
256 256
         'userlimit' => $bbbsession['userlimit'],
257 257
         'locales' => bigbluebuttonbn_get_locales_for_ui()
258 258
     );
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 // Finish the page
270 270
 echo $OUTPUT->footer();
271 271
 
272
-function bigbluebuttonbn_view_joining($bbbsession){
272
+function bigbluebuttonbn_view_joining($bbbsession) {
273 273
     global $CFG, $DB, $OUTPUT;
274 274
 
275 275
     echo $OUTPUT->heading($bbbsession['meetingname'], 3);
@@ -278,29 +278,29 @@  discard block
 block discarded – undo
278 278
     echo '<br><span id="status_bar"></span><br>';
279 279
     echo '<span id="control_panel"></span>';
280 280
     echo $OUTPUT->box_end();
281
-    if( $bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator']) ){
282
-        echo ''.
283
-          '<div id="panelContent" class="hidden">'.
284
-          '  <div class="yui3-widget-bd">'.
285
-          '    <form>'.
286
-          '      <fieldset>'.
287
-          '        <input type="hidden" name="join" id="meeting_join_url" value="">'.
288
-          '        <input type="hidden" name="message" id="meeting_message" value="">'.
289
-          '        <div>'.
290
-          '          <label for="name">'.get_string('view_recording_name', 'bigbluebuttonbn').'</label><br/>'.
291
-          '          <input type="text" name="name" id="recording_name" placeholder="">'.
292
-          '        </div><br>'.
293
-          '        <div>'.
294
-          '          <label for="description">'.get_string('view_recording_description', 'bigbluebuttonbn').'</label><br/>'.
295
-          '          <input type="text" name="description" id="recording_description" value="" placeholder="">'.
296
-          '        </div><br>'.
297
-          '        <div>'.
298
-          '          <label for="tags">'.get_string('view_recording_tags', 'bigbluebuttonbn').'</label><br/>'.
299
-          '          <input type="text" name="tags" id="recording_tags" value="" placeholder="">'.
300
-          '        </div>'.
301
-          '      </fieldset>'.
302
-          '    </form>'.
303
-          '  </div>'.
281
+    if ($bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator'])) {
282
+        echo '' .
283
+          '<div id="panelContent" class="hidden">' .
284
+          '  <div class="yui3-widget-bd">' .
285
+          '    <form>' .
286
+          '      <fieldset>' .
287
+          '        <input type="hidden" name="join" id="meeting_join_url" value="">' .
288
+          '        <input type="hidden" name="message" id="meeting_message" value="">' .
289
+          '        <div>' .
290
+          '          <label for="name">' . get_string('view_recording_name', 'bigbluebuttonbn') . '</label><br/>' .
291
+          '          <input type="text" name="name" id="recording_name" placeholder="">' .
292
+          '        </div><br>' .
293
+          '        <div>' .
294
+          '          <label for="description">' . get_string('view_recording_description', 'bigbluebuttonbn') . '</label><br/>' .
295
+          '          <input type="text" name="description" id="recording_description" value="" placeholder="">' .
296
+          '        </div><br>' .
297
+          '        <div>' .
298
+          '          <label for="tags">' . get_string('view_recording_tags', 'bigbluebuttonbn') . '</label><br/>' .
299
+          '          <input type="text" name="tags" id="recording_tags" value="" placeholder="">' .
300
+          '        </div>' .
301
+          '      </fieldset>' .
302
+          '    </form>' .
303
+          '  </div>' .
304 304
           '</div>';
305 305
     }
306 306
 
@@ -311,19 +311,19 @@  discard block
 block discarded – undo
311 311
     bigbluebuttonbn_view_recordings($bbbsession);
312 312
 }
313 313
 
314
-function bigbluebuttonbn_view_before( $bbbsession ){
314
+function bigbluebuttonbn_view_before($bbbsession) {
315 315
     global $CFG, $DB, $OUTPUT;
316 316
 
317 317
     echo $OUTPUT->heading(get_string('view_message_conference_not_started', 'bigbluebuttonbn'), 3);
318 318
 
319 319
     echo '<table>';
320 320
     if ($bbbsession['openingtime']) {
321
-        echo '<tr><td class="c0">'.get_string('mod_form_field_openingtime','bigbluebuttonbn').':</td>';
322
-        echo '    <td class="c1">'.userdate($bbbsession['openingtime']).'</td></tr>';
321
+        echo '<tr><td class="c0">' . get_string('mod_form_field_openingtime', 'bigbluebuttonbn') . ':</td>';
322
+        echo '    <td class="c1">' . userdate($bbbsession['openingtime']) . '</td></tr>';
323 323
     }
324 324
     if ($bbbsession['closingtime']) {
325
-        echo '<tr><td class="c0">'.get_string('mod_form_field_closingtime','bigbluebuttonbn').':</td>';
326
-        echo '    <td class="c1">'.userdate($bbbsession['closingtime']).'</td></tr>';
325
+        echo '<tr><td class="c0">' . get_string('mod_form_field_closingtime', 'bigbluebuttonbn') . ':</td>';
326
+        echo '    <td class="c1">' . userdate($bbbsession['closingtime']) . '</td></tr>';
327 327
     }
328 328
     echo '</table>';
329 329
 }
@@ -333,32 +333,32 @@  discard block
 block discarded – undo
333 333
 
334 334
     echo $OUTPUT->heading(get_string('view_message_conference_has_ended', 'bigbluebuttonbn'), 3);
335 335
 
336
-    if( !is_null($bbbsession['presentation']['url']) ) {
336
+    if (!is_null($bbbsession['presentation']['url'])) {
337 337
         $attributes = array('title' => $bbbsession['presentation']['name']);
338 338
         $icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']);
339 339
 
340
-        echo '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'.
341
-             ''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''.
342
-             ''.$OUTPUT->action_link($bbbsession['presentation']['url'], $bbbsession['presentation']['name'], null, $attributes).'<br><br>';
340
+        echo '<h4>' . get_string('view_section_title_presentation', 'bigbluebuttonbn') . '</h4>' .
341
+             '' . $OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false) . '' .
342
+             '' . $OUTPUT->action_link($bbbsession['presentation']['url'], $bbbsession['presentation']['name'], null, $attributes) . '<br><br>';
343 343
     }
344 344
 
345 345
     bigbluebuttonbn_view_recordings($bbbsession);
346 346
 }
347 347
 
348 348
 function bigbluebuttonbn_view_recordings($bbbsession) {
349
-    if( isset($bbbsession['record']) && $bbbsession['record'] ) {
350
-        echo '<h4>'.get_string('view_section_title_recordings', 'bigbluebuttonbn').'</h4>';
349
+    if (isset($bbbsession['record']) && $bbbsession['record']) {
350
+        echo '<h4>' . get_string('view_section_title_recordings', 'bigbluebuttonbn') . '</h4>';
351 351
 
352 352
         $recordings = bigbluebuttonbn_getRecordingsArray($bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret']);
353
-        if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
353
+        if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
354 354
             $table = bigbluebuttonbn_get_recording_table($bbbsession, $recordings);
355 355
         }
356 356
 
357
-        if( isset($table->data) ) {
357
+        if (isset($table->data)) {
358 358
             //Print the table
359
-            echo '<div id="bigbluebuttonbn_html_table">'."\n";
360
-            echo html_writer::table($table)."\n";
361
-            echo '</div>'."\n";
359
+            echo '<div id="bigbluebuttonbn_html_table">' . "\n";
360
+            echo html_writer::table($table) . "\n";
361
+            echo '</div>' . "\n";
362 362
 
363 363
         } else {
364 364
             print_string('view_message_norecordings', 'bigbluebuttonbn');
Please login to merge, or discard this patch.
lib.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -13,21 +13,21 @@  discard block
 block discarded – undo
13 13
 
14 14
 global $BIGBLUEBUTTONBN_CFG, $CFG;
15 15
 
16
-require_once($CFG->dirroot.'/calendar/lib.php');
17
-require_once($CFG->dirroot.'/message/lib.php');
18
-require_once($CFG->dirroot.'/lib/accesslib.php');
19
-require_once($CFG->dirroot.'/lib/filelib.php');
20
-require_once($CFG->dirroot.'/lib/formslib.php');
21
-require_once($CFG->dirroot.'/mod/lti/OAuth.php');
22
-require_once($CFG->libdir.'/accesslib.php');
23
-require_once($CFG->libdir.'/completionlib.php');
24
-require_once($CFG->libdir.'/datalib.php');
25
-require_once(dirname(__FILE__).'/JWT.php');
26
-
27
-if( file_exists(dirname(__FILE__).'/config.php') ) {
28
-    require_once(dirname(__FILE__).'/config.php');
29
-    if( isset($BIGBLUEBUTTONBN_CFG) ) {
30
-        $CFG = (object) array_merge((array)$CFG, (array)$BIGBLUEBUTTONBN_CFG);
16
+require_once($CFG->dirroot . '/calendar/lib.php');
17
+require_once($CFG->dirroot . '/message/lib.php');
18
+require_once($CFG->dirroot . '/lib/accesslib.php');
19
+require_once($CFG->dirroot . '/lib/filelib.php');
20
+require_once($CFG->dirroot . '/lib/formslib.php');
21
+require_once($CFG->dirroot . '/mod/lti/OAuth.php');
22
+require_once($CFG->libdir . '/accesslib.php');
23
+require_once($CFG->libdir . '/completionlib.php');
24
+require_once($CFG->libdir . '/datalib.php');
25
+require_once(dirname(__FILE__) . '/JWT.php');
26
+
27
+if (file_exists(dirname(__FILE__) . '/config.php')) {
28
+    require_once(dirname(__FILE__) . '/config.php');
29
+    if (isset($BIGBLUEBUTTONBN_CFG)) {
30
+        $CFG = (object)array_merge((array)$CFG, (array)$BIGBLUEBUTTONBN_CFG);
31 31
     }
32 32
 } else {
33 33
     $BIGBLUEBUTTONBN_CFG = new stdClass();
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 
45 45
 function bigbluebuttonbn_supports($feature) {
46
-    switch($feature) {
46
+    switch ($feature) {
47 47
         case FEATURE_IDNUMBER:                return true;
48 48
         case FEATURE_GROUPS:                  return true;
49 49
         case FEATURE_GROUPINGS:               return true;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 function bigbluebuttonbn_add_instance($data, $mform) {
73 73
     global $DB, $CFG;
74 74
 
75
-    $draftitemid = isset($data->presentation)? $data->presentation: null;
75
+    $draftitemid = isset($data->presentation) ? $data->presentation : null;
76 76
     $context = bigbluebuttonbn_get_context_module($data->coursemodule);
77 77
 
78 78
     bigbluebuttonbn_process_pre_save($data);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     global $DB, $CFG;
101 101
 
102 102
     $data->id = $data->instance;
103
-    $draftitemid = isset($data->presentation)? $data->presentation: null;
103
+    $draftitemid = isset($data->presentation) ? $data->presentation : null;
104 104
     $context = bigbluebuttonbn_get_context_module($data->coursemodule);
105 105
 
106 106
     bigbluebuttonbn_process_pre_save($data);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 function bigbluebuttonbn_delete_instance($id) {
127 127
     global $CFG, $DB;
128 128
 
129
-    if (! $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) {
129
+    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) {
130 130
         return false;
131 131
     }
132 132
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     //
136 136
     // End the session associated with this instance (if it's running)
137 137
     //
138
-    $meetingID = $bigbluebuttonbn->meetingid.'-'.$bigbluebuttonbn->course.'-'.$bigbluebuttonbn->id;
138
+    $meetingID = $bigbluebuttonbn->meetingid . '-' . $bigbluebuttonbn->course . '-' . $bigbluebuttonbn->id;
139 139
     
140 140
     $modPW = $bigbluebuttonbn->moderatorpass;
141 141
     $url = bigbluebuttonbn_get_cfg_server_url();
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
     //if( bigbluebuttonbn_isMeetingRunning($meetingID, $url, $shared_secret) )
145 145
     //    $getArray = bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $url, $shared_secret );
146 146
 
147
-    if (! $DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) {
147
+    if (!$DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) {
148 148
         $result = false;
149 149
     }
150 150
 
151
-    if (! $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
151
+    if (!$DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
152 152
         $result = false;
153 153
     }
154 154
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
  * @return boolean
187 187
  */
188 188
 function bigbluebuttonbn_print_recent_activity($course, $isteacher, $timestart) {
189
-    return false;  //  True if anything was printed, otherwise false
189
+    return false; //  True if anything was printed, otherwise false
190 190
 }
191 191
 
192 192
 /**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
  * @param int $groupid defaults to 0
202 202
  * @return void adds items into $activities and increases $index
203 203
  */
204
-function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) {
204
+function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0) {
205 205
 }
206 206
 
207 207
 /**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  *
220 220
  * @return boolean
221 221
  **/
222
-function bigbluebuttonbn_cron () {
222
+function bigbluebuttonbn_cron() {
223 223
     return true;
224 224
 }
225 225
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 function bigbluebuttonbn_get_coursemodule_info($coursemodule) {
316 316
     global $CFG, $DB;
317 317
 
318
-    if ( !$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat, newwindow')) {
318
+    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat, newwindow')) {
319 319
         return NULL;
320 320
     }
321 321
 
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 function bigbluebuttonbn_process_pre_save(&$bigbluebuttonbn) {
342 342
     global $DB, $CFG;
343 343
 
344
-    if ( !isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated ) {
344
+    if (!isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated) {
345 345
         $bigbluebuttonbn->timecreated = time();
346 346
         //Assign password only if it is a new activity
347
-        if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) {
347
+        if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) {
348 348
             $bigbluebuttonbn->moderatorpass = bigbluebuttonbn_random_password(12);
349 349
             $bigbluebuttonbn->viewerpass = bigbluebuttonbn_random_password(12);
350 350
         }
@@ -353,13 +353,13 @@  discard block
 block discarded – undo
353 353
         $bigbluebuttonbn->timemodified = time();
354 354
     }
355 355
 
356
-    if (! isset($bigbluebuttonbn->newwindow))
356
+    if (!isset($bigbluebuttonbn->newwindow))
357 357
         $bigbluebuttonbn->newwindow = 0;
358
-    if (! isset($bigbluebuttonbn->wait))
358
+    if (!isset($bigbluebuttonbn->wait))
359 359
         $bigbluebuttonbn->wait = 0;
360
-    if (! isset($bigbluebuttonbn->record))
360
+    if (!isset($bigbluebuttonbn->record))
361 361
         $bigbluebuttonbn->record = 0;
362
-    if (! isset($bigbluebuttonbn->tagging))
362
+    if (!isset($bigbluebuttonbn->tagging))
363 363
         $bigbluebuttonbn->tagging = 0;
364 364
 
365 365
     $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants);
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
 
379 379
     // Now that an id was assigned, generate and set the meetingid property based on 
380 380
     // [Moodle Instance + Activity ID + BBB Secret] (but only for new activities)
381
-    if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) {
382
-        $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot.$bigbluebuttonbn->id.bigbluebuttonbn_get_cfg_shared_secret());
381
+    if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) {
382
+        $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot . $bigbluebuttonbn->id . bigbluebuttonbn_get_cfg_shared_secret());
383 383
         $DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn_meetingid, array('id' => $bigbluebuttonbn->id));
384 384
         $action = get_string('mod_form_field_notification_msg_created', 'bigbluebuttonbn');
385 385
     } else {
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
     $at = get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn');
389 389
 
390 390
     // Add evento to the calendar when if openingtime is set
391
-    if ( isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime ){
391
+    if (isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime) {
392 392
         $event = new stdClass();
393 393
         $event->name        = $bigbluebuttonbn->name;
394 394
         $event->courseid    = $bigbluebuttonbn->course;
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
         $event->instance    = $bigbluebuttonbn->id;
399 399
         $event->timestart   = $bigbluebuttonbn->openingtime;
400 400
 
401
-        if ( $bigbluebuttonbn->closingtime ){
401
+        if ($bigbluebuttonbn->closingtime) {
402 402
             $event->durationtime = $bigbluebuttonbn->closingtime - $bigbluebuttonbn->openingtime;
403 403
         } else {
404 404
             $event->durationtime = 0;
405 405
         }
406 406
 
407
-        if ( $event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)) ) {
407
+        if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
408 408
             $calendarevent = calendar_event::load($event->id);
409 409
             $calendarevent->update($event);
410 410
         } else {
@@ -415,45 +415,45 @@  discard block
 block discarded – undo
415 415
         $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id));
416 416
     }
417 417
 
418
-    if( isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification ) {
418
+    if (isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification) {
419 419
         // Prepare message
420 420
         $msg = new stdClass();
421 421
 
422 422
         /// Build the message_body
423 423
         $msg->action = $action;
424 424
         $msg->activity_type = "";
425
-        if( isset($bigbluebuttonbn->type) && $bigbluebuttonbn->type != 0 )
425
+        if (isset($bigbluebuttonbn->type) && $bigbluebuttonbn->type != 0)
426 426
             $msg->activity_type = bigbluebuttonbn_get_predefinedprofile_name($bigbluebuttonbn->type);
427 427
         $msg->activity_title = $bigbluebuttonbn->name;
428
-        $message_text = '<p>'.$msg->activity_type.' &quot;'.$msg->activity_title.'&quot; '.get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn').' '.$msg->action.'.</p>';
428
+        $message_text = '<p>' . $msg->activity_type . ' &quot;' . $msg->activity_title . '&quot; ' . get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn') . ' ' . $msg->action . '.</p>';
429 429
 
430 430
         /// Add the meeting details to the message_body
431 431
         $msg->action = ucfirst($action);
432 432
         $msg->activity_description = "";
433
-        if( !empty($bigbluebuttonbn->intro) )
433
+        if (!empty($bigbluebuttonbn->intro))
434 434
             $msg->activity_description = trim($bigbluebuttonbn->intro);
435 435
         $msg->activity_openingtime = "";
436 436
         if ($bigbluebuttonbn->openingtime) {
437
-            $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime);
437
+            $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->openingtime);
438 438
         }
439 439
         $msg->activity_closingtime = "";
440
-        if ($bigbluebuttonbn->closingtime ) {
441
-            $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->closingtime);
440
+        if ($bigbluebuttonbn->closingtime) {
441
+            $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->closingtime);
442 442
         }
443
-        $msg->activity_owner = $USER->firstname.' '.$USER->lastname;
443
+        $msg->activity_owner = $USER->firstname . ' ' . $USER->lastname;
444 444
 
445
-        $message_text .= '<p><b>'.$msg->activity_title.'</b> '.get_string('email_body_notification_meeting_details', 'bigbluebuttonbn').':';
445
+        $message_text .= '<p><b>' . $msg->activity_title . '</b> ' . get_string('email_body_notification_meeting_details', 'bigbluebuttonbn') . ':';
446 446
         $message_text .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>';
447
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_title', 'bigbluebuttonbn').': </td><td>';
448
-        $message_text .= $msg->activity_title.'</td></tr>';
449
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_description', 'bigbluebuttonbn').': </td><td>';
450
-        $message_text .= $msg->activity_description.'</td></tr>';
451
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn').': </td><td>';
452
-        $message_text .= $msg->activity_openingtime.'</td></tr>';
453
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn').': </td><td>';
454
-        $message_text .= $msg->activity_closingtime.'</td></tr>';
455
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.$msg->action.' '.get_string('email_body_notification_meeting_by', 'bigbluebuttonbn').': </td><td>';
456
-        $message_text .= $msg->activity_owner.'</td></tr></tbody></table></p>';
447
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_title', 'bigbluebuttonbn') . ': </td><td>';
448
+        $message_text .= $msg->activity_title . '</td></tr>';
449
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_description', 'bigbluebuttonbn') . ': </td><td>';
450
+        $message_text .= $msg->activity_description . '</td></tr>';
451
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn') . ': </td><td>';
452
+        $message_text .= $msg->activity_openingtime . '</td></tr>';
453
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn') . ': </td><td>';
454
+        $message_text .= $msg->activity_closingtime . '</td></tr>';
455
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . $msg->action . ' ' . get_string('email_body_notification_meeting_by', 'bigbluebuttonbn') . ': </td><td>';
456
+        $message_text .= $msg->activity_owner . '</td></tr></tbody></table></p>';
457 457
 
458 458
         // Send notification to all users enrolled
459 459
         bigbluebuttonbn_send_notification($USER, $bigbluebuttonbn, $message_text);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
  * @param array $options additional options affecting the file serving
505 505
  * @return bool false if file not found, does not return if found - justsend the file
506 506
  */
507
-function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
507
+function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
508 508
     global $CFG, $DB;
509 509
 
510 510
     if ($context->contextlevel != CONTEXT_MODULE) {
@@ -520,21 +520,21 @@  discard block
 block discarded – undo
520 520
         return false;
521 521
     }
522 522
 
523
-    if( sizeof($args) > 1 ) {
523
+    if (sizeof($args) > 1) {
524 524
         $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache');
525 525
         $presentation_nonce_key = sha1($bigbluebuttonbn->id);
526 526
         $presentation_nonce = $cache->get($presentation_nonce_key);
527 527
         $presentation_nonce_value = $presentation_nonce['value'];
528 528
         $presentation_nonce_counter = $presentation_nonce['counter'];
529 529
 
530
-        if( $args["0"] != $presentation_nonce_value ) {
530
+        if ($args["0"] != $presentation_nonce_value) {
531 531
             return false;
532 532
         }
533 533
 
534 534
         //The nonce value is actually used twice because BigBlueButton reads the file two times
535 535
         $presentation_nonce_counter += 1;
536
-        if( $presentation_nonce_counter < 2 ) {
537
-            $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter ));
536
+        if ($presentation_nonce_counter < 2) {
537
+            $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter));
538 538
         } else {
539 539
             $cache->delete($presentation_nonce_key);
540 540
         }
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
     }
553 553
 
554 554
     if ($filearea === 'presentation') {
555
-        $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
555
+        $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
556 556
     } else {
557 557
         return false;
558 558
     }
@@ -586,10 +586,10 @@  discard block
 block discarded – undo
586 586
  * @package  mod_bigbluebuttonbn
587 587
  * @return array a list of available roles
588 588
  */
589
-function bigbluebuttonbn_get_db_moodle_roles($rolename='all') {
589
+function bigbluebuttonbn_get_db_moodle_roles($rolename = 'all') {
590 590
     global $DB;
591 591
 
592
-    if( $rolename != 'all')
592
+    if ($rolename != 'all')
593 593
         $roles = $DB->get_record('role', array('shortname' => $rolename));
594 594
     else
595 595
         $roles = $DB->get_records('role', array());
@@ -608,22 +608,22 @@  discard block
 block discarded – undo
608 608
 
609 609
     $roles = bigbluebuttonbn_get_db_moodle_roles();
610 610
     $sqluserids = array();
611
-    foreach($roles as $role){
611
+    foreach ($roles as $role) {
612 612
         $users = get_role_users($role->id, $context);
613
-        foreach($users as $user) {
613
+        foreach ($users as $user) {
614 614
             array_push($sqluserids, $user->id);
615 615
         }
616 616
     }
617 617
 
618 618
     $users_array = array();
619
-    if( !empty($sqluserids) ) {
619
+    if (!empty($sqluserids)) {
620 620
         $users_array = $DB->get_records_select("user", "id IN (" . implode(', ', $sqluserids) . ") AND deleted = 0");
621 621
     }
622 622
 
623 623
     return $users_array;
624 624
 }
625 625
 
626
-function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message="") {
626
+function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message = "") {
627 627
     global $CFG, $DB;
628 628
 
629 629
     $context = bigbluebuttonbn_get_context_course($bigbluebuttonbn->course);
@@ -631,19 +631,19 @@  discard block
 block discarded – undo
631 631
 
632 632
     //Complete message
633 633
     $msg = new stdClass();
634
-    $msg->user_name = $sender->firstname.' '.$sender->lastname;
634
+    $msg->user_name = $sender->firstname . ' ' . $sender->lastname;
635 635
     $msg->user_email = $sender->email;
636 636
     $msg->course_name = "$course->fullname";
637
-    $message .= '<p><hr/><br/>'.get_string('email_footer_sent_by', 'bigbluebuttonbn').' '.$msg->user_name.'('.$msg->user_email.') ';
638
-    $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn').' '.$msg->course_name.'.</p>';
637
+    $message .= '<p><hr/><br/>' . get_string('email_footer_sent_by', 'bigbluebuttonbn') . ' ' . $msg->user_name . '(' . $msg->user_email . ') ';
638
+    $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn') . ' ' . $msg->course_name . '.</p>';
639 639
     
640 640
     $users = bigbluebuttonbn_get_users($context);
641
-    foreach( $users as $user ) {
642
-        if( $user->id != $sender->id ){
643
-            error_log("Sending msg to ".$user->firstname." ".$user->lastname.".");
641
+    foreach ($users as $user) {
642
+        if ($user->id != $sender->id) {
643
+            error_log("Sending msg to " . $user->firstname . " " . $user->lastname . ".");
644 644
             $messageid = message_post_message($sender, $user, $message, FORMAT_HTML);
645 645
             if (!empty($messageid)) {
646
-                error_log("Msg sent to ".$user->firstname." ".$user->lastname.".");
646
+                error_log("Msg sent to " . $user->firstname . " " . $user->lastname . ".");
647 647
             } else {
648 648
                 error_log("Msg was NOT sent.");
649 649
             }
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
     global $CFG;
656 656
 
657 657
     $version_major = bigbluebuttonbn_get_moodle_version_major();
658
-    if ( $version_major < '2013111800' ) {
658
+    if ($version_major < '2013111800') {
659 659
         //This is valid before v2.6
660 660
         $context = get_context_instance(CONTEXT_MODULE, $id);
661 661
     } else {
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
     global $CFG;
671 671
 
672 672
     $version_major = bigbluebuttonbn_get_moodle_version_major();
673
-    if ( $version_major < '2013111800' ) {
673
+    if ($version_major < '2013111800') {
674 674
         //This is valid before v2.6
675 675
         $context = get_context_instance(CONTEXT_COURSE, $id);
676 676
     } else {
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
 
684 684
 function bigbluebuttonbn_get_cfg_server_url() {
685 685
     global $BIGBLUEBUTTONBN_CFG, $CFG;
686
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)? trim(trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url),'/').'/': (isset($CFG->bigbluebuttonbn_server_url)? trim(trim($CFG->bigbluebuttonbn_server_url),'/').'/': 'http://test-install.blindsidenetworks.com/bigbluebutton/'));
686
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ? trim(trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url), '/') . '/' : (isset($CFG->bigbluebuttonbn_server_url) ? trim(trim($CFG->bigbluebuttonbn_server_url), '/') . '/' : 'http://test-install.blindsidenetworks.com/bigbluebutton/'));
687 687
 }
688 688
 
689 689
 function bigbluebuttonbn_get_cfg_shared_secret() {
690 690
     global $BIGBLUEBUTTONBN_CFG, $CFG;
691
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret): (isset($CFG->bigbluebuttonbn_shared_secret)? trim($CFG->bigbluebuttonbn_shared_secret): '8cd8ef52e8e101574e400365b55e11a6'));
691
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) : (isset($CFG->bigbluebuttonbn_shared_secret) ? trim($CFG->bigbluebuttonbn_shared_secret) : '8cd8ef52e8e101574e400365b55e11a6'));
692 692
 }
693 693
 
Please login to merge, or discard this patch.
bbb_view.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
9 9
  */
10 10
 
11
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
12
-require_once(dirname(__FILE__).'/locallib.php');
11
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
12
+require_once(dirname(__FILE__) . '/locallib.php');
13 13
 
14
-$id = optional_param('id', 0, PARAM_INT);  // course_module ID, or
15
-$bn = optional_param('bn', 0, PARAM_INT);  // bigbluebuttonbn instance ID
14
+$id = optional_param('id', 0, PARAM_INT); // course_module ID, or
15
+$bn = optional_param('bn', 0, PARAM_INT); // bigbluebuttonbn instance ID
16 16
 $action = required_param('action', PARAM_TEXT);
17 17
 $name = optional_param('name', '', PARAM_TEXT);
18 18
 $description = optional_param('description', '', PARAM_TEXT);
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 $PAGE->set_cacheable(false);
40 40
 $PAGE->blocks->show_only_fake_blocks();
41 41
 
42
-if ( isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
42
+if (isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
43 43
     require_login($course, true, $cm);
44 44
     $bbbsession = $SESSION->bigbluebuttonbn_bbbsession;
45 45
 }
46 46
 switch (strtolower($action)) {
47 47
     case 'logout':
48
-        if ( isset($bbbsession) && !is_null($bbbsession) ) {
48
+        if (isset($bbbsession) && !is_null($bbbsession)) {
49 49
             /// Moodle event logger: Create an event for meeting left
50 50
             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $context, $cm);
51 51
 
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
         }
61 61
         break;
62 62
     case 'join':
63
-        if ( isset($bbbsession) && !is_null($bbbsession) ) {
63
+        if (isset($bbbsession) && !is_null($bbbsession)) {
64 64
             //See if the session is in progress
65
-            if( bigbluebuttonbn_isMeetingRunning( $bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'] ) ) {
65
+            if (bigbluebuttonbn_isMeetingRunning($bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'])) {
66 66
                 /// Since the meeting is already running, we just join the session
67 67
                 bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn);
68 68
 
69 69
             } else {
70 70
                 // If user is administrator, moderator or if is viewer and no waiting is required
71
-                if( $bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait'] ) {
71
+                if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) {
72 72
                     /// Prepare the metadata
73 73
                     $metadata = array("meta_bn-origin" => $bbbsession['origin'],
74 74
                             "meta_bbb-origin-version" => $bbbsession['originVersion'],
@@ -76,20 +76,20 @@  discard block
 block discarded – undo
76 76
                             "meta_bbb-origin-server-common-name" => $bbbsession['originServerCommonName'],
77 77
                             "meta_bbb-origin-tag" => $bbbsession['originTag'],
78 78
                             "meta_bbb-context" => $bbbsession['course']->fullname,
79
-                            "meta_bbb-recording-name" => (isset($name) && $name != '')? $name: $bbbsession['contextActivityName'],
80
-                            "meta_bbb-recording-description" => (isset($description) && $description != '')? $description: $bbbsession['contextActivityDescription'],
81
-                            "meta_bbb-recording-tags" => (isset($tags) && $tags != '')? $tags: $bbbsession['contextActivityTags'],
79
+                            "meta_bbb-recording-name" => (isset($name) && $name != '') ? $name : $bbbsession['contextActivityName'],
80
+                            "meta_bbb-recording-description" => (isset($description) && $description != '') ? $description : $bbbsession['contextActivityDescription'],
81
+                            "meta_bbb-recording-tags" => (isset($tags) && $tags != '') ? $tags : $bbbsession['contextActivityTags'],
82 82
                     );
83 83
 
84
-                    if ( bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled() ) {
84
+                    if (bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled()) {
85 85
                         $metadata["meta_bn-recording-ready-url"] = $bbbsession['recordingReadyURL'];
86 86
                     }
87 87
 
88 88
                     /// Set the duration for the meeting
89
-                    if ( bigbluebuttonbn_get_cfg_scheduled_duration_enabled() ) {
89
+                    if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) {
90 90
                         $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime);
91
-                        if( $durationtime > 0 )
92
-                            $bbbsession['welcome'] .= '<br><br>'.str_replace("%duration%", ''.$durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn'));
91
+                        if ($durationtime > 0)
92
+                            $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn'));
93 93
                     } else {
94 94
                         $durationtime = 0;
95 95
                     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                             $bbbsession['shared_secret'],
104 104
                             $bbbsession['endpoint'],
105 105
                             $bbbsession['logoutURL'],
106
-                            $bbbsession['record']? 'true': 'false',
106
+                            $bbbsession['record'] ? 'true' : 'false',
107 107
                             $durationtime,
108 108
                             $bbbsession['voicebridge'],
109 109
                             $metadata,
@@ -113,25 +113,25 @@  discard block
 block discarded – undo
113 113
 
114 114
                     if (!$response) {
115 115
                         // If the server is unreachable, then prompts the user of the necessary action
116
-                        if ( $bbbsession['administrator'] ) {
117
-                            print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
118
-                        } else if ( $bbbsession['moderator'] ) {
119
-                            print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
116
+                        if ($bbbsession['administrator']) {
117
+                            print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
118
+                        } else if ($bbbsession['moderator']) {
119
+                            print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
120 120
                         } else {
121
-                            print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
121
+                            print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
122 122
                         }
123 123
 
124
-                    } else if( $response['returncode'] == "FAILED" ) {
124
+                    } else if ($response['returncode'] == "FAILED") {
125 125
                         // The meeting was not created
126
-                        $error_key = bigbluebuttonbn_get_error_key( $response['messageKey'], 'view_error_create' );
127
-                        if( !$error_key ) {
128
-                            print_error( $response['message'], 'bigbluebuttonbn' );
126
+                        $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');
127
+                        if (!$error_key) {
128
+                            print_error($response['message'], 'bigbluebuttonbn');
129 129
                         } else {
130
-                            print_error( $error_key, 'bigbluebuttonbn' );
130
+                            print_error($error_key, 'bigbluebuttonbn');
131 131
                         }
132 132
 
133
-                    } else if ($response['hasBeenForciblyEnded'] == "true"){
134
-                        print_error( get_string( 'index_error_forciblyended', 'bigbluebuttonbn' ));
133
+                    } else if ($response['hasBeenForciblyEnded'] == "true") {
134
+                        print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn'));
135 135
 
136 136
                     } else { ///////////////Everything is ok /////////////////////
137 137
                         /// Moodle event logger: Create an event for meeting created
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
                     }
144 144
 
145 145
                 } else {
146
-                    header('Location: '.$bbbsession['logoutURL'] );
146
+                    header('Location: ' . $bbbsession['logoutURL']);
147 147
                 }
148 148
             }
149 149
 
150 150
         } else {
151
-            print_error( 'view_error_unable_join', 'bigbluebuttonbn' );
151
+            print_error('view_error_unable_join', 'bigbluebuttonbn');
152 152
         }
153 153
         break;
154 154
     default:
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 function bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn) {
173 173
     //// Update the cache
174 174
     $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($bbbsession['meetingid'], $bbbsession['modPW'], true);
175
-    if( $bbbsession['userlimit'] == 0 || intval($meeting_info['participantCount']) < $bbbsession['userlimit']  ) {
175
+    if ($bbbsession['userlimit'] == 0 || intval($meeting_info['participantCount']) < $bbbsession['userlimit']) {
176 176
         //// Build the URL
177
-        if( $bbbsession['administrator'] || $bbbsession['moderator'] ) {
177
+        if ($bbbsession['administrator'] || $bbbsession['moderator']) {
178 178
             $password = $bbbsession['modPW'];
179 179
         } else {
180 180
             $password = $bbbsession['viewerPW'];
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
         /// Internal logger: Instert a record with the meeting created
186 186
         bigbluebuttonbn_log($bbbsession, 'Join');
187 187
         //// Before executing the redirect, increment the number of participants
188
-        bigbluebuttonbn_bbb_broker_participant_joined($bbbsession['meetingid'], ($bbbsession['administrator'] || $bbbsession['moderator']) );
188
+        bigbluebuttonbn_bbb_broker_participant_joined($bbbsession['meetingid'], ($bbbsession['administrator'] || $bbbsession['moderator']));
189 189
         //// Execute the redirect
190
-        header('Location: '.$join_url );
190
+        header('Location: ' . $join_url);
191 191
 
192 192
     } else {
193
-        header('Location: '.$bbbsession['logoutURL'] );
193
+        header('Location: ' . $bbbsession['logoutURL']);
194 194
     }
195 195
 }
196 196
\ No newline at end of file
Please login to merge, or discard this patch.
db/upgrade.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
11 11
  */
12 12
 
13
-function xmldb_bigbluebuttonbn_upgrade($oldversion=0) {
13
+function xmldb_bigbluebuttonbn_upgrade($oldversion = 0) {
14 14
 
15 15
     global $CFG, $THEME, $DB;
16 16
     $dbman = $DB->get_manager(); // loads ddl manager and xmldb classes
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
     if ($result && $oldversion < 2012040200) {
21 21
         // Define field intro to be droped from bigbluebuttonbn
22 22
         $table = new xmldb_table('bigbluebuttonbn');
23
-        $field = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null,'name');
23
+        $field = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'name');
24 24
 
25 25
         // Drop field intro
26 26
         if ($dbman->field_exists($table, $field)) {
27
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
27
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
28 28
         }
29 29
 
30 30
         // Define field introformat to be droped from bigbluebuttonbn
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
         // Drop field introformat
35 35
         if ($dbman->field_exists($table, $field)) {
36
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
36
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
37 37
         }
38 38
 
39 39
         // Once we reach this point, we can store the new version and consider the module
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $field = new xmldb_field('welcome');
74 74
         $field->set_attributes(XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, null, null, 'type');
75 75
 
76
-        $dbman->change_field_type($table, $field, $continue=true, $feedback=true);
76
+        $dbman->change_field_type($table, $field, $continue = true, $feedback = true);
77 77
 
78 78
         upgrade_mod_savepoint(true, 2012100100, 'bigbluebuttonbn');
79 79
     }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
86 86
 
87 87
         if (!$dbman->field_exists($table, $field)) {
88
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
88
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
89 89
         }
90 90
 
91 91
         upgrade_mod_savepoint(true, 2014050100, 'bigbluebuttonbn');
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $field = new xmldb_field('participants', XMLDB_TYPE_TEXT, 'medium', null, null, null, null);
98 98
 
99 99
         if (!$dbman->field_exists($table, $field)) {
100
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
100
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
101 101
         }
102 102
 
103 103
         upgrade_mod_savepoint(true, 2014070420, 'bigbluebuttonbn');
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $field = new xmldb_field('participants');
110 110
         $field->set_attributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null);
111 111
 
112
-        $dbman->change_field_type($table, $field, $continue=true, $feedback=true);
112
+        $dbman->change_field_type($table, $field, $continue = true, $feedback = true);
113 113
 
114 114
         upgrade_mod_savepoint(true, 2014101004, 'bigbluebuttonbn');
115 115
     }
@@ -119,67 +119,67 @@  discard block
 block discarded – undo
119 119
         $table = new xmldb_table('bigbluebuttonbn');
120 120
         //// Drop field timeduration
121 121
         $field = new xmldb_field('timeduration');
122
-        if( $dbman->field_exists($table, $field) ) {
123
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
122
+        if ($dbman->field_exists($table, $field)) {
123
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
124 124
         }
125 125
         //// Drop field allmoderators
126 126
         $field = new xmldb_field('allmoderators');
127
-        if( $dbman->field_exists($table, $field) ) {
128
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
127
+        if ($dbman->field_exists($table, $field)) {
128
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
129 129
         }
130 130
         //// Add field intro
131 131
         $field = new xmldb_field('intro');
132 132
         $field->set_attributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'name');
133
-        if( !$dbman->field_exists($table, $field) ) {
134
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
133
+        if (!$dbman->field_exists($table, $field)) {
134
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
135 135
         }
136 136
         //// Add field introformat
137 137
         $field = new xmldb_field('introformat');
138 138
         $field->set_attributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 1, 'intro');
139
-        if( !$dbman->field_exists($table, $field) ) {
140
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
139
+        if (!$dbman->field_exists($table, $field)) {
140
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
141 141
         }
142 142
         //// Add field tagging
143 143
         $field = new xmldb_field('tagging');
144 144
         $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'record');
145
-        if( !$dbman->field_exists($table, $field) ) {
146
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
145
+        if (!$dbman->field_exists($table, $field)) {
146
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
147 147
         }
148 148
         //// Add field presentation
149 149
         $field = new xmldb_field('presentation');
150 150
         $field->set_attributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'timemodified');
151
-        if( !$dbman->field_exists($table, $field) ) {
152
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
151
+        if (!$dbman->field_exists($table, $field)) {
152
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
153 153
         }
154 154
         //// Add field type
155 155
         $field = new xmldb_field('type');
156 156
         $field->set_attributes(XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'course');
157
-        if( !$dbman->field_exists($table, $field) ) {
158
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
157
+        if (!$dbman->field_exists($table, $field)) {
158
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
159 159
         }
160 160
         //// Rename field timeavailable
161 161
         $field = new xmldb_field('timeavailable');
162 162
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
163
-        if( $dbman->field_exists($table, $field) ) {
164
-            $dbman->rename_field($table, $field, 'openingtime', $continue=true, $feedback=true);
163
+        if ($dbman->field_exists($table, $field)) {
164
+            $dbman->rename_field($table, $field, 'openingtime', $continue = true, $feedback = true);
165 165
         }
166 166
         //// Rename field timedue
167 167
         $field = new xmldb_field('timedue');
168 168
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
169
-        if( $dbman->field_exists($table, $field) ) {
170
-            $dbman->rename_field($table, $field, 'closingtime', $continue=true, $feedback=true);
169
+        if ($dbman->field_exists($table, $field)) {
170
+            $dbman->rename_field($table, $field, 'closingtime', $continue = true, $feedback = true);
171 171
         }
172 172
         //// Add field timecreated
173 173
         $field = new xmldb_field('timecreated');
174 174
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'closingtime');
175
-        if( !$dbman->field_exists($table, $field) ) {
176
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
175
+        if (!$dbman->field_exists($table, $field)) {
176
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
177 177
         }
178 178
         //// Add field userlimit
179 179
         $field = new xmldb_field('userlimit');
180 180
         $field->set_attributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
181 181
         if (!$dbman->field_exists($table, $field)) {
182
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
182
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
183 183
         }
184 184
 
185 185
         // Update the bigbluebuttonbn_log table
@@ -187,18 +187,18 @@  discard block
 block discarded – undo
187 187
         //// Add field userid
188 188
         $field = new xmldb_field('userid');
189 189
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'bigbluebuttonbnid');
190
-        if( !$dbman->field_exists($table, $field) ) {
191
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
190
+        if (!$dbman->field_exists($table, $field)) {
191
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
192 192
         }
193 193
         //// Add field meta
194 194
         $field = new xmldb_field('meta');
195 195
         $field->set_attributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'event');
196
-        if( !$dbman->field_exists($table, $field) ) {
197
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
196
+        if (!$dbman->field_exists($table, $field)) {
197
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
198 198
         }
199 199
         //// Drop field recording
200 200
         $field = new xmldb_field('record');
201
-        if( $dbman->field_exists($table, $field) ) {
201
+        if ($dbman->field_exists($table, $field)) {
202 202
             //// Migrate data in field recording to new format in meta
203 203
             $meta = new \stdClass();
204 204
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $DB->set_field('bigbluebuttonbn_log', 'meta', json_encode($meta), array('event' => 'Create', 'record' => 0));
212 212
 
213 213
             // Drop field recording
214
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
214
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
215 215
         }
216 216
 
217 217
         upgrade_mod_savepoint(true, 2015063000, 'bigbluebuttonbn');
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
         $table = new xmldb_table('bigbluebuttonbn');
223 223
         //// Drop field description
224 224
         $field = new xmldb_field('description');
225
-        if( $dbman->field_exists($table, $field) ) {
226
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
225
+        if ($dbman->field_exists($table, $field)) {
226
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
227 227
         }
228 228
         //// Change welcome, allow null
229 229
         $field = new xmldb_field('welcome');
230 230
         $field->set_attributes(XMLDB_TYPE_TEXT, null, null, null, null, null, null, null, 'type');
231
-        if( $dbman->field_exists($table, $field) ) {
232
-            $dbman->change_field_notnull($table, $field, $continue=true, $feedback=true);
231
+        if ($dbman->field_exists($table, $field)) {
232
+            $dbman->change_field_notnull($table, $field, $continue = true, $feedback = true);
233 233
         }
234 234
 
235 235
         // Update the bigbluebuttonbn_log table
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
         $field = new xmldb_field('userid');
239 239
         //$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'bigbluebuttonbnid');
240 240
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'bigbluebuttonbnid');
241
-        if( $dbman->field_exists($table, $field) ) {
242
-            $dbman->change_field_notnull($table, $field, $continue=true, $feedback=true);
241
+        if ($dbman->field_exists($table, $field)) {
242
+            $dbman->change_field_notnull($table, $field, $continue = true, $feedback = true);
243 243
         }
244 244
 
245 245
         upgrade_mod_savepoint(true, 2015080605, 'bigbluebuttonbn');
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  * @copyright 2010-2015 Blindside Networks Inc.
9 9
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
10 10
  */
11
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
12
-require_once(dirname(__FILE__).'/locallib.php');
11
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
12
+require_once(dirname(__FILE__) . '/locallib.php');
13 13
 
14
-$id = required_param('id', PARAM_INT);      // Course Module ID, or
15
-$a  = optional_param('a', 0, PARAM_INT);    // bigbluebuttonbn instance ID
16
-$g  = optional_param('g', 0, PARAM_INT);    // group instance ID
14
+$id = required_param('id', PARAM_INT); // Course Module ID, or
15
+$a  = optional_param('a', 0, PARAM_INT); // bigbluebuttonbn instance ID
16
+$g  = optional_param('g', 0, PARAM_INT); // group instance ID
17 17
 
18 18
 if ($id) {
19 19
     $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 $PAGE->navbar->add(get_string('modulename', 'bigbluebuttonbn'), "index.php?id=$course->id");
37 37
 
38 38
 /// Get all the appropriate data
39
-if (! $bigbluebuttonbns = get_all_instances_in_course('bigbluebuttonbn', $course)) {
39
+if (!$bigbluebuttonbns = get_all_instances_in_course('bigbluebuttonbn', $course)) {
40 40
     notice('There are no instances of bigbluebuttonbn', "../../course/view.php?id=$course->id");
41 41
 }
42 42
 
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 $timenow            = time();
45 45
 $strweek            = get_string('week');
46 46
 $strtopic           = get_string('topic');
47
-$heading_name       = get_string('index_heading_name', 'bigbluebuttonbn' );
48
-$heading_group      = get_string('index_heading_group', 'bigbluebuttonbn' );
47
+$heading_name       = get_string('index_heading_name', 'bigbluebuttonbn');
48
+$heading_group      = get_string('index_heading_group', 'bigbluebuttonbn');
49 49
 $heading_users      = get_string('index_heading_users', 'bigbluebuttonbn');
50 50
 $heading_viewer     = get_string('index_heading_viewer', 'bigbluebuttonbn');
51
-$heading_moderator  = get_string('index_heading_moderator', 'bigbluebuttonbn' );
52
-$heading_actions    = get_string('index_heading_actions', 'bigbluebuttonbn' );
53
-$heading_recording  = get_string('index_heading_recording', 'bigbluebuttonbn' );
51
+$heading_moderator  = get_string('index_heading_moderator', 'bigbluebuttonbn');
52
+$heading_actions    = get_string('index_heading_actions', 'bigbluebuttonbn');
53
+$heading_recording  = get_string('index_heading_recording', 'bigbluebuttonbn');
54 54
 
55 55
 $table = new html_table();
56 56
 
57
-$table->head  = array ($strweek, $heading_name, $heading_group, $heading_users, $heading_viewer, $heading_moderator, $heading_recording, $heading_actions );
58
-$table->align = array ('center', 'left', 'center', 'center', 'center',  'center', 'center' );
57
+$table->head  = array($strweek, $heading_name, $heading_group, $heading_users, $heading_viewer, $heading_moderator, $heading_recording, $heading_actions);
58
+$table->align = array('center', 'left', 'center', 'center', 'center', 'center', 'center');
59 59
 
60 60
 $endpoint = bigbluebuttonbn_get_cfg_server_url();
61 61
 $shared_secret = bigbluebuttonbn_get_cfg_shared_secret();
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
     //
67 67
     // A request to end the meeting
68 68
     //
69
-    if (! $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $a), '*', MUST_EXIST) ) {
69
+    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $a), '*', MUST_EXIST)) {
70 70
         print_error("BigBlueButton ID $a is incorrect");
71 71
     }
72 72
     $course = $DB->get_record('course', array('id' => $bigbluebuttonbn->course), '*', MUST_EXIST);
73 73
     $cm = get_coursemodule_from_instance('bigbluebuttonbn', $bigbluebuttonbn->id, $course->id, false, MUST_EXIST);
74 74
 
75 75
     //User roles
76
-    if( $bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]" ){
76
+    if ($bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]") {
77 77
         //The room that is being used comes from a previous version
78 78
         $moderator = has_capability('mod/bigbluebuttonbn:moderate', $context);
79 79
     } else {
@@ -81,19 +81,19 @@  discard block
 block discarded – undo
81 81
     }
82 82
     $administrator = has_capability('moodle/category:manage', $context);
83 83
 
84
-    if( $moderator || $administrator ) {
84
+    if ($moderator || $administrator) {
85 85
         bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm);
86 86
 
87 87
         echo get_string('index_ending', 'bigbluebuttonbn');
88 88
 
89
-        $meetingID = $bigbluebuttonbn->meetingid.'-'.$course->id.'-'.$bigbluebuttonbn->id;
89
+        $meetingID = $bigbluebuttonbn->meetingid . '-' . $course->id . '-' . $bigbluebuttonbn->id;
90 90
         $modPW = $bigbluebuttonbn->moderatorpass;
91
-        if( $g != '0'  ) {
92
-            $getArray = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID.'['.$g.']', $modPW, $endpoint, $shared_secret ) );
91
+        if ($g != '0') {
92
+            $getArray = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID . '[' . $g . ']', $modPW, $endpoint, $shared_secret));
93 93
         } else {
94
-            $getArray = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $endpoint, $shared_secret ));
94
+            $getArray = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $endpoint, $shared_secret));
95 95
         }
96
-	   redirect('index.php?id='.$id);
96
+	   redirect('index.php?id=' . $id);
97 97
     }
98 98
 }
99 99
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     $cm = get_coursemodule_from_id('bigbluebuttonbn', $bigbluebuttonbn->coursemodule, 0, false, MUST_EXIST);
102 102
 
103 103
     //User roles
104
-    if( $bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]" ){
104
+    if ($bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]") {
105 105
         //The room that is being used comes from a previous version
106 106
         $moderator = has_capability('mod/bigbluebuttonbn:moderate', $context);
107 107
     } else {
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
     }
110 110
     $administrator = has_capability('moodle/category:manage', $context);
111 111
 
112
-    if ( groups_get_activity_groupmode($cm) > 0 ){
113
-        $table->data[] = displayBigBlueButtonRooms($endpoint, $shared_secret, ($administrator || $moderator), $course, $bigbluebuttonbn, (object) array('id'=>0, 'name'=>get_string('allparticipants')));
112
+    if (groups_get_activity_groupmode($cm) > 0) {
113
+        $table->data[] = displayBigBlueButtonRooms($endpoint, $shared_secret, ($administrator || $moderator), $course, $bigbluebuttonbn, (object)array('id'=>0, 'name'=>get_string('allparticipants')));
114 114
         $groups = groups_get_activity_allowed_groups($cm);
115
-        if( isset($groups)) {
116
-            foreach( $groups as $group){
115
+        if (isset($groups)) {
116
+            foreach ($groups as $group) {
117 117
                 $table->data[] = displayBigBlueButtonRooms($endpoint, $shared_secret, ($administrator || $moderator), $course, $bigbluebuttonbn, $group);
118 118
             }
119 119
         }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 echo $OUTPUT->footer();
131 131
 
132 132
 /// Functions
133
-function displayBigBlueButtonRooms($endpoint, $shared_secret, $moderator, $course, $bigbluebuttonbn, $groupObj = null ){
133
+function displayBigBlueButtonRooms($endpoint, $shared_secret, $moderator, $course, $bigbluebuttonbn, $groupObj = null) {
134 134
     $joinURL = null;
135 135
     $group = "-";
136 136
     $users = "-";
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
     $moderatorList = "-";
141 141
     $recording = "-";
142 142
 
143
-    if ( !$bigbluebuttonbn->visible ) {
143
+    if (!$bigbluebuttonbn->visible) {
144 144
         // Nothing to do
145 145
     } else {
146 146
         $modPW = $bigbluebuttonbn->moderatorpass;
147 147
         $attPW = $bigbluebuttonbn->viewerpass;
148 148
 
149
-        $meetingID = $bigbluebuttonbn->meetingid.'-'.$course->id.'-'.$bigbluebuttonbn->id;
149
+        $meetingID = $bigbluebuttonbn->meetingid . '-' . $course->id . '-' . $bigbluebuttonbn->id;
150 150
         //
151 151
         // Output Users in the meeting
152 152
         //
153
-        if( $groupObj == null ){
154
-            $meetingInfo = bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $endpoint, $shared_secret );
155
-            $joinURL = '<a href="view.php?id='.$bigbluebuttonbn->coursemodule.'">'.format_string($bigbluebuttonbn->name).'</a>';
153
+        if ($groupObj == null) {
154
+            $meetingInfo = bigbluebuttonbn_getMeetingInfoArray($meetingID, $modPW, $endpoint, $shared_secret);
155
+            $joinURL = '<a href="view.php?id=' . $bigbluebuttonbn->coursemodule . '">' . format_string($bigbluebuttonbn->name) . '</a>';
156 156
         } else {
157
-            $meetingInfo = bigbluebuttonbn_getMeetingInfoArray( $meetingID.'['.$groupObj->id.']', $modPW, $endpoint, $shared_secret );
158
-            $joinURL = '<a href="view.php?id='.$bigbluebuttonbn->coursemodule.'&group='.$groupObj->id.'">'.format_string($bigbluebuttonbn->name).'</a>';
157
+            $meetingInfo = bigbluebuttonbn_getMeetingInfoArray($meetingID . '[' . $groupObj->id . ']', $modPW, $endpoint, $shared_secret);
158
+            $joinURL = '<a href="view.php?id=' . $bigbluebuttonbn->coursemodule . '&group=' . $groupObj->id . '">' . format_string($bigbluebuttonbn->name) . '</a>';
159 159
             $group = $groupObj->name;
160 160
         }
161 161
         
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             //
164 164
             // The server was unreachable
165 165
             //
166
-            print_error( get_string( 'index_error_unable_display', 'bigbluebuttonbn' ));
166
+            print_error(get_string('index_error_unable_display', 'bigbluebuttonbn'));
167 167
             return;
168 168
         }
169 169
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             // There was an error returned
173 173
             //
174 174
             if ($meetingInfo['messageKey'] == "checksumError") {
175
-                print_error( get_string( 'index_error_checksum', 'bigbluebuttonbn' ));
175
+                print_error(get_string('index_error_checksum', 'bigbluebuttonbn'));
176 176
                 return;
177 177
             }
178 178
 
@@ -184,39 +184,39 @@  discard block
 block discarded – undo
184 184
                 //
185 185
                 // There was an error
186 186
                 //
187
-                $users = $meetingInfo['messageKey'].": ".$meetingInfo['message'];
187
+                $users = $meetingInfo['messageKey'] . ": " . $meetingInfo['message'];
188 188
             }
189 189
         } else {
190 190
             //
191 191
             // The meeting info was returned
192 192
             //
193 193
             if ($meetingInfo['running'] == 'true') {
194
-                if ( $moderator ) {
195
-                    if( $groupObj == null ) {
196
-                        $actions = '<form name="form1" method="post" action=""><INPUT type="hidden" name="id" value="'.$course->id.'"><INPUT type="hidden" name="a" value="'.$bigbluebuttonbn->id.'"><INPUT type="submit" name="submit" value="end" onclick="return confirm(\''. get_string('index_confirm_end', 'bigbluebuttonbn' ).'\')"></form>';
194
+                if ($moderator) {
195
+                    if ($groupObj == null) {
196
+                        $actions = '<form name="form1" method="post" action=""><INPUT type="hidden" name="id" value="' . $course->id . '"><INPUT type="hidden" name="a" value="' . $bigbluebuttonbn->id . '"><INPUT type="submit" name="submit" value="end" onclick="return confirm(\'' . get_string('index_confirm_end', 'bigbluebuttonbn') . '\')"></form>';
197 197
                     } else {
198
-                        $actions = '<form name="form1" method="post" action=""><INPUT type="hidden" name="id" value="'.$course->id.'"><INPUT type="hidden" name="a" value="'.$bigbluebuttonbn->id.'"><INPUT type="hidden" name="g" value="'.$groupObj->id.'"><INPUT type="submit" name="submit" value="end" onclick="return confirm(\''. get_string('index_confirm_end', 'bigbluebuttonbn' ).'\')"></form>';
198
+                        $actions = '<form name="form1" method="post" action=""><INPUT type="hidden" name="id" value="' . $course->id . '"><INPUT type="hidden" name="a" value="' . $bigbluebuttonbn->id . '"><INPUT type="hidden" name="g" value="' . $groupObj->id . '"><INPUT type="submit" name="submit" value="end" onclick="return confirm(\'' . get_string('index_confirm_end', 'bigbluebuttonbn') . '\')"></form>';
199 199
                     }
200 200
                 }
201
-                if ( isset($meetingInfo['recording']) && $meetingInfo['recording'] == 'true' ){ // if it has been set when meeting created, set the variable on/off
202
-                    $recording = get_string('index_enabled', 'bigbluebuttonbn' );
201
+                if (isset($meetingInfo['recording']) && $meetingInfo['recording'] == 'true') { // if it has been set when meeting created, set the variable on/off
202
+                    $recording = get_string('index_enabled', 'bigbluebuttonbn');
203 203
                 }
204 204
                  
205 205
                 $xml = $meetingInfo['attendees'];
206
-                if (count( $xml ) && count( $xml->attendee ) ) {
207
-                    $users = count( $xml->attendee );
206
+                if (count($xml) && count($xml->attendee)) {
207
+                    $users = count($xml->attendee);
208 208
                     $viewer_count = 0;
209 209
                     $moderator_count = 0;
210
-                    foreach ( $xml->attendee as $attendee ) {
211
-                        if ($attendee->role == "MODERATOR" ) {
212
-                            if ( $viewer_count++ > 0 ) {
210
+                    foreach ($xml->attendee as $attendee) {
211
+                        if ($attendee->role == "MODERATOR") {
212
+                            if ($viewer_count++ > 0) {
213 213
                                 $moderatorList .= ", ";
214 214
                             } else {
215 215
                                 $moderatorList = "";
216 216
                             }
217 217
                             $moderatorList .= $attendee->fullName;
218 218
                         } else {
219
-                            if ( $moderator_count++ > 0 ) {
219
+                            if ($moderator_count++ > 0) {
220 220
                                 $viewerList .= ", ";
221 221
                             } else {
222 222
                                 $viewerList = "";
@@ -228,6 +228,6 @@  discard block
 block discarded – undo
228 228
             }
229 229
         }
230 230
 
231
-        return array ($bigbluebuttonbn->section, $joinURL, $group, $users, $viewerList, $moderatorList, $recording, $actions );
231
+        return array($bigbluebuttonbn->section, $joinURL, $group, $users, $viewerList, $moderatorList, $recording, $actions);
232 232
     }
233 233
 }
234 234
\ No newline at end of file
Please login to merge, or discard this patch.
locallib.php 1 patch
Spacing   +277 added lines, -277 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 global $BIGBLUEBUTTONBN_CFG, $CFG;
16 16
 
17
-require_once(dirname(__FILE__).'/lib.php');
17
+require_once(dirname(__FILE__) . '/lib.php');
18 18
 
19 19
 const BIGBLUEBUTTONBN_FORCED = true;
20 20
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
     $log->userid = $bbbsession['userID'];
48 48
     $log->timecreated = time();
49 49
     $log->event = $event;
50
-    if( $event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE)
51
-        $log->meta = '{"record":'.($bbbsession['record']? 'true': 'false').'}';
50
+    if ($event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE)
51
+        $log->meta = '{"record":' . ($bbbsession['record'] ? 'true' : 'false') . '}';
52 52
 
53 53
     $returnid = $DB->insert_record('bigbluebuttonbn_log', $log);
54 54
 }
@@ -56,119 +56,119 @@  discard block
 block discarded – undo
56 56
  ////////////////////////////
57 57
 //  BigBlueButton API Calls  //
58 58
  ////////////////////////////
59
-function bigbluebuttonbn_getJoinURL( $meetingID, $userName, $PW, $SALT, $URL ) {
60
-    $url_join = $URL."api/join?";
61
-    $params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.urlencode($PW);
62
-    return ($url_join.$params.'&checksum='.sha1("join".$params.$SALT) );
59
+function bigbluebuttonbn_getJoinURL($meetingID, $userName, $PW, $SALT, $URL) {
60
+    $url_join = $URL . "api/join?";
61
+    $params = 'meetingID=' . urlencode($meetingID) . '&fullName=' . urlencode($userName) . '&password=' . urlencode($PW);
62
+    return ($url_join . $params . '&checksum=' . sha1("join" . $params . $SALT));
63 63
 }
64 64
 
65
-function bigbluebuttonbn_getCreateMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration=0, $voiceBridge=0, $metadata = array() ) {
66
-    $url_create = $URL."api/create?";
65
+function bigbluebuttonbn_getCreateMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration = 0, $voiceBridge = 0, $metadata = array()) {
66
+    $url_create = $URL . "api/create?";
67 67
 
68
-    $params = 'name='.urlencode($name).'&meetingID='.urlencode($meetingID).'&attendeePW='.urlencode($attendeePW).'&moderatorPW='.urlencode($moderatorPW).'&logoutURL='.urlencode($logoutURL).'&record='.$record;
68
+    $params = 'name=' . urlencode($name) . '&meetingID=' . urlencode($meetingID) . '&attendeePW=' . urlencode($attendeePW) . '&moderatorPW=' . urlencode($moderatorPW) . '&logoutURL=' . urlencode($logoutURL) . '&record=' . $record;
69 69
 
70 70
     $voiceBridge = intval($voiceBridge);
71
-    if ( $voiceBridge > 0 && $voiceBridge < 79999)
72
-        $params .= '&voiceBridge='.$voiceBridge;
71
+    if ($voiceBridge > 0 && $voiceBridge < 79999)
72
+        $params .= '&voiceBridge=' . $voiceBridge;
73 73
 
74 74
     $duration = intval($duration);
75
-    if( $duration > 0 )
76
-        $params .= '&duration='.$duration;
75
+    if ($duration > 0)
76
+        $params .= '&duration=' . $duration;
77 77
 
78
-    if( trim( $welcome ) )
79
-        $params .= '&welcome='.urlencode($welcome);
78
+    if (trim($welcome))
79
+        $params .= '&welcome=' . urlencode($welcome);
80 80
 
81 81
     foreach ($metadata as $key => $value) {
82
-        $params .= '&'.$key.'='.urlencode($value);
82
+        $params .= '&' . $key . '=' . urlencode($value);
83 83
     }
84 84
 
85
-    return ( $url_create.$params.'&checksum='.sha1("create".$params.$SALT) );
85
+    return ($url_create . $params . '&checksum=' . sha1("create" . $params . $SALT));
86 86
 }
87 87
 
88
-function bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) {
89
-    $base_url = $URL."api/isMeetingRunning?";
90
-    $params = 'meetingID='.urlencode($meetingID);
91
-    return ($base_url.$params.'&checksum='.sha1("isMeetingRunning".$params.$SALT) );
88
+function bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT) {
89
+    $base_url = $URL . "api/isMeetingRunning?";
90
+    $params = 'meetingID=' . urlencode($meetingID);
91
+    return ($base_url . $params . '&checksum=' . sha1("isMeetingRunning" . $params . $SALT));
92 92
 }
93 93
 
94
-function bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) {
95
-    $base_url = $URL."api/getMeetingInfo?";
96
-    $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
97
-    return ( $base_url.$params.'&checksum='.sha1("getMeetingInfo".$params.$SALT));
94
+function bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT) {
95
+    $base_url = $URL . "api/getMeetingInfo?";
96
+    $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW);
97
+    return ($base_url . $params . '&checksum=' . sha1("getMeetingInfo" . $params . $SALT));
98 98
 }
99 99
 
100 100
 function bigbluebuttonbn_getMeetingsURL($URL, $SALT) {
101
-    $base_url = $URL."api/getMeetings?";
101
+    $base_url = $URL . "api/getMeetings?";
102 102
     $params = '';
103
-    return ( $base_url.$params.'&checksum='.sha1("getMeetings".$params.$SALT));
103
+    return ($base_url . $params . '&checksum=' . sha1("getMeetings" . $params . $SALT));
104 104
 }
105 105
 
106
-function bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) {
107
-    $base_url = $URL."api/end?";
108
-    $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
109
-    return ( $base_url.$params.'&checksum='.sha1("end".$params.$SALT) );
106
+function bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT) {
107
+    $base_url = $URL . "api/end?";
108
+    $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW);
109
+    return ($base_url . $params . '&checksum=' . sha1("end" . $params . $SALT));
110 110
 }
111 111
 
112
-function bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID=null ) {
113
-    $base_url_record = $URL."api/getRecordings?";
114
-    if( $meetingID == null ) {
112
+function bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID = null) {
113
+    $base_url_record = $URL . "api/getRecordings?";
114
+    if ($meetingID == null) {
115 115
         $params = "";
116 116
     } else {
117
-        $params = "meetingID=".urlencode($meetingID);
117
+        $params = "meetingID=" . urlencode($meetingID);
118 118
     }
119
-    return ($base_url_record.$params."&checksum=".sha1("getRecordings".$params.$SALT) );
119
+    return ($base_url_record . $params . "&checksum=" . sha1("getRecordings" . $params . $SALT));
120 120
 }
121 121
 
122
-function bigbluebuttonbn_getDeleteRecordingsURL( $recordID, $URL, $SALT ) {
123
-    $url_delete = $URL."api/deleteRecordings?";
124
-    $params = 'recordID='.urlencode($recordID);
125
-    return ($url_delete.$params.'&checksum='.sha1("deleteRecordings".$params.$SALT) );
122
+function bigbluebuttonbn_getDeleteRecordingsURL($recordID, $URL, $SALT) {
123
+    $url_delete = $URL . "api/deleteRecordings?";
124
+    $params = 'recordID=' . urlencode($recordID);
125
+    return ($url_delete . $params . '&checksum=' . sha1("deleteRecordings" . $params . $SALT));
126 126
 }
127 127
 
128
-function bigbluebuttonbn_getPublishRecordingsURL( $recordID, $set, $URL, $SALT ) {
129
-    $url_publish = $URL."api/publishRecordings?";
130
-    $params = 'recordID='.$recordID."&publish=".$set;
131
-    return ($url_publish.$params.'&checksum='.sha1("publishRecordings".$params.$SALT) );
128
+function bigbluebuttonbn_getPublishRecordingsURL($recordID, $set, $URL, $SALT) {
129
+    $url_publish = $URL . "api/publishRecordings?";
130
+    $params = 'recordID=' . $recordID . "&publish=" . $set;
131
+    return ($url_publish . $params . '&checksum=' . sha1("publishRecordings" . $params . $SALT));
132 132
 }
133 133
 
134 134
 function bigbluebuttonbn_getCapabilitiesURL($URL, $SALT) {
135
-    $base_url = $URL."api/getCapabilities?";
135
+    $base_url = $URL . "api/getCapabilities?";
136 136
     $params = '';
137
-    return ( $base_url.$params.'&checksum='.sha1("getCapabilities".$params.$SALT));
137
+    return ($base_url . $params . '&checksum=' . sha1("getCapabilities" . $params . $SALT));
138 138
 }
139 139
 
140
-function bigbluebuttonbn_getCreateMeetingArray( $username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record='false', $duration=0, $voiceBridge=0, $metadata=array(), $presentation_name=null, $presentation_url=null ) {
141
-    if( !is_null($presentation_name) && !is_null($presentation_url) ) {
142
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getCreateMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $metadata),
140
+function bigbluebuttonbn_getCreateMeetingArray($username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record = 'false', $duration = 0, $voiceBridge = 0, $metadata = array(), $presentation_name = null, $presentation_url = null) {
141
+    if (!is_null($presentation_name) && !is_null($presentation_url)) {
142
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getCreateMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $metadata),
143 143
                 BIGBLUEBUTTONBN_METHOD_POST,
144
-                "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".$presentation_url."' /></module></modules>"
144
+                "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" . $presentation_url . "' /></module></modules>"
145 145
                 );
146 146
     } else {
147
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getCreateMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $metadata) );
147
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getCreateMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $metadata));
148 148
     }
149 149
 
150
-    if( $xml ) {
151
-        if($xml->meetingID) return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded );
152
-        else return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
150
+    if ($xml) {
151
+        if ($xml->meetingID) return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded);
152
+        else return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
153 153
     }
154 154
     else {
155 155
         return null;
156 156
     }
157 157
 }
158 158
 
159
-function bigbluebuttonbn_getMeetingsArray( $URL, $SALT ) {
160
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL( $URL, $SALT ) );
159
+function bigbluebuttonbn_getMeetingsArray($URL, $SALT) {
160
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingsURL($URL, $SALT));
161 161
 
162
-    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {    //The meetings were returned
162
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey) {    //The meetings were returned
163 163
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
164 164
 
165
-    } else if($xml && $xml->returncode == 'SUCCESS'){                    //If there were meetings already created
165
+    } else if ($xml && $xml->returncode == 'SUCCESS') {                    //If there were meetings already created
166 166
         foreach ($xml->meetings->meeting as $meeting) {
167
-            $meetings[] = array( 'meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running );
167
+            $meetings[] = array('meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running);
168 168
         }
169 169
         return $meetings;
170 170
 
171
-    } else if( $xml ) { //If the xml packet returned failure it displays the message to the user
171
+    } else if ($xml) { //If the xml packet returned failure it displays the message to the user
172 172
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
173 173
 
174 174
     } else { //If the server is unreachable, then prompts the user of the necessary action
@@ -176,21 +176,21 @@  discard block
 block discarded – undo
176 176
     }
177 177
 }
178 178
 
179
-function bigbluebuttonbn_getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) {
180
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
179
+function bigbluebuttonbn_getMeetingInfo($meetingID, $modPW, $URL, $SALT) {
180
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT));
181 181
     return $xml;
182 182
 }
183 183
 
184
-function bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) {
185
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
184
+function bigbluebuttonbn_getMeetingInfoArray($meetingID, $modPW, $URL, $SALT) {
185
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT));
186 186
 
187
-    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null){//The meeting info was returned
188
-        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
187
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null) {//The meeting info was returned
188
+        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
189 189
 
190
-    } else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created
191
-        return array('returncode' => $xml->returncode, 'meetingID' => $xml->meetingID, 'moderatorPW' => $xml->moderatorPW, 'attendeePW' => $xml->attendeePW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, 'running' => $xml->running, 'recording' => $xml->recording, 'startTime' => $xml->startTime, 'endTime' => $xml->endTime, 'participantCount' => $xml->participantCount, 'moderatorCount' => $xml->moderatorCount, 'attendees' => $xml->attendees, 'metadata' => $xml->metadata );
190
+    } else if ($xml && $xml->returncode == 'SUCCESS') { //If there were meetings already created
191
+        return array('returncode' => $xml->returncode, 'meetingID' => $xml->meetingID, 'moderatorPW' => $xml->moderatorPW, 'attendeePW' => $xml->attendeePW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, 'running' => $xml->running, 'recording' => $xml->recording, 'startTime' => $xml->startTime, 'endTime' => $xml->endTime, 'participantCount' => $xml->participantCount, 'moderatorCount' => $xml->moderatorCount, 'attendees' => $xml->attendees, 'metadata' => $xml->metadata);
192 192
 
193
-    } else if( ($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user
193
+    } else if (($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user
194 194
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
195 195
 
196 196
     } else { //If the server is unreachable, then prompts the user of the necessary action
@@ -198,42 +198,42 @@  discard block
 block discarded – undo
198 198
     }
199 199
 }
200 200
 
201
-function bigbluebuttonbn_getRecordingsArray( $meetingIDs, $URL, $SALT ) {
201
+function bigbluebuttonbn_getRecordingsArray($meetingIDs, $URL, $SALT) {
202 202
     $recordings = array();
203 203
 
204
-    if( is_array($meetingIDs) ) {
204
+    if (is_array($meetingIDs)) {
205 205
         // getRecordings is executes using a method POST (supported only on BBB 1.0 and later)
206
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT ), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs );
206
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs);
207 207
     } else {
208 208
         // getRecordings is executes using a method GET supported by any version of BBB
209
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingIDs ) );
209
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingIDs));
210 210
     }
211 211
 
212
-    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {//The meetings were returned
213
-        $recordings = array('returncode' => (string) $xml->returncode, 'message' => (string) $xml->message, 'messageKey' => (string) $xml->messageKey);
212
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey) {//The meetings were returned
213
+        $recordings = array('returncode' => (string)$xml->returncode, 'message' => (string)$xml->message, 'messageKey' => (string)$xml->messageKey);
214 214
 
215
-    } else if($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)){ //If there were meetings already created
215
+    } else if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created
216 216
         foreach ($xml->recordings->recording as $recording) {
217 217
             $playbackArray = array();
218
-            foreach ( $recording->playback->format as $format ){
219
-                $playbackArray[(string) $format->type] = array( 'type' => (string) $format->type, 'url' => (string) $format->url );
218
+            foreach ($recording->playback->format as $format) {
219
+                $playbackArray[(string)$format->type] = array('type' => (string)$format->type, 'url' => (string)$format->url);
220 220
             }
221 221
 
222 222
             //Add the metadata to the recordings array
223 223
             $metadataArray = array();
224 224
             $metadata = get_object_vars($recording->metadata);
225 225
             foreach ($metadata as $key => $value) {
226
-                if(is_object($value)) $value = '';
227
-                $metadataArray['meta_'.$key] = $value;
226
+                if (is_object($value)) $value = '';
227
+                $metadataArray['meta_' . $key] = $value;
228 228
             }
229 229
 
230
-            $recordings[] = array( 'recordID' => (string) $recording->recordID, 'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name, 'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime, 'endTime' => (string) $recording->endTime, 'playbacks' => $playbackArray ) + $metadataArray;
230
+            $recordings[] = array('recordID' => (string)$recording->recordID, 'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name, 'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime, 'endTime' => (string)$recording->endTime, 'playbacks' => $playbackArray) + $metadataArray;
231 231
         }
232 232
 
233 233
         usort($recordings, 'bigbluebuttonbn_recordingBuildSorter');
234 234
 
235
-    } else if( $xml ) { //If the xml packet returned failure it displays the message to the user
236
-        $recordings = array('returncode' => (string) $xml->returncode, 'message' => (string) $xml->message, 'messageKey' => (string) $xml->messageKey);
235
+    } else if ($xml) { //If the xml packet returned failure it displays the message to the user
236
+        $recordings = array('returncode' => (string)$xml->returncode, 'message' => (string)$xml->message, 'messageKey' => (string)$xml->messageKey);
237 237
 
238 238
     } else { //If the server is unreachable, then prompts the user of the necessary action
239 239
     }
@@ -241,37 +241,37 @@  discard block
 block discarded – undo
241 241
     return $recordings;
242 242
 }
243 243
 
244
-function bigbluebuttonbn_getRecordingArray( $recordingID, $meetingID, $URL, $SALT ) {
244
+function bigbluebuttonbn_getRecordingArray($recordingID, $meetingID, $URL, $SALT) {
245 245
     $recording = array();
246 246
 
247
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID ) );
247
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID));
248 248
 
249
-    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {//The meetings were returned
250
-        $recordings = array('returncode' => (string) $xml->returncode, 'message' => (string) $xml->message, 'messageKey' => (string) $xml->messageKey);
249
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey) {//The meetings were returned
250
+        $recordings = array('returncode' => (string)$xml->returncode, 'message' => (string)$xml->message, 'messageKey' => (string)$xml->messageKey);
251 251
 
252
-    } else if($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)){ //If there were meetings already created
252
+    } else if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created
253 253
         foreach ($xml->recordings->recording as $recording) {
254
-            if( $recording->recordID == $recordingID ) {
254
+            if ($recording->recordID == $recordingID) {
255 255
                 $playbackArray = array();
256
-                foreach ( $recording->playback->format as $format ){
257
-                    $playbackArray[(string) $format->type] = array( 'type' => (string) $format->type, 'url' => (string) $format->url );
256
+                foreach ($recording->playback->format as $format) {
257
+                    $playbackArray[(string)$format->type] = array('type' => (string)$format->type, 'url' => (string)$format->url);
258 258
                 }
259 259
 
260 260
                 //Add the metadata to the recordings array
261 261
                 $metadataArray = array();
262 262
                 $metadata = get_object_vars($recording->metadata);
263 263
                 foreach ($metadata as $key => $value) {
264
-                    if(is_object($value)) $value = '';
265
-                    $metadataArray['meta_'.$key] = $value;
264
+                    if (is_object($value)) $value = '';
265
+                    $metadataArray['meta_' . $key] = $value;
266 266
                 }
267 267
 
268
-                $recording = array( 'recordID' => (string) $recording->recordID, 'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name, 'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime, 'endTime' => (string) $recording->endTime, 'playbacks' => $playbackArray ) + $metadataArray;
268
+                $recording = array('recordID' => (string)$recording->recordID, 'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name, 'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime, 'endTime' => (string)$recording->endTime, 'playbacks' => $playbackArray) + $metadataArray;
269 269
                 break;
270 270
             }
271 271
         }
272 272
 
273
-    } else if( $xml ) { //If the xml packet returned failure it displays the message to the user
274
-        $recording = array('returncode' => (string) $xml->returncode, 'message' => (string) $xml->message, 'messageKey' => (string) $xml->messageKey);
273
+    } else if ($xml) { //If the xml packet returned failure it displays the message to the user
274
+        $recording = array('returncode' => (string)$xml->returncode, 'message' => (string)$xml->message, 'messageKey' => (string)$xml->messageKey);
275 275
 
276 276
     } else { //If the server is unreachable, then prompts the user of the necessary action
277 277
     }
@@ -279,36 +279,36 @@  discard block
 block discarded – undo
279 279
     return $recording;
280 280
 }
281 281
 
282
-function bigbluebuttonbn_recordingBuildSorter($a, $b){
283
-    if( $a['startTime'] < $b['startTime']) return -1;
284
-    else if( $a['startTime'] == $b['startTime']) return 0;
282
+function bigbluebuttonbn_recordingBuildSorter($a, $b) {
283
+    if ($a['startTime'] < $b['startTime']) return -1;
284
+    else if ($a['startTime'] == $b['startTime']) return 0;
285 285
     else return 1;
286 286
 }
287 287
 
288
-function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) {
289
-    $ids = 	explode(",", $recordIDs);
290
-    foreach( $ids as $id){
291
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) );
292
-        if( $xml && $xml->returncode != 'SUCCESS' )
288
+function bigbluebuttonbn_doDeleteRecordings($recordIDs, $URL, $SALT) {
289
+    $ids = explode(",", $recordIDs);
290
+    foreach ($ids as $id) {
291
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT));
292
+        if ($xml && $xml->returncode != 'SUCCESS')
293 293
             return false;
294 294
     }
295 295
     return true;
296 296
 }
297 297
 
298
-function bigbluebuttonbn_doPublishRecordings( $recordIDs, $set, $URL, $SALT ) {
299
-    $ids = 	explode(",", $recordIDs);
300
-    foreach( $ids as $id){
301
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) );
302
-        if( $xml && $xml->returncode != 'SUCCESS' )
298
+function bigbluebuttonbn_doPublishRecordings($recordIDs, $set, $URL, $SALT) {
299
+    $ids = explode(",", $recordIDs);
300
+    foreach ($ids as $id) {
301
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT));
302
+        if ($xml && $xml->returncode != 'SUCCESS')
303 303
             return false;
304 304
     }
305 305
     return true;
306 306
 }
307 307
 
308
-function bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $URL, $SALT ) {
309
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) );
308
+function bigbluebuttonbn_doEndMeeting($meetingID, $modPW, $URL, $SALT) {
309
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT));
310 310
 
311
-    if( $xml ) { //If the xml packet returned failure it displays the message to the user
311
+    if ($xml) { //If the xml packet returned failure it displays the message to the user
312 312
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
313 313
     }
314 314
     else { //If the server is unreachable, then prompts the user of the necessary action
@@ -316,44 +316,44 @@  discard block
 block discarded – undo
316 316
     }
317 317
 }
318 318
 
319
-function bigbluebuttonbn_isMeetingRunning( $meetingID, $URL, $SALT ) {
320
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) );
321
-    if ( $xml && $xml->returncode == 'SUCCESS' ) {
322
-        return ( ( $xml->running == 'true' ) ? true : false);
319
+function bigbluebuttonbn_isMeetingRunning($meetingID, $URL, $SALT) {
320
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT));
321
+    if ($xml && $xml->returncode == 'SUCCESS') {
322
+        return (($xml->running == 'true') ? true : false);
323 323
     } else {
324
-        return ( false );
324
+        return (false);
325 325
     }
326 326
 }
327 327
 
328 328
 
329
-function bigbluebuttonbn_getServerVersion( $URL ){
330
-    $xml = bigbluebuttonbn_wrap_xml_load_file( $URL."api" );
331
-    if ( $xml && $xml->returncode == 'SUCCESS' ) {
329
+function bigbluebuttonbn_getServerVersion($URL) {
330
+    $xml = bigbluebuttonbn_wrap_xml_load_file($URL . "api");
331
+    if ($xml && $xml->returncode == 'SUCCESS') {
332 332
         return $xml->version;
333 333
     } else {
334 334
         return NULL;
335 335
     }
336 336
 }
337 337
 
338
-function bigbluebuttonbn_getMeetingXML( $meetingID, $URL, $SALT ) {
339
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) );
340
-    if ( $xml && $xml->returncode == 'SUCCESS') {
341
-        return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
338
+function bigbluebuttonbn_getMeetingXML($meetingID, $URL, $SALT) {
339
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT));
340
+    if ($xml && $xml->returncode == 'SUCCESS') {
341
+        return (str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
342 342
     } else {
343 343
         return 'false';
344 344
     }
345 345
 }
346 346
 
347
-function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) {
347
+function bigbluebuttonbn_wrap_xml_load_file($url, $method = BIGBLUEBUTTONBN_METHOD_GET, $data = null) {
348 348
     if (extension_loaded('curl')) {
349 349
         $c = new curl();
350
-        $c->setopt( Array( "SSL_VERIFYPEER" => true));
351
-        if( $method == BIGBLUEBUTTONBN_METHOD_POST ) {
352
-            if( !is_null($data) ) {
353
-                if( !is_array($data) ) {
350
+        $c->setopt(Array("SSL_VERIFYPEER" => true));
351
+        if ($method == BIGBLUEBUTTONBN_METHOD_POST) {
352
+            if (!is_null($data)) {
353
+                if (!is_array($data)) {
354 354
                     $options['CURLOPT_HTTPHEADER'] = array(
355 355
                             'Content-Type: text/xml',
356
-                            'Content-Length: '.strlen($data),
356
+                            'Content-Length: ' . strlen($data),
357 357
                             'Content-Language: en-US'
358 358
                         );
359 359
                     $response = $c->post($url, $data, $options);
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
             try {
376 376
                 $xml = new SimpleXMLElement($response, LIBXML_NOCDATA);
377 377
                 return $xml;
378
-            } catch (Exception $e){
378
+            } catch (Exception $e) {
379 379
                 libxml_use_internal_errors($previous);
380 380
                 error_log("The XML response is not correct on wrap_simplexml_load_file");
381 381
                 error_log($response);
@@ -389,18 +389,18 @@  discard block
 block discarded – undo
389 389
     } else {
390 390
         $previous = libxml_use_internal_errors(true);
391 391
         try {
392
-            $xml = simplexml_load_file($url,'SimpleXMLElement', LIBXML_NOCDATA);
392
+            $xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA);
393 393
             return $xml;
394
-        } catch  (Exception $e){
394
+        } catch (Exception $e) {
395 395
             libxml_use_internal_errors($previous);
396 396
             return NULL;
397 397
         }
398 398
     }
399 399
 }
400 400
 
401
-function bigbluebuttonbn_get_role_name($role_shortname){
401
+function bigbluebuttonbn_get_role_name($role_shortname) {
402 402
     $role = bigbluebuttonbn_get_db_moodle_roles($role_shortname);
403
-    if( $role != null && $role->name != "") {
403
+    if ($role != null && $role->name != "") {
404 404
         $role_name = $role->name;
405 405
     } else {
406 406
         switch ($role_shortname) {
@@ -420,13 +420,13 @@  discard block
 block discarded – undo
420 420
     return $role_name;
421 421
 }
422 422
 
423
-function bigbluebuttonbn_get_roles($rolename='all', $format='json'){
423
+function bigbluebuttonbn_get_roles($rolename = 'all', $format = 'json') {
424 424
     $roles = bigbluebuttonbn_get_db_moodle_roles($rolename);
425 425
     $roles_array = array();
426
-    foreach($roles as $role){
427
-        if( $format=='json' ) {
426
+    foreach ($roles as $role) {
427
+        if ($format == 'json') {
428 428
             array_push($roles_array,
429
-                    array( "id" => $role->shortname,
429
+                    array("id" => $role->shortname,
430 430
                         "name" => bigbluebuttonbn_get_role_name($role->shortname)
431 431
                     )
432 432
             );
@@ -437,19 +437,19 @@  discard block
 block discarded – undo
437 437
     return $roles_array;
438 438
 }
439 439
 
440
-function bigbluebuttonbn_get_roles_json($rolename='all'){
440
+function bigbluebuttonbn_get_roles_json($rolename = 'all') {
441 441
     return json_encode(bigbluebuttonbn_get_roles($rolename));
442 442
 }
443 443
 
444
-function bigbluebuttonbn_get_users_json($users, $full=false) {
445
-    if( $full ) {
444
+function bigbluebuttonbn_get_users_json($users, $full = false) {
445
+    if ($full) {
446 446
         return json_encode($users);
447 447
     } else {
448 448
         $users_array = array();
449
-        foreach($users as $user){
449
+        foreach ($users as $user) {
450 450
             array_push($users_array,
451
-                    array( "id" => $user->id,
452
-                            "name" => $user->firstname.' '.$user->lastname
451
+                    array("id" => $user->id,
452
+                            "name" => $user->firstname . ' ' . $user->lastname
453 453
                     )
454 454
             );
455 455
         }
@@ -457,15 +457,15 @@  discard block
 block discarded – undo
457 457
     }
458 458
 }
459 459
 
460
-function bigbluebuttonbn_get_participant_list($bigbluebuttonbn=null, $context=null){
460
+function bigbluebuttonbn_get_participant_list($bigbluebuttonbn = null, $context = null) {
461 461
     global $CFG, $USER;
462 462
 
463 463
     $participant_list_array = array();
464 464
 
465
-    if( $bigbluebuttonbn != null ) {
465
+    if ($bigbluebuttonbn != null) {
466 466
         $participant_list = json_decode($bigbluebuttonbn->participants);
467 467
         if (is_array($participant_list)) {
468
-            foreach($participant_list as $participant){
468
+            foreach ($participant_list as $participant) {
469 469
                 array_push($participant_list_array,
470 470
                         array(
471 471
                             "selectiontype" => $participant->selectiontype,
@@ -485,16 +485,16 @@  discard block
 block discarded – undo
485 485
         );
486 486
 
487 487
         $moderator_defaults = bigbluebuttonbn_get_cfg_moderator_default();
488
-        if ( !isset($moderator_defaults) ) {
488
+        if (!isset($moderator_defaults)) {
489 489
             $moderator_defaults = array('owner');
490 490
         } else {
491 491
             $moderator_defaults = explode(',', $moderator_defaults);
492 492
         }
493
-        foreach( $moderator_defaults as $moderator_default ) {
494
-            if( $moderator_default == 'owner' ) {
493
+        foreach ($moderator_defaults as $moderator_default) {
494
+            if ($moderator_default == 'owner') {
495 495
                 $users = bigbluebuttonbn_get_users($context);
496
-                foreach( $users as $user ){
497
-                    if( $user->id == $USER->id ){
496
+                foreach ($users as $user) {
497
+                    if ($user->id == $USER->id) {
498 498
                         array_push($participant_list_array,
499 499
                                 array(
500 500
                                         "selectiontype" => "user",
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     return $participant_list_array;
521 521
 }
522 522
 
523
-function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid=null){
523
+function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid = null) {
524 524
     return json_encode(bigbluebuttonbn_get_participant_list($bigbluebuttonbnid));
525 525
 }
526 526
 
@@ -529,21 +529,21 @@  discard block
 block discarded – undo
529 529
 
530 530
     if (is_array($participant_list)) {
531 531
         // Iterate looking for all configuration
532
-        foreach($participant_list as $participant){
533
-            if( $participant->selectiontype == 'all' ) {
534
-                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
532
+        foreach ($participant_list as $participant) {
533
+            if ($participant->selectiontype == 'all') {
534
+                if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR)
535 535
                     return true;
536 536
             }
537 537
         }
538 538
 
539 539
         //Iterate looking for roles
540 540
         $db_moodle_roles = bigbluebuttonbn_get_db_moodle_roles();
541
-        foreach($participant_list as $participant){
542
-            if( $participant->selectiontype == 'role' ) {
543
-                foreach( $roles as $role ) {
541
+        foreach ($participant_list as $participant) {
542
+            if ($participant->selectiontype == 'role') {
543
+                foreach ($roles as $role) {
544 544
                     $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->roleid);
545
-                    if( $participant->selectionid == $db_moodle_role->shortname ) {
546
-                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
545
+                    if ($participant->selectionid == $db_moodle_role->shortname) {
546
+                        if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR)
547 547
                             return true;
548 548
                     }
549 549
                 }
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
         }
552 552
 
553 553
         //Iterate looking for users
554
-        foreach($participant_list as $participant){
555
-            if( $participant->selectiontype == 'user' ) {
556
-                if( $participant->selectionid == $user ) {
557
-                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
554
+        foreach ($participant_list as $participant) {
555
+            if ($participant->selectiontype == 'user') {
556
+                if ($participant->selectionid == $user) {
557
+                    if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR)
558 558
                         return true;
559 559
                 }
560 560
             }
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 }
566 566
 
567 567
 function bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role_id) {
568
-    foreach( $db_moodle_roles as $db_moodle_role ){
569
-        if( $role_id ==  $db_moodle_role->id ) {
568
+    foreach ($db_moodle_roles as $db_moodle_role) {
569
+        if ($role_id == $db_moodle_role->id) {
570 570
             return $db_moodle_role;
571 571
         }
572 572
     }
@@ -574,22 +574,22 @@  discard block
 block discarded – undo
574 574
 
575 575
 function bigbluebuttonbn_get_error_key($messageKey, $defaultKey = null) {
576 576
     $key = $defaultKey;
577
-    if ( $messageKey == "checksumError" ){
577
+    if ($messageKey == "checksumError") {
578 578
         $key = 'index_error_checksum';
579
-    } else if ( $messageKey == 'maxConcurrent' ) {
579
+    } else if ($messageKey == 'maxConcurrent') {
580 580
         $key = 'view_error_max_concurrent';
581 581
     }
582 582
     return $key;
583 583
 }
584 584
 
585
-function bigbluebuttonbn_voicebridge_unique($voicebridge, $id=null) {
585
+function bigbluebuttonbn_voicebridge_unique($voicebridge, $id = null) {
586 586
     global $DB;
587 587
     $is_unique = true;
588
-    if( $voicebridge != 0 ) {
588
+    if ($voicebridge != 0) {
589 589
         $table = "bigbluebuttonbn";
590
-        $select = "voicebridge = ".$voicebridge;
591
-        if( $id ) $select .= " AND id <> ".$id;
592
-        if ( $rooms = $DB->get_records_select($table, $select)  ) {
590
+        $select = "voicebridge = " . $voicebridge;
591
+        if ($id) $select .= " AND id <> " . $id;
592
+        if ($rooms = $DB->get_records_select($table, $select)) {
593 593
             $is_unique = false;
594 594
         }
595 595
     }
@@ -602,8 +602,8 @@  discard block
 block discarded – undo
602 602
 
603 603
     $duration = 0;
604 604
     $now = time();
605
-    if( $closingtime > 0 && $now < $closingtime ) {
606
-        $duration = ceil(($closingtime - $now)/60);
605
+    if ($closingtime > 0 && $now < $closingtime) {
606
+        $duration = ceil(($closingtime - $now) / 60);
607 607
         $compensation_time = intval(bigbluebuttonbn_get_cfg_scheduled_duration_compensation());
608 608
         $duration = intval($duration) + $compensation_time;
609 609
     }
@@ -611,13 +611,13 @@  discard block
 block discarded – undo
611 611
     return $duration;
612 612
 }
613 613
 
614
-function bigbluebuttonbn_get_presentation_array($context, $presentation, $id=null) {
614
+function bigbluebuttonbn_get_presentation_array($context, $presentation, $id = null) {
615 615
     $presentation_name = null;
616 616
     $presentation_url = null;
617 617
     $presentation_icon = null;
618 618
     $presentation_mimetype_description = null;
619 619
 
620
-    if( !empty($presentation) ) {
620
+    if (!empty($presentation)) {
621 621
         $fs = get_file_storage();
622 622
         $files = $fs->get_area_files($context->id, 'mod_bigbluebuttonbn', 'presentation', 0, 'itemid, filepath, filename', false);
623 623
         if (count($files) < 1) {
@@ -631,12 +631,12 @@  discard block
 block discarded – undo
631 631
             $presentation_icon = file_file_icon($file, 24);
632 632
             $presentation_mimetype_description = get_mimetype_description($file);
633 633
 
634
-            if( !is_null($id) ) {
634
+            if (!is_null($id)) {
635 635
                 //Create the nonce component for granting a temporary public access
636 636
                 $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache');
637 637
                 $presentation_nonce_key = sha1($id);
638 638
                 $presentation_nonce_value = bigbluebuttonbn_generate_nonce(); 
639
-                $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => 0 ));
639
+                $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => 0));
640 640
 
641 641
                 //The item id was adapted for granting public access to the presentation once in order to allow BigBlueButton to gather the file
642 642
                 $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), $presentation_nonce_value, $file->get_filepath(), $file->get_filename());
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
         }
648 648
     }
649 649
 
650
-    $presentation_array = array( "url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description);
650
+    $presentation_array = array("url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description);
651 651
 
652 652
     return $presentation_array;
653 653
 }
@@ -657,13 +657,13 @@  discard block
 block discarded – undo
657 657
     $mt = microtime();
658 658
     $rand = mt_rand();
659 659
 
660
-    return md5($mt.$rand);
660
+    return md5($mt . $rand);
661 661
 }
662 662
 
663
-function bigbluebuttonbn_random_password( $length = 8 ) {
663
+function bigbluebuttonbn_random_password($length = 8) {
664 664
 
665 665
     $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
666
-    $password = substr( str_shuffle( $chars ), 0, $length );
666
+    $password = substr(str_shuffle($chars), 0, $length);
667 667
 
668 668
     return $password;
669 669
 }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
     global $CFG;
756 756
 
757 757
     $version_major = bigbluebuttonbn_get_moodle_version_major();
758
-    if ( $version_major < '2014051200' ) {
758
+    if ($version_major < '2014051200') {
759 759
         //This is valid before v2.7
760 760
         bigbluebuttonbn_event_log_legacy($event_type, $bigbluebuttonbn, $context, $cm);
761 761
 
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
     }
766 766
 }
767 767
 
768
-function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced=false) {
768
+function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced = false) {
769 769
     global $CFG;
770 770
 
771 771
     $recordings = array();
@@ -781,19 +781,19 @@  discard block
 block discarded – undo
781 781
     $result = $cache->get($meetingid);
782 782
     $meeting_info = json_decode($result['meeting_info']);
783 783
     $meeting_info->participantCount += 1;
784
-    if( $is_moderator ) {
784
+    if ($is_moderator) {
785 785
         $meeting_info->moderatorCount += 1;
786 786
     }
787
-    $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info) ));
787
+    $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info)));
788 788
 }
789 789
 
790 790
 function bigbluebuttonbn_bbb_broker_is_meeting_running($meeting_info) {
791
-    $meeting_running = ( isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS' );
791
+    $meeting_running = (isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS');
792 792
 
793 793
     return $meeting_running;
794 794
 }
795 795
 
796
-function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced=false) {
796
+function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced = false) {
797 797
     global $CFG;
798 798
 
799 799
     $meeting_info = array();
@@ -804,19 +804,19 @@  discard block
 block discarded – undo
804 804
     $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache');
805 805
     $result = $cache->get($meetingid);
806 806
     $now = time();
807
-    if( isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced ) {
807
+    if (isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced) {
808 808
         //Use the value in the cache
809 809
         $meeting_info = json_decode($result['meeting_info']);
810 810
     } else {
811 811
         //Ping again and refresh the cache
812
-        $meeting_info = (array) bigbluebuttonbn_getMeetingInfo( $meetingid, $password, $endpoint, $shared_secret );
813
-        $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info) ));
812
+        $meeting_info = (array)bigbluebuttonbn_getMeetingInfo($meetingid, $password, $endpoint, $shared_secret);
813
+        $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info)));
814 814
     }
815 815
 
816 816
     return $meeting_info;
817 817
 }
818 818
 
819
-function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password){
819
+function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password) {
820 820
     global $CFG;
821 821
 
822 822
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
@@ -825,16 +825,16 @@  discard block
 block discarded – undo
825 825
     bigbluebuttonbn_doEndMeeting($meetingid, $password, $endpoint, $shared_secret);
826 826
 }
827 827
 
828
-function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish=true){
828
+function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish = true) {
829 829
     global $CFG;
830 830
 
831 831
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
832 832
     $shared_secret = bigbluebuttonbn_get_cfg_shared_secret();
833 833
 
834
-    bigbluebuttonbn_doPublishRecordings($recordingid, ($publish)? 'true': 'false', $endpoint, $shared_secret);
834
+    bigbluebuttonbn_doPublishRecordings($recordingid, ($publish) ? 'true' : 'false', $endpoint, $shared_secret);
835 835
 }
836 836
 
837
-function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid){
837
+function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid) {
838 838
     global $CFG;
839 839
 
840 840
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
@@ -846,18 +846,18 @@  discard block
 block discarded – undo
846 846
 function bigbluebuttonbn_bbb_broker_validate_parameters($params) {
847 847
     $error = '';
848 848
 
849
-    if ( !isset($params['callback']) ) {
849
+    if (!isset($params['callback'])) {
850 850
         $error = $bigbluebuttonbn_bbb_broker_add_error($error, 'This call must include a javascript callback.');
851 851
     }
852 852
 
853
-    if ( !isset($params['action']) ) {
853
+    if (!isset($params['action'])) {
854 854
         $error = $bigbluebuttonbn_bbb_broker_add_error($error, 'Action parameter must be included.');
855 855
     } else {
856
-        switch ( strtolower($params['action']) ){
856
+        switch (strtolower($params['action'])) {
857 857
             case 'server_ping':
858 858
             case 'meeting_info':
859 859
             case 'meeting_end':
860
-                if ( !isset($params['id']) ) {
860
+                if (!isset($params['id'])) {
861 861
                     $error = $bigbluebuttonbn_bbb_broker_add_error($error, 'The meetingID must be specified.');
862 862
                 }
863 863
                 break;
@@ -866,28 +866,28 @@  discard block
 block discarded – undo
866 866
             case 'recording_publish':
867 867
             case 'recording_unpublish':
868 868
             case 'recording_delete':
869
-                if ( !isset($params['id']) ) {
869
+                if (!isset($params['id'])) {
870 870
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The recordingID must be specified.');
871 871
                 }
872 872
                 break;
873 873
             case 'recording_ready':
874
-                if( empty($params['signed_parameters']) ) {
874
+                if (empty($params['signed_parameters'])) {
875 875
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'A JWT encoded string must be included as [signed_parameters].');
876 876
                 }
877 877
                 break;
878 878
             default:
879
-                $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action '.$params['action'].' can not be performed.');
879
+                $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action ' . $params['action'] . ' can not be performed.');
880 880
         }
881 881
     }
882 882
 
883 883
     return $error;
884 884
 }
885 885
 
886
-function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg='') {
886
+function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg = '') {
887 887
     $error = $org_msg;
888 888
 
889
-    if( !empty($new_msg) ) {
890
-        if( !empty($error) ) $error .= ' ';
889
+    if (!empty($new_msg)) {
890
+        if (!empty($error)) $error .= ' ';
891 891
         $error .= $new_msg;
892 892
     }
893 893
 
@@ -899,27 +899,27 @@  discard block
 block discarded – undo
899 899
 
900 900
     $row = null;
901 901
 
902
-    if ( $bbbsession['managerecordings'] || $recording['published'] == 'true' ) {
902
+    if ($bbbsession['managerecordings'] || $recording['published'] == 'true') {
903 903
         $length = 0;
904
-        $endTime = isset($recording['endTime'])? floatval($recording['endTime']):0;
904
+        $endTime = isset($recording['endTime']) ? floatval($recording['endTime']) : 0;
905 905
         $endTime = $endTime - ($endTime % 1000);
906
-        $startTime = isset($recording['startTime'])? floatval($recording['startTime']):0;
906
+        $startTime = isset($recording['startTime']) ? floatval($recording['startTime']) : 0;
907 907
         $startTime = $startTime - ($startTime % 1000);
908 908
         $duration = intval(($endTime - $startTime) / 60000);
909 909
 
910 910
         //$meta_course = isset($recording['meta_context'])?str_replace('"', '\"', $recording['meta_context']):'';
911 911
         //For backward compatibility
912
-        if( isset($recording['meta_contextactivity']) ) {
912
+        if (isset($recording['meta_contextactivity'])) {
913 913
             $meta_activity = str_replace('"', '\"', $recording['meta_contextactivity']);
914
-        } if( isset($recording['meta_bbb-recording-name']) ) {
914
+        } if (isset($recording['meta_bbb-recording-name'])) {
915 915
             $meta_activity = str_replace('"', '\"', $recording['meta_bbb-recording-name']);
916 916
         } else {
917 917
             $meta_activity = str_replace('"', '\"', $recording['meetingName']);
918 918
         }
919 919
 
920
-        if( isset($recording['meta_contextactivitydescription']) ) {
920
+        if (isset($recording['meta_contextactivitydescription'])) {
921 921
             $meta_description = str_replace('"', '\"', $recording['meta_contextactivitydescription']);
922
-        } else if( isset($recording['meta_bbb-recording-description']) ) {
922
+        } else if (isset($recording['meta_bbb-recording-description'])) {
923 923
             $meta_description = str_replace('"', '\"', $recording['meta_bbb-recording-description']);
924 924
         } else {
925 925
             $meta_description = '';
@@ -928,12 +928,12 @@  discard block
 block discarded – undo
928 928
         $actionbar = '';
929 929
         $params['id'] = $bbbsession['cm']->id;
930 930
         $params['recordingid'] = $recording['recordID'];
931
-        if ( $bbbsession['managerecordings'] ) {
931
+        if ($bbbsession['managerecordings']) {
932 932
             $url = '#';
933 933
             $action = null;
934 934
 
935 935
             ///Set action [show|hide]
936
-            if ( $recording['published'] == 'true' ){
936
+            if ($recording['published'] == 'true') {
937 937
                 $manage_tag = 'hide';
938 938
                 $manage_action = 'unpublish';
939 939
             } else {
@@ -941,36 +941,36 @@  discard block
 block discarded – undo
941 941
                 $manage_action = 'publish';
942 942
             }
943 943
 
944
-            if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
944
+            if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
945 945
                 //With icon for publish/unpublish
946
-                $icon_attributes = array('id' => 'recording-btn-'.$manage_action.'-'.$recording['recordID']);
947
-                $icon = new pix_icon('t/'.$manage_tag, get_string($manage_tag), 'moodle', $icon_attributes);
948
-                $link_attributes = array('id' => 'recording-link-'.$manage_action.'-'.$recording['recordID'], 'onclick' => 'M.mod_bigbluebuttonbn.broker_manageRecording("'.$manage_action.'", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");');
946
+                $icon_attributes = array('id' => 'recording-btn-' . $manage_action . '-' . $recording['recordID']);
947
+                $icon = new pix_icon('t/' . $manage_tag, get_string($manage_tag), 'moodle', $icon_attributes);
948
+                $link_attributes = array('id' => 'recording-link-' . $manage_action . '-' . $recording['recordID'], 'onclick' => 'M.mod_bigbluebuttonbn.broker_manageRecording("' . $manage_action . '", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");');
949 949
                 $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
950 950
 
951 951
                 //With icon for delete
952
-                $icon_attributes = array('id' => 'recording-btn-delete-'.$recording['recordID']);
952
+                $icon_attributes = array('id' => 'recording-btn-delete-' . $recording['recordID']);
953 953
                 $icon = new pix_icon('t/delete', get_string('delete'), 'moodle', $icon_attributes);
954
-                $link_attributes = array('id' => 'recording-link-delete-'.$recording['recordID'], 'onclick' => 'if(confirm("'.get_string('view_recording_delete_confirmation', 'bigbluebuttonbn').'?")) M.mod_bigbluebuttonbn.broker_manageRecording("delete", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");');
954
+                $link_attributes = array('id' => 'recording-link-delete-' . $recording['recordID'], 'onclick' => 'if(confirm("' . get_string('view_recording_delete_confirmation', 'bigbluebuttonbn') . '?")) M.mod_bigbluebuttonbn.broker_manageRecording("delete", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");');
955 955
                 $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
956 956
 
957 957
             } else {
958 958
                 //With text for publish/unpublish
959
-                $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag), $action, array('title' => get_string($manage_tag), 'class' => 'btn btn-xs', 'onclick' => 'M.mod_bigbluebuttonbn.broker_manageRecording("'.$manage_action.'", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");') );
959
+                $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag), $action, array('title' => get_string($manage_tag), 'class' => 'btn btn-xs', 'onclick' => 'M.mod_bigbluebuttonbn.broker_manageRecording("' . $manage_action . '", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");'));
960 960
                 $actionbar .= "&nbsp;";
961 961
 
962 962
                 //With text for delete
963
-                $actionbar .= $OUTPUT->action_link($url, get_string('delete'), $action, array('title' => get_string('delete'), 'class' => 'btn btn-xs btn-danger', 'onclick' => 'if(confirm("Are you sure to delete?")) M.mod_bigbluebuttonbn.broker_manageRecording("delete", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");') );
963
+                $actionbar .= $OUTPUT->action_link($url, get_string('delete'), $action, array('title' => get_string('delete'), 'class' => 'btn btn-xs btn-danger', 'onclick' => 'if(confirm("Are you sure to delete?")) M.mod_bigbluebuttonbn.broker_manageRecording("delete", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");'));
964 964
             }
965 965
         }
966 966
 
967 967
         if ($recording['published'] == 'true') {
968
-            $recording_types = '<div id="playbacks-'.$recording['recordID'].'">';
968
+            $recording_types = '<div id="playbacks-' . $recording['recordID'] . '">';
969 969
         } else {
970
-            $recording_types = '<div id="playbacks-'.$recording['recordID'].'" hidden>';
970
+            $recording_types = '<div id="playbacks-' . $recording['recordID'] . '" hidden>';
971 971
         }
972
-        foreach ( $recording['playbacks'] as $playback ) {
973
-            $recording_types .= $OUTPUT->action_link($playback['url'], get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn'), null, array('title' => get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn'), 'target' => '_new') ).'&#32;';
972
+        foreach ($recording['playbacks'] as $playback) {
973
+            $recording_types .= $OUTPUT->action_link($playback['url'], get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'), null, array('title' => get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'), 'target' => '_new')) . '&#32;';
974 974
         }
975 975
         $recording_types .= '</div>';
976 976
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
         $row->date = floatval($recording['startTime']);
986 986
         $row->date_formatted = $formattedStartDate;
987 987
         $row->duration = $duration;
988
-        if ( $bbbsession['managerecordings'] ) {
988
+        if ($bbbsession['managerecordings']) {
989 989
             $row->actionbar = $actionbar;
990 990
         }
991 991
     }
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
         array("key" =>"duration", "label" => $view_recording_duration, "width" => "50px")
1012 1012
         );
1013 1013
 
1014
-    if ( $bbbsession['managerecordings'] ) {
1014
+    if ($bbbsession['managerecordings']) {
1015 1015
         array_push($recordingsbn_columns, array("key" =>"actionbar", "label" => $view_recording_actionbar, "width" => "75px", "allowHTML" => true));
1016 1016
     }
1017 1017
 
@@ -1022,10 +1022,10 @@  discard block
 block discarded – undo
1022 1022
     $table_data = array();
1023 1023
 
1024 1024
     ///Build table content
1025
-    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1026
-        foreach ( $recordings as $recording ) {
1025
+    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1026
+        foreach ($recordings as $recording) {
1027 1027
             $row = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording);
1028
-            if( $row != null ) {
1028
+            if ($row != null) {
1029 1029
                 array_push($table_data, $row);
1030 1030
             }
1031 1031
         }
@@ -1053,27 +1053,27 @@  discard block
 block discarded – undo
1053 1053
     $table->data = array();
1054 1054
 
1055 1055
     ///Initialize table headers
1056
-    if ( $bbbsession['managerecordings'] ) {
1057
-        $table->head  = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar);
1058
-        $table->align = array ('left', 'left', 'left', 'left', 'center', 'left');
1056
+    if ($bbbsession['managerecordings']) {
1057
+        $table->head  = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar);
1058
+        $table->align = array('left', 'left', 'left', 'left', 'center', 'left');
1059 1059
     } else {
1060
-        $table->head  = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration);
1061
-        $table->align = array ('left', 'left', 'left', 'left', 'center');
1060
+        $table->head  = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration);
1061
+        $table->align = array('left', 'left', 'left', 'left', 'center');
1062 1062
     }
1063 1063
 
1064 1064
     ///Build table content
1065
-    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1066
-        foreach ( $recordings as $recording ){
1065
+    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1066
+        foreach ($recordings as $recording) {
1067 1067
             $row = new html_table_row();
1068
-            $row->id = 'recording-td-'.$recording['recordID'];
1068
+            $row->id = 'recording-td-' . $recording['recordID'];
1069 1069
 
1070 1070
             $row_data = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording);
1071
-            if( $row_data != null ) {
1071
+            if ($row_data != null) {
1072 1072
                 $row_data->date_formatted = str_replace(" ", "&nbsp;", $row_data->date_formatted);
1073
-                if ( $bbbsession['managerecordings'] ) {
1074
-                    $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration, $row_data->actionbar );
1073
+                if ($bbbsession['managerecordings']) {
1074
+                    $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration, $row_data->actionbar);
1075 1075
                 } else {
1076
-                    $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration );
1076
+                    $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration);
1077 1077
                 }
1078 1078
 
1079 1079
                 array_push($table->data, $row);
@@ -1092,15 +1092,15 @@  discard block
 block discarded – undo
1092 1092
 
1093 1093
     /// Build the message_body
1094 1094
     $msg->activity_type = "";
1095
-    if( isset($bigbluebuttonbn->type) && $bigbluebuttonbn->type != 0 )
1095
+    if (isset($bigbluebuttonbn->type) && $bigbluebuttonbn->type != 0)
1096 1096
         $msg->activity_type = bigbluebuttonbn_get_predefinedprofile_name($bigbluebuttonbn->type);
1097 1097
     $msg->activity_title = $bigbluebuttonbn->name;
1098
-    $message_text = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').' '.$msg->activity_type.' &quot;'.$msg->activity_title.'&quot; '.get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
1098
+    $message_text = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') . ' ' . $msg->activity_type . ' &quot;' . $msg->activity_title . '&quot; ' . get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
1099 1099
     
1100 1100
     bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message_text);
1101 1101
 }
1102 1102
 
1103
-function bigbluebuttonbn_server_offers($capability_name){
1103
+function bigbluebuttonbn_server_offers($capability_name) {
1104 1104
     global $CFG;
1105 1105
 
1106 1106
     $capability_offered = null;
@@ -1114,12 +1114,12 @@  discard block
 block discarded – undo
1114 1114
     $host_ends = explode(".", $host);
1115 1115
     $host_ends_length = count($host_ends);
1116 1116
 
1117
-    if( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' &&  $host_ends[$host_ends_length -2] == 'blindsidenetworks' ) {
1117
+    if ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks') {
1118 1118
         //Validate the capabilities offered
1119
-        $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret );
1120
-        if( $capabilities ) {
1119
+        $capabilities = bigbluebuttonbn_getCapabilitiesArray($endpoint, $shared_secret);
1120
+        if ($capabilities) {
1121 1121
             foreach ($capabilities as $capability) {
1122
-                if( $capability["name"] == $capability_name)
1122
+                if ($capability["name"] == $capability_name)
1123 1123
                     $capability_offered = $capability;
1124 1124
             }
1125 1125
         }
@@ -1128,14 +1128,14 @@  discard block
 block discarded – undo
1128 1128
     return $capability_offered;
1129 1129
 }
1130 1130
 
1131
-function bigbluebuttonbn_server_offers_bn_capabilities(){
1131
+function bigbluebuttonbn_server_offers_bn_capabilities() {
1132 1132
     //Validates if the server may have extended capabilities
1133 1133
     $parsed_url = parse_url(bigbluebuttonbn_get_cfg_server_url());
1134 1134
     $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
1135 1135
     $host_ends = explode(".", $host);
1136 1136
     $host_ends_length = count($host_ends);
1137 1137
 
1138
-    return ( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' && $host_ends[$host_ends_length -2] == 'blindsidenetworks' );
1138
+    return ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks');
1139 1139
 }
1140 1140
 
1141 1141
 function bigbluebuttonbn_get_locales_for_ui() {
@@ -1168,79 +1168,79 @@  discard block
 block discarded – undo
1168 1168
 
1169 1169
 function bigbluebuttonbn_get_cfg_server_url_default() {
1170 1170
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1171
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url: (isset($CFG->bigbluebuttonbn_server_url)? $CFG->bigbluebuttonbn_server_url: (isset($CFG->BigBlueButtonBNServerURL)? $CFG->BigBlueButtonBNServerURL: 'http://test-install.blindsidenetworks.com/bigbluebutton/')));
1171
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url : (isset($CFG->bigbluebuttonbn_server_url) ? $CFG->bigbluebuttonbn_server_url : (isset($CFG->BigBlueButtonBNServerURL) ? $CFG->BigBlueButtonBNServerURL : 'http://test-install.blindsidenetworks.com/bigbluebutton/')));
1172 1172
 }
1173 1173
 
1174 1174
 function bigbluebuttonbn_get_cfg_shared_secret_default() {
1175 1175
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1176
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret: (isset($CFG->bigbluebuttonbn_shared_secret)? $CFG->bigbluebuttonbn_shared_secret: (isset($CFG->BigBlueButtonBNSecuritySalt)? $CFG->BigBlueButtonBNSecuritySalt: '8cd8ef52e8e101574e400365b55e11a6')));
1176
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret : (isset($CFG->bigbluebuttonbn_shared_secret) ? $CFG->bigbluebuttonbn_shared_secret : (isset($CFG->BigBlueButtonBNSecuritySalt) ? $CFG->BigBlueButtonBNSecuritySalt : '8cd8ef52e8e101574e400365b55e11a6')));
1177 1177
 }
1178 1178
 
1179 1179
 function bigbluebuttonbn_get_cfg_voicebridge_editable() {
1180 1180
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1181
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable: (isset($CFG->bigbluebuttonbn_voicebridge_editable)? $CFG->bigbluebuttonbn_voicebridge_editable: false));    
1181
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable : (isset($CFG->bigbluebuttonbn_voicebridge_editable) ? $CFG->bigbluebuttonbn_voicebridge_editable : false));    
1182 1182
 }
1183 1183
 
1184 1184
 function bigbluebuttonbn_get_cfg_recording_default() {
1185 1185
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1186
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default: (isset($CFG->bigbluebuttonbn_recording_default)? $CFG->bigbluebuttonbn_recording_default: true));
1186
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default : (isset($CFG->bigbluebuttonbn_recording_default) ? $CFG->bigbluebuttonbn_recording_default : true));
1187 1187
 }
1188 1188
 
1189 1189
 function bigbluebuttonbn_get_cfg_recording_editable() {
1190 1190
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1191
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable: (isset($CFG->bigbluebuttonbn_recording_editable)? $CFG->bigbluebuttonbn_recording_editable: true));
1191
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable : (isset($CFG->bigbluebuttonbn_recording_editable) ? $CFG->bigbluebuttonbn_recording_editable : true));
1192 1192
 }
1193 1193
 
1194 1194
 function bigbluebuttonbn_get_cfg_recording_tagging_default() {
1195 1195
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1196
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default: (isset($CFG->bigbluebuttonbn_recordingtagging_default)? $CFG->bigbluebuttonbn_recordingtagging_default: false));
1196
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default : (isset($CFG->bigbluebuttonbn_recordingtagging_default) ? $CFG->bigbluebuttonbn_recordingtagging_default : false));
1197 1197
 }
1198 1198
 
1199 1199
 function bigbluebuttonbn_get_cfg_recording_tagging_editable() {
1200 1200
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1201
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable: (isset($CFG->bigbluebuttonbn_recordingtagging_editable)? $CFG->bigbluebuttonbn_recordingtagging_editable: false));
1201
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable : (isset($CFG->bigbluebuttonbn_recordingtagging_editable) ? $CFG->bigbluebuttonbn_recordingtagging_editable : false));
1202 1202
 }
1203 1203
 
1204 1204
 function bigbluebuttonbn_get_cfg_recording_icons_enabled() {
1205 1205
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1206
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled: (isset($CFG->bigbluebuttonbn_recording_icons_enabled)? $CFG->bigbluebuttonbn_recording_icons_enabled: true));
1206
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled : (isset($CFG->bigbluebuttonbn_recording_icons_enabled) ? $CFG->bigbluebuttonbn_recording_icons_enabled : true));
1207 1207
 }
1208 1208
 
1209 1209
 function bigbluebuttonbn_get_cfg_waitformoderator_default() {
1210 1210
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1211
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default: (isset($CFG->bigbluebuttonbn_waitformoderator_default)? $CFG->bigbluebuttonbn_waitformoderator_default: false));
1211
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default : (isset($CFG->bigbluebuttonbn_waitformoderator_default) ? $CFG->bigbluebuttonbn_waitformoderator_default : false));
1212 1212
 }
1213 1213
 
1214 1214
 function bigbluebuttonbn_get_cfg_waitformoderator_editable() {
1215 1215
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1216
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable: (isset($CFG->bigbluebuttonbn_waitformoderator_editable)? $CFG->bigbluebuttonbn_waitformoderator_editable: true));
1216
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable : (isset($CFG->bigbluebuttonbn_waitformoderator_editable) ? $CFG->bigbluebuttonbn_waitformoderator_editable : true));
1217 1217
 }
1218 1218
 
1219 1219
 function bigbluebuttonbn_get_cfg_waitformoderator_ping_interval() {
1220 1220
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1221
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval: (isset($CFG->bigbluebuttonbn_waitformoderator_ping_interval)? $CFG->bigbluebuttonbn_waitformoderator_ping_interval: 15));
1221
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval : (isset($CFG->bigbluebuttonbn_waitformoderator_ping_interval) ? $CFG->bigbluebuttonbn_waitformoderator_ping_interval : 15));
1222 1222
 }
1223 1223
 
1224 1224
 function bigbluebuttonbn_get_cfg_waitformoderator_cache_ttl() {
1225 1225
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1226
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl: (isset($CFG->bigbluebuttonbn_waitformoderator_cache_ttl)? $CFG->bigbluebuttonbn_waitformoderator_cache_ttl: 60));
1226
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl : (isset($CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ? $CFG->bigbluebuttonbn_waitformoderator_cache_ttl : 60));
1227 1227
 }
1228 1228
 
1229 1229
 function bigbluebuttonbn_get_cfg_userlimit_default() {
1230 1230
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1231
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default: (isset($CFG->bigbluebuttonbn_userlimit_default)? $CFG->bigbluebuttonbn_userlimit_default: 0));
1231
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default : (isset($CFG->bigbluebuttonbn_userlimit_default) ? $CFG->bigbluebuttonbn_userlimit_default : 0));
1232 1232
 }
1233 1233
 
1234 1234
 function bigbluebuttonbn_get_cfg_userlimit_editable() {
1235 1235
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1236
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable: (isset($CFG->bigbluebuttonbn_userlimit_editable)? $CFG->bigbluebuttonbn_userlimit_editable: false));
1236
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable : (isset($CFG->bigbluebuttonbn_userlimit_editable) ? $CFG->bigbluebuttonbn_userlimit_editable : false));
1237 1237
 }
1238 1238
 
1239 1239
 function bigbluebuttonbn_get_cfg_preuploadpresentation_enabled() {
1240 1240
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1241 1241
     if (extension_loaded('curl')) {
1242 1242
         // This feature only works if curl is installed
1243
-        return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled: (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $CFG->bigbluebuttonbn_preuploadpresentation_enabled: false));
1243
+        return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled : (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $CFG->bigbluebuttonbn_preuploadpresentation_enabled : false));
1244 1244
     } else {
1245 1245
         return false;
1246 1246
     }
@@ -1248,30 +1248,30 @@  discard block
 block discarded – undo
1248 1248
 
1249 1249
 function bigbluebuttonbn_get_cfg_sendnotifications_enabled() {
1250 1250
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1251
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled: (isset($CFG->bigbluebuttonbn_sendnotifications_enabled)? $CFG->bigbluebuttonbn_sendnotifications_enabled: false));
1251
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled : (isset($CFG->bigbluebuttonbn_sendnotifications_enabled) ? $CFG->bigbluebuttonbn_sendnotifications_enabled : false));
1252 1252
 }
1253 1253
 
1254 1254
 function bigbluebuttonbn_get_cfg_recordingready_enabled() {
1255 1255
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1256
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled: (isset($CFG->bigbluebuttonbn_recordingready_enabled)? $CFG->bigbluebuttonbn_recordingready_enabled: false));
1256
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled : (isset($CFG->bigbluebuttonbn_recordingready_enabled) ? $CFG->bigbluebuttonbn_recordingready_enabled : false));
1257 1257
 }
1258 1258
 
1259 1259
 function bigbluebuttonbn_get_cfg_moderator_default() {
1260 1260
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1261
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default: (isset($CFG->bigbluebuttonbn_moderator_default)? $CFG->bigbluebuttonbn_moderator_default: 'owner'));
1261
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default : (isset($CFG->bigbluebuttonbn_moderator_default) ? $CFG->bigbluebuttonbn_moderator_default : 'owner'));
1262 1262
 }
1263 1263
 
1264 1264
 function bigbluebuttonbn_get_cfg_scheduled_duration_enabled() {
1265 1265
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1266
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled: (isset($CFG->bigbluebuttonbn_scheduled_duration_enabled)? $CFG->bigbluebuttonbn_scheduled_duration_enabled: false));
1266
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled : (isset($CFG->bigbluebuttonbn_scheduled_duration_enabled) ? $CFG->bigbluebuttonbn_scheduled_duration_enabled : false));
1267 1267
 }
1268 1268
 
1269 1269
 function bigbluebuttonbn_get_cfg_scheduled_duration_compensation() {
1270 1270
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1271
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation: (isset($CFG->bigbluebuttonbn_scheduled_duration_compensation)? $CFG->bigbluebuttonbn_scheduled_duration_compensation: 10));
1271
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation : (isset($CFG->bigbluebuttonbn_scheduled_duration_compensation) ? $CFG->bigbluebuttonbn_scheduled_duration_compensation : 10));
1272 1272
 }
1273 1273
 
1274 1274
 function bigbluebuttonbn_get_cfg_scheduled_pre_opening() {
1275 1275
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1276
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening: (isset($CFG->bigbluebuttonbn_scheduled_pre_opening)? $CFG->bigbluebuttonbn_scheduled_pre_opening: 10));
1276
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening : (isset($CFG->bigbluebuttonbn_scheduled_pre_opening) ? $CFG->bigbluebuttonbn_scheduled_pre_opening : 10));
1277 1277
 }
Please login to merge, or discard this patch.
version.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,5 +15,5 @@
 block discarded – undo
15 15
 $plugin->requires = 2013111800;
16 16
 $plugin->cron     = 0;
17 17
 $plugin->component = 'mod_bigbluebuttonbn';
18
-$plugin->maturity = MATURITY_STABLE;    // [MATURITY_STABLE | MATURITY_RC | MATURITY_BETA | MATURITY_ALPHA]
18
+$plugin->maturity = MATURITY_STABLE; // [MATURITY_STABLE | MATURITY_RC | MATURITY_BETA | MATURITY_ALPHA]
19 19
 $plugin->release  = '2.0.4';
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_published.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
      * @return string
39 39
      */
40 40
     public function get_description() {
41
-        $rid = isset($this->other['rid'])? $this->other['rid']: '';
41
+        $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
42 42
         return "The user with id '$this->userid' has published a recording with id '$rid' for " .
43 43
         "the course id '$this->contextinstanceid'.";
44 44
     }
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_unpublished.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
      * @return string
39 39
      */
40 40
     public function get_description() {
41
-        $rid = isset($this->other['rid'])? $this->other['rid']: '';
41
+        $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
42 42
         return "The user with id '$this->userid' has unpublished a recording with id '$rid' for " .
43 43
         "the course id '$this->contextinstanceid'.";
44 44
     }
Please login to merge, or discard this patch.