The branch, master has been updated via f3f41cbe78693781a9874c59a8ae736d324797bd (commit) from c0fed158771dbc443547835c52598471fe9031af (commit)
- Log ----------------------------------------------------------------- commit f3f41cbe78693781a9874c59a8ae736d324797bd Author: Marc Delisle marc@infomarc.info Date: Sat Apr 17 13:51:08 2010 -0400
remove one instance of inline js
-----------------------------------------------------------------------
Summary of changes: js/cross_framing_protection.js | 20 ++++++++++++++++++++ libraries/header_scripts.inc.php | 18 +----------------- 2 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 js/cross_framing_protection.js
diff --git a/js/cross_framing_protection.js b/js/cross_framing_protection.js new file mode 100644 index 0000000..e69d162 --- /dev/null +++ b/js/cross_framing_protection.js @@ -0,0 +1,20 @@ +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * Conditionally called from libraries/header_scripts.inc.php + * if third-party framing is not allowed + * + */ + +try { + // can't access this if on a different domain + var topdomain = top.document.domain; + // double-check just for sure + if (topdomain != self.document.domain) { + alert("Redirecting..."); + top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1)); + } +} +catch(e) { + alert("Redirecting... (error: " + e); + top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1)); +} diff --git a/libraries/header_scripts.inc.php b/libraries/header_scripts.inc.php index bcb6528..6a4aacb 100644 --- a/libraries/header_scripts.inc.php +++ b/libraries/header_scripts.inc.php @@ -18,23 +18,7 @@ require_once './libraries/common.inc.php'; // Cross-framing protection if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) { ?> -<script type="text/javascript"> -//<![CDATA[ -try { - // can't access this if on a different domain - var topdomain = top.document.domain; - // double-check just for sure - if (topdomain != self.document.domain) { - alert("Redirecting..."); - top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1)); - } -} -catch(e) { - alert("Redirecting... (error: " + e); - top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1)); -} -//]]> -</script> +<script src="./js/cross_framing_protection.js" type="text/javascript"></script> <?php } // generate title
hooks/post-receive