Completed
Push — master ( 22fad4...7de194 )
by Jesus
02:27
created
locallib.php 1 patch
Spacing   +340 added lines, -340 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,132 +56,132 @@  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
 
76 76
     $duration = intval($duration);
77
-    if( $duration > 0 ) {
78
-        $params .= '&duration='.$duration;
77
+    if ($duration > 0) {
78
+        $params .= '&duration=' . $duration;
79 79
     }
80 80
 
81 81
     $maxParticipants = intval($maxParticipants);
82
-    if( $maxParticipants > 0 ) {
83
-        $params .= '&maxParticipants='.$maxParticipants;
82
+    if ($maxParticipants > 0) {
83
+        $params .= '&maxParticipants=' . $maxParticipants;
84 84
     }
85 85
 
86
-    if( trim( $welcome ) ) {
87
-        $params .= '&welcome='.urlencode($welcome);
86
+    if (trim($welcome)) {
87
+        $params .= '&welcome=' . urlencode($welcome);
88 88
     }
89 89
 
90 90
     foreach ($metadata as $key => $value) {
91
-        $params .= '&'.$key.'='.urlencode($value);
91
+        $params .= '&' . $key . '=' . urlencode($value);
92 92
     }
93 93
 
94
-    $url = $url_create.$params.'&checksum='.sha1("create".$params.$SALT);
94
+    $url = $url_create . $params . '&checksum=' . sha1("create" . $params . $SALT);
95 95
     return $url;
96 96
 }
97 97
 
98
-function bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) {
99
-    $base_url = $URL."api/isMeetingRunning?";
100
-    $params = 'meetingID='.urlencode($meetingID);
101
-    $url = $base_url.$params.'&checksum='.sha1("isMeetingRunning".$params.$SALT);
98
+function bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT) {
99
+    $base_url = $URL . "api/isMeetingRunning?";
100
+    $params = 'meetingID=' . urlencode($meetingID);
101
+    $url = $base_url . $params . '&checksum=' . sha1("isMeetingRunning" . $params . $SALT);
102 102
     return $url;
103 103
 }
104 104
 
105
-function bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) {
106
-    $base_url = $URL."api/getMeetingInfo?";
107
-    $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
108
-    $url = $base_url.$params.'&checksum='.sha1("getMeetingInfo".$params.$SALT);
105
+function bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT) {
106
+    $base_url = $URL . "api/getMeetingInfo?";
107
+    $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW);
108
+    $url = $base_url . $params . '&checksum=' . sha1("getMeetingInfo" . $params . $SALT);
109 109
     return $url;
110 110
 }
111 111
 
112
-function bigbluebuttonbn_getMeetingsURL( $URL, $SALT ) {
113
-    $base_url = $URL."api/getMeetings?";
114
-    $url = $base_url.'&checksum='.sha1("getMeetings".$SALT);
112
+function bigbluebuttonbn_getMeetingsURL($URL, $SALT) {
113
+    $base_url = $URL . "api/getMeetings?";
114
+    $url = $base_url . '&checksum=' . sha1("getMeetings" . $SALT);
115 115
     return $url;
116 116
 }
117 117
 
118
-function bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) {
119
-    $base_url = $URL."api/end?";
120
-    $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
121
-    $url = $base_url.$params.'&checksum='.sha1("end".$params.$SALT);
118
+function bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT) {
119
+    $base_url = $URL . "api/end?";
120
+    $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW);
121
+    $url = $base_url . $params . '&checksum=' . sha1("end" . $params . $SALT);
122 122
     return $url;
123 123
 }
124 124
 
125
-function bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID=null ) {
126
-    $base_url_record = $URL."api/getRecordings?";
127
-    if( $meetingID == null ) {
125
+function bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID = null) {
126
+    $base_url_record = $URL . "api/getRecordings?";
127
+    if ($meetingID == null) {
128 128
         $params = "";
129 129
     } else {
130
-        $params = "meetingID=".urlencode($meetingID);
130
+        $params = "meetingID=" . urlencode($meetingID);
131 131
     }
132
-    $url = $base_url_record.$params."&checksum=".sha1("getRecordings".$params.$SALT);
132
+    $url = $base_url_record . $params . "&checksum=" . sha1("getRecordings" . $params . $SALT);
133 133
     return $url;
134 134
 }
135 135
 
136
-function bigbluebuttonbn_getDeleteRecordingsURL( $recordID, $URL, $SALT ) {
137
-    $url_delete = $URL."api/deleteRecordings?";
138
-    $params = 'recordID='.urlencode($recordID);
139
-    $url = $url_delete.$params.'&checksum='.sha1("deleteRecordings".$params.$SALT);
136
+function bigbluebuttonbn_getDeleteRecordingsURL($recordID, $URL, $SALT) {
137
+    $url_delete = $URL . "api/deleteRecordings?";
138
+    $params = 'recordID=' . urlencode($recordID);
139
+    $url = $url_delete . $params . '&checksum=' . sha1("deleteRecordings" . $params . $SALT);
140 140
     return $url;
141 141
 }
142 142
 
143
-function bigbluebuttonbn_getPublishRecordingsURL( $recordID, $set, $URL, $SALT ) {
144
-    $url_publish = $URL."api/publishRecordings?";
145
-    $params = 'recordID='.$recordID."&publish=".$set;
146
-    $url = $url_publish.$params.'&checksum='.sha1("publishRecordings".$params.$SALT);
143
+function bigbluebuttonbn_getPublishRecordingsURL($recordID, $set, $URL, $SALT) {
144
+    $url_publish = $URL . "api/publishRecordings?";
145
+    $params = 'recordID=' . $recordID . "&publish=" . $set;
146
+    $url = $url_publish . $params . '&checksum=' . sha1("publishRecordings" . $params . $SALT);
147 147
     return $url;
148 148
 }
149 149
 
150
-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 ) {
150
+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) {
151 151
     $create_meeting_url = bigbluebuttonbn_getCreateMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $maxParticipants, $metadata);
152
-    if( !is_null($presentation_name) && !is_null($presentation_url) ) {
153
-        $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url,
152
+    if (!is_null($presentation_name) && !is_null($presentation_url)) {
153
+        $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url,
154 154
                 BIGBLUEBUTTONBN_METHOD_POST,
155
-                "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".$presentation_url."' /></module></modules>"
155
+                "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" . $presentation_url . "' /></module></modules>"
156 156
                 );
157 157
     } else {
158
-        $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url );
158
+        $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url);
159 159
     }
160 160
 
161
-    if ( $xml ) {
161
+    if ($xml) {
162 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 );
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 164
         } else {
165
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
165
+            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
166 166
         }
167 167
     } else {
168 168
         return null;
169 169
     }
170 170
 }
171 171
 
172
-function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT ) {
173
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL($URL, $SALT) );
172
+function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT) {
173
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingsURL($URL, $SALT));
174 174
 
175
-    if ( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {    //The meetings were returned
175
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey) {    //The meetings were returned
176 176
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
177 177
 
178
-    } else if($xml && $xml->returncode == 'SUCCESS') {                    //If there were meetings already created
178
+    } else if ($xml && $xml->returncode == 'SUCCESS') {                    //If there were meetings already created
179 179
         foreach ($xml->meetings->meeting as $meeting) {
180
-            $meetings[] = array( 'meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running );
180
+            $meetings[] = array('meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running);
181 181
         }
182 182
         return $meetings;
183 183
 
184
-    } else if( $xml ) { //If the xml packet returned failure it displays the message to the user
184
+    } else if ($xml) { //If the xml packet returned failure it displays the message to the user
185 185
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
186 186
 
187 187
     } else { //If the server is unreachable, then prompts the user of the necessary action
@@ -189,21 +189,21 @@  discard block
 block discarded – undo
189 189
     }
190 190
 }
191 191
 
192
-function bigbluebuttonbn_getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) {
193
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
192
+function bigbluebuttonbn_getMeetingInfo($meetingID, $modPW, $URL, $SALT) {
193
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT));
194 194
     return $xml;
195 195
 }
196 196
 
197
-function bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) {
198
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
197
+function bigbluebuttonbn_getMeetingInfoArray($meetingID, $modPW, $URL, $SALT) {
198
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT));
199 199
 
200
-    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null){//The meeting info was returned
201
-        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
200
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null) {//The meeting info was returned
201
+        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
202 202
 
203
-    } else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created
204
-        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 );
203
+    } else if ($xml && $xml->returncode == 'SUCCESS') { //If there were meetings already created
204
+        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);
205 205
 
206
-    } else if( ($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user
206
+    } else if (($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user
207 207
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
208 208
 
209 209
     } else { //If the server is unreachable, then prompts the user of the necessary action
@@ -211,19 +211,19 @@  discard block
 block discarded – undo
211 211
     }
212 212
 }
213 213
 
214
-function bigbluebuttonbn_getRecordingsArray( $meetingIDs, $URL, $SALT ) {
214
+function bigbluebuttonbn_getRecordingsArray($meetingIDs, $URL, $SALT) {
215 215
     $recordings = array();
216 216
 
217
-    if ( is_array($meetingIDs) ) {
217
+    if (is_array($meetingIDs)) {
218 218
         // getRecordings is executes using a method POST (supported only on BBB 1.0 and later)
219
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT ), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs );
219
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs);
220 220
     } else {
221 221
         // getRecordings is executes using a method GET supported by any version of BBB
222
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingIDs ) );
222
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingIDs));
223 223
     }
224 224
 
225
-    if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created
226
-        foreach ( $xml->recordings->recording as $recording ) {
225
+    if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created
226
+        foreach ($xml->recordings->recording as $recording) {
227 227
             $recordings[] = bigbluebuttonbn_getRecordingArrayRow($recording);
228 228
         }
229 229
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     return $recordings;
234 234
 }
235 235
 
236
-function bigbluebuttonbn_index_recordings($recordings, $index_key='recordID') {
236
+function bigbluebuttonbn_index_recordings($recordings, $index_key = 'recordID') {
237 237
     $indexed_recordings = array();
238 238
 
239 239
     foreach ($recordings as $recording) {
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
     return $indexed_recordings;
244 244
 }
245 245
 
246
-function bigbluebuttonbn_getRecordingArray( $recordingID, $meetingID, $URL, $SALT ) {
246
+function bigbluebuttonbn_getRecordingArray($recordingID, $meetingID, $URL, $SALT) {
247 247
     $recordingArray = array();
248 248
 
249
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID ) );
249
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID));
250 250
 
