From d21a5865cfff4010f4107b8c8ef8dfac72ef08a8 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 4 Jan 2007 04:57:50 +0000 Subject: [PATCH] Added CFG->frametarget (defined by frametarget()) MDL-8050 --- lib/setup.php | 3 +++ lib/weblib.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/setup.php b/lib/setup.php index 6739b2fa037..01de893e7c3 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 099b14a6021..dc0054a1cd8 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: ?>