c36ed9cf |
1 | <?php |
cd2b7182 |
2 | |
35586184 |
3 | /** |
4 | * options_personal.php |
5 | * |
76911253 |
6 | * Copyright (c) 1999-2003 The SquirrelMail Project Team |
35586184 |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
9 | * Displays all options relating to personal information |
10 | * |
11 | * $Id$ |
2b646597 |
12 | * @package squirrelmail |
35586184 |
13 | */ |
cbe5423b |
14 | |
2b646597 |
15 | /** SquirrelMail required files. */ |
86725763 |
16 | require_once(SM_PATH . 'functions/imap.php'); |
01265fba |
17 | |
cbe5423b |
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); |
397ddb13 |
22 | define('SMOPT_GRP_TZ', 3); |
cbe5423b |
23 | |
24 | /* Define the optpage load function for the personal options page. */ |
25 | function load_optpage_data_personal() { |
01265fba |
26 | global $data_dir, $username, $edit_identity, $edit_name, |
df442a10 |
27 | $full_name, $reply_to, $email_address, $signature, $tzChangeAllowed, |
28 | $color; |
cbe5423b |
29 | |
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'); |
01265fba |
33 | $email_address = getPref($data_dir, $username, 'email_address'); |
34 | $signature = getSig($data_dir, $username, 'g'); |
bbcafebd |
35 | |
36 | /* Build a simple array into which we will build options. */ |
37 | $optgrps = array(); |
38 | $optvals = array(); |
39 | |
40 | /******************************************************/ |
41 | /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */ |
42 | /******************************************************/ |
bbcafebd |
43 | |
8a2e4d5b |
44 | /*** Load the Contact Information Options into the array ***/ |
bbcafebd |
45 | $optgrps[SMOPT_GRP_CONTACT] = _("Name and Address Options"); |
46 | $optvals[SMOPT_GRP_CONTACT] = array(); |
47 | |
48 | /* Build a simple array into which we will build options. */ |
49 | $optvals = array(); |
50 | |
26e2d3ef |
51 | if (!isset($edit_identity)) { |
52 | $edit_identity = TRUE; |
53 | } |
54 | |
8a7d0669 |
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 |
62 | ); |
63 | } else { |
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 |
70 | ); |
71 | } |
bbcafebd |
72 | |
8a7d0669 |
73 | if ($edit_identity) { |
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 |
80 | ); |
81 | } else { |
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 |
88 | ); |
89 | } |
bbcafebd |
90 | |
91 | $optvals[SMOPT_GRP_CONTACT][] = array( |
92 | 'name' => 'reply_to', |
93 | 'caption' => _("Reply To"), |
94 | 'type' => SMOPT_TYPE_STRING, |
95 | 'refresh' => SMOPT_REFRESH_NONE, |
96 | 'size' => SMOPT_SIZE_HUGE |
97 | ); |
98 | |
01265fba |
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' |
106 | ); |
107 | |
8a7d0669 |
108 | if ($edit_identity) { |
109 | $identities_link_value = '<A HREF="options_identities.php">' |
110 | . _("Edit Advanced Identities") |
111 | . '</A> ' |
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 |
119 | ); |
120 | } |
4b50568d |
121 | |
31afdbff |
122 | if ( $tzChangeAllowed ) { |
4b50568d |
123 | $TZ_ARRAY[SMPREF_NONE] = _("Same as server"); |
df442a10 |
124 | $tzfile = SM_PATH . 'locale/timezones.cfg'; |
7ca94ea4 |
125 | if ((!is_readable($tzfile)) or (!$fd = fopen($tzfile,'r'))) { |
126 | $message = _("Error opening timezone config, contact administrator."); |
127 | } |
128 | if (isset($message)) { |
129 | plain_error_message($message, $color); |
130 | exit; |
131 | } |
4b50568d |
132 | while (!feof ($fd)) { |
133 | $zone = fgets($fd, 1024); |
134 | if( $zone ) { |
135 | $zone = trim($zone); |
df442a10 |
136 | $TZ_ARRAY[$zone] = $zone; |
4b50568d |
137 | } |
7bcc8f54 |
138 | } |
4b50568d |
139 | fclose ($fd); |
7e235a1a |
140 | |
4b50568d |
141 | $optgrps[SMOPT_GRP_TZ] = _("Timezone Options"); |
142 | $optvals[SMOPT_GRP_TZ] = array(); |
7e235a1a |
143 | |
4b50568d |
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 |
150 | ); |
151 | } |
152 | |
8a2e4d5b |
153 | /*** Load the Reply Citation Options into the array ***/ |
154 | $optgrps[SMOPT_GRP_REPLY] = _("Reply Citation Options"); |
bbcafebd |
155 | $optvals[SMOPT_GRP_REPLY] = array(); |
156 | |
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")) |
166 | ); |
167 | |
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 |
174 | ); |
175 | |
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 |
182 | ); |
183 | |
8a2e4d5b |
184 | /*** Load the Signature Options into the array ***/ |
185 | $optgrps[SMOPT_GRP_SIG] = _("Signature Options"); |
186 | $optvals[SMOPT_GRP_SIG] = array(); |
bbcafebd |
187 | |
8a2e4d5b |
188 | $optvals[SMOPT_GRP_SIG][] = array( |
bbcafebd |
189 | 'name' => 'use_signature', |
190 | 'caption' => _("Use Signature"), |
191 | 'type' => SMOPT_TYPE_BOOLEAN, |
192 | 'refresh' => SMOPT_REFRESH_NONE |
193 | ); |
194 | |
8a2e4d5b |
195 | $optvals[SMOPT_GRP_SIG][] = array( |
bbcafebd |
196 | 'name' => 'prefix_sig', |
197 | 'caption' => _("Prefix Signature with '-- ' Line"), |
198 | 'type' => SMOPT_TYPE_BOOLEAN, |
199 | 'refresh' => SMOPT_REFRESH_NONE |
200 | ); |
201 | |
cbe5423b |
202 | /* Assemble all this together and return it as our result. */ |
203 | $result = array( |
204 | 'grps' => $optgrps, |
205 | 'vals' => $optvals |
206 | ); |
207 | return ($result); |
208 | } |
e7db48af |
209 | |
cbe5423b |
210 | /******************************************************************/ |
211 | /** Define any specialized save functions for this option page. ***/ |
212 | /******************************************************************/ |
e7db48af |
213 | |
cbe5423b |
214 | function save_option_signature($option) { |
215 | global $data_dir, $username; |
01265fba |
216 | setSig($data_dir, $username, 'g', $option->new_value); |
cbe5423b |
217 | } |
e7db48af |
218 | |
cbe5423b |
219 | ?> |