Skip to content

Commit

Permalink
core MDL-19791 Replaced deprecated functions, added set_url calls
Browse files Browse the repository at this point in the history
  • Loading branch information
samhemelryk committed Sep 25, 2009
1 parent d9cb06d commit 1a198dd
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 10 deletions.
3 changes: 3 additions & 0 deletions lib/form/editorhelp.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once('../../config.php');

$PAGE->set_url(new moodle_url($CFG->wwwroot.'/lib/form/editorhelp.php'));

$topics = array();
$titles = array();
for ($i=1; ; $i++){
Expand Down
7 changes: 6 additions & 1 deletion lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions lib/session-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

?>
?>
1 change: 1 addition & 0 deletions lib/simpletest/filtersettingsperformancetester.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
$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);
Expand Down
2 changes: 1 addition & 1 deletion lib/statslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 5 additions & 3 deletions lib/womenslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
2 changes: 1 addition & 1 deletion my/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') . '<br /><br />' . get_string('liketologin'), get_login_url(), $CFG->wwwroot);
Expand Down

0 comments on commit 1a198dd

Please sign in to comment.