This file is indexed.

/usr/share/php/Icinga/Web/StyleSheet.php is in php-icinga 2.1.0-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */

namespace Icinga\Web;

use Icinga\Application\Icinga;
use Icinga\Web\FileCache;
use Icinga\Web\LessCompiler;

class StyleSheet
{
    protected static $lessFiles = array(
        '../application/fonts/fontello-ifont/css/ifont-embedded.css',
        'css/vendor/normalize.css',
        'css/vendor/tipsy.css',
        'css/icinga/base.less',
        'css/icinga/colors.less',
        'css/icinga/badges.less',
        'css/icinga/mixins.less',
        'css/icinga/grid.less',
        'css/icinga/nav.less',
        'css/icinga/main.less',
        'css/icinga/animation.less',
        'css/icinga/layout-colors.less',
        'css/icinga/layout-structure.less',
        'css/icinga/menu.less',
        'css/icinga/header-elements.less',
        'css/icinga/footer-elements.less',
//        'css/icinga/main-content.less',
        'css/icinga/tabs.less',
        'css/icinga/forms.less',
        'css/icinga/setup.less',
        'css/icinga/widgets.less',
        'css/icinga/login.less',
        'css/icinga/about.less',
        'css/icinga/controls.less',
        'css/icinga/dev.less',
//        'css/icinga/logo.less',
        'css/icinga/spinner.less',
        'css/icinga/compat.less'
    );

    public static function compileForPdf()
    {
        self::checkPhp();
        $less = new LessCompiler();
        $basedir = Icinga::app()->getBootstrapDirectory();
        foreach (self::$lessFiles as $file) {
            $less->addFile($basedir . '/' . $file);
        }
        $less->addLoadedModules();
        $less->addFile($basedir . '/css/pdf/pdfprint.less');
        return $less->compile();
    }

    public static function sendMinified()
    {
        self::send(true);
    }

    protected static function fixModuleLayoutCss($css)
    {
        return preg_replace(
            '/(\.icinga-module\.module-[^\s]+) (#layout\.[^\s]+)/m',
            '\2 \1',
            $css
        );
    }

    protected static function checkPhp()
    {
        // PHP had a rather conservative PCRE backtrack limit unless 5.3.7
        if (version_compare(PHP_VERSION, '5.3.7') <= 0) {
            ini_set('pcre.backtrack_limit', 1000000);
        }
    }

    public static function send($minified = false)
    {
        self::checkPhp();
        $app = Icinga::app();
        $basedir = $app->getBootstrapDirectory();
        foreach (self::$lessFiles as $file) {
            $lessFiles[] = $basedir . '/' . $file;
        }
        $files = $lessFiles;
        foreach ($app->getModuleManager()->getLoadedModules() as $name => $module) {
            if ($module->hasCss()) {
                foreach ($module->getCssFiles() as $path) {
                    if (file_exists($path)) {
                        $files[] = $path;
                    }
                }
            }
        }

        if ($etag = FileCache::etagMatchesFiles($files)) {
            header("HTTP/1.1 304 Not Modified");
            return;
        } else {
            $etag = FileCache::etagForFiles($files);
        }
        header('Cache-Control: public');
        header('ETag: "' . $etag . '"');
        header('Content-Type: text/css');

        $min = $minified ? '.min' : '';
        $cacheFile = 'icinga-' . $etag . $min . '.css';
        $cache = FileCache::instance();
        if ($cache->has($cacheFile)) {
            $cache->send($cacheFile);
            return;
        }

        $less = new LessCompiler();
        $less->disableExtendedImport();
        foreach ($lessFiles as $file) {
            $less->addFile($file);
        }
        $less->addLoadedModules();
        if ($minified) {
            $less->compress();
        }
        $out = self::fixModuleLayoutCss($less->compile());
        $cache->store($cacheFile, $out);
        echo $out;
    }
}