[ Index ] |
|
Code source de Seagull 0.6.1 |
1 <?php 2 /* Reminder: always indent with 4 spaces (no tabs). */ 3 // +---------------------------------------------------------------------------+ 4 // | Copyright (c) 2006, Demian Turner | 5 // | All rights reserved. | 6 // | | 7 // | Redistribution and use in source and binary forms, with or without | 8 // | modification, are permitted provided that the following conditions | 9 // | are met: | 10 // | | 11 // | o Redistributions of source code must retain the above copyright | 12 // | notice, this list of conditions and the following disclaimer. | 13 // | o Redistributions in binary form must reproduce the above copyright | 14 // | notice, this list of conditions and the following disclaimer in the | 15 // | documentation and/or other materials provided with the distribution. | 16 // | o The names of the authors may not be used to endorse or promote | 17 // | products derived from this software without specific prior written | 18 // | permission. | 19 // | | 20 // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 21 // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 22 // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 23 // | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 24 // | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 25 // | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 26 // | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 27 // | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 28 // | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 29 // | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 30 // | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 31 // | | 32 // +---------------------------------------------------------------------------+ 33 // | Seagull 0.6 | 34 // +---------------------------------------------------------------------------+ 35 // | style.php | 36 // +---------------------------------------------------------------------------+ 37 // | Author: John Dell <jdell@unr.edu> | 38 // +---------------------------------------------------------------------------+ 39 // $Id: style.php,v 1.85 2005/06/22 00:40:44 demian Exp $ 40 41 // PHP Stylesheet caching headers. 42 // Adapted from PEAR HTTP_Header_Cache authored by Wolfram Kriesing <wk@visionp.de> 43 // Adapted by John Dell 44 45 //////////////////////////// DO NOT MODIFY ///////////////////////////// 46 47 require_once '../../helpers.php'; 48 49 // send default cacheing headers and content type 50 header('Pragma: cache'); 51 header('Cache-Control: public'); 52 header('Content-Type: text/css'); 53 54 $modTimes = array(); 55 56 if (is_file($tmp = './vars.php')) { 57 $modTimes['vars'] = filemtime($tmp); 58 } 59 if (is_file($tmp = './core.php')) { 60 $modTimes['core'] = filemtime($tmp); 61 } 62 if (is_file($tmp = './blockStyle.php')) { 63 $modTimes['blockStyle'] = filemtime($tmp); 64 } 65 $frmNavStyleSheet = @$_REQUEST['navStylesheet']; 66 if (is_file($navStyleSheet = realpath("./$frmNavStyleSheet.nav.php"))) { 67 $modTimes['navigation'] = filemtime($navStyleSheet); 68 } 69 $frmModuleName = @$_REQUEST['moduleName']; 70 $frmIsSymlink = @$_REQUEST['isSymlink']; 71 72 if ($frmIsSymlink) { 73 if (is_file($moduleName = realpath("../../../$frmModuleName/css/$frmModuleName.php"))) { 74 $modTimes['module'] = filemtime($moduleName); 75 } 76 } else { 77 if (is_file($moduleName = realpath("./$frmModuleName.php"))) { 78 $modTimes['module'] = filemtime($moduleName); 79 } 80 } 81 82 // Get last modified time of file 83 $modTimes['shared'] = getlastmod(); 84 85 // exit out of script if cached on client 86 if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { 87 $cliModTime = dateToTimestamp($_SERVER['HTTP_IF_MODIFIED_SINCE']); 88 if (max($modTimes) <= $cliModTime) { 89 header('HTTP/1.x 304 Not Modified'); 90 exit; 91 } 92 } 93 94 /* send last modified date of file to client so it will have date for server 95 * on next request. 96 * Technically we could just send the current time (as PEAR does) rather 97 * than the actual modify time of the file since either way would get the 98 * correct behavior, but since we already have the actual modified time of 99 * the file, we'll just use that. 100 */ 101 $srvModDate = timestampToDate(max($modTimes)); 102 header("Last-Modified: $srvModDate"); 103 104 // get form context (submitted or not) 105 $isFormSubmitted = (isset($_REQUEST['isFormSubmitted']) && $_REQUEST['isFormSubmitted'] == "1") 106 ? true 107 : false; 108 109 // get base url for css classes that include images 110 $path = dirname($_SERVER['PHP_SELF']); 111 $aPath = explode('/', $path); 112 $aPath = array_filter($aPath); 113 array_pop($aPath); 114 $baseUrl = join('/', $aPath); 115 $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') 116 ? 'https' : 'http'; 117 $baseUrl = $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' . $baseUrl; 118 119 require_once './vars.php'; 120 require_once './core.php'; 121 require_once './blockStyle.php'; 122 if (isset($modTimes['navigation'])) { 123 require_once realpath("./$frmNavStyleSheet.nav.php"); 124 } 125 if (isset($modTimes['module'])) { 126 if ($frmIsSymlink) { 127 require_once realpath("../../../$frmModuleName/css/$frmModuleName.php"); 128 } else { 129 require_once realpath("./$frmModuleName.php"); 130 } 131 } 132 133 // copied from PEAR HTTP Header.php (comments stripped) 134 // Author: Wolfram Kriesing <wk@visionp.de> 135 // Changes: mktime() to gmmktime() to make work in timezones other than GMT 136 function dateToTimestamp($date) 137 { 138 $months = array_flip(array('Jan','Feb','Mar','Apr','May','Jun', 139 'Jul','Aug','Sep','Oct','Nov','Dec')); 140 preg_match('~[^,]*,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+).*~', $date, 141 $splitDate); 142 $timestamp = @gmmktime($splitDate[4], $splitDate[5], $splitDate[6], 143 $months[$splitDate[2]]+1, $splitDate[1], $splitDate[3]); 144 return $timestamp; 145 } 146 147 // copied from PEAR HTTP.php Date function (comments stripped) 148 // Author: Stig Bakken <ssb@fast.no> 149 function timestampToDate($time) 150 { 151 if (ini_get("y2k_compliance") == true) { 152 return gmdate("D, d M Y H:i:s \G\M\T", $time); 153 } else { 154 return gmdate("F, d-D-y H:i:s \G\M\T", $time); 155 } 156 } 157 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 30 01:27:52 2007 | par Balluche grâce à PHPXref 0.7 |