Completed
Push — v2.2-stable ( 6725b1...4b91b7 )
by Jesus
13s queued 10s
created
lib.php 1 patch
Spacing   +44 added lines, -44 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;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 function bigbluebuttonbn_delete_instance_log($bigbluebuttonbn) {
232 232
     global $DB;
233 233
     $sql  = "SELECT * FROM {bigbluebuttonbn_logs} ";
234
-    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND ". $DB->sql_compare_text('meta') . " = ?";
234
+    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND " . $DB->sql_compare_text('meta') . " = ?";
235 235
     $logs = $DB->get_records_sql($sql, array($bigbluebuttonbn->id, BIGBLUEBUTTONBN_LOG_EVENT_CREATE, "{\"record\":true}"));
236 236
     $meta = "{\"has_recordings\":" . empty($logs) ? "true" : "false" . "}";
237 237
     bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_DELETE, [], $meta);
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
 function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) {
255 255
     global $DB;
256 256
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
257
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ), '*');
257
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',), '*');
258 258
     if ($completed > 0) {
259
-        return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '.
260
-            get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '.
259
+        return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' .
260
+            get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' .
261 261
             get_string('view_message_times', 'bigbluebuttonbn');
262 262
     }
263 263
     return '';
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 function bigbluebuttonbn_user_complete($course, $user, $mod, $bigbluebuttonbn) {
278 278
     global $DB;
279 279
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
280
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ),
280
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',),
281 281
         '*', IGNORE_MULTIPLE);
282 282
     return $completed > 0;
283 283
 }
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
  * @return array status array
437 437
  */
438 438
 function bigbluebuttonbn_reset_recordings($courseid) {
439
-    require_once(__DIR__.'/locallib.php');
439
+    require_once(__DIR__ . '/locallib.php');
440 440
     // Criteria for search [courseid | bigbluebuttonbn=null | subset=false | includedeleted=true].
441 441
     $recordings = bigbluebuttonbn_get_recordings($courseid, null, false, true);
442 442
     // Remove all the recordings.
@@ -504,16 +504,16 @@  discard block
 block discarded – undo
504 504
     if ($bigbluebuttonbn->visible) {
505 505
         $classes = 'class="dimmed" ';
506 506
     }
507
-    $str  = '<div class="bigbluebuttonbn overview">'."\n";
508
-    $str .= '  <div class="name">'.get_string('modulename', 'bigbluebuttonbn').':&nbsp;'."\n";
509
-    $str .= '    <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.
510
-      '">'.$bigbluebuttonbn->name.'</a>'."\n";
511
-    $str .= '  </div>'."\n";
512
-    $str .= '  <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).
513
-        '</div>'."\n";
514
-    $str .= '  <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime)
515
-      .'</div>'."\n";
516
-    $str .= '</div>'."\n";
507
+    $str  = '<div class="bigbluebuttonbn overview">' . "\n";
508
+    $str .= '  <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ':&nbsp;' . "\n";
509
+    $str .= '    <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule .
510
+      '">' . $bigbluebuttonbn->name . '</a>' . "\n";
511
+    $str .= '  </div>' . "\n";
512
+    $str .= '  <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) .
513
+        '</div>' . "\n";
514
+    $str .= '  <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime)
515
+      .'</div>' . "\n";
516
+    $str .= '</div>' . "\n";
517 517
     return $str;
518 518
 }
519 519
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
  * @return void
566 566
  **/
567 567
 function bigbluebuttonbn_process_pre_save_instance(&$bigbluebuttonbn) {
568
-    require_once(__DIR__.'/locallib.php');
568
+    require_once(__DIR__ . '/locallib.php');
569 569
     $bigbluebuttonbn->timemodified = time();
570 570
     if ((integer)$bigbluebuttonbn->instance == 0) {
571 571
         $bigbluebuttonbn->timecreated = time();
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
     if (count($files) == 1) {
722 722
         // Get the first (and only) file.
723 723
         $file = reset($files);
724
-        $filesrc = '/'.$file->get_filename();
724
+        $filesrc = '/' . $file->get_filename();
725 725
     }
726 726
     return $filesrc;
727 727
 }
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
     if (!$filename) {
790 790
         return false;
791 791
     }
792
-    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
792
+    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
793 793
     $fs = get_file_storage();
794 794
     $file = $fs->get_file_by_hash(sha1($fullpath));
795 795
     if (!$file || $file->is_directory()) {
Please login to merge, or discard this patch.