Completed
Push — master ( ef28c1...9aefdf )
by Jesus
02:33
created
bbb_view.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,8 +88,9 @@
 block discarded – undo
88 88
                     /// Set the duration for the meeting
89 89
                     if ( bigbluebuttonbn_get_cfg_scheduled_duration_enabled() ) {
90 90
                         $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime);
91
-                        if( $durationtime > 0 )
92
-                            $bbbsession['welcome'] .= '<br><br>'.str_replace("%duration%", ''.$durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn'));
91
+                        if( $durationtime > 0 ) {
92
+                                                    $bbbsession['welcome'] .= '<br><br>'.str_replace("%duration%", ''.$durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn'));
93
+                        }
93 94
                     } else {
94 95
                         $durationtime = 0;
95 96
                     }
Please login to merge, or discard this patch.
bbb_broker.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,8 +119,9 @@
 block discarded – undo
119 119
                         //Execute the end command
120 120
                         $meeting_info = bigbluebuttonbn_bbb_broker_do_end_meeting($params['id'], $bbbsession['modPW']);
121 121
                         // Moodle event logger: Create an event for meeting ended
122
-                        if( isset($bigbluebuttonbn) )
123
-                            bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm);
122
+                        if( isset($bigbluebuttonbn) ) {
123
+                                                    bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm);
124
+                        }
124 125
                         /// Update the cache
125 126
                         $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($params['id'], $bbbsession['modPW'], true);
126 127
 
Please login to merge, or discard this patch.
mod_form.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -269,8 +269,9 @@
 block discarded – undo
269 269
         // Fourth block starts here
270 270
         //-------------------------------------------------------------------------------
271 271
         $mform->addElement('header', 'schedule', get_string('mod_form_block_schedule', 'bigbluebuttonbn'));
272
-        if( isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0 )
273
-            $mform->setExpanded('schedule');
272
+        if( isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0 ) {
273
+                    $mform->setExpanded('schedule');
274
+        }
274 275
 
275 276
         $mform->addElement('date_time_selector', 'openingtime', get_string('mod_form_field_openingtime', 'bigbluebuttonbn'), array('optional' => true));
276 277
         $mform->setDefault('openingtime', 0);
Please login to merge, or discard this patch.
lib.php 1 patch
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -388,14 +388,18 @@  discard block
 block discarded – undo
388 388
         $bigbluebuttonbn->timemodified = time();
389 389
     }
390 390
 
391
-    if (! isset($bigbluebuttonbn->newwindow))
392
-        $bigbluebuttonbn->newwindow = 0;
393
-    if (! isset($bigbluebuttonbn->wait))
394
-        $bigbluebuttonbn->wait = 0;
395
-    if (! isset($bigbluebuttonbn->record))
396
-        $bigbluebuttonbn->record = 0;
397
-    if (! isset($bigbluebuttonbn->tagging))
398
-        $bigbluebuttonbn->tagging = 0;
391
+    if (! isset($bigbluebuttonbn->newwindow)) {
392
+            $bigbluebuttonbn->newwindow = 0;
393
+    }
394
+    if (! isset($bigbluebuttonbn->wait)) {
395
+            $bigbluebuttonbn->wait = 0;
396
+    }
397
+    if (! isset($bigbluebuttonbn->record)) {
398
+            $bigbluebuttonbn->record = 0;
399
+    }
400
+    if (! isset($bigbluebuttonbn->tagging)) {
401
+            $bigbluebuttonbn->tagging = 0;
402
+    }
399 403
 
400 404
     $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants);
401 405
 }
@@ -463,8 +467,9 @@  discard block
 block discarded – undo
463 467
         /// Add the meeting details to the message_body
464 468
         $msg->action = ucfirst($action);
465 469
         $msg->activity_description = "";
466
-        if( !empty($bigbluebuttonbn->intro) )
467
-            $msg->activity_description = trim($bigbluebuttonbn->intro);
470
+        if( !empty($bigbluebuttonbn->intro) ) {
471
+                    $msg->activity_description = trim($bigbluebuttonbn->intro);
472
+        }
468 473
         $msg->activity_openingtime = "";
