This is a first attempt to make moodle frame safe.

I've added the variable CFG->main_frame to config-dist.php, and replaced _top
targets with the variable in all the php files.  HTML files, like those in the
documentation, have not been modified, as they are not (yet) parsed.

The variable should probably get moved into the config table, and get some
documentation.

I've also included, but commented out, a slight change in weblib.php, which
would guarantee that messages would be seen before redirecting the user (unless
delay intentionally set to 0 when redirect is used).
This commit is contained in:
gregb_cc 2003-03-11 21:35:12 +00:00
parent 754b76fe65
commit 08b3606390
7 changed files with 39 additions and 23 deletions

View file

@ -364,7 +364,7 @@ function popup_form ($common, $options, $formname, $selected="", $nothing="choos
$nothing = get_string("choose")."...";
}
$output = "<FORM TARGET=_top NAME=$formname>";
$output = "<FORM TARGET=\"{$CFG->main_frame}\" NAME=$formname>";
$output .= "<SELECT NAME=popup onChange=\"top.location=document.$formname.popup.options[document.$formname.popup.selectedIndex].value\">\n";
if ($nothing != "") {
@ -653,10 +653,10 @@ function print_footer ($course=NULL) {
$course = get_site();
$homepage = true;
} else {
$homelink = "<A TARGET=_top HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>";
$homelink = "<A TARGET=\"{$CFG->main_frame}\" HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>";
}
} else {
$homelink = "<A TARGET=_top HREF=\"$CFG->wwwroot\">".get_string("home")."</A>";
$homelink = "<A TARGET=\"{$CFG->main_frame}\" HREF=\"$CFG->wwwroot\">".get_string("home")."</A>";
$course = get_site();
}
@ -690,7 +690,7 @@ function print_navigation ($navigation) {
if (! $site = get_site()) {
$site->shortname = get_string("home");;
}
echo "<A TARGET=_top HREF=\"$CFG->wwwroot/\">$site->shortname</A> -> $navigation";
echo "<A TARGET=\"{$CFG->main_frame}\" HREF=\"$CFG->wwwroot/\">$site->shortname</A> -> $navigation";
}
}
@ -1141,6 +1141,16 @@ function notice_yesno ($message, $linkyes, $linkno) {
print_simple_box_end();
}
/* This is an alternate beginning to the redirect function
function redirect($url, $message="", $delay=false) {
// Uses META tags to redirect the user, after printing a notice
if(!empty($message) && $delay == false):
$delay = 10;
else:
$delay = 0;
endif;
*/
function redirect($url, $message="", $delay=0) {
// Uses META tags to redirect the user, after printing a notice