From e1968a8e11f73f6d4de1dd232bb05810b69ae9d2 Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 20 Jan 2007 13:00:03 +0000 Subject: [PATCH] MDL-7861 xhtml strict fix in notice() for & in referer, proper string quoting in print_single_button(), changed cleaning of submitted link; fixed warning when referer not send in print_continue(); fixed some doc comments --- lib/weblib.php | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 9efb11db91..853c34eb3e 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2883,9 +2883,13 @@ function print_continue($link, $return=false) { $output = ''; - if (!$link) { - - $link = $_SERVER['HTTP_REFERER']; + if ($link == '') { + if (!empty($_SERVER['HTTP_REFERER'])) { + $link = $_SERVER['HTTP_REFERER']; + $link = str_replace('&', '&', $link); // make it valid XHTML + } else { + $link = $CFG->wwwroot .'/'; + } } $output .= '
'; @@ -2925,7 +2929,7 @@ function print_box($message, $classes='generalbox', $ids='', $return=false) { } } -/* +/** * Starts a box using divs * Replaces print_simple_box_start (see deprecatedlib.php) * @@ -2950,7 +2954,7 @@ function print_box_start($classes='generalbox', $ids='', $return=false) { } -/* +/** * Simple function to end a box (see above) * Replaces print_simple_box_end (see deprecatedlib.php) * @@ -2979,14 +2983,14 @@ function print_single_button($link, $options, $label='OK', $method='get', $targe $output = ''; $output .= '
'; // taking target out, will need to add later target="'.$target.'" - $output .= '
'; + $output .= ''; $output .= '
'; if ($options) { foreach ($options as $name => $value) { - $output .= ''; + $output .= ''; } } - $output .= '
'; + $output .= '
'; if ($return) { return $output; @@ -4810,15 +4814,6 @@ function notice ($message, $link='', $course=NULL, $adminroot='') { global $CFG, $SITE; $message = clean_text($message); - $link = clean_text($link); - - if (!$link) { - if (!empty($_SERVER['HTTP_REFERER'])) { - $link = $_SERVER['HTTP_REFERER']; - } else { - $link = $CFG->wwwroot .'/'; - } - } print_box($message, 'generalbox', 'notice'); print_continue($link); -- 2.39.5