251
-    if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created
251
+    if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created
252 252
         foreach ($xml->recordings->recording as $recording) {
253
-            if( $recording->recordID == $recordingID ) {
253
+            if ($recording->recordID == $recordingID) {
254 254
                 $recordingArray = bigbluebuttonbn_getRecordingArrayRow($recording);
255 255
                 break;
256 256
             }
@@ -260,64 +260,64 @@  discard block
 block discarded – undo
260 260
     return $recordingArray;
261 261
 }
262 262
 
263
-function bigbluebuttonbn_getRecordingArrayRow( $recording ) {
263
+function bigbluebuttonbn_getRecordingArrayRow($recording) {
264 264
 
265 265
     $playbackArray = array();
266
-    foreach ( $recording->playback->format as $format ) {
267
-        $playbackArray[(string) $format->type] = array( 'type' => (string) $format->type, 'url' => (string) $format->url, 'length' => (string) $format->length );
266
+    foreach ($recording->playback->format as $format) {
267
+        $playbackArray[(string)$format->type] = array('type' => (string)$format->type, 'url' => (string)$format->url, 'length' => (string)$format->length);
268 268
     }
269 269
 
270 270
     //Add the metadata to the recordings array
271 271
     $metadataArray = array();
272 272
     $metadata = get_object_vars($recording->metadata);
273
-    foreach ( $metadata as $key => $value ) {
274
-        if ( is_object($value) ) {
273
+    foreach ($metadata as $key => $value) {
274
+        if (is_object($value)) {
275 275
             $value = '';
276 276
         }
277
-        $metadataArray['meta_'.$key] = $value;
277
+        $metadataArray['meta_' . $key] = $value;
278 278
     }
279 279
 
280
-    $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;
280
+    $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;
281 281
 
282 282
     return $recordingArrayRow;
283 283
 }
284 284
 
285
-function bigbluebuttonbn_recordingBuildSorter($a, $b){
286
-    if ( $a['startTime'] < $b['startTime'] ) {
285
+function bigbluebuttonbn_recordingBuildSorter($a, $b) {
286
+    if ($a['startTime'] < $b['startTime']) {
287 287
         return -1;
288
-    } else if ( $a['startTime'] == $b['startTime']) {
288
+    } else if ($a['startTime'] == $b['startTime']) {
289 289
         return 0;
290 290
     } else {
291 291
         return 1;
292 292
     }
293 293
 }
294 294
 
295
-function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) {
296
-    $ids = 	explode(",", $recordIDs);
297
-    foreach( $ids as $id){
298
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) );
299
-        if( $xml && $xml->returncode != 'SUCCESS' ) {
295
+function bigbluebuttonbn_doDeleteRecordings($recordIDs, $URL, $SALT) {
296
+    $ids = explode(",", $recordIDs);
297
+    foreach ($ids as $id) {
298
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT));
299
+        if ($xml && $xml->returncode != 'SUCCESS') {
300 300
             return false;
301 301
         }
302 302
     }
303 303
     return true;
304 304
 }
305 305
 
306
-function bigbluebuttonbn_doPublishRecordings( $recordIDs, $set, $URL, $SALT ) {
307
-    $ids = 	explode(",", $recordIDs);
308
-    foreach( $ids as $id){
309
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) );
310
-        if( $xml && $xml->returncode != 'SUCCESS' ) {
306
+function bigbluebuttonbn_doPublishRecordings($recordIDs, $set, $URL, $SALT) {
307
+    $ids = explode(",", $recordIDs);
308
+    foreach ($ids as $id) {
309
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT));
310
+        if ($xml && $xml->returncode != 'SUCCESS') {
311 311
             return false;
312 312
         }
313 313
     }
314 314
     return true;
315 315
 }
316 316
 
317
-function bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $URL, $SALT ) {
318
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) );
317
+function bigbluebuttonbn_doEndMeeting($meetingID, $modPW, $URL, $SALT) {
318
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT));
319 319
 
320
-    if( $xml ) { //If the xml packet returned failure it displays the message to the user
320
+    if ($xml) { //If the xml packet returned failure it displays the message to the user
321 321
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
322 322
     }
323 323
     else { //If the server is unreachable, then prompts the user of the necessary action
@@ -325,46 +325,46 @@  discard block
 block discarded – undo
325 325
     }
326 326
 }
327 327
 
328
-function bigbluebuttonbn_isMeetingRunning( $meetingID, $URL, $SALT ) {
329
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) );
330
-    if ( $xml && $xml->returncode == 'SUCCESS' ) {
331
-        return ( ( $xml->running == 'true' ) ? true : false);
328
+function bigbluebuttonbn_isMeetingRunning($meetingID, $URL, $SALT) {
329
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT));
330
+    if ($xml && $xml->returncode == 'SUCCESS') {
331
+        return (($xml->running == 'true') ? true : false);
332 332
     } else {
333
-        return ( false );
333
+        return (false);
334 334
     }
335 335
 }
336 336
 
337 337
 
