add info about pear in debian
[squirrelmail.git] / src / style.php
CommitLineData
d3c2ff0a 1<?php
2/**
3 * Style sheet script
5c4ff7bf 4 *
d3c2ff0a 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');
5c4ff7bf 25require_once(SM_PATH . 'include/load_prefs.php');
d3c2ff0a 26
27/* temp setting containing list of font styles. Should go to config.php */
28$fontsets=array();
29$fontsets['sans']['NAME']='Sans';
30$fontsets['sans']['STYLE']='helvetica,arial,sans-serif';
31$fontsets['serif']['NAME']='Serif';
32$fontsets['serif']['STYLE']='serif';
33$fontsets['comicsans']['NAME']='Comic Sans';
34$fontsets['comicsans']['STYLE']='comic sans ms,sans-serif';
35$fontsets['vera']['NAME']='Vera';
36$fontsets['vera']['STYLE']='bitstream vera sans,verdana,sans-serif';
37$fontsets['tahoma']['NAME']='Tahoma';
38$fontsets['tahoma']['STYLE']='tahoma,sans-serif';
39
40/* template init */
41/** start block copy from right_main.php */
42include_once(SM_PATH . 'class/template/template.class.php');
5c4ff7bf 43
d3c2ff0a 44$oTemplate = new Template($sTplDir);
45/** end block copy */
46
47/* set default colors in case color theme is not full */
48$color = array();
49$color[0] = '#dcdcdc'; // (light gray) TitleBar
50$color[1] = '#800000'; // (red)
51$color[2] = '#cc0000'; // (light red) Warning/Error Messages
52$color[3] = '#a0b8c8'; // (green-blue) Left Bar Background
53$color[4] = '#ffffff'; // (white) Normal Background
54$color[5] = '#ffffcc'; // (light yellow) Table Headers
55$color[6] = '#000000'; // (black) Text on left bar
56$color[7] = '#0000cc'; // (blue) Links
57$color[8] = '#000000'; // (black) Normal text
58$color[9] = '#ababab'; // (mid-gray) Darker version of #0
59$color[10] = '#666666'; // (dark gray) Darker version of #9
60$color[11] = '#770000'; // (dark red) Special Folders color
61$color[12] = '#ededed'; // (light gray) Alternate color for message list
62$color[13] = '#800000'; // (dark red) Color for quoted text -- > 1 quote
63$color[14] = '#ff0000'; // (red) Color for quoted text -- >> 2 or more
64$color[15] = '#002266'; // (dark blue) Unselectable folders
65$color[16] = '#ff9933'; // (orange) Highlight color
66
67/** get theme from GET */
68if (sqgetGlobalVar('themeid',$themeid,SQ_GET) &&
69 file_exists(SM_PATH . 'themes/'.basename($themeid,'.php').'.php')) {
70 include_once(SM_PATH . 'themes/'.basename($themeid,'.php').'.php');
71} elseif (file_exists($theme[$theme_default]['PATH'])) {
72 include_once($theme[$theme_default]['PATH']);
73}
74
5c4ff7bf 75/**
76 * get alignment variable from language settings...
77 * MOVE THIS to a central init section !!!!
78 */
79if (!sqgetGlobalVar('align',$align,SQ_SESSION)) {
80 $dir = ( isset( $languages[$squirrelmail_language]['DIR']) ) ? $languages[$squirrelmail_language]['DIR'] : 'ltr';
81 if ( $dir == 'ltr' ) {
82 $align = array('left' => 'left', 'right' => 'right');
83 } else {
84 $align = array('left' => 'right', 'right' => 'left');
85 }
86 sqsession_register($align, 'align');
87}
88
d3c2ff0a 89/**/
90$oTemplate->assign('color', $color);
91
92/**
93 * set color constants in order to use simple names instead of color array
5c4ff7bf 94 * 0 - SQM_TEXT_DISABLED, SQM_TITLE_BACKGROUND, SQM_BUTTON_BACKGROUND_DISABLED,
d3c2ff0a 95 * SQM_ROW_BACKGROUND_1
96 * 1 -
97 * 2 - SQM_ERROR_TEXT
98 * 3 - SQM_BACKGROUND_LEFT
99 * 4 - SQM_BACKGROUND
100 * 5 - SQM_ROW_BACKGROUND_HIGHLIGHT, SQM_COLUMN_HEADER_BACKGROUND
101 * 6 - SQM_TEXT_STANDARD_LEFT
102 * 7 - SQM_TITLE_TEXT, SQM_BLOCK_TITLE_TEXT
5c4ff7bf 103 * 8 - SQM_TEXT_STANDARD, SQM_BUTTON_TEXT, SQM_BLOCK_TEXT, SQM_ROW_TEXT_1,
104 * SQM_ROW_TEXT_2, SQM_ROW_TEXT_HIGHLIGHT, SQM_ROW_TEXT_SELECTED,
d3c2ff0a 105 * SQM_COLUMN_HEADER_TEXT
106 * 9 - SQM_BUTTON_BACKGROUND
107 * 10 - SQM_BLOCK_TITLE
108 * 11 - SQM_TEXT_SPECIAL
109 * 12 - SQM_BUTTON_BACKGROUND_TEXT, SQM_BLOCK_BACKGROUND, SQM_ROW_BACKGROUND_2
110 * 13 - SQM_MESSAGE_QUOTE_1
111 * 14 - SQM_MESSAGE_QUOTE_2
112 * 15 - SQM_TEXT_HIGHLIGHT
113 * 16 - SQM_ROW_BACKGROUND_SELECTED
114 */
115define('SQM_BACKGROUND',$color[4]);
116define('SQM_BACKGROUND_LEFT',$color[3]);
117
118define('SQM_TEXT_STANDARD',$color[8]);
119define('SQM_TEXT_STANDARD_LEFT',$color[6]);
120define('SQM_TEXT_HIGHLIGHT',$color[15]);
121define('SQM_TEXT_DISABLED',$color[0]);
122define('SQM_TEXT_SPECIAL',$color[11]);
123
124define('SQM_LINK',$color[7]);
125define('SQM_LINK_LEFT',$color[6]);
126
127define('SQM_TITLE_BACKGROUND',$color[0]);
128define('SQM_TITLE_TEXT',$color[7]);
129
130define('SQM_BUTTON_BACKGROUND',$color[9]);
131define('SQM_BUTTON_TEXT',$color[8]);
132define('SQM_BUTTON_BACKGROUND_DISABLED',$color[0]);
133define('SQM_BUTTON_BACKGROUND_TEXT',$color[12]);
134
135define('SQM_BLOCK_BACKGROUND',$color[12]);
136define('SQM_BLOCK_TEXT',$color[8]);
137define('SQM_BLOCK_TITLE',$color[10]);
138define('SQM_BLOCK_TITLE_TEXT',$color[7]);
139
140define('SQM_ROW_BACKGROUND_1',$color[0]);
141define('SQM_ROW_BACKGROUND_2',$color[12]);
142define('SQM_ROW_TEXT_1',$color[8]);
143define('SQM_ROW_TEXT_2',$color[8]);
144define('SQM_ROW_BACKGROUND_HIGHLIGHT',$color[5]);
145define('SQM_ROW_TEXT_HIGHLIGHT',$color[8]);
146define('SQM_ROW_BACKGROUND_SELECTED',$color[16]);
147define('SQM_ROW_TEXT_SELECTED',$color[8]);
148
149define('SQM_COLUMN_HEADER_BACKGROUND',$color[5]);
150define('SQM_COLUMN_HEADER_TEXT',$color[8]);
151
152define('SQM_MESSAGE_QUOTE_1',$color[13]);
153define('SQM_MESSAGE_QUOTE_2',$color[14]);
154
155define('SQM_ERROR_TEXT',$color[2]);
156
5c4ff7bf 157define('SQM_ALIGN_LEFT', $align['left']);
158define('SQM_ALIGN_RIGHT', $align['right']);
159
d3c2ff0a 160if (sqgetGlobalVar('fontset',$fontset,SQ_GET) &&
161 isset($fontsets[$fontset])) {
162 $fontfamily=$fontsets[$fontset]['STYLE'];
163} else {
164 $fontfamily='';
165}
166$oTemplate->assign('fontfamily', $fontfamily);
167
168if (! sqgetGlobalVar('fontsize',$fontsize,SQ_GET)) {
169 $fontsize = 0;
170} else {
171 $fontsize = (int) $fontsize;
172}
173$oTemplate->assign('fontsize', $fontsize);
174
175header('Content-Type: text/css');
00a68572 176// output a last-modified header if we can
177if ( $lastmod = @filemtime($oTemplate->template_dir . 'stylesheet.tpl') ) {
178 $gmlastmod = gmdate('D, d M Y H:i:s', $lastmod) . ' GMT';
179 header('Last-Modified: ' . $gmlastmod);
180}
d3c2ff0a 181
182$oTemplate->display('stylesheet.tpl');
183
00a68572 184?>