From: moodler Date: Thu, 4 Jan 2007 04:57:50 +0000 (+0000) Subject: Added CFG->frametarget (defined by frametarget()) MDL-8050 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d21a5865cfff4010f4107b8c8ef8dfac72ef08a8;p=moodle.git Added CFG->frametarget (defined by frametarget()) MDL-8050 --- diff --git a/lib/setup.php b/lib/setup.php index 6739b2fa03..01de893e7c 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -301,6 +301,9 @@ global $HTTPSPAGEREQUIRED; } $CFG->os = PHP_OS; +/// Set up default frame target string, based on $CFG->framename + $CFG->frametarget = frametarget(); + /// Setup cache dir for Smarty and others if (!file_exists($CFG->dataroot .'/cache')) { make_upload_directory('cache'); diff --git a/lib/weblib.php b/lib/weblib.php index 099b14a602..dc0054a1cd 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -5632,5 +5632,19 @@ function disable_debugging() { $CFG->debug = $CFG->debug | 0x80000000; // switch the sign bit in integer number ;-) } + +/** + * Returns string to add a frame attribute, if required + */ +function frametarget() { + global $CFG; + + if (empty($CFG->framename) or ($CFG->framename == '_top')) { + return ''; + } else { + return ' target="'.$CFG->framename.'" '; + } +} + // vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140: ?>