338
-function bigbluebuttonbn_getServerVersion( $URL ){
339
-    $xml = bigbluebuttonbn_wrap_xml_load_file( $URL."api" );
340
-    if ( $xml && $xml->returncode == 'SUCCESS' ) {
338
+function bigbluebuttonbn_getServerVersion($URL) {
339
+    $xml = bigbluebuttonbn_wrap_xml_load_file($URL . "api");
340
+    if ($xml && $xml->returncode == 'SUCCESS') {
341 341
         return $xml->version;
342 342
     } else {
343 343
         return NULL;
344 344
     }
345 345
 }
346 346
 
347
-function bigbluebuttonbn_getMeetingXML( $meetingID, $URL, $SALT ) {
348
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) );
349
-    if ( $xml && $xml->returncode == 'SUCCESS') {
350
-        return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
347
+function bigbluebuttonbn_getMeetingXML($meetingID, $URL, $SALT) {
348
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT));
349
+    if ($xml && $xml->returncode == 'SUCCESS') {
350
+        return (str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
351 351
     } else {
352 352
         return 'false';
353 353
     }
354 354
 }
355 355
 
356
-function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) {
357
-    if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url);
356
+function bigbluebuttonbn_wrap_xml_load_file($url, $method = BIGBLUEBUTTONBN_METHOD_GET, $data = null) {
357
+    if (bigbluebuttonbn_debugdisplay()) error_log("Request to: " . $url);
358 358
 
359 359
     if (extension_loaded('curl')) {
360 360
         $c = new curl();
361
-        $c->setopt( Array( "SSL_VERIFYPEER" => true));
362
-        if( $method == BIGBLUEBUTTONBN_METHOD_POST ) {
363
-            if( !is_null($data) ) {
364
-                if( !is_array($data) ) {
361
+        $c->setopt(Array("SSL_VERIFYPEER" => true));
362
+        if ($method == BIGBLUEBUTTONBN_METHOD_POST) {
363
+            if (!is_null($data)) {
364
+                if (!is_array($data)) {
365 365
                     $options['CURLOPT_HTTPHEADER'] = array(
366 366
                             'Content-Type: text/xml',
367
-                            'Content-Length: '.strlen($data),
367
+                            'Content-Length: ' . strlen($data),
368 368
                             'Content-Language: en-US'
369 369
                         );
370 370
                     $response = $c->post($url, $data, $options);
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
             try {
387 387
                 $xml = new SimpleXMLElement($response, LIBXML_NOCDATA);
388 388
                 return $xml;
389
-            } catch (Exception $e){
389
+            } catch (Exception $e) {
390 390
                 libxml_use_internal_errors($previous);
391
-                $error = 'Caught exception: '.$e->getMessage();
391
+                $error = 'Caught exception: ' . $e->getMessage();
392 392
                 error_log($error);
393 393
                 return NULL;
394 394
             }
@@ -400,18 +400,18 @@  discard block
 block discarded – undo
400 400
     } else {
401 401
         $previous = libxml_use_internal_errors(true);
402 402
         try {
403
-            $xml = simplexml_load_file($url,'SimpleXMLElement', LIBXML_NOCDATA);
403
+            $xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA);
404 404
             return $xml;
405
-        } catch  (Exception $e){
405
+        } catch (Exception $e) {
406 406
             libxml_use_internal_errors($previous);
407 407
             return NULL;
408 408
         }
409 409
     }
410 410
 }
411 411
 
412
-function bigbluebuttonbn_get_role_name($role_shortname){
412
+function bigbluebuttonbn_get_role_name($role_shortname) {
413 413
     $role = bigbluebuttonbn_get_db_moodle_roles($role_shortname);
414
-    if( $role != null && $role->name != "") {
414
+    if ($role != null && $role->name != "") {
415 415
         $role_name = $role->name;
416 416
     } else {
417 417
         switch ($role_shortname) {
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
     return $role_name;
432 432
 }
433 433
 
434
-function bigbluebuttonbn_get_roles($rolename='all', $format='json'){
434
+function bigbluebuttonbn_get_roles($rolename = 'all', $format = 'json') {
435 435
     $roles = bigbluebuttonbn_get_db_moodle_roles($rolename);
436 436
     $roles_array = array();
437
-    foreach($roles as $role){
438
-        if( $format=='json' ) {
437
+    foreach ($roles as $role) {
438
+        if ($format == 'json') {
439 439
             array_push($roles_array,
440
-                    array( "id" => $role->shortname,
440
+                    array("id" => $role->shortname,
441 441
                         "name" => bigbluebuttonbn_get_role_name($role->shortname)
442 442
                     )
443 443
             );
@@ -448,19 +448,19 @@  discard block
 block discarded – undo
448 448
     return $roles_array;
449 449
 }
450 450
 
451
-function bigbluebuttonbn_get_roles_json($rolename='all'){
451
+function bigbluebuttonbn_get_roles_json($rolename = 'all') {
452 452
     return json_encode(bigbluebuttonbn_get_roles($rolename));
453 453
 }
454 454
 
455
-function bigbluebuttonbn_get_users_json($users, $full=false) {
456
-    if( $full ) {
455
+function bigbluebuttonbn_get_users_json($users, $full = false) {
456
+    if ($full) {
457 457
         return json_encode($users);
458 458
     } else {
459 459
         $users_array = array();
460
-        foreach($users as $user){
460
+        foreach ($users as $user) {
461 461
             array_push($users_array,
462
-                    array( "id" => $user->id,
463
-                            "name" => $user->firstname.' '.$user->lastname
462
+                    array("id" => $user->id,
463
+                            "name" => $user->firstname . ' ' . $user->lastname
464 464
                     )
465 465
             );
466 466
         }
@@ -468,15 +468,15 @@  discard block
 block discarded – undo
468 468
     }
469 469
 }
470 470
 
471
-function bigbluebuttonbn_get_participant_list($bigbluebuttonbn=null, $context=null){
471
+function bigbluebuttonbn_get_participant_list($bigbluebuttonbn = null, $context = null) {
472 472
     global $CFG, $USER;
473 473
 
474 474
     $participant_list_array = array();
475 475
 
476
-    if( $bigbluebuttonbn != null ) {
476
+    if ($bigbluebuttonbn != null) {
477 477
         $participant_list = json_decode($bigbluebuttonbn->participants);
478 478
         if (is_array($participant_list)) {
479
-            foreach($participant_list as $participant){
479
+            foreach ($participant_list as $participant) {
480 480
                 array_push($participant_list_array,
481 481
                         array(
482 482
                             "selectiontype" => $participant->selectiontype,
@@ -496,16 +496,16 @@  discard block
 block discarded – undo
496 496
         );
497 497
 
498 498
         $moderator_defaults = bigbluebuttonbn_get_cfg_moderator_default();
499
-        if ( !isset($moderator_defaults) ) {
499
+        if (!isset($moderator_defaults)) {
500 500
             $moderator_defaults = array('owner');
501 501
         } else {
502 502
             $moderator_defaults = explode(',', $moderator_defaults);
503 503
         }
504
-        foreach( $moderator_defaults as $moderator_default ) {
505
-            if( $moderator_default == 'owner' ) {
504
+        foreach ($moderator_defaults as $moderator_default) {
505
+            if ($moderator_default == 'owner') {
506 506
                 $users = bigbluebuttonbn_get_users($context);
507
-                foreach( $users as $user ){
508
-                    if( $user->id == $USER->id ){
507
+                foreach ($users as $user) {
508
+                    if ($user->id == $USER->id) {
509 509
                         array_push($participant_list_array,
510 510
                                 array(
511 511
                                         "selectiontype" => "user",
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
     return $participant_list_array;
532 532
 }
533 533
 
534
-function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid=null){
534
+function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid = null) {
535 535
     return json_encode(bigbluebuttonbn_get_participant_list($bigbluebuttonbnid));
536 536
 }
537 537
 
@@ -540,9 +540,9 @@  discard block
 block discarded – undo
540 540
 
541 541
     if (is_array($participant_list)) {
542 542
         // Iterate looking for all configuration
543
-        foreach($participant_list as $participant){
544
-            if( $participant->selectiontype == 'all' ) {
545
-                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
543
+        foreach ($participant_list as $participant) {
544
+            if ($participant->selectiontype == 'all') {
545
+                if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR) {
546 546
                     return true;
547 547
                 }
548 548
             }
@@ -550,12 +550,12 @@  discard block
 block discarded – undo
550 550
 
551 551
         //Iterate looking for roles
552 552
         $db_moodle_roles = bigbluebuttonbn_get_db_moodle_roles();
553
-        foreach($participant_list as $participant){
554
-            if( $participant->selectiontype == 'role' ) {
555
-                foreach( $roles as $role ) {
553
+        foreach ($participant_list as $participant) {
554
+            if ($participant->selectiontype == 'role') {
555
+                foreach ($roles as $role) {
556 556
                     $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->roleid);
557
-                    if( $participant->selectionid == $db_moodle_role->shortname ) {
558
-                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
557
+                    if ($participant->selectionid == $db_moodle_role->shortname) {
558
+                        if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR) {
559 559
                             return true;
560 560
                         }
561 561
                     }
@@ -564,10 +564,10 @@  discard block
 block discarded – undo
564 564
         }
565 565
 
566 566
         //Iterate looking for users
567
-        foreach($participant_list as $participant){
568
-            if( $participant->selectiontype == 'user' ) {
569
-                if( $participant->selectionid == $user ) {
570
-                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
567
+        foreach ($participant_list as $participant) {
568
+            if ($participant->selectiontype == 'user') {
569
+                if ($participant->selectionid == $user) {
570
+                    if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR) {
571 571
                         return true;
572 572
                     }
573 573
                 }
@@ -579,8 +579,8 @@  discard block
 block discarded – undo
579 579
 }
580 580
 
581 581
 function bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role_id) {
582
-    foreach( $db_moodle_roles as $db_moodle_role ){
583
-        if( $role_id ==  $db_moodle_role->id ) {
582
+    foreach ($db_moodle_roles as $db_moodle_role) {
583
+        if ($role_id == $db_moodle_role->id) {
584 584
             return $db_moodle_role;
585 585
         }
586 586
     }
@@ -588,25 +588,25 @@  discard block
 block discarded – undo
588 588
 
589 589
 function bigbluebuttonbn_get_error_key($messageKey, $defaultKey = null) {
590 590
     $key = $defaultKey;
591
-    if ( $messageKey == "checksumError" ) {
591
+    if ($messageKey == "checksumError") {
592 592
         $key = 'index_error_checksum';
593
-    } else if ( $messageKey == 'maxConcurrent' ) {
593
+    } else if ($messageKey == 'maxConcurrent') {
594 594
         $key = 'view_error_max_concurrent';
595 595
     }
596 596
     return $key;
597 597
 }
598 598
 
599
-function bigbluebuttonbn_voicebridge_unique($voicebridge, $id=null) {
599
+function bigbluebuttonbn_voicebridge_unique($voicebridge, $id = null) {
600 600
     global $DB;
601 601
 
602 602
     $is_unique = true;
603
-    if ( $voicebridge != 0 ) {
603
+    if ($voicebridge != 0) {
604 604
         $table = "bigbluebuttonbn";
605
-        $select = "voicebridge = ".$voicebridge;
606
-        if ( $id ) {
607
-            $select .= " AND id <> ".$id;
605
+        $select = "voicebridge = " . $voicebridge;
606
+        if ($id) {
607
+            $select .= " AND id <> " . $id;
608 608
         }
609
-        if ( $rooms = $DB->get_records_select($table, $select)  ) {
609
+        if ($rooms = $DB->get_records_select($table, $select)) {
610 610
             $is_unique = false;
611 611
         }
612 612
     }
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
 
620 620
     $duration = 0;
621 621
     $now = time();
622
-    if ( $closingtime > 0 && $now < $closingtime ) {
623
-        $duration = ceil(($closingtime - $now)/60);
622
+    if ($closingtime > 0 && $now < $closingtime) {
623
+        $duration = ceil(($closingtime - $now) / 60);
624 624
         $compensation_time = intval(bigbluebuttonbn_get_cfg_scheduled_duration_compensation());
625 625
         $duration = intval($duration) + $compensation_time;
626 626
     }
@@ -628,13 +628,13 @@  discard block
 block discarded – undo
628 628
     return $duration;
629 629
 }
630 630
 
631
-function bigbluebuttonbn_get_presentation_array($context, $presentation, $id=null) {
631
+function bigbluebuttonbn_get_presentation_array($context, $presentation, $id = null) {
632 632
     $presentation_name = null;
633 633
     $presentation_url = null;
634 634
     $presentation_icon = null;
635 635
     $presentation_mimetype_description = null;
636 636
 
637
-    if ( !empty($presentation) ) {
637
+    if (!empty($presentation)) {
638 638
         $fs = get_file_storage();
639 639
         $files = $fs->get_area_files($context->id, 'mod_bigbluebuttonbn', 'presentation', 0, 'itemid, filepath, filename', false);
640 640
         if (count($files) < 1) {
@@ -648,12 +648,12 @@  discard block
 block discarded – undo
648 648
             $presentation_icon = file_file_icon($file, 24);
649 649
             $presentation_mimetype_description = get_mimetype_description($file);
650 650
 
651
-            if( !is_null($id) ) {
651
+            if (!is_null($id)) {
652 652
                 //Create the nonce component for granting a temporary public access
653 653
                 $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache');
654 654
                 $presentation_nonce_key = sha1($id);
655 655
                 $presentation_nonce_value = bigbluebuttonbn_generate_nonce();
656
-                $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => 0 ));
656
+                $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => 0));
657 657
 
658 658
                 //The item id was adapted for granting public access to the presentation once in order to allow BigBlueButton to gather the file
659 659
                 $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), $presentation_nonce_value, $file->get_filepath(), $file->get_filename());
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
         }
665 665
     }
666 666
 
667
-    $presentation_array = array( "url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description);
667
+    $presentation_array = array("url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description);
668 668
 
669 669
     return $presentation_array;
670 670
 }
@@ -674,13 +674,13 @@  discard block
 block discarded – undo
674 674
     $mt = microtime();
675 675
     $rand = mt_rand();
676 676
 
677
-    return md5($mt.$rand);
677
+    return md5($mt . $rand);
678 678
 }
679 679
 
680
-function bigbluebuttonbn_random_password( $length = 8 ) {
680
+function bigbluebuttonbn_random_password($length = 8) {
681 681
 
682 682
     $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
683
-    $password = substr( str_shuffle( $chars ), 0, $length );
683
+    $password = substr(str_shuffle($chars), 0, $length);
684 684
 
685 685
     return $password;
686 686
 }
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
     global $CFG;
773 773
 
774 774
     $version_major = bigbluebuttonbn_get_moodle_version_major();
775
-    if ( $version_major < '2014051200' ) {
775
+    if ($version_major < '2014051200') {
776 776
         //This is valid before v2.7
777 777
         bigbluebuttonbn_event_log_legacy($event_type, $bigbluebuttonbn, $context, $cm);
778 778
 
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
     }
783 783
 }
784 784
 
785
-function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced=false) {
785
+function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced = false) {
786 786
     global $CFG;
787 787
 
788 788
     $recordings = array();
@@ -798,19 +798,19 @@  discard block
 block discarded – undo
798 798
     $result = $cache->get($meetingid);
799 799
     $meeting_info = json_decode($result['meeting_info']);
800 800
     $meeting_info->participantCount += 1;
801
-    if( $is_moderator ) {
801
+    if ($is_moderator) {
802 802
         $meeting_info->moderatorCount += 1;
803 803
     }
804
-    $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info) ));
804
+    $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info)));
805 805
 }
806 806
 
807 807
 function bigbluebuttonbn_bbb_broker_is_meeting_running($meeting_info) {
808
-    $meeting_running = ( isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS' );
808
+    $meeting_running = (isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS');
809 809
 
810 810
     return $meeting_running;
811 811
 }
812 812
 
813
-function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced=false) {
813
+function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced = false) {
814 814
     global $CFG;
815 815
 
816 816
     $meeting_info = array();
@@ -821,19 +821,19 @@  discard block
 block discarded – undo
821 821
     $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache');
822 822
     $result = $cache->get($meetingid);
823 823
     $now = time();
824
-    if( isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced ) {
824
+    if (isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced) {
825 825
         //Use the value in the cache
826 826
         $meeting_info = json_decode($result['meeting_info']);
827 827
     } else {
828 828
         //Ping again and refresh the cache
829
-        $meeting_info = (array) bigbluebuttonbn_getMeetingInfo( $meetingid, $password, $endpoint, $shared_secret );
830
-        $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info) ));
829
+        $meeting_info = (array)bigbluebuttonbn_getMeetingInfo($meetingid, $password, $endpoint, $shared_secret);
830
+        $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info)));
831 831
     }
832 832
 
833 833
     return $meeting_info;
834 834
 }
835 835
 
836
-function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password){
836
+function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password) {
837 837
     global $CFG;
838 838
 
839 839
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
@@ -842,16 +842,16 @@  discard block
 block discarded – undo
842 842
     bigbluebuttonbn_doEndMeeting($meetingid, $password, $endpoint, $shared_secret);
843 843
 }
844 844
 
845
-function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish=true){
845
+function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish = true) {
846 846
     global $CFG;
847 847
 
848 848
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
849 849
     $shared_secret = bigbluebuttonbn_get_cfg_shared_secret();
850 850
 
851
-    bigbluebuttonbn_doPublishRecordings($recordingid, ($publish)? 'true': 'false', $endpoint, $shared_secret);
851
+    bigbluebuttonbn_doPublishRecordings($recordingid, ($publish) ? 'true' : 'false', $endpoint, $shared_secret);
852 852
 }
853 853
 
854
-function bigbluebuttonbn_bbb_broker_do_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish=true){
854
+function bigbluebuttonbn_bbb_broker_do_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish = true) {
855 855
     global $DB;
856 856
 
857 857
     //Locate the record to be updated
@@ -860,9 +860,9 @@  discard block
 block discarded – undo
860 860
     $recordings_imported = array();
861 861
     foreach ($records as $key => $record) {
862 862
         $meta = json_decode($record->meta, true);
863
-        if( $recordingid == $meta['recording']['recordID'] ) {
863
+        if ($recordingid == $meta['recording']['recordID']) {
864 864
             // Found, prepare data for the update
865
-            $meta['recording']['published'] = ($publish)? 'true': 'false';
865
+            $meta['recording']['published'] = ($publish) ? 'true' : 'false';
866 866
             $records[$key]->meta = json_encode($meta);
867 867
 
868 868
             // Proceed with the update
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
     }
872 872
 }
873 873
 
874
-function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid){
874
+function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid) {
875 875
     global $CFG;
876 876
 
877 877
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
     bigbluebuttonbn_doDeleteRecordings($recordingid, $endpoint, $shared_secret);
881 881
 }
882 882
 
883
-function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID){
883
+function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID) {
884 884
     global $DB;
885 885
 
886 886
     //Locate the record to be updated
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
     $recordings_imported = array();
890 890
     foreach ($records as $key => $record) {
891 891
         $meta = json_decode($record->meta, true);
892
-        if( $recordingid == $meta['recording']['recordID'] ) {
892
+        if ($recordingid == $meta['recording']['recordID']) {
893 893
             // Execute delete
894 894
             $DB->delete_records("bigbluebuttonbn_logs", array('id' => $key));
895 895
         }
@@ -899,18 +899,18 @@  discard block
 block discarded – undo
899 899
 function bigbluebuttonbn_bbb_broker_validate_parameters($params) {
900 900
     $error = '';
901 901
 
902
-    if ( !isset($params['callback']) ) {
902
+    if (!isset($params['callback'])) {
903 903
         $error = bigbluebuttonbn_bbb_broker_add_error($error, 'This call must include a javascript callback.');
904 904
     }
905 905
 
906
-    if ( !isset($params['action']) ) {
906
+    if (!isset($params['action'])) {
907 907
         $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action parameter must be included.');
908 908
     } else {
909
-        switch ( strtolower($params['action']) ){
909
+        switch (strtolower($params['action'])) {
910 910
             case 'server_ping':
911 911
             case 'meeting_info':
912 912
             case 'meeting_end':
913
-                if ( !isset($params['id']) ) {
913
+                if (!isset($params['id'])) {
914 914
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The meetingID must be specified.');
915 915
                 }
916 916
                 break;
@@ -920,76 +920,76 @@  discard block
 block discarded – undo
920 920
             case 'recording_unpublish':
921 921
             case 'recording_delete':
922 922
             case 'recording_import':
923
-                if ( !isset($params['id']) ) {
923
+                if (!isset($params['id'])) {
924 924
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The recordingID must be specified.');
925 925
                 }
926 926
                 break;
927 927
             case 'recording_ready':
928
-                if( empty($params['signed_parameters']) ) {
928
+                if (empty($params['signed_parameters'])) {
929 929
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'A JWT encoded string must be included as [signed_parameters].');
930 930
                 }
931 931
                 break;
932 932
             default:
933
-                $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action '.$params['action'].' can not be performed.');
933
+                $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action ' . $params['action'] . ' can not be performed.');
934 934
         }
935 935
     }
936 936
 
937 937
     return $error;
938 938
 }
939 939
 
940
-function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg='') {
940
+function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg = '') {
941 941
     $error = $org_msg;
942 942
 
943
-    if( !empty($new_msg) ) {
944
-        if( !empty($error) ) $error .= ' ';
943
+    if (!empty($new_msg)) {
944
+        if (!empty($error)) $error .= ' ';
945 945
         $error .= $new_msg;
946 946
     }
947 947
 
948 948
     return $error;
949 949
 }
950 950
 
951
-function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools=["publishing", "deleting"]) {
951
+function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools = ["publishing", "deleting"]) {
952 952
     global $OUTPUT, $CFG, $USER;
953 953
 
954 954
     $row = null;
955 955
 
956
-    if ( $bbbsession['managerecordings'] || $recording['published'] == 'true' ) {
957
-        $startTime = isset($recording['startTime'])? floatval($recording['startTime']):0;
956
+    if ($bbbsession['managerecordings'] || $recording['published'] == 'true') {
957
+        $startTime = isset($recording['startTime']) ? floatval($recording['startTime']) : 0;
958 958
         $startTime = $startTime - ($startTime % 1000);
959 959
         $duration = intval(array_values($recording['playbacks'])[0]['length']);
960 960
 
961 961
         //For backward compatibility
962
-        if( isset($recording['meta_contextactivity']) ) {
962
+        if (isset($recording['meta_contextactivity'])) {
963 963
             $meta_activity = str_replace('"', '\"', $recording['meta_contextactivity']);
964
-        } if( isset($recording['meta_bbb-recording-name']) ) {
964
+        } if (isset($recording['meta_bbb-recording-name'])) {
965 965
             $meta_activity = str_replace('"', '\"', $recording['meta_bbb-recording-name']);
966 966
         } else {
967 967
             $meta_activity = str_replace('"', '\"', $recording['meetingName']);
968 968
         }
969 969
 
970
-        if( isset($recording['meta_contextactivitydescription']) ) {
970
+        if (isset($recording['meta_contextactivitydescription'])) {
971 971
             $meta_description = str_replace('"', '\"', $recording['meta_contextactivitydescription']);
972
-        } else if( isset($recording['meta_bbb-recording-description']) ) {
972
+        } else if (isset($recording['meta_bbb-recording-description'])) {
973 973
             $meta_description = str_replace('"', '\"', $recording['meta_bbb-recording-description']);
974 974
         } else {
975 975
             $meta_description = '';
976 976
         }
977 977
 
978 978
         //Set recording_types
979
-        if ( isset($recording['imported']) ) {
980
-            $attributes = 'data-imported="true" title='.get_string('view_recording_link_warning', 'bigbluebuttonbn');
979
+        if (isset($recording['imported'])) {
980
+            $attributes = 'data-imported="true" title=' . get_string('view_recording_link_warning', 'bigbluebuttonbn');
981 981
         } else {
982 982
             $attributes = 'data-imported="false"';
983 983
         }
984 984
 
985 985
         $recording_types = '';
986 986
         if ($recording['published'] == 'true') {
987
-            $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'>';
987
+            $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '>';
988 988
         } else {
989
-            $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'" hidden>';
989
+            $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '" hidden>';
990 990
         }
991
-        foreach ( $recording['playbacks'] as $playback ) {
992
-            $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;';
991
+        foreach ($recording['playbacks'] as $playback) {
992
+            $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;';
993 993
         }
994 994
         $recording_types .= '</div>';
995 995
 
@@ -998,11 +998,11 @@  discard block
 block discarded – undo
998 998
 
999 999
         //Set actionbar, if user is allowed to manage recordings
1000 1000
         $actionbar = '';
1001
-        if ( $bbbsession['managerecordings'] ) {
1001
+        if ($bbbsession['managerecordings']) {
1002 1002
             // Set style for imported links
1003
-            if( isset($recording['imported']) ) {
1003
+            if (isset($recording['imported'])) {
1004 1004
                 $recordings_imported_count = 0;
1005
-                $tag_tail = ' '.get_string('view_recording_link', 'bigbluebuttonbn');
1005
+                $tag_tail = ' ' . get_string('view_recording_link', 'bigbluebuttonbn');
1006 1006
                 $head = '<i>';
1007 1007
                 $tail = '</i>';
1008 1008
             } else {
@@ -1016,53 +1016,53 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
             if (in_array("publishing", $tools)) {
1018 1018
                 ///Set action [show|hide]
1019
-                if ( $recording['published'] == 'true' ){
1019
+                if ($recording['published'] == 'true') {
1020 1020
                     $manage_tag = 'hide';
1021 1021
                     $manage_action = 'unpublish';
1022 1022
                 } else {
1023 1023
                     $manage_tag = 'show';
1024 1024
                     $manage_action = 'publish';
1025 1025
                 }
1026
-                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("'.$manage_action.'", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");';
1026
+                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("' . $manage_action . '", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
1027 1027
 
1028
-                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
1028
+                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1029 1029
                     //With icon for publish/unpublish
1030
-                    $icon_attributes = array('id' => 'recording-btn-'.$manage_action.'-'.$recording['recordID']);
1031
-                    $icon = new pix_icon('t/'.$manage_tag, get_string($manage_tag).$tag_tail, 'moodle', $icon_attributes);
1032
-                    $link_attributes = array('id' => 'recording-link-'.$manage_action.'-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1030
+                    $icon_attributes = array('id' => 'recording-btn-' . $manage_action . '-' . $recording['recordID']);
1031
+                    $icon = new pix_icon('t/' . $manage_tag, get_string($manage_tag) . $tag_tail, 'moodle', $icon_attributes);
1032
+                    $link_attributes = array('id' => 'recording-link-' . $manage_action . '-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1033 1033
                     $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
1034 1034
                 } else {
1035 1035
                     //With text for publish/unpublish
1036
-                    $link_attributes = array('title' => get_string($manage_tag).$tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1037
-                    $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag).$tag_tail, $action, $link_attributes);
1036
+                    $link_attributes = array('title' => get_string($manage_tag) . $tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1037
+                    $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag) . $tag_tail, $action, $link_attributes);
1038 1038
                     $actionbar .= "&nbsp;";
1039 1039
                 }
1040 1040
             }
1041 1041
 
1042 1042
             if (in_array("deleting", $tools)) {
1043
-                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");';
1043
+                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
1044 1044
 
1045
-                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
1045
+                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1046 1046
                     //With icon for delete
1047
-                    $icon_attributes = array('id' => 'recording-btn-delete-'.$recording['recordID']);
1048
-                    $icon = new pix_icon('t/delete', get_string('delete').$tag_tail, 'moodle', $icon_attributes);
1049
-                    $link_attributes = array('id' => 'recording-link-delete-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1047
+                    $icon_attributes = array('id' => 'recording-btn-delete-' . $recording['recordID']);
1048
+                    $icon = new pix_icon('t/delete', get_string('delete') . $tag_tail, 'moodle', $icon_attributes);
1049
+                    $link_attributes = array('id' => 'recording-link-delete-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1050 1050
                     $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
1051 1051
                 } else {
1052 1052
                     //With text for delete
1053
-                    $link_attributes = array('title' => get_string('delete').$tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1054
-                    $actionbar .= $OUTPUT->action_link($url, get_string('delete').$tag_tail, $action, $link_attributes);
1053
+                    $link_attributes = array('title' => get_string('delete') . $tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1054
+                    $actionbar .= $OUTPUT->action_link($url, get_string('delete') . $tag_tail, $action, $link_attributes);
1055 1055
                 }
1056 1056
             }
1057 1057
 
1058 1058
             if (in_array("importing", $tools)) {
1059
-                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");';
1059
+                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
1060 1060
 
1061
-                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
1061
+                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1062 1062
                     //With icon for import
1063
-                    $icon_attributes = array('id' => 'recording-btn-import-'.$recording['recordID']);
1063
+                    $icon_attributes = array('id' => 'recording-btn-import-' . $recording['recordID']);
1064 1064
                     $icon = new pix_icon('i/import', get_string('import'), 'moodle', $icon_attributes);
1065
-                    $link_attributes = array('id' => 'recording-link-import-'.$recording['recordID'], 'onclick' => $onclick);
1065
+                    $link_attributes = array('id' => 'recording-link-import-' . $recording['recordID'], 'onclick' => $onclick);
1066 1066
                     $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
1067 1067
                 } else {
1068 1068
                     //With text for import
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
         }
1074 1074
 
1075 1075
         //Set corresponding format
1076
-        $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z';
1076
+        $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
1077 1077
         $formattedStartDate = userdate($startTime / 1000, $dateformat, usertimezone($USER->timezone));
1078 1078
 
1079 1079
         $row = new stdClass();
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
         $row->date_formatted = "{$head}{$formattedStartDate}{$tail}";
1085 1085
         $row->duration = "{$duration}";
1086 1086
         $row->duration_formatted = "{$head}{$duration}{$tail}";
1087
-        if ( $bbbsession['managerecordings'] ) {
1087
+        if ($bbbsession['managerecordings']) {
1088 1088
             $row->actionbar = $actionbar;
1089 1089
         }
1090 1090
     }
@@ -1110,21 +1110,21 @@  discard block
 block discarded – undo
1110 1110
         array("key" =>"duration", "label" => $view_recording_duration, "width" => "50px")
1111 1111
         );
1112 1112
 
1113
-    if ( $bbbsession['managerecordings'] ) {
1113
+    if ($bbbsession['managerecordings']) {
1114 1114
         array_push($recordingsbn_columns, array("key" =>"actionbar", "label" => $view_recording_actionbar, "width" => "75px", "allowHTML" => true));
1115 1115
     }
1116 1116
 
1117 1117
     return $recordingsbn_columns;
1118 1118
 }
1119 1119
 
1120
-function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools=["publishing", "deleting"]) {
1120
+function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools = ["publishing", "deleting"]) {
1121 1121
     $table_data = array();
1122 1122
 
1123 1123
     ///Build table content
1124
-    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1125
-        foreach ( $recordings as $recording ) {
1124
+    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1125
+        foreach ($recordings as $recording) {
1126 1126
             $row = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools);
1127
-            if( $row != null ) {
1127
+            if ($row != null) {
1128 1128
                 array_push($table_data, $row);
1129 1129
             }
1130 1130
         }
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
     return $table_data;
1134 1134
 }
1135 1135
 
1136
-function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) {
1136
+function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) {
1137 1137
     global $OUTPUT, $CFG;
1138 1138
 
1139 1139
     ///Set strings to show
@@ -1152,20 +1152,20 @@  discard block
 block discarded – undo
1152 1152
     $table->data = array();
1153 1153
 
1154 1154
     ///Initialize table headers
1155
-    if ( $bbbsession['managerecordings'] ) {
1156
-        $table->head  = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar);
1157
-        $table->align = array ('left', 'left', 'left', 'left', 'center', 'left');
1155
+    if ($bbbsession['managerecordings']) {
1156
+        $table->head  = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar);
1157
+        $table->align = array('left', 'left', 'left', 'left', 'center', 'left');
1158 1158
     } else {
1159
-        $table->head  = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration);
1160
-        $table->align = array ('left', 'left', 'left', 'left', 'center');
1159
+        $table->head  = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration);
1160
+        $table->align = array('left', 'left', 'left', 'left', 'center');
1161 1161
     }
1162 1162
 
1163 1163
     ///Build table content
1164
-    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1165
-        foreach ( $recordings as $recording ){
1164
+    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1165
+        foreach ($recordings as $recording) {
1166 1166
             $row = new html_table_row();
1167
-            $row->id = 'recording-td-'.$recording['recordID'];
1168
-            if ( isset($recording['imported']) ) {
1167
+            $row->id = 'recording-td-' . $recording['recordID'];
1168
+            if (isset($recording['imported'])) {
1169 1169
                 $row->attributes['data-imported'] = 'true';
1170 1170
                 $row->attributes['title'] = get_string('view_recording_link_warning', 'bigbluebuttonbn');
1171 1171
             } else {
@@ -1173,12 +1173,12 @@  discard block
 block discarded – undo
1173 1173
             }
1174 1174
 
1175 1175
             $row_data = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools);
1176
-            if( $row_data != null ) {
1176
+            if ($row_data != null) {
1177 1177
                 $row_data->date_formatted = str_replace(" ", "&nbsp;", $row_data->date_formatted);
1178
-                if ( $bbbsession['managerecordings'] ) {
1179
-                    $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted, $row_data->actionbar );
1178
+                if ($bbbsession['managerecordings']) {
1179
+                    $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted, $row_data->actionbar);
1180 1180
                 } else {
1181
-                    $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted );
1181
+                    $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted);
1182 1182
                 }
1183 1183
 
1184 1184
                 array_push($table->data, $row);
@@ -1198,12 +1198,12 @@  discard block
 block discarded – undo
1198 1198
     /// Build the message_body
1199 1199
     $msg->activity_type = "";
1200 1200
     $msg->activity_title = $bigbluebuttonbn->name;
1201
-    $message_text = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').' '.$msg->activity_type.' &quot;'.$msg->activity_title.'&quot; '.get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
1201
+    $message_text = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') . ' ' . $msg->activity_type . ' &quot;' . $msg->activity_title . '&quot; ' . get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
1202 1202
 
1203 1203
     bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message_text);
1204 1204
 }
1205 1205
 
1206
-function bigbluebuttonbn_server_offers($capability_name){
1206
+function bigbluebuttonbn_server_offers($capability_name) {
1207 1207
     global $CFG;
1208 1208
 
1209 1209
     $capability_offered = null;
@@ -1217,12 +1217,12 @@  discard block
 block discarded – undo
1217 1217
     $host_ends = explode(".", $host);
1218 1218
     $host_ends_length = count($host_ends);
1219 1219
 
1220
-    if( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' &&  $host_ends[$host_ends_length -2] == 'blindsidenetworks' ) {
1220
+    if ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks') {
1221 1221
         //Validate the capabilities offered
1222
-        $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret );
1223
-        if( $capabilities ) {
1222
+        $capabilities = bigbluebuttonbn_getCapabilitiesArray($endpoint, $shared_secret);
1223
+        if ($capabilities) {
1224 1224
             foreach ($capabilities as $capability) {
1225
-                if ( $capability["name"] == $capability_name) {
1225
+                if ($capability["name"] == $capability_name) {
1226 1226
                     $capability_offered = $capability;
1227 1227
                 }
1228 1228
             }
@@ -1232,14 +1232,14 @@  discard block
 block discarded – undo
1232 1232
     return $capability_offered;
1233 1233
 }
1234 1234
 
1235
-function bigbluebuttonbn_server_offers_bn_capabilities(){
1235
+function bigbluebuttonbn_server_offers_bn_capabilities() {
1236 1236
     //Validates if the server may have extended capabilities
1237 1237
     $parsed_url = parse_url(bigbluebuttonbn_get_cfg_server_url());
1238 1238
     $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
1239 1239
     $host_ends = explode(".", $host);
1240 1240
     $host_ends_length = count($host_ends);
1241 1241
 
1242
-    return ( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' && $host_ends[$host_ends_length -2] == 'blindsidenetworks' );
1242
+    return ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks');
1243 1243
 }
1244 1244
 
1245 1245
 function bigbluebuttonbn_get_locales_for_ui() {
@@ -1284,89 +1284,89 @@  discard block
 block discarded – undo
1284 1284
 
1285 1285
 function bigbluebuttonbn_get_cfg_server_url_default() {
1286 1286
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1287
-    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: BIGBLUEBUTTONBN_DEFAULT_SERVER_URL)));
1287
+    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 : BIGBLUEBUTTONBN_DEFAULT_SERVER_URL)));
1288 1288
 }
1289 1289
 
1290 1290
 function bigbluebuttonbn_get_cfg_shared_secret_default() {
1291 1291
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1292
-    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: BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET)));
1292
+    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 : BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET)));
1293 1293
 }
1294 1294
 
1295 1295
 function bigbluebuttonbn_get_cfg_voicebridge_editable() {
1296 1296
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1297
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable: (isset($CFG->bigbluebuttonbn_voicebridge_editable)? $CFG->bigbluebuttonbn_voicebridge_editable: false));
1297
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable : (isset($CFG->bigbluebuttonbn_voicebridge_editable) ? $CFG->bigbluebuttonbn_voicebridge_editable : false));
1298 1298
 }
1299 1299
 
1300 1300
 function bigbluebuttonbn_get_cfg_recording_default() {
1301 1301
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1302
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default: (isset($CFG->bigbluebuttonbn_recording_default)? $CFG->bigbluebuttonbn_recording_default: true));
1302
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default : (isset($CFG->bigbluebuttonbn_recording_default) ? $CFG->bigbluebuttonbn_recording_default : true));
1303 1303
 }
1304 1304
 
1305 1305
 function bigbluebuttonbn_get_cfg_recording_editable() {
1306 1306
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1307
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable: (isset($CFG->bigbluebuttonbn_recording_editable)? $CFG->bigbluebuttonbn_recording_editable: true));
1307
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable : (isset($CFG->bigbluebuttonbn_recording_editable) ? $CFG->bigbluebuttonbn_recording_editable : true));
1308 1308
 }
1309 1309
 
1310 1310
 function bigbluebuttonbn_get_cfg_recording_tagging_default() {
1311 1311
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1312
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default: (isset($CFG->bigbluebuttonbn_recordingtagging_default)? $CFG->bigbluebuttonbn_recordingtagging_default: false));
1312
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default : (isset($CFG->bigbluebuttonbn_recordingtagging_default) ? $CFG->bigbluebuttonbn_recordingtagging_default : false));
1313 1313
 }
1314 1314
 
1315 1315
 function bigbluebuttonbn_get_cfg_recording_tagging_editable() {
1316 1316
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1317
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable: (isset($CFG->bigbluebuttonbn_recordingtagging_editable)? $CFG->bigbluebuttonbn_recordingtagging_editable: false));
1317
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable : (isset($CFG->bigbluebuttonbn_recordingtagging_editable) ? $CFG->bigbluebuttonbn_recordingtagging_editable : false));
1318 1318
 }
1319 1319
 
1320 1320
 function bigbluebuttonbn_get_cfg_recording_icons_enabled() {
1321 1321
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1322
-    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));
1322
+    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));
1323 1323
 }
1324 1324
 
1325 1325
 function bigbluebuttonbn_get_cfg_importrecordings_enabled() {
1326 1326
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1327
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled: (isset($CFG->bigbluebuttonbn_importrecordings_enabled)? $CFG->bigbluebuttonbn_importrecordings_enabled: false));
1327
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled : (isset($CFG->bigbluebuttonbn_importrecordings_enabled) ? $CFG->bigbluebuttonbn_importrecordings_enabled : false));
1328 1328
 }
1329 1329
 
1330 1330
 function bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled() {
1331 1331
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1332
-    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));
1332
+    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));
1333 1333
 }
1334 1334
 
1335 1335
 function bigbluebuttonbn_get_cfg_waitformoderator_default() {
1336 1336
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1337
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default: (isset($CFG->bigbluebuttonbn_waitformoderator_default)? $CFG->bigbluebuttonbn_waitformoderator_default: false));
1337
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default : (isset($CFG->bigbluebuttonbn_waitformoderator_default) ? $CFG->bigbluebuttonbn_waitformoderator_default : false));
1338 1338
 }
1339 1339
 
1340 1340
 function bigbluebuttonbn_get_cfg_waitformoderator_editable() {
1341 1341
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1342
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable: (isset($CFG->bigbluebuttonbn_waitformoderator_editable)? $CFG->bigbluebuttonbn_waitformoderator_editable: true));
1342
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable : (isset($CFG->bigbluebuttonbn_waitformoderator_editable) ? $CFG->bigbluebuttonbn_waitformoderator_editable : true));
1343 1343
 }
1344 1344
 
1345 1345
 function bigbluebuttonbn_get_cfg_waitformoderator_ping_interval() {
1346 1346
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1347
-    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));
1347
+    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));
1348 1348
 }
1349 1349
 
1350 1350
 function bigbluebuttonbn_get_cfg_waitformoderator_cache_ttl() {
1351 1351
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1352
-    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));
1352
+    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));
1353 1353
 }
1354 1354
 
1355 1355
 function bigbluebuttonbn_get_cfg_userlimit_default() {
1356 1356
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1357
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default: (isset($CFG->bigbluebuttonbn_userlimit_default)? $CFG->bigbluebuttonbn_userlimit_default: 0));
1357
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default : (isset($CFG->bigbluebuttonbn_userlimit_default) ? $CFG->bigbluebuttonbn_userlimit_default : 0));
1358 1358
 }
1359 1359
 
1360 1360
 function bigbluebuttonbn_get_cfg_userlimit_editable() {
1361 1361
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1362
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable: (isset($CFG->bigbluebuttonbn_userlimit_editable)? $CFG->bigbluebuttonbn_userlimit_editable: false));
1362
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable : (isset($CFG->bigbluebuttonbn_userlimit_editable) ? $CFG->bigbluebuttonbn_userlimit_editable : false));
1363 1363
 }
1364 1364
 
1365 1365
 function bigbluebuttonbn_get_cfg_preuploadpresentation_enabled() {
1366 1366
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1367 1367
     if (extension_loaded('curl')) {
1368 1368
         // This feature only works if curl is installed
1369
-        return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled: (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $CFG->bigbluebuttonbn_preuploadpresentation_enabled: false));
1369
+        return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled : (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $CFG->bigbluebuttonbn_preuploadpresentation_enabled : false));
1370 1370
     } else {
1371 1371
         return false;
1372 1372
     }
@@ -1374,37 +1374,37 @@  discard block
 block discarded – undo
1374 1374
 
1375 1375
 function bigbluebuttonbn_get_cfg_sendnotifications_enabled() {
1376 1376
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1377
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled: (isset($CFG->bigbluebuttonbn_sendnotifications_enabled)? $CFG->bigbluebuttonbn_sendnotifications_enabled: false));
1377
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled : (isset($CFG->bigbluebuttonbn_sendnotifications_enabled) ? $CFG->bigbluebuttonbn_sendnotifications_enabled : false));
1378 1378
 }
1379 1379
 
1380 1380
 function bigbluebuttonbn_get_cfg_recordingready_enabled() {
1381 1381
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1382
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled: (isset($CFG->bigbluebuttonbn_recordingready_enabled)? $CFG->bigbluebuttonbn_recordingready_enabled: false));
1382
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled : (isset($CFG->bigbluebuttonbn_recordingready_enabled) ? $CFG->bigbluebuttonbn_recordingready_enabled : false));
1383 1383
 }
1384 1384
 
1385 1385
 function bigbluebuttonbn_get_cfg_moderator_default() {
1386 1386
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1387
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default: (isset($CFG->bigbluebuttonbn_moderator_default)? $CFG->bigbluebuttonbn_moderator_default: 'owner'));
1387
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default : (isset($CFG->bigbluebuttonbn_moderator_default) ? $CFG->bigbluebuttonbn_moderator_default : 'owner'));
1388 1388
 }
1389 1389
 
1390 1390
 function bigbluebuttonbn_get_cfg_scheduled_duration_enabled() {
1391 1391
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1392
-    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));
1392
+    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));
1393 1393
 }
1394 1394
 
1395 1395
 function bigbluebuttonbn_get_cfg_scheduled_duration_compensation() {
1396 1396
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1397
-    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));
1397
+    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));
1398 1398
 }
1399 1399
 
1400 1400
 function bigbluebuttonbn_get_cfg_scheduled_pre_opening() {
1401 1401
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1402
-    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));
1402
+    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));
1403 1403
 }
