2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 08/29/2003 *
4 * =================== Last change: 12/03/2004 *
6 * -------------------------------------------------------------------- *
7 * File : stylesheet.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Stylesheets are stored here *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Style-Sheets werden hier abgelegt *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
49 // Add stylesheet for installation
50 if ((isInstaller())) {
51 array_push($stylesList, 'install.css');
54 // When no CSS output-mode is set, set it to file-output
55 if (!isConfigEntrySet('css_php')) {
56 setConfigEntry('css_php', 'FILE');
60 $currentTheme = getCurrentTheme();
62 // Has the theme changed?
63 if ($currentTheme != getSession('mailer_theme')) {
65 setMailerTheme($currentTheme);
68 // Output CSS files or content or link to css.php ?
69 if ((isCssOutputMode()) || (getCssPhp() == 'DIRECT')) {
71 $stylesList = merge_array($stylesList, getExtensionCssFiles());
74 $basePath = getBasePathFromTheme($currentTheme);
76 // Output inclusion lines
77 foreach ($stylesList as $value) {
78 // Only include found CSS files (to reduce 404 requests)
79 $FQFN = $basePath . '/' . $value;
81 // Do include only existing files and whose are not empty
82 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
83 switch (getCssPhp()) {
84 case 'DIRECT': // Just link them (unsupported)
85 $GLOBALS['__page_header'] .= '<link rel="stylesheet" type="text/css" href="{%url=theme/' . getCurrentTheme() . '/' . $value . '%}" />';
88 case 'FILE': // Output contents
89 $GLOBALS['__page_header'] .= readFromFile($FQFN);
92 default: // Invalid mode!
93 reportBug(__FILE__, __LINE__, sprintf('Invalid css_php value %s detected.', getCssPhp()));
98 } elseif ((isHtmlOutputMode()) || (getCssPhp() == 'INLINE')) {
100 $stylesList = merge_array($stylesList, getExtensionCssFiles());
102 // Generate base path
103 $basePath = getBasePathFromTheme(getCurrentTheme());
105 // Output inclusion lines
107 foreach ($stylesList as $value) {
108 // Only include found CSS files (to reduce 404 requests)
109 $FQFN = $basePath . '/' . $value;
111 // Do include only existing files and whose are not empty
112 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
114 $OUT .= readFromFile($FQFN);
119 $GLOBALS['__page_header'] .= loadTemplate('css_inline', TRUE, $OUT);
121 // Now we load all CSS files from css.php!
122 $OUT = '<link rel="stylesheet" type="text/css" href="{%url=css.php';
123 if ((isInstaller())) {
124 // Default theme first
125 $OUT .= '?theme=' . getCurrentTheme() . '&installing=1';
127 // Add SVN revision to bypass caching problems
128 $OUT .= '?rev=' . getCurrentRepositoryRevision();
132 $GLOBALS['__page_header'] .= $OUT . '%}{%ext,version=sql_patches%}" />';