cbbfb26134af3ef444f8f66ecdc700c752f46f1a
5 * Copyright (c) 1999-2001 The SquirrelMail Development Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 * Displays the options page. Pulls from proper user preference files
9 * and config.php. Displays preferences as selected and other options.
14 require_once('../src/validate.php');
15 require_once('../functions/display_messages.php');
16 require_once('../functions/imap.php');
17 require_once('../functions/array.php');
19 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
22 if (isset($language)) {
23 setcookie('squirrelmail_language', $language, time()+
2592000, $base_uri);
24 $squirrelmail_language = $language;
27 displayPageHeader($color, _("None"));
32 <table bgcolor
="<?php echo $color[0] ?>" width
="95%" align
="center" cellpadding
="2" cellspacing
="0" border
="0">
33 <tr
><td align
="center">
34 <b
><?php
echo _("Options") ?
></b
><br
>
36 <table width
="100%" border
="0" cellpadding
="5" cellspacing
="0">
37 <tr
><td bgcolor
="<?php echo $color[4] ?>" align
="center">
40 if (isset($submit_personal)) {
41 /* Save personal information. */
42 if (isset($full_name)) {
43 setPref($data_dir, $username, 'full_name', $full_name);
45 if (isset($email_address)) {
46 setPref($data_dir, $username, 'email_address', $email_address);
48 if (isset($reply_to)) {
49 setPref($data_dir, $username, 'reply_to', $reply_to);
51 setPref($data_dir, $username, 'reply_citation_style', $new_reply_citation_style);
52 setPref($data_dir, $username, 'reply_citation_start', $new_reply_citation_start);
53 setPref($data_dir, $username, 'reply_citation_end', $new_reply_citation_end);
54 if (! isset($usesignature))
56 setPref($data_dir, $username, 'use_signature', $usesignature);
57 if (! isset($prefixsig)) {
60 setPref($data_dir, $username, 'prefix_sig', $prefixsig);
61 if (isset($signature_edit)) {
62 setSig($data_dir, $username, $signature_edit);
65 do_hook('options_personal_save');
67 echo '<br><b>'._("Successfully saved personal information!").'</b><br>';
68 } else if (isset($submit_display)) {
69 /* Do checking to make sure $new_theme is in the array. */
70 $theme_in_array = false;
71 for ($i=0; $i < count($theme); $i++
) {
72 if ($theme[$i]['PATH'] == $new_chosen_theme) {
73 $theme_in_array = true;
77 if (!$theme_in_array) {
78 $new_chosen_theme = '';
81 /* Save display preferences. */
82 setPref($data_dir, $username, 'chosen_theme', $new_chosen_theme);
83 setPref($data_dir, $username, 'language', $new_language);
84 setPref($data_dir, $username, 'use_javascript_addr_book', $new_use_javascript_addr_book);
85 setPref($data_dir, $username, 'javascript_setting', $new_javascript_setting);
86 setPref($data_dir, $username, 'show_num', $new_show_num);
87 setPref($data_dir, $username, 'wrap_at', $new_wrap_at);
88 setPref($data_dir, $username, 'editor_size', $new_editor_size);
89 setPref($data_dir, $username, 'location_of_buttons', $new_location_of_buttons);
90 setPref($data_dir, $username, 'location_of_bar', $new_location_of_bar);
91 setPref($data_dir, $username, 'left_size', $new_left_size);
92 setPref($data_dir, $username, 'left_refresh', $new_left_refresh);
93 setPref($data_dir, $username, 'alt_index_colors', $new_alt_index_colors);
94 setPref($data_dir, $username, 'show_html_default', $new_show_html_default);
95 setPref($data_dir, $username, 'include_self_reply_all', $new_include_self_reply_all);
96 setPref($data_dir, $username, 'page_selector', $new_page_selector);
97 setPref($data_dir, $username, 'page_selector_max', $new_page_selector_max);
98 setPref($data_dir, $username, 'show_xmailer_default', $new_show_xmailer_default);
100 $js_autodetect_results = (isset($new_js_autodetect_results) ?
$new_js_autodetect_results : SMPREF_JS_OFF
);
101 if ($new_javascript_setting == SMPREF_JS_AUTODETECT
) {
102 if ($js_autodetect_results == SMPREF_JS_ON
) {
103 setPref($data_dir, $username, 'javascript_on', SMPREF_JS_ON
);
105 setPref($data_dir, $username, 'javascript_on', SMPREF_JS_OFF
);
108 setPref($data_dir, $username, 'javascript_on', $new_javascript_setting);
111 do_hook('options_display_save');
113 echo '<br><b>'._("Successfully saved display preferences!").'</b><br>';
114 echo '<a href="../src/webmail.php?right_frame=options.php" target=_top>' . _("Refresh Page") . '</a><br>';
115 } else if (isset($submit_folder)) {
116 /* Save trash folder preferences. */
117 if ($new_trash_folder != SMPREF_NONE
) {
118 setPref($data_dir, $username, 'move_to_trash', SMPREF_ON
);
119 setPref($data_dir, $username, 'trash_folder', $new_trash_folder);
121 setPref($data_dir, $username, 'move_to_trash', SMPREF_OFF
);
122 setPref($data_dir, $username, 'trash_folder', SMPREF_NONE
);
125 /* Save sent folder preferences. */
126 if ($new_sent_folder != SMPREF_NONE
) {
127 setPref($data_dir, $username, 'move_to_sent', SMPREF_ON
);
128 setPref($data_dir, $username, 'sent_folder', $new_sent_folder);
130 setPref($data_dir, $username, 'move_to_sent', SMPREF_OFF
);
131 setPref($data_dir, $username, 'sent_folder', SMPREF_NONE
);
134 /* Save draft folder preferences. */
135 if ($new_draft_folder != SMPREF_NONE
) {
136 setPref($data_dir, $username, 'save_as_draft', SMPREF_ON
);
137 setPref($data_dir, $username, 'draft_folder', $new_draft_folder);
139 setPref($data_dir, $username, 'save_as_draft', SMPREF_OFF
);
140 setPref($data_dir, $username, 'draft_folder', SMPREF_NONE
);
143 /* Save folder prefix preferences. */
144 if (isset($folderprefix)) {
145 setPref($data_dir, $username, 'folder_prefix', $folderprefix);
147 setPref($data_dir, $username, 'folder_prefix', '');
149 setPref($data_dir, $username, 'unseen_notify', $unseennotify);
150 setPref($data_dir, $username, 'unseen_type', $unseentype);
151 if (isset($collapsefolders))
152 setPref($data_dir, $username, 'collapse_folders', $collapsefolders);
154 removePref($data_dir, $username, 'collapse_folders');
155 setPref($data_dir, $username, 'date_format', $dateformat);
156 setPref($data_dir, $username, 'hour_format', $hourformat);
157 do_hook('options_folders_save');
158 echo '<br><b>'._("Successfully saved folder preferences!").'</b><br>';
159 echo '<a href="../src/left_main.php" target=left>' . _("Refresh Folder List") . '</a><br>';
161 do_hook('options_save');
164 /****************************************/
165 /* Now build our array of option pages. */
166 /****************************************/
168 /* Build a section for Personal Options. */
169 $optionpages[] = array(
170 'name' => _("Personal Information"),
171 'url' => 'options_personal.php',
172 'desc' => _("This contains personal information about yourself such as your name, your email address, etc."),
176 /* Build a section for Display Options. */
177 $optionpages[] = array(
178 'name' => _("Display Preferences"),
179 'url' => 'options_display.php',
180 'desc' => _("You can change the way that SquirrelMail looks and displays information to you, such as the colors, the language, and other settings."),
184 /* Build a section for Message Highlighting Options. */
185 $optionpages[] = array(
186 'name' =>_("Message Highlighting"),
187 'url' => 'options_highlight.php',
188 'desc' =>_("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."),
192 /* Build a section for Folder Options. */
193 $optionpages[] = array(
194 'name' => _("Folder Preferences"),
195 'url' => 'options_folder.php',
196 'desc' => _("These settings change the way your folders are displayed and manipulated."),
200 /* Build a section for Index Order Options. */
201 $optionpages[] = array(
202 'name' => _("Index Order"),
203 'url' => 'options_order.php',
204 'desc' => _("The order of the message index can be rearanged and changed to contain the headers in any order you want."),
207 /* Build a section for plugins wanting to register an optionpage. */
208 do_hook('options_register');
210 /*****************************************************/
211 /* Let's sort Javascript Option Pages to the bottom. */
212 /*****************************************************/
213 foreach ($optionpages as $optpage) {
214 if (!$optpage['js']) {
215 $reg_optionpages[] = $optpage;
216 } else if ($javascript_on == SMPREF_JS_ON
) {
217 $js_optionpages[] = $optpage;
220 $optionpages = array_merge($reg_optionpages, $js_optionpages);
222 /********************************************/
223 /* Now, print out each option page section. */
224 /********************************************/
225 $first_optpage = false;
226 foreach ($optionpages as $next_optpage) {
227 if ($first_optpage == false) {
228 $first_optpage = $next_optpage;
230 print_optionpages_row($first_optpage, $next_optpage);
231 $first_optpage = false;
235 if ($first_optpage != false) {
236 print_optionpages_row($first_optpage);
239 do_hook('options_link_and_description');
252 /*******************************************************************/
253 /* Please be warned. The code below this point sucks. This is just */
254 /* my first implementation to make the option rows work for both */
255 /* Javascript and non-Javascript option chunks. */
257 /* Please, someone make these better for me. All three functions */
258 /* below REALLY do close to the same thing. */
260 /* This code would be GREATLY improved by a templating system. */
261 /* Don't try to implement that now, however. That will come later. */
262 /*******************************************************************/
264 /*******************************************************************/
265 /* Actually, now that I think about it, don't do anything with */
266 /* this code yet. There is ACTUALLY supposed to be a difference */
267 /* between the three functions that write the option rows. I just */
268 /* have not yet gotten to integrating that yet. */
269 /*******************************************************************/
272 * This function prints out an option page row.
274 function print_optionpages_row($leftopt, $rightopt = false) {
277 echo "<table bgcolor=\"$color[4]\" width=\"100%\" cellpadding=0 cellspacing=5 border=0>" .
278 '<tr><td valign="top">' .
279 '<table width="100%" cellpadding="3" cellspacing="0" border="0">' .
281 "<td valign=top bgcolor=\"$color[9]\" width=\"50%\">" .
282 '<a href="' . $leftopt['url'] . '">' . $leftopt['name'] . '</a>'.
284 "<td valign=top bgcolor=\"$color[4]\"> </td>";
286 echo "<td valign=top bgcolor=\"$color[9]\" width=\"50%\">" .
287 '<a href="' . $rightopt['url'] . '">' . $rightopt['name'] . '</a>' .
290 echo "<td valign=top bgcolor=\"$color[4]\" width=\"50%\"> </td>";
295 "<td valign=top bgcolor=\"$color[0]\">" .
298 "<td valign=top bgcolor=\"$color[4]\"> </td>";
300 echo "<td valign=top bgcolor=\"$color[0]\">" .
304 echo "<td valign=top bgcolor=\"$color[4]\"> </td>";