Completed
Pull Request — v2.2-stable (#135)
by Jesus
01:52
created
lib.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
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
 // JWT is included in Moodle 3.7 core, but a local package is still needed for backward compatibility.
43 43
 if (!class_exists('\Firebase\JWT\JWT')) {
44 44
     if (file_exists($CFG->libdir . '/php-jwt/src/JWT.php')) {
45 45
         require_once($CFG->libdir . '/php-jwt/src/JWT.php');
46 46
     } else {
47
-        require_once($CFG->dirroot.'/mod/bigbluebuttonbn/vendor/firebase/php-jwt/src/JWT.php');
47
+        require_once($CFG->dirroot . '/mod/bigbluebuttonbn/vendor/firebase/php-jwt/src/JWT.php');
48 48
     }
49 49
 }
50 50
 
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
     $CFG->bigbluebuttonbn = array();
53 53
 }
54 54
 
55
-if (file_exists(dirname(__FILE__).'/config.php')) {
56
-    require_once(dirname(__FILE__).'/config.php');
55
+if (file_exists(dirname(__FILE__) . '/config.php')) {
56
+    require_once(dirname(__FILE__) . '/config.php');
57 57
     // Old BigBlueButtonBN cfg schema. For backward compatibility.
58 58
     global $BIGBLUEBUTTONBN_CFG;
59 59
     if (isset($BIGBLUEBUTTONBN_CFG)) {
60
-        foreach ((array) $BIGBLUEBUTTONBN_CFG as $key => $value) {
60
+        foreach ((array)$BIGBLUEBUTTONBN_CFG as $key => $value) {
61 61
             $cfgkey = str_replace("bigbluebuttonbn_", "", $key);
62 62
             $CFG->bigbluebuttonbn[$cfgkey] = $value;
63 63
         }
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
         return null;
114 114
     }
115 115
     $features = array(
116
-        (string) FEATURE_IDNUMBER => true,
117
-        (string) FEATURE_GROUPS => true,
118
-        (string) FEATURE_GROUPINGS => true,
119
-        (string) FEATURE_GROUPMEMBERSONLY => true,
120
-        (string) FEATURE_MOD_INTRO => true,
121
-        (string) FEATURE_BACKUP_MOODLE2 => true,
122
-        (string) FEATURE_COMPLETION_TRACKS_VIEWS => true,
123
-        (string) FEATURE_GRADE_HAS_GRADE => false,
124
-        (string) FEATURE_GRADE_OUTCOMES => false,
125
-        (string) FEATURE_SHOW_DESCRIPTION => true,
116
+        (string)FEATURE_IDNUMBER => true,
117
+        (string)FEATURE_GROUPS => true,
118
+        (string)FEATURE_GROUPINGS => true,
119
+        (string)FEATURE_GROUPMEMBERSONLY => true,
120
+        (string)FEATURE_MOD_INTRO => true,
121
+        (string)FEATURE_BACKUP_MOODLE2 => true,
122
+        (string)FEATURE_COMPLETION_TRACKS_VIEWS => true,
123
+        (string)FEATURE_GRADE_HAS_GRADE => false,
124
+        (string)FEATURE_GRADE_OUTCOMES => false,
125
+        (string)FEATURE_SHOW_DESCRIPTION => true,
126 126
     );
127
-    if (isset($features[(string) $feature])) {
127
+    if (isset($features[(string)$feature])) {
128 128
         return $features[$feature];
129 129
     }
130 130
     return null;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 function bigbluebuttonbn_delete_instance_log($bigbluebuttonbn) {
225 225
     global $DB;
226 226
     $sql  = "SELECT * FROM {bigbluebuttonbn_logs} ";
227
-    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND ". $DB->sql_compare_text('meta') . " = ?";
227
+    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND " . $DB->sql_compare_text('meta') . " = ?";
228 228
     $logs = $DB->get_records_sql($sql, array($bigbluebuttonbn->id, BIGBLUEBUTTONBN_LOG_EVENT_CREATE, "{\"record\":true}"));
229 229
     $meta = "{\"has_recordings\":" . empty($logs) ? "true" : "false" . "}";
230 230
     bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_DELETE, [], $meta);
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) {
248 248
     global $DB;
249 249
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
250
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ), '*');
250
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',), '*');
251 251
     if ($completed > 0) {
252
-        return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '.
253
-            get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '.
252
+        return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' .
253
+            get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' .
254 254
             get_string('view_message_times', 'bigbluebuttonbn');
255 255
     }
256 256
     return '';
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 function bigbluebuttonbn_user_complete($course, $user, $mod, $bigbluebuttonbn) {
271 271
     global $DB;
272 272
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
273
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ),
273
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',),
274 274
         '*', IGNORE_MULTIPLE);
275 275
     return $completed > 0;
276 276
 }
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
  * @return array status array
430 430
  */
431 431
 function bigbluebuttonbn_reset_recordings($courseid) {
432
-    require_once(__DIR__.'/locallib.php');
432
+    require_once(__DIR__ . '/locallib.php');
433 433
     // Criteria for search [courseid | bigbluebuttonbn=null | subset=false | includedeleted=true].
434 434
     $recordings = bigbluebuttonbn_get_recordings($courseid, null, false, true);
435 435
     // Remove all the recordings.
@@ -497,16 +497,16 @@  discard block
 block discarded – undo
497 497
     if ($bigbluebuttonbn->visible) {
498 498
         $classes = 'class="dimmed" ';
499 499
     }
500
-    $str  = '<div class="bigbluebuttonbn overview">'."\n";
501
-    $str .= '  <div class="name">'.get_string('modulename', 'bigbluebuttonbn').':&nbsp;'."\n";
502
-    $str .= '    <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.
503
-      '">'.$bigbluebuttonbn->name.'</a>'."\n";
504
-    $str .= '  </div>'."\n";
505
-    $str .= '  <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).
506
-        '</div>'."\n";
507
-    $str .= '  <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime)
508
-      .'</div>'."\n";
509
-    $str .= '</div>'."\n";
500
+    $str  = '<div class="bigbluebuttonbn overview">' . "\n";
501
+    $str .= '  <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ':&nbsp;' . "\n";
502
+    $str .= '    <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule .
503
+      '">' . $bigbluebuttonbn->name . '</a>' . "\n";
504
+    $str .= '  </div>' . "\n";
505
+    $str .= '  <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) .
506
+        '</div>' . "\n";
507
+    $str .= '  <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime)
508
+      .'</div>' . "\n";
509
+    $str .= '</div>' . "\n";
510 510
     return $str;
511 511
 }
512 512
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
     if (count($files) == 1) {
714 714
         // Get the first (and only) file.
715 715
         $file = reset($files);
716
-        $filesrc = '/'.$file->get_filename();
716
+        $filesrc = '/' . $file->get_filename();
717 717
     }
718 718
     return $filesrc;
719 719
 }
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
     if (!$filename) {
782 782
         return false;
783 783
     }
784
-    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
784
+    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
785 785
     $fs = get_file_storage();
786 786
     $file = $fs->get_file_by_hash(sha1($fullpath));
787 787
     if (!$file || $file->is_directory()) {
Please login to merge, or discard this patch.