diff --git a/lib/form/editorhelp.php b/lib/form/editorhelp.php
index 509462281a2..b43273f2e15 100644
--- a/lib/form/editorhelp.php
+++ b/lib/form/editorhelp.php
@@ -1,5 +1,8 @@
set_url(new moodle_url($CFG->wwwroot.'/lib/form/editorhelp.php'));
+
$topics = array();
$titles = array();
for ($i=1; ; $i++){
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 903ec010ba8..d9f88423156 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -5010,7 +5010,12 @@ function email_welcome_message_to_user($course, $user=NULL) {
if (!empty($message)) {
$subject = get_string('welcometocourse', '', format_string($course->fullname));
- if (! $teacher = get_teacher($course->id)) {
+ $context = get_context_instance(CONTEXT_COURSE, $course->id);
+ // Pass $view=true to filter hidden caps if the user cannot see them
+ if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC','', '', '', '', false, true)) {
+ $users = sort_by_roleassignment_authority($users, $context);
+ $teacher = array_shift($users);
+ } else {
$teacher = get_admin();
}
email_to_user($user, $teacher, $subject, $message);
diff --git a/lib/session-test.php b/lib/session-test.php
index 01fcd659c09..edfb7a2810e 100644
--- a/lib/session-test.php
+++ b/lib/session-test.php
@@ -32,8 +32,12 @@
/** Include config {@see config.php} */
require '../config.php';
-error('session test not reimplemented yet');
+$PAGE->set_url(new moodle_url($CFG->wwwroot.'/lib/session-test.php'));
+$PAGE->set_generaltype('form');
+list($message, $moreinfourl, $link) = prepare_error_message('notlocalisederrormessage', 'error', '', 'session test not reimplemented yet');
+echo $OUTPUT->fatal_error($message, $moreinfourl, $link, debug_backtrace());
+//
//TODO: add code that actually tests moodle sessions, the old one only tested PHP sessions used from installer, not the real moodle sessions
-?>
+?>
\ No newline at end of file
diff --git a/lib/simpletest/filtersettingsperformancetester.php b/lib/simpletest/filtersettingsperformancetester.php
index 99aa691807c..149b7a91af8 100644
--- a/lib/simpletest/filtersettingsperformancetester.php
+++ b/lib/simpletest/filtersettingsperformancetester.php
@@ -41,6 +41,7 @@ require_capability('moodle/site:config', $syscontext);
$baseurl = $CFG->wwwroot . '/lib/simpletest/filtersettingsperformancetester.php';
$title = 'filter_get_active_in_context performance test';
+$PAGE->set_url(new moodle_url($CFG->wwwroot.'/lib/simpletest/filtersettingsperformancetester.php'));
$PAGE->navbar->add($title);
$PAGE->set_title($title);
$PAGE->set_heading($title);
diff --git a/lib/statslib.php b/lib/statslib.php
index 9f00f648dae..4b16a314843 100644
--- a/lib/statslib.php
+++ b/lib/statslib.php
@@ -145,7 +145,7 @@ function stats_cron_daily($maxdays=1) {
$viewactions = implode(',', stats_get_action_names('view'));
$postactions = implode(',', stats_get_action_names('post'));
- $guest = get_guest();
+ $guest = get_complete_user_data('username', 'guest');
$guestrole = get_guest_role();
list($enroljoin, $enrolwhere, $enrolparams) = stats_get_enrolled_sql($CFG->statscatdepth, true);
diff --git a/lib/weblib.php b/lib/weblib.php
index d26cc223658..cce26eb0bb7 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -2164,11 +2164,11 @@ function open_containers() {
* @return mixed string or void
*/
function print_container_end_all($return=false, $keep=0) {
+ global $OUTPUT;
$output = '';
while (open_containers() > $keep) {
- $output .= print_container_end($return);
+ $output .= $OUTPUT->container_end();
}
-
if ($return) {
return $output;
} else {
diff --git a/lib/womenslib.php b/lib/womenslib.php
index 1118cf2e24e..b22710dcb4f 100644
--- a/lib/womenslib.php
+++ b/lib/womenslib.php
@@ -22,6 +22,8 @@
*/
/** Include config.pgp */
- include('../config.php');
- redirect('http://en.wikipedia.org/wiki/Women%27s_liberation');
-?>
+include('../config.php');
+
+$PAGE->set_url(new moodle_url($CFG->wwwroot.'/lib/womenslib.php'));
+
+redirect('http://en.wikipedia.org/wiki/Women%27s_liberation');
\ No newline at end of file
diff --git a/my/index.php b/my/index.php
index 43641c909b9..ebdd718503c 100644
--- a/my/index.php
+++ b/my/index.php
@@ -9,7 +9,7 @@
$strmymoodle = get_string('mymoodle','my');
- if (isguest()) {
+ if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), 0, false)) {
$PAGE->set_title($strmymoodle);
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('noguest', 'my') . '
' . get_string('liketologin'), get_login_url(), $CFG->wwwroot);