[ Index ]
 

Code source de Seagull 0.6.1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/themes/default/css/ -> style.php (source)

   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  
  40      // PHP Stylesheet caching headers.
  41      // Adapted from PEAR HTTP_Header_Cache authored by Wolfram Kriesing <wk@visionp.de>
  42      // Adapted by John Dell
  43  
  44      ////////////////////////////   DO NOT MODIFY   /////////////////////////////
  45  
  46      require_once  '../../helpers.php';
  47  
  48      // send default cacheing headers and content type
  49      header('Pragma: cache');
  50      header('Cache-Control: public');
  51      header('Content-Type: text/css');
  52  
  53      $modTimes = array();
  54  
  55      if (is_file($tmp = './vars.php')) {
  56          $modTimes['vars'] = filemtime($tmp);
  57      }
  58      if (is_file($tmp = './core.php')) {
  59          $modTimes['core'] = filemtime($tmp);
  60      }
  61      if (is_file($tmp = './blockStyle.php')) {
  62          $modTimes['blockStyle'] = filemtime($tmp);
  63      }
  64      $frmNavStyleSheet = @$_REQUEST['navStylesheet'];
  65      if (is_file($navStyleSheet = realpath("./$frmNavStyleSheet.nav.php"))) {
  66          $modTimes['navigation'] = filemtime($navStyleSheet);
  67      }
  68      $frmModuleName = @$_REQUEST['moduleName'];
  69      $frmIsSymlink  = @$_REQUEST['isSymlink'];
  70  
  71      if ($frmIsSymlink) {
  72          if (is_file($moduleName = realpath("../../../$frmModuleName/css/$frmModuleName.php"))) {
  73              $modTimes['module'] = filemtime($moduleName);
  74          }
  75      } else {
  76          if (is_file($moduleName = realpath("./$frmModuleName.php"))) {
  77              $modTimes['module'] = filemtime($moduleName);
  78          }
  79      }
  80  
  81      // Get last modified time of file
  82      $modTimes['shared'] = getlastmod();
  83  
  84      // exit out of script if cached on client
  85      if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
  86          $cliModTime = dateToTimestamp($_SERVER['HTTP_IF_MODIFIED_SINCE']);
  87          if (max($modTimes) <= $cliModTime) {
  88              header('HTTP/1.x 304 Not Modified');
  89              exit;
  90          }
  91      }
  92  
  93      /* send last modified date of file to client so it will have date for server
  94       * on next request.
  95       * Technically we could just send the current time (as PEAR does) rather
  96       * than the actual modify time of the file since either way would get the
  97       * correct behavior, but since we already have the actual modified time of
  98       * the file, we'll just use that.
  99       */
 100      $srvModDate = timestampToDate(max($modTimes));
 101      header("Last-Modified: $srvModDate");
 102  
 103      //  get base url for css classes that include images
 104      $path = dirname($_SERVER['PHP_SELF']);
 105      $aPath = explode('/', $path);
 106      $aPath = array_filter($aPath);
 107      array_pop($aPath);
 108      $baseUrl = join('/', $aPath);
 109      array_pop($aPath);
 110      array_pop($aPath);
 111  
 112      $webRootUrl = join('/', $aPath);
 113      $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']  == 'on')
 114          ? 'https' : 'http';
 115      $baseUrl = $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' . $baseUrl;
 116      $webRootUrl = $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' . $webRootUrl;
 117      require_once  './vars.php';
 118      require_once  './core.php';
 119      require_once  './blockStyle.php';
 120      if (isset($modTimes['navigation'])) {
 121          require_once realpath("./$frmNavStyleSheet.nav.php");
 122      }
 123      if (isset($modTimes['module'])) {
 124          if ($frmIsSymlink) {
 125              require_once realpath("../../../$frmModuleName/css/$frmModuleName.php");
 126          } else {
 127              require_once realpath("./$frmModuleName.php");
 128          }
 129      }
 130  
 131      // copied from PEAR HTTP Header.php (comments stripped)
 132      // Author: Wolfram Kriesing <wk@visionp.de>
 133      // Changes: mktime() to gmmktime() to make work in timezones other than GMT
 134      function dateToTimestamp($date)
 135      {
 136          $months = array_flip(array('Jan','Feb','Mar','Apr','May','Jun',
 137              'Jul','Aug','Sep','Oct','Nov','Dec'));
 138          preg_match('~[^,]*,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+).*~', $date,
 139              $splitDate);
 140          $timestamp = @gmmktime($splitDate[4], $splitDate[5], $splitDate[6],
 141              $months[$splitDate[2]]+1, $splitDate[1], $splitDate[3]);
 142          return $timestamp;
 143      }
 144  
 145      // copied from PEAR HTTP.php Date function (comments stripped)
 146      // Author: Stig Bakken <ssb@fast.no>
 147      function timestampToDate($time)
 148      {
 149          if (ini_get("y2k_compliance") == true) {
 150              return gmdate("D, d M Y H:i:s \G\M\T", $time);
 151          } else {
 152              return gmdate("F, d-D-y H:i:s \G\M\T", $time);
 153          }
 154      }
 155  ?>


Généré le : Fri Mar 30 01:27:52 2007 par Balluche grâce à PHPXref 0.7