469 474
         if ($bigbluebuttonbn->openingtime) {
470 475
             $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime);
@@ -622,10 +627,11 @@  discard block
 block discarded – undo
622 627
 function bigbluebuttonbn_get_db_moodle_roles($rolename='all') {
623 628
     global $DB;
624 629
 
625
-    if( $rolename != 'all')
626
-        $roles = $DB->get_record('role', array('shortname' => $rolename));
627
-    else
628
-        $roles = $DB->get_records('role', array());
630
+    if( $rolename != 'all') {
631
+            $roles = $DB->get_record('role', array('shortname' => $rolename));
632
+    } else {
633
+            $roles = $DB->get_records('role', array());
634
+    }
629 635
 
630 636
     return $roles;
631 637
 }
Please login to merge, or discard this patch.
view.php 1 patch
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@  discard block
 block discarded – undo
84 84
 $bbbsession['voicebridge'] = ($bigbluebuttonbn->voicebridge > 0)? 70000 + $bigbluebuttonbn->voicebridge: $bigbluebuttonbn->voicebridge;
85 85
 $bbbsession['wait'] = $bigbluebuttonbn->wait;
86 86
 $bbbsession['record'] = $bigbluebuttonbn->record;
87
-if( $bigbluebuttonbn->record )
87
+if( $bigbluebuttonbn->record ) {
88 88
     $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn');
89
+}
89 90
 $bbbsession['tagging'] = $bigbluebuttonbn->tagging;
90 91
 
91 92
 $bbbsession['openingtime'] = $bigbluebuttonbn->openingtime;
@@ -112,22 +113,24 @@  discard block
 block discarded – undo
112 113
 // Validates if the BigBlueButton server is running
113 114
 $serverVersion = bigbluebuttonbn_getServerVersion($bbbsession['endpoint']);
114 115
 if ( !isset($serverVersion) ) { //Server is not working
115
-    if ( $bbbsession['administrator'] )
116
-        print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
117
-    else if ( $bbbsession['moderator'] )
118
-        print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
119
-    else
120
-        print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
121
-} else {
122
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL( $bbbsession['endpoint'], $bbbsession['shared_secret'] ) );
123
-    if ( !isset($xml) || !isset($xml->returncode) || $xml->returncode == 'FAILED' ){ // The shared secret is wrong
124
-        if ( $bbbsession['administrator'] )
116
+    if ( $bbbsession['administrator'] ) {
125 117
             print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
126
-        else if ( $bbbsession['moderator'] )
118
+    } else if ( $bbbsession['moderator'] ) {
127 119
             print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
128
-        else
120
+    } else {
129 121
             print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
130 122
     }
123
+    } else {
124
+    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL( $bbbsession['endpoint'], $bbbsession['shared_secret'] ) );
125
+    if ( !isset($xml) || !isset($xml->returncode) || $xml->returncode == 'FAILED' ){ // The shared secret is wrong
126
+        if ( $bbbsession['administrator'] ) {
127
+                    print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
128
+        } else if ( $bbbsession['moderator'] ) {
129
+                    print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
130
+        } else {
131
+                    print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
132
+        }
133
+    }
131 134
 }
132 135
 
133 136
 // Mark viewed by user (if required)
@@ -203,10 +206,11 @@  discard block
 block discarded – undo
203 206
     }
204 207
 
205 208
     $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.$bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']';
206
-    if( $bbbsession['group'] > 0 )
207
-        $group_name = groups_get_group_name($bbbsession['group']);
208
-    else
209
-        $group_name = get_string('allparticipants');
209
+    if( $bbbsession['group'] > 0 ) {
210
+            $group_name = groups_get_group_name($bbbsession['group']);
211
+    } else {
212
+            $group_name = get_string('allparticipants');
213
+    }
210 214
     $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$group_name.')';
211 215
 }
212 216
 // Metadata (context)
@@ -362,7 +366,9 @@  discard block
 block discarded – undo
362 366
             }
363 367
             //Generates the meetingID string
364 368
             foreach ($mIDs as $mID) {
365
-                if (strlen($meetingID) > 0) $meetingID .= ',';
369
+                if (strlen($meetingID) > 0) {
370
+                    $meetingID .= ',';
371
+                }
366 372
                 $meetingID .= $mID;
367 373
             }
