[ Index ]

PHP Cross Reference of MyBB 1.8.37

title

Body

[close]

/ -> css.php (source)

   1  <?php
   2  /**
   3   * MyBB 1.8
   4   * Copyright 2014 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://www.mybb.com
   7   * License: http://www.mybb.com/about/license
   8   *
   9   */
  10  
  11  define("IN_MYBB", 1);
  12  define("NO_ONLINE", 1);
  13  define('THIS_SCRIPT', 'css.php');
  14  
  15  require_once  "./inc/init.php";
  16  require_once MYBB_ROOT . $config['admin_dir'] . '/inc/functions_themes.php';
  17  
  18  $stylesheets = $mybb->get_input('stylesheet', MyBB::INPUT_ARRAY);
  19  
  20  if(!empty($stylesheets))
  21  {
  22      $stylesheet_list = implode(', ', array_map('intval', $stylesheets));
  23  
  24      $content = '';
  25      $prefix = TABLE_PREFIX;
  26  
  27      switch($db->type)
  28      {
  29          case 'pgsql':
  30          case 'sqlite':
  31              $sql = <<<SQL
  32  SELECT stylesheet FROM {$prefix}themestylesheets
  33    WHERE sid IN ({$stylesheet_list})
  34    ORDER BY CASE sid\n
  35  SQL;
  36  
  37              $i = 0;
  38              foreach($stylesheets as $sid)
  39              {
  40                  $sid = (int) $sid;
  41  
  42                  $sql .= "WHEN {$sid} THEN {$i}\n";
  43                  $i++;
  44              }
  45  
  46              $sql .= 'END;';
  47              break;
  48          default:
  49              $sql = <<<SQL
  50  SELECT stylesheet FROM {$prefix}themestylesheets
  51    WHERE sid IN ({$stylesheet_list})
  52    ORDER BY FIELD(sid, {$stylesheet_list});
  53  SQL;
  54              break;
  55      }
  56  
  57      $query = $db->query($sql);
  58  
  59      while($row = $db->fetch_array($query))
  60      {
  61          $stylesheet = $row['stylesheet'];
  62  
  63          $plugins->run_hooks('css_start', $stylesheet);
  64  
  65          if(!empty($mybb->settings['minifycss']))
  66          {
  67              $stylesheet = minify_stylesheet($stylesheet);
  68          }
  69  
  70          $plugins->run_hooks('css_end', $stylesheet);
  71  
  72          $content .= $stylesheet;
  73      }
  74  
  75      header('Content-type: text/css');
  76      echo $content;
  77  }
  78  exit;


2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref