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