Completed
Push — master ( 43b232...a6a187 )
by Jesus
02:48
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.
locallib.php 1 patch
Braces   +67 added lines, -40 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
     }
@@ -228,7 +233,9 @@  discard block
 block discarded – undo
228 233
             $metadataArray = array();
229 234
             $metadata = get_object_vars($recording->metadata);
230 235
             foreach ( $metadata as $key => $value ) {
231
-                if ( is_object($value) ) $value = '';
236
+                if ( is_object($value) ) {
237
+                    $value = '';
238
+                }
232 239
                 $metadataArray['meta_'.$key] = $value;
233 240
             }
234 241
 
@@ -268,7 +275,9 @@  discard block
 block discarded – undo
268 275
                 $metadataArray = array();
269 276
                 $metadata = get_object_vars($recording->metadata);
270 277
                 foreach ($metadata as $key => $value) {
271
-                    if(is_object($value)) $value = '';
278
+                    if(is_object($value)) {
279
+                        $value = '';
280
+                    }
272 281
                     $metadataArray['meta_'.$key] = $value;
273 282
                 }
274 283
 
@@ -282,17 +291,22 @@  discard block
 block discarded – undo
282 291
 }
283 292
 
284 293
 function bigbluebuttonbn_recordingBuildSorter($a, $b){
285
-    if( $a['startTime'] < $b['startTime']) return -1;
286
-    else if( $a['startTime'] == $b['startTime']) return 0;
287
-    else return 1;
288
-}
294
+    if( $a['startTime'] < $b['startTime']) {
295
+        return -1;
296
+    } else if( $a['startTime'] == $b['startTime']) {
297
+        return 0;
298
+    } else {
299
+        return 1;
300
+    }
301
+    }
289 302
 
290 303
 function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) {
291 304
     $ids = 	explode(",", $recordIDs);
292 305
     foreach( $ids as $id){
293 306
         $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) );
294
-        if( $xml && $xml->returncode != 'SUCCESS' )
295
-            return false;
307
+        if( $xml && $xml->returncode != 'SUCCESS' ) {
308
+                    return false;
309
+        }
296 310
     }
297 311
     return true;
298 312
 }
@@ -301,8 +315,9 @@  discard block
 block discarded – undo
301 315
     $ids = 	explode(",", $recordIDs);
302 316
     foreach( $ids as $id){
303 317
         $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) );
304
-        if( $xml && $xml->returncode != 'SUCCESS' )
305
-            return false;
318
+        if( $xml && $xml->returncode != 'SUCCESS' ) {
319
+                    return false;
320
+        }
306 321
     }
307 322
     return true;
308 323
 }
@@ -312,8 +327,7 @@  discard block
 block discarded – undo
312 327
 
313 328
     if( $xml ) { //If the xml packet returned failure it displays the message to the user
314 329
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
315
-    }
316
-    else { //If the server is unreachable, then prompts the user of the necessary action
330
+    } else { //If the server is unreachable, then prompts the user of the necessary action
317 331
         return null;
318 332
     }
319 333
 }
@@ -347,7 +361,9 @@  discard block
 block discarded – undo
347 361
 }
348 362
 
349 363
 function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) {
350
-    if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url);
364
+    if ( bigbluebuttonbn_debugdisplay() ) {
365
+        error_log("Request to: ".$url);
366
+    }
351 367
 
352 368
     if (extension_loaded('curl')) {
353 369
         $c = new curl();
@@ -535,8 +551,9 @@  discard block
 block discarded – undo
535 551
         // Iterate looking for all configuration
536 552
         foreach($participant_list as $participant){
537 553
             if( $participant->selectiontype == 'all' ) {
538
-                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
539
-                    return true;
554
+                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
555
+                                    return true;
556
+                }
540 557
             }
541 558
         }
542 559
 
@@ -547,8 +564,9 @@  discard block
 block discarded – undo
547 564
                 foreach( $roles as $role ) {
548 565
                     $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->roleid);
549 566
                     if( $participant->selectionid == $db_moodle_role->shortname ) {
550
-                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
551
-                            return true;
567
+                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
568
+                                                    return true;
569
+                        }
552 570
                     }
553 571
                 }
554 572
             }
@@ -558,8 +576,9 @@  discard block
 block discarded – undo
558 576
         foreach($participant_list as $participant){
559 577
             if( $participant->selectiontype == 'user' ) {
560 578
                 if( $participant->selectionid == $user ) {
561
-                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
562
-                        return true;
579
+                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
580
+                                            return true;
581
+                    }
563 582
                 }
564 583
             }
565 584
         }
@@ -593,7 +612,9 @@  discard block
 block discarded – undo
593 612
     if( $voicebridge != 0 ) {
594 613
         $table = "bigbluebuttonbn";
595 614
         $select = "voicebridge = ".$voicebridge;
596
-        if( $id ) $select .= " AND id <> ".$id;
615
+        if( $id ) {
616
+            $select .= " AND id <> ".$id;
617
+        }
597 618
         if ( $rooms = $DB->get_records_select($table, $select)  ) {
598 619
             $is_unique = false;
599 620
         }
@@ -929,7 +950,9 @@  discard block
 block discarded – undo
929 950
     $error = $org_msg;
930 951
 
931 952
     if( !empty($new_msg) ) {
932
-        if( !empty($error) ) $error .= ' ';
953
+        if( !empty($error) ) {
954
+            $error .= ' ';
955
+        }
933 956
         $error .= $new_msg;
934 957
     }
935 958
 
@@ -1218,8 +1241,9 @@  discard block
 block discarded – undo
1218 1241
         $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret );
1219 1242
         if( $capabilities ) {
1220 1243
             foreach ($capabilities as $capability) {
1221
-                if( $capability["name"] == $capability_name)
1222
-                    $capability_offered = $capability;
1244
+                if( $capability["name"] == $capability_name) {
1245
+                                    $capability_offered = $capability;
1246
+                }
1223 1247
             }
1224 1248
         }
1225 1249
     }
@@ -1526,7 +1550,9 @@  discard block
 block discarded – undo
1526 1550
             }
1527 1551
             //Generates the meetingID string
1528 1552
             foreach ($mIDs as $mID) {
1529
-                if (strlen($meetingID) > 0) $meetingID .= ',';
1553
+                if (strlen($meetingID) > 0) {
1554
+                    $meetingID .= ',';
1555
+                }
1530 1556
                 $meetingID .= $mID;
1531 1557
             }
1532 1558
         }
@@ -1624,9 +1650,10 @@  discard block
 block discarded – undo
1624 1650
 function bigbluebuttonbn_html2text($html, $len) {
1625 1651
     $text = strip_tags($html);
1626 1652
     $text = str_replace("&nbsp;", ' ', $text);
1627
-    if( strlen($text) > $len )
1628
-        $text = substr($text, 0, $len)."...";
1629
-    else
1630
-        $text = substr($text, 0, $len);
1653
+    if( strlen($text) > $len ) {
1654
+            $text = substr($text, 0, $len)."...";
1655
+    } else {
1656
+            $text = substr($text, 0, $len);
1657
+    }
1631 1658
     return $text;
1632 1659
 }
1633 1660
\ No newline at end of file
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.