1404 1404
 
1405 1405
 function bigbluebuttonbn_import_get_courses_for_select(array $bbbsession) {
1406 1406
 
1407
-    if( $bbbsession['administrator'] ) {
1407
+    if ($bbbsession['administrator']) {
1408 1408
         $courses = get_courses('all', 'c.id ASC', 'c.id,c.shortname,c.fullname');
1409 1409
         //It includes the name of the site as a course (category 0), so remove the first one
1410 1410
         unset($courses["1"]);
@@ -1413,21 +1413,21 @@  discard block
 block discarded – undo
1413 1413
     }
1414 1414
 
1415 1415
     $courses_for_select = [];
1416
-    foreach($courses as $course) {
1417
-        if( $course->id != $bbbsession['course']->id ) {
1416
+    foreach ($courses as $course) {
1417
+        if ($course->id != $bbbsession['course']->id) {
1418 1418
             $courses_for_select[$course->id] = $course->fullname;
1419 1419
         }
1420 1420
     }
1421 1421
     return $courses_for_select;
1422 1422
 }
1423 1423
 
1424
-function bigbluebuttonbn_getRecordedMeetingsDeleted($courseID, $bigbluebuttonbnID=NULL) {
1424
+function bigbluebuttonbn_getRecordedMeetingsDeleted($courseID, $bigbluebuttonbnID = NULL) {
1425 1425
     global $DB;
1426 1426
 
1427 1427
     $records_deleted = array();
1428 1428
 
1429
-    $filter = array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_DELETE );
1430
-    if ( $bigbluebuttonbnID != NULL ) {
1429
+    $filter = array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_DELETE);
1430
+    if ($bigbluebuttonbnID != NULL) {
1431 1431
         $filter['id'] = $bigbluebuttonbnID;
1432 1432
     }
1433 1433
 
@@ -1436,17 +1436,17 @@  discard block
 block discarded – undo
1436 1436
     foreach ($bigbluebuttonbns_deleted as $key => $bigbluebuttonbn_deleted) {
1437 1437
         $records = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE));
1438 1438
 
1439
-        if( !empty($records) ) {
1439
+        if (!empty($records)) {
1440 1440
             //Remove duplicates
1441 1441
             $unique_records = array();
1442 1442
             foreach ($records as $key => $record) {
1443
-                if (array_key_exists($record->meetingid, $unique_records) ) {
1443
+                if (array_key_exists($record->meetingid, $unique_records)) {
1444 1444
                     unset($records[$key]);
1445 1445
                 } else {
1446 1446
                     $meta = json_decode($record->meta);
1447
-                    if ( !$meta->record ) {
1447
+                    if (!$meta->record) {
1448 1448
                         unset($records[$key]);
1449
-                    } else if ( $bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) {
1449
+                    } else if ($bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) {
1450 1450
                         unset($records[$key]);
1451 1451
                     } else {
1452 1452
                         array_push($unique_records, $record->meetingid);
@@ -1461,27 +1461,27 @@  discard block
 block discarded – undo
1461 1461
     return $records_deleted;
1462 1462
 }
1463 1463
 
1464
-function bigbluebuttonbn_getRecordedMeetings($courseID, $bigbluebuttonbnID=NULL) {
1464
+function bigbluebuttonbn_getRecordedMeetings($courseID, $bigbluebuttonbnID = NULL) {
1465 1465
     global $DB;
1466 1466
 
1467 1467
     $records = Array();
1468 1468
 
1469 1469
     $filter = array('course' => $courseID);
1470
-    if ( $bigbluebuttonbnID != NULL ) {
1470
+    if ($bigbluebuttonbnID != NULL) {
1471 1471
         $filter['id'] = $bigbluebuttonbnID;
1472 1472
     }
1473 1473
     $bigbluebuttonbns = $DB->get_records('bigbluebuttonbn', $filter);
1474 1474
 
1475
-    if ( !empty($bigbluebuttonbns) ) {
1475
+    if (!empty($bigbluebuttonbns)) {
1476 1476
         $table = 'bigbluebuttonbn_logs';
1477 1477
 
1478 1478
         //Prepare select for loading records based on existent bigbluebuttonbns
1479 1479
         $select = "";
1480 1480
         foreach ($bigbluebuttonbns as $key => $bigbluebuttonbn) {
1481
-            $select .= strlen($select) == 0? "(": " OR ";
1482
-            $select .= "bigbluebuttonbnid=".$bigbluebuttonbn->id;
1481
+            $select .= strlen($select) == 0 ? "(" : " OR ";
1482
+            $select .= "bigbluebuttonbnid=" . $bigbluebuttonbn->id;
1483 1483
         }
1484
-        $select .= ") AND log='".BIGBLUEBUTTONBN_LOG_EVENT_CREATE."'";
1484
+        $select .= ") AND log='" . BIGBLUEBUTTONBN_LOG_EVENT_CREATE . "'";
1485 1485
 
1486 1486
         //Execute select for loading records based on existent bigbluebuttonbns
1487 1487
         $records = $DB->get_records_select($table, $select);
@@ -1489,8 +1489,8 @@  discard block
 block discarded – undo
1489 1489
         //Remove duplicates
1490 1490
         $unique_records = array();
1491 1491
         foreach ($records as $key => $record) {
1492
-            $record_key = $record->meetingid.','.$record->bigbluebuttonbnid.','.$record->meta;
1493
-            if( array_search($record_key, $unique_records) === false ) {
1492
+            $record_key = $record->meetingid . ',' . $record->bigbluebuttonbnid . ',' . $record->meta;
1493
+            if (array_search($record_key, $unique_records) === false) {
1494 1494
                 array_push($unique_records, $record_key);
1495 1495
             } else {
1496 1496
                 unset($records[$key]);
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
         //Remove the ones with record=false
1501 1501
         foreach ($records as $key => $record) {
1502 1502
             $meta = json_decode($record->meta);
1503
-            if ( !$meta || !$meta->record ) {
1503
+            if (!$meta || !$meta->record) {
1504 1504
                 unset($records[$key]);
1505 1505
             }
1506 1506
         }
@@ -1514,15 +1514,15 @@  discard block
 block discarded – undo
1514 1514
 
1515 1515
     // Load the meetingIDs to be used in the getRecordings request
1516 1516
     $meetingID = '';
1517
-    if ( is_numeric($courseID) ) {
1517
+    if (is_numeric($courseID)) {
1518 1518
         $results = bigbluebuttonbn_getRecordedMeetings($courseID);
1519 1519
 
1520
-        if( bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled() ) {
1520
+        if (bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled()) {
1521 1521
             $results_deleted = bigbluebuttonbn_getRecordedMeetingsDeleted($courseID);
1522 1522
             $results = array_merge($results, $results_deleted);
1523 1523
         }
1524 1524
 
1525
-        if( $results ) {
1525
+        if ($results) {
1526 1526
             //Eliminates duplicates
1527 1527
             $mIDs = array();
1528 1528
             foreach ($results as $result) {
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
     }
1540 1540
 
1541 1541
     // If there were meetingIDs excecute the getRecordings request
1542
-    if ( $meetingID != '' ) {
1542
+    if ($meetingID != '') {
1543 1543
         $recordings = bigbluebuttonbn_getRecordingsArray($meetingID, $URL, $SALT);
1544 1544
     }
1545 1545
 
@@ -1562,37 +1562,37 @@  discard block
 block discarded – undo
1562 1562
     $recordings_already_imported_indexed = bigbluebuttonbn_index_recordings($recordings_already_imported);
1563 1563
 
1564 1564
     foreach ($recordings as $key => $recording) {
1565
-        if( isset($recordings_already_imported_indexed[$recording['recordID']]) ) {
1565
+        if (isset($recordings_already_imported_indexed[$recording['recordID']])) {
1566 1566
             unset($recordings[$key]);
1567 1567
         }
1568 1568
     }
1569 1569
     return $recordings;
1570 1570
 }
1571 1571
 
1572
-function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) {
1572
+function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) {
1573 1573
 
1574
-    if ( isset($recordings) && !empty($recordings) ) {  // There are recordings for this meeting
1574
+    if (isset($recordings) && !empty($recordings)) {  // There are recordings for this meeting
1575 1575
         $table = bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools);
1576 1576
     }
1577 1577
 
1578 1578
     $output = '';
1579
-    if( isset($table->data) ) {
1579
+    if (isset($table->data)) {
1580 1580
         //Print the table
1581
-        $output .= '<div id="bigbluebuttonbn_html_table">'."\n";
1582
-        $output .= html_writer::table($table)."\n";
1583
-        $output .= '</div>'."\n";
1581
+        $output .= '<div id="bigbluebuttonbn_html_table">' . "\n";
1582
+        $output .= html_writer::table($table) . "\n";
1583
+        $output .= '</div>' . "\n";
1584 1584
 
1585 1585
     } else {
1586
-        $output .= get_string('view_message_norecordings', 'bigbluebuttonbn').'<br>'."\n";
1586
+        $output .= get_string('view_message_norecordings', 'bigbluebuttonbn') . '<br>' . "\n";
1587 1587
     }
1588 1588
 
1589 1589
     return $output;
1590 1590
 }
1591 1591
 
1592
-function bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID=NULL) {
1592
+function bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID = NULL) {
1593 1593
     global $DB;
1594 1594
 
1595
-    if ( $bigbluebuttonbnID != NULL ) {
1595
+    if ($bigbluebuttonbnID != NULL) {
1596 1596
         // Fetch only those related to the $courseID and $bigbluebuttonbnID requested
1597 1597
         $recordings_imported = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'bigbluebuttonbnid' => $bigbluebuttonbnID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_IMPORT));
1598 1598
     } else {
@@ -1602,7 +1602,7 @@  discard block
 block discarded – undo
1602 1602
     return $recordings_imported;
1603 1603
 }
1604 1604
 
1605
-function bigbluebuttonbn_getRecordingsImportedArray($courseID, $bigbluebuttonbnID=NULL) {
1605
+function bigbluebuttonbn_getRecordingsImportedArray($courseID, $bigbluebuttonbnID = NULL) {
1606 1606
     $recordings_imported = bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID);
1607 1607
     $recordings_imported_array = bigbluebuttonbn_import_get_recordings_imported($recordings_imported);
1608 1608
     return $recordings_imported_array;
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 function bigbluebuttonbn_getRecordingsImportedAllInstances($recordID) {
1612 1612
     global $DB, $CFG;
1613 1613
 
1614
-    $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.'%' ));
1614
+    $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 . '%'));
1615 1615
     return $recordings_imported;
1616 1616
 }
1617 1617
 
@@ -1630,8 +1630,8 @@  discard block
 block discarded – undo
1630 1630
 function bigbluebuttonbn_html2text($html, $len) {
1631 1631
     $text = strip_tags($html);
1632 1632
     $text = str_replace("&nbsp;", ' ', $text);
1633
-    if( strlen($text) > $len ) {
1634
-        $text = substr($text, 0, $len)."...";
1633
+    if (strlen($text) > $len) {
1634
+        $text = substr($text, 0, $len) . "...";
1635 1635
     } else {
1636 1636
         $text = substr($text, 0, $len);
1637 1637
     }
Please login to merge, or discard this patch.
settings.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -13,52 +13,52 @@  discard block
 block discarded – undo
13 13
 
14 14
 global $BIGBLUEBUTTONBN_CFG;
15 15
 
16
-require_once(dirname(__FILE__).'/locallib.php');
16
+require_once(dirname(__FILE__) . '/locallib.php');
17 17
 
18 18
 if ($ADMIN->fulltree) {
19
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ||
20
-        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ) {
21
-        $settings->add( new admin_setting_heading('bigbluebuttonbn_config_general',
19
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ||
20
+        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)) {
21
+        $settings->add(new admin_setting_heading('bigbluebuttonbn_config_general',
22 22
                 get_string('config_general', 'bigbluebuttonbn'),
23 23
                 get_string('config_general_description', 'bigbluebuttonbn')));
24 24
 
25
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ) {
26
-            $settings->add( new admin_setting_configtext( 'bigbluebuttonbn_server_url',
27
-                    get_string( 'config_server_url', 'bigbluebuttonbn' ),
28
-                    get_string( 'config_server_url_description', 'bigbluebuttonbn' ),
25
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)) {
26
+            $settings->add(new admin_setting_configtext('bigbluebuttonbn_server_url',
27
+                    get_string('config_server_url', 'bigbluebuttonbn'),
28
+                    get_string('config_server_url_description', 'bigbluebuttonbn'),
29 29
                     BIGBLUEBUTTONBN_DEFAULT_SERVER_URL));
30 30
         }
31
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ) {
32
-            $settings->add( new admin_setting_configtext( 'bigbluebuttonbn_shared_secret',
33
-                    get_string( 'config_shared_secret', 'bigbluebuttonbn' ),
34
-                    get_string( 'config_shared_secret_description', 'bigbluebuttonbn' ),
31
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)) {
32
+            $settings->add(new admin_setting_configtext('bigbluebuttonbn_shared_secret',
33
+                    get_string('config_shared_secret', 'bigbluebuttonbn'),
34
+                    get_string('config_shared_secret_description', 'bigbluebuttonbn'),
35 35
                     BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET));
36 36
         }
37 37
     }
38 38
 
39 39
     //// Configuration for 'recording' feature
40
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ||
40
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ||
41 41
         !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ||
42
-        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled) ) {
43
-        $settings->add( new admin_setting_heading('bigbluebuttonbn_recording',
42
+        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled)) {
43
+        $settings->add(new admin_setting_heading('bigbluebuttonbn_recording',
44 44
                 get_string('config_feature_recording', 'bigbluebuttonbn'),
45 45
                 get_string('config_feature_recording_description', 'bigbluebuttonbn')));
46 46
 
47
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ) {
47
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default)) {
48 48
             // default value for 'recording' feature
49 49
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recording_default',
50 50
                     get_string('config_feature_recording_default', 'bigbluebuttonbn'),
51 51
                     get_string('config_feature_recording_default_description', 'bigbluebuttonbn'),
52 52
                     1));
53 53
         }
54
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ) {
54
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable)) {
55 55
             // UI for 'recording' feature
56 56
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recording_editable',
57 57
                     get_string('config_feature_recording_editable', 'bigbluebuttonbn'),
58 58
                     get_string('config_feature_recording_editable_description', 'bigbluebuttonbn'),
59 59
                     1));
60 60
         }
61
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled) ) {
61
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled)) {
62 62
             // Front panel for 'recording' managment feature
63 63
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recording_icons_enabled',
64 64
                     get_string('config_feature_recording_icons_enabled', 'bigbluebuttonbn'),
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     //// Configuration for 'recording tagging' feature
71
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ||
72
-        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ) {
73
-        $settings->add( new admin_setting_heading('bigbluebuttonbn_recordingtagging',
71
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ||
72
+        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)) {
73
+        $settings->add(new admin_setting_heading('bigbluebuttonbn_recordingtagging',
74 74
                 get_string('config_feature_recordingtagging', 'bigbluebuttonbn'),
75 75
                 get_string('config_feature_recordingtagging_description', 'bigbluebuttonbn')));
76 76
 
77
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ) {
77
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default)) {
78 78
             // default value for 'recording tagging' feature
79 79
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recordingtagging_default',
80 80
                     get_string('config_feature_recordingtagging_default', 'bigbluebuttonbn'),
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                     0));
83 83
         }
84 84
         // UI for 'recording tagging' feature
85
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ) {
85
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)) {
86 86
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recordingtagging_editable',
87 87
                     get_string('config_feature_recordingtagging_editable', 'bigbluebuttonbn'),
88 88
                     get_string('config_feature_recordingtagging_editable_description', 'bigbluebuttonbn'),
@@ -91,20 +91,20 @@  discard block
 block discarded – undo
91 91
     }
92 92
 
93 93
     //// Configuration for 'import recordings' feature
94
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ||
95
-        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ) {
96
-        $settings->add( new admin_setting_heading('bigbluebuttonbn_importrecordings',
94
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ||
95
+        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)) {
96
+        $settings->add(new admin_setting_heading('bigbluebuttonbn_importrecordings',
97 97
                 get_string('config_feature_importrecordings', 'bigbluebuttonbn'),
98 98
                 get_string('config_feature_importrecordings_description', 'bigbluebuttonbn')));
99 99
 
100
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ) {
100
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled)) {
101 101
             // default value for 'import recordings' feature
102 102
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_importrecordings_enabled',
103 103
                     get_string('config_feature_importrecordings_enabled', 'bigbluebuttonbn'),
104 104
                     get_string('config_feature_importrecordings_enabled_description', 'bigbluebuttonbn'),
105 105
                     0));
106 106
         }
107
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ) {
107
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)) {
108 108
             // consider deleted activities for 'import recordings' feature
109 109
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_importrecordings_from_deleted_activities_enabled',
110 110
                     get_string('config_feature_importrecordings_from_deleted_activities_enabled', 'bigbluebuttonbn'),
@@ -114,36 +114,36 @@  discard block
 block discarded – undo
114 114
     }
115 115
 
116 116
     //// Configuration for wait for moderator feature
117
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ||
117
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ||
118 118
         !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ||
119 119
         !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval) ||
120
-        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ) {
121
-        $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_waitformoderator',
120
+        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl)) {
121
+        $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_waitformoderator',
122 122
                 get_string('config_feature_waitformoderator', 'bigbluebuttonbn'),
123 123
                 get_string('config_feature_waitformoderator_description', 'bigbluebuttonbn')));
