Completed
Push — v2.2-stable ( fe03de...7d4f6d )
by Jesus
02:13
created
lib.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -28,32 +28,32 @@  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
-if (file_exists(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php')) {
44
-    require_once(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php');
43
+if (file_exists(dirname(__FILE__) . '/vendor/firebase/php-jwt/src/JWT.php')) {
44
+    require_once(dirname(__FILE__) . '/vendor/firebase/php-jwt/src/JWT.php');
45 45
 }
46 46
 
47 47
 if (!isset($CFG->bigbluebuttonbn)) {
48 48
     $CFG->bigbluebuttonbn = array();
49 49
 }
50 50
 
51
-if (file_exists(dirname(__FILE__).'/config.php')) {
52
-    require_once(dirname(__FILE__).'/config.php');
51
+if (file_exists(dirname(__FILE__) . '/config.php')) {
52
+    require_once(dirname(__FILE__) . '/config.php');
53 53
     // Old BigBlueButtonBN cfg schema. For backward compatibility.
54 54
     global $BIGBLUEBUTTONBN_CFG;
55 55
     if (isset($BIGBLUEBUTTONBN_CFG)) {
56
-        foreach ((array) $BIGBLUEBUTTONBN_CFG as $key => $value) {
56
+        foreach ((array)$BIGBLUEBUTTONBN_CFG as $key => $value) {
57 57
             $cfgkey = str_replace("bigbluebuttonbn_", "", $key);
58 58
             $CFG->bigbluebuttonbn[$cfgkey] = $value;
59 59
         }
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
         return null;
110 110
     }
111 111
     $features = array(
112
-        (string) FEATURE_IDNUMBER => true,
113
-        (string) FEATURE_GROUPS => true,
114
-        (string) FEATURE_GROUPINGS => true,
115
-        (string) FEATURE_GROUPMEMBERSONLY => true,
116
-        (string) FEATURE_MOD_INTRO => true,
117
-        (string) FEATURE_BACKUP_MOODLE2 => true,
118
-        (string) FEATURE_COMPLETION_TRACKS_VIEWS => true,
119
-        (string) FEATURE_GRADE_HAS_GRADE => false,
120
-        (string) FEATURE_GRADE_OUTCOMES => false,
121
-        (string) FEATURE_SHOW_DESCRIPTION => true,
112
+        (string)FEATURE_IDNUMBER => true,
113
+        (string)FEATURE_GROUPS => true,
114
+        (string)FEATURE_GROUPINGS => true,
115
+        (string)FEATURE_GROUPMEMBERSONLY => true,
116
+        (string)FEATURE_MOD_INTRO => true,
117
+        (string)FEATURE_BACKUP_MOODLE2 => true,
118
+        (string)FEATURE_COMPLETION_TRACKS_VIEWS => true,
119
+        (string)FEATURE_GRADE_HAS_GRADE => false,
120
+        (string)FEATURE_GRADE_OUTCOMES => false,
121
+        (string)FEATURE_SHOW_DESCRIPTION => true,
122 122
     );
123
-    if (isset($features[(string) $feature])) {
123
+    if (isset($features[(string)$feature])) {
124 124
         return $features[$feature];
125 125
     }
126 126
     return null;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 function bigbluebuttonbn_delete_instance_log($bigbluebuttonbn) {
221 221
     global $DB;
222 222
     $sql  = "SELECT * FROM {bigbluebuttonbn_logs} ";
223
-    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND ". $DB->sql_compare_text('meta') . " = ?";
223
+    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND " . $DB->sql_compare_text('meta') . " = ?";
224 224
     $logs = $DB->get_records_sql($sql, array($bigbluebuttonbn->id, BIGBLUEBUTTONBN_LOG_EVENT_CREATE, "{\"record\":true}"));
225 225
     $meta = "{\"has_recordings\":" . empty($logs) ? "true" : "false" . "}";
226 226
     bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_DELETE, [], $meta);
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) {
244 244
     global $DB;
245 245
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
246
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ), '*');
246
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',), '*');
247 247
     if ($completed > 0) {
248
-        return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '.
249
-            get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '.
248
+        return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' .
249
+            get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' .
250 250
             get_string('view_message_times', 'bigbluebuttonbn');
251 251
     }
252 252
     return '';
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 function bigbluebuttonbn_user_complete($course, $user, $mod, $bigbluebuttonbn) {
267 267
     global $DB;
268 268
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
269
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ),
269
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',),
270 270
         '*', IGNORE_MULTIPLE);
271 271
     return $completed > 0;
272 272
 }
@@ -341,16 +341,16 @@  discard block
 block discarded – undo
341 341
     if ($bigbluebuttonbn->visible) {
342 342
         $classes = 'class="dimmed" ';
343 343
     }
344
-    $str  = '<div class="bigbluebuttonbn overview">'."\n";
345
-    $str .= '  <div class="name">'.get_string('modulename', 'bigbluebuttonbn').':&nbsp;'."\n";
346
-    $str .= '    <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.
347
-      '">'.$bigbluebuttonbn->name.'</a>'."\n";
348
-    $str .= '  </div>'."\n";
349
-    $str .= '  <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).
350
-        '</div>'."\n";
351
-    $str .= '  <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime)
352
-      .'</div>'."\n";
353
-    $str .= '</div>'."\n";
344
+    $str  = '<div class="bigbluebuttonbn overview">' . "\n";
345
+    $str .= '  <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ':&nbsp;' . "\n";
346
+    $str .= '    <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule .
347
+      '">' . $bigbluebuttonbn->name . '</a>' . "\n";
348
+    $str .= '  </div>' . "\n";
349
+    $str .= '  <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) .
350
+        '</div>' . "\n";
351
+    $str .= '  <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime)
352
+      .'</div>' . "\n";
353
+    $str .= '</div>' . "\n";
354 354
     return $str;
355 355
 }
356 356
 
@@ -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.