Commit:    9098464a05bab5ebb92dfad27c7cee77e2663965
Author:    Hannes Magnusson <[email protected]>         Fri, 6 Dec 2013 
15:16:13 -0800
Parents:   b040133138dd0a8c95e77eef2c7bcb841dba1c82
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=9098464a05bab5ebb92dfad27c7cee77e2663965

Log:
Remove an used file & improve the logo scale

Changed paths:
  A  images/logo.php
  M  include/header.inc
  D  styles/dynamic.php


Diff:
diff --git a/images/logo.php b/images/logo.php
new file mode 100644
index 0000000..14b8841
--- /dev/null
+++ b/images/logo.php
@@ -0,0 +1,60 @@
+<?php
+
+function imgheader($filename) {
+    $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
+    switch($ext) {
+        case "gif":
+            $hdr = "image/gif";
+            break;
+        case "png":
+            $hdr = "image/png";
+            break;
+        case "jpg":
+        case "jpeg":
+            $hdr = "image/jpeg";
+            break;
+        default:
+            return false;
+    }
+    header("Content-Type: " . $hdr);
+}
+
+$now = $_SERVER["REQUEST_TIME"];
+$logos = array(
+    "./logos/[email protected]",
+);
+
+/* xmas season, december and the first week of January */
+$day = date("z", $_SERVER["REQUEST_TIME"]) - date("L", $now);
+if ($day < 7 || 365-$day < 32) {
+    $logos[] = "./php_snow_2008.gif";
+}
+
+/* Every 60seconds.. give the elephpant a chance */
+if ($now % 60 == 10) {
+    $logos[] = "./ele-running.gif";
+}
+
+
+shuffle($logos);
+$logo = array_pop($logos);
+
+
+if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
+    $last = strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]);
+
+    /* Use the same logo for a day */
+    if (strtotime("+1 day", $last) > $now) {
+        header("HTTP/1.1 304 Not Modified");
+        exit;
+    }
+}
+
+$future = strtotime("+1 day", $now);
+$tsstring = gmdate("D, d M Y H:i:s ", $now) . "GMT";
+header("Last-Modified: " . $tsstring);
+header("Expires: " . date(DATE_RSS, $future));
+imgheader($logo);
+readfile($logo);
+
+
diff --git a/include/header.inc b/include/header.inc
index 0b904b4..b72d85f 100755
--- a/include/header.inc
+++ b/include/header.inc
@@ -69,7 +69,7 @@ if (isset($shortname) && $shortname) {
   <div class="navbar-inner">
     <div class="container">
       <div class="row-fluid">
-        <a href="/" class="brand"><img src="/images/logos/[email protected]" 
width="48" height="24" alt="php"></a>
+        <a href="/" class="brand"><img src="/images/logo.php" width="48" 
height="24" alt="php"></a>
         <div id="mainmenu-toggle-overlay"></div>
         <input type="checkbox" id="mainmenu-toggle">
         <ul class="nav">
diff --git a/styles/dynamic.php b/styles/dynamic.php
deleted file mode 100644
index 329ba64..0000000
--- a/styles/dynamic.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php /* vim: set filetype=css : */ 
-$str = date(DATE_RSS, strtotime("+1 hour"));
-header("Expires: $str");
-header("Content-Type: text/css");
-?>
-<?php if (rand(1, 9000) == 1337): ?>
-#headhome {
-    background: url(/images/ele-running.gif) no-repeat -10px;
-    position: relative;
-    z-index: 1;
-}
-#headhome a {
-    background: none;
-}
-<?php endif ?>
-


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to