Completed
Push — master ( 63aa89...ef28c1 )
by Jesus
02:13
created
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.