Completed
Push — master ( d3581f...f69be4 )
by Jesus
66:21 queued 58:55
created
lang/en/bigbluebuttonbn.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -289,14 +289,14 @@
 block discarded – undo
289 289
 
290 290
 
291 291
 $string['email_date'] = '{$a->day} at {$a->time}';
292
-$string['email_footer'] = '<p><hr/><br/>This automatic notification message was sent by {$a->user_name}({$a->user_email}) '.
292
+$string['email_footer'] = '<p><hr/><br/>This automatic notification message was sent by {$a->user_name}({$a->user_email}) ' .
293 293
         'from the course {$a->course_name}</p>';
294
-$string['email_body_notification'] = '<p>{$a->activity_type} &quot;{$a->activity_title}&quot; has been {$a->action}</p>'.
295
-        '<p><b>{$a->activity_title}</b> Details: '.
296
-        '<table border="0" style="margin: 5px 0 0 20px"><tbody>'.
297
-        '<tr><td style="font-weight:bold;color:#555;">Title: </td><td>{$a->activity_title}</td></tr>'.
298
-        '<tr><td style="font-weight:bold;color:#555;">Description: </td><td>{$a->activity_description}</td></tr>'.
299
-        '<tr><td style="font-weight:bold;color:#555;">Start date: </td><td>{$a->activity_openingtime}</td></tr>'.
300
-        '<tr><td style="font-weight:bold;color:#555;">End date: </td><td>{$a->activity_closingtime}</td></tr>'.
294
+$string['email_body_notification'] = '<p>{$a->activity_type} &quot;{$a->activity_title}&quot; has been {$a->action}</p>' .
295
+        '<p><b>{$a->activity_title}</b> Details: ' .
296
+        '<table border="0" style="margin: 5px 0 0 20px"><tbody>' .
297
+        '<tr><td style="font-weight:bold;color:#555;">Title: </td><td>{$a->activity_title}</td></tr>' .
298
+        '<tr><td style="font-weight:bold;color:#555;">Description: </td><td>{$a->activity_description}</td></tr>' .
299
+        '<tr><td style="font-weight:bold;color:#555;">Start date: </td><td>{$a->activity_openingtime}</td></tr>' .
300
+        '<tr><td style="font-weight:bold;color:#555;">End date: </td><td>{$a->activity_closingtime}</td></tr>' .
301 301
         '<tr><td style="font-weight:bold;color:#555;">{$a->action} by: </td><td>{$a->activity_owner}</td></tr></tbody></table></p>';
302 302
 $string['email_body_recording'] = '<p>Recording for {$a->activity_type} &quot;{$a->activity_title}&quot; is ready</p>';
