59177427 |
1 | <?php |
d3cdb279 |
2 | |
35586184 |
3 | /** |
4 | * options.php |
5 | * |
35586184 |
6 | * Displays the options page. Pulls from proper user preference files |
7 | * and config.php. Displays preferences as selected and other options. |
8 | * |
d4e46166 |
9 | * @copyright © 1999-2009 The SquirrelMail Project Team |
4b4abf93 |
10 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
30967a1e |
11 | * @version $Id$ |
8f6f9ba5 |
12 | * @package squirrelmail |
ca479ad1 |
13 | * @subpackage prefs |
35586184 |
14 | */ |
cbe5423b |
15 | |
ebd2391c |
16 | /** This is the options page */ |
17 | define('PAGE_NAME', 'options'); |
18 | |
30967a1e |
19 | /** |
202bcbcc |
20 | * Include the SquirrelMail initialization file. |
30967a1e |
21 | */ |
202bcbcc |
22 | require('../include/init.php'); |
86725763 |
23 | |
24 | /* SquirrelMail required files. */ |
202bcbcc |
25 | |
26 | //include(SM_PATH . 'functions/imap_general.php'); |
27 | require_once(SM_PATH . 'functions/options.php'); |
28 | require_once(SM_PATH . 'functions/forms.php'); |
cbe5423b |
29 | |
cbe5423b |
30 | /*********************************/ |
31 | /*** Build the resultant page. ***/ |
32 | /*********************************/ |
33 | |
cbe5423b |
34 | define('SMOPT_MODE_DISPLAY', 'display'); |
35 | define('SMOPT_MODE_SUBMIT', 'submit'); |
36 | define('SMOPT_MODE_LINK', 'link'); |
37 | |
38 | define('SMOPT_PAGE_MAIN', 'main'); |
39 | define('SMOPT_PAGE_PERSONAL', 'personal'); |
40 | define('SMOPT_PAGE_DISPLAY', 'display'); |
5ed9d4fd |
41 | define('SMOPT_PAGE_COMPOSE', 'compose'); |
8949acd6 |
42 | define('SMOPT_PAGE_ACCESSIBILITY', 'accessibility'); |
cbe5423b |
43 | define('SMOPT_PAGE_HIGHLIGHT', 'highlight'); |
44 | define('SMOPT_PAGE_FOLDER', 'folder'); |
45 | define('SMOPT_PAGE_ORDER', 'order'); |
46 | |
8abb7e3a |
47 | /** |
48 | * Save submitted options and calculate the most |
49 | * we need to refresh the page |
50 | * |
51 | * @param string $optpage The name of the page being submitted |
52 | * @param array $optpage_data An array of all the submitted options |
53 | * |
54 | * @return int The highest level of screen refresh needed per |
55 | * the options that were changed. This value will |
56 | * correspond to the SMOPT_REFRESH_* constants found |
57 | * in functions/options.php. |
58 | * |
59 | */ |
cbe5423b |
60 | function process_optionmode_submit($optpage, $optpage_data) { |
61 | /* Initialize the maximum option refresh level. */ |
62 | $max_refresh = SMOPT_REFRESH_NONE; |
63 | |
209e24bb |
64 | |
65 | |
cbe5423b |
66 | /* Save each option in each option group. */ |
67 | foreach ($optpage_data['options'] as $option_grp) { |
68 | foreach ($option_grp['options'] as $option) { |
209e24bb |
69 | |
70 | /* Special case: need to make sure emailaddress |
71 | * is saved if we use it as a test for ask_user_info */ |
72 | global $ask_user_info; |
73 | if ( $optpage = SMOPT_PAGE_PERSONAL && $ask_user_info && |
74 | $option->name == 'email_address' ) { |
75 | $option->setValue(''); |
76 | } |
77 | |
534367eb |
78 | /* Remove Debug Mode Until Needed |
cbe5423b |
79 | echo "name = '$option->name', " |
80 | . "value = '$option->value', " |
6206f6c4 |
81 | . "new_value = '$option->new_value'\n"; |
244a64a4 |
82 | //FIXME: NO HTML IN THE CORE! |
39bfea8f |
83 | echo "<br />"; |
534367eb |
84 | */ |
cbe5423b |
85 | if ($option->changed()) { |
86 | $option->save(); |
87 | $max_refresh = max($max_refresh, $option->refresh_level); |
88 | } |
89 | } |
90 | } |
1e0628fb |
91 | |
cbe5423b |
92 | /* Return the max refresh level. */ |
93 | return ($max_refresh); |
94 | } |
95 | |
96 | function process_optionmode_link($optpage) { |
97 | /* There will be something here, later. */ |
98 | } |
99 | |
0b0e96c5 |
100 | |
0b0e96c5 |
101 | |
102 | /* ---------------------------- main ---------------------------- */ |
103 | |
a32985a5 |
104 | /* get the globals that we may need */ |
1e12d1ff |
105 | sqgetGlobalVar('optpage', $optpage); |
5ccba4f3 |
106 | sqgetGlobalVar('optmode', $optmode, SQ_FORM); |
1e12d1ff |
107 | sqgetGlobalVar('optpage_data',$optpage_data, SQ_POST); |
a32985a5 |
108 | /* end of getting globals */ |
109 | |
cbe5423b |
110 | /* Make sure we have an Option Page set. Default to main. */ |
c1f7790a |
111 | if ( !isset($optpage) || $optpage == '' ) { |
112 | $optpage = SMOPT_PAGE_MAIN; |
113 | } else { |
114 | $optpage = strip_tags( $optpage ); |
cbe5423b |
115 | } |
116 | |
117 | /* Make sure we have an Option Mode set. Default to display. */ |
118 | if (!isset($optmode)) { |
119 | $optmode = SMOPT_MODE_DISPLAY; |
120 | } |
121 | |
0b0e96c5 |
122 | /* |
91e0dccc |
123 | * First, set the load information for each option page. |
0b0e96c5 |
124 | */ |
cbe5423b |
125 | |
126 | /* Initialize load information variables. */ |
127 | $optpage_name = ''; |
128 | $optpage_file = ''; |
129 | $optpage_loader = ''; |
130 | |
131 | /* Set the load information for each page. */ |
132 | switch ($optpage) { |
91e0dccc |
133 | case SMOPT_PAGE_MAIN: |
c1f7790a |
134 | break; |
cbe5423b |
135 | case SMOPT_PAGE_PERSONAL: |
a3439b27 |
136 | $optpage_name = _("Personal Information"); |
08185f2a |
137 | $optpage_file = SM_PATH . 'include/options/personal.php'; |
a3439b27 |
138 | $optpage_loader = 'load_optpage_data_personal'; |
139 | $optpage_loadhook = 'optpage_loadhook_personal'; |
cbe5423b |
140 | break; |
141 | case SMOPT_PAGE_DISPLAY: |
142 | $optpage_name = _("Display Preferences"); |
08185f2a |
143 | $optpage_file = SM_PATH . 'include/options/display.php'; |
cbe5423b |
144 | $optpage_loader = 'load_optpage_data_display'; |
a3439b27 |
145 | $optpage_loadhook = 'optpage_loadhook_display'; |
cbe5423b |
146 | break; |
5ed9d4fd |
147 | case SMOPT_PAGE_COMPOSE: |
148 | $optpage_name = _("Compose Preferences"); |
149 | $optpage_file = SM_PATH . 'include/options/compose.php'; |
150 | $optpage_loader = 'load_optpage_data_compose'; |
151 | $optpage_loadhook = 'optpage_loadhook_compose'; |
152 | break; |
8949acd6 |
153 | case SMOPT_PAGE_ACCESSIBILITY: |
154 | $optpage_name = _("Accessibility Preferences"); |
155 | $optpage_file = SM_PATH . 'include/options/accessibility.php'; |
156 | $optpage_loader = 'load_optpage_data_accessibility'; |
157 | $optpage_loadhook = 'optpage_loadhook_accessibility'; |
158 | break; |
cbe5423b |
159 | case SMOPT_PAGE_HIGHLIGHT: |
160 | $optpage_name = _("Message Highlighting"); |
08185f2a |
161 | $optpage_file = SM_PATH . 'include/options/highlight.php'; |
cbe5423b |
162 | $optpage_loader = 'load_optpage_data_highlight'; |
a3439b27 |
163 | $optpage_loadhook = 'optpage_loadhook_highlight'; |
cbe5423b |
164 | break; |
165 | case SMOPT_PAGE_FOLDER: |
166 | $optpage_name = _("Folder Preferences"); |
08185f2a |
167 | $optpage_file = SM_PATH . 'include/options/folder.php'; |
cbe5423b |
168 | $optpage_loader = 'load_optpage_data_folder'; |
a3439b27 |
169 | $optpage_loadhook = 'optpage_loadhook_folder'; |
cbe5423b |
170 | break; |
171 | case SMOPT_PAGE_ORDER: |
172 | $optpage_name = _("Index Order"); |
08185f2a |
173 | $optpage_file = SM_PATH . 'include/options/order.php'; |
cbe5423b |
174 | $optpage_loader = 'load_optpage_data_order'; |
a3439b27 |
175 | $optpage_loadhook = 'optpage_loadhook_order'; |
cbe5423b |
176 | break; |
6e515418 |
177 | default: do_hook('optpage_set_loadinfo', $null); |
cbe5423b |
178 | } |
179 | |
180 | /**********************************************************/ |
181 | /*** Second, load the option information for this page. ***/ |
182 | /**********************************************************/ |
183 | |
a32985a5 |
184 | if ( !@is_file( $optpage_file ) ) { |
c1f7790a |
185 | $optpage = SMOPT_PAGE_MAIN; |
64033e1c |
186 | } elseif ($optpage != SMOPT_PAGE_MAIN ) { |
cbe5423b |
187 | /* Include the file for this optionpage. */ |
91e0dccc |
188 | |
cbe5423b |
189 | require_once($optpage_file); |
190 | |
191 | /* Assemble the data for this option page. */ |
192 | $optpage_data = array(); |
193 | $optpage_data = $optpage_loader(); |
6e515418 |
194 | do_hook($optpage_loadhook, $null); |
64033e1c |
195 | $optpage_data['options'] = create_option_groups($optpage_data['grps'], $optpage_data['vals']); |
cbe5423b |
196 | } |
197 | |
198 | /***********************************************************/ |
199 | /*** Next, process anything that needs to be processed. ***/ |
200 | /***********************************************************/ |
201 | |
288df1a0 |
202 | $optpage_save_error=array(); |
203 | |
cc61478a |
204 | if ( isset( $optpage_data ) ) { |
205 | switch ($optmode) { |
206 | case SMOPT_MODE_SUBMIT: |
207 | $max_refresh = process_optionmode_submit($optpage, $optpage_data); |
208 | break; |
209 | case SMOPT_MODE_LINK: |
210 | $max_refresh = process_optionmode_link($optpage, $optpage_data); |
211 | break; |
212 | } |
cbe5423b |
213 | } |
cbe5423b |
214 | |
2de8b87f |
215 | $optpage_title = _("Options"); |
216 | if (isset($optpage_name) && ($optpage_name != '')) { |
217 | $optpage_title .= " - $optpage_name"; |
218 | } |
219 | |
cbe5423b |
220 | /*******************************************************************/ |
221 | /* DO OLD SAVING OF SUBMITTED OPTIONS. THIS WILL BE REMOVED LATER. */ |
222 | /*******************************************************************/ |
223 | |
21f6d2ea |
224 | //FIXME: let's remove these finally in 1.5.2..... but first, are there any plugins using them? |
cbe5423b |
225 | /* If in submit mode, select a save hook name and run it. */ |
7e235a1a |
226 | if ($optmode == SMOPT_MODE_SUBMIT) { |
cbe5423b |
227 | /* Select a save hook name. */ |
228 | switch ($optpage) { |
229 | case SMOPT_PAGE_PERSONAL: |
230 | $save_hook_name = 'options_personal_save'; |
231 | break; |
232 | case SMOPT_PAGE_DISPLAY: |
233 | $save_hook_name = 'options_display_save'; |
234 | break; |
10ad5e30 |
235 | case SMOPT_PAGE_COMPOSE: |
236 | $save_hook_name = 'options_compose_save'; |
237 | break; |
8949acd6 |
238 | case SMOPT_PAGE_ACCESSIBILITY: |
239 | $save_hook_name = 'options_accessibility_save'; |
240 | break; |
cbe5423b |
241 | case SMOPT_PAGE_FOLDER: |
242 | $save_hook_name = 'options_folder_save'; |
243 | break; |
91e0dccc |
244 | default: |
cc61478a |
245 | $save_hook_name = 'options_save'; |
cbe5423b |
246 | break; |
247 | } |
b5efadfa |
248 | |
cbe5423b |
249 | /* Run the options save hook. */ |
6e515418 |
250 | do_hook($save_hook_name, $null); |
cbe5423b |
251 | } |
252 | |
253 | /***************************************************************/ |
254 | /* Apply logic to decide what optpage we want to display next. */ |
255 | /***************************************************************/ |
256 | |
257 | /* If this is the result of an option page being submitted, then */ |
258 | /* show the main page. Otherwise, show whatever page was called. */ |
259 | |
260 | if ($optmode == SMOPT_MODE_SUBMIT) { |
261 | $optpage = SMOPT_PAGE_MAIN; |
f31cc5f7 |
262 | $optpage_title = _("Options"); |
cbe5423b |
263 | } |
264 | |
2de8b87f |
265 | /***************************************************************/ |
266 | /* Finally, display whatever page we are supposed to show now. */ |
267 | /***************************************************************/ |
268 | |
876fdb60 |
269 | displayPageHeader($color, null, (isset($optpage_data['xtra']) ? $optpage_data['xtra'] : '')); |
2de8b87f |
270 | |
2de8b87f |
271 | /* |
272 | * The main option page has a different layout then the rest of the option |
273 | * pages. Therefore, we create it here first, then the others below. |
274 | */ |
275 | if ($optpage == SMOPT_PAGE_MAIN) { |
276 | /**********************************************************/ |
277 | /* First, display the results of a submission, if needed. */ |
278 | /**********************************************************/ |
279 | $notice = ''; |
280 | if ($optmode == SMOPT_MODE_SUBMIT) { |
281 | if (!isset($frame_top)) { |
282 | $frame_top = '_top'; |
283 | } |
284 | |
285 | if (isset($optpage_save_error) && $optpage_save_error!=array()) { |
8befffa8 |
286 | //FIXME: REMOVE HTML FROM CORE |
64033e1c |
287 | $notice = _("Error(s) occurred while saving your options") . "<br />\n<ul>\n"; |
2de8b87f |
288 | foreach ($optpage_save_error as $error_message) { |
289 | $notice.= '<li><small>' . $error_message . "</small></li>\n"; |
290 | } |
64033e1c |
291 | $notice.= "</ul>\n" . _("Some of your preference changes were not applied.") . "\n"; |
2de8b87f |
292 | } else { |
293 | /* Display a message indicating a successful save. */ |
1a7dcf9d |
294 | // i18n: The %s represents the name of the option page saving the options |
295 | $notice = sprintf(_("Successfully Saved Options: %s"), $optpage_name) . "<br />\n"; |
2de8b87f |
296 | } |
297 | |
298 | /* If $max_refresh != SMOPT_REFRESH_NONE, provide a refresh link. */ |
299 | if ( !isset( $max_refresh ) ) { |
300 | } else if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) { |
8befffa8 |
301 | //FIXME: REMOVE HTML FROM CORE - when migrating, keep in mind that the javascript below assumes the folder list is in a separate sibling frame under the same parent, and it is called "left" |
302 | if (checkForJavascript()) { |
303 | $notice .= sprintf(_("Folder list should automatically %srefresh%s."), '<a href="../src/left_main.php" target="left">', '</a>') . '<br /><script type="text/javascript">' . "\n<!--\nparent.left.location = '../src/left_main.php';\n// -->\n</script>\n"; |
304 | } else { |
305 | $notice .= '<a href="../src/left_main.php" target="left">' . _("Refresh Folder List") . '</a><br />'; |
306 | } |
2de8b87f |
307 | } else if ($max_refresh) { |
8befffa8 |
308 | if (checkForJavascript()) { |
309 | //FIXME: REMOVE HTML FROM CORE - when migrating, keep in mind that the javascript below assumes the parent is the top-most SM frame and is what should be refreshed with webmail.php |
310 | $notice .= sprintf(_("This page should automatically %srefresh%s."), '<a href="../src/webmail.php?right_frame=options.php" target="' . $frame_top . '">', '</a>') . '<br /><script type="text/javascript">' . "\n<!--\nparent.location = '../src/webmail.php?right_frame=options.php';\n// -->\n</script>\n"; |
311 | } else { |
312 | $notice .= '<a href="../src/webmail.php?right_frame=options.php" target="' . $frame_top . '">' . _("Refresh Page") . '</a><br />'; |
313 | } |
2de8b87f |
314 | } |
315 | } |
64033e1c |
316 | |
317 | if (!empty($notice)) { |
203f4ab0 |
318 | $oTemplate->assign('note', $notice); |
64033e1c |
319 | $oTemplate->display('note.tpl'); |
320 | } |
321 | |
2de8b87f |
322 | /******************************************/ |
323 | /* Build our array of Option Page Blocks. */ |
324 | /******************************************/ |
325 | $optpage_blocks = array(); |
326 | |
96698334 |
327 | // access keys... |
328 | global $accesskey_options_personal, $accesskey_options_display, |
329 | $accesskey_options_highlighting, $accesskey_options_folders, |
330 | $accesskey_options_index_order, $accesskey_options_compose, |
331 | $accesskey_options_accessibility; |
332 | |
2de8b87f |
333 | /* Build a section for Personal Options. */ |
334 | $optpage_blocks[] = array( |
96698334 |
335 | 'name' => _("Personal Information"), |
336 | 'url' => 'options.php?optpage=' . SMOPT_PAGE_PERSONAL, |
337 | 'desc' => _("This contains personal information about yourself such as your name, your email address, etc."), |
338 | 'js' => false, |
339 | 'accesskey' => $accesskey_options_personal, |
2de8b87f |
340 | ); |
341 | |
342 | /* Build a section for Display Options. */ |
343 | $optpage_blocks[] = array( |
96698334 |
344 | 'name' => _("Display Preferences"), |
345 | 'url' => 'options.php?optpage=' . SMOPT_PAGE_DISPLAY, |
346 | 'desc' => _("You can change the way that SquirrelMail looks and displays information to you, such as the colors, the language, and other settings."), |
347 | 'js' => false, |
348 | 'accesskey' => $accesskey_options_display, |
2de8b87f |
349 | ); |
350 | |
351 | /* Build a section for Message Highlighting Options. */ |
352 | $optpage_blocks[] = array( |
96698334 |
353 | 'name' =>_("Message Highlighting"), |
354 | 'url' => 'options_highlight.php', |
355 | '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."), |
356 | 'js' => false, |
357 | 'accesskey' => $accesskey_options_highlighting, |
2de8b87f |
358 | ); |
359 | |
360 | /* Build a section for Folder Options. */ |
361 | $optpage_blocks[] = array( |
96698334 |
362 | 'name' => _("Folder Preferences"), |
363 | 'url' => 'options.php?optpage=' . SMOPT_PAGE_FOLDER, |
364 | 'desc' => _("These settings change the way your folders are displayed and manipulated."), |
365 | 'js' => false, |
366 | 'accesskey' => $accesskey_options_folders, |
2de8b87f |
367 | ); |
368 | |
369 | /* Build a section for Index Order Options. */ |
370 | $optpage_blocks[] = array( |
96698334 |
371 | 'name' => _("Index Order"), |
372 | 'url' => 'options_order.php', |
373 | 'desc' => _("The order of the message index can be rearranged and changed to contain the headers in any order you want."), |
374 | 'js' => false, |
375 | 'accesskey' => $accesskey_options_index_order, |
2de8b87f |
376 | ); |
377 | |
378 | /* Build a section for Compose Options. */ |
379 | $optpage_blocks[] = array( |
96698334 |
380 | 'name' => _("Compose Preferences"), |
381 | 'url' => 'options.php?optpage=' . SMOPT_PAGE_COMPOSE, |
382 | 'desc' => _("Control the behaviour and layout of writing new mail messages, replying to and forwarding messages."), |
383 | 'js' => false, |
384 | 'accesskey' => $accesskey_options_compose, |
2de8b87f |
385 | ); |
386 | |
8949acd6 |
387 | /* Build a section for Accessibility Options. */ |
388 | $optpage_blocks[] = array( |
96698334 |
389 | 'name' => _("Accessibility Preferences"), |
390 | 'url' => 'options.php?optpage=' . SMOPT_PAGE_ACCESSIBILITY, |
391 | 'desc' => _("You can configure features that improve interface usability."), |
392 | 'js' => false, |
393 | 'accesskey' => $accesskey_options_accessibility, |
8949acd6 |
394 | ); |
395 | |
2de8b87f |
396 | /* Build a section for plugins wanting to register an optionpage. */ |
6e515418 |
397 | do_hook('optpage_register_block', $null); |
2de8b87f |
398 | |
399 | /*****************************************************/ |
400 | /* Let's sort Javascript Option Pages to the bottom. */ |
401 | /*****************************************************/ |
402 | $js_optpage_blocks = array(); |
403 | $reg_optpage_blocks = array(); |
404 | foreach ($optpage_blocks as $cur_optpage) { |
96698334 |
405 | if (!isset($cur_optpage['accesskey'])) { |
406 | $cur_optpage['accesskey'] = 'NONE'; |
407 | } |
2de8b87f |
408 | if (!isset($cur_optpage['js']) || !$cur_optpage['js']) { |
409 | $reg_optpage_blocks[] = $cur_optpage; |
457e8593 |
410 | } else if (checkForJavascript()) { |
2de8b87f |
411 | $js_optpage_blocks[] = $cur_optpage; |
412 | } |
413 | } |
414 | $optpage_blocks = array_merge($reg_optpage_blocks, $js_optpage_blocks); |
415 | |
416 | /********************************************/ |
417 | /* Now, print out each option page section. */ |
418 | /********************************************/ |
64033e1c |
419 | $oTemplate->assign('page_title', $optpage_title); |
420 | $oTemplate->assign('options', $optpage_blocks); |
2de8b87f |
421 | |
2de8b87f |
422 | $oTemplate->display('option_groups.tpl'); |
64033e1c |
423 | |
6e515418 |
424 | do_hook('options_link_and_description', $null); |
cbe5423b |
425 | |
cbe5423b |
426 | |
2de8b87f |
427 | /*************************************************************************/ |
428 | /* If we are not looking at the main option page, display the page here. */ |
429 | /*************************************************************************/ |
430 | } else { |
fcc81e7a |
431 | /* Set the bottom_hook_name and submit_name. */ |
2de8b87f |
432 | switch ($optpage) { |
433 | case SMOPT_PAGE_PERSONAL: |
2de8b87f |
434 | $bottom_hook_name = 'options_personal_bottom'; |
435 | $submit_name = 'submit_personal'; |
436 | break; |
437 | case SMOPT_PAGE_DISPLAY: |
2de8b87f |
438 | $bottom_hook_name = 'options_display_bottom'; |
439 | $submit_name = 'submit_display'; |
440 | break; |
441 | case SMOPT_PAGE_COMPOSE: |
2de8b87f |
442 | $bottom_hook_name = 'options_compose_bottom'; |
443 | $submit_name = 'submit_compose'; |
444 | break; |
8949acd6 |
445 | case SMOPT_PAGE_ACCESSIBILITY: |
446 | $bottom_hook_name = 'options_accessibility_bottom'; |
447 | $submit_name = 'submit_accessibility'; |
448 | break; |
2de8b87f |
449 | case SMOPT_PAGE_HIGHLIGHT: |
2de8b87f |
450 | $bottom_hook_name = 'options_highlight_bottom'; |
451 | $submit_name = 'submit_highlight'; |
452 | break; |
453 | case SMOPT_PAGE_FOLDER: |
2de8b87f |
454 | $bottom_hook_name = 'options_folder_bottom'; |
455 | $submit_name = 'submit_folder'; |
456 | break; |
457 | case SMOPT_PAGE_ORDER: |
2de8b87f |
458 | $bottom_hook_name = 'options_order_bottom'; |
459 | $submit_name = 'submit_order'; |
460 | break; |
461 | default: |
2de8b87f |
462 | $bottom_hook_name = ''; |
463 | $submit_name = 'submit'; |
464 | } |
465 | |
64033e1c |
466 | // Begin output form |
c4e3cf06 |
467 | echo addForm('options.php', 'post', 'option_form') |
64033e1c |
468 | . create_optpage_element($optpage) |
469 | . create_optmode_element(SMOPT_MODE_SUBMIT); |
470 | |
64033e1c |
471 | // This is the only variable that is needed by *just* the template. |
6c06cf54 |
472 | $oTemplate->assign('option_groups', $optpage_data['options']); |
64033e1c |
473 | |
ad3aa533 |
474 | global $ask_user_info, $org_name; |
75b4ac6f |
475 | if ( $optpage == SMOPT_PAGE_PERSONAL && $ask_user_info |
209e24bb |
476 | && getPref($data_dir, $username,'email_address') == "" ) { |
477 | $oTemplate->assign('topmessage', |
ad3aa533 |
478 | sprintf(_("Welcome to %s. Please supply your full name and email address."), $org_name) ); |
209e24bb |
479 | } |
480 | |
fcc81e7a |
481 | // These variables are not specifically needed by the template, |
482 | // but they are relevant to the page being built, so we'll add |
483 | // them in case some plugin is modifying the page, etc.... |
484 | // |
64033e1c |
485 | $oTemplate->assign('max_refresh', isset($max_refresh) ? $max_refresh : NULL); |
486 | $oTemplate->assign('page_title', $optpage_title); |
fcc81e7a |
487 | $oTemplate->assign('optpage', $optpage); |
488 | $oTemplate->assign('optpage_name', $optpage_name); |
489 | $oTemplate->assign('optmode', $optmode); |
490 | $oTemplate->assign('optpage_data', $optpage_data); |
64033e1c |
491 | |
835db280 |
492 | $oTemplate->assign('submit_name', $submit_name); |
64033e1c |
493 | $oTemplate->display('options.tpl'); |
494 | |
244a64a4 |
495 | $oTemplate->display('form_close.tpl'); |
2de8b87f |
496 | |
497 | /* If it is not empty, trigger the bottom hook. */ |
498 | if ($bottom_hook_name != '') { |
6e515418 |
499 | do_hook($bottom_hook_name, $null); |
2de8b87f |
500 | } |
64033e1c |
501 | |
2de8b87f |
502 | } |
a2b193bc |
503 | |
6e4bf7c9 |
504 | $oTemplate->display('footer.tpl'); |