/**
* options_personal.php
*
- * Copyright (c) 1999-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
* Displays all options relating to personal information
*
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
*/
/** SquirrelMail required files. */
-require_once(SM_PATH . 'functions/imap.php');
require_once(SM_PATH . 'include/timezones.php');
/* Define the group constants for the personal options page. */
function load_optpage_data_personal() {
global $data_dir, $username, $edit_identity, $edit_name,
$full_name, $reply_to, $email_address, $signature, $tzChangeAllowed,
- $color, $timeZone;
+ $color, $timeZone, $domain;
/* Set the values of some global variables. */
$full_name = getPref($data_dir, $username, 'full_name');
$reply_to = getPref($data_dir, $username, 'reply_to');
- $email_address = getPref($data_dir, $username, 'email_address');
+ $email_address = getPref($data_dir, $username, 'email_address',SMPREF_NONE);
$signature = getSig($data_dir, $username, 'g');
+
+ // set email_address to default value, if it is not set in user's preferences
+ if ($email_address == SMPREF_NONE) {
+ if (preg_match("/(.+)@(.+)/",$username)) {
+ $email_address = $username;
+ } else {
+ $email_address = $username . '@' . $domain ;
+ }
+ }
/* Build a simple array into which we will build options. */
$optgrps = array();
if ($edit_identity) {
$optvals[SMOPT_GRP_CONTACT][] = array(
'name' => 'email_address',
- 'caption' => _("Email Address"),
+ 'caption' => _("E-mail Address"),
'type' => SMOPT_TYPE_STRING,
'refresh' => SMOPT_REFRESH_NONE,
'size' => SMOPT_SIZE_HUGE
} else {
$optvals[SMOPT_GRP_CONTACT][] = array(
'name' => 'email_address',
- 'caption' => _("Email Address"),
+ 'caption' => _("E-mail Address"),
'type' => SMOPT_TYPE_COMMENT,
'refresh' => SMOPT_REFRESH_NONE,
- 'comment' => $email_address
+ 'comment' => htmlspecialchars($email_address)
);
}
);
}
- if ( $tzChangeAllowed ) {
+ if ( $tzChangeAllowed || function_exists('date_default_timezone_set')) {
$TZ_ARRAY[SMPREF_NONE] = _("Same as server");
$aTimeZones = sq_get_tz_array();
global $data_dir, $username;
setSig($data_dir, $username, 'g', $option->new_value);
}
-
-?>
\ No newline at end of file