Please login to merge, or discard this patch.
lib.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@  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.'/mod/lti/OAuth.php');
19
-require_once($CFG->libdir.'/accesslib.php');
20
-require_once($CFG->libdir.'/completionlib.php');
21
-require_once($CFG->libdir.'/datalib.php');
22
-require_once($CFG->libdir.'/coursecatlib.php');
23
-require_once($CFG->libdir.'/enrollib.php');
24
-require_once($CFG->libdir.'/filelib.php');
25
-require_once($CFG->libdir.'/formslib.php');
26
-
27
-require_once(dirname(__FILE__).'/JWT.php');
28
-
29
-if( file_exists(dirname(__FILE__).'/config.php') ) {
30
-    require_once(dirname(__FILE__).'/config.php');
31
-    if( isset($BIGBLUEBUTTONBN_CFG) ) {
32
-        $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 . '/mod/lti/OAuth.php');
19
+require_once($CFG->libdir . '/accesslib.php');
20
+require_once($CFG->libdir . '/completionlib.php');
21
+require_once($CFG->libdir . '/datalib.php');
22
+require_once($CFG->libdir . '/coursecatlib.php');
23
+require_once($CFG->libdir . '/enrollib.php');
24
+require_once($CFG->libdir . '/filelib.php');
25
+require_once($CFG->libdir . '/formslib.php');
26
+
27
+require_once(dirname(__FILE__) . '/JWT.php');
28
+
29
+if (file_exists(dirname(__FILE__) . '/config.php')) {
30
+    require_once(dirname(__FILE__) . '/config.php');
31
+    if (isset($BIGBLUEBUTTONBN_CFG)) {
32
+        $CFG = (object)array_merge((array)$CFG, (array)$BIGBLUEBUTTONBN_CFG);
33 33
     }
34 34
 } else {
35 35
     $BIGBLUEBUTTONBN_CFG = new stdClass();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 const BIGBLUEBUTTONBN_LOG_EVENT_DELETE = "Delete";
51 51
 
52 52
 function bigbluebuttonbn_supports($feature) {
53
-    switch($feature) {
53
+    switch ($feature) {
54 54
         case FEATURE_IDNUMBER:                return true;
55 55
         case FEATURE_GROUPS:                  return true;
56 56
         case FEATURE_GROUPINGS:               return true;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 function bigbluebuttonbn_add_instance($data, $mform) {
80 80
     global $DB, $CFG;
81 81
 
82
-    $draftitemid = isset($data->presentation)? $data->presentation: null;
82
+    $draftitemid = isset($data->presentation) ? $data->presentation : null;
83 83
     $context = bigbluebuttonbn_get_context_module($data->coursemodule);
84 84
 
85 85
     bigbluebuttonbn_process_pre_save($data);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     global $DB, $CFG;
108 108
 
109 109
     $data->id = $data->instance;
110
-    $draftitemid = isset($data->presentation)? $data->presentation: null;
110
+    $draftitemid = isset($data->presentation) ? $data->presentation : null;
111 111
     $context = bigbluebuttonbn_get_context_module($data->coursemodule);
112 112
 
113 113
     bigbluebuttonbn_process_pre_save($data);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 function bigbluebuttonbn_delete_instance($id) {
134 134
     global $CFG, $DB, $USER;
135 135
 
136
-    if (! $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) {
136
+    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) {
137 137
         return false;
138 138
     }
139 139
 
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
     //if( bigbluebuttonbn_isMeetingRunning($meetingID, $url, $shared_secret) )
152 152
     //    $getArray = bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $url, $shared_secret );
153 153
 
154
-    if (! $DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) {
154
+    if (!$DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) {
155 155
         $result = false;
156 156
     }
157 157
 
158
-    if (! $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
158
+    if (!$DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
159 159
         $result = false;
160 160
     }
161 161
 
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
     $logs = $DB->get_records('bigbluebuttonbn_logs', array('bigbluebuttonbnid' => $bigbluebuttonbn->id, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE));
172 172
     error_log(json_encode($logs));
173 173
     $has_recordings = 'false';
174
-    if (! empty($logs) ) {
174
+    if (!empty($logs)) {
175 175
         error_log("IS not empty");
176
-        foreach ( $logs as $l ) {
176
+        foreach ($logs as $l) {
177 177
             error_log(json_encode($l));
178 178
             $meta = json_decode($l->meta);
179
-            if ( $meta->record ) {
179
+            if ($meta->record) {
180 180
                 $has_recordings = 'true';
181 181
             }
182 182
         }
183 183
     }
184 184
     $log->meta = "{\"has_recordings\":{$has_recordings}}";
185 185
 
186
-    if (! $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) {
186
+    if (!$returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) {
187 187
         $result = false;
188 188
     }
189 189
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * @return boolean
222 222
  */
223 223
 function bigbluebuttonbn_print_recent_activity($course, $isteacher, $timestart) {
224
-    return false;  //  True if anything was printed, otherwise false
224
+    return false; //  True if anything was printed, otherwise false
225 225
 }
226 226
 
227 227
 /**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
  * @param int $groupid defaults to 0
237 237
  * @return void adds items into $activities and increases $index
238 238
  */
239
-function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) {
239
+function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0) {
240 240
 }
241 241
 
242 242
 /**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return boolean
256 256
  **/
257
-function bigbluebuttonbn_cron () {
257
+function bigbluebuttonbn_cron() {
258 258
     return true;
259 259
 }
260 260
 
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
     }
357 357
 
358 358
     $strbigbluebuttonbn = get_string('modulename', 'bigbluebuttonbn');
359
-    $strnextsession  = get_string('nextsession', 'bigbluebuttonbn');
359
+    $strnextsession = get_string('nextsession', 'bigbluebuttonbn');
360 360
 
361 361
     foreach ($bigbluebuttonbns as $bigbluebuttonbn) {
362 362
         if ($bigbluebuttonbn->openingtime and $bigbluebuttonbn->closingtime) {  // A bigbluebuttonbn is scheduled.
363
-            $str = '<div class="bigbluebuttonbn overview"><div class="name">'.
364
-                   $strbigbluebuttonbn.': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"').
365
-                   ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'.
366
-                   $bigbluebuttonbn->name.'</a></div>';
367
-            $str .= '<div class="info">'.$strnextsession.': '.userdate($bigbluebuttonbn->openingtime).'</div></div>';
363
+            $str = '<div class="bigbluebuttonbn overview"><div class="name">' .
364
+                   $strbigbluebuttonbn . ': <a ' . ($bigbluebuttonbn->visible ? '' : ' class="dimmed"') .
365
+                   ' href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule . '">' .
366
+                   $bigbluebuttonbn->name . '</a></div>';
367
+            $str .= '<div class="info">' . $strnextsession . ': ' . userdate($bigbluebuttonbn->openingtime) . '</div></div>';
368 368
 
369 369
             if (empty($htmlarray[$bigbluebuttonbn->course]['bigbluebuttonbn'])) {
370 370
                 $htmlarray[$bigbluebuttonbn->course]['bigbluebuttonbn'] = $str;
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 function bigbluebuttonbn_get_coursemodule_info($coursemodule) {
390 390
     global $CFG, $DB;
391 391
 
392
-    if ( !$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat, newwindow')) {
392
+    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat, newwindow')) {
393 393
         return NULL;
394 394
     }
395 395
 
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 function bigbluebuttonbn_process_pre_save(&$bigbluebuttonbn) {
416 416
     global $DB, $CFG;
417 417
 
418
-    if ( !isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated ) {
418
+    if (!isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated) {
419 419
         $bigbluebuttonbn->timecreated = time();
420 420
         //Assign password only if it is a new activity
421
-        if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) {
421
+        if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) {
422 422
             $bigbluebuttonbn->moderatorpass = bigbluebuttonbn_random_password(12);
423 423
             $bigbluebuttonbn->viewerpass = bigbluebuttonbn_random_password(12);
424 424
         }
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
         $bigbluebuttonbn->timemodified = time();
428 428
     }
429 429
 
430
-    if (! isset($bigbluebuttonbn->newwindow))
430
+    if (!isset($bigbluebuttonbn->newwindow))
431 431
         $bigbluebuttonbn->newwindow = 0;
432
-    if (! isset($bigbluebuttonbn->wait))
432
+    if (!isset($bigbluebuttonbn->wait))
433 433
         $bigbluebuttonbn->wait = 0;
434
-    if (! isset($bigbluebuttonbn->record))
434
+    if (!isset($bigbluebuttonbn->record))
435 435
         $bigbluebuttonbn->record = 0;
436
-    if (! isset($bigbluebuttonbn->tagging))
436
+    if (!isset($bigbluebuttonbn->tagging))
437 437
         $bigbluebuttonbn->tagging = 0;
438 438
 
439 439
     $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants);
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
 
453 453
     // Now that an id was assigned, generate and set the meetingid property based on 
454 454
     // [Moodle Instance + Activity ID + BBB Secret] (but only for new activities)
455
-    if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) {
456
-        $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot.$bigbluebuttonbn->id.bigbluebuttonbn_get_cfg_shared_secret());
455
+    if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) {
456
+        $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot . $bigbluebuttonbn->id . bigbluebuttonbn_get_cfg_shared_secret());
457 457
         $DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn_meetingid, array('id' => $bigbluebuttonbn->id));
458 458
         $action = get_string('mod_form_field_notification_msg_created', 'bigbluebuttonbn');
459 459
     } else {
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
     }
462 462
 
463 463
     // Add evento to the calendar when if openingtime is set
464
-    if ( isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime ){
464
+    if (isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime) {
465 465
         $event = new stdClass();
466 466
         $event->name        = $bigbluebuttonbn->name;
467 467
         $event->courseid    = $bigbluebuttonbn->course;
@@ -471,13 +471,13 @@  discard block
 block discarded – undo
471 471
         $event->instance    = $bigbluebuttonbn->id;
472 472
         $event->timestart   = $bigbluebuttonbn->openingtime;
473 473
 
474
-        if ( $bigbluebuttonbn->closingtime ){
474
+        if ($bigbluebuttonbn->closingtime) {
475 475
             $event->durationtime = $bigbluebuttonbn->closingtime - $bigbluebuttonbn->openingtime;
476 476
         } else {
477 477
             $event->durationtime = 0;
478 478
         }
479 479
 
480
-        if ( $event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)) ) {
480
+        if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
481 481
             $calendarevent = calendar_event::load($event->id);
482 482
             $calendarevent->update($event);
483 483
         } else {
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
         $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id));
489 489
     }
490 490
 
491
-    if( isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification ) {
491
+    if (isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification) {
492 492
         // Prepare message
493 493
         $msg = new stdClass();
494 494
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
         /// Add the meeting details to the message_body
501 501
         $msg->action = ucfirst($action);
502 502
         $msg->activity_description = "";
503
-        if( !empty($bigbluebuttonbn->intro) )
503
+        if (!empty($bigbluebuttonbn->intro))
504 504
             $msg->activity_description = trim($bigbluebuttonbn->intro);
505 505
         $msg->activity_openingtime = "";
506 506
         if ($bigbluebuttonbn->openingtime) {
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
             $msg->activity_openingtime = get_string('email_date', 'bigbluebuttonbn', $date);
511 511
         }
512 512
         $msg->activity_closingtime = "";
513
-        if ($bigbluebuttonbn->closingtime ) {
513
+        if ($bigbluebuttonbn->closingtime) {
514 514
             $date = new stdClass();
515 515
             $date->day = calendar_day_representation($bigbluebuttonbn->closingtime);
516 516
             $date->time = calendar_time_representation($bigbluebuttonbn->closingtime);
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
  * @param array $options additional options affecting the file serving
570 570
  * @return bool false if file not found, does not return if found - justsend the file
571 571
  */
572
-function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
572
+function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
573 573
     global $CFG, $DB;
574 574
 
575 575
     if ($context->contextlevel != CONTEXT_MODULE) {
@@ -585,21 +585,21 @@  discard block
 block discarded – undo
585 585
         return false;
586 586
     }
587 587
 
588
-    if( sizeof($args) > 1 ) {
588
+    if (sizeof($args) > 1) {
589 589
         $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache');
590 590
         $presentation_nonce_key = sha1($bigbluebuttonbn->id);
591 591
         $presentation_nonce = $cache->get($presentation_nonce_key);
592 592
         $presentation_nonce_value = $presentation_nonce['value'];
593 593
         $presentation_nonce_counter = $presentation_nonce['counter'];
594 594
 
595
-        if( $args["0"] != $presentation_nonce_value ) {
595
+        if ($args["0"] != $presentation_nonce_value) {
596 596
             return false;
597 597
         }
598 598
 
599 599
         //The nonce value is actually used twice because BigBlueButton reads the file two times
600 600
         $presentation_nonce_counter += 1;
601
-        if( $presentation_nonce_counter < 2 ) {
602
-            $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter ));
601
+        if ($presentation_nonce_counter < 2) {
602
+            $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter));
603 603
         } else {
604 604
             $cache->delete($presentation_nonce_key);
605 605
         }
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
     }
618 618
 
619 619
     if ($filearea === 'presentation') {
620
-        $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
620
+        $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
621 621
     } else {
622 622
         return false;
623 623
     }
@@ -651,10 +651,10 @@  discard block
 block discarded – undo
651 651
  * @package  mod_bigbluebuttonbn
652 652
  * @return array a list of available roles
653 653
  */
654
-function bigbluebuttonbn_get_db_moodle_roles($rolename='all') {
654
+function bigbluebuttonbn_get_db_moodle_roles($rolename = 'all') {
655 655
     global $DB;
656 656
 
657
-    if( $rolename != 'all')
657
+    if ($rolename != 'all')
658 658
         $roles = $DB->get_record('role', array('shortname' => $rolename));
659 659
     else
660 660
         $roles = $DB->get_records('role', array());
@@ -673,22 +673,22 @@  discard block
 block discarded – undo
673 673
 
674 674
     $roles = bigbluebuttonbn_get_db_moodle_roles();
675 675
     $sqluserids = array();
676
-    foreach($roles as $role){
676
+    foreach ($roles as $role) {
677 677
         $users = get_role_users($role->id, $context);
678
-        foreach($users as $user) {
678
+        foreach ($users as $user) {
679 679
             array_push($sqluserids, $user->id);
680 680
         }
681 681
     }
682 682
 
683 683
     $users_array = array();
684
-    if( !empty($sqluserids) ) {
684
+    if (!empty($sqluserids)) {
685 685
         $users_array = $DB->get_records_select("user", "id IN (" . implode(', ', $sqluserids) . ") AND deleted = 0");
686 686
     }
687 687
 
688 688
     return $users_array;
689 689
 }
690 690
 
691
-function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message="") {
691
+function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message = "") {
692 692
     global $CFG, $DB;
693 693
 
694 694
     $context = bigbluebuttonbn_get_context_course($bigbluebuttonbn->course);
@@ -702,12 +702,12 @@  discard block
 block discarded – undo
702 702
     $message .= get_string('email_footer', 'bigbluebuttonbn', $msg);
703 703
 
704 704
     $users = bigbluebuttonbn_get_users($context);
705
-    foreach( $users as $user ) {
706
-        if( $user->id != $sender->id ){
707
-            error_log("Sending msg to ".$user->firstname." ".$user->lastname.".");
705
+    foreach ($users as $user) {
706
+        if ($user->id != $sender->id) {
707
+            error_log("Sending msg to " . $user->firstname . " " . $user->lastname . ".");
708 708
             $messageid = message_post_message($sender, $user, $message, FORMAT_HTML);
709 709
             if (!empty($messageid)) {
710
-                error_log("Msg sent to ".$user->firstname." ".$user->lastname.".");
710
+                error_log("Msg sent to " . $user->firstname . " " . $user->lastname . ".");
711 711
             } else {
712 712
                 error_log("Msg was NOT sent.");
713 713
             }
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
     global $CFG;
720 720
 
721 721
     $version_major = bigbluebuttonbn_get_moodle_version_major();
722
-    if ( $version_major < '2013111800' ) {
722
+    if ($version_major < '2013111800') {
723 723
         //This is valid before v2.6
724 724
         $context = get_context_instance(CONTEXT_MODULE, $id);
725 725
     } else {
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
     global $CFG;
735 735
 
736 736
     $version_major = bigbluebuttonbn_get_moodle_version_major();
737
-    if ( $version_major < '2013111800' ) {
737
+    if ($version_major < '2013111800') {
738 738
         //This is valid before v2.6
739 739
         $context = get_context_instance(CONTEXT_COURSE, $id);
740 740
     } else {
@@ -747,11 +747,11 @@  discard block
 block discarded – undo
747 747
 
748 748
 function bigbluebuttonbn_get_cfg_server_url() {
749 749
     global $BIGBLUEBUTTONBN_CFG, $CFG;
750
-    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/'));
750
+    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/'));
751 751
 }
752 752
 
753 753
 function bigbluebuttonbn_get_cfg_shared_secret() {
754 754
     global $BIGBLUEBUTTONBN_CFG, $CFG;
755
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret): (isset($CFG->bigbluebuttonbn_shared_secret)? trim($CFG->bigbluebuttonbn_shared_secret): '8cd8ef52e8e101574e400365b55e11a6'));
755
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) : (isset($CFG->bigbluebuttonbn_shared_secret) ? trim($CFG->bigbluebuttonbn_shared_secret) : '8cd8ef52e8e101574e400365b55e11a6'));
756 756
 }
757 757
 
Please login to merge, or discard this patch.
locallib.php 1 patch
Spacing   +339 added lines, -339 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
 
@@ -33,21 +33,21 @@  discard block
 block discarded – undo
33 33
 const BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED = 'recording_published';
34 34
 const BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED = 'recording_unpublished';
35 35
 
36
-function bigbluebuttonbn_logs(array $bbbsession, $event, array $overrides = [], $meta = NULL ) {
36
+function bigbluebuttonbn_logs(array $bbbsession, $event, array $overrides = [], $meta = NULL) {
37 37
     global $DB;
38 38
 
39 39
     $log = new stdClass();
40 40
 
41
-    $log->courseid = isset($overrides['courseid'])? $overrides['courseid']: $bbbsession['course']->id;
42
-    $log->bigbluebuttonbnid = isset($overrides['bigbluebuttonbnid'])? $overrides['bigbluebuttonbnid']: $bbbsession['bigbluebuttonbn']->id;
43
-    $log->userid = isset($overrides['userid'])? $overrides['userid']: $bbbsession['userID'];
44
-    $log->meetingid = isset($overrides['meetingid'])? $overrides['meetingid']: $bbbsession['meetingid'];
45
-    $log->timecreated = isset($overrides['timecreated'])? $overrides['timecreated']: time();
41
+    $log->courseid = isset($overrides['courseid']) ? $overrides['courseid'] : $bbbsession['course']->id;
42
+    $log->bigbluebuttonbnid = isset($overrides['bigbluebuttonbnid']) ? $overrides['bigbluebuttonbnid'] : $bbbsession['bigbluebuttonbn']->id;
43
+    $log->userid = isset($overrides['userid']) ? $overrides['userid'] : $bbbsession['userID'];
44
+    $log->meetingid = isset($overrides['meetingid']) ? $overrides['meetingid'] : $bbbsession['meetingid'];
45
+    $log->timecreated = isset($overrides['timecreated']) ? $overrides['timecreated'] : time();
46 46
     $log->log = $event;
47
-    if ( isset($meta) ) {
47
+    if (isset($meta)) {
48 48
         $log->meta = $meta;
49
-    } else if( $event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) {
50
-        $log->meta = '{"record":'.($bbbsession['record']? 'true': 'false').'}';
49
+    } else if ($event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) {
50
+        $log->meta = '{"record":' . ($bbbsession['record'] ? 'true' : 'false') . '}';
51 51
     }
52 52
 
53 53
     $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log);
@@ -56,127 +56,127 @@  discard block
 block discarded – undo
56 56
  ////////////////////////////
57 57
 //  BigBlueButton API Calls  //
58 58
  ////////////////////////////
59
-function bigbluebuttonbn_getJoinURL( $meetingID, $userName, $PW, $SALT, $URL, $logoutURL ) {
60
-    $url_join = $URL."api/join?";
61
-    $params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.urlencode($PW).'&logoutURL='.urlencode($logoutURL);
62
-    $url = $url_join.$params.'&checksum='.sha1("join".$params.$SALT);
59
+function bigbluebuttonbn_getJoinURL($meetingID, $userName, $PW, $SALT, $URL, $logoutURL) {
60
+    $url_join = $URL . "api/join?";
61
+    $params = 'meetingID=' . urlencode($meetingID) . '&fullName=' . urlencode($userName) . '&password=' . urlencode($PW) . '&logoutURL=' . urlencode($logoutURL);
62
+    $url = $url_join . $params . '&checksum=' . sha1("join" . $params . $SALT);
63 63
     return $url;
64 64
 }
65 65
 
66
-function bigbluebuttonbn_getCreateMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration=0, $voiceBridge=0, $maxParticipants=0, $metadata=array() ) {
67
-    $url_create = $URL."api/create?";
66
+function bigbluebuttonbn_getCreateMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration = 0, $voiceBridge = 0, $maxParticipants = 0, $metadata = array()) {
67
+    $url_create = $URL . "api/create?";
68 68
 
69
-    $params = 'name='.urlencode($name).'&meetingID='.urlencode($meetingID).'&attendeePW='.urlencode($attendeePW).'&moderatorPW='.urlencode($moderatorPW).'&logoutURL='.urlencode($logoutURL).'&record='.$record;
69
+    $params = 'name=' . urlencode($name) . '&meetingID=' . urlencode($meetingID) . '&attendeePW=' . urlencode($attendeePW) . '&moderatorPW=' . urlencode($moderatorPW) . '&logoutURL=' . urlencode($logoutURL) . '&record=' . $record;
70 70
 
71 71
     $voiceBridge = intval($voiceBridge);
72
-    if ( $voiceBridge > 0 && $voiceBridge < 79999)
73
-        $params .= '&voiceBridge='.$voiceBridge;
72
+    if ($voiceBridge > 0 && $voiceBridge < 79999)
73
+        $params .= '&voiceBridge=' . $voiceBridge;
74 74
 
75 75
     $duration = intval($duration);
76
-    if( $duration > 0 )
77
-        $params .= '&duration='.$duration;
76
+    if ($duration > 0)
77
+        $params .= '&duration=' . $duration;
78 78
 
79 79
     $maxParticipants = intval($maxParticipants);
80
-    if( $maxParticipants > 0 )
81
-        $params .= '&maxParticipants='.$maxParticipants;
80
+    if ($maxParticipants > 0)
81
+        $params .= '&maxParticipants=' . $maxParticipants;
82 82
 
83
-    if( trim( $welcome ) )
84
-        $params .= '&welcome='.urlencode($welcome);
83
+    if (trim($welcome))
84
+        $params .= '&welcome=' . urlencode($welcome);
85 85
 
86 86
     foreach ($metadata as $key => $value) {
87
-        $params .= '&'.$key.'='.urlencode($value);
87
+        $params .= '&' . $key . '=' . urlencode($value);
88 88
     }
89 89
 
90
-    $url = $url_create.$params.'&checksum='.sha1("create".$params.$SALT);
90
+    $url = $url_create . $params . '&checksum=' . sha1("create" . $params . $SALT);
91 91
     return $url;
92 92
 }
93 93
 
94
-function bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) {
95
-    $base_url = $URL."api/isMeetingRunning?";
96
-    $params = 'meetingID='.urlencode($meetingID);
97
-    $url = $base_url.$params.'&checksum='.sha1("isMeetingRunning".$params.$SALT);
94
+function bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT) {
95
+    $base_url = $URL . "api/isMeetingRunning?";
96
+    $params = 'meetingID=' . urlencode($meetingID);
97
+    $url = $base_url . $params . '&checksum=' . sha1("isMeetingRunning" . $params . $SALT);
98 98
     return $url;
99 99
 }
100 100
 
101
-function bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) {
102
-    $base_url = $URL."api/getMeetingInfo?";
103
-    $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
104
-    $url = $base_url.$params.'&checksum='.sha1("getMeetingInfo".$params.$SALT);
101
+function bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT) {
102
+    $base_url = $URL . "api/getMeetingInfo?";
103
+    $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW);
104
+    $url = $base_url . $params . '&checksum=' . sha1("getMeetingInfo" . $params . $SALT);
105 105
     return $url;
106 106
 }
107 107
 
108
-function bigbluebuttonbn_getMeetingsURL( $URL, $SALT ) {
109
-    $base_url = $URL."api/getMeetings?";
110
-    $url = $base_url.'&checksum='.sha1("getMeetings".$SALT);
108
+function bigbluebuttonbn_getMeetingsURL($URL, $SALT) {
109
+    $base_url = $URL . "api/getMeetings?";
110
+    $url = $base_url . '&checksum=' . sha1("getMeetings" . $SALT);
111 111
     return $url;
112 112
 }
113 113
 
114
-function bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) {
115
-    $base_url = $URL."api/end?";
116
-    $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
117
-    $url = $base_url.$params.'&checksum='.sha1("end".$params.$SALT);
114
+function bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT) {
115
+    $base_url = $URL . "api/end?";
116
+    $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW);
117
+    $url = $base_url . $params . '&checksum=' . sha1("end" . $params . $SALT);
118 118
     return $url;
119 119
 }
120 120
 
121
-function bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID=null ) {
122
-    $base_url_record = $URL."api/getRecordings?";
123
-    if( $meetingID == null ) {
121
+function bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID = null) {
122
+    $base_url_record = $URL . "api/getRecordings?";
123
+    if ($meetingID == null) {
124 124
         $params = "";
125 125
     } else {
126
-        $params = "meetingID=".urlencode($meetingID);
126
+        $params = "meetingID=" . urlencode($meetingID);
127 127
     }
128
-    $url = $base_url_record.$params."&checksum=".sha1("getRecordings".$params.$SALT);
128
+    $url = $base_url_record . $params . "&checksum=" . sha1("getRecordings" . $params . $SALT);
129 129
     return $url;
130 130
 }
131 131
 
132
-function bigbluebuttonbn_getDeleteRecordingsURL( $recordID, $URL, $SALT ) {
133
-    $url_delete = $URL."api/deleteRecordings?";
134
-    $params = 'recordID='.urlencode($recordID);
135
-    $url = $url_delete.$params.'&checksum='.sha1("deleteRecordings".$params.$SALT);
132
+function bigbluebuttonbn_getDeleteRecordingsURL($recordID, $URL, $SALT) {
133
+    $url_delete = $URL . "api/deleteRecordings?";
134
+    $params = 'recordID=' . urlencode($recordID);
135
+    $url = $url_delete . $params . '&checksum=' . sha1("deleteRecordings" . $params . $SALT);
136 136
     return $url;
137 137
 }
138 138
 
139
-function bigbluebuttonbn_getPublishRecordingsURL( $recordID, $set, $URL, $SALT ) {
140
-    $url_publish = $URL."api/publishRecordings?";
141
-    $params = 'recordID='.$recordID."&publish=".$set;
142
-    $url = $url_publish.$params.'&checksum='.sha1("publishRecordings".$params.$SALT);
139
+function bigbluebuttonbn_getPublishRecordingsURL($recordID, $set, $URL, $SALT) {
140
+    $url_publish = $URL . "api/publishRecordings?";
141
+    $params = 'recordID=' . $recordID . "&publish=" . $set;
142
+    $url = $url_publish . $params . '&checksum=' . sha1("publishRecordings" . $params . $SALT);
143 143
     return $url;
144 144
 }
145 145
 
146
-function bigbluebuttonbn_getCreateMeetingArray( $username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record='false', $duration=0, $voiceBridge=0, $maxParticipants=0, $metadata=array(), $presentation_name=null, $presentation_url=null ) {
146
+function bigbluebuttonbn_getCreateMeetingArray($username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record = 'false', $duration = 0, $voiceBridge = 0, $maxParticipants = 0, $metadata = array(), $presentation_name = null, $presentation_url = null) {
147 147
     $create_meeting_url = bigbluebuttonbn_getCreateMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $maxParticipants, $metadata);
148
-    if( !is_null($presentation_name) && !is_null($presentation_url) ) {
149
-        $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url,
148
+    if (!is_null($presentation_name) && !is_null($presentation_url)) {
149
+        $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url,
150 150
                 BIGBLUEBUTTONBN_METHOD_POST,
151
-                "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".$presentation_url."' /></module></modules>"
151
+                "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" . $presentation_url . "' /></module></modules>"
152 152
                 );
153 153
     } else {
154
-        $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url );
154
+        $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url);
155 155
     }
156 156
 
157
-    if ( $xml ) {
157
+    if ($xml) {
158 158
         if ($xml->meetingID)
159
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded );
159
+            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded);
160 160
         else
161
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
161
+            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
162 162
     } else {
163 163
         return null;
164 164
     }
165 165
 }
166 166
 
167
-function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT ) {
168
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL($URL, $SALT) );
167
+function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT) {
168
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingsURL($URL, $SALT));
169 169
 
170
-    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {    //The meetings were returned
170
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey) {    //The meetings were returned
171 171
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
172 172
 
173
-    } else if($xml && $xml->returncode == 'SUCCESS'){                    //If there were meetings already created
173
+    } else if ($xml && $xml->returncode == 'SUCCESS') {                    //If there were meetings already created
174 174
         foreach ($xml->meetings->meeting as $meeting) {
175
-            $meetings[] = array( 'meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running );
175
+            $meetings[] = array('meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running);
176 176
         }
177 177
         return $meetings;
178 178
 
179
-    } else if( $xml ) { //If the xml packet returned failure it displays the message to the user
179
+    } else if ($xml) { //If the xml packet returned failure it displays the message to the user
180 180
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
181 181
 
182 182
     } else { //If the server is unreachable, then prompts the user of the necessary action
@@ -184,21 +184,21 @@  discard block
 block discarded – undo
184 184
     }
185 185
 }
186 186
 
187
-function bigbluebuttonbn_getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) {
188
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
187
+function bigbluebuttonbn_getMeetingInfo($meetingID, $modPW, $URL, $SALT) {
188
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT));
189 189
     return $xml;
190 190
 }
191 191
 
192
-function bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) {
193
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
192
+function bigbluebuttonbn_getMeetingInfoArray($meetingID, $modPW, $URL, $SALT) {
193
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT));
194 194
 
195
-    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null){//The meeting info was returned
196
-        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
195
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null) {//The meeting info was returned
196
+        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
197 197
 
198
-    } else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created
199
-        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 );
198
+    } else if ($xml && $xml->returncode == 'SUCCESS') { //If there were meetings already created
199
+        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);
200 200
 
201
-    } else if( ($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user
201
+    } else if (($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user
202 202
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
203 203
 
204 204
     } else { //If the server is unreachable, then prompts the user of the necessary action
@@ -206,19 +206,19 @@  discard block
 block discarded – undo
206 206
     }
207 207
 }
208 208
 
209
-function bigbluebuttonbn_getRecordingsArray( $meetingIDs, $URL, $SALT ) {
209
+function bigbluebuttonbn_getRecordingsArray($meetingIDs, $URL, $SALT) {
210 210
     $recordings = array();
211 211
 
212
-    if ( is_array($meetingIDs) ) {
212
+    if (is_array($meetingIDs)) {
213 213
         // getRecordings is executes using a method POST (supported only on BBB 1.0 and later)
214
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT ), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs );
214
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs);
215 215
     } else {
216 216
         // getRecordings is executes using a method GET supported by any version of BBB
217
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingIDs ) );
217
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingIDs));
218 218
     }
219 219
 
220
-    if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created
221
-        foreach ( $xml->recordings->recording as $recording ) {
220
+    if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created
221
+        foreach ($xml->recordings->recording as $recording) {
222 222
             $recordings[] = bigbluebuttonbn_getRecordingArrayRow($recording);
223 223
         }
224 224
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     return $recordings;
229 229
 }
230 230
 
231
-function bigbluebuttonbn_index_recordings($recordings, $index_key='recordID') {
231
+function bigbluebuttonbn_index_recordings($recordings, $index_key = 'recordID') {
232 232
     $indexed_recordings = array();
233 233
 
234 234
     foreach ($recordings as $recording) {
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
     return $indexed_recordings;
239 239
 }
240 240
 
241
-function bigbluebuttonbn_getRecordingArray( $recordingID, $meetingID, $URL, $SALT ) {
241
+function bigbluebuttonbn_getRecordingArray($recordingID, $meetingID, $URL, $SALT) {
242 242
     $recordingArray = array();
243 243
 
244
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID ) );
244
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID));
245 245
 
246
-    if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created
246
+    if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created
247 247
         foreach ($xml->recordings->recording as $recording) {
248
-            if( $recording->recordID == $recordingID ) {
248
+            if ($recording->recordID == $recordingID) {
249 249
                 $recordingArray = bigbluebuttonbn_getRecordingArrayRow($recording);
250 250
                 break;
251 251
             }
@@ -255,57 +255,57 @@  discard block
 block discarded – undo
255 255
     return $recordingArray;
256 256
 }
257 257
 
258
-function bigbluebuttonbn_getRecordingArrayRow( $recording ) {
258
+function bigbluebuttonbn_getRecordingArrayRow($recording) {
259 259
     $recordingArrayRow = array();
260 260
 
261 261
     $playbackArray = array();
262
-    foreach ( $recording->playback->format as $format ) {
263
-        $playbackArray[(string) $format->type] = array( 'type' => (string) $format->type, 'url' => (string) $format->url, 'length' => (string) $format->length );
262
+    foreach ($recording->playback->format as $format) {
263
+        $playbackArray[(string)$format->type] = array('type' => (string)$format->type, 'url' => (string)$format->url, 'length' => (string)$format->length);
264 264
     }
265 265
 
266 266
     //Add the metadata to the recordings array
267 267
     $metadataArray = array();
268 268
     $metadata = get_object_vars($recording->metadata);
269
-    foreach ( $metadata as $key => $value ) {
270
-        if ( is_object($value) ) $value = '';
271
-        $metadataArray['meta_'.$key] = $value;
269
+    foreach ($metadata as $key => $value) {
270
+        if (is_object($value)) $value = '';
271
+        $metadataArray['meta_' . $key] = $value;
272 272
     }
273 273
 
274
-    $recordingArrayRow = 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;
274
+    $recordingArrayRow = 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;
275 275
 
276 276
     return $recordingArrayRow;
277 277
 }
278 278
 
279
-function bigbluebuttonbn_recordingBuildSorter($a, $b){
280
-    if( $a['startTime'] < $b['startTime']) return -1;
281
-    else if( $a['startTime'] == $b['startTime']) return 0;
279
+function bigbluebuttonbn_recordingBuildSorter($a, $b) {
280
+    if ($a['startTime'] < $b['startTime']) return -1;
281
+    else if ($a['startTime'] == $b['startTime']) return 0;
282 282
     else return 1;
283 283
 }
284 284
 
285
-function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) {
286
-    $ids = 	explode(",", $recordIDs);
287
-    foreach( $ids as $id){
288
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) );
289
-        if( $xml && $xml->returncode != 'SUCCESS' )
285
+function bigbluebuttonbn_doDeleteRecordings($recordIDs, $URL, $SALT) {
286
+    $ids = explode(",", $recordIDs);
287
+    foreach ($ids as $id) {
288
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT));
289
+        if ($xml && $xml->returncode != 'SUCCESS')
290 290
             return false;
291 291
     }
292 292
     return true;
293 293
 }
294 294
 
295
-function bigbluebuttonbn_doPublishRecordings( $recordIDs, $set, $URL, $SALT ) {
296
-    $ids = 	explode(",", $recordIDs);
297
-    foreach( $ids as $id){
298
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) );
299
-        if( $xml && $xml->returncode != 'SUCCESS' )
295
+function bigbluebuttonbn_doPublishRecordings($recordIDs, $set, $URL, $SALT) {
296
+    $ids = explode(",", $recordIDs);
297
+    foreach ($ids as $id) {
298
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT));
299
+        if ($xml && $xml->returncode != 'SUCCESS')
300 300
             return false;
301 301
     }
302 302
     return true;
303 303
 }
304 304
 
305
-function bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $URL, $SALT ) {
306
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) );
305
+function bigbluebuttonbn_doEndMeeting($meetingID, $modPW, $URL, $SALT) {
306
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT));
307 307
 
308
-    if( $xml ) { //If the xml packet returned failure it displays the message to the user
308
+    if ($xml) { //If the xml packet returned failure it displays the message to the user
309 309
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
310 310
     }
311 311
     else { //If the server is unreachable, then prompts the user of the necessary action
@@ -313,46 +313,46 @@  discard block
 block discarded – undo
313 313
     }
314 314
 }
315 315
 
316
-function bigbluebuttonbn_isMeetingRunning( $meetingID, $URL, $SALT ) {
317
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) );
318
-    if ( $xml && $xml->returncode == 'SUCCESS' ) {
319
-        return ( ( $xml->running == 'true' ) ? true : false);
316
+function bigbluebuttonbn_isMeetingRunning($meetingID, $URL, $SALT) {
317
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT));
318
+    if ($xml && $xml->returncode == 'SUCCESS') {
319
+        return (($xml->running == 'true') ? true : false);
320 320
     } else {
321
-        return ( false );
321
+        return (false);
322 322
     }
323 323
 }
324 324
 
325 325
 
326
-function bigbluebuttonbn_getServerVersion( $URL ){
327
-    $xml = bigbluebuttonbn_wrap_xml_load_file( $URL."api" );
328
-    if ( $xml && $xml->returncode == 'SUCCESS' ) {
326
+function bigbluebuttonbn_getServerVersion($URL) {
327
+    $xml = bigbluebuttonbn_wrap_xml_load_file($URL . "api");
328
+    if ($xml && $xml->returncode == 'SUCCESS') {
329 329
         return $xml->version;
330 330
     } else {
331 331
         return NULL;
332 332
     }
333 333
 }
334 334
 
335
-function bigbluebuttonbn_getMeetingXML( $meetingID, $URL, $SALT ) {
336
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) );
337
-    if ( $xml && $xml->returncode == 'SUCCESS') {
338
-        return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
335
+function bigbluebuttonbn_getMeetingXML($meetingID, $URL, $SALT) {
336
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT));
337
+    if ($xml && $xml->returncode == 'SUCCESS') {
338
+        return (str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
339 339
     } else {
340 340
         return 'false';
341 341
     }
342 342
 }
343 343
 
344
-function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) {
345
-    if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url);
344
+function bigbluebuttonbn_wrap_xml_load_file($url, $method = BIGBLUEBUTTONBN_METHOD_GET, $data = null) {
345
+    if (bigbluebuttonbn_debugdisplay()) error_log("Request to: " . $url);
346 346
 
347 347
     if (extension_loaded('curl')) {
348 348
         $c = new curl();
349
-        $c->setopt( Array( "SSL_VERIFYPEER" => true));
350
-        if( $method == BIGBLUEBUTTONBN_METHOD_POST ) {
351
-            if( !is_null($data) ) {
352
-                if( !is_array($data) ) {
349
+        $c->setopt(Array("SSL_VERIFYPEER" => true));
350
+        if ($method == BIGBLUEBUTTONBN_METHOD_POST) {
351
+            if (!is_null($data)) {
352
+                if (!is_array($data)) {
353 353
                     $options['CURLOPT_HTTPHEADER'] = array(
354 354
                             'Content-Type: text/xml',
355
-                            'Content-Length: '.strlen($data),
355
+                            'Content-Length: ' . strlen($data),
356 356
                             'Content-Language: en-US'
357 357
                         );
358 358
                     $response = $c->post($url, $data, $options);
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
             try {
375 375
                 $xml = new SimpleXMLElement($response, LIBXML_NOCDATA);
376 376
                 return $xml;
377
-            } catch (Exception $e){
377
+            } catch (Exception $e) {
378 378
                 libxml_use_internal_errors($previous);
379
-                $error = 'Caught exception: '.$e->getMessage();
379
+                $error = 'Caught exception: ' . $e->getMessage();
380 380
                 error_log($error);
381 381
                 return NULL;
382 382
             }
@@ -388,18 +388,18 @@  discard block
 block discarded – undo
388 388
     } else {
389 389
         $previous = libxml_use_internal_errors(true);
390 390
         try {
391
-            $xml = simplexml_load_file($url,'SimpleXMLElement', LIBXML_NOCDATA);
391
+            $xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA);
392 392
             return $xml;
393
-        } catch  (Exception $e){
393
+        } catch (Exception $e) {
394 394
             libxml_use_internal_errors($previous);
395 395
             return NULL;
396 396
         }
397 397
     }
398 398
 }
399 399
 
400
-function bigbluebuttonbn_get_role_name($role_shortname){
400
+function bigbluebuttonbn_get_role_name($role_shortname) {
401 401
     $role = bigbluebuttonbn_get_db_moodle_roles($role_shortname);
402
-    if( $role != null && $role->name != "") {
402
+    if ($role != null && $role->name != "") {
403 403
         $role_name = $role->name;
404 404
     } else {
405 405
         switch ($role_shortname) {
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
     return $role_name;
420 420
 }
421 421
 
422
-function bigbluebuttonbn_get_roles($rolename='all', $format='json'){
422
+function bigbluebuttonbn_get_roles($rolename = 'all', $format = 'json') {
423 423
     $roles = bigbluebuttonbn_get_db_moodle_roles($rolename);
424 424
     $roles_array = array();
425
-    foreach($roles as $role){
426
-        if( $format=='json' ) {
425
+    foreach ($roles as $role) {
426
+        if ($format == 'json') {
427 427
             array_push($roles_array,
428
-                    array( "id" => $role->shortname,
428
+                    array("id" => $role->shortname,
429 429
                         "name" => bigbluebuttonbn_get_role_name($role->shortname)
430 430
                     )
431 431
             );
@@ -436,19 +436,19 @@  discard block
 block discarded – undo
436 436
     return $roles_array;
437 437
 }
438 438
 
439
-function bigbluebuttonbn_get_roles_json($rolename='all'){
439
+function bigbluebuttonbn_get_roles_json($rolename = 'all') {
440 440
     return json_encode(bigbluebuttonbn_get_roles($rolename));
441 441
 }
442 442
 
443
-function bigbluebuttonbn_get_users_json($users, $full=false) {
444
-    if( $full ) {
443
+function bigbluebuttonbn_get_users_json($users, $full = false) {
444
+    if ($full) {
445 445
         return json_encode($users);
446 446
     } else {
447 447
         $users_array = array();
448
-        foreach($users as $user){
448
+        foreach ($users as $user) {
449 449
             array_push($users_array,
450
-                    array( "id" => $user->id,
451
-                            "name" => $user->firstname.' '.$user->lastname
450
+                    array("id" => $user->id,
451
+                            "name" => $user->firstname . ' ' . $user->lastname
452 452
                     )
453 453
             );
454 454
         }
@@ -456,15 +456,15 @@  discard block
 block discarded – undo
456 456
     }
457 457
 }
458 458
 
459
-function bigbluebuttonbn_get_participant_list($bigbluebuttonbn=null, $context=null){
459
+function bigbluebuttonbn_get_participant_list($bigbluebuttonbn = null, $context = null) {
460 460
     global $CFG, $USER;
461 461
 
462 462
     $participant_list_array = array();
463 463
 
464
-    if( $bigbluebuttonbn != null ) {
464
+    if ($bigbluebuttonbn != null) {
465 465
         $participant_list = json_decode($bigbluebuttonbn->participants);
466 466
         if (is_array($participant_list)) {
467
-            foreach($participant_list as $participant){
467
+            foreach ($participant_list as $participant) {
468 468
                 array_push($participant_list_array,
469 469
                         array(
470 470
                             "selectiontype" => $participant->selectiontype,
@@ -484,16 +484,16 @@  discard block
 block discarded – undo
484 484
         );
485 485
 
486 486
         $moderator_defaults = bigbluebuttonbn_get_cfg_moderator_default();
487
-        if ( !isset($moderator_defaults) ) {
487
+        if (!isset($moderator_defaults)) {
488 488
             $moderator_defaults = array('owner');
489 489
         } else {
490 490
             $moderator_defaults = explode(',', $moderator_defaults);
491 491
         }
492
-        foreach( $moderator_defaults as $moderator_default ) {
493
-            if( $moderator_default == 'owner' ) {
492
+        foreach ($moderator_defaults as $moderator_default) {
493
+            if ($moderator_default == 'owner') {
494 494
                 $users = bigbluebuttonbn_get_users($context);
495
-                foreach( $users as $user ){
496
-                    if( $user->id == $USER->id ){
495
+                foreach ($users as $user) {
496
+                    if ($user->id == $USER->id) {
497 497
                         array_push($participant_list_array,
498 498
                                 array(
499 499
                                         "selectiontype" => "user",
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
     return $participant_list_array;
520 520
 }
521 521
 
522
-function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid=null){
522
+function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid = null) {
523 523
     return json_encode(bigbluebuttonbn_get_participant_list($bigbluebuttonbnid));
524 524
 }
525 525
 
@@ -528,21 +528,21 @@  discard block
 block discarded – undo
528 528
 
529 529
     if (is_array($participant_list)) {
530 530
         // Iterate looking for all configuration
531
-        foreach($participant_list as $participant){
532
-            if( $participant->selectiontype == 'all' ) {
533
-                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
531
+        foreach ($participant_list as $participant) {
532
+            if ($participant->selectiontype == 'all') {
533
+                if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR)
534 534
                     return true;
535 535
             }
536 536
         }
537 537
 
538 538
         //Iterate looking for roles
539 539
         $db_moodle_roles = bigbluebuttonbn_get_db_moodle_roles();
540
-        foreach($participant_list as $participant){
541
-            if( $participant->selectiontype == 'role' ) {
542
-                foreach( $roles as $role ) {
540
+        foreach ($participant_list as $participant) {
541
+            if ($participant->selectiontype == 'role') {
542
+                foreach ($roles as $role) {
543 543
                     $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->roleid);
544
-                    if( $participant->selectionid == $db_moodle_role->shortname ) {
545
-                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
544
+                    if ($participant->selectionid == $db_moodle_role->shortname) {
545
+                        if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR)
546 546
                             return true;
547 547
                     }
548 548
                 }
@@ -550,10 +550,10 @@  discard block
 block discarded – undo
550 550
         }
551 551
 
552 552
         //Iterate looking for users
553
-        foreach($participant_list as $participant){
554
-            if( $participant->selectiontype == 'user' ) {
555
-                if( $participant->selectionid == $user ) {
556
-                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
553
+        foreach ($participant_list as $participant) {
554
+            if ($participant->selectiontype == 'user') {
555
+                if ($participant->selectionid == $user) {
556
+                    if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR)
557 557
                         return true;
558 558
                 }
559 559
             }
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
 }
565 565
 
566 566
 function bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role_id) {
567
-    foreach( $db_moodle_roles as $db_moodle_role ){
568
-        if( $role_id ==  $db_moodle_role->id ) {
567
+    foreach ($db_moodle_roles as $db_moodle_role) {
568
+        if ($role_id == $db_moodle_role->id) {
569 569
             return $db_moodle_role;
570 570
         }
571 571
     }
@@ -573,23 +573,23 @@  discard block
 block discarded – undo
573 573
 
574 574
 function bigbluebuttonbn_get_error_key($messageKey, $defaultKey = null) {
575 575
     $key = $defaultKey;
576
-    if ( $messageKey == "checksumError" ){
576
+    if ($messageKey == "checksumError") {
577 577
         $key = 'index_error_checksum';
578
-    } else if ( $messageKey == 'maxConcurrent' ) {
578
+    } else if ($messageKey == 'maxConcurrent') {
579 579
         $key = 'view_error_max_concurrent';
580 580
     }
581 581
     return $key;
582 582
 }
583 583
 
584
-function bigbluebuttonbn_voicebridge_unique($voicebridge, $id=null) {
584
+function bigbluebuttonbn_voicebridge_unique($voicebridge, $id = null) {
585 585
     global $DB;
586 586
 
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_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish=true){
837
+function bigbluebuttonbn_bbb_broker_do_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish = true) {
838 838
     global $DB;
839 839
 
840 840
     //Locate the record to be updated
@@ -843,9 +843,9 @@  discard block
 block discarded – undo
843 843
     $recordings_imported = array();
844 844
     foreach ($records as $key => $record) {
845 845
         $meta = json_decode($record->meta, true);
846
-        if( $recordingid == $meta['recording']['recordID'] ) {
846
+        if ($recordingid == $meta['recording']['recordID']) {
847 847
             // Found, prepare data for the update
848
-            $meta['recording']['published'] = ($publish)? 'true': 'false';
848
+            $meta['recording']['published'] = ($publish) ? 'true' : 'false';
849 849
             $records[$key]->meta = json_encode($meta);
850 850
 
851 851
             // Proceed with the update
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
     }
855 855
 }
856 856
 
857
-function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid){
857
+function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid) {
858 858
     global $CFG;
859 859
 
860 860
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
     bigbluebuttonbn_doDeleteRecordings($recordingid, $endpoint, $shared_secret);
864 864
 }
865 865
 
866
-function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID){
866
+function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID) {
867 867
     global $DB;
868 868
 
869 869
     //Locate the record to be updated
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
     $recordings_imported = array();
873 873
     foreach ($records as $key => $record) {
874 874
         $meta = json_decode($record->meta, true);
875
-        if( $recordingid == $meta['recording']['recordID'] ) {
875
+        if ($recordingid == $meta['recording']['recordID']) {
876 876
             // Execute delete
877 877
             $DB->delete_records("bigbluebuttonbn_logs", array('id' => $key));
878 878
         }
@@ -882,18 +882,18 @@  discard block
 block discarded – undo
882 882
 function bigbluebuttonbn_bbb_broker_validate_parameters($params) {
883 883
     $error = '';
884 884
 
885
-    if ( !isset($params['callback']) ) {
885
+    if (!isset($params['callback'])) {
886 886
         $error = bigbluebuttonbn_bbb_broker_add_error($error, 'This call must include a javascript callback.');
887 887
     }
888 888
 
889
-    if ( !isset($params['action']) ) {
889
+    if (!isset($params['action'])) {
890 890
         $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action parameter must be included.');
891 891
     } else {
892
-        switch ( strtolower($params['action']) ){
892
+        switch (strtolower($params['action'])) {
893 893
             case 'server_ping':
894 894
             case 'meeting_info':
895 895
             case 'meeting_end':
896
-                if ( !isset($params['id']) ) {
896
+                if (!isset($params['id'])) {
897 897
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The meetingID must be specified.');
898 898
                 }
899 899
                 break;
@@ -903,79 +903,79 @@  discard block
 block discarded – undo
903 903
             case 'recording_unpublish':
904 904
             case 'recording_delete':
905 905
             case 'recording_import':
906
-                if ( !isset($params['id']) ) {
906
+                if (!isset($params['id'])) {
907 907
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The recordingID must be specified.');
908 908
                 }
909 909
                 break;
910 910
             case 'recording_ready':
911
-                if( empty($params['signed_parameters']) ) {
911
+                if (empty($params['signed_parameters'])) {
912 912
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'A JWT encoded string must be included as [signed_parameters].');
913 913
                 }
914 914
                 break;
915 915
             default:
916
-                $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action '.$params['action'].' can not be performed.');
916
+                $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action ' . $params['action'] . ' can not be performed.');
917 917
         }
918 918
     }
919 919
 
920 920
     return $error;
921 921
 }
922 922
 
923
-function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg='') {
923
+function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg = '') {
924 924
     $error = $org_msg;
925 925
 
926
-    if( !empty($new_msg) ) {
927
-        if( !empty($error) ) $error .= ' ';
926
+    if (!empty($new_msg)) {
927
+        if (!empty($error)) $error .= ' ';
928 928
         $error .= $new_msg;
929 929
     }
930 930
 
931 931
     return $error;
932 932
 }
933 933
 
934
-function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools=["publishing", "deleting"]) {
934
+function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools = ["publishing", "deleting"]) {
935 935
     global $OUTPUT, $CFG, $USER;
936 936
 
937 937
     $row = null;
938 938
 
939
-    if ( $bbbsession['managerecordings'] || $recording['published'] == 'true' ) {
939
+    if ($bbbsession['managerecordings'] || $recording['published'] == 'true') {
940 940
         $length = 0;
941
-        $startTime = isset($recording['startTime'])? floatval($recording['startTime']):0;
941
+        $startTime = isset($recording['startTime']) ? floatval($recording['startTime']) : 0;
942 942
         $startTime = $startTime - ($startTime % 1000);
943
-        $endTime = isset($recording['endTime'])? floatval($recording['endTime']):0;
943
+        $endTime = isset($recording['endTime']) ? floatval($recording['endTime']) : 0;
944 944
         $endTime = $endTime - ($endTime % 1000);
945 945
         $duration = intval(array_values($recording['playbacks'])[0]['length']);
946 946
 
947 947
         //For backward compatibility
948
-        if( isset($recording['meta_contextactivity']) ) {
948
+        if (isset($recording['meta_contextactivity'])) {
949 949
             $meta_activity = str_replace('"', '\"', $recording['meta_contextactivity']);
950
-        } if( isset($recording['meta_bbb-recording-name']) ) {
950
+        } if (isset($recording['meta_bbb-recording-name'])) {
951 951
             $meta_activity = str_replace('"', '\"', $recording['meta_bbb-recording-name']);
952 952
         } else {
953 953
             $meta_activity = str_replace('"', '\"', $recording['meetingName']);
954 954
         }
955 955
 
956
-        if( isset($recording['meta_contextactivitydescription']) ) {
956
+        if (isset($recording['meta_contextactivitydescription'])) {
957 957
             $meta_description = str_replace('"', '\"', $recording['meta_contextactivitydescription']);
958
-        } else if( isset($recording['meta_bbb-recording-description']) ) {
958
+        } else if (isset($recording['meta_bbb-recording-description'])) {
959 959
             $meta_description = str_replace('"', '\"', $recording['meta_bbb-recording-description']);
960 960
         } else {
961 961
             $meta_description = '';
962 962
         }
963 963
 
964 964
         //Set recording_types
965
-        if ( isset($recording['imported']) ) {
966
-            $attributes = 'data-imported="true" title='.get_string('view_recording_link_warning', 'bigbluebuttonbn');
965
+        if (isset($recording['imported'])) {
966
+            $attributes = 'data-imported="true" title=' . get_string('view_recording_link_warning', 'bigbluebuttonbn');
967 967
         } else {
968 968
             $attributes = 'data-imported="false"';
969 969
         }
970 970
 
971 971
         $recording_types = '';
972 972
         if ($recording['published'] == 'true') {
973
-            $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'>';
973
+            $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '>';
974 974
         } else {
975
-            $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'" hidden>';
975
+            $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '" hidden>';
976 976
         }
977
-        foreach ( $recording['playbacks'] as $playback ) {
978
-            $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;';
977
+        foreach ($recording['playbacks'] as $playback) {
978
+            $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;';
979 979
         }
980 980
         $recording_types .= '</div>';
981 981
 
@@ -984,11 +984,11 @@  discard block
 block discarded – undo
984 984
 
985 985
         //Set actionbar, if user is allowed to manage recordings
986 986
         $actionbar = '';
987
-        if ( $bbbsession['managerecordings'] ) {
987
+        if ($bbbsession['managerecordings']) {
988 988
             // Set style for imported links
989
-            if( isset($recording['imported']) ) {
989
+            if (isset($recording['imported'])) {
990 990
                 $recordings_imported_count = 0;
991
-                $tag_tail = ' '.get_string('view_recording_link', 'bigbluebuttonbn');
991
+                $tag_tail = ' ' . get_string('view_recording_link', 'bigbluebuttonbn');
992 992
                 $head = '<i>';
993 993
                 $tail = '</i>';
994 994
             } else {
@@ -1002,53 +1002,53 @@  discard block
 block discarded – undo
1002 1002
 
1003 1003
             if (in_array("publishing", $tools)) {
1004 1004
                 ///Set action [show|hide]
1005
-                if ( $recording['published'] == 'true' ){
1005
+                if ($recording['published'] == 'true') {
1006 1006
                     $manage_tag = 'hide';
1007 1007
                     $manage_action = 'unpublish';
1008 1008
                 } else {
1009 1009
                     $manage_tag = 'show';
1010 1010
                     $manage_action = 'publish';
1011 1011
                 }
1012
-                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("'.$manage_action.'", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");';
1012
+                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("' . $manage_action . '", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
1013 1013
 
1014
-                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
1014
+                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1015 1015
                     //With icon for publish/unpublish
1016
-                    $icon_attributes = array('id' => 'recording-btn-'.$manage_action.'-'.$recording['recordID']);
1017
-                    $icon = new pix_icon('t/'.$manage_tag, get_string($manage_tag).$tag_tail, 'moodle', $icon_attributes);
1018
-                    $link_attributes = array('id' => 'recording-link-'.$manage_action.'-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1016
+                    $icon_attributes = array('id' => 'recording-btn-' . $manage_action . '-' . $recording['recordID']);
1017
+                    $icon = new pix_icon('t/' . $manage_tag, get_string($manage_tag) . $tag_tail, 'moodle', $icon_attributes);
1018
+                    $link_attributes = array('id' => 'recording-link-' . $manage_action . '-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1019 1019
                     $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
1020 1020
                 } else {
1021 1021
                     //With text for publish/unpublish
1022
-                    $link_attributes = array('title' => get_string($manage_tag).$tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1023
-                    $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag).$tag_tail, $action, $link_attributes);
1022
+                    $link_attributes = array('title' => get_string($manage_tag) . $tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1023
+                    $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag) . $tag_tail, $action, $link_attributes);
1024 1024
                     $actionbar .= "&nbsp;";
1025 1025
                 }
1026 1026
             }
1027 1027
 
1028 1028
             if (in_array("deleting", $tools)) {
1029
-                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");';
1029
+                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
1030 1030
 
1031
-                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
1031
+                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1032 1032
                     //With icon for delete
1033
-                    $icon_attributes = array('id' => 'recording-btn-delete-'.$recording['recordID']);
1034
-                    $icon = new pix_icon('t/delete', get_string('delete').$tag_tail, 'moodle', $icon_attributes);
1035
-                    $link_attributes = array('id' => 'recording-link-delete-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1033
+                    $icon_attributes = array('id' => 'recording-btn-delete-' . $recording['recordID']);
1034
+                    $icon = new pix_icon('t/delete', get_string('delete') . $tag_tail, 'moodle', $icon_attributes);
1035
+                    $link_attributes = array('id' => 'recording-link-delete-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1036 1036
                     $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
1037 1037
                 } else {
1038 1038
                     //With text for delete
1039
-                    $link_attributes = array('title' => get_string('delete').$tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1040
-                    $actionbar .= $OUTPUT->action_link($url, get_string('delete').$tag_tail, $action, $link_attributes);
1039
+                    $link_attributes = array('title' => get_string('delete') . $tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1040
+                    $actionbar .= $OUTPUT->action_link($url, get_string('delete') . $tag_tail, $action, $link_attributes);
1041 1041
                 }
1042 1042
             }
1043 1043
 
1044 1044
             if (in_array("importing", $tools)) {
1045
-                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");';
1045
+                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
1046 1046
 
1047
-                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
1047
+                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1048 1048
                     //With icon for import
1049
-                    $icon_attributes = array('id' => 'recording-btn-import-'.$recording['recordID']);
1049
+                    $icon_attributes = array('id' => 'recording-btn-import-' . $recording['recordID']);
1050 1050
                     $icon = new pix_icon('i/import', get_string('import'), 'moodle', $icon_attributes);
1051
-                    $link_attributes = array('id' => 'recording-link-import-'.$recording['recordID'], 'onclick' => $onclick);
1051
+                    $link_attributes = array('id' => 'recording-link-import-' . $recording['recordID'], 'onclick' => $onclick);
1052 1052
                     $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
1053 1053
                 } else {
1054 1054
                     //With text for import
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
         }
1060 1060
 
1061 1061
         //Set corresponding format
1062
-        $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z';
1062
+        $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
1063 1063
         $formattedStartDate = userdate($startTime / 1000, $dateformat, usertimezone($USER->timezone));
1064 1064
 
1065 1065
         $row = new stdClass();
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
         $row->date_formatted = "{$head}{$formattedStartDate}{$tail}";
1071 1071
         $row->duration = "{$duration}";
1072 1072
         $row->duration_formatted = "{$head}{$duration}{$tail}";
1073
-        if ( $bbbsession['managerecordings'] ) {
1073
+        if ($bbbsession['managerecordings']) {
1074 1074
             $row->actionbar = $actionbar;
1075 1075
         }
1076 1076
     }
@@ -1096,21 +1096,21 @@  discard block
 block discarded – undo
1096 1096
         array("key" =>"duration", "label" => $view_recording_duration, "width" => "50px")
1097 1097
         );
1098 1098
 
1099
-    if ( $bbbsession['managerecordings'] ) {
1099
+    if ($bbbsession['managerecordings']) {
1100 1100
         array_push($recordingsbn_columns, array("key" =>"actionbar", "label" => $view_recording_actionbar, "width" => "75px", "allowHTML" => true));
1101 1101
     }
1102 1102
 
1103 1103
     return $recordingsbn_columns;
1104 1104
 }
1105 1105
 
1106
-function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools=["publishing", "deleting"]) {
1106
+function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools = ["publishing", "deleting"]) {
1107 1107
     $table_data = array();
1108 1108
 
1109 1109
     ///Build table content
1110
-    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1111
-        foreach ( $recordings as $recording ) {
1110
+    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1111
+        foreach ($recordings as $recording) {
1112 1112
             $row = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools);
1113
-            if( $row != null ) {
1113
+            if ($row != null) {
1114 1114
                 array_push($table_data, $row);
1115 1115
             }
1116 1116
         }
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
     return $table_data;
1120 1120
 }
1121 1121
 
1122
-function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) {
1122
+function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) {
1123 1123
     global $OUTPUT, $CFG;
1124 1124
 
1125 1125
     ///Set strings to show
@@ -1138,20 +1138,20 @@  discard block
 block discarded – undo
1138 1138
     $table->data = array();
1139 1139
 
1140 1140
     ///Initialize table headers
1141
-    if ( $bbbsession['managerecordings'] ) {
1142
-        $table->head  = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar);
1143
-        $table->align = array ('left', 'left', 'left', 'left', 'center', 'left');
1141
+    if ($bbbsession['managerecordings']) {
1142
+        $table->head  = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar);
1143
+        $table->align = array('left', 'left', 'left', 'left', 'center', 'left');
1144 1144
     } else {
1145
-        $table->head  = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration);
1146
-        $table->align = array ('left', 'left', 'left', 'left', 'center');
1145
+        $table->head  = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration);
1146
+        $table->align = array('left', 'left', 'left', 'left', 'center');
1147 1147
     }
1148 1148
 
1149 1149
     ///Build table content
1150
-    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1151
-        foreach ( $recordings as $recording ){
1150
+    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1151
+        foreach ($recordings as $recording) {
1152 1152
             $row = new html_table_row();
1153
-            $row->id = 'recording-td-'.$recording['recordID'];
1154
-            if ( isset($recording['imported']) ) {
1153
+            $row->id = 'recording-td-' . $recording['recordID'];
1154
+            if (isset($recording['imported'])) {
1155 1155
                 $row->attributes['data-imported'] = 'true';
1156 1156
                 $row->attributes['title'] = get_string('view_recording_link_warning', 'bigbluebuttonbn');
1157 1157
             } else {
@@ -1159,12 +1159,12 @@  discard block
 block discarded – undo
1159 1159
             }
1160 1160
 
1161 1161
             $row_data = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools);
1162
-            if( $row_data != null ) {
1162
+            if ($row_data != null) {
1163 1163
                 $row_data->date_formatted = str_replace(" ", "&nbsp;", $row_data->date_formatted);
1164
-                if ( $bbbsession['managerecordings'] ) {
1165
-                    $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted, $row_data->actionbar );
1164
+                if ($bbbsession['managerecordings']) {
1165
+                    $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted, $row_data->actionbar);
1166 1166
                 } else {
1167
-                    $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted );
1167
+                    $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted);
1168 1168
                 }
1169 1169
 
1170 1170
                 array_push($table->data, $row);
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
     bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message_text);
1189 1189
 }
1190 1190
 
1191
-function bigbluebuttonbn_server_offers($capability_name){
1191
+function bigbluebuttonbn_server_offers($capability_name) {
1192 1192
     global $CFG;
1193 1193
 
1194 1194
     $capability_offered = null;
@@ -1202,12 +1202,12 @@  discard block
 block discarded – undo
1202 1202
     $host_ends = explode(".", $host);
1203 1203
     $host_ends_length = count($host_ends);
1204 1204
 
1205
-    if( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' &&  $host_ends[$host_ends_length -2] == 'blindsidenetworks' ) {
1205
+    if ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks') {
1206 1206
         //Validate the capabilities offered
1207
-        $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret );
1208
-        if( $capabilities ) {
1207
+        $capabilities = bigbluebuttonbn_getCapabilitiesArray($endpoint, $shared_secret);
1208
+        if ($capabilities) {
1209 1209
             foreach ($capabilities as $capability) {
1210
-                if( $capability["name"] == $capability_name)
1210
+                if ($capability["name"] == $capability_name)
1211 1211
                     $capability_offered = $capability;
1212 1212
             }
1213 1213
         }
@@ -1216,14 +1216,14 @@  discard block
 block discarded – undo
1216 1216
     return $capability_offered;
1217 1217
 }
1218 1218
 
1219
-function bigbluebuttonbn_server_offers_bn_capabilities(){
1219
+function bigbluebuttonbn_server_offers_bn_capabilities() {
1220 1220
     //Validates if the server may have extended capabilities
1221 1221
     $parsed_url = parse_url(bigbluebuttonbn_get_cfg_server_url());
1222 1222
     $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
1223 1223
     $host_ends = explode(".", $host);
1224 1224
     $host_ends_length = count($host_ends);
1225 1225
 
1226
-    return ( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' && $host_ends[$host_ends_length -2] == 'blindsidenetworks' );
1226
+    return ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks');
1227 1227
 }
1228 1228
 
1229 1229
 function bigbluebuttonbn_get_locales_for_ui() {
@@ -1266,89 +1266,89 @@  discard block
 block discarded – undo
1266 1266
 
1267 1267
 function bigbluebuttonbn_get_cfg_server_url_default() {
1268 1268
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1269
-    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/')));
1269
+    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/')));
1270 1270
 }
1271 1271
 
1272 1272
 function bigbluebuttonbn_get_cfg_shared_secret_default() {
1273 1273
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1274
-    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')));
1274
+    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')));
1275 1275
 }
1276 1276
 
1277 1277
 function bigbluebuttonbn_get_cfg_voicebridge_editable() {
1278 1278
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1279
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable: (isset($CFG->bigbluebuttonbn_voicebridge_editable)? $CFG->bigbluebuttonbn_voicebridge_editable: false));
1279
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable : (isset($CFG->bigbluebuttonbn_voicebridge_editable) ? $CFG->bigbluebuttonbn_voicebridge_editable : false));
1280 1280
 }
1281 1281
 
1282 1282
 function bigbluebuttonbn_get_cfg_recording_default() {
1283 1283
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1284
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default: (isset($CFG->bigbluebuttonbn_recording_default)? $CFG->bigbluebuttonbn_recording_default: true));
1284
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default : (isset($CFG->bigbluebuttonbn_recording_default) ? $CFG->bigbluebuttonbn_recording_default : true));
1285 1285
 }
1286 1286
 
1287 1287
 function bigbluebuttonbn_get_cfg_recording_editable() {
1288 1288
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1289
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable: (isset($CFG->bigbluebuttonbn_recording_editable)? $CFG->bigbluebuttonbn_recording_editable: true));
1289
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable : (isset($CFG->bigbluebuttonbn_recording_editable) ? $CFG->bigbluebuttonbn_recording_editable : true));
1290 1290
 }
1291 1291
 
1292 1292
 function bigbluebuttonbn_get_cfg_recording_tagging_default() {
1293 1293
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1294
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default: (isset($CFG->bigbluebuttonbn_recordingtagging_default)? $CFG->bigbluebuttonbn_recordingtagging_default: false));
1294
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default : (isset($CFG->bigbluebuttonbn_recordingtagging_default) ? $CFG->bigbluebuttonbn_recordingtagging_default : false));
1295 1295
 }
1296 1296
 
1297 1297
 function bigbluebuttonbn_get_cfg_recording_tagging_editable() {
1298 1298
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1299
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable: (isset($CFG->bigbluebuttonbn_recordingtagging_editable)? $CFG->bigbluebuttonbn_recordingtagging_editable: false));
1299
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable : (isset($CFG->bigbluebuttonbn_recordingtagging_editable) ? $CFG->bigbluebuttonbn_recordingtagging_editable : false));
1300 1300
 }
1301 1301
 
1302 1302
 function bigbluebuttonbn_get_cfg_recording_icons_enabled() {
1303 1303
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1304
-    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));
1304
+    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));
1305 1305
 }
1306 1306
 
1307 1307
 function bigbluebuttonbn_get_cfg_importrecordings_enabled() {
1308 1308
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1309
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled: (isset($CFG->bigbluebuttonbn_importrecordings_enabled)? $CFG->bigbluebuttonbn_importrecordings_enabled: false));
1309
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled : (isset($CFG->bigbluebuttonbn_importrecordings_enabled) ? $CFG->bigbluebuttonbn_importrecordings_enabled : false));
1310 1310
 }
1311 1311
 
1312 1312
 function bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled() {
1313 1313
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1314
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled: (isset($CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)? $CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled: false));
1314
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled : (isset($CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ? $CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled : false));
1315 1315
 }
1316 1316
 
1317 1317
 function bigbluebuttonbn_get_cfg_waitformoderator_default() {
1318 1318
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1319
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default: (isset($CFG->bigbluebuttonbn_waitformoderator_default)? $CFG->bigbluebuttonbn_waitformoderator_default: false));
1319
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default : (isset($CFG->bigbluebuttonbn_waitformoderator_default) ? $CFG->bigbluebuttonbn_waitformoderator_default : false));
1320 1320
 }
1321 1321
 
1322 1322
 function bigbluebuttonbn_get_cfg_waitformoderator_editable() {
1323 1323
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1324
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable: (isset($CFG->bigbluebuttonbn_waitformoderator_editable)? $CFG->bigbluebuttonbn_waitformoderator_editable: true));
1324
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable : (isset($CFG->bigbluebuttonbn_waitformoderator_editable) ? $CFG->bigbluebuttonbn_waitformoderator_editable : true));
1325 1325
 }
1326 1326
 
1327 1327
 function bigbluebuttonbn_get_cfg_waitformoderator_ping_interval() {
1328 1328
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1329
-    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));
1329
+    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));
1330 1330
 }
1331 1331
 
1332 1332
 function bigbluebuttonbn_get_cfg_waitformoderator_cache_ttl() {
1333 1333
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1334
-    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));
1334
+    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));
1335 1335
 }
1336 1336
 
1337 1337
 function bigbluebuttonbn_get_cfg_userlimit_default() {
1338 1338
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1339
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default: (isset($CFG->bigbluebuttonbn_userlimit_default)? $CFG->bigbluebuttonbn_userlimit_default: 0));
1339
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default : (isset($CFG->bigbluebuttonbn_userlimit_default) ? $CFG->bigbluebuttonbn_userlimit_default : 0));
1340 1340
 }
1341 1341
 
1342 1342
 function bigbluebuttonbn_get_cfg_userlimit_editable() {
1343 1343
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1344
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable: (isset($CFG->bigbluebuttonbn_userlimit_editable)? $CFG->bigbluebuttonbn_userlimit_editable: false));
1344
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable : (isset($CFG->bigbluebuttonbn_userlimit_editable) ? $CFG->bigbluebuttonbn_userlimit_editable : false));
1345 1345
 }
1346 1346
 
1347 1347
 function bigbluebuttonbn_get_cfg_preuploadpresentation_enabled() {
1348 1348
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1349 1349
     if (extension_loaded('curl')) {
1350 1350
         // This feature only works if curl is installed
1351
-        return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled: (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $CFG->bigbluebuttonbn_preuploadpresentation_enabled: false));
1351
+        return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled : (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $CFG->bigbluebuttonbn_preuploadpresentation_enabled : false));
1352 1352
     } else {
1353 1353
         return false;
1354 1354
     }
@@ -1356,37 +1356,37 @@  discard block
 block discarded – undo
1356 1356
 
1357 1357
 function bigbluebuttonbn_get_cfg_sendnotifications_enabled() {
1358 1358
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1359
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled: (isset($CFG->bigbluebuttonbn_sendnotifications_enabled)? $CFG->bigbluebuttonbn_sendnotifications_enabled: false));
1359
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled : (isset($CFG->bigbluebuttonbn_sendnotifications_enabled) ? $CFG->bigbluebuttonbn_sendnotifications_enabled : false));
1360 1360
 }
1361 1361
 
1362 1362
 function bigbluebuttonbn_get_cfg_recordingready_enabled() {
1363 1363
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1364
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled: (isset($CFG->bigbluebuttonbn_recordingready_enabled)? $CFG->bigbluebuttonbn_recordingready_enabled: false));
1364
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled : (isset($CFG->bigbluebuttonbn_recordingready_enabled) ? $CFG->bigbluebuttonbn_recordingready_enabled : false));
1365 1365
 }
1366 1366
 
1367 1367
 function bigbluebuttonbn_get_cfg_moderator_default() {
1368 1368
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1369
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default: (isset($CFG->bigbluebuttonbn_moderator_default)? $CFG->bigbluebuttonbn_moderator_default: 'owner'));
1369
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default : (isset($CFG->bigbluebuttonbn_moderator_default) ? $CFG->bigbluebuttonbn_moderator_default : 'owner'));
1370 1370
 }
1371 1371
 
1372 1372
 function bigbluebuttonbn_get_cfg_scheduled_duration_enabled() {
1373 1373
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1374
-    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));
1374
+    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));
1375 1375
 }
1376 1376
 
1377 1377
 function bigbluebuttonbn_get_cfg_scheduled_duration_compensation() {
1378 1378
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1379
-    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));
1379
+    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));
1380 1380
 }
1381 1381
 
1382 1382
 function bigbluebuttonbn_get_cfg_scheduled_pre_opening() {
1383 1383
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1384
-    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));
1384
+    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));
1385 1385
 }
1386 1386
 
1387 1387
 function bigbluebuttonbn_import_get_courses_for_select(array $bbbsession) {
1388 1388
 
1389
-    if( $bbbsession['administrator'] ) {
1389
+    if ($bbbsession['administrator']) {
1390 1390
         $courses = get_courses('all', 'c.id ASC', 'c.id,c.shortname,c.fullname');
1391 1391
         //It includes the name of the site as a course (category 0), so remove the first one
1392 1392
         unset($courses["1"]);
@@ -1395,21 +1395,21 @@  discard block
 block discarded – undo
1395 1395
     }
1396 1396
 
1397 1397
     $courses_for_select = [];
1398
-    foreach($courses as $course) {
1399
-        if( $course->id != $bbbsession['course']->id ) {
1398
+    foreach ($courses as $course) {
1399
+        if ($course->id != $bbbsession['course']->id) {
1400 1400
             $courses_for_select[$course->id] = $course->fullname;
1401 1401
         }
1402 1402
     }
1403 1403
     return $courses_for_select;
1404 1404
 }
1405 1405
 
1406
-function bigbluebuttonbn_getRecordedMeetingsDeleted($courseID, $bigbluebuttonbnID=NULL) {
1406
+function bigbluebuttonbn_getRecordedMeetingsDeleted($courseID, $bigbluebuttonbnID = NULL) {
1407 1407
     global $DB;
1408 1408
 
1409 1409
     $records_deleted = array();
1410 1410
 
1411
-    $filter = array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_DELETE );
1412
-    if ( $bigbluebuttonbnID != NULL ) {
1411
+    $filter = array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_DELETE);
1412
+    if ($bigbluebuttonbnID != NULL) {
1413 1413
         $filter['id'] = $bigbluebuttonbnID;
1414 1414
     }
1415 1415
 
@@ -1418,17 +1418,17 @@  discard block
 block discarded – undo
1418 1418
     foreach ($bigbluebuttonbns_deleted as $key => $bigbluebuttonbn_deleted) {
1419 1419
         $records = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE));
1420 1420
 
1421
-        if( !empty($records) ) {
1421
+        if (!empty($records)) {
1422 1422
             //Remove duplicates
1423 1423
             $unique_records = array();
1424 1424
             foreach ($records as $key => $record) {
1425
-                if (array_key_exists($record->meetingid, $unique_records) ) {
1425
+                if (array_key_exists($record->meetingid, $unique_records)) {
1426 1426
                     unset($records[$key]);
1427 1427
                 } else {
1428 1428
                     $meta = json_decode($record->meta);
1429
-                    if ( !$meta->record ) {
1429
+                    if (!$meta->record) {
1430 1430
                         unset($records[$key]);
1431
-                    } else if ( $bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) {
1431
+                    } else if ($bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) {
1432 1432
                         unset($records[$key]);
1433 1433
                     } else {
1434 1434
                         array_push($unique_records, $record->meetingid);
@@ -1443,27 +1443,27 @@  discard block
 block discarded – undo
1443 1443
     return $records_deleted;
1444 1444
 }
1445 1445
 
1446
-function bigbluebuttonbn_getRecordedMeetings($courseID, $bigbluebuttonbnID=NULL) {
1446
+function bigbluebuttonbn_getRecordedMeetings($courseID, $bigbluebuttonbnID = NULL) {
1447 1447
     global $DB;
1448 1448
 
1449 1449
     $records = Array();
1450 1450
 
1451 1451
     $filter = array('course' => $courseID);
1452
-    if ( $bigbluebuttonbnID != NULL ) {
1452
+    if ($bigbluebuttonbnID != NULL) {
1453 1453
         $filter['id'] = $bigbluebuttonbnID;
1454 1454
     }
1455 1455
     $bigbluebuttonbns = $DB->get_records('bigbluebuttonbn', $filter);
1456 1456
 
1457
-    if ( !empty($bigbluebuttonbns) ) {
1457
+    if (!empty($bigbluebuttonbns)) {
1458 1458
         $table = 'bigbluebuttonbn_logs';
1459 1459
 
1460 1460
         //Prepare select for loading records based on existent bigbluebuttonbns
1461 1461
         $select = "";
1462 1462
         foreach ($bigbluebuttonbns as $key => $bigbluebuttonbn) {
1463
-            $select .= strlen($select) == 0? "(": " OR ";
1464
-            $select .= "bigbluebuttonbnid=".$bigbluebuttonbn->id;
1463
+            $select .= strlen($select) == 0 ? "(" : " OR ";
1464
+            $select .= "bigbluebuttonbnid=" . $bigbluebuttonbn->id;
1465 1465
         }
1466
-        $select .= ") AND log='".BIGBLUEBUTTONBN_LOG_EVENT_CREATE."'";
1466
+        $select .= ") AND log='" . BIGBLUEBUTTONBN_LOG_EVENT_CREATE . "'";
1467 1467
 
1468 1468
         //Execute select for loading records based on existent bigbluebuttonbns
1469 1469
         $records = $DB->get_records_select($table, $select);
@@ -1471,8 +1471,8 @@  discard block
 block discarded – undo
1471 1471
         //Remove duplicates
1472 1472
         $unique_records = array();
1473 1473
         foreach ($records as $key => $record) {
1474
-            $record_key = $record->meetingid.','.$record->bigbluebuttonbnid.','.$record->meta;
1475
-            if( array_search($record_key, $unique_records) === false ) {
1474
+            $record_key = $record->meetingid . ',' . $record->bigbluebuttonbnid . ',' . $record->meta;
1475
+            if (array_search($record_key, $unique_records) === false) {
1476 1476
                 array_push($unique_records, $record_key);
1477 1477
             } else {
1478 1478
                 unset($records[$key]);
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
         //Remove the ones with record=false
1483 1483
         foreach ($records as $key => $record) {
1484 1484
             $meta = json_decode($record->meta);
1485
-            if ( !$meta || !$meta->record ) {
1485
+            if (!$meta || !$meta->record) {
1486 1486
                 unset($records[$key]);
1487 1487
             }
1488 1488
         }
@@ -1496,15 +1496,15 @@  discard block
 block discarded – undo
1496 1496
 
1497 1497
     // Load the meetingIDs to be used in the getRecordings request
1498 1498
     $meetingID = '';
1499
-    if ( is_numeric($courseID) ) {
1499
+    if (is_numeric($courseID)) {
1500 1500
         $results = bigbluebuttonbn_getRecordedMeetings($courseID);
1501 1501
 
1502
-        if( bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled() ) {
1502
+        if (bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled()) {
1503 1503
             $results_deleted = bigbluebuttonbn_getRecordedMeetingsDeleted($courseID);
1504 1504
             $results = array_merge($results, $results_deleted);
1505 1505
         }
1506 1506
 
1507
-        if( $results ) {
1507
+        if ($results) {
1508 1508
             //Eliminates duplicates
1509 1509
             $mIDs = array();
1510 1510
             foreach ($results as $result) {
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
     }
1520 1520
 
1521 1521
     // If there were meetingIDs excecute the getRecordings request
1522
-    if ( $meetingID != '' ) {
1522
+    if ($meetingID != '') {
1523 1523
         $recordings = bigbluebuttonbn_getRecordingsArray($meetingID, $URL, $SALT);
1524 1524
     }
1525 1525
 
@@ -1542,37 +1542,37 @@  discard block
 block discarded – undo
1542 1542
     $recordings_already_imported_indexed = bigbluebuttonbn_index_recordings($recordings_already_imported);
1543 1543
 
1544 1544
     foreach ($recordings as $key => $recording) {
1545
-        if( isset($recordings_already_imported_indexed[$recording['recordID']]) ) {
1545
+        if (isset($recordings_already_imported_indexed[$recording['recordID']])) {
1546 1546
             unset($recordings[$key]);
1547 1547
         }
1548 1548
     }
1549 1549
     return $recordings;
1550 1550
 }
1551 1551
 
1552
-function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) {
1552
+function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) {
1553 1553
 
1554
-    if ( isset($recordings) && !empty($recordings) ) {  // There are recordings for this meeting
1554
+    if (isset($recordings) && !empty($recordings)) {  // There are recordings for this meeting
1555 1555
         $table = bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools);
1556 1556
     }
1557 1557
 
1558 1558
     $output = '';
1559
-    if( isset($table->data) ) {
1559
+    if (isset($table->data)) {
1560 1560
         //Print the table
1561
-        $output .= '<div id="bigbluebuttonbn_html_table">'."\n";
1562
-        $output .= html_writer::table($table)."\n";
1563
-        $output .= '</div>'."\n";
1561
+        $output .= '<div id="bigbluebuttonbn_html_table">' . "\n";
1562
+        $output .= html_writer::table($table) . "\n";
1563
+        $output .= '</div>' . "\n";
1564 1564
 
1565 1565
     } else {
1566
-        $output .= get_string('view_message_norecordings', 'bigbluebuttonbn').'<br>'."\n";
1566
+        $output .= get_string('view_message_norecordings', 'bigbluebuttonbn') . '<br>' . "\n";
1567 1567
     }
1568 1568
 
1569 1569
     return $output;
1570 1570
 }
1571 1571
 
1572
-function bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID=NULL) {
1572
+function bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID = NULL) {
1573 1573
     global $DB;
1574 1574
 
1575
-    if ( $bigbluebuttonbnID != NULL ) {
1575
+    if ($bigbluebuttonbnID != NULL) {
1576 1576
         // Fetch only those related to the $courseID and $bigbluebuttonbnID requested
1577 1577
         $recordings_imported = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'bigbluebuttonbnid' => $bigbluebuttonbnID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_IMPORT));
1578 1578
     } else {
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
     return $recordings_imported;
1583 1583
 }
1584 1584
 
1585
-function bigbluebuttonbn_getRecordingsImportedArray($courseID, $bigbluebuttonbnID=NULL) {
1585
+function bigbluebuttonbn_getRecordingsImportedArray($courseID, $bigbluebuttonbnID = NULL) {
1586 1586
     $recordings_imported = bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID);
1587 1587
     $recordings_imported_array = bigbluebuttonbn_import_get_recordings_imported($recordings_imported);
1588 1588
     return $recordings_imported_array;
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 function bigbluebuttonbn_getRecordingsImportedAllInstances($recordID) {
1592 1592
     global $DB, $CFG;
1593 1593
 
1594
-    $recordings_imported = $DB->get_records_sql('SELECT * FROM '.$CFG->prefix.'bigbluebuttonbn_logs WHERE log=? AND '.$DB->sql_like('meta', '?'), array( BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, '%'.$recordID.'%' ));
1594
+    $recordings_imported = $DB->get_records_sql('SELECT * FROM ' . $CFG->prefix . 'bigbluebuttonbn_logs WHERE log=? AND ' . $DB->sql_like('meta', '?'), array(BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, '%' . $recordID . '%'));
1595 1595
     return $recordings_imported;
1596 1596
 }
1597 1597
 
@@ -1610,8 +1610,8 @@  discard block
 block discarded – undo
1610 1610
 function bigbluebuttonbn_html2text($html, $len) {
1611 1611
     $text = strip_tags($html);
1612 1612
     $text = str_replace("&nbsp;", ' ', $text);
1613
-    if( strlen($text) > $len )
1614
-        $text = substr($text, 0, $len)."...";
1613
+    if (strlen($text) > $len)
1614
+        $text = substr($text, 0, $len) . "...";
1615 1615
     else
1616 1616
         $text = substr($text, 0, $len);
1617 1617
     return $text;
Please login to merge, or discard this patch.