X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Foptions.php;h=0058c3b1e0a066ca340c5d09a172e55d6c8e3ad8;hp=50f45037d0cd42a7e10c7ded28c50ae87b35a963;hb=5ed9d4fdf688c87cedb9837504ce247fc92f4eba;hpb=625c8b787b79d07a1e53ba05213f66451d73651e
diff --git a/src/options.php b/src/options.php
index 50f45037..0058c3b1 100644
--- a/src/options.php
+++ b/src/options.php
@@ -3,32 +3,36 @@
/**
* options.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 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$
+ * @version $Id$
+ * @package squirrelmail
*/
-/* Path for SquirrelMail required files. */
+/**
+ * Path for SquirrelMail required files.
+ * @ignore
+ */
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');
@@ -36,6 +40,7 @@ define('SMOPT_MODE_LINK', 'link');
define('SMOPT_PAGE_MAIN', 'main');
define('SMOPT_PAGE_PERSONAL', 'personal');
define('SMOPT_PAGE_DISPLAY', 'display');
+define('SMOPT_PAGE_COMPOSE', 'compose');
define('SMOPT_PAGE_HIGHLIGHT', 'highlight');
define('SMOPT_PAGE_FOLDER', 'folder');
define('SMOPT_PAGE_ORDER', 'order');
@@ -51,7 +56,7 @@ function process_optionmode_submit($optpage, $optpage_data) {
echo "name = '$option->name', "
. "value = '$option->value', "
. "new_value = '$option->new_value'\n";
- echo "
";
+ echo "
";
*/
if ($option->changed()) {
$option->save();
@@ -115,23 +120,14 @@ function print_optionpages_row($leftopt, $rightopt = false) {
/* ---------------------------- 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. */
@@ -147,7 +143,7 @@ if (!isset($optmode)) {
}
/*
- * First, set the load information for each option page.
+ * First, set the load information for each option page.
*/
/* Initialize load information variables. */
@@ -157,7 +153,7 @@ $optpage_loader = '';
/* Set the load information for each page. */
switch ($optpage) {
- case SMOPT_PAGE_MAIN:
+ case SMOPT_PAGE_MAIN:
break;
case SMOPT_PAGE_PERSONAL:
$optpage_name = _("Personal Information");
@@ -171,6 +167,12 @@ switch ($optpage) {
$optpage_loader = 'load_optpage_data_display';
$optpage_loadhook = 'optpage_loadhook_display';
break;
+ case SMOPT_PAGE_COMPOSE:
+ $optpage_name = _("Compose Preferences");
+ $optpage_file = SM_PATH . 'include/options/compose.php';
+ $optpage_loader = 'load_optpage_data_compose';
+ $optpage_loadhook = 'optpage_loadhook_compose';
+ break;
case SMOPT_PAGE_HIGHLIGHT:
$optpage_name = _("Message Highlighting");
$optpage_file = SM_PATH . 'include/options/highlight.php';
@@ -200,7 +202,7 @@ if ( !@is_file( $optpage_file ) ) {
$optpage = SMOPT_PAGE_MAIN;
} else if ($optpage != SMOPT_PAGE_MAIN ) {
/* Include the file for this optionpage. */
-
+
require_once($optpage_file);
/* Assemble the data for this option page. */
@@ -215,6 +217,8 @@ if ( !@is_file( $optpage_file ) ) {
/*** Next, process anything that needs to be processed. ***/
/***********************************************************/
+$optpage_save_error=array();
+
if ( isset( $optpage_data ) ) {
switch ($optmode) {
case SMOPT_MODE_SUBMIT:
@@ -225,21 +229,12 @@ if ( isset( $optpage_data ) ) {
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' ) .
- "$optpage_title
\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. */
/*******************************************************************/
@@ -257,7 +252,7 @@ if ($optmode == SMOPT_MODE_SUBMIT) {
case SMOPT_PAGE_FOLDER:
$save_hook_name = 'options_folder_save';
break;
- default:
+ default:
$save_hook_name = 'options_save';
break;
}
@@ -281,6 +276,16 @@ if ($optmode == SMOPT_MODE_SUBMIT) {
/* 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' ) .
+ "$optpage_title
\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.
@@ -293,15 +298,26 @@ if ($optpage == SMOPT_PAGE_MAIN) {
if (!isset($frame_top)) {
$frame_top = '_top';
}
- /* Display a message indicating a successful save. */
- echo '' . _("Successfully Saved Options") . ": $optpage_name
\n";
+
+ if (isset($optpage_save_error) && $optpage_save_error!=array()) {
+ echo "" . _("Error(s) happened while saving your options") . "
\n";
+ echo "