Missing files added
[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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
36 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40
41 // Default styles
42 $STYLES = array(
43                 "general.css",
44 );
45
46 // Add stylesheet for installation
47 if ((basename($_SERVER['PHP_SELF']) == "install.php") || (!isBooleanConstantAndTrue('mxchange_installed')) || (isset($_GET['installing']))) $STYLES[] = "install.css";
48
49 // When no CSS output-mode is set, set it to file-output
50 if (empty($_CONFIG['css_php'])) $_CONFIG['css_php'] = "FILE";
51
52 // Output CSS files or content or link to css.php ?
53 if (($CSS == "1") || ($_CONFIG['css_php'] == "DIRECT"))
54 {
55         // Load CSS files
56         if (is_array($EXT_CSS_FILES))
57         {
58                 // Load extension's CSS files
59                 foreach ($EXT_CSS_FILES as $value) $STYLES[] = $value;
60         }
61
62         // Create missing configuration file
63         if (!function_exists('GET_CURR_THEME')) {
64                 // Dummy for e.g. down database links
65                 function GET_CURR_THEME () {
66                         return "default";
67                 }
68         }
69
70         // Output inclusion lines
71         foreach ($STYLES as $value)
72         {
73                 // Only include found CSS files (to reduce 404 requests)
74                 $BASE = PATH."theme/".GET_CURR_THEME()."/css/";
75                 $file = $BASE.$value;
76                 // Do include only existing files and whose are not empty
77                 if ((file_exists($file)) && (filesize($file) > 0))
78                 {
79                         switch ($_CONFIG['css_php'])
80                         {
81                         case "DIRECT":
82                                 OUTPUT_HTML("<LINK rel=\"stylesheet\" type=\"text/css\" href=\"".URL."/".$BASE."\">");
83                                 break;
84
85                         case "FILE":
86                                 $load = implode("", file($file));
87                                 OUTPUT_HTML($load);
88                                 break;
89                         }
90                 }
91         }
92 }
93  else
94 {
95         // Now we load all CSS files from css.php!
96         OUTPUT_HTML("<LINK rel=\"stylesheet\" type=\"text/css\" href=\"".URL."/css.php", false);
97         if (isBooleanConstantAndTrue('mxchange_installing'))
98         {
99                 // Default theme first
100                 $NEW_THEME = "default";
101                 if (!empty($_GET['theme'])) $NEW_THEME = $_GET['theme'];
102                 if (!empty($_POST['theme'])) $NEW_THEME = $_POST['theme'];
103                 OUTPUT_HTML("?theme=".$NEW_THEME."&amp;installing=1", false);
104         }
105         OUTPUT_HTML("\">");
106 }
107
108 //
109 ?>