includes/functions.php
changeset 81 d7fc25acd3f3
parent 80 cb7dde69c301
child 82 03c7f5ec1e4c
--- a/includes/functions.php	Wed Aug 01 13:39:27 2007 -0400
+++ b/includes/functions.php	Sun Aug 05 15:58:50 2007 -0400
@@ -2680,15 +2680,19 @@
   //
   if ( $do_gzip && function_exists('ob_gzhandler') )
   {
-    //
-    // Copied from phpBB, which was in turn borrowed from php.net
-    //
     $gzip_contents = ob_get_contents();
     ob_end_clean();
     
-    header('Content-encoding: gzip');
-    $gzip_contents = ob_gzhandler($gzip_contents);
-    echo $gzip_contents;
+    $return = ob_gzhandler($gzip_contents);
+    if ( $return )
+    {
+      header('Content-encoding: gzip');
+      echo $gzip_contents;
+    }
+    else
+    {
+      echo $gzip_contents;
+    }
   }
 }
 
@@ -2763,8 +2767,9 @@
     // fix for firefox issue
     $js = preg_replace('/\};([\s]*)(else|\))/i', '}\\2', $js);
     
+    $replacement = "<script{$jscript[1][$i]}>/* <![CDATA[ */ $js /* ]]> */</script>";
     // apply changes
-    $html = str_replace($jscript[0][$i], "<script{$jscript[1][$i]}>$js</script>", $html);
+    $html = str_replace($jscript[0][$i], $replacement, $html);
   }
   
   // Which tags to strip - you can change this if needed
@@ -2797,11 +2802,11 @@
   $size_after = strlen($html);
   
   // Tell snoopish users what's going on
-  $html = str_replace('<html>', "\n".'<!-- NOTE: Enano has performed an HTML optimization routine on the HTML you see here. This is to enhance page loading speeds.
+  $html = str_replace('<html', "\n".'<!-- NOTE: Enano has performed an HTML optimization routine on the HTML you see here. This is to enhance page loading speeds.
      To view the uncompressed source of this page, add the "nocompress" parameter to the URI of this page: index.php?title=Main_Page&nocompress or Main_Page?nocompress'."
      Size before compression: $size_before bytes
      Size after compression:  $size_after bytes
-     -->\n<html>", $html);
+     -->\n<html", $html);
   return $html;
 }