/**
* options.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Displays the options page. Pulls from proper user preference files
* and config.php. Displays preferences as selected and other options.
*
* $Id$
+ * @package squirrelmail
*/
-/* Path for SquirrelMail required files. */
+/** Path for SquirrelMail required files. */
define('SM_PATH','../');
/* SquirrelMail required files. */
require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/global.php');
require_once(SM_PATH . 'functions/display_messages.php');
require_once(SM_PATH . 'functions/imap.php');
require_once(SM_PATH . 'functions/options.php');
require_once(SM_PATH . 'functions/strings.php');
require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/forms.php');
/*********************************/
/*** Build the resultant page. ***/
/*********************************/
-displayPageHeader($color, 'None');
-
define('SMOPT_MODE_DISPLAY', 'display');
define('SMOPT_MODE_SUBMIT', 'submit');
define('SMOPT_MODE_LINK', 'link');
/* ---------------------------- main ---------------------------- */
/* get the globals that we may need */
-if (isset($_GET['optpage'])) {
- $optpage = $_GET['optpage'];
-}
-elseif (isset($_POST['optpage'])) {
- $optpage = $_POST['optpage'];
-}
-if (isset($_POST['optmode'])) {
- $optmode = $_POST['optmode'];
-}
-if (isset($_POST['optpage_data'])) {
- $optpage_data = $_POST['optpage_data'];
-}
-$username = $_SESSION['username'];
-$key = $_COOKIE['key'];
-$onetimepad = $_SESSION['onetimepad'];
-$delimiter = $_SESSION['delimiter'];
-
+sqgetGlobalVar('key', $key, SQ_COOKIE);
+sqgetGlobalVar('username', $username, SQ_SESSION);
+sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
+sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
+
+sqgetGlobalVar('optpage', $optpage);
+sqgetGlobalVar('optmode', $optmode, SQ_FORM);
+sqgetGlobalVar('optpage_data',$optpage_data, SQ_POST);
/* end of getting globals */
/* Make sure we have an Option Page set. Default to main. */
break;
}
}
-/*** MOVE THIS DISPLAY CODE DOWN EVENTUALLY!!! ***/
$optpage_title = _("Options");
if (isset($optpage_name) && ($optpage_name != '')) {
$optpage_title .= " - $optpage_name";
}
-echo html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) . "\n" .
- html_tag( 'tr' ) . "\n" .
- html_tag( 'td', '', 'center' ) .
- "<b>$optpage_title</b><br>\n".
- html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n" .
- html_tag( 'tr' ) . "\n" .
- html_tag( 'td', '', 'center', $color[4] ) . "\n";
-
/*******************************************************************/
/* DO OLD SAVING OF SUBMITTED OPTIONS. THIS WILL BE REMOVED LATER. */
/*******************************************************************/
/* Finally, display whatever page we are supposed to show now. */
/***************************************************************/
+displayPageHeader($color, 'None', (isset($optpage_data['xtra']) ? $optpage_data['xtra'] : ''));
+
+echo html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) . "\n" .
+ html_tag( 'tr' ) . "\n" .
+ html_tag( 'td', '', 'center' ) .
+ "<b>$optpage_title</b><br>\n".
+ html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n" .
+ html_tag( 'tr' ) . "\n" .
+ html_tag( 'td', '', 'center', $color[4] ) . "\n";
+
/*
* The main option page has a different layout then the rest of the option
* pages. Therefore, we create it here first, then the others below.
$js_optpage_blocks = array();
$reg_optpage_blocks = array();
foreach ($optpage_blocks as $cur_optpage) {
- if (!$cur_optpage['js']) {
+ if (!isset($cur_optpage['js']) || !$cur_optpage['js']) {
$reg_optpage_blocks[] = $cur_optpage;
} else if ($javascript_on == SMPREF_JS_ON) {
$js_optpage_blocks[] = $cur_optpage;
/* If we are not looking at the main option page, display the page here. */
/*************************************************************************/
} else {
- echo '<form name="f" action="options.php" method="post"><br>' . "\n"
+ echo addForm('options.php', 'POST', 'f')
. create_optpage_element($optpage)
. create_optmode_element(SMOPT_MODE_SUBMIT)
. html_tag( 'table', '', '', '', 'width="100%" cellpadding="2" cellspacing="0" border="0"' ) . "\n"