]> git.mxchange.org Git - mailer.git/blob - inc/stylesheet.php
Added patch_core.sh to all 'cored' PHP projects to ease patching of the 'core' project
[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  * -------------------------------------------------------------------- *
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                  *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 }
42
43 // Default styles
44 $stylesList = array(
45                 'general.css',
46 );
47
48 // Add stylesheet for installation
49 if ((isInstallationPhase())) $stylesList[] = 'install.css';
50
51 // When no CSS output-mode is set, set it to file-output
52 if (!isConfigEntrySet('css_php')) setConfigEntry('css_php', 'FILE');
53
54 // Output CSS files or content or link to css.php ?
55 if ((isCssOutputMode()) || (getConfig('css_php') == 'DIRECT')) {
56         // Load CSS files
57         $stylesList = merge_array($stylesList, getExtensionCssFiles());
58
59         // Generate base path
60         $basePath = sprintf("%stheme/%s/css/", getPath(), getCurrentTheme());
61
62         // Output inclusion lines
63         foreach ($stylesList as $value) {
64                 // Only include found CSS files (to reduce 404 requests)
65                 $FQFN = $basePath . $value;
66
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 . '%}" />';
72                                         break;
73
74                                 case 'FILE': // Output contents
75                                         $GLOBALS['page_header'] .= readFromFile($FQFN);
76                                         break;
77
78                                 default: // Invalid mode!
79                                         debug_report_bug(__FILE__, __LINE__, sprintf("Invalid css_php value %s detected.", getConfig('css_php')));
80                                         break;
81                         } // END - switch
82                 } // END - if
83         } // END - foreach
84 } elseif ((isHtmlOutputMode()) || (getConfig('css_php') == 'INLINE')) {
85         // Load CSS files
86         $stylesList = merge_array($stylesList, getExtensionCssFiles());
87
88         // Generate base path
89         $basePath = sprintf("%stheme/%s/css/", getPath(), getCurrentTheme());
90
91         // Output inclusion lines
92         $OUT = '';
93         foreach ($stylesList as $value) {
94                 // Only include found CSS files (to reduce 404 requests)
95                 $FQFN = $basePath . $value;
96
97                 // Do include only existing files and whose are not empty
98                 if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
99                         // Load CSS content
100                         $OUT .= readFromFile($FQFN);
101                 } // END - if
102         } // END - foreach
103
104         // Load template
105         $GLOBALS['page_header'] .= loadTemplate('css_inline', true, $OUT);
106 } else {
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 . '&amp;installing=1';
115         } else {
116                 // Add SVN revision to bypass caching problems
117                 $OUT .= '?rev=' . getCurrentRepositoryRevision();
118         }
119
120         // Close tag
121         $GLOBALS['page_header'] .= $OUT . '%}{%ext,version=sql_patches%}" />';
122 }
123
124 // [EOF]
125 ?>