start working on 1.5.1 release notes
[squirrelmail.git] / src / style.php
CommitLineData
d3c2ff0a 1<?php
2/**
3 * Style sheet script
4 *
5 * Script processes GET arguments and generates CSS output from stylesheet.tpl.
6 * Used GET arguments:
7 * <ul>
8 * <li>themeid - string, sets theme file from themes/*.php
9 * <li>fontset - string, sets selected set of fonts from $fontsets array.
10 * <li>fontsize - integer, sets selected font size
11 * </ul>
47ccfad4 12 * @copyright &copy; 2005-2006 The SquirrelMail Project Team
d3c2ff0a 13 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 * @version $Id$
15 * @package squirrelmail
16 */
17
18/** @ignore */
19define('SM_PATH','../');
20
21/* SquirrelMail required files. */
22require_once(SM_PATH . 'functions/global.php');
23require_once(SM_PATH . 'functions/strings.php');
24require_once(SM_PATH . 'config/config.php');
25
26/* temp setting containing list of font styles. Should go to config.php */
27$fontsets=array();
28$fontsets['sans']['NAME']='Sans';
29$fontsets['sans']['STYLE']='helvetica,arial,sans-serif';
30$fontsets['serif']['NAME']='Serif';
31$fontsets['serif']['STYLE']='serif';
32$fontsets['comicsans']['NAME']='Comic Sans';
33$fontsets['comicsans']['STYLE']='comic sans ms,sans-serif';
34$fontsets['vera']['NAME']='Vera';
35$fontsets['vera']['STYLE']='bitstream vera sans,verdana,sans-serif';
36$fontsets['tahoma']['NAME']='Tahoma';
37$fontsets['tahoma']['STYLE']='tahoma,sans-serif';
38
39/* template init */
40/** start block copy from right_main.php */
41include_once(SM_PATH . 'class/template/template.class.php');
42$sTplDir = SM_PATH . 'templates/default/';
43$oTemplate = new Template($sTplDir);
44/** end block copy */
45
46/* set default colors in case color theme is not full */
47$color = array();
48$color[0] = '#dcdcdc'; // (light gray) TitleBar
49$color[1] = '#800000'; // (red)
50$color[2] = '#cc0000'; // (light red) Warning/Error Messages
51$color[3] = '#a0b8c8'; // (green-blue) Left Bar Background
52$color[4] = '#ffffff'; // (white) Normal Background
53$color[5] = '#ffffcc'; // (light yellow) Table Headers
54$color[6] = '#000000'; // (black) Text on left bar
55$color[7] = '#0000cc'; // (blue) Links
56$color[8] = '#000000'; // (black) Normal text
57$color[9] = '#ababab'; // (mid-gray) Darker version of #0
58$color[10] = '#666666'; // (dark gray) Darker version of #9
59$color[11] = '#770000'; // (dark red) Special Folders color
60$color[12] = '#ededed'; // (light gray) Alternate color for message list
61$color[13] = '#800000'; // (dark red) Color for quoted text -- > 1 quote
62$color[14] = '#ff0000'; // (red) Color for quoted text -- >> 2 or more
63$color[15] = '#002266'; // (dark blue) Unselectable folders
64$color[16] = '#ff9933'; // (orange) Highlight color
65
66/** get theme from GET */
67if (sqgetGlobalVar('themeid',$themeid,SQ_GET) &&
68 file_exists(SM_PATH . 'themes/'.basename($themeid,'.php').'.php')) {
69 include_once(SM_PATH . 'themes/'.basename($themeid,'.php').'.php');
70} elseif (file_exists($theme[$theme_default]['PATH'])) {
71 include_once($theme[$theme_default]['PATH']);
72}
73
74/**/
75$oTemplate->assign('color', $color);
76
77/**
78 * set color constants in order to use simple names instead of color array
79 * 0 - SQM_TEXT_DISABLED, SQM_TITLE_BACKGROUND, SQM_BUTTON_BACKGROUND_DISABLED,
80 * SQM_ROW_BACKGROUND_1
81 * 1 -
82 * 2 - SQM_ERROR_TEXT
83 * 3 - SQM_BACKGROUND_LEFT
84 * 4 - SQM_BACKGROUND
85 * 5 - SQM_ROW_BACKGROUND_HIGHLIGHT, SQM_COLUMN_HEADER_BACKGROUND
86 * 6 - SQM_TEXT_STANDARD_LEFT
87 * 7 - SQM_TITLE_TEXT, SQM_BLOCK_TITLE_TEXT
88 * 8 - SQM_TEXT_STANDARD, SQM_BUTTON_TEXT, SQM_BLOCK_TEXT, SQM_ROW_TEXT_1,
89 * SQM_ROW_TEXT_2, SQM_ROW_TEXT_HIGHLIGHT, SQM_ROW_TEXT_SELECTED,
90 * SQM_COLUMN_HEADER_TEXT
91 * 9 - SQM_BUTTON_BACKGROUND
92 * 10 - SQM_BLOCK_TITLE
93 * 11 - SQM_TEXT_SPECIAL
94 * 12 - SQM_BUTTON_BACKGROUND_TEXT, SQM_BLOCK_BACKGROUND, SQM_ROW_BACKGROUND_2
95 * 13 - SQM_MESSAGE_QUOTE_1
96 * 14 - SQM_MESSAGE_QUOTE_2
97 * 15 - SQM_TEXT_HIGHLIGHT
98 * 16 - SQM_ROW_BACKGROUND_SELECTED
99 */
100define('SQM_BACKGROUND',$color[4]);
101define('SQM_BACKGROUND_LEFT',$color[3]);
102
103define('SQM_TEXT_STANDARD',$color[8]);
104define('SQM_TEXT_STANDARD_LEFT',$color[6]);
105define('SQM_TEXT_HIGHLIGHT',$color[15]);
106define('SQM_TEXT_DISABLED',$color[0]);
107define('SQM_TEXT_SPECIAL',$color[11]);
108
109define('SQM_LINK',$color[7]);
110define('SQM_LINK_LEFT',$color[6]);
111
112define('SQM_TITLE_BACKGROUND',$color[0]);
113define('SQM_TITLE_TEXT',$color[7]);
114
115define('SQM_BUTTON_BACKGROUND',$color[9]);
116define('SQM_BUTTON_TEXT',$color[8]);
117define('SQM_BUTTON_BACKGROUND_DISABLED',$color[0]);
118define('SQM_BUTTON_BACKGROUND_TEXT',$color[12]);
119
120define('SQM_BLOCK_BACKGROUND',$color[12]);
121define('SQM_BLOCK_TEXT',$color[8]);
122define('SQM_BLOCK_TITLE',$color[10]);
123define('SQM_BLOCK_TITLE_TEXT',$color[7]);
124
125define('SQM_ROW_BACKGROUND_1',$color[0]);
126define('SQM_ROW_BACKGROUND_2',$color[12]);
127define('SQM_ROW_TEXT_1',$color[8]);
128define('SQM_ROW_TEXT_2',$color[8]);
129define('SQM_ROW_BACKGROUND_HIGHLIGHT',$color[5]);
130define('SQM_ROW_TEXT_HIGHLIGHT',$color[8]);
131define('SQM_ROW_BACKGROUND_SELECTED',$color[16]);
132define('SQM_ROW_TEXT_SELECTED',$color[8]);
133
134define('SQM_COLUMN_HEADER_BACKGROUND',$color[5]);
135define('SQM_COLUMN_HEADER_TEXT',$color[8]);
136
137define('SQM_MESSAGE_QUOTE_1',$color[13]);
138define('SQM_MESSAGE_QUOTE_2',$color[14]);
139
140define('SQM_ERROR_TEXT',$color[2]);
141
142if (sqgetGlobalVar('fontset',$fontset,SQ_GET) &&
143 isset($fontsets[$fontset])) {
144 $fontfamily=$fontsets[$fontset]['STYLE'];
145} else {
146 $fontfamily='';
147}
148$oTemplate->assign('fontfamily', $fontfamily);
149
150if (! sqgetGlobalVar('fontsize',$fontsize,SQ_GET)) {
151 $fontsize = 0;
152} else {
153 $fontsize = (int) $fontsize;
154}
155$oTemplate->assign('fontsize', $fontsize);
156
157header('Content-Type: text/css');
158
159$oTemplate->display('stylesheet.tpl');
160
161?>