moodle_setlocale();
/// send mime type and encoding
- @header('Content-Type: text/plain; charset='.current_charset());
+ if (check_browser_version('MSIE')) {
+ //ugly IE hack to work around downloading instead of viewing
+ @header('Content-Type: text/html; charset='.current_charset());
+ echo "<xmp>"; //<pre> is not good enough for us here
+ } else {
+ //send proper plaintext header
+ @header('Content-Type: text/plain; charset='.current_charset());
+ }
/// Start output log
$difftime = microtime_diff($starttime, microtime());
mtrace("Execution took ".$difftime." seconds");
+/// finishe the IE hack
+ if (check_browser_version('MSIE')) {
+ echo "</xmp>";
+ }
+
?>
* @return bool
*/
function check_browser_version($brand='MSIE', $version=5.5) {
- $agent = $_SERVER['HTTP_USER_AGENT'];
-
- if (empty($agent)) {
+ if (empty($_SERVER['HTTP_USER_AGENT'])) {
return false;
}
+ $agent = $_SERVER['HTTP_USER_AGENT'];
+
switch ($brand) {
case 'Firefox': /// Mozilla Firefox browsers