Just fixing a bug I ran across where attachments was an empty array.
[squirrelmail.git] / src / options_personal.php
CommitLineData
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
14require_once('../functions/imap.php');
15require_once('../functions/array.php');
01265fba 16
cbe5423b 17/* Define the group constants for the personal options page. */
18define('SMOPT_GRP_CONTACT', 0);
19define('SMOPT_GRP_REPLY', 1);
20define('SMOPT_GRP_SIG', 2);
397ddb13 21define('SMOPT_GRP_TZ', 3);
cbe5423b 22
23/* Define the optpage load function for the personal options page. */
24function load_optpage_data_personal() {
01265fba 25 global $data_dir, $username, $edit_identity, $edit_name,
26 $full_name, $reply_to, $email_address, $signature;
cbe5423b 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');
01265fba 31 $email_address = getPref($data_dir, $username, 'email_address');
32 $signature = getSig($data_dir, $username, 'g');
bbcafebd 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 /******************************************************/
bbcafebd 41
8a2e4d5b 42 /*** Load the Contact Information Options into the array ***/
bbcafebd 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
26e2d3ef 49 if (!isset($edit_identity)) {
50 $edit_identity = TRUE;
51 }
52
8a7d0669 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 }
bbcafebd 70
8a7d0669 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 }
bbcafebd 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
01265fba 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
8a7d0669 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 }
8a2e4d5b 119
7bcc8f54 120 $TZ_ARRAY[SMPREF_NONE] = _("Same as server");
121 $fd = fopen('../locale/timezones.cfg','r');
122 while (!feof ($fd)) {
123 $zone = fgets($fd, 1024);
124 if( $zone ) {
7e235a1a 125 $zone = trim($zone);
7bcc8f54 126 $TZ_ARRAY["$zone"] = "$zone";
127 }
128 }
129 fclose ($fd);
7e235a1a 130
7bcc8f54 131 $optgrps[SMOPT_GRP_TZ] = _("Timezone Options");
132 $optvals[SMOPT_GRP_TZ] = array();
133
134 $optvals[SMOPT_GRP_TZ][] = array(
135 'name' => 'timezone',
7e235a1a 136 'caption' => _("Your current timezone"),
137 'type' => SMOPT_TYPE_STRLIST,
138 'refresh' => SMOPT_REFRESH_NONE,
139 'posvals' => $TZ_ARRAY
7bcc8f54 140 );
7e235a1a 141
8a2e4d5b 142 /*** Load the Reply Citation Options into the array ***/
143 $optgrps[SMOPT_GRP_REPLY] = _("Reply Citation Options");
bbcafebd 144 $optvals[SMOPT_GRP_REPLY] = array();
145
146 $optvals[SMOPT_GRP_REPLY][] = array(
147 'name' => 'reply_citation_style',
148 'caption' => _("Reply Citation Style"),
149 'type' => SMOPT_TYPE_STRLIST,
150 'refresh' => SMOPT_REFRESH_NONE,
151 'posvals' => array(SMPREF_NONE => _("No Citation"),
152 'author_said' => _("AUTHOR Said"),
153 'quote_who' => _("Quote Who XML"),
154 'user-defined' => _("User-Defined"))
155 );
156
157 $optvals[SMOPT_GRP_REPLY][] = array(
158 'name' => 'reply_citation_start',
159 'caption' => _("User-Defined Citation Start"),
160 'type' => SMOPT_TYPE_STRING,
161 'refresh' => SMOPT_REFRESH_NONE,
162 'size' => SMOPT_SIZE_MEDIUM
163 );
164
165 $optvals[SMOPT_GRP_REPLY][] = array(
166 'name' => 'reply_citation_end',
167 'caption' => _("User-Defined Citation End"),
168 'type' => SMOPT_TYPE_STRING,
169 'refresh' => SMOPT_REFRESH_NONE,
170 'size' => SMOPT_SIZE_MEDIUM
171 );
172
8a2e4d5b 173 /*** Load the Signature Options into the array ***/
174 $optgrps[SMOPT_GRP_SIG] = _("Signature Options");
175 $optvals[SMOPT_GRP_SIG] = array();
bbcafebd 176
8a2e4d5b 177 $optvals[SMOPT_GRP_SIG][] = array(
bbcafebd 178 'name' => 'use_signature',
179 'caption' => _("Use Signature"),
180 'type' => SMOPT_TYPE_BOOLEAN,
181 'refresh' => SMOPT_REFRESH_NONE
182 );
183
8a2e4d5b 184 $optvals[SMOPT_GRP_SIG][] = array(
bbcafebd 185 'name' => 'prefix_sig',
186 'caption' => _("Prefix Signature with '-- ' Line"),
187 'type' => SMOPT_TYPE_BOOLEAN,
188 'refresh' => SMOPT_REFRESH_NONE
189 );
190
cbe5423b 191 /* Assemble all this together and return it as our result. */
192 $result = array(
193 'grps' => $optgrps,
194 'vals' => $optvals
195 );
196 return ($result);
197}
e7db48af 198
cbe5423b 199/******************************************************************/
200/** Define any specialized save functions for this option page. ***/
201/******************************************************************/
e7db48af 202
cbe5423b 203function save_option_signature($option) {
204 global $data_dir, $username;
01265fba 205 setSig($data_dir, $username, 'g', $option->new_value);
cbe5423b 206}
e7db48af 207
cbe5423b 208?>