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 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.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')) {
48 // Add stylesheet for installation
49 if ((isInstallationPhase())) $stylesList[] = 'install.css';
51 // When no CSS output-mode is set, set it to file-output
52 if (!isConfigEntrySet('css_php')) setConfigEntry('css_php', 'FILE');
54 // Output CSS files or content or link to css.php ?
55 if ((isCssOutputMode()) || (getConfig('css_php') == 'DIRECT')) {
57 $stylesList = merge_array($stylesList, getExtensionCssFiles());
60 $basePath = sprintf("%stheme/%s/css/", getPath(), getCurrentTheme());
62 // Output inclusion lines
63 foreach ($stylesList as $value) {
64 // Only include found CSS files (to reduce 404 requests)
65 $FQFN = $basePath . $value;
67 // Do include only existing files and whose are not empty
68 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
69 switch (getConfig('css_php')) {
70 case 'DIRECT': // Just link them (unsupported)
71 $GLOBALS['page_header'] .= '<link rel="stylesheet" type="text/css" href="{%url=theme/' . getCurrentTheme() . '/' . $value . '%}" />';
74 case 'FILE': // Output contents
75 $GLOBALS['page_header'] .= readFromFile($FQFN);
78 default: // Invalid mode!
79 debug_report_bug(__FILE__, __LINE__, sprintf("Invalid css_php value %s detected.", getConfig('css_php')));
84 } elseif ((isHtmlOutputMode()) || (getConfig('css_php') == 'INLINE')) {
86 $stylesList = merge_array($stylesList, getExtensionCssFiles());
89 $basePath = sprintf("%stheme/%s/css/", getPath(), getCurrentTheme());
91 // Output inclusion lines
93 foreach ($stylesList as $value) {
94 // Only include found CSS files (to reduce 404 requests)
95 $FQFN = $basePath . $value;
97 // Do include only existing files and whose are not empty
98 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
100 $OUT .= readFromFile($FQFN);
105 $GLOBALS['page_header'] .= loadTemplate('css_inline', true, $OUT);
107 // Now we load all CSS files from css.php!
108 $OUT = '<link rel="stylesheet" type="text/css" href="{%url=css.php';
109 if ((isInstallationPhase())) {
110 // Default theme first
111 $newTheme = 'default';
112 if (isGetRequestParameterSet('theme')) $newTheme = getRequestParameter('theme');
113 if (isPostRequestParameterSet('theme')) $newTheme = secureString(postRequestParameter('theme'));
114 $OUT .= '?theme=' . $newTheme . '&installing=1';
116 // Add SVN revision to bypass caching problems
117 $OUT .= '?rev=' . getCurrentRepositoryRevision();
121 $GLOBALS['page_header'] .= $OUT . '%}{%ext,version=sql_patches%}" />';