Completed
Push — v2.2-stable ( 648db6...2d3598 )
by Jesus
03:31 queued 01:36
created
lib.php 1 patch
Spacing   +42 added lines, -42 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
 }
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
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').':&nbsp;'."\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') . ':&nbsp;' . "\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
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
     if (count($files) == 1) {
562 562
         // Get the first (and only) file.
563 563
         $file = reset($files);
564
-        $filesrc = '/'.$file->get_filename();
564
+        $filesrc = '/' . $file->get_filename();
565 565
     }
566 566
     return $filesrc;
567 567
 }
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
     if (!$filename) {
630 630
         return false;
631 631
     }
632
-    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
632
+    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
633 633
     $fs = get_file_storage();
634 634
     $file = $fs->get_file_by_hash(sha1($fullpath));
635 635
     if (!$file || $file->is_directory()) {
Please login to merge, or discard this patch.