Rewrites for installation of sql_patches
[mailer.git] / inc / stylesheet.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    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  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Default styles
41 $STYLES = array(
42                 "general.css",
43 );
44
45 // Add stylesheet for installation
46 if ((basename($_SERVER['PHP_SELF']) == "install.php") || (!isBooleanConstantAndTrue('mxchange_installed')) || (isset($_GET['installing']))) $STYLES[] = "install.css";
47
48 // When no CSS output-mode is set, set it to file-output
49 if (getConfig('css_php') == "") $_CONFIG['css_php'] = "FILE";
50
51 // Output CSS files or content or link to css.php ?
52 if (($CSS == "1") || (getConfig('css_php') == "DIRECT")) {
53         // Load CSS files
54         if (is_array($EXT_CSS_FILES)) {
55                 // Load extension's CSS files
56                 foreach ($EXT_CSS_FILES as $value) $STYLES[] = $value;
57         } // END - if
58
59         // Output inclusion lines
60         foreach ($STYLES as $value) {
61                 // Only include found CSS files (to reduce 404 requests)
62                 $BASE = sprintf("%stheme/%s/css/", PATH, GET_CURR_THEME());
63                 $file = $BASE.$value;
64
65                 // Do include only existing files and whose are not empty
66                 if ((FILE_READABLE($file)) && (filesize($file) > 0)) {
67                         switch (getConfig('css_php')) {
68                                 case "DIRECT":
69                                         OUTPUT_HTML("<link rel=\"stylesheet\" type=\"text/css\" href=\"".URL."/theme/".GET_CURR_THEME()."/".$value."\" />");
70                                         break;
71
72                                 case "FILE":
73                                         $load = implode("", file($file));
74                                         OUTPUT_HTML($load);
75                                         break;
76                         }
77                 }
78         }
79 } else {
80         // Now we load all CSS files from css.php!
81         OUTPUT_HTML("<link rel=\"stylesheet\" type=\"text/css\" href=\"".URL."/css.php", false);
82         if (isBooleanConstantAndTrue('mxchange_installing')) {
83                 // Default theme first
84                 $NEW_THEME = "default";
85                 if (!empty($_GET['theme'])) $NEW_THEME = SQL_ESCAPE($_GET['theme']);
86                 if (!empty($_POST['theme'])) $NEW_THEME = SQL_ESCAPE($_POST['theme']);
87                 OUTPUT_HTML("?theme=".$NEW_THEME."&amp;installing=1", false);
88         }
89         OUTPUT_HTML("\" />");
90 }
91
92 //
93 ?>