c36ed9cf |
1 | <?php |
cd2b7182 |
2 | |
35586184 |
3 | /** |
4 | * options_personal.php |
5 | * |
15e6162e |
6 | * Copyright (c) 1999-2002 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$ |
12 | */ |
cbe5423b |
13 | |
14 | require_once('../functions/imap.php'); |
15 | require_once('../functions/array.php'); |
01265fba |
16 | |
cbe5423b |
17 | /* Define the group constants for the personal options page. */ |
18 | define('SMOPT_GRP_CONTACT', 0); |
19 | define('SMOPT_GRP_REPLY', 1); |
20 | define('SMOPT_GRP_SIG', 2); |
21 | |
22 | /* Define the optpage load function for the personal options page. */ |
23 | function load_optpage_data_personal() { |
01265fba |
24 | global $data_dir, $username, $edit_identity, $edit_name, |
25 | $full_name, $reply_to, $email_address, $signature; |
cbe5423b |
26 | |
27 | /* Set the values of some global variables. */ |
28 | $full_name = getPref($data_dir, $username, 'full_name'); |
29 | $reply_to = getPref($data_dir, $username, 'reply_to'); |
01265fba |
30 | $email_address = getPref($data_dir, $username, 'email_address'); |
31 | $signature = getSig($data_dir, $username, 'g'); |
bbcafebd |
32 | |
33 | /* Build a simple array into which we will build options. */ |
34 | $optgrps = array(); |
35 | $optvals = array(); |
36 | |
37 | /******************************************************/ |
38 | /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */ |
39 | /******************************************************/ |
bbcafebd |
40 | |
8a2e4d5b |
41 | /*** Load the Contact Information Options into the array ***/ |
bbcafebd |
42 | $optgrps[SMOPT_GRP_CONTACT] = _("Name and Address Options"); |
43 | $optvals[SMOPT_GRP_CONTACT] = array(); |
44 | |
45 | /* Build a simple array into which we will build options. */ |
46 | $optvals = array(); |
47 | |
8a7d0669 |
48 | if ($edit_identity || $edit_name) { |
49 | $optvals[SMOPT_GRP_CONTACT][] = array( |
50 | 'name' => 'full_name', |
51 | 'caption' => _("Full Name"), |
52 | 'type' => SMOPT_TYPE_STRING, |
53 | 'refresh' => SMOPT_REFRESH_NONE, |
54 | 'size' => SMOPT_SIZE_HUGE |
55 | ); |
56 | } else { |
57 | $optvals[SMOPT_GRP_CONTACT][] = array( |
58 | 'name' => 'full_name', |
59 | 'caption' => _("Full Name"), |
60 | 'type' => SMOPT_TYPE_COMMENT, |
61 | 'refresh' => SMOPT_REFRESH_NONE, |
62 | 'comment' => $full_name |
63 | ); |
64 | } |
bbcafebd |
65 | |
8a7d0669 |
66 | if ($edit_identity) { |
67 | $optvals[SMOPT_GRP_CONTACT][] = array( |
68 | 'name' => 'email_address', |
69 | 'caption' => _("Email Address"), |
70 | 'type' => SMOPT_TYPE_STRING, |
71 | 'refresh' => SMOPT_REFRESH_NONE, |
72 | 'size' => SMOPT_SIZE_HUGE |
73 | ); |
74 | } else { |
75 | $optvals[SMOPT_GRP_CONTACT][] = array( |
76 | 'name' => 'email_address', |
77 | 'caption' => _("Email Address"), |
78 | 'type' => SMOPT_TYPE_COMMENT, |
79 | 'refresh' => SMOPT_REFRESH_NONE, |
80 | 'comment' => $email_address |
81 | ); |
82 | } |
bbcafebd |
83 | |
84 | $optvals[SMOPT_GRP_CONTACT][] = array( |
85 | 'name' => 'reply_to', |
86 | 'caption' => _("Reply To"), |
87 | 'type' => SMOPT_TYPE_STRING, |
88 | 'refresh' => SMOPT_REFRESH_NONE, |
89 | 'size' => SMOPT_SIZE_HUGE |
90 | ); |
91 | |
01265fba |
92 | $optvals[SMOPT_GRP_CONTACT][] = array( |
93 | 'name' => 'signature', |
94 | 'caption' => _("Signature"), |
95 | 'type' => SMOPT_TYPE_TEXTAREA, |
96 | 'refresh' => SMOPT_REFRESH_NONE, |
97 | 'size' => SMOPT_SIZE_MEDIUM, |
98 | 'save' => 'save_option_signature' |
99 | ); |
100 | |
8a7d0669 |
101 | if ($edit_identity) { |
102 | $identities_link_value = '<A HREF="options_identities.php">' |
103 | . _("Edit Advanced Identities") |
104 | . '</A> ' |
105 | . _("(discards changes made on this form so far)"); |
106 | $optvals[SMOPT_GRP_CONTACT][] = array( |
107 | 'name' => 'identities_link', |
108 | 'caption' => _("Multiple Identities"), |
109 | 'type' => SMOPT_TYPE_COMMENT, |
110 | 'refresh' => SMOPT_REFRESH_NONE, |
111 | 'comment' => $identities_link_value |
112 | ); |
113 | } |
8a2e4d5b |
114 | |
7bcc8f54 |
115 | $TZ_ARRAY[SMPREF_NONE] = _("Same as server"); |
116 | $fd = fopen('../locale/timezones.cfg','r'); |
117 | while (!feof ($fd)) { |
118 | $zone = fgets($fd, 1024); |
119 | if( $zone ) { |
120 | $zone = trim($zone); |
121 | $TZ_ARRAY["$zone"] = "$zone"; |
122 | } |
123 | } |
124 | fclose ($fd); |
125 | |
126 | $optgrps[SMOPT_GRP_TZ] = _("Timezone Options"); |
127 | $optvals[SMOPT_GRP_TZ] = array(); |
128 | |
129 | $optvals[SMOPT_GRP_TZ][] = array( |
130 | 'name' => 'timezone', |
131 | 'caption' => _("Your current timezone"), |
132 | 'type' => SMOPT_TYPE_STRLIST, |
133 | 'refresh' => SMOPT_REFRESH_NONE, |
134 | 'posvals' => $TZ_ARRAY |
135 | ); |
136 | |
8a2e4d5b |
137 | /*** Load the Reply Citation Options into the array ***/ |
138 | $optgrps[SMOPT_GRP_REPLY] = _("Reply Citation Options"); |
bbcafebd |
139 | $optvals[SMOPT_GRP_REPLY] = array(); |
140 | |
141 | $optvals[SMOPT_GRP_REPLY][] = array( |
142 | 'name' => 'reply_citation_style', |
143 | 'caption' => _("Reply Citation Style"), |
144 | 'type' => SMOPT_TYPE_STRLIST, |
145 | 'refresh' => SMOPT_REFRESH_NONE, |
146 | 'posvals' => array(SMPREF_NONE => _("No Citation"), |
147 | 'author_said' => _("AUTHOR Said"), |
148 | 'quote_who' => _("Quote Who XML"), |
149 | 'user-defined' => _("User-Defined")) |
150 | ); |
151 | |
152 | $optvals[SMOPT_GRP_REPLY][] = array( |
153 | 'name' => 'reply_citation_start', |
154 | 'caption' => _("User-Defined Citation Start"), |
155 | 'type' => SMOPT_TYPE_STRING, |
156 | 'refresh' => SMOPT_REFRESH_NONE, |
157 | 'size' => SMOPT_SIZE_MEDIUM |
158 | ); |
159 | |
160 | $optvals[SMOPT_GRP_REPLY][] = array( |
161 | 'name' => 'reply_citation_end', |
162 | 'caption' => _("User-Defined Citation End"), |
163 | 'type' => SMOPT_TYPE_STRING, |
164 | 'refresh' => SMOPT_REFRESH_NONE, |
165 | 'size' => SMOPT_SIZE_MEDIUM |
166 | ); |
167 | |
8a2e4d5b |
168 | /*** Load the Signature Options into the array ***/ |
169 | $optgrps[SMOPT_GRP_SIG] = _("Signature Options"); |
170 | $optvals[SMOPT_GRP_SIG] = array(); |
bbcafebd |
171 | |
8a2e4d5b |
172 | $optvals[SMOPT_GRP_SIG][] = array( |
bbcafebd |
173 | 'name' => 'use_signature', |
174 | 'caption' => _("Use Signature"), |
175 | 'type' => SMOPT_TYPE_BOOLEAN, |
176 | 'refresh' => SMOPT_REFRESH_NONE |
177 | ); |
178 | |
8a2e4d5b |
179 | $optvals[SMOPT_GRP_SIG][] = array( |
bbcafebd |
180 | 'name' => 'prefix_sig', |
181 | 'caption' => _("Prefix Signature with '-- ' Line"), |
182 | 'type' => SMOPT_TYPE_BOOLEAN, |
183 | 'refresh' => SMOPT_REFRESH_NONE |
184 | ); |
185 | |
cbe5423b |
186 | /* Assemble all this together and return it as our result. */ |
187 | $result = array( |
188 | 'grps' => $optgrps, |
189 | 'vals' => $optvals |
190 | ); |
191 | return ($result); |
192 | } |
e7db48af |
193 | |
cbe5423b |
194 | /******************************************************************/ |
195 | /** Define any specialized save functions for this option page. ***/ |
196 | /******************************************************************/ |
e7db48af |
197 | |
cbe5423b |
198 | function save_option_signature($option) { |
199 | global $data_dir, $username; |
01265fba |
200 | setSig($data_dir, $username, 'g', $option->new_value); |
cbe5423b |
201 | } |
e7db48af |
202 | |
cbe5423b |
203 | ?> |