]> git.joonet.de Git - adminer.git/commitdiff
External stylesheet
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 21 Jan 2008 16:28:48 +0000 (16:28 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 21 Jan 2008 16:28:48 +0000 (16:28 +0000)
Last-Modified header for files

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@369 7c3ca157-0c34-0410-bff1-cbf682f78f5c

_compile.php

index df32f5c085a74e40463f22d4c331c987ee83632c..88a5278feca0d79a019ed428b1ec21ee6687a4af 100644 (file)
@@ -82,10 +82,32 @@ if ($_COOKIE["lang"]) {
        $file = str_replace("<?php switch_lang(); ?>\n", "", $file);
        $file = str_replace('<?php echo $LANG; ?>', $_COOKIE["lang"], $file);
 }
-$file = str_replace("favicon.ico", '<?php echo preg_replace("~\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?favicon="; ?>', $file);
-$file = str_replace("arrow.gif", '" . preg_replace("~\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?gif=arrow', $file);
-$file = str_replace('error_reporting(E_ALL & ~E_NOTICE);', "error_reporting(E_ALL & ~E_NOTICE);\nif (isset(\$_GET['favicon'])) {\n\theader('Content-Type: image/x-icon');\n\techo base64_decode('" . base64_encode(file_get_contents("favicon.ico")) . "');\n\texit;\n} elseif (isset(\$_GET['gif'])) {\n\theader('Content-Type: image/gif');\n\techo base64_decode('" . base64_encode(file_get_contents("arrow.gif")) . "');\n\texit;\n}", $file);
-$file = str_replace('<link rel="stylesheet" type="text/css" href="default.css" />', "<style type='text/css'>\n" . file_get_contents("default.css") . "</style>", $file);
+$file = str_replace("favicon.ico", '<?php echo preg_replace("~\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?file=favicon.ico"; ?>', $file);
+$file = str_replace("default.css", '<?php echo preg_replace("~\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?file=default.css"; ?>', $file);
+$file = str_replace("arrow.gif", '" . preg_replace("~\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?file=arrow.gif', $file);
+$file = str_replace('error_reporting(E_ALL & ~E_NOTICE);', 'error_reporting(E_ALL & ~E_NOTICE);
+if (isset($_GET["file"])) {
+       if ($_SERVER["HTTP_IF_MODIFIED_SINCE"] && ' . time() . ' <= strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
+               header("HTTP/1.1 304 Not Modified");
+       } else {
+               header("Last-Modified: " . gmdate("D, d M Y H:i:s", ' . time() . ') . " GMT");
+               switch ($_GET["file"]) {
+                       case "favicon.ico":
+                               header("Content-Type: image/x-icon");
+                               echo base64_decode("' . base64_encode(file_get_contents("favicon.ico")) . '");
+                       break;
+                       case "default.css":
+                               header("Content-Type: text/css");
+                               ?>' . file_get_contents("default.css") . '<?php
+                       break;
+                       default:
+                               header("Content-Type: image/gif");
+                               echo base64_decode("' . base64_encode(file_get_contents("arrow.gif")) . '");
+                       break;
+               }
+       }
+       exit;
+}', $file);
 $file = php_shrink($file);
 fwrite(fopen($filename, "w"), $file);
 echo "$filename created.\n";