From 6ba65fa08d4c9709b4a712fbb166303a71ab590d Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 28 Feb 2007 06:25:22 +0000 Subject: [PATCH] Merged Nicolas' changes from MDL-8582 into HEAD. --- admin/handlevirus.php | 4 +- admin/mnet/enr_course_enrol.php | 2 +- admin/mnet/enr_courses.php | 4 +- admin/oacleanup.php | 2 +- admin/process_email.php | 4 +- admin/register.php | 2 +- admin/roles/assign.php | 2 +- admin/roles/override.php | 2 +- admin/roles/tabs.php | 2 +- auth/cas/forbidden.php | 2 +- auth/cas/login.php | 10 +-- auth/mnet/auth.php | 2 +- backup/backup.php | 4 +- backup/restore_check.html | 2 +- backup/restorelib.php | 2 +- backup/try.php | 6 +- blocks/admin/block_admin.php | 4 +- blocks/course_list/block_course_list.php | 21 +++--- course/category.php | 6 +- course/delete.php | 7 +- course/edit.php | 4 +- course/grade.php | 2 +- course/grades.php | 6 +- course/groups.php | 2 +- course/import/activities/index.php | 2 +- course/import/groups/index.php | 2 +- course/importstudents.php | 2 +- course/index.php | 10 +-- course/info.php | 2 +- course/lib.php | 26 +++---- course/pending.php | 4 +- course/recent.php | 10 +-- course/report/log/index.php | 2 +- course/report/log/lib.php | 2 +- course/report/outline/index.php | 4 +- course/report/participation/index.php | 4 +- course/report/stats/index.php | 4 +- course/report/stats/report.php | 2 +- course/scales.php | 6 +- course/search.php | 2 +- course/user.php | 4 +- enrol/authorize/enrol.php | 4 +- enrol/authorize/locallib.php | 4 +- enrol/database/enrol.php | 8 +-- enrol/imsenterprise/importnow.php | 2 +- enrol/mnet/allowed_courses.php | 8 +-- enrol/paypal/ipn.php | 6 +- files/index.php | 2 +- grade/exceptions.php | 2 +- grade/lib.php | 9 +-- group/assign.php | 2 +- group/group.php | 2 +- group/grouping.php | 2 +- group/groupui/index.php | 2 +- group/groupui/printgrouping.php | 2 +- group/index.php | 4 +- lib/accesslib.php | 4 +- lib/db/mysql.php | 12 ++-- lib/db/postgres7.php | 4 +- lib/moodlelib.php | 8 +-- lib/questionlib.php | 2 +- lib/simpletest/testweblib.php | 33 +++++++++ lib/weblib.php | 68 +++++++++++++++---- message/index.php | 4 +- mod/assignment/lib.php | 2 +- mod/chat/gui_header_js/index.php | 2 +- mod/chat/gui_sockets/index.php | 2 +- mod/choice/view.php | 2 +- mod/data/edit.php | 2 +- mod/data/view.php | 2 +- mod/forum/discuss.php | 4 +- mod/forum/index.php | 8 +-- mod/forum/lib.php | 2 +- mod/forum/post.php | 4 +- mod/forum/user.php | 4 +- mod/glossary/export.php | 2 +- mod/glossary/print.php | 4 +- mod/glossary/showentry.php | 4 +- mod/hotpot/index.php | 6 +- mod/hotpot/report.php | 4 +- mod/hotpot/review.php | 4 +- mod/hotpot/view.php | 4 +- mod/lams/index.php | 2 +- mod/lesson/index.php | 2 +- mod/resource/index.php | 2 +- mod/resource/type/file/resource.class.php | 2 +- .../type/repository/resource.class.php | 2 +- mod/scorm/player.php | 4 +- mod/scorm/report.php | 6 +- mod/scorm/view.php | 2 +- mod/survey/report.php | 2 +- mod/workshop/assess.php | 2 +- question/category_class.php | 6 +- user/edit.php | 2 +- user/editadvanced.php | 2 +- user/profile/definelib.php | 2 +- user/profile/index.php | 2 +- user/tabs.php | 4 +- user/view.php | 7 +- 99 files changed, 289 insertions(+), 210 deletions(-) create mode 100644 lib/simpletest/testweblib.php diff --git a/admin/handlevirus.php b/admin/handlevirus.php index f2b20e2126a..7a09c1eb672 100644 --- a/admin/handlevirus.php +++ b/admin/handlevirus.php @@ -40,7 +40,7 @@ while(!feof($fd)) { $user = get_record("user","id",$log->userid); $course = get_record("course","id",$log->course); - $subject = get_string('virusfoundsubject','moodle',$site->fullname); + $subject = get_string('virusfoundsubject','moodle',format_string($site->fullname)); $a->date = userdate($log->time); $a->action = $action; @@ -78,7 +78,7 @@ function notify_admins_unknown($file,$a) { global $site; $admins = get_admins(); - $subject = get_string('virusfoundsubject','moodle',$site->fullname); + $subject = get_string('virusfoundsubject','moodle',format_string($site->fullname)); $body = get_string('virusfoundlateradminnolog','moodle',$a); foreach ($admins as $admin) { email_to_user($admin,$admin,$subject,$body); diff --git a/admin/mnet/enr_course_enrol.php b/admin/mnet/enr_course_enrol.php index 906e2280f46..94af92e1753 100644 --- a/admin/mnet/enr_course_enrol.php +++ b/admin/mnet/enr_course_enrol.php @@ -258,7 +258,7 @@ $strsearchresults = get_string('searchresults'); admin_externalpage_print_header($adminroot); print_box('' . s($mnet_peer->name) . ' : ' - . s($course->shortname) .' '. s($course->fullname) + . format_string($course->shortname) .' '. format_string($course->fullname) . '
' . get_string("enrolcourseenrol_desc", "mnet")); diff --git a/admin/mnet/enr_courses.php b/admin/mnet/enr_courses.php index 079668f5abf..f1157dbe1b9 100644 --- a/admin/mnet/enr_courses.php +++ b/admin/mnet/enr_courses.php @@ -41,10 +41,10 @@ . "host={$mnethost}&courseid={$course->id}&sesskey={$USER->sesskey}"; print ('' . "$icon" - . "".s($course->fullname). "" + . "".format_string($course->fullname). "" . '' . '' - . ''.s($course->shortname). ' - ' .s($course->cat_name).'' + . ''.format_string($course->shortname). ' - ' .format_string($course->cat_name).'' . '' . '' . "{$course->summary}" diff --git a/admin/oacleanup.php b/admin/oacleanup.php index bc603691fb6..78ac48f39a3 100644 --- a/admin/oacleanup.php +++ b/admin/oacleanup.php @@ -99,7 +99,7 @@ function online_assignment_cleanup($output=false) { /// grab the section record if (!($section = get_record('course_sections', 'id', $newsection))) { - if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '.$course->fullname.'
'; + if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '. format_string($course->fullname) .'
'; continue; } diff --git a/admin/process_email.php b/admin/process_email.php index 77f72c3f923..8e5091abcd0 100755 --- a/admin/process_email.php +++ b/admin/process_email.php @@ -16,8 +16,8 @@ if ($_ENV['RECIPIENT'] == $CFG->noreplyaddress) { } $site = get_site(); - $subject = get_string('noreplybouncesubject','moodle',$site->fullname); - $body = get_string('noreplybouncemessage','moodle',$site->fullname)."\n\n"; + $subject = get_string('noreplybouncesubject','moodle',format_string($site->fullname)); + $body = get_string('noreplybouncemessage','moodle',format_string($site->fullname))."\n\n"; $fd = fopen('php://stdin','r'); if ($fd) { diff --git a/admin/register.php b/admin/register.php index 6f5c34c8bf5..cc142feb752 100644 --- a/admin/register.php +++ b/admin/register.php @@ -34,7 +34,7 @@ $strregistration = get_string("registration"); $strregistrationinfo = get_string("registrationinfo"); - print_header("$site->shortname: $strregistration", "$site->fullname", + print_header("$site->shortname: $strregistration", $site->fullname, "admin/index.php\">$stradministration -> $strregistration"); print_heading($strregistration); diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 24d3a383405..11d1c263cd6 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -103,7 +103,7 @@ /// site header } else { - print_header("$course->fullname: $fullname", "$course->fullname", + print_header("$course->fullname: $fullname", $course->fullname, "wwwroot/user/view.php?id=$userid&course=$courseid\">$fullname -> $straction", "", "", true, " ", navmenu($course)); } diff --git a/admin/roles/override.php b/admin/roles/override.php index a52124f6913..b94ea7e1cdf 100755 --- a/admin/roles/override.php +++ b/admin/roles/override.php @@ -129,7 +129,7 @@ /// site header } else { - print_header("$course->fullname: $fullname", "$course->fullname", + print_header("$course->fullname: $fullname", $course->fullname, "wwwroot/user/view.php?id=$userid&course=$course->id\">$fullname -> $straction", "", "", true, " ", navmenu($course)); } $showroles = 1; diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php index a69baa0101e..f240896af41 100755 --- a/admin/roles/tabs.php +++ b/admin/roles/tabs.php @@ -31,7 +31,7 @@ if ($currenttab != 'update') { $streditcoursesettings = get_string("editcoursesettings"); $course = get_record('course', 'id', $context->instanceid); - print_header($streditcoursesettings, "$course->fullname", + print_header($streditcoursesettings, $course->fullname, "wwwroot/course/view.php?id=$course->id\">$course->shortname -> $straction"); } break; diff --git a/auth/cas/forbidden.php b/auth/cas/forbidden.php index ce1b8b2dafd..918261ecf65 100644 --- a/auth/cas/forbidden.php +++ b/auth/cas/forbidden.php @@ -10,7 +10,7 @@ $loginsite = get_string("loginsite"); $errormsg = get_string("auth_cas_invalidcaslogin", "auth"); - print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite); + print_header("$site->fullname: $loginsite", $site->fullname, $loginsite); include("forbidden.html"); print_footer(); exit; diff --git a/auth/cas/login.php b/auth/cas/login.php index d2148b60115..7551bc88c40 100644 --- a/auth/cas/login.php +++ b/auth/cas/login.php @@ -143,12 +143,12 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); if ($ldapauth->config->expiration == 1) { $days2expire = $ldapauth->password_expire($USER->username); if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) { - print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "
$langmenu
"); + print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "
$langmenu
"); notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo); print_footer(); exit; } elseif (intval($days2expire) < 0 ) { - print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "
$langmenu
"); + print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "
$langmenu
"); notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo); print_footer(); exit; @@ -247,12 +247,12 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); if ($ldapauth->config->expiration == 1) { $days2expire = $ldapauth->password_expire($USER->username); if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) { - print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "
$langmenu
"); + print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "
$langmenu
"); notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo); print_footer(); exit; } elseif (intval($days2expire) < 0 ) { - print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "
$langmenu
"); + print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "
$langmenu
"); notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo); print_footer(); exit; @@ -302,7 +302,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); $show_instructions = false; } - print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "
$langmenu
"); + print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "
$langmenu
"); include($CFG->dirroot.'/auth/cas/index_form.html'); print_footer(); diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index 9c8c07a394f..338a9b259bd 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -271,7 +271,7 @@ class auth_plugin_mnet list($code, $message) = array_map('trim',explode(':', $errormessage, 2)); if($code == 702) { $site = get_site(); - print_error('mnet_session_prohibited','mnet', $remotewwwroot, $site->fullname); + print_error('mnet_session_prohibited','mnet', $remotewwwroot, format_string($site->fullname)); exit; } $message .= "ERROR $code:
$errormessage
"; diff --git a/backup/backup.php b/backup/backup.php index f87a6d4aa7d..d6a8265df3d 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -78,7 +78,7 @@ print_heading(get_string("choosecourse")); print_simple_box_start("center"); foreach ($courses as $course) { - echo ''.s($course->fullname).' ('.s($course->shortname).')
'."\n"; + echo ''.format_string($course->fullname).' ('.format_string($course->shortname).')
'."\n"; } print_simple_box_end(); } else { @@ -106,7 +106,7 @@ } //Print form - print_heading("$strcoursebackup: $course->fullname ($course->shortname)"); + print_heading(format_string("$strcoursebackup: $course->fullname ($course->shortname)")); print_simple_box_start("center"); //Adjust some php variables to the execution of this script diff --git a/backup/restore_check.html b/backup/restore_check.html index d28cf701ec3..065df0a94b7 100644 --- a/backup/restore_check.html +++ b/backup/restore_check.html @@ -222,7 +222,7 @@ } else { $optdimmed = ''; } - echo "id&launch=check&id=$id&file=$file\">".s($course->fullname).' ('.s($course->shortname).')
'."\n"; + echo "id&launch=check&id=$id&file=$file\">".format_string($course->fullname).' ('.format_string($course->shortname).')
'."\n"; } print_simple_box_end(); } else { diff --git a/backup/restorelib.php b/backup/restorelib.php index 57a4aeffbe3..e4fbc728a1b 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -5762,7 +5762,7 @@ echo "
  • ".get_string("usingexistingcourse"); echo "