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 * -------------------------------------------------------------------- *
13 * Copyright (c) 2003 - 2009 by Roland Haeder *
14 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
15 * For more information visit: http://mxchange.org *
17 * This program is free software; you can redistribute it and/or modify *
18 * it under the terms of the GNU General Public License as published by *
19 * the Free Software Foundation; either version 2 of the License, or *
20 * (at your option) any later version. *
22 * This program is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
25 * GNU General Public License for more details. *
27 * You should have received a copy of the GNU General Public License *
28 * along with this program; if not, write to the Free Software *
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
31 ************************************************************************/
33 // Some security stuff...
34 if (!defined('__SECURITY')) {
44 // Add stylesheet for installation
45 if ((isInstaller())) {
46 array_push($stylesList, 'install.css');
49 // When no CSS output-mode is set, set it to file-output
50 if (!isConfigEntrySet('css_php')) {
51 setConfigEntry('css_php', 'FILE');
55 $currentTheme = getCurrentTheme();
57 // Has the theme changed?
58 if ($currentTheme != getSession('mailer_theme')) {
60 setMailerTheme($currentTheme);
63 // Output CSS files or content or link to css.php ?
64 if ((isCssOutputMode()) || (getCssPhp() == 'DIRECT')) {
66 $stylesList = merge_array($stylesList, getExtensionCssFiles());
69 $basePath = getBasePathFromTheme($currentTheme);
71 // Output inclusion lines
72 foreach ($stylesList as $value) {
73 // Only include found CSS files (to reduce 404 requests)
74 $FQFN = $basePath . '/' . $value;
76 // Do include only existing files and whose are not empty
77 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
78 switch (getCssPhp()) {
79 case 'DIRECT': // Just link them (unsupported)
80 $GLOBALS['__page_header'] .= '<link rel="stylesheet" type="text/css" href="{%url=theme/' . getCurrentTheme() . '/' . $value . '%}" />';
83 case 'FILE': // Output contents
84 $GLOBALS['__page_header'] .= removeDeprecatedComment(readFromFile($FQFN));
87 default: // Invalid mode!
88 reportBug(__FILE__, __LINE__, sprintf('Invalid css_php value %s detected.', getCssPhp()));
93 } elseif ((isHtmlOutputMode()) || (getCssPhp() == 'INLINE')) {
95 $stylesList = merge_array($stylesList, getExtensionCssFiles());
98 $basePath = getBasePathFromTheme(getCurrentTheme());
100 // Output inclusion lines
102 foreach ($stylesList as $value) {
103 // Only include found CSS files (to reduce 404 requests)
104 $FQFN = $basePath . '/' . $value;
106 // Do include only existing files and whose are not empty
107 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
109 $OUT .= readFromFile($FQFN);
114 $GLOBALS['__page_header'] .= loadTemplate('css_inline', TRUE, removeDeprecatedComment($OUT));
116 // Now we load all CSS files from css.php!
117 $OUT = '<link rel="stylesheet" type="text/css" href="{%url=css.php';
119 if ((isInstaller())) {
120 // Default theme first
121 $OUT .= '?theme=' . getCurrentTheme() . '&installing=1';
123 // Add version + a number to bypass caching problems
124 $OUT .= '?ver={?FULL_VERSION?}&cb={?CACHE_BUSTER?}';
128 $GLOBALS['__page_header'] .= $OUT . '%}{%ext,version=sql_patches%}" />';