2 /************************************************************************
3 * MXChange v0.2.1 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 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
49 // Add stylesheet for installation
50 if ((isInstallationPhase())) $STYLES[] = 'install.css';
52 // When no CSS output-mode is set, set it to file-output
53 if (!isConfigEntrySet('css_php')) setConfigEntry('css_php', 'FILE');
55 // Output CSS files or content or link to css.php ?
56 if ((getOutputMode() == 1) || (getConfig('css_php') == 'DIRECT')) {
58 $STYLES = merge_array($STYLES, getExtensionCssFiles());
61 $basePath = sprintf("%stheme/%s/css/", getConfig('PATH'), getCurrentTheme());
63 // Output inclusion lines
64 foreach ($STYLES as $value) {
65 // Only include found CSS files (to reduce 404 requests)
66 $FQFN = $basePath . $value;
68 // Do include only existing files and whose are not empty
69 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
70 switch (getConfig('css_php')) {
71 case 'DIRECT': // Just link them (unsupported)
72 outputHtml('<link rel="stylesheet" type="text/css" href="{?URL?}/theme/' . getCurrentTheme() . '/' . $value . '" />');
75 case 'FILE': // Output contents
76 outputHtml(readFromFile($FQFN));
79 default: // Invalid mode!
80 debug_report_bug(sprintf("Invalid css_php value %s detected.", getConfig('css_php')));
85 } elseif ((getOutputMode() == 0) || (getConfig('css_php') == 'INLINE')) {
87 $STYLES = merge_array($STYLES, getExtensionCssFiles());
90 $basePath = sprintf("%stheme/%s/css/", getConfig('PATH'), getCurrentTheme());
92 // Output inclusion lines
94 foreach ($STYLES as $value) {
95 // Only include found CSS files (to reduce 404 requests)
96 $FQFN = $basePath . $value;
98 // Do include only existing files and whose are not empty
99 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
101 $OUT .= readFromFile($FQFN);
106 loadTemplate('css_inline', false, $OUT);
108 // Now we load all CSS files from css.php!
109 outputHtml('<link rel="stylesheet" type="text/css" href="{?URL?}/css.php', false);
110 if ((isInstallationPhase())) {
111 // Default theme first
112 $newTheme = 'default';
113 if (isGetRequestElementSet('theme')) $newTheme = getRequestElement('theme');
114 if (isPostRequestElementSet('theme')) $newTheme = SQL_ESCAPE(postRequestElement('theme'));
115 outputHtml('?theme=' . $newTheme . '&installing=1', false);
117 // Add SVN revision to bypass caching problems
118 outputHtml('?rev=' . getConfig('CURR_SVN_REVISION'));