368 374
         }
Please login to merge, or discard this patch.
locallib.php 1 patch
Braces   +64 added lines, -39 removed lines patch added patch discarded remove patch
@@ -69,19 +69,23 @@  discard block
 block discarded – undo
69 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 76
     $duration = intval($duration);
76
-    if( $duration > 0 )
77
-        $params .= '&duration='.$duration;
77
+    if( $duration > 0 ) {
78
+            $params .= '&duration='.$duration;
79
+    }
78 80
 
79 81
     $maxParticipants = intval($maxParticipants);
80
-    if( $maxParticipants > 0 )
81
-        $params .= '&maxParticipants='.$maxParticipants;
82
+    if( $maxParticipants > 0 ) {
83
+            $params .= '&maxParticipants='.$maxParticipants;
84
+    }
82 85
 
83
-    if( trim( $welcome ) )
84
-        $params .= '&welcome='.urlencode($welcome);
86
+    if( trim( $welcome ) ) {
87
+            $params .= '&welcome='.urlencode($welcome);
88
+    }
85 89
 
86 90
     foreach ($metadata as $key => $value) {
87 91
         $params .= '&'.$key.'='.urlencode($value);
@@ -155,10 +159,11 @@  discard block
 block discarded – undo
155 159
     }
156 160
 
157 161
     if ( $xml ) {
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 );
160
-        else
161
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
162
+        if ($xml->meetingID) {
163
+                    return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded );
164
+        } else {
165
+                    return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
166
+        }
162 167
     } else {
163 168
         return null;
164 169
     }
@@ -267,7 +272,9 @@  discard block
 block discarded – undo
267 272
     $metadataArray = array();
268 273
     $metadata = get_object_vars($recording->metadata);
269 274
     foreach ( $metadata as $key => $value ) {
270
-        if ( is_object($value) ) $value = '';
275
+        if ( is_object($value) ) {
276
+            $value = '';
277
+        }
271 278
         $metadataArray['meta_'.$key] = $value;
272 279
     }
273 280
 
@@ -277,17 +284,22 @@  discard block
 block discarded – undo
277 284
 }
278 285
 
279 286
 function bigbluebuttonbn_recordingBuildSorter($a, $b){
280
-    if( $a['startTime'] < $b['startTime']) return -1;
281
-    else if( $a['startTime'] == $b['startTime']) return 0;
282
-    else return 1;
283
-}
287
+    if( $a['startTime'] < $b['startTime']) {
288
+        return -1;
289
+    } else if( $a['startTime'] == $b['startTime']) {
290
+        return 0;
291
+    } else {
292
+        return 1;
293
+    }
294
+    }
284 295
 
285 296
 function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) {
286 297
     $ids = 	explode(",", $recordIDs);
287 298
     foreach( $ids as $id){
288 299
         $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) );
289
-        if( $xml && $xml->returncode != 'SUCCESS' )
290
-            return false;
300
+        if( $xml && $xml->returncode != 'SUCCESS' ) {
301
+                    return false;
302
+        }
291 303
     }
292 304
     return true;
293 305
 }
@@ -296,8 +308,9 @@  discard block
 block discarded – undo
296 308
     $ids = 	explode(",", $recordIDs);
297 309
     foreach( $ids as $id){
298 310
         $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) );
299
-        if( $xml && $xml->returncode != 'SUCCESS' )
300
-            return false;
311
+        if( $xml && $xml->returncode != 'SUCCESS' ) {
312
+                    return false;
313
+        }
301 314
     }
302 315
     return true;
303 316
 }
@@ -307,8 +320,7 @@  discard block
 block discarded – undo
307 320
 
308 321
     if( $xml ) { //If the xml packet returned failure it displays the message to the user
309 322
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
310
-    }
311
-    else { //If the server is unreachable, then prompts the user of the necessary action
323
+    } else { //If the server is unreachable, then prompts the user of the necessary action
312 324
         return null;
313 325
     }
314 326
 }
@@ -342,7 +354,9 @@  discard block
 block discarded – undo
