@@ -174,7 +174,7 @@ |
||
174 | 174 | * Sign a string with a given key and algorithm. |
175 | 175 | * |
176 | 176 | * @param string $msg The message to sign |
177 | - * @param string|resource $key The secret key |
|
177 | + * @param string $key The secret key |
|
178 | 178 | * @param string $alg The signing algorithm. |
179 | 179 | * Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256' |
180 | 180 | * |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | if ($keyId !== null) { |
157 | 157 | $header['kid'] = $keyId; |
158 | 158 | } |
159 | - if ( isset($head) && is_array($head) ) { |
|
159 | + if (isset($head) && is_array($head)) { |
|
160 | 160 | $header = array_merge($head, $header); |
161 | 161 | } |
162 | 162 | $segments = array(); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | throw new DomainException('Algorithm not supported'); |
189 | 189 | } |
190 | 190 | list($function, $algorithm) = static::$supported_algs[$alg]; |
191 | - switch($function) { |
|
191 | + switch ($function) { |
|
192 | 192 | case 'hash_hmac': |
193 | 193 | return hash_hmac($algorithm, $msg, $key, true); |
194 | 194 | case 'openssl': |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | list($function, $algorithm) = static::$supported_algs[$alg]; |
225 | - switch($function) { |
|
225 | + switch ($function) { |
|
226 | 226 | case 'openssl': |
227 | 227 | $success = openssl_verify($msg, $signature, $key, $algorithm); |
228 | 228 | if (!$success) { |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | * manually detect large ints in the JSON string and quote them (thus converting |
271 | 271 | *them to strings) before decoding, hence the preg_replace() call. |
272 | 272 | */ |
273 | - $max_int_length = strlen((string) PHP_INT_MAX) - 1; |
|
274 | - $json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input); |
|
273 | + $max_int_length = strlen((string)PHP_INT_MAX) - 1; |
|
274 | + $json_without_bigints = preg_replace('/:\s*(-?\d{' . $max_int_length . ',})/', ': "$1"', $input); |
|
275 | 275 | $obj = json_decode($json_without_bigints); |
276 | 276 | } |
277 | 277 |
@@ -28,29 +28,29 @@ discard block |
||
28 | 28 | |
29 | 29 | global $CFG; |
30 | 30 | |
31 | -require_once($CFG->dirroot.'/calendar/lib.php'); |
|
32 | -require_once($CFG->dirroot.'/message/lib.php'); |
|
33 | -require_once($CFG->dirroot.'/mod/lti/OAuth.php'); |
|
34 | -require_once($CFG->dirroot.'/tag/lib.php'); |
|
35 | -require_once($CFG->libdir.'/accesslib.php'); |
|
36 | -require_once($CFG->libdir.'/completionlib.php'); |
|
37 | -require_once($CFG->libdir.'/datalib.php'); |
|
38 | -require_once($CFG->libdir.'/enrollib.php'); |
|
39 | -require_once($CFG->libdir.'/filelib.php'); |
|
40 | -require_once($CFG->libdir.'/formslib.php'); |
|
31 | +require_once($CFG->dirroot . '/calendar/lib.php'); |
|
32 | +require_once($CFG->dirroot . '/message/lib.php'); |
|
33 | +require_once($CFG->dirroot . '/mod/lti/OAuth.php'); |
|
34 | +require_once($CFG->dirroot . '/tag/lib.php'); |
|
35 | +require_once($CFG->libdir . '/accesslib.php'); |
|
36 | +require_once($CFG->libdir . '/completionlib.php'); |
|
37 | +require_once($CFG->libdir . '/datalib.php'); |
|
38 | +require_once($CFG->libdir . '/enrollib.php'); |
|
39 | +require_once($CFG->libdir . '/filelib.php'); |
|
40 | +require_once($CFG->libdir . '/formslib.php'); |
|
41 | 41 | |
42 | 42 | |
43 | 43 | if (!class_exists('\Firebase\JWT\JWT') && |
44 | - file_exists(dirname(__FILE__).'/lib/firebase/php-jwt/src/JWT.php')) { |
|
45 | - require_once(dirname(__FILE__).'/lib/firebase/php-jwt/src/JWT.php'); |
|
44 | + file_exists(dirname(__FILE__) . '/lib/firebase/php-jwt/src/JWT.php')) { |
|
45 | + require_once(dirname(__FILE__) . '/lib/firebase/php-jwt/src/JWT.php'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | if (!isset($CFG->bigbluebuttonbn)) { |
49 | 49 | $CFG->bigbluebuttonbn = array(); |
50 | 50 | } |
51 | 51 | |
52 | -if (file_exists(dirname(__FILE__).'/config.php')) { |
|
53 | - require_once(dirname(__FILE__).'/config.php'); |
|
52 | +if (file_exists(dirname(__FILE__) . '/config.php')) { |
|
53 | + require_once(dirname(__FILE__) . '/config.php'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /* |
@@ -103,18 +103,18 @@ discard block |
||
103 | 103 | return null; |
104 | 104 | } |
105 | 105 | $features = array( |
106 | - (string) FEATURE_IDNUMBER => true, |
|
107 | - (string) FEATURE_GROUPS => true, |
|
108 | - (string) FEATURE_GROUPINGS => true, |
|
109 | - (string) FEATURE_GROUPMEMBERSONLY => true, |
|
110 | - (string) FEATURE_MOD_INTRO => true, |
|
111 | - (string) FEATURE_BACKUP_MOODLE2 => true, |
|
112 | - (string) FEATURE_COMPLETION_TRACKS_VIEWS => true, |
|
113 | - (string) FEATURE_GRADE_HAS_GRADE => false, |
|
114 | - (string) FEATURE_GRADE_OUTCOMES => false, |
|
115 | - (string) FEATURE_SHOW_DESCRIPTION => true, |
|
106 | + (string)FEATURE_IDNUMBER => true, |
|
107 | + (string)FEATURE_GROUPS => true, |
|
108 | + (string)FEATURE_GROUPINGS => true, |
|
109 | + (string)FEATURE_GROUPMEMBERSONLY => true, |
|
110 | + (string)FEATURE_MOD_INTRO => true, |
|
111 | + (string)FEATURE_BACKUP_MOODLE2 => true, |
|
112 | + (string)FEATURE_COMPLETION_TRACKS_VIEWS => true, |
|
113 | + (string)FEATURE_GRADE_HAS_GRADE => false, |
|
114 | + (string)FEATURE_GRADE_OUTCOMES => false, |
|
115 | + (string)FEATURE_SHOW_DESCRIPTION => true, |
|
116 | 116 | ); |
117 | - if (isset($features[(string) $feature])) { |
|
117 | + if (isset($features[(string)$feature])) { |
|
118 | 118 | return $features[$feature]; |
119 | 119 | } |
120 | 120 | return null; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | function bigbluebuttonbn_delete_instance_log($bigbluebuttonbn) { |
214 | 214 | global $DB; |
215 | 215 | $sql = "SELECT * FROM {bigbluebuttonbn_logs} "; |
216 | - $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND ". $DB->sql_compare_text('meta') . " = ?"; |
|
216 | + $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND " . $DB->sql_compare_text('meta') . " = ?"; |
|
217 | 217 | $logs = $DB->get_records_sql($sql, array($bigbluebuttonbn->id, BIGBLUEBUTTONBN_LOG_EVENT_CREATE, "{\"record\":true}")); |
218 | 218 | $meta = "{\"has_recordings\":" . empty($logs) ? "true" : "false" . "}"; |
219 | 219 | bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_DELETE, [], $meta); |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) { |
237 | 237 | global $DB; |
238 | 238 | $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id, |
239 | - 'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ), '*'); |
|
239 | + 'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',), '*'); |
|
240 | 240 | if ($completed > 0) { |
241 | - return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '. |
|
242 | - get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '. |
|
241 | + return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' . |
|
242 | + get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' . |
|
243 | 243 | get_string('view_message_times', 'bigbluebuttonbn'); |
244 | 244 | } |
245 | 245 | return ''; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | function bigbluebuttonbn_user_complete($course, $user, $mod, $bigbluebuttonbn) { |
260 | 260 | global $DB; |
261 | 261 | $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id, |
262 | - 'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ), |
|
262 | + 'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',), |
|
263 | 263 | '*', IGNORE_MULTIPLE); |
264 | 264 | return $completed > 0; |
265 | 265 | } |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | if ($bigbluebuttonbn->visible) { |
346 | 346 | $classes = 'class="dimmed" '; |
347 | 347 | } |
348 | - $str = '<div class="bigbluebuttonbn overview">'."\n"; |
|
349 | - $str .= ' <div class="name">'.get_string('modulename', 'bigbluebuttonbn').': '."\n"; |
|
350 | - $str .= ' <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule. |
|
351 | - '">'.$bigbluebuttonbn->name.'</a>'."\n"; |
|
352 | - $str .= ' </div>'."\n"; |
|
353 | - $str .= ' <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime). |
|
354 | - '</div>'."\n"; |
|
355 | - $str .= ' <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime) |
|
356 | - .'</div>'."\n"; |
|
357 | - $str .= '</div>'."\n"; |
|
348 | + $str = '<div class="bigbluebuttonbn overview">' . "\n"; |
|
349 | + $str .= ' <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ': ' . "\n"; |
|
350 | + $str .= ' <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule . |
|
351 | + '">' . $bigbluebuttonbn->name . '</a>' . "\n"; |
|
352 | + $str .= ' </div>' . "\n"; |
|
353 | + $str .= ' <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) . |
|
354 | + '</div>' . "\n"; |
|
355 | + $str .= ' <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime) |
|
356 | + .'</div>' . "\n"; |
|
357 | + $str .= '</div>' . "\n"; |
|
358 | 358 | return $str; |
359 | 359 | } |
360 | 360 | |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | if (count($files) == 1) { |
587 | 587 | // Get the first (and only) file. |
588 | 588 | $file = reset($files); |
589 | - $filesrc = '/'.$file->get_filename(); |
|
589 | + $filesrc = '/' . $file->get_filename(); |
|
590 | 590 | } |
591 | 591 | return $filesrc; |
592 | 592 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | if (!$filename) { |
656 | 656 | return false; |
657 | 657 | } |
658 | - $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename; |
|
658 | + $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename; |
|
659 | 659 | $fs = get_file_storage(); |
660 | 660 | $file = $fs->get_file_by_hash(sha1($fullpath)); |
661 | 661 | if (!$file || $file->is_directory()) { |