Completed
Push — master ( ef28c1...9aefdf )
by Jesus
02:33
created
index.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  * @copyright 2010-2015 Blindside Networks Inc.
9 9
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
10 10
  */
11
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
12
-require_once(dirname(__FILE__).'/locallib.php');
11
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
12
+require_once(dirname(__FILE__) . '/locallib.php');
13 13
 
14
-$id = required_param('id', PARAM_INT);      // Course Module ID, or
15
-$a  = optional_param('a', 0, PARAM_INT);    // bigbluebuttonbn instance ID
16
-$g  = optional_param('g', 0, PARAM_INT);    // group instance ID
14
+$id = required_param('id', PARAM_INT); // Course Module ID, or
15
+$a  = optional_param('a', 0, PARAM_INT); // bigbluebuttonbn instance ID
16
+$g  = optional_param('g', 0, PARAM_INT); // group instance ID
17 17
 
18 18
 if ($id) {
19 19
     $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 $PAGE->navbar->add(get_string('modulename', 'bigbluebuttonbn'), "index.php?id=$course->id");
37 37
 
38 38
 /// Get all the appropriate data
39
-if (! $bigbluebuttonbns = get_all_instances_in_course('bigbluebuttonbn', $course)) {
39
+if (!$bigbluebuttonbns = get_all_instances_in_course('bigbluebuttonbn', $course)) {
40 40
     notice('There are no instances of bigbluebuttonbn', "../../course/view.php?id=$course->id");
41 41
 }
42 42
 
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 $timenow            = time();
45 45
 $strweek            = get_string('week');
46 46
 $strtopic           = get_string('topic');
47
-$heading_name       = get_string('index_heading_name', 'bigbluebuttonbn' );
48
-$heading_group      = get_string('index_heading_group', 'bigbluebuttonbn' );
47
+$heading_name       = get_string('index_heading_name', 'bigbluebuttonbn');
48
+$heading_group      = get_string('index_heading_group', 'bigbluebuttonbn');
49 49
 $heading_users      = get_string('index_heading_users', 'bigbluebuttonbn');
50 50
 $heading_viewer     = get_string('index_heading_viewer', 'bigbluebuttonbn');
51
-$heading_moderator  = get_string('index_heading_moderator', 'bigbluebuttonbn' );
52
-$heading_actions    = get_string('index_heading_actions', 'bigbluebuttonbn' );
53
-$heading_recording  = get_string('index_heading_recording', 'bigbluebuttonbn' );
51
+$heading_moderator  = get_string('index_heading_moderator', 'bigbluebuttonbn');
52
+$heading_actions    = get_string('index_heading_actions', 'bigbluebuttonbn');
53
+$heading_recording  = get_string('index_heading_recording', 'bigbluebuttonbn');
54 54
 
55 55
 $table = new html_table();
56 56
 
57
-$table->head  = array ($strweek, $heading_name, $heading_group, $heading_users, $heading_viewer, $heading_moderator, $heading_recording, $heading_actions );
58
-$table->align = array ('center', 'left', 'center', 'center', 'center',  'center', 'center' );
57
+$table->head  = array($strweek, $heading_name, $heading_group, $heading_users, $heading_viewer, $heading_moderator, $heading_recording, $heading_actions);
58
+$table->align = array('center', 'left', 'center', 'center', 'center', 'center', 'center');
59 59
 
60 60
 $endpoint = bigbluebuttonbn_get_cfg_server_url();
61 61
 $shared_secret = bigbluebuttonbn_get_cfg_shared_secret();
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
     //
67 67
     // A request to end the meeting
68 68
     //
69
-    if (! $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $a), '*', MUST_EXIST) ) {
69
+    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $a), '*', MUST_EXIST)) {
70 70
         print_error("BigBlueButton ID $a is incorrect");
71 71
     }
72 72
     $course = $DB->get_record('course', array('id' => $bigbluebuttonbn->course), '*', MUST_EXIST);
73 73
     $cm = get_coursemodule_from_instance('bigbluebuttonbn', $bigbluebuttonbn->id, $course->id, false, MUST_EXIST);
74 74
 
75 75
     //User roles
76
-    if( $bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]" ){
76
+    if ($bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]") {
77 77
         //The room that is being used comes from a previous version
78 78
         $moderator = has_capability('mod/bigbluebuttonbn:moderate', $context);
79 79
     } else {
@@ -81,19 +81,19 @@  discard block
 block discarded – undo
81 81
     }
82 82
     $administrator = has_capability('moodle/category:manage', $context);
83 83
 
84
-    if( $moderator || $administrator ) {
84
+    if ($moderator || $administrator) {
85 85
         bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm);
86 86
 
87 87
         echo get_string('index_ending', 'bigbluebuttonbn');
88 88
 
89
-        $meetingID = $bigbluebuttonbn->meetingid.'-'.$course->id.'-'.$bigbluebuttonbn->id;
89
+        $meetingID = $bigbluebuttonbn->meetingid . '-' . $course->id . '-' . $bigbluebuttonbn->id;
90 90
         $modPW = $bigbluebuttonbn->moderatorpass;
91
-        if( $g != '0'  ) {
92
-            $getArray = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID.'['.$g.']', $modPW, $endpoint, $shared_secret ) );
91
+        if ($g != '0') {
92
+            $getArray = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID . '[' . $g . ']', $modPW, $endpoint, $shared_secret));
93 93
         } else {
94
-            $getArray = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $endpoint, $shared_secret ));
94
+            $getArray = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $endpoint, $shared_secret));
95 95
         }
96
-	   redirect('index.php?id='.$id);
96
+	   redirect('index.php?id=' . $id);
97 97
     }
98 98
 }
99 99
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     $cm = get_coursemodule_from_id('bigbluebuttonbn', $bigbluebuttonbn->coursemodule, 0, false, MUST_EXIST);
102 102
 
103 103
     //User roles
104
-    if( $bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]" ){
104
+    if ($bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]") {
105 105
         //The room that is being used comes from a previous version
106 106
         $moderator = has_capability('mod/bigbluebuttonbn:moderate', $context);
107 107
     } else {
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
     }
110 110
     $administrator = has_capability('moodle/category:manage', $context);
111 111
 
