Added code from Philippe Mingo on June 1, 2001
[squirrelmail.git] / src / options.php
1 <?php
2 /**
3 ** options.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Displays the options page. Pulls from proper user preference files
9 ** and config.php. Displays preferences as selected and other options.
10 **
11 ** $Id$
12 **/
13
14 include('../src/validate.php');
15 include('../functions/display_messages.php');
16 include('../functions/imap.php');
17 include('../functions/array.php');
18
19 if (isset($language)) {
20 setcookie('squirrelmail_language', $language, time()+2592000);
21 $squirrelmail_language = $language;
22 }
23
24 displayPageHeader($color, _("None"));
25
26 ?>
27
28 <br>
29 <table bgcolor="<?php echo $color[0] ?>" width="95%" align="center" cellpadding="2" cellspacing="0" border="0">
30 <tr><td align="center">
31
32 <b><?php echo _("Options") ?></b><br>
33
34 <table width="100%" border="0" cellpadding="5" cellspacing="0">
35 <tr><td bgcolor="<?php echo $color[4] ?>" align="center">
36
37 <?php
38 if (isset($submit_personal)) {
39 # Save personal information
40 if (isset($full_name))
41 setPref($data_dir, $username, 'full_name', $full_name);
42 if (isset($email_address))
43 setPref($data_dir, $username, 'email_address', $email_address);
44 if (isset($reply_to))
45 setPref($data_dir, $username, 'reply_to', $reply_to);
46 if (! isset($usesignature))
47 $usesignature = 0;
48 setPref($data_dir, $username, 'use_signature', $usesignature);
49 if (! isset($prefixsig))
50 $prefixsig = 0;
51 setPref($data_dir, $username, 'prefix_sig', $prefixsig);
52 if (isset($signature_edit)) setSig($data_dir, $username, $signature_edit);
53
54 do_hook('options_personal_save');
55
56 echo '<br><b>'._("Successfully saved personal information!").'</b><br>';
57 } else if (isset($submit_display)) {
58 // Do checking to make sure $chosentheme is in the array
59 $in_ary = false;
60 for ($i=0; $i < count($theme); $i++)
61 {
62 if ($theme[$i]['PATH'] == $chosentheme)
63 {
64 $in_ary = true;
65 break;
66 }
67 }
68 if (! $in_ary)
69 $chosentheme = '';
70
71 # Save display preferences
72 setPref($data_dir, $username, 'chosen_theme', $chosentheme);
73 setPref($data_dir, $username, 'show_num', $shownum);
74 setPref($data_dir, $username, 'wrap_at', $wrapat);
75 setPref($data_dir, $username, 'editor_size', $editorsize);
76 setPref($data_dir, $username, 'left_refresh', $leftrefresh);
77 setPref($data_dir, $username, 'language', $language);
78 setPref($data_dir, $username, 'location_of_bar', $folder_new_location);
79 setPref($data_dir, $username, 'location_of_buttons', $button_new_location);
80 setPref($data_dir, $username, 'left_size', $leftsize);
81 setPref($data_dir, $username, 'use_javascript_addr_book', $javascript_abook);
82 if (isset($altIndexColors) && $altIndexColors == 1)
83 setPref($data_dir, $username, 'alt_index_colors', 1);
84 else
85 setPref($data_dir, $username, 'alt_index_colors', 0);
86 if (isset($showhtmldefault))
87 setPref($data_dir, $username, 'show_html_default', 1);
88 else
89 removePref($data_dir, $username, 'show_html_default');
90
91 do_hook('options_display_save');
92
93 echo '<br><b>'._("Successfully saved display preferences!").'</b><br>';
94 echo '<a href="../src/webmail.php?right_frame=options.php" target=_top>' . _("Refresh Page") . '</a><br>';
95 } else if (isset($submit_folder)) {
96 # Save folder preferences
97 if ($trash != 'none') {
98 setPref($data_dir, $username, 'move_to_trash', true);
99 setPref($data_dir, $username, 'trash_folder', $trash);
100 } else {
101 setPref($data_dir, $username, 'move_to_trash', '0');
102 setPref($data_dir, $username, 'trash_folder', 'none');
103 }
104 if ($sent != 'none') {
105 setPref($data_dir, $username, 'move_to_sent', true);
106 setPref($data_dir, $username, 'sent_folder', $sent);
107 } else {
108 setPref($data_dir, $username, 'move_to_sent', '0');
109 setPref($data_dir, $username, 'sent_folder', 'none');
110 }
111 setPref($data_dir, $username, 'folder_prefix', $folderprefix);
112 setPref($data_dir, $username, 'unseen_notify', $unseennotify);
113 setPref($data_dir, $username, 'unseen_type', $unseentype);
114 if (isset($collapsefolders))
115 setPref($data_dir, $username, 'collapse_folders', $collapsefolders);
116 else
117 removePref($data_dir, $username, 'collapse_folders');
118 do_hook('options_folders_save');
119 echo '<br><b>'._("Successfully saved folder preferences!").'</b><br>';
120 echo '<a href="../src/left_main.php" target=left>' . _("Refresh Folder List") . '</a><br>';
121 } else {
122 do_hook('options_save');
123 }
124
125 ?>
126
127 <table bgcolor="<?php echo $color[4] ?>" width="100%" cellpadding="5" cellspacing="0" border="0">
128 <tr>
129 <td width="50%" valign="top">
130 <table width="100%" cellpadding="3" cellspacing="0" border="0">
131 <tr>
132 <td bgcolor="<?php echo $color[9] ?>">
133 <a href="options_personal.php"><?php echo _("Personal Information"); ?></a>
134 </td>
135 </tr>
136 <tr>
137 <td bgcolor="<?php echo $color[0] ?>">
138 <?php echo _("This contains personal information about yourself such as your name, your email address, etc.") ?>
139 </td>
140 </tr>
141 </table><br>
142 <table width="100%" cellpadding="3" cellspacing="0" border="0">
143 <tr>
144 <td bgcolor="<?php echo $color[9] ?>">
145 <a href="options_highlight.php"><?php echo _("Message Highlighting"); ?></a>
146 </td>
147 </tr>
148 <tr>
149 <td bgcolor="<?php echo $color[0] ?>">
150 <?php echo _("Based upon given criteria, incoming messages can have different background colors in the message list. This helps to easily distinguish who the messages are from, especially for mailing lists.") ?>
151 </td>
152 </tr>
153 </table><br>
154 <table width="100%" cellpadding="3" cellspacing="0" border="0">
155 <tr>
156 <td bgcolor="<?php echo $color[9] ?>">
157 <a href="options_order.php"><?php echo _("Index Order"); ?></a>
158 </td>
159 </tr>
160 <tr>
161 <td bgcolor="<?php echo $color[0] ?>">
162 <?php echo _("The order of the message index can be rearanged and changed to contain the headers in any order you want.") ?>
163 </td>
164 </tr>
165 </table><br>
166 </td>
167 <td valign="top" width="50%">
168 <table width="100%" cellpadding="3" cellspacing="0" border="0">
169 <tr>
170 <td bgcolor="<?php echo $color[9] ?>">
171 <a href="options_display.php"><?php echo _("Display Preferences"); ?></a>
172 </td>
173 </tr>
174 <tr>
175 <td bgcolor="<?php echo $color[0] ?>">
176 <?php echo _("You can change the way that SquirrelMail looks and displays information to you, such as the colors, the language, and other settings.") ?>
177 </td>
178 </tr>
179 </table><br>
180 <table width="100%" cellpadding="3" cellspacing="0" border="0">
181 <tr>
182 <td bgcolor="<?php echo $color[9] ?>">
183 <a href="options_folder.php"><?php echo _("Folder Preferences"); ?></a>
184 </td>
185 </tr>
186 <tr>
187 <td bgcolor="<?php echo $color[0] ?>">
188 <?php echo _("These settings change the way your folders are displayed and manipulated.") ?>
189 </td>
190 </tr>
191 </table><br>
192 </td>
193 </tr>
194 </table>
195
196 <?php do_hook('options_link_and_description'); ?>
197
198
199 </td></tr>
200 </table>
201
202 </td></tr>
203 </table>
204
205 </body></html>