Completed
Push — v2.2-stable ( f8abee...5f469b )
by Jesus
02:22
created
lib.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -28,33 +28,33 @@  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
 
43 43
 if (!class_exists('\Firebase\JWT\JWT') &&
44
-    file_exists(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php')) {
45
-    require_once(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php');
44
+    file_exists(dirname(__FILE__) . '/vendor/firebase/php-jwt/src/JWT.php')) {
45
+    require_once(dirname(__FILE__) . '/vendor/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
     // Old BigBlueButtonBN cfg schema. For backward compatibility.
55 55
     global $BIGBLUEBUTTONBN_CFG;
56 56
     if (isset($BIGBLUEBUTTONBN_CFG)) {
57
-        foreach ((array) $BIGBLUEBUTTONBN_CFG as $key => $value) {
57
+        foreach ((array)$BIGBLUEBUTTONBN_CFG as $key => $value) {
58 58
             $cfgkey = str_replace("bigbluebuttonbn_", "", $key);
59 59
             $CFG->bigbluebuttonbn[$cfgkey] = $value;
60 60
         }
@@ -110,18 +110,18 @@  discard block
 block discarded – undo
110 110
         return null;
111 111
     }
112 112
     $features = array(
113
-        (string) FEATURE_IDNUMBER => true,
114
-        (string) FEATURE_GROUPS => true,
115
-        (string) FEATURE_GROUPINGS => true,
116
-        (string) FEATURE_GROUPMEMBERSONLY => true,
117
-        (string) FEATURE_MOD_INTRO => true,
118
-        (string) FEATURE_BACKUP_MOODLE2 => true,
119
-        (string) FEATURE_COMPLETION_TRACKS_VIEWS => true,
120
-        (string) FEATURE_GRADE_HAS_GRADE => false,
121
-        (string) FEATURE_GRADE_OUTCOMES => false,
122
-        (string) FEATURE_SHOW_DESCRIPTION => true,
113
+        (string)FEATURE_IDNUMBER => true,
114
+        (string)FEATURE_GROUPS => true,
115
+        (string)FEATURE_GROUPINGS => true,
116
+        (string)FEATURE_GROUPMEMBERSONLY => true,
117
+        (string)FEATURE_MOD_INTRO => true,
118
+        (string)FEATURE_BACKUP_MOODLE2 => true,
119
+        (string)FEATURE_COMPLETION_TRACKS_VIEWS => true,
120
+        (string)FEATURE_GRADE_HAS_GRADE => false,
121
+        (string)FEATURE_GRADE_OUTCOMES => false,
122
+        (string)FEATURE_SHOW_DESCRIPTION => true,
123 123
     );
124
-    if (isset($features[(string) $feature])) {
124
+    if (isset($features[(string)$feature])) {
125 125
         return $features[$feature];
126 126
     }
127 127
     return null;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 function bigbluebuttonbn_delete_instance_log($bigbluebuttonbn) {
222 222
     global $DB;
223 223
     $sql  = "SELECT * FROM {bigbluebuttonbn_logs} ";
224
-    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND ". $DB->sql_compare_text('meta') . " = ?";
224
+    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND " . $DB->sql_compare_text('meta') . " = ?";
225 225
     $logs = $DB->get_records_sql($sql, array($bigbluebuttonbn->id, BIGBLUEBUTTONBN_LOG_EVENT_CREATE, "{\"record\":true}"));
226 226
     $meta = "{\"has_recordings\":" . empty($logs) ? "true" : "false" . "}";
227 227
     bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_DELETE, [], $meta);
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) {
245 245
     global $DB;
246 246
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
247
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ), '*');
247
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',), '*');
248 248
     if ($completed > 0) {
249
-        return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '.
250
-            get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '.
249
+        return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' .
250
+            get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' .
251 251
             get_string('view_message_times', 'bigbluebuttonbn');
252 252
     }
253 253
     return '';
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 function bigbluebuttonbn_user_complete($course, $user, $mod, $bigbluebuttonbn) {
268 268
     global $DB;
269 269
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
270
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ),
270
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',),
271 271
         '*', IGNORE_MULTIPLE);
272 272
     return $completed > 0;
273 273
 }
@@ -342,16 +342,16 @@  discard block
 block discarded – undo
342 342
     if ($bigbluebuttonbn->visible) {
343 343
         $classes = 'class="dimmed" ';
344 344
     }
345
-    $str  = '<div class="bigbluebuttonbn overview">'."\n";
346
-    $str .= '  <div class="name">'.get_string('modulename', 'bigbluebuttonbn').':&nbsp;'."\n";
347
-    $str .= '    <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.
348
-      '">'.$bigbluebuttonbn->name.'</a>'."\n";
349
-    $str .= '  </div>'."\n";
350
-    $str .= '  <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).
351
-        '</div>'."\n";
352
-    $str .= '  <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime)
353
-      .'</div>'."\n";
354
-    $str .= '</div>'."\n";
345
+    $str  = '<div class="bigbluebuttonbn overview">' . "\n";
346
+    $str .= '  <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ':&nbsp;' . "\n";
347
+    $str .= '    <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule .
348
+      '">' . $bigbluebuttonbn->name . '</a>' . "\n";
349
+    $str .= '  </div>' . "\n";
350
+    $str .= '  <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) .
351
+        '</div>' . "\n";
352
+    $str .= '  <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime)
353
+      .'</div>' . "\n";
354
+    $str .= '</div>' . "\n";
355 355
     return $str;
356 356
 }
357 357
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
     if (count($files) == 1) {
559 559
         // Get the first (and only) file.
560 560
         $file = reset($files);
561
-        $filesrc = '/'.$file->get_filename();
561
+        $filesrc = '/' . $file->get_filename();
562 562
     }
563 563
     return $filesrc;
564 564
 }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     if (!$filename) {
627 627
         return false;
628 628
     }
629
-    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
629
+    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
630 630
     $fs = get_file_storage();
631 631
     $file = $fs->get_file_by_hash(sha1($fullpath));
632 632
     if (!$file || $file->is_directory()) {
Please login to merge, or discard this patch.