342 354
 }
343 355
 
344 356
 function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) {
345
-    if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url);
357
+    if ( bigbluebuttonbn_debugdisplay() ) {
358
+        error_log("Request to: ".$url);
359
+    }
346 360
 
347 361
     if (extension_loaded('curl')) {
348 362
         $c = new curl();
@@ -530,8 +544,9 @@  discard block
 block discarded – undo
530 544
         // Iterate looking for all configuration
531 545
         foreach($participant_list as $participant){
532 546
             if( $participant->selectiontype == 'all' ) {
533
-                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
534
-                    return true;
547
+                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
548
+                                    return true;
549
+                }
535 550
             }
536 551
         }
537 552
 
@@ -542,8 +557,9 @@  discard block
 block discarded – undo
542 557
                 foreach( $roles as $role ) {
543 558
                     $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->roleid);
544 559
                     if( $participant->selectionid == $db_moodle_role->shortname ) {
545
-                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
546
-                            return true;
560
+                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
561
+                                                    return true;
562
+                        }
547 563
                     }
548 564
                 }
549 565
             }
@@ -553,8 +569,9 @@  discard block
 block discarded – undo
553 569
         foreach($participant_list as $participant){
554 570
             if( $participant->selectiontype == 'user' ) {
555 571
                 if( $participant->selectionid == $user ) {
556
-                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
557
-                        return true;
572
+                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
573
+                                            return true;
574
+                    }
558 575
                 }
559 576
             }
560 577
         }
@@ -588,7 +605,9 @@  discard block
 block discarded – undo
588 605
     if( $voicebridge != 0 ) {
589 606
         $table = "bigbluebuttonbn";
590 607
         $select = "voicebridge = ".$voicebridge;
591
-        if( $id ) $select .= " AND id <> ".$id;
608
+        if( $id ) {
609
+            $select .= " AND id <> ".$id;
610
+        }
592 611
         if ( $rooms = $DB->get_records_select($table, $select)  ) {
593 612
             $is_unique = false;
594 613
         }
@@ -924,7 +943,9 @@  discard block
 block discarded – undo
924 943
     $error = $org_msg;
925 944
 
926 945
     if( !empty($new_msg) ) {
927
-        if( !empty($error) ) $error .= ' ';
946
+        if( !empty($error) ) {
947
+            $error .= ' ';
948
+        }
928 949
         $error .= $new_msg;
929 950
     }
930 951
 
@@ -1205,8 +1226,9 @@  discard block
 block discarded – undo
1205 1226
         $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret );
1206 1227
         if( $capabilities ) {
1207 1228
             foreach ($capabilities as $capability) {
1208
-                if( $capability["name"] == $capability_name)
1209
-                    $capability_offered = $capability;
1229
+                if( $capability["name"] == $capability_name) {
1230
+                                    $capability_offered = $capability;
1231
+                }
1210 1232
             }
1211 1233
         }
1212 1234
     }
@@ -1512,7 +1534,9 @@  discard block
 block discarded – undo
1512 1534
             }
1513 1535
             //Generates the meetingID string
1514 1536
             foreach ($mIDs as $mID) {
1515
-                if (strlen($meetingID) > 0) $meetingID .= ',';
1537
+                if (strlen($meetingID) > 0) {
1538
+                    $meetingID .= ',';
1539
+                }
1516 1540
                 $meetingID .= $mID;
1517 1541
             }
1518 1542
         }
@@ -1610,9 +1634,10 @@  discard block
 block discarded – undo
1610 1634
 function bigbluebuttonbn_html2text($html, $len) {
1611 1635
     $text = strip_tags($html);
1612 1636
     $text = str_replace("&nbsp;", ' ', $text);
1613
-    if( strlen($text) > $len )
1614
-        $text = substr($text, 0, $len)."...";
1615
-    else
1616
-        $text = substr($text, 0, $len);
1637
+    if( strlen($text) > $len ) {
1638
+            $text = substr($text, 0, $len)."...";
1639
+    } else {
1640
+            $text = substr($text, 0, $len);
1641
+    }
1617 1642
     return $text;
1618 1643
 }
Please login to merge, or discard this patch.