124 124
 
125
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ) {
125
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default)) {
126 126
             //default value for 'wait for moderator' feature
127 127
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_waitformoderator_default',
128 128
                     get_string('config_feature_waitformoderator_default', 'bigbluebuttonbn'),
129 129
                     get_string('config_feature_waitformoderator_default_description', 'bigbluebuttonbn'),
130 130
                     0));
131 131
         }
132
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ) {
132
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable)) {
133 133
             // UI for 'wait for moderator' feature
134 134
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_waitformoderator_editable',
135 135
                     get_string('config_feature_waitformoderator_editable', 'bigbluebuttonbn'),
136 136
                     get_string('config_feature_waitformoderator_editable_description', 'bigbluebuttonbn'),
137 137
                     1));
138 138
         }
139
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval) ) {
139
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval)) {
140 140
             //ping interval value for 'wait for moderator' feature
141 141
             $settings->add(new admin_setting_configtext('bigbluebuttonbn_waitformoderator_ping_interval',
142 142
                     get_string('config_feature_waitformoderator_ping_interval', 'bigbluebuttonbn'),
143 143
                     get_string('config_feature_waitformoderator_ping_interval_description', 'bigbluebuttonbn'),
144 144
                     10, PARAM_INT));
145 145
         }
146
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ) {
146
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl)) {
147 147
             //cache TTL value for 'wait for moderator' feature
148 148
             $settings->add(new admin_setting_configtext('bigbluebuttonbn_waitformoderator_cache_ttl',
149 149
                     get_string('config_feature_waitformoderator_cache_ttl', 'bigbluebuttonbn'),
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
     }
154 154
 
155 155
     //// Configuration for "static voice bridge" feature
156
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable) ) {
157
-        $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_voicebridge',
156
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable)) {
157
+        $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_voicebridge',
158 158
                 get_string('config_feature_voicebridge', 'bigbluebuttonbn'),
159 159
                 get_string('config_feature_voicebridge_description', 'bigbluebuttonbn')));
160 160
 
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
     }
167 167
 
168 168
     //// Configuration for "preupload presentation" feature
169
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled) ) {
169
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled)) {
170 170
         // This feature only works if curl is installed
171 171
         if (extension_loaded('curl')) {
172
-            $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation',
172
+            $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation',
173 173
                 get_string('config_feature_preuploadpresentation', 'bigbluebuttonbn'),
174 174
                 get_string('config_feature_preuploadpresentation_description', 'bigbluebuttonbn')
175 175
                 ));
@@ -180,29 +180,29 @@  discard block
 block discarded – undo
180 180
                 get_string('config_feature_preuploadpresentation_enabled_description', 'bigbluebuttonbn'),
181 181
                 0));
182 182
         } else {
183
-            $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation',
183
+            $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation',
184 184
                 get_string('config_feature_preuploadpresentation', 'bigbluebuttonbn'),
185
-                get_string('config_feature_preuploadpresentation_description', 'bigbluebuttonbn').'<br><br>'.
186
-                '<div class="form-defaultinfo">'.get_string('config_warning_curl_not_installed', 'bigbluebuttonbn').'</div><br>'
185
+                get_string('config_feature_preuploadpresentation_description', 'bigbluebuttonbn') . '<br><br>' .
186
+                '<div class="form-defaultinfo">' . get_string('config_warning_curl_not_installed', 'bigbluebuttonbn') . '</div><br>'
187 187
                 ));
188 188
         }
189 189
     }
190 190
 
191 191
     //// Configuration for "user limit" feature
192
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ||
193
-        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ) {
194
-        $settings->add( new admin_setting_heading('config_userlimit',
192
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ||
193
+        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)) {
194
+        $settings->add(new admin_setting_heading('config_userlimit',
195 195
                 get_string('config_feature_userlimit', 'bigbluebuttonbn'),
196 196
                 get_string('config_feature_userlimit_description', 'bigbluebuttonbn')));
197 197
 
198
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ) {
198
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default)) {
199 199
             //default value for 'user limit' feature
200 200
             $settings->add(new admin_setting_configtext('bigbluebuttonbn_userlimit_default',
201 201
                     get_string('config_feature_userlimit_default', 'bigbluebuttonbn'),
202 202
                     get_string('config_feature_userlimit_default_description', 'bigbluebuttonbn'),
203 203
                     0, PARAM_INT));
204 204
         }
205
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ) {
205
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)) {
206 206
             // UI for 'user limit' feature
207 207
             $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_userlimit_editable',
208 208
                     get_string('config_feature_userlimit_editable', 'bigbluebuttonbn'),
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
     }
213 213
 
214 214
     //// Configuration for "scheduled duration" feature
215
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled) ) {
216
-      $settings->add( new admin_setting_heading('config_scheduled',
215
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled)) {
216
+      $settings->add(new admin_setting_heading('config_scheduled',
217 217
               get_string('config_scheduled', 'bigbluebuttonbn'),
218 218
               get_string('config_scheduled_description', 'bigbluebuttonbn')));
219 219
 
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
     }
238 238
 
239 239
     //// Configuration for defining the default role/user that will be moderator on new activities
240
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default) ) {
241
-        $settings->add( new admin_setting_heading('bigbluebuttonbn_permission',
240
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)) {
241
+        $settings->add(new admin_setting_heading('bigbluebuttonbn_permission',
242 242
                 get_string('config_permission', 'bigbluebuttonbn'),
243 243
                 get_string('config_permission_description', 'bigbluebuttonbn')));
244 244
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
     }
253 253
 
254 254
     //// Configuration for "send notifications" feature
255
-    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled) ) {
256
-        $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_sendnotifications',
255
+    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled)) {
256
+        $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_sendnotifications',
257 257
                 get_string('config_feature_sendnotifications', 'bigbluebuttonbn'),
258 258
                 get_string('config_feature_sendnotifications_description', 'bigbluebuttonbn')));
259 259
 
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
     }
266 266
 
267 267
     //// Configuration for extended BN capabilities
268
-    if( bigbluebuttonbn_server_offers_bn_capabilities() ) {
268
+    if (bigbluebuttonbn_server_offers_bn_capabilities()) {
269 269
         //// Configuration for 'notify users when recording ready' feature
270
-        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled) ) {
271
-            $settings->add( new admin_setting_heading('bigbluebuttonbn_extended_capabilities',
270
+        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)) {
271
+            $settings->add(new admin_setting_heading('bigbluebuttonbn_extended_capabilities',
272 272
                     get_string('config_extended_capabilities', 'bigbluebuttonbn'),
273 273
                     get_string('config_extended_capabilities_description', 'bigbluebuttonbn')));
274 274
 
Please login to merge, or discard this patch.