Completed
Push — master ( 0f1932...08f511 )
by Jesus
150:07 queued 141:41
created
lib.php 2 patches
Indentation   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -241,7 +241,6 @@  discard block
 block discarded – undo
241 241
 
242 242
 /**
243 243
  * Prints single activity item prepared by {@see recordingsbn_get_recent_mod_activity()}
244
-
245 244
  * @return void
246 245
  */
247 246
 function bigbluebuttonbn_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames) {
@@ -361,9 +360,9 @@  discard block
 block discarded – undo
361 360
     foreach ($bigbluebuttonbns as $bigbluebuttonbn) {
362 361
         if ($bigbluebuttonbn->openingtime and $bigbluebuttonbn->closingtime) {  // A bigbluebuttonbn is scheduled.
363 362
             $str = '<div class="bigbluebuttonbn overview"><div class="name">'.
364
-                   $strbigbluebuttonbn.': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"').
365
-                   ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'.
366
-                   $bigbluebuttonbn->name.'</a></div>';
363
+                    $strbigbluebuttonbn.': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"').
364
+                    ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'.
365
+                    $bigbluebuttonbn->name.'</a></div>';
367 366
             $str .= '<div class="info">'.$strnextsession.': '.userdate($bigbluebuttonbn->openingtime).'</div></div>';
368 367
 
369 368
             if (empty($htmlarray[$bigbluebuttonbn->course]['bigbluebuttonbn'])) {
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@  discard block
 block discarded – undo
13 13
 
14 14
 global $BIGBLUEBUTTONBN_CFG, $CFG;
15 15
 
16
-require_once($CFG->dirroot.'/calendar/lib.php');
17
-require_once($CFG->dirroot.'/message/lib.php');
18
-require_once($CFG->dirroot.'/mod/lti/OAuth.php');
19
-require_once($CFG->libdir.'/accesslib.php');
20
-require_once($CFG->libdir.'/completionlib.php');
21
-require_once($CFG->libdir.'/datalib.php');
22
-require_once($CFG->libdir.'/coursecatlib.php');
23
-require_once($CFG->libdir.'/enrollib.php');
24
-require_once($CFG->libdir.'/filelib.php');
25
-require_once($CFG->libdir.'/formslib.php');
26
-
27
-require_once(dirname(__FILE__).'/JWT.php');
28
-
29
-if( file_exists(dirname(__FILE__).'/config.php') ) {
30
-    require_once(dirname(__FILE__).'/config.php');
31
-    if( isset($BIGBLUEBUTTONBN_CFG) ) {
32
-        $CFG = (object) array_merge((array)$CFG, (array)$BIGBLUEBUTTONBN_CFG);
16
+require_once($CFG->dirroot . '/calendar/lib.php');
17
+require_once($CFG->dirroot . '/message/lib.php');
18
+require_once($CFG->dirroot . '/mod/lti/OAuth.php');
19
+require_once($CFG->libdir . '/accesslib.php');
20
+require_once($CFG->libdir . '/completionlib.php');
21
+require_once($CFG->libdir . '/datalib.php');
22
+require_once($CFG->libdir . '/coursecatlib.php');
23
+require_once($CFG->libdir . '/enrollib.php');
24
+require_once($CFG->libdir . '/filelib.php');
25
+require_once($CFG->libdir . '/formslib.php');
26
+
27
+require_once(dirname(__FILE__) . '/JWT.php');
28
+
29
+if (file_exists(dirname(__FILE__) . '/config.php')) {
30
+    require_once(dirname(__FILE__) . '/config.php');
31
+    if (isset($BIGBLUEBUTTONBN_CFG)) {
32
+        $CFG = (object)array_merge((array)$CFG, (array)$BIGBLUEBUTTONBN_CFG);
33 33
     }
34 34
 } else {
35 35
     $BIGBLUEBUTTONBN_CFG = new stdClass();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 const BIGBLUEBUTTONBN_LOG_EVENT_DELETE = "Delete";
51 51
 
52 52
 function bigbluebuttonbn_supports($feature) {
53
-    switch($feature) {
53
+    switch ($feature) {
54 54
         case FEATURE_IDNUMBER:                return true;
55 55
         case FEATURE_GROUPS:                  return true;
56 56
         case FEATURE_GROUPINGS:               return true;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 function bigbluebuttonbn_add_instance($data, $mform) {
80 80
     global $DB, $CFG;
81 81
 
82
-    $draftitemid = isset($data->presentation)? $data->presentation: null;
82
+    $draftitemid = isset($data->presentation) ? $data->presentation : null;
83 83
     $context = bigbluebuttonbn_get_context_module($data->coursemodule);
84 84
 
85 85
     bigbluebuttonbn_process_pre_save($data);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     global $DB, $CFG;
108 108
 
109 109
     $data->id = $data->instance;
110
-    $draftitemid = isset($data->presentation)? $data->presentation: null;
110
+    $draftitemid = isset($data->presentation) ? $data->presentation : null;
111 111
     $context = bigbluebuttonbn_get_context_module($data->coursemodule);
112 112
 
113 113
     bigbluebuttonbn_process_pre_save($data);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 function bigbluebuttonbn_delete_instance($id) {
134 134
     global $CFG, $DB, $USER;
135 135
 
136
-    if (! $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) {
136
+    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) {
137 137
         return false;
138 138
     }
139 139
 
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
     //if( bigbluebuttonbn_isMeetingRunning($meetingID, $url, $shared_secret) )
152 152
     //    $getArray = bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $url, $shared_secret );
153 153
 
154
-    if (! $DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) {
154
+    if (!$DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) {
155 155
         $result = false;
156 156
     }
157 157
 
158
-    if (! $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
158
+    if (!$DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
159 159
         $result = false;
160 160
     }
161 161
 
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
     $logs = $DB->get_records('bigbluebuttonbn_logs', array('bigbluebuttonbnid' => $bigbluebuttonbn->id, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE));
172 172
     error_log(json_encode($logs));
173 173
     $has_recordings = 'false';
174
-    if (! empty($logs) ) {
174
+    if (!empty($logs)) {
175 175
         error_log("IS not empty");
176
-        foreach ( $logs as $l ) {
176
+        foreach ($logs as $l) {
177 177
             error_log(json_encode($l));
178 178
             $meta = json_decode($l->meta);
179
-            if ( $meta->record ) {
179
+            if ($meta->record) {
180 180
                 $has_recordings = 'true';
181 181
             }
182 182
         }
183 183
     }
184 184
     $log->meta = "{\"has_recordings\":{$has_recordings}}";
185 185
 
186
-    if (! $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) {
186
+    if (!$returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) {
187 187
         $result = false;
188 188
     }
189 189
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * @return boolean
222 222
  */
223 223
 function bigbluebuttonbn_print_recent_activity($course, $isteacher, $timestart) {
224
-    return false;  //  True if anything was printed, otherwise false
224
+    return false; //  True if anything was printed, otherwise false
225 225
 }
226 226
 
227 227
 /**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
  * @param int $groupid defaults to 0
237 237
  * @return void adds items into $activities and increases $index
238 238
  */
239
-function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) {
239
+function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0) {
240 240
 }
241 241
 
242 242
 /**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return boolean
256 256
  **/
257
-function bigbluebuttonbn_cron () {
257
+function bigbluebuttonbn_cron() {
258 258
     return true;
259 259
 }
260 260
 
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
     }
357 357
 
358 358
     $strbigbluebuttonbn = get_string('modulename', 'bigbluebuttonbn');
359
-    $strnextsession  = get_string('nextsession', 'bigbluebuttonbn');
359
+    $strnextsession = get_string('nextsession', 'bigbluebuttonbn');
360 360
 
361 361
     foreach ($bigbluebuttonbns as $bigbluebuttonbn) {
362 362
         if ($bigbluebuttonbn->openingtime and $bigbluebuttonbn->closingtime) {  // A bigbluebuttonbn is scheduled.
363
-            $str = '<div class="bigbluebuttonbn overview"><div class="name">'.
364
-                   $strbigbluebuttonbn.': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"').
365
-                   ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'.
366
-                   $bigbluebuttonbn->name.'</a></div>';
367
-            $str .= '<div class="info">'.$strnextsession.': '.userdate($bigbluebuttonbn->openingtime).'</div></div>';
363
+            $str = '<div class="bigbluebuttonbn overview"><div class="name">' .
364
+                   $strbigbluebuttonbn . ': <a ' . ($bigbluebuttonbn->visible ? '' : ' class="dimmed"') .
365
+                   ' href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule . '">' .
366
+                   $bigbluebuttonbn->name . '</a></div>';
367
+            $str .= '<div class="info">' . $strnextsession . ': ' . userdate($bigbluebuttonbn->openingtime) . '</div></div>';
368 368
 
369 369
             if (empty($htmlarray[$bigbluebuttonbn->course]['bigbluebuttonbn'])) {
370 370
                 $htmlarray[$bigbluebuttonbn->course]['bigbluebuttonbn'] = $str;
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 function bigbluebuttonbn_get_coursemodule_info($coursemodule) {
390 390
     global $CFG, $DB;
391 391
 
392
-    if ( !$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat, newwindow')) {
392
+    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat, newwindow')) {
393 393
         return NULL;
394 394
     }
395 395
 
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 function bigbluebuttonbn_process_pre_save(&$bigbluebuttonbn) {
416 416
     global $DB, $CFG;
417 417
 
418
-    if ( !isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated ) {
418
+    if (!isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated) {
419 419
         $bigbluebuttonbn->timecreated = time();
420 420
         //Assign password only if it is a new activity
421
-        if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) {
421
+        if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) {
422 422
             $bigbluebuttonbn->moderatorpass = bigbluebuttonbn_random_password(12);
423 423
             $bigbluebuttonbn->viewerpass = bigbluebuttonbn_random_password(12);
424 424
         }
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
         $bigbluebuttonbn->timemodified = time();
428 428
     }
429 429
 
430
-    if (! isset($bigbluebuttonbn->newwindow))
430
+    if (!isset($bigbluebuttonbn->newwindow))
431 431
         $bigbluebuttonbn->newwindow = 0;
432
-    if (! isset($bigbluebuttonbn->wait))
432
+    if (!isset($bigbluebuttonbn->wait))
433 433
         $bigbluebuttonbn->wait = 0;
434
-    if (! isset($bigbluebuttonbn->record))
434
+    if (!isset($bigbluebuttonbn->record))
435 435
         $bigbluebuttonbn->record = 0;
436
-    if (! isset($bigbluebuttonbn->tagging))
436
+    if (!isset($bigbluebuttonbn->tagging))
437 437
         $bigbluebuttonbn->tagging = 0;
438 438
 
439 439
     $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants);
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
 
453 453
     // Now that an id was assigned, generate and set the meetingid property based on 
454 454
     // [Moodle Instance + Activity ID + BBB Secret] (but only for new activities)
455
-    if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) {
456
-        $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot.$bigbluebuttonbn->id.bigbluebuttonbn_get_cfg_shared_secret());
455
+    if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) {
456
+        $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot . $bigbluebuttonbn->id . bigbluebuttonbn_get_cfg_shared_secret());
457 457
         $DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn_meetingid, array('id' => $bigbluebuttonbn->id));
458 458
         $action = get_string('mod_form_field_notification_msg_created', 'bigbluebuttonbn');
459 459
     } else {
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
     $at = get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn');
463 463
 
464 464
     // Add evento to the calendar when if openingtime is set
465
-    if ( isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime ){
465
+    if (isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime) {
466 466
         $event = new stdClass();
467 467
         $event->name        = $bigbluebuttonbn->name;
468 468
         $event->courseid    = $bigbluebuttonbn->course;
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
         $event->instance    = $bigbluebuttonbn->id;
473 473
         $event->timestart   = $bigbluebuttonbn->openingtime;
474 474
 
475
-        if ( $bigbluebuttonbn->closingtime ){
475
+        if ($bigbluebuttonbn->closingtime) {
476 476
             $event->durationtime = $bigbluebuttonbn->closingtime - $bigbluebuttonbn->openingtime;
477 477
         } else {
478 478
             $event->durationtime = 0;
479 479
         }
480 480
 
481
-        if ( $event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)) ) {
481
+        if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
482 482
             $calendarevent = calendar_event::load($event->id);
483 483
             $calendarevent->update($event);
484 484
         } else {
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id));
490 490
     }
491 491
 
492
-    if( isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification ) {
492
+    if (isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification) {
493 493
         // Prepare message
494 494
         $msg = new stdClass();
495 495
 
@@ -497,35 +497,35 @@  discard block
 block discarded – undo
497 497
         $msg->action = $action;
498 498
         $msg->activity_type = "";
499 499
         $msg->activity_title = $bigbluebuttonbn->name;
500
-        $message_text = '<p>'.$msg->activity_type.' &quot;'.$msg->activity_title.'&quot; '.get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn').' '.$msg->action.'.</p>';
500
+        $message_text = '<p>' . $msg->activity_type . ' &quot;' . $msg->activity_title . '&quot; ' . get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn') . ' ' . $msg->action . '.</p>';
501 501
 
502 502
         /// Add the meeting details to the message_body
503 503
         $msg->action = ucfirst($action);
504 504
         $msg->activity_description = "";
505
-        if( !empty($bigbluebuttonbn->intro) )
505
+        if (!empty($bigbluebuttonbn->intro))
506 506
             $msg->activity_description = trim($bigbluebuttonbn->intro);
507 507
         $msg->activity_openingtime = "";
508 508
         if ($bigbluebuttonbn->openingtime) {
509
-            $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime);
509
+            $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->openingtime);
510 510
         }
511 511
         $msg->activity_closingtime = "";
512
-        if ($bigbluebuttonbn->closingtime ) {
513
-            $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->closingtime);
512
+        if ($bigbluebuttonbn->closingtime) {
513
+            $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->closingtime);
514 514
         }
515
-        $msg->activity_owner = $USER->firstname.' '.$USER->lastname;
515
+        $msg->activity_owner = $USER->firstname . ' ' . $USER->lastname;
516 516
 
517
-        $message_text .= '<p><b>'.$msg->activity_title.'</b> '.get_string('email_body_notification_meeting_details', 'bigbluebuttonbn').':';
517
+        $message_text .= '<p><b>' . $msg->activity_title . '</b> ' . get_string('email_body_notification_meeting_details', 'bigbluebuttonbn') . ':';
518 518
         $message_text .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>';
519
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_title', 'bigbluebuttonbn').': </td><td>';
520
-        $message_text .= $msg->activity_title.'</td></tr>';
521
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_description', 'bigbluebuttonbn').': </td><td>';
522
-        $message_text .= $msg->activity_description.'</td></tr>';
523
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn').': </td><td>';
524
-        $message_text .= $msg->activity_openingtime.'</td></tr>';
525
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn').': </td><td>';
526
-        $message_text .= $msg->activity_closingtime.'</td></tr>';
527
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.$msg->action.' '.get_string('email_body_notification_meeting_by', 'bigbluebuttonbn').': </td><td>';
528
-        $message_text .= $msg->activity_owner.'</td></tr></tbody></table></p>';
519
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_title', 'bigbluebuttonbn') . ': </td><td>';
520
+        $message_text .= $msg->activity_title . '</td></tr>';
521
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_description', 'bigbluebuttonbn') . ': </td><td>';
522
+        $message_text .= $msg->activity_description . '</td></tr>';
523
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn') . ': </td><td>';
524
+        $message_text .= $msg->activity_openingtime . '</td></tr>';
525
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn') . ': </td><td>';
526
+        $message_text .= $msg->activity_closingtime . '</td></tr>';
527
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . $msg->action . ' ' . get_string('email_body_notification_meeting_by', 'bigbluebuttonbn') . ': </td><td>';
528
+        $message_text .= $msg->activity_owner . '</td></tr></tbody></table></p>';
529 529
 
530 530
         // Send notification to all users enrolled
531 531
         bigbluebuttonbn_send_notification($USER, $bigbluebuttonbn, $message_text);
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
  * @param array $options additional options affecting the file serving
577 577
  * @return bool false if file not found, does not return if found - justsend the file
578 578
  */
579
-function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
579
+function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
580 580
     global $CFG, $DB;
581 581
 
582 582
     if ($context->contextlevel != CONTEXT_MODULE) {
@@ -592,21 +592,21 @@  discard block
 block discarded – undo
592 592
         return false;
593 593
     }
594 594
 
595
-    if( sizeof($args) > 1 ) {
595
+    if (sizeof($args) > 1) {
596 596
         $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache');
597 597
         $presentation_nonce_key = sha1($bigbluebuttonbn->id);
598 598
         $presentation_nonce = $cache->get($presentation_nonce_key);
599 599
         $presentation_nonce_value = $presentation_nonce['value'];
600 600
         $presentation_nonce_counter = $presentation_nonce['counter'];
601 601
 
602
-        if( $args["0"] != $presentation_nonce_value ) {
602
+        if ($args["0"] != $presentation_nonce_value) {
603 603
             return false;
604 604
         }
605 605
 
606 606
         //The nonce value is actually used twice because BigBlueButton reads the file two times
607 607
         $presentation_nonce_counter += 1;
608
-        if( $presentation_nonce_counter < 2 ) {
609
-            $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter ));
608
+        if ($presentation_nonce_counter < 2) {
609
+            $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter));
610 610
         } else {
611 611
             $cache->delete($presentation_nonce_key);
612 612
         }
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
     }
625 625
 
626 626
     if ($filearea === 'presentation') {
627
-        $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
627
+        $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
628 628
     } else {
629 629
         return false;
630 630
     }
@@ -658,10 +658,10 @@  discard block
 block discarded – undo
658 658
  * @package  mod_bigbluebuttonbn
659 659
  * @return array a list of available roles
660 660
  */
661
-function bigbluebuttonbn_get_db_moodle_roles($rolename='all') {
661
+function bigbluebuttonbn_get_db_moodle_roles($rolename = 'all') {
662 662
     global $DB;
663 663
 
664
-    if( $rolename != 'all')
664
+    if ($rolename != 'all')
665 665
         $roles = $DB->get_record('role', array('shortname' => $rolename));
666 666
     else
667 667
         $roles = $DB->get_records('role', array());
@@ -680,22 +680,22 @@  discard block
 block discarded – undo
680 680
 
681 681
     $roles = bigbluebuttonbn_get_db_moodle_roles();
682 682
     $sqluserids = array();
683
-    foreach($roles as $role){
683
+    foreach ($roles as $role) {
684 684
         $users = get_role_users($role->id, $context);
685
-        foreach($users as $user) {
685
+        foreach ($users as $user) {
686 686
             array_push($sqluserids, $user->id);
687 687
         }
688 688
     }
689 689
 
690 690
     $users_array = array();
691
-    if( !empty($sqluserids) ) {
691
+    if (!empty($sqluserids)) {
692 692
         $users_array = $DB->get_records_select("user", "id IN (" . implode(', ', $sqluserids) . ") AND deleted = 0");
693 693
     }
694 694
 
695 695
     return $users_array;
696 696
 }
697 697
 
698
-function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message="") {
698
+function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message = "") {
699 699
     global $CFG, $DB;
700 700
 
701 701
     $context = bigbluebuttonbn_get_context_course($bigbluebuttonbn->course);
@@ -703,19 +703,19 @@  discard block
 block discarded – undo
703 703
 
704 704
     //Complete message
705 705
     $msg = new stdClass();
706
-    $msg->user_name = $sender->firstname.' '.$sender->lastname;
706
+    $msg->user_name = $sender->firstname . ' ' . $sender->lastname;
707 707
     $msg->user_email = $sender->email;
708 708
     $msg->course_name = "$course->fullname";
709
-    $message .= '<p><hr/><br/>'.get_string('email_footer_sent_by', 'bigbluebuttonbn').' '.$msg->user_name.'('.$msg->user_email.') ';
710
-    $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn').' '.$msg->course_name.'.</p>';
709
+    $message .= '<p><hr/><br/>' . get_string('email_footer_sent_by', 'bigbluebuttonbn') . ' ' . $msg->user_name . '(' . $msg->user_email . ') ';
710
+    $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn') . ' ' . $msg->course_name . '.</p>';
711 711
     
712 712
     $users = bigbluebuttonbn_get_users($context);
713
-    foreach( $users as $user ) {
714
-        if( $user->id != $sender->id ){
715
-            error_log("Sending msg to ".$user->firstname." ".$user->lastname.".");
713
+    foreach ($users as $user) {
714
+        if ($user->id != $sender->id) {
715
+            error_log("Sending msg to " . $user->firstname . " " . $user->lastname . ".");
716 716
             $messageid = message_post_message($sender, $user, $message, FORMAT_HTML);
717 717
             if (!empty($messageid)) {
718
-                error_log("Msg sent to ".$user->firstname." ".$user->lastname.".");
718
+                error_log("Msg sent to " . $user->firstname . " " . $user->lastname . ".");
719 719
             } else {
720 720
                 error_log("Msg was NOT sent.");
721 721
             }
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
     global $CFG;
728 728
 
729 729
     $version_major = bigbluebuttonbn_get_moodle_version_major();
730
-    if ( $version_major < '2013111800' ) {
730
+    if ($version_major < '2013111800') {
731 731
         //This is valid before v2.6
732 732
         $context = get_context_instance(CONTEXT_MODULE, $id);
733 733
     } else {
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
     global $CFG;
743 743
 
744 744
     $version_major = bigbluebuttonbn_get_moodle_version_major();
745
-    if ( $version_major < '2013111800' ) {
745
+    if ($version_major < '2013111800') {
746 746
         //This is valid before v2.6
747 747
         $context = get_context_instance(CONTEXT_COURSE, $id);
748 748
     } else {
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 
756 756
 function bigbluebuttonbn_get_cfg_server_url() {
757 757
     global $BIGBLUEBUTTONBN_CFG, $CFG;
758
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)? trim(trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url),'/').'/': (isset($CFG->bigbluebuttonbn_server_url)? trim(trim($CFG->bigbluebuttonbn_server_url),'/').'/': 'http://test-install.blindsidenetworks.com/bigbluebutton/'));
758
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ? trim(trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url), '/') . '/' : (isset($CFG->bigbluebuttonbn_server_url) ? trim(trim($CFG->bigbluebuttonbn_server_url), '/') . '/' : 'http://test-install.blindsidenetworks.com/bigbluebutton/'));
759 759
 }
760 760
 
761 761
 function bigbluebuttonbn_get_cfg_shared_secret() {
762 762
     global $BIGBLUEBUTTONBN_CFG, $CFG;
763
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret): (isset($CFG->bigbluebuttonbn_shared_secret)? trim($CFG->bigbluebuttonbn_shared_secret): '8cd8ef52e8e101574e400365b55e11a6'));
763
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) : (isset($CFG->bigbluebuttonbn_shared_secret) ? trim($CFG->bigbluebuttonbn_shared_secret) : '8cd8ef52e8e101574e400365b55e11a6'));
764 764
 }
765 765
 
Please login to merge, or discard this patch.