Missing SVN properties set
[mailer.git] / inc / stylesheet.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 08/29/2003 *
4  * ===================                          Last change: 12/03/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : stylesheet.php                                   *
8  * -------------------------------------------------------------------- *
9  * Short description : Stylesheets are stored here                      *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Style-Sheets werden hier abgelegt                *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                  *
22  *                                                                      *
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.                                  *
27  *                                                                      *
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.                         *
32  *                                                                      *
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,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         die();
42 }
43
44 // Default styles
45 $STYLES = array(
46                 'general.css',
47 );
48
49 // Add stylesheet for installation
50 if ((isInstallationPhase())) $STYLES[] = 'install.css';
51
52 // When no CSS output-mode is set, set it to file-output
53 if (!isConfigEntrySet('css_php')) setConfigEntry('css_php', 'FILE');
54
55 // Output CSS files or content or link to css.php ?
56 if ((getOutputMode() == 1) || (getConfig('css_php') == 'DIRECT')) {
57         // Load CSS files
58         $STYLES = merge_array($STYLES, getExtensionCssFiles());
59
60         // Generate base path
61         $basePath = sprintf("%stheme/%s/css/", getConfig('PATH'), getCurrentTheme());
62
63         // Output inclusion lines
64         foreach ($STYLES as $value) {
65                 // Only include found CSS files (to reduce 404 requests)
66                 $FQFN = $basePath . $value;
67
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 . '" />');
73                                         break;
74
75                                 case 'FILE': // Output contents
76                                         outputHtml(readFromFile($FQFN));
77                                         break;
78
79                                 default: // Invalid mode!
80                                         debug_report_bug(sprintf("Invalid css_php value %s detected.", getConfig('css_php')));
81                                         break;
82                         } // END - switch
83                 } // END - if
84         } // END - foreach
85 } elseif ((getOutputMode() == '0') || (getConfig('css_php') == 'INLINE')) {
86         // Load CSS files
87         $STYLES = merge_array($STYLES, getExtensionCssFiles());
88
89         // Generate base path
90         $basePath = sprintf("%stheme/%s/css/", getConfig('PATH'), getCurrentTheme());
91
92         // Output inclusion lines
93         $OUT = '';
94         foreach ($STYLES as $value) {
95                 // Only include found CSS files (to reduce 404 requests)
96                 $FQFN = $basePath . $value;
97
98                 // Do include only existing files and whose are not empty
99                 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
100                         // Load CSS content
101                         $OUT .= readFromFile($FQFN);
102                 } // END - if
103         } // END - foreach
104
105         // Load template
106         loadTemplate('css_inline', false, $OUT);
107 } else {
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 = secureString(postRequestElement('theme'));
115                 outputHtml('?theme=' . $newTheme . '&amp;installing=1', false);
116         } else {
117                 // Add SVN revision to bypass caching problems
118                 outputHtml('?rev=' . getConfig('CURR_SVN_REVISION'));
119         }
120
121         // Close tag
122         outputHtml('" />');
123 }
124
125 // [EOF]
126 ?>