a15d5ba55d83eb5a23b4d742453f3d50905f9139
6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Displays all options relating to personal information
12 * @package squirrelmail
15 /** SquirrelMail required files. */
16 require_once(SM_PATH
. 'functions/imap.php');
18 /* Define the group constants for the personal options page. */
19 define('SMOPT_GRP_CONTACT', 0);
20 define('SMOPT_GRP_REPLY', 1);
21 define('SMOPT_GRP_SIG', 2);
22 define('SMOPT_GRP_TZ', 3);
24 /* Define the optpage load function for the personal options page. */
25 function load_optpage_data_personal() {
26 global $data_dir, $username, $edit_identity, $edit_name,
27 $full_name, $reply_to, $email_address, $signature, $tzChangeAllowed,
30 /* Set the values of some global variables. */
31 $full_name = getPref($data_dir, $username, 'full_name');
32 $reply_to = getPref($data_dir, $username, 'reply_to');
33 $email_address = getPref($data_dir, $username, 'email_address');
34 $signature = getSig($data_dir, $username, 'g');
36 /* Build a simple array into which we will build options. */
40 /******************************************************/
41 /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
42 /******************************************************/
44 /*** Load the Contact Information Options into the array ***/
45 $optgrps[SMOPT_GRP_CONTACT
] = _("Name and Address Options");
46 $optvals[SMOPT_GRP_CONTACT
] = array();
48 /* Build a simple array into which we will build options. */
51 if (!isset($edit_identity)) {
52 $edit_identity = TRUE;
55 if ($edit_identity ||
$edit_name) {
56 $optvals[SMOPT_GRP_CONTACT
][] = array(
57 'name' => 'full_name',
58 'caption' => _("Full Name"),
59 'type' => SMOPT_TYPE_STRING
,
60 'refresh' => SMOPT_REFRESH_NONE
,
61 'size' => SMOPT_SIZE_HUGE
64 $optvals[SMOPT_GRP_CONTACT
][] = array(
65 'name' => 'full_name',
66 'caption' => _("Full Name"),
67 'type' => SMOPT_TYPE_COMMENT
,
68 'refresh' => SMOPT_REFRESH_NONE
,
69 'comment' => $full_name
74 $optvals[SMOPT_GRP_CONTACT
][] = array(
75 'name' => 'email_address',
76 'caption' => _("Email Address"),
77 'type' => SMOPT_TYPE_STRING
,
78 'refresh' => SMOPT_REFRESH_NONE
,
79 'size' => SMOPT_SIZE_HUGE
82 $optvals[SMOPT_GRP_CONTACT
][] = array(
83 'name' => 'email_address',
84 'caption' => _("Email Address"),
85 'type' => SMOPT_TYPE_COMMENT
,
86 'refresh' => SMOPT_REFRESH_NONE
,
87 'comment' => $email_address
91 $optvals[SMOPT_GRP_CONTACT
][] = array(
93 'caption' => _("Reply To"),
94 'type' => SMOPT_TYPE_STRING
,
95 'refresh' => SMOPT_REFRESH_NONE
,
96 'size' => SMOPT_SIZE_HUGE
99 $optvals[SMOPT_GRP_CONTACT
][] = array(
100 'name' => 'signature',
101 'caption' => _("Signature"),
102 'type' => SMOPT_TYPE_TEXTAREA
,
103 'refresh' => SMOPT_REFRESH_NONE
,
104 'size' => SMOPT_SIZE_MEDIUM
,
105 'save' => 'save_option_signature'
108 if ($edit_identity) {
109 $identities_link_value = '<A HREF="options_identities.php">'
110 . _("Edit Advanced Identities")
112 . _("(discards changes made on this form so far)");
113 $optvals[SMOPT_GRP_CONTACT
][] = array(
114 'name' => 'identities_link',
115 'caption' => _("Multiple Identities"),
116 'type' => SMOPT_TYPE_COMMENT
,
117 'refresh' => SMOPT_REFRESH_NONE
,
118 'comment' => $identities_link_value
122 if ( $tzChangeAllowed ) {
123 $TZ_ARRAY[SMPREF_NONE
] = _("Same as server");
124 $tzfile = SM_PATH
. 'locale/timezones.cfg';
125 if ((!is_readable($tzfile)) or (!$fd = fopen($tzfile,'r'))) {
126 $message = _("Error opening timezone config, contact administrator.");
128 if (isset($message)) {
129 plain_error_message($message, $color);
132 while (!feof ($fd)) {
133 $zone = fgets($fd, 1024);
136 $TZ_ARRAY[$zone] = $zone;
141 $optgrps[SMOPT_GRP_TZ
] = _("Timezone Options");
142 $optvals[SMOPT_GRP_TZ
] = array();
144 $optvals[SMOPT_GRP_TZ
][] = array(
145 'name' => 'timezone',
146 'caption' => _("Your current timezone"),
147 'type' => SMOPT_TYPE_STRLIST
,
148 'refresh' => SMOPT_REFRESH_NONE
,
149 'posvals' => $TZ_ARRAY
153 /*** Load the Reply Citation Options into the array ***/
154 $optgrps[SMOPT_GRP_REPLY
] = _("Reply Citation Options");
155 $optvals[SMOPT_GRP_REPLY
] = array();
157 $optvals[SMOPT_GRP_REPLY
][] = array(
158 'name' => 'reply_citation_style',
159 'caption' => _("Reply Citation Style"),
160 'type' => SMOPT_TYPE_STRLIST
,
161 'refresh' => SMOPT_REFRESH_NONE
,
162 'posvals' => array(SMPREF_NONE
=> _("No Citation"),
163 'author_said' => _("AUTHOR Said"),
164 'quote_who' => _("Quote Who XML"),
165 'user-defined' => _("User-Defined"))
168 $optvals[SMOPT_GRP_REPLY
][] = array(
169 'name' => 'reply_citation_start',
170 'caption' => _("User-Defined Citation Start"),
171 'type' => SMOPT_TYPE_STRING
,
172 'refresh' => SMOPT_REFRESH_NONE
,
173 'size' => SMOPT_SIZE_MEDIUM
176 $optvals[SMOPT_GRP_REPLY
][] = array(
177 'name' => 'reply_citation_end',
178 'caption' => _("User-Defined Citation End"),
179 'type' => SMOPT_TYPE_STRING
,
180 'refresh' => SMOPT_REFRESH_NONE
,
181 'size' => SMOPT_SIZE_MEDIUM
184 /*** Load the Signature Options into the array ***/
185 $optgrps[SMOPT_GRP_SIG
] = _("Signature Options");
186 $optvals[SMOPT_GRP_SIG
] = array();
188 $optvals[SMOPT_GRP_SIG
][] = array(
189 'name' => 'use_signature',
190 'caption' => _("Use Signature"),
191 'type' => SMOPT_TYPE_BOOLEAN
,
192 'refresh' => SMOPT_REFRESH_NONE
195 $optvals[SMOPT_GRP_SIG
][] = array(
196 'name' => 'prefix_sig',
197 'caption' => _("Prefix Signature with '-- ' Line"),
198 'type' => SMOPT_TYPE_BOOLEAN
,
199 'refresh' => SMOPT_REFRESH_NONE
202 /* Assemble all this together and return it as our result. */
210 /******************************************************************/
211 /** Define any specialized save functions for this option page. ***/
212 /******************************************************************/
214 function save_option_signature($option) {
215 global $data_dir, $username;
216 setSig($data_dir, $username, 'g', $option->new_value
);