112
-    if ( groups_get_activity_groupmode($cm) > 0 ){
113
-        $table->data[] = displayBigBlueButtonRooms($endpoint, $shared_secret, ($administrator || $moderator), $course, $bigbluebuttonbn, (object) array('id'=>0, 'name'=>get_string('allparticipants')));
112
+    if (groups_get_activity_groupmode($cm) > 0) {
113
+        $table->data[] = displayBigBlueButtonRooms($endpoint, $shared_secret, ($administrator || $moderator), $course, $bigbluebuttonbn, (object)array('id'=>0, 'name'=>get_string('allparticipants')));
114 114
         $groups = groups_get_activity_allowed_groups($cm);
115
-        if( isset($groups)) {
116
-            foreach( $groups as $group){
115
+        if (isset($groups)) {
116
+            foreach ($groups as $group) {
117 117
                 $table->data[] = displayBigBlueButtonRooms($endpoint, $shared_secret, ($administrator || $moderator), $course, $bigbluebuttonbn, $group);
118 118
             }
119 119
         }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 echo $OUTPUT->footer();
131 131
 
132 132
 /// Functions
133
-function displayBigBlueButtonRooms($endpoint, $shared_secret, $moderator, $course, $bigbluebuttonbn, $groupObj = null ){
133
+function displayBigBlueButtonRooms($endpoint, $shared_secret, $moderator, $course, $bigbluebuttonbn, $groupObj = null) {
134 134
     $joinURL = null;
135 135
     $group = "-";
136 136
     $users = "-";
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
     $moderatorList = "-";
141 141
     $recording = "-";
142 142
 
143
-    if ( !$bigbluebuttonbn->visible ) {
143
+    if (!$bigbluebuttonbn->visible) {
144 144
         // Nothing to do
145 145
     } else {
146 146
         $modPW = $bigbluebuttonbn->moderatorpass;
147 147
         $attPW = $bigbluebuttonbn->viewerpass;
148 148
 
149
-        $meetingID = $bigbluebuttonbn->meetingid.'-'.$course->id.'-'.$bigbluebuttonbn->id;
149
+        $meetingID = $bigbluebuttonbn->meetingid . '-' . $course->id . '-' . $bigbluebuttonbn->id;
150 150
         //
151 151
         // Output Users in the meeting
152 152
         //
153
-        if( $groupObj == null ){
154
-            $meetingInfo = bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $endpoint, $shared_secret );
155
-            $joinURL = '<a href="view.php?id='.$bigbluebuttonbn->coursemodule.'">'.format_string($bigbluebuttonbn->name).'</a>';
153
+        if ($groupObj == null) {
154
+            $meetingInfo = bigbluebuttonbn_getMeetingInfoArray($meetingID, $modPW, $endpoint, $shared_secret);
155
+            $joinURL = '<a href="view.php?id=' . $bigbluebuttonbn->coursemodule . '">' . format_string($bigbluebuttonbn->name) . '</a>';
156 156
         } else {
157
-            $meetingInfo = bigbluebuttonbn_getMeetingInfoArray( $meetingID.'['.$groupObj->id.']', $modPW, $endpoint, $shared_secret );
158
-            $joinURL = '<a href="view.php?id='.$bigbluebuttonbn->coursemodule.'&group='.$groupObj->id.'">'.format_string($bigbluebuttonbn->name).'</a>';
157
+            $meetingInfo = bigbluebuttonbn_getMeetingInfoArray($meetingID . '[' . $groupObj->id . ']', $modPW, $endpoint, $shared_secret);
158
+            $joinURL = '<a href="view.php?id=' . $bigbluebuttonbn->coursemodule . '&group=' . $groupObj->id . '">' . format_string($bigbluebuttonbn->name) . '</a>';
159 159
             $group = $groupObj->name;
160 160
         }
161 161
         
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             //
164 164
             // The server was unreachable
165 165
             //
166
-            print_error( get_string( 'index_error_unable_display', 'bigbluebuttonbn' ));
166
+            print_error(get_string('index_error_unable_display', 'bigbluebuttonbn'));
167 167
             return;
168 168
         }
169 169
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             // There was an error returned
173 173
             //
174 174
             if ($meetingInfo['messageKey'] == "checksumError") {
175
-                print_error( get_string( 'index_error_checksum', 'bigbluebuttonbn' ));
175
+                print_error(get_string('index_error_checksum', 'bigbluebuttonbn'));
176 176
                 return;
177 177
             }
178 178
 
@@ -184,39 +184,39 @@  discard block
 block discarded – undo
184 184
                 //
185 185
                 // There was an error
186 186
                 //
187
-                $users = $meetingInfo['messageKey'].": ".$meetingInfo['message'];
187
+                $users = $meetingInfo['messageKey'] . ": " . $meetingInfo['message'];
188 188
             }
189 189
         } else {
190 190
             //
191 191
             // The meeting info was returned
192 192
             //
193 193
             if ($meetingInfo['running'] == 'true') {
194
-                if ( $moderator ) {
195
-                    if( $groupObj == null ) {
196
-                        $actions = '<form name="form1" method="post" action=""><INPUT type="hidden" name="id" value="'.$course->id.'"><INPUT type="hidden" name="a" value="'.$bigbluebuttonbn->id.'"><INPUT type="submit" name="submit" value="end" onclick="return confirm(\''. get_string('index_confirm_end', 'bigbluebuttonbn' ).'\')"></form>';
194
+                if ($moderator) {
195
+                    if ($groupObj == null) {
196
+                        $actions = '<form name="form1" method="post" action=""><INPUT type="hidden" name="id" value="' . $course->id . '"><INPUT type="hidden" name="a" value="' . $bigbluebuttonbn->id . '"><INPUT type="submit" name="submit" value="end" onclick="return confirm(\'' . get_string('index_confirm_end', 'bigbluebuttonbn') . '\')"></form>';
197 197
                     } else {
198
-                        $actions = '<form name="form1" method="post" action=""><INPUT type="hidden" name="id" value="'.$course->id.'"><INPUT type="hidden" name="a" value="'.$bigbluebuttonbn->id.'"><INPUT type="hidden" name="g" value="'.$groupObj->id.'"><INPUT type="submit" name="submit" value="end" onclick="return confirm(\''. get_string('index_confirm_end', 'bigbluebuttonbn' ).'\')"></form>';
198
+                        $actions = '<form name="form1" method="post" action=""><INPUT type="hidden" name="id" value="' . $course->id . '"><INPUT type="hidden" name="a" value="' . $bigbluebuttonbn->id . '"><INPUT type="hidden" name="g" value="' . $groupObj->id . '"><INPUT type="submit" name="submit" value="end" onclick="return confirm(\'' . get_string('index_confirm_end', 'bigbluebuttonbn') . '\')"></form>';
199 199
                     }
200 200
                 }
201
-                if ( isset($meetingInfo['recording']) && $meetingInfo['recording'] == 'true' ){ // if it has been set when meeting created, set the variable on/off
202
-                    $recording = get_string('index_enabled', 'bigbluebuttonbn' );
201
+                if (isset($meetingInfo['recording']) && $meetingInfo['recording'] == 'true') { // if it has been set when meeting created, set the variable on/off
202
+                    $recording = get_string('index_enabled', 'bigbluebuttonbn');
203 203
                 }
204 204
                  
205 205
                 $xml = $meetingInfo['attendees'];
206
-                if (count( $xml ) && count( $xml->attendee ) ) {
207
-                    $users = count( $xml->attendee );
206
+                if (count($xml) && count($xml->attendee)) {
207
+                    $users = count($xml->attendee);
208 208
                     $viewer_count = 0;
209 209
                     $moderator_count = 0;
210
-                    foreach ( $xml->attendee as $attendee ) {
211
-                        if ($attendee->role == "MODERATOR" ) {
212
-                            if ( $viewer_count++ > 0 ) {
210
+                    foreach ($xml->attendee as $attendee) {
211
+                        if ($attendee->role == "MODERATOR") {
212
+                            if ($viewer_count++ > 0) {
213 213
                                 $moderatorList .= ", ";
214 214
                             } else {
215 215
                                 $moderatorList = "";
216 216
                             }
217 217
                             $moderatorList .= $attendee->fullName;
218 218
                         } else {
219
-                            if ( $moderator_count++ > 0 ) {
219
+                            if ($moderator_count++ > 0) {
220 220
                                 $viewerList .= ", ";
221 221
                             } else {
222 222
                                 $viewerList = "";
@@ -228,6 +228,6 @@  discard block
 block discarded – undo
228 228
             }
229 229
         }
230 230
 
231
-        return array ($bigbluebuttonbn->section, $joinURL, $group, $users, $viewerList, $moderatorList, $recording, $actions );
231
+        return array($bigbluebuttonbn->section, $joinURL, $group, $users, $viewerList, $moderatorList, $recording, $actions);
232 232
     }
233 233
 }
234 234
\ No newline at end of file
Please login to merge, or discard this patch.
JWT.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             throw new DomainException('Algorithm not supported');
151 151
         }
152 152
         list($function, $algorithm) = self::$supported_algs[$alg];
153
-        switch($function) {
153
+        switch ($function) {
154 154
             case 'hash_hmac':
155 155
                 return hash_hmac($algorithm, $msg, $key, true);
156 156
             case 'openssl':
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         }
182 182
 
183 183
         list($function, $algorithm) = self::$supported_algs[$alg];
184
-        switch($function) {
184
+        switch ($function) {
185 185
             case 'openssl':
186 186
                 $success = openssl_verify($msg, $signature, $key, $algorithm);
187 187
                 if (!$success) {
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
              * manually detect large ints in the JSON string and quote them (thus converting
229 229
              *them to strings) before decoding, hence the preg_replace() call.
230 230
              */
231
-            $max_int_length = strlen((string) PHP_INT_MAX) - 1;
232
-            $json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input);
231
+            $max_int_length = strlen((string)PHP_INT_MAX) - 1;
232
+            $json_without_bigints = preg_replace('/:\s*(-?\d{' . $max_int_length . ',})/', ': "$1"', $input);
233 233
             $obj = json_decode($json_without_bigints);
234 234
         }
235 235
 
Please login to merge, or discard this patch.
import_view.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
9 9
  */
10 10
 
11
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
12
-require_once(dirname(__FILE__).'/locallib.php');
11
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
12
+require_once(dirname(__FILE__) . '/locallib.php');
13 13
 
14
-$bn = required_param('bn', PARAM_INT);     // bigbluebuttonbn instance ID
15
-$tc = optional_param('tc', 0, PARAM_INT);  // target course ID
14
+$bn = required_param('bn', PARAM_INT); // bigbluebuttonbn instance ID
15
+$tc = optional_param('tc', 0, PARAM_INT); // target course ID
16 16
 
17 17
 if ($bn) {
18 18
     $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $bn), '*', MUST_EXIST);
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 require_login($course, true, $cm);
28 28
 
29
-if ( isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
29
+if (isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
30 30
     $bbbsession = $SESSION->bigbluebuttonbn_bbbsession;
31 31
 }
32 32
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 $options = bigbluebuttonbn_import_get_courses_for_select($bbbsession);
49 49
 $selected = bigbluebuttonbn_selected_course($options, $tc);
50
-if( empty($options) ) {
50
+if (empty($options)) {
51 51
     $output .= html_writer::tag('div', get_string('view_error_import_no_courses', 'bigbluebuttonbn'));
52 52
 
53 53
 } else {
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
     $recordings = bigbluebuttonbn_import_exlcude_recordings_already_imported($bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id, $recordings);
59 59
     //store remaining recordings (indexed) in a session variable
60 60
     $SESSION->bigbluebuttonbn_importrecordings = bigbluebuttonbn_index_recordings($recordings);
61
-    if( empty($recordings) ) {
61
+    if (empty($recordings)) {
62 62
         $output .= html_writer::tag('div', get_string('view_error_import_no_recordings', 'bigbluebuttonbn'));
63 63
     } else {
64
-        $output .= html_writer::tag('span', '', ['id' => 'import_recording_links_table' ,'name'=>'import_recording_links_table']);
64
+        $output .= html_writer::tag('span', '', ['id' => 'import_recording_links_table', 'name'=>'import_recording_links_table']);
65 65
         $output .= bigbluebutton_output_recording_table($bbbsession, $recordings, ['importing']);
66 66
     }
67 67
     $output .= html_writer::start_tag('br');
68
-    $output .= html_writer::tag( 'input', '', array('type' => 'button', 'value' => get_string('view_recording_button_return', 'bigbluebuttonbn'), 'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$cm->id.'\'') );
68
+    $output .= html_writer::tag('input', '', array('type' => 'button', 'value' => get_string('view_recording_button_return', 'bigbluebuttonbn'), 'onclick' => 'window.location=\'' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $cm->id . '\''));
69 69
 
70 70
     $jsvars = array(
71 71
         'bn' => $bn,
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 // finally, render the output
88 88
 echo $output;
89 89
 
90
-function bigbluebuttonbn_selected_course($options, $tc='') {
91
-    if( empty($options) ) {
90
+function bigbluebuttonbn_selected_course($options, $tc = '') {
91
+    if (empty($options)) {
92 92
         $selected = '';
93
-    } else if(array_key_exists($tc, $options)) {
93
+    } else if (array_key_exists($tc, $options)) {
94 94
         $selected = $tc;
95 95
     } else {
96 96
         $selected = '';
Please login to merge, or discard this patch.
backup/moodle2/backup_bigbluebuttonbn_activity_task.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@
 block discarded – undo
54 54
     static public function encode_content_links($content) {
55 55
         global $CFG;
56 56
 
57
-        $base = preg_quote($CFG->wwwroot.'/mod/bigbluebuttonbn','#');
57
+        $base = preg_quote($CFG->wwwroot . '/mod/bigbluebuttonbn', '#');
58 58
 
59 59
         //Link to the list of bigbluebuttonbns
60
-        $pattern = "#(".$base."\/index.php\?id\=)([0-9]+)#";
60
+        $pattern = "#(" . $base . "\/index.php\?id\=)([0-9]+)#";
61 61
         $content = preg_replace($pattern, '$@BIGBLUEBUTTONBNINDEX*$2@$', $content);
62 62
 
63 63
         //Link to bigbluebuttonbn view by moduleid
64
-        $pattern = "#(".$base."\/view.php\?id\=)([0-9]+)#";
64
+        $pattern = "#(" . $base . "\/view.php\?id\=)([0-9]+)#";
65 65
         $content = preg_replace($pattern, '$@BIGBLUEBUTTONBNVIEWBYID*$2@$', $content);
66 66
 
67 67
         return $content;
Please login to merge, or discard this patch.
bbb_view.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
9 9
  */
10 10
 
11
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
12
-require_once(dirname(__FILE__).'/locallib.php');
11
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
12
+require_once(dirname(__FILE__) . '/locallib.php');
13 13
 
14
-$id = optional_param('id', 0, PARAM_INT);  // course_module ID, or
15
-$bn = optional_param('bn', 0, PARAM_INT);  // bigbluebuttonbn instance ID
14
+$id = optional_param('id', 0, PARAM_INT); // course_module ID, or
15
+$bn = optional_param('bn', 0, PARAM_INT); // bigbluebuttonbn instance ID
16 16
 $action = required_param('action', PARAM_TEXT);
17 17
 $name = optional_param('name', '', PARAM_TEXT);
18 18
 $description = optional_param('description', '', PARAM_TEXT);
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 require_login($course, true, $cm);
45 45
 
46
-if ( isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
46
+if (isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
47 47
     $bbbsession = $SESSION->bigbluebuttonbn_bbbsession;
48 48
 }
49 49
 switch (strtolower($action)) {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         if (isset($errors) && $errors != '') {
52 52
           bigbluebutton_bbb_view_errors($errors, $id);
53 53
 
54
-        } else if ( isset($bbbsession) && !is_null($bbbsession) ) {
54
+        } else if (isset($bbbsession) && !is_null($bbbsession)) {
55 55
             /// Moodle event logger: Create an event for meeting left
56 56
             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $context, $cm);
57 57
 
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
         }
67 67
         break;
68 68
     case 'join':
69
-        if ( isset($bbbsession) && !is_null($bbbsession) ) {
69
+        if (isset($bbbsession) && !is_null($bbbsession)) {
70 70
             //See if the session is in progress
71
-            if( bigbluebuttonbn_isMeetingRunning( $bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'] ) ) {
71
+            if (bigbluebuttonbn_isMeetingRunning($bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'])) {
72 72
                 /// Since the meeting is already running, we just join the session
73 73
                 bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn);
74 74
 
75 75
             } else {
76 76
                 // If user is administrator, moderator or if is viewer and no waiting is required
77
-                if( $bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait'] ) {
77
+                if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) {
78 78
                     /// Prepare the metadata
79 79
                     $metadata = array("meta_bn-origin" => $bbbsession['origin'],
80 80
                             "meta_bbb-origin-version" => $bbbsession['originVersion'],
@@ -82,20 +82,20 @@  discard block
 block discarded – undo
82 82
                             "meta_bbb-origin-server-common-name" => $bbbsession['originServerCommonName'],
83 83
                             "meta_bbb-origin-tag" => $bbbsession['originTag'],
84 84
                             "meta_bbb-context" => $bbbsession['course']->fullname,
85
-                            "meta_bbb-recording-name" => (isset($name) && $name != '')? $name: $bbbsession['contextActivityName'],
86
-                            "meta_bbb-recording-description" => (isset($description) && $description != '')? $description: $bbbsession['contextActivityDescription'],
87
-                            "meta_bbb-recording-tags" => (isset($tags) && $tags != '')? $tags: $bbbsession['contextActivityTags'],
85
+                            "meta_bbb-recording-name" => (isset($name) && $name != '') ? $name : $bbbsession['contextActivityName'],
86
+                            "meta_bbb-recording-description" => (isset($description) && $description != '') ? $description : $bbbsession['contextActivityDescription'],
87
+                            "meta_bbb-recording-tags" => (isset($tags) && $tags != '') ? $tags : $bbbsession['contextActivityTags'],
88 88
                     );
89 89
 
90
-                    if ( bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled() ) {
90
+                    if (bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled()) {
91 91
                         $metadata["meta_bn-recording-ready-url"] = $bbbsession['recordingReadyURL'];
92 92
                     }
93 93
 
94 94
                     /// Set the duration for the meeting
95
-                    if ( bigbluebuttonbn_get_cfg_scheduled_duration_enabled() ) {
95
+                    if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) {
96 96
                         $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime);
97
-                        if( $durationtime > 0 )
98
-                            $bbbsession['welcome'] .= '<br><br>'.str_replace("%duration%", ''.$durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn'));
97
+                        if ($durationtime > 0)
98
+                            $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn'));
99 99
                     } else {
100 100
                         $durationtime = 0;
101 101
                     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                             $bbbsession['shared_secret'],
110 110
                             $bbbsession['endpoint'],
111 111
                             $bbbsession['logoutURL'],
112
-                            $bbbsession['record']? 'true': 'false',
112
+                            $bbbsession['record'] ? 'true' : 'false',
113 113
                             $durationtime,
114 114
                             $bbbsession['voicebridge'],
115 115
                             $bbbsession['userlimit'],
@@ -120,25 +120,25 @@  discard block
 block discarded – undo
120 120
 
121 121
                     if (!$response) {
122 122
                         // If the server is unreachable, then prompts the user of the necessary action
123
-                        if ( $bbbsession['administrator'] ) {
124
-                            print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
125
-                        } else if ( $bbbsession['moderator'] ) {
126
-                            print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
123
+                        if ($bbbsession['administrator']) {
124
+                            print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
125
+                        } else if ($bbbsession['moderator']) {
126
+                            print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
127 127
                         } else {
128
-                            print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
128
+                            print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
129 129
                         }
130 130
 
131
-                    } else if( $response['returncode'] == "FAILED" ) {
131
+                    } else if ($response['returncode'] == "FAILED") {
132 132
                         // The meeting was not created
133
-                        $error_key = bigbluebuttonbn_get_error_key( $response['messageKey'], 'view_error_create' );
134
-                        if( !$error_key ) {
135
-                            print_error( $response['message'], 'bigbluebuttonbn' );
133
+                        $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');
134
+                        if (!$error_key) {
135
+                            print_error($response['message'], 'bigbluebuttonbn');
136 136
                         } else {
137
-                            print_error( $error_key, 'bigbluebuttonbn' );
137
+                            print_error($error_key, 'bigbluebuttonbn');
138 138
                         }
139 139
 
140
-                    } else if ($response['hasBeenForciblyEnded'] == "true"){
141
-                        print_error( get_string( 'index_error_forciblyended', 'bigbluebuttonbn' ));
140
+                    } else if ($response['hasBeenForciblyEnded'] == "true") {
141
+                        print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn'));
142 142
 
143 143
                     } else { ///////////////Everything is ok /////////////////////
144 144
                         /// Moodle event logger: Create an event for meeting created
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
                     }
151 151
 
152 152
                 } else {
153
-                    header('Location: '.$bbbsession['logoutURL'] );
153
+                    header('Location: ' . $bbbsession['logoutURL']);
154 154
                 }
155 155
             }
156 156
 
157 157
         } else {
158
-            print_error( 'view_error_unable_join', 'bigbluebuttonbn' );
158
+            print_error('view_error_unable_join', 'bigbluebuttonbn');
159 159
         }
160 160
         break;
161 161
     default:
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 function bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn) {
180 180
     //// Update the cache
181 181
     $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($bbbsession['meetingid'], $bbbsession['modPW'], true);
182
-    if( $bbbsession['userlimit'] == 0 || intval($meeting_info['participantCount']) < $bbbsession['userlimit']  ) {
182
+    if ($bbbsession['userlimit'] == 0 || intval($meeting_info['participantCount']) < $bbbsession['userlimit']) {
183 183
         //// Build the URL
184
-        if( $bbbsession['administrator'] || $bbbsession['moderator'] ) {
184
+        if ($bbbsession['administrator'] || $bbbsession['moderator']) {
185 185
             $password = $bbbsession['modPW'];
186 186
         } else {
187 187
             $password = $bbbsession['viewerPW'];
@@ -192,25 +192,25 @@  discard block
 block discarded – undo
192 192
         /// Internal logger: Instert a record with the meeting created
193 193
         bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_JOIN);
194 194
         //// Before executing the redirect, increment the number of participants
195
-        bigbluebuttonbn_bbb_broker_participant_joined($bbbsession['meetingid'], ($bbbsession['administrator'] || $bbbsession['moderator']) );
195
+        bigbluebuttonbn_bbb_broker_participant_joined($bbbsession['meetingid'], ($bbbsession['administrator'] || $bbbsession['moderator']));
196 196
         //// Execute the redirect
197
-        header('Location: '.$join_url );
197
+        header('Location: ' . $join_url);
198 198
 
199 199
     } else {
200
-        header('Location: '.$bbbsession['logoutURL'] );
200
+        header('Location: ' . $bbbsession['logoutURL']);
201 201
     }
202 202
 }
203 203
 
204 204
 function bigbluebutton_bbb_view_errors($sErrors, $id) {
205 205
     global $CFG, $OUTPUT, $PAGE;
206 206
 
207
-    $errors = (array) json_decode(urldecode($sErrors));
207
+    $errors = (array)json_decode(urldecode($sErrors));
208 208
     $msgErrors = "";
209 209
     foreach ($errors as $error) {
210 210
         $msgErrors .= html_writer::tag('p', $error->{"message"}, array('class' => 'alert alert-danger')) . "\n";
211 211
     }
212 212
 
213 213
     echo $OUTPUT->header();
214
-    print_error( 'view_error_bigbluebutton', 'bigbluebuttonbn', $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$id, $msgErrors, $sErrors );
214
+    print_error('view_error_bigbluebutton', 'bigbluebuttonbn', $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $id, $msgErrors, $sErrors);
215 215
     echo $OUTPUT->footer();
216 216
 }
Please login to merge, or discard this patch.
bbb_broker.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -8,15 +8,15 @@  discard block
 block discarded – undo
8 8
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
9 9
  */
10 10
 
11
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
12
-require_once(dirname(__FILE__).'/locallib.php');
11
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
12
+require_once(dirname(__FILE__) . '/locallib.php');
13 13
 
14 14
 global $PAGE, $USER, $CFG, $SESSION, $DB;
15 15
 
16
-$params['action']  = optional_param('action', '', PARAM_TEXT);
16
+$params['action'] = optional_param('action', '', PARAM_TEXT);
17 17
 $params['callback'] = optional_param('callback', '', PARAM_TEXT);
18
-$params['id'] = optional_param('id', '', PARAM_TEXT);    //recordID, the BBB recordID
19
-$params['idx'] = optional_param('idx', '', PARAM_TEXT);  //meetingID, the BBB meetingID
18
+$params['id'] = optional_param('id', '', PARAM_TEXT); //recordID, the BBB recordID
19
+$params['idx'] = optional_param('idx', '', PARAM_TEXT); //meetingID, the BBB meetingID
20 20
 $params['bigbluebuttonbn'] = optional_param('bigbluebuttonbn', 0, PARAM_INT);
21 21
 $params['signed_parameters'] = optional_param('signed_parameters', '', PARAM_TEXT);
22 22
 
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 
26 26
 $error = '';
27 27
 
28
-if( empty($params['action']) ) {
28
+if (empty($params['action'])) {
29 29
     $error = bigbluebuttonbn_bbb_broker_add_error($error, "Parameter [action] was not included");
30 30
 
31 31
 } else {
32 32
     $error = bigbluebuttonbn_bbb_broker_validate_parameters($params);
33 33
 
34
-    if( empty($error) && $params['action'] != "recording_ready" ) {
34
+    if (empty($error) && $params['action'] != "recording_ready") {
35 35
 
36 36
         if ($params['bigbluebuttonbn'] != 0) {
37 37
             $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $params['bigbluebuttonbn']), '*', MUST_EXIST);
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             $context = bigbluebuttonbn_get_context_module($cm->id);
41 41
         }
42 42
 
43
-        if ( isset($SESSION->bigbluebuttonbn_bbbsession) && !is_null($SESSION->bigbluebuttonbn_bbbsession) ) {
43
+        if (isset($SESSION->bigbluebuttonbn_bbbsession) && !is_null($SESSION->bigbluebuttonbn_bbbsession)) {
44 44
             $bbbsession = $SESSION->bigbluebuttonbn_bbbsession;
45 45
         } else {
46 46
             $error = bigbluebuttonbn_bbb_broker_add_error($error, "No session variable set");
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 }
50 50
 
51 51
 header('Content-Type: application/javascript; charset=utf-8');
52
-if ( empty($error) ) {
52
+if (empty($error)) {
53 53
 
54 54
     if (!isloggedin() && $PAGE->course->id == SITEID) {
55 55
         $userid = guest_user()->id;
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
     }
59 59
     $hascourseaccess = ($PAGE->course->id == SITEID) || can_access_course($PAGE->course, $userid);
60 60
 
61
-    if( !$hascourseaccess ){
61
+    if (!$hascourseaccess) {
62 62
         header("HTTP/1.0 401 Unauthorized");
63 63
         return;
64 64
     } else {
65 65
         try {
66
-            switch ( strtolower($params['action']) ){
66
+            switch (strtolower($params['action'])) {
67 67
                 case 'meeting_info':
68 68
                     $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($params['id'], $bbbsession['modPW']);
69 69
                     $meeting_running = bigbluebuttonbn_bbb_broker_is_meeting_running($meeting_info); 
70 70
 
71 71
                     $status_can_end = '';
72 72
                     $status_can_tag = '';
73
-                    if( $meeting_running ) {
73
+                    if ($meeting_running) {
74 74
                         $join_button_text = get_string('view_conference_action_join', 'bigbluebuttonbn');
75
-                        if( $bbbsession['userlimit'] == 0 || $meeting_info->participantCount < $bbbsession['userlimit'] ) {
75
+                        if ($bbbsession['userlimit'] == 0 || $meeting_info->participantCount < $bbbsession['userlimit']) {
76 76
                             $initial_message = get_string('view_message_conference_in_progress', 'bigbluebuttonbn');
77 77
                             $can_join = true;
78 78
 
@@ -81,50 +81,50 @@  discard block
 block discarded – undo
81 81
                             $can_join = false;
82 82
                         }
83 83
 
84
-                        if( $bbbsession['administrator'] || $bbbsession['moderator'] ) {
84
+                        if ($bbbsession['administrator'] || $bbbsession['moderator']) {
85 85
                             $end_button_text = get_string('view_conference_action_end', 'bigbluebuttonbn');
86 86
                             $can_end = true;
87
-                            $status_can_end = '"can_end": true, "end_button_text": "'.$end_button_text.'", ';
87
+                            $status_can_end = '"can_end": true, "end_button_text": "' . $end_button_text . '", ';
88 88
                         }
89 89
 
90 90
                     } else {
91 91
                         // If user is administrator, moderator or if is viewer and no waiting is required
92
-                        if ( $bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait'] ) {
92
+                        if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) {
93 93
                             $initial_message = get_string('view_message_conference_room_ready', 'bigbluebuttonbn');
94 94
                             $join_button_text = get_string('view_conference_action_join', 'bigbluebuttonbn');
95 95
                             $can_join = true;
96 96
 
97 97
                         } else {
98 98
                             $initial_message = get_string('view_message_conference_not_started', 'bigbluebuttonbn');
99
-                            if ( $bbbsession['wait'] ) {
100
-                                $initial_message .= ' '.get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn');
99
+                            if ($bbbsession['wait']) {
100
+                                $initial_message .= ' ' . get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn');
101 101
                             }
102 102
                             $join_button_text = get_string('view_conference_action_lineup', 'bigbluebuttonbn');
103 103
                             $can_join = false;
104 104
                         }
105 105
 
106
-                        if( $bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator']) ) {
106
+                        if ($bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator'])) {
107 107
                             $can_tag = true;
108 108
 
109 109
                         } else {
110 110
                             $can_tag = false;
111 111
                         }
112
-                        $status_can_end = '"can_tag": '.($can_tag? 'true': 'false').', ';
112
+                        $status_can_end = '"can_tag": ' . ($can_tag ? 'true' : 'false') . ', ';
113 113
                     }
114 114
 
115
-                    echo $params['callback'].'({ "running": '.($meeting_running? 'true':'false').', "info": '.json_encode($meeting_info).', "status": {"can_join": '.($can_join? 'true':'false').',"join_url": "'.$bbbsession['joinURL'].'","join_button_text": "'.$join_button_text.'", '.$status_can_end.$status_can_tag.'"message": "'.$initial_message.'"} });';
115
+                    echo $params['callback'] . '({ "running": ' . ($meeting_running ? 'true' : 'false') . ', "info": ' . json_encode($meeting_info) . ', "status": {"can_join": ' . ($can_join ? 'true' : 'false') . ',"join_url": "' . $bbbsession['joinURL'] . '","join_button_text": "' . $join_button_text . '", ' . $status_can_end . $status_can_tag . '"message": "' . $initial_message . '"} });';
116 116
                     break;
117 117
                 case 'meeting_end':
118
-                    if( $bbbsession['administrator'] || $bbbsession['moderator'] ) {
118
+                    if ($bbbsession['administrator'] || $bbbsession['moderator']) {
119 119
                         //Execute the end command
120 120
                         $meeting_info = bigbluebuttonbn_bbb_broker_do_end_meeting($params['id'], $bbbsession['modPW']);
121 121
                         // Moodle event logger: Create an event for meeting ended
122
-                        if( isset($bigbluebuttonbn) )
122
+                        if (isset($bigbluebuttonbn))
123 123
                             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm);
124 124
                         // Update the cache
125 125
                         $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($params['id'], $bbbsession['modPW'], true);
126 126
 
127
-                        echo $params['callback'].'({ "status": true });';
127
+                        echo $params['callback'] . '({ "status": true });';
128 128
                     } else {
129 129
                         error_log("ERROR: User not authorized to execute end command");
130 130
                         header("HTTP/1.0 401 Unauthorized. User not authorized to execute end command");
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
                 case 'recording_list':
134 134
                     break;
135 135
                 case 'recording_info':
136
-                    if( $bbbsession['managerecordings'] ) {
136
+                    if ($bbbsession['managerecordings']) {
137 137
                         //Retrieve the array of imported recordings
138
-                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn'])?$bbbsession['bigbluebuttonbn']->id: NULL);
138
+                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL);
139 139
                         $recordings_indexed = bigbluebuttonbn_index_recordings($recordings_imported);
140
-                        if( isset($recordings_indexed[$params['id']]) ) {
140
+                        if (isset($recordings_indexed[$params['id']])) {
141 141
                             //Look up for an update on the imported recording
142 142
                             $recording = $recordings_indexed[$params['id']];
143
-                            if ( isset($recording) && !empty($recording) && !array_key_exists('messageKey', $recording)) {  // The recording was found
144
-                                echo $params['callback'].'({ "status": "true", "published": "'.$recording['published'].'"});';
143
+                            if (isset($recording) && !empty($recording) && !array_key_exists('messageKey', $recording)) {  // The recording was found
144
+                                echo $params['callback'] . '({ "status": "true", "published": "' . $recording['published'] . '"});';
145 145
                             } else {
146
-                                echo $params['callback'].'({ "status": "false" });';
146
+                                echo $params['callback'] . '({ "status": "false" });';
147 147
                             }
148 148
 
149 149
                         // As the recordingid was not identified as imported recording link, look up for a real recording
150 150
                         } else {
151 151
                             $recording = bigbluebuttonbn_getRecordingArray($params['id'], $params['idx'], $endpoint, $shared_secret);
152
-                            if ( isset($recording) && !empty($recording) && !array_key_exists('messageKey', $recording)) {  // The recording was found
153
-                                echo $params['callback'].'({ "status": "true", "published": "'.$recording['published'].'"});';
152
+                            if (isset($recording) && !empty($recording) && !array_key_exists('messageKey', $recording)) {  // The recording was found
153
+                                echo $params['callback'] . '({ "status": "true", "published": "' . $recording['published'] . '"});';
154 154
                             } else {
155
-                                echo $params['callback'].'({ "status": "false" });';
155
+                                echo $params['callback'] . '({ "status": "false" });';
156 156
                             }
157 157
                         }
158 158
 
@@ -162,16 +162,16 @@  discard block
 block discarded – undo
162 162
                     }
163 163
                     break;
164 164
                 case 'recording_publish':
165
-                    if( $bbbsession['managerecordings'] ) {
165
+                    if ($bbbsession['managerecordings']) {
166 166
                         $status = true;
167 167
                         //Retrieve the array of imported recordings for the current course and activity
168
-                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn'])?$bbbsession['bigbluebuttonbn']->id: NULL);
168
+                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL);
169 169
                         $recordings_imported_indexed = bigbluebuttonbn_index_recordings($recordings_imported);
170
-                        if( isset($recordings_imported_indexed[$params['id']]) ) {
170
+                        if (isset($recordings_imported_indexed[$params['id']])) {
171 171
                             $recordings = bigbluebuttonbn_getRecordingsArray($recordings_imported_indexed[$params['id']]['meetingID'], $bbbsession['endpoint'], $bbbsession['shared_secret']);
172 172
                             $recordings_indexed = bigbluebuttonbn_index_recordings($recordings);
173 173
                             $recording = $recordings_indexed[$params['id']];
174
-                            if ( $recording['published'] === 'true' ) {
174
+                            if ($recording['published'] === 'true') {
175 175
                                 // Only if the physical recording is published, execute publish on imported recording link
176 176
                                 $meeting_info = bigbluebuttonbn_bbb_broker_do_publish_recording_imported($params['id'], $bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id, true);
177 177
                             } else {
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
                             $meeting_info = bigbluebuttonbn_bbb_broker_do_publish_recording($params['id'], true);
184 184
                         }
185 185
 
186
-                        if ( $status ) {
186
+                        if ($status) {
187 187
                             $callback_response['status'] = "true";
188 188
 
189 189
                             // Moodle event logger: Create an event for recording published
190
-                            if( isset($bigbluebuttonbn) ) {
190
+                            if (isset($bigbluebuttonbn)) {
191 191
                                 bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED, $bigbluebuttonbn, $context, $cm);
192 192
                             }
193 193
 
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
                     }
206 206
                     break;
207 207
                 case 'recording_unpublish':
208
-                    if( $bbbsession['managerecordings'] ) {
208
+                    if ($bbbsession['managerecordings']) {
209 209
                         //Retrieve the array of imported recordings for the current course and activity
210
-                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn'])?$bbbsession['bigbluebuttonbn']->id: NULL);
210
+                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL);
211 211
                         $recordings_indexed = bigbluebuttonbn_index_recordings($recordings_imported);
212
-                        if( isset($recordings_indexed[$params['id']]) ) {
212
+                        if (isset($recordings_indexed[$params['id']])) {
213 213
                             // Execute unpublish on imported recording link
214 214
                             $meeting_info = bigbluebuttonbn_bbb_broker_do_publish_recording_imported($params['id'], $bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id, false);
215 215
                         } else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                             // First: Unpublish imported links associated to the recording 
218 218
                             $recordings_imported_all = bigbluebuttonbn_getRecordingsImportedAllInstances($params['id']);
219 219
 
220
-                            if( count($recordings_imported_all) > 0 ) {
220
+                            if (count($recordings_imported_all) > 0) {
221 221
                                 foreach ($recordings_imported_all as $key => $record) {
222 222
                                     $meta = json_decode($record->meta, true);
223 223
                                     // Prepare data for the update
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
                         }
234 234
 
235 235
                         // Moodle event logger: Create an event for recording unpublished
236
-                        if( isset($bigbluebuttonbn) ) {
236
+                        if (isset($bigbluebuttonbn)) {
237 237
                             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED, $bigbluebuttonbn, $context, $cm);
238 238
                         }
239 239
 
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
                     }
248 248
                     break;
249 249
                 case 'recording_delete':
250
-                    if( $bbbsession['managerecordings'] ) {
250
+                    if ($bbbsession['managerecordings']) {
251 251
                         //Retrieve the array of imported recordings
252
-                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn'])?$bbbsession['bigbluebuttonbn']->id: NULL);
252
+                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL);
253 253
                         $recordings_indexed = bigbluebuttonbn_index_recordings($recordings_imported);
254
-                        if( isset($recordings_indexed[$params['id']]) ) {
254
+                        if (isset($recordings_indexed[$params['id']])) {
255 255
                             // Execute unpublish on imported recording link
256 256
                             bigbluebuttonbn_bbb_broker_do_delete_recording_imported($params['id'], $bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id);
257 257
                         } else {
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                             // First: Delete imported links associated to the recording 
260 260
                             $recordings_imported_all = bigbluebuttonbn_getRecordingsImportedAllInstances($params['id']);
261 261
 
262
-                            if( count($recordings_imported_all) > 0 ) {
262
+                            if (count($recordings_imported_all) > 0) {
263 263
                                 foreach ($recordings_imported_all as $key => $record) {
264 264
                                     // Execute delete
265 265
                                     $DB->delete_records("bigbluebuttonbn_logs", array('id' => $key));
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                         }
271 271
 
272 272
                         // Moodle event logger: Create an event for recording deleted
273
-                        if( isset($bigbluebuttonbn) ) {
273
+                        if (isset($bigbluebuttonbn)) {
274 274
                             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_DELETED, $bigbluebuttonbn, $context, $cm);
275 275
                         }
276 276
 
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
                         $decoded_parameters = JWT::decode($params['signed_parameters'], $shared_secret, array('HS256'));
290 290
 
291 291
                     } catch (Exception $e) {
292
-                        $error = 'Caught exception: '.$e->getMessage();
292
+                        $error = 'Caught exception: ' . $e->getMessage();
293 293
                         error_log($error);
294
-                        header("HTTP/1.0 400 Bad Request. ".$error);
294
+                        header("HTTP/1.0 400 Bad Request. " . $error);
295 295
                         return;
296 296
                     }
297 297
 
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
                         $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $meeting_id_elements[2]), '*', MUST_EXIST);
303 303
 
304 304
                     } catch (Exception $e) {
305
-                        $error = 'Caught exception: '.$e->getMessage();
305
+                        $error = 'Caught exception: ' . $e->getMessage();
306 306
                         error_log($error);
307
-                        header("HTTP/1.0 410 Gone. ".$error);
307
+                        header("HTTP/1.0 410 Gone. " . $error);
308 308
                         return;
309 309
                     }
310 310
 
@@ -314,22 +314,22 @@  discard block
 block discarded – undo
314 314
                         header("HTTP/1.0 202 Accepted");
315 315
                         return;
316 316
                     } catch (Exception $e) {
317
-                        $error = 'Caught exception: '.$e->getMessage();
317
+                        $error = 'Caught exception: ' . $e->getMessage();
318 318
                         error_log($error);
319
-                        header("HTTP/1.0 503 Service Unavailable. ".$error);
319
+                        header("HTTP/1.0 503 Service Unavailable. " . $error);
320 320
                         return;
321 321
                     }
322 322
                     break;
323 323
                 case 'recording_import':
324
-                    if( $bbbsession['managerecordings'] ) {
324
+                    if ($bbbsession['managerecordings']) {
325 325
                         $importrecordings = $SESSION->bigbluebuttonbn_importrecordings;
326
-                        if( isset($importrecordings[$params['id']]) ) {
326
+                        if (isset($importrecordings[$params['id']])) {
327 327
                             $importrecordings[$params['id']]['imported'] = true;
328 328
                             $overrides['meetingid'] = $importrecordings[$params['id']]['meetingID'];
329
-                            $meta = '{"recording":'.json_encode($importrecordings[$params['id']]).'}';
329
+                            $meta = '{"recording":' . json_encode($importrecordings[$params['id']]) . '}';
330 330
                             bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, $overrides, $meta);
331 331
                             // Moodle event logger: Create an event for recording imported
332
-                            if( isset($bigbluebuttonbn) ) {
332
+                            if (isset($bigbluebuttonbn)) {
333 333
                                 bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED, $bigbluebuttonbn, $context, $cm);
334 334
                             }
335 335
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                         } else {
341 341
                             $error = "Recording {$params['id']} could not be found. It can not be imported";
342 342
                             error_log($error);
343
-                            header("HTTP/1.0 404 Not found. ".$error);
343
+                            header("HTTP/1.0 404 Not found. " . $error);
344 344
                             return;
345 345
                         }
346 346
                     }
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
                     break;
352 352
             }
353 353
 
354
-        } catch(Exception $e) {
355
-            error_log("BBB_BROKER ERROR: ".$e->getCode().", ".$e->getMessage());
356
-            header("HTTP/1.0 502 Bad Gateway. ".$e->getMessage());
354
+        } catch (Exception $e) {
355
+            error_log("BBB_BROKER ERROR: " . $e->getCode() . ", " . $e->getMessage());
356
+            header("HTTP/1.0 502 Bad Gateway. " . $e->getMessage());
357 357
             return;
358 358
         }
359 359
     }
360 360
 
361 361
 } else {
362
-    header("HTTP/1.0 400 Bad Request. ".$error);
362
+    header("HTTP/1.0 400 Bad Request. " . $error);
363 363
     return;
364 364
 }
365 365
\ No newline at end of file
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_meeting_ended.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
      * @return string
39 39
      */
40 40
     public function get_description() {
41
-        $a = (object) array('userid' => $this->userid, 'bigbluebuttonbnid' => $this->objectid, 'courseid' => $this->contextinstanceid);
41
+        $a = (object)array('userid' => $this->userid, 'bigbluebuttonbnid' => $this->objectid, 'courseid' => $this->contextinstanceid);
42 42
         return get_string('event_meeting_ended_description', 'bigbluebuttonbn', $a);
43 43
     }
44 44
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_published.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
      * @return string
39 39
      */
40 40
     public function get_description() {
41
-        $rid = isset($this->other['rid'])? $this->other['rid']: '';
42
-        $a = (object) array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
41
+        $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
42
+        $a = (object)array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
43 43
         return get_string('event_recording_published_description', 'bigbluebuttonbn', $a);
44 44
     }
45 45
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_deleted.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
      * @return string
39 39
      */
40 40
     public function get_description() {
41
-        $rid = isset($this->other['rid'])? $this->other['rid']: '';
42
-        $a = (object) array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
41
+        $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
42
+        $a = (object)array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
43 43
         return get_string('event_recording_published_description', 'bigbluebuttonbn', $a);
44 44
     }
45 45
 
Please login to merge, or discard this patch.