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