c36ed9cf |
1 | <?php |
e7db48af |
2 | |
35586184 |
3 | /** |
4 | * options_display.php |
5 | * |
82d304a0 |
6 | * Copyright (c) 1999-2004 The SquirrelMail Project Team |
35586184 |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
9 | * Displays all optinos about display preferences |
10 | * |
763b63fe |
11 | * @version $Id$ |
2b646597 |
12 | * @package squirrelmail |
35586184 |
13 | */ |
cbe5423b |
14 | |
2b646597 |
15 | /** Define the group constants for the display options page. */ |
cbe5423b |
16 | define('SMOPT_GRP_GENERAL', 0); |
17 | define('SMOPT_GRP_MAILBOX', 1); |
18 | define('SMOPT_GRP_MESSAGE', 2); |
19 | |
6395c46d |
20 | // load icon themes if in use |
21 | global $use_icons; |
22 | if ($use_icons) { |
23 | global $icon_themes; |
24 | $dirName = SM_PATH . 'images/themes'; |
4f7a5870 |
25 | if (is_readable($dirName) && is_dir($dirName)) { |
26 | $d = dir($dirName); |
27 | while($dir = $d->read()) { |
28 | if ($dir != "." && $dir != "..") { |
29 | if (is_dir($dirName."/".$dir) && file_exists("$dirName/$dir/theme.php")) |
30 | include("$dirName/$dir/theme.php"); |
31 | } |
6395c46d |
32 | } |
33 | } |
34 | } |
35 | |
48af4b64 |
36 | /** |
37 | * This function builds an array with all the information about |
38 | * the options available to the user, and returns it. The options |
39 | * are grouped by the groups in which they are displayed. |
40 | * For each option, the following information is stored: |
41 | * - name: the internal (variable) name |
42 | * - caption: the description of the option in the UI |
43 | * - type: one of SMOPT_TYPE_* |
44 | * - refresh: one of SMOPT_REFRESH_* |
45 | * - size: one of SMOPT_SIZE_* |
46 | * - save: the name of a function to call when saving this option |
47 | * @return array all option information |
48 | */ |
cbe5423b |
49 | function load_optpage_data_display() { |
ae958cd3 |
50 | global $theme, $language, $languages, $js_autodetect_results, $javascript_setting, |
46dfa56e |
51 | $compose_new_win, $default_use_mdn, $squirrelmail_language, $allow_thread_sort, |
6395c46d |
52 | $optmode, $show_alternative_names, $available_languages, $use_icons; |
a3ec3c91 |
53 | |
ce393174 |
54 | /* Build a simple array into which we will build options. */ |
bbcafebd |
55 | $optgrps = array(); |
56 | $optvals = array(); |
a3ec3c91 |
57 | |
bbcafebd |
58 | /******************************************************/ |
59 | /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */ |
60 | /******************************************************/ |
bbcafebd |
61 | |
62 | /*** Load the General Options into the array ***/ |
63 | $optgrps[SMOPT_GRP_GENERAL] = _("General Display Options"); |
64 | $optvals[SMOPT_GRP_GENERAL] = array(); |
65 | |
66 | /* Load the theme option. */ |
ce393174 |
67 | $theme_values = array(); |
68 | foreach ($theme as $theme_key => $theme_attributes) { |
be278741 |
69 | $theme_values[$theme_attributes['NAME']] = $theme_attributes['PATH']; |
ce393174 |
70 | } |
be278741 |
71 | ksort($theme_values); |
72 | $theme_values = array_flip($theme_values); |
bbcafebd |
73 | $optvals[SMOPT_GRP_GENERAL][] = array( |
ce393174 |
74 | 'name' => 'chosen_theme', |
75 | 'caption' => _("Theme"), |
76 | 'type' => SMOPT_TYPE_STRLIST, |
77 | 'refresh' => SMOPT_REFRESH_ALL, |
cbe5423b |
78 | 'posvals' => $theme_values, |
79 | 'save' => 'save_option_theme' |
ce393174 |
80 | ); |
5d110fa6 |
81 | |
8f1ba72b |
82 | $css_values = array( 'none' => _("Default" ) ); |
bb7173fa |
83 | $css_dir = SM_PATH . 'themes/css'; |
84 | if (is_readable($css_dir) && is_dir($css_dir)) { |
85 | $handle=opendir($css_dir); |
4f7a5870 |
86 | while ($file = readdir($handle) ) { |
87 | if ( substr( $file, -4 ) == '.css' ) { |
88 | $css_values[$file] = substr( $file, 0, strlen( $file ) - 4 ); |
89 | } |
8f1ba72b |
90 | } |
4f7a5870 |
91 | closedir($handle); |
dcd6f144 |
92 | } |
5d110fa6 |
93 | |
54078578 |
94 | if ( count( $css_values ) > 1 ) { |
5d110fa6 |
95 | |
e2cdae1f |
96 | $optvals[SMOPT_GRP_GENERAL][] = array( |
97 | 'name' => 'custom_css', |
98 | 'caption' => _("Custom Stylesheet"), |
99 | 'type' => SMOPT_TYPE_STRLIST, |
100 | 'refresh' => SMOPT_REFRESH_ALL, |
101 | 'posvals' => $css_values |
102 | ); |
5d110fa6 |
103 | |
e2cdae1f |
104 | } |
39d3ec89 |
105 | |
106 | // config.php can be unupdated. |
107 | if (! isset($available_languages) || $available_languages=="" ) { |
108 | $available_languages="ALL"; } |
5d110fa6 |
109 | |
e557fdb0 |
110 | $language_values = array(); |
39d3ec89 |
111 | if ( strtoupper($available_languages)=='ALL') { |
112 | foreach ($languages as $lang_key => $lang_attributes) { |
113 | if (isset($lang_attributes['NAME'])) { |
114 | $language_values[$lang_key] = $lang_attributes['NAME']; |
115 | if ( isset($show_alternative_names) && |
116 | $show_alternative_names && |
117 | isset($lang_attributes['ALTNAME']) ) { |
118 | $language_values[$lang_key] .= " / " . $lang_attributes['ALTNAME']; |
119 | } |
120 | } |
121 | } |
122 | } else if (strtoupper($available_languages)!='NONE') { |
123 | // admin can set list of available languages in config |
124 | $available_languages_array=explode (" ",$available_languages); |
125 | foreach ($available_languages_array as $lang_key ) { |
126 | if (isset($languages[$lang_key]['NAME'])) { |
127 | $language_values[$lang_key] = $languages[$lang_key]['NAME']; |
128 | if ( isset($show_alternative_names) && |
129 | $show_alternative_names && |
130 | isset($languages[$lang_key]['ALTNAME']) ) { |
131 | $language_values[$lang_key] .= " / " . $languages[$lang_key]['ALTNAME']; |
132 | } |
5d110fa6 |
133 | } |
39d3ec89 |
134 | } |
ce393174 |
135 | } |
e557fdb0 |
136 | asort($language_values); |
8405d0a4 |
137 | $language_values = |
138 | array_merge(array('' => _("Default")), $language_values); |
ec2c91a1 |
139 | $language = $squirrelmail_language; |
39d3ec89 |
140 | if (strtoupper($available_languages)!='NONE') { |
141 | // if set to 'none', interface will use only default language |
142 | $optvals[SMOPT_GRP_GENERAL][] = array( |
143 | 'name' => 'language', |
144 | 'caption' => _("Language"), |
145 | 'type' => SMOPT_TYPE_STRLIST, |
146 | 'refresh' => SMOPT_REFRESH_ALL, |
92afa1c0 |
147 | 'posvals' => $language_values, |
148 | 'htmlencoded' => true |
39d3ec89 |
149 | ); |
150 | } |
ce393174 |
151 | |
a3ec3c91 |
152 | /* Set values for the "use javascript" option. */ |
bbcafebd |
153 | $optvals[SMOPT_GRP_GENERAL][] = array( |
a3ec3c91 |
154 | 'name' => 'javascript_setting', |
ce393174 |
155 | 'caption' => _("Use Javascript"), |
a3ec3c91 |
156 | 'type' => SMOPT_TYPE_STRLIST, |
157 | 'refresh' => SMOPT_REFRESH_ALL, |
158 | 'posvals' => array(SMPREF_JS_AUTODETECT => _("Autodetect"), |
159 | SMPREF_JS_ON => _("Always"), |
ae958cd3 |
160 | SMPREF_JS_OFF => _("Never")), |
161 | 'save' => 'save_option_javascript_autodetect', |
162 | 'script' => 'onclick="document.forms[0].new_js_autodetect_results.value = \'' . SMPREF_JS_ON . '\';"' |
a3ec3c91 |
163 | ); |
164 | |
bbcafebd |
165 | $optvals[SMOPT_GRP_GENERAL][] = array( |
a3ec3c91 |
166 | 'name' => 'js_autodetect_results', |
167 | 'caption' => '', |
168 | 'type' => SMOPT_TYPE_HIDDEN, |
ae958cd3 |
169 | 'refresh' => SMOPT_REFRESH_NONE |
5826affb |
170 | //'post_script' => $js_autodetect_script, |
a3ec3c91 |
171 | ); |
172 | |
bbcafebd |
173 | /*** Load the General Options into the array ***/ |
174 | $optgrps[SMOPT_GRP_MAILBOX] = _("Mailbox Display Options"); |
175 | $optvals[SMOPT_GRP_MAILBOX] = array(); |
176 | |
177 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
a3ec3c91 |
178 | 'name' => 'show_num', |
179 | 'caption' => _("Number of Messages to Index"), |
180 | 'type' => SMOPT_TYPE_INTEGER, |
bbcafebd |
181 | 'refresh' => SMOPT_REFRESH_NONE, |
182 | 'size' => SMOPT_SIZE_TINY |
a3ec3c91 |
183 | ); |
184 | |
bbcafebd |
185 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
a440e68f |
186 | 'name' => 'alt_index_colors', |
187 | 'caption' => _("Enable Alternating Row Colors"), |
188 | 'type' => SMOPT_TYPE_BOOLEAN, |
189 | 'refresh' => SMOPT_REFRESH_NONE |
190 | ); |
191 | |
6395c46d |
192 | if ($use_icons) { |
193 | global $icon_themes, $icon_theme; |
194 | $temp = array(); |
195 | for ($count = 0; $count < sizeof($icon_themes); $count++) { |
196 | $temp[$count] = $icon_themes[$count]['NAME']; |
197 | if ($icon_theme == $icon_themes[$count]['PATH']) |
198 | $value = $count; |
199 | } |
4f7a5870 |
200 | if (sizeof($icon_themes) > 0) { |
201 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
202 | 'name' => 'icon_theme', |
203 | 'caption' => _("Message Flags Icon Theme"), |
204 | 'type' => SMOPT_TYPE_STRLIST, |
205 | 'refresh' => SMOPT_REFRESH_NONE, |
206 | 'posvals' => $temp, |
207 | 'initial_value' => $value, |
208 | 'save' => 'icon_theme_save' |
209 | ); |
210 | } |
6395c46d |
211 | } |
212 | |
fd181f53 |
213 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
214 | 'name' => 'show_flag_buttons', |
215 | 'caption' => _("Show Flag / Unflag Buttons"), |
216 | 'type' => SMOPT_TYPE_BOOLEAN, |
217 | 'refresh' => SMOPT_REFRESH_NONE |
218 | ); |
219 | |
bbcafebd |
220 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
a440e68f |
221 | 'name' => 'page_selector', |
222 | 'caption' => _("Enable Page Selector"), |
223 | 'type' => SMOPT_TYPE_BOOLEAN, |
224 | 'refresh' => SMOPT_REFRESH_NONE |
225 | ); |
226 | |
bbcafebd |
227 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
a440e68f |
228 | 'name' => 'page_selector_max', |
229 | 'caption' => _("Maximum Number of Pages to Show"), |
230 | 'type' => SMOPT_TYPE_INTEGER, |
bbcafebd |
231 | 'refresh' => SMOPT_REFRESH_NONE, |
232 | 'size' => SMOPT_SIZE_TINY |
a440e68f |
233 | ); |
234 | |
3e3b60e3 |
235 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
236 | 'name' => 'show_full_date', |
237 | 'caption' => _("Always Show Full Date"), |
238 | 'type' => SMOPT_TYPE_BOOLEAN, |
239 | 'refresh' => SMOPT_REFRESH_NONE |
240 | ); |
241 | |
459e3347 |
242 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
243 | 'name' => 'truncate_sender', |
244 | 'caption' => _("Length of From/To Field (0 for full)"), |
245 | 'type' => SMOPT_TYPE_INTEGER, |
246 | 'refresh' => SMOPT_REFRESH_NONE, |
247 | 'size' => SMOPT_SIZE_TINY |
248 | ); |
249 | |
3fc1a95f |
250 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
251 | 'name' => 'truncate_subject', |
252 | 'caption' => _("Length of Subject Field (0 for full)"), |
253 | 'type' => SMOPT_TYPE_INTEGER, |
254 | 'refresh' => SMOPT_REFRESH_NONE, |
255 | 'size' => SMOPT_SIZE_TINY |
256 | ); |
257 | |
1ae2832e |
258 | $optvals[SMOPT_GRP_MAILBOX][] = array( |
259 | 'name' => 'show_recipient_instead', |
260 | 'caption' => _("Show recipient name if the message is from your default identity"), |
261 | 'type' => SMOPT_TYPE_BOOLEAN, |
262 | 'refresh' => SMOPT_REFRESH_NONE, |
263 | 'size' => SMOPT_SIZE_TINY |
264 | ); |
265 | |
459e3347 |
266 | |
bbcafebd |
267 | /*** Load the General Options into the array ***/ |
268 | $optgrps[SMOPT_GRP_MESSAGE] = _("Message Display and Composition"); |
269 | $optvals[SMOPT_GRP_MESSAGE] = array(); |
270 | |
271 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
a3ec3c91 |
272 | 'name' => 'wrap_at', |
273 | 'caption' => _("Wrap Incoming Text At"), |
274 | 'type' => SMOPT_TYPE_INTEGER, |
bbcafebd |
275 | 'refresh' => SMOPT_REFRESH_NONE, |
276 | 'size' => SMOPT_SIZE_TINY |
a3ec3c91 |
277 | ); |
278 | |
bbcafebd |
279 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
a3ec3c91 |
280 | 'name' => 'editor_size', |
3cb80c8c |
281 | 'caption' => _("Width of Editor Window"), |
282 | 'type' => SMOPT_TYPE_INTEGER, |
283 | 'refresh' => SMOPT_REFRESH_NONE, |
284 | 'size' => SMOPT_SIZE_TINY |
285 | ); |
286 | |
287 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
288 | 'name' => 'editor_height', |
289 | 'caption' => _("Height of Editor Window"), |
a3ec3c91 |
290 | 'type' => SMOPT_TYPE_INTEGER, |
bbcafebd |
291 | 'refresh' => SMOPT_REFRESH_NONE, |
292 | 'size' => SMOPT_SIZE_TINY |
a3ec3c91 |
293 | ); |
294 | |
bbcafebd |
295 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
a3ec3c91 |
296 | 'name' => 'location_of_buttons', |
ce393174 |
297 | 'caption' => _("Location of Buttons when Composing"), |
a3ec3c91 |
298 | 'type' => SMOPT_TYPE_STRLIST, |
299 | 'refresh' => SMOPT_REFRESH_NONE, |
ce393174 |
300 | 'posvals' => array(SMPREF_LOC_TOP => _("Before headers"), |
301 | SMPREF_LOC_BETWEEN => _("Between headers and message body"), |
302 | SMPREF_LOC_BOTTOM => _("After message body")) |
a3ec3c91 |
303 | ); |
304 | |
07687736 |
305 | |
bbcafebd |
306 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
a440e68f |
307 | 'name' => 'use_javascript_addr_book', |
308 | 'caption' => _("Addressbook Display Format"), |
ce393174 |
309 | 'type' => SMOPT_TYPE_STRLIST, |
a440e68f |
310 | 'refresh' => SMOPT_REFRESH_NONE, |
311 | 'posvals' => array('1' => _("Javascript"), |
312 | '0' => _("HTML")) |
fd87494d |
313 | ); |
314 | |
bbcafebd |
315 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
fd87494d |
316 | 'name' => 'show_html_default', |
317 | 'caption' => _("Show HTML Version by Default"), |
318 | 'type' => SMOPT_TYPE_BOOLEAN, |
319 | 'refresh' => SMOPT_REFRESH_NONE |
320 | ); |
321 | |
bbcafebd |
322 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
6206f6c4 |
323 | 'name' => 'enable_forward_as_attachment', |
324 | 'caption' => _("Enable Forward as Attachment"), |
fd87494d |
325 | 'type' => SMOPT_TYPE_BOOLEAN, |
326 | 'refresh' => SMOPT_REFRESH_NONE |
327 | ); |
328 | |
a0bc3274 |
329 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
330 | 'name' => 'forward_cc', |
6206f6c4 |
331 | 'caption' => _("Include CCs when Forwarding Messages"), |
332 | 'type' => SMOPT_TYPE_BOOLEAN, |
333 | 'refresh' => SMOPT_REFRESH_NONE |
334 | ); |
335 | |
336 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
337 | 'name' => 'include_self_reply_all', |
338 | 'caption' => _("Include Me in CC when I Reply All"), |
a0bc3274 |
339 | 'type' => SMOPT_TYPE_BOOLEAN, |
340 | 'refresh' => SMOPT_REFRESH_NONE |
341 | ); |
342 | |
bbcafebd |
343 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
9ab0d96f |
344 | 'name' => 'show_xmailer_default', |
a440e68f |
345 | 'caption' => _("Enable Mailer Display"), |
9ab0d96f |
346 | 'type' => SMOPT_TYPE_BOOLEAN, |
347 | 'refresh' => SMOPT_REFRESH_NONE |
348 | ); |
349 | |
7baf86a9 |
350 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
351 | 'name' => 'attachment_common_show_images', |
10f0ce72 |
352 | 'caption' => _("Display Attached Images with Message"), |
7baf86a9 |
353 | 'type' => SMOPT_TYPE_BOOLEAN, |
354 | 'refresh' => SMOPT_REFRESH_NONE |
355 | ); |
356 | |
f226cba7 |
357 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
358 | 'name' => 'pf_cleandisplay', |
10f0ce72 |
359 | 'caption' => _("Enable Printer Friendly Clean Display"), |
f226cba7 |
360 | 'type' => SMOPT_TYPE_BOOLEAN, |
361 | 'refresh' => SMOPT_REFRESH_NONE |
362 | ); |
07687736 |
363 | |
57257333 |
364 | if ($default_use_mdn) { |
365 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
366 | 'name' => 'mdn_user_support', |
6206f6c4 |
367 | 'caption' => _("Enable Mail Delivery Notification"), |
57257333 |
368 | 'type' => SMOPT_TYPE_BOOLEAN, |
369 | 'refresh' => SMOPT_REFRESH_NONE |
370 | ); |
371 | } |
07687736 |
372 | |
9c3e6cd4 |
373 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
374 | 'name' => 'compose_new_win', |
6206f6c4 |
375 | 'caption' => _("Compose Messages in New Window"), |
9c3e6cd4 |
376 | 'type' => SMOPT_TYPE_BOOLEAN, |
377 | 'refresh' => SMOPT_REFRESH_ALL |
378 | ); |
07687736 |
379 | |
380 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
381 | 'name' => 'compose_width', |
6206f6c4 |
382 | 'caption' => _("Width of Compose Window"), |
07687736 |
383 | 'type' => SMOPT_TYPE_INTEGER, |
384 | 'refresh' => SMOPT_REFRESH_ALL, |
385 | 'size' => SMOPT_SIZE_TINY |
386 | ); |
387 | |
388 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
389 | 'name' => 'compose_height', |
6206f6c4 |
390 | 'caption' => _("Height of Compose Window"), |
07687736 |
391 | 'type' => SMOPT_TYPE_INTEGER, |
392 | 'refresh' => SMOPT_REFRESH_ALL, |
393 | 'size' => SMOPT_SIZE_TINY |
394 | ); |
395 | |
3b17e952 |
396 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
397 | 'name' => 'sig_first', |
6206f6c4 |
398 | 'caption' => _("Append Signature before Reply/Forward Text"), |
3b17e952 |
399 | 'type' => SMOPT_TYPE_BOOLEAN, |
400 | 'refresh' => SMOPT_REFRESH_NONE |
401 | ); |
07687736 |
402 | |
a46ecf66 |
403 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
404 | 'name' => 'body_quote', |
405 | 'caption' => _("Prefix for Original Message when Replying"), |
406 | 'type' => SMOPT_TYPE_STRING, |
407 | 'refresh' => SMOPT_REFRESH_NONE, |
408 | 'size' => SMOPT_SIZE_TINY, |
409 | 'save' => 'save_option_reply_prefix' |
410 | ); |
411 | |
9f2f6126 |
412 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
413 | 'name' => 'reply_focus', |
414 | 'caption' => _("Cursor Position when Replying"), |
415 | 'type' => SMOPT_TYPE_STRLIST, |
416 | 'refresh' => SMOPT_REFRESH_NONE, |
417 | 'posvals' => array('' => _("To: field"), |
418 | 'focus' => _("Focus in body"), |
192cdcf5 |
419 | 'select' => _("Select body"), |
420 | 'none' => _("No focus")) |
9f2f6126 |
421 | ); |
422 | |
4ee86d70 |
423 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
424 | 'name' => 'strip_sigs', |
425 | 'caption' => _("Strip signature when replying"), |
426 | 'type' => SMOPT_TYPE_BOOLEAN, |
427 | 'refresh' => SMOPT_REFRESH_NONE |
428 | ); |
429 | |
df9fdeb9 |
430 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
431 | 'name' => 'internal_date_sort', |
be1f2f58 |
432 | 'caption' => _("Sort by Received Date"), |
df9fdeb9 |
433 | 'type' => SMOPT_TYPE_BOOLEAN, |
434 | 'refresh' => SMOPT_REFRESH_ALL |
435 | ); |
794d59c0 |
436 | if ($allow_thread_sort == TRUE) { |
7c612fdd |
437 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
438 | 'name' => 'sort_by_ref', |
6206f6c4 |
439 | 'caption' => _("Enable Thread Sort by References Header"), |
7c612fdd |
440 | 'type' => SMOPT_TYPE_BOOLEAN, |
441 | 'refresh' => SMOPT_REFRESH_ALL |
442 | ); |
4267d5de |
443 | $optvals[SMOPT_GRP_MESSAGE][] = array( |
444 | 'name' => 'delete_prev_next_display', |
445 | 'caption' => _("Show 'Delete & Prev/Next' Links"), |
446 | 'type' => SMOPT_TYPE_BOOLEAN, |
447 | 'refresh' => SMOPT_REFRESH_ALL |
448 | ); |
5d110fa6 |
449 | |
7c612fdd |
450 | } |
cbe5423b |
451 | /* Assemble all this together and return it as our result. */ |
452 | $result = array( |
453 | 'grps' => $optgrps, |
ae958cd3 |
454 | 'vals' => $optvals |
cbe5423b |
455 | ); |
456 | return ($result); |
457 | } |
a3ec3c91 |
458 | |
cbe5423b |
459 | /******************************************************************/ |
460 | /** Define any specialized save functions for this option page. ***/ |
461 | /******************************************************************/ |
f1e6f580 |
462 | |
5d110fa6 |
463 | function save_option_header($option) { |
464 | } |
465 | |
48af4b64 |
466 | /** |
467 | * This function saves a new theme setting. |
468 | * It updates the theme array. |
469 | */ |
cbe5423b |
470 | function save_option_theme($option) { |
471 | global $theme; |
bb7173fa |
472 | |
cbe5423b |
473 | /* Do checking to make sure $new_theme is in the array. */ |
474 | $theme_in_array = false; |
475 | for ($i = 0; $i < count($theme); ++$i) { |
476 | if ($theme[$i]['PATH'] == $option->new_value) { |
477 | $theme_in_array = true; |
478 | break; |
479 | } |
480 | } |
481 | |
482 | if (!$theme_in_array) { |
483 | $option->new_value = ''; |
484 | } |
e7db48af |
485 | |
cbe5423b |
486 | /* Save the option like normal. */ |
487 | save_option($option); |
488 | } |
e7db48af |
489 | |
48af4b64 |
490 | /** |
491 | * This function saves the javascript detection option. |
492 | */ |
cbe5423b |
493 | function save_option_javascript_autodetect($option) { |
ae958cd3 |
494 | global $data_dir, $username; |
23d6bd09 |
495 | |
ae958cd3 |
496 | save_option($option); |
497 | checkForJavascript(TRUE); |
cbe5423b |
498 | } |
499 | |
5d110fa6 |
500 | /** |
6395c46d |
501 | * This function saves the user's icon theme setting |
502 | */ |
503 | function icon_theme_save($option) { |
504 | |
505 | global $icon_themes, $data_dir, $username; |
506 | |
507 | |
5d110fa6 |
508 | // Don't assume the new value is there, double check |
509 | // and only save if found |
6395c46d |
510 | // |
511 | if (isset($icon_themes[$option->new_value]['PATH'])) |
512 | setPref($data_dir, $username, 'icon_theme', $icon_themes[$option->new_value]['PATH']); |
513 | else |
514 | setPref($data_dir, $username, 'icon_theme', 'none'); |
515 | |
516 | } |
517 | |
5d110fa6 |
518 | /** |
a46ecf66 |
519 | * This function saves the reply prefix (body_quote) character(s) |
520 | */ |
521 | function save_option_reply_prefix($option) { |
522 | global $data_dir, $username, $new_javascript_setting; |
523 | |
524 | // save as "NONE" if it was blanked out |
525 | // |
526 | if (empty($option->new_value)) $option->new_value = 'NONE'; |
527 | |
528 | |
529 | // Save the option like normal. |
530 | // |
531 | save_option($option); |
532 | |
533 | } |
534 | |
bb7173fa |
535 | ?> |