Beehive PHP Cross Reference Discussion Forums

Source: /font_size.php - 65 lines - 2067 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*======================================================================
   4  Copyright Project Beehive Forum 2002
   5  
   6  This file is part of Beehive Forum.
   7  
   8  Beehive Forum is free software; you can redistribute it and/or modify
   9  it under the terms of the GNU General Public License as published by
  10  the Free Software Foundation; either version 3 of the License, or
  11  (at your option) any later version.
  12  
  13  Beehive Forum is distributed in the hope that it will be useful,
  14  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  GNU General Public License for more details.
  17  
  18  You should have received a copy of the GNU General Public License
  19  along with Beehive; if not, write to the Free Software
  20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  21  USA
  22  ======================================================================*/
  23  
  24  // Bootstrap
  25  require_once  'boot.php';
  26  
  27  // Required includes
  28  require_once  BH_INCLUDE_PATH . 'cache.inc.php';
  29  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  30  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  31  // End Required includes
  32  
  33  // Guests can't do different font sizes.
  34  if (!session::logged_in()) exit;
  35  
  36  // User's font size.
  37  if (isset($_SESSION['FONT_SIZE']) && is_numeric($_SESSION['FONT_SIZE'])) {
  38      $font_size = max(min($_SESSION['FONT_SIZE'], 15), 5);
  39  } else {
  40      $font_size = 10;
  41  }
  42  
  43  // Make sure the font size is positive and an integer.
  44  $font_size = floor(abs($font_size));
  45  
  46  // Output in text/css.
  47  header("Content-type: text/css; charset=UTF-8");
  48  
  49  // Check the cache
  50  cache_check_last_modified(time(), md5($font_size . $_SESSION['UID'] . $_SESSION['LOGON']));
  51  
  52  // Check the user's font size.
  53  if ($font_size < 5) $font_size = 5;
  54  if ($font_size > 15) $font_size = 15;
  55  
  56  // Array of different font sizes
  57  $css_selectors = array(
  58      'body' => 0.8,
  59      '.navpage' => 0.65
  60  );
  61  
  62  // Output the CSS
  63  foreach ($css_selectors as $css_selector => $css_font_ratio) {
  64      printf("%s {\n    font-size: %d%%;\n}\n\n", $css_selector, $font_size * $css_font_ratio * 10);
  65  }

title

Description

title

Description

title

Description

title

title

Body