Completed
Push — master ( 12ecea...43b232 )
by Jesus
03:32
created
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.