uid support?
[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 }
4b50568d 119
120 if ( !ini_get("safe_mode") ) {
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 }
7bcc8f54 129 }
4b50568d 130 fclose ($fd);
7e235a1a 131
4b50568d 132 $optgrps[SMOPT_GRP_TZ] = _("Timezone Options");
133 $optvals[SMOPT_GRP_TZ] = array();
7e235a1a 134
4b50568d 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
8a2e4d5b 144 /*** Load the Reply Citation Options into the array ***/
145 $optgrps[SMOPT_GRP_REPLY] = _("Reply Citation Options");
bbcafebd 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
8a2e4d5b 175 /*** Load the Signature Options into the array ***/
176 $optgrps[SMOPT_GRP_SIG] = _("Signature Options");
177 $optvals[SMOPT_GRP_SIG] = array();
bbcafebd 178
8a2e4d5b 179 $optvals[SMOPT_GRP_SIG][] = array(
bbcafebd 180 'name' => 'use_signature',
181 'caption' => _("Use Signature"),
182 'type' => SMOPT_TYPE_BOOLEAN,
183 'refresh' => SMOPT_REFRESH_NONE
184 );
185
8a2e4d5b 186 $optvals[SMOPT_GRP_SIG][] = array(
bbcafebd 187 'name' => 'prefix_sig',
188 'caption' => _("Prefix Signature with '-- ' Line"),
189 'type' => SMOPT_TYPE_BOOLEAN,
190 'refresh' => SMOPT_REFRESH_NONE
191 );
192
cbe5423b 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}
e7db48af 200
cbe5423b 201/******************************************************************/
202/** Define any specialized save functions for this option page. ***/
203/******************************************************************/
e7db48af 204
cbe5423b 205function save_option_signature($option) {
206 global $data_dir, $username;
01265fba 207 setSig($data_dir, $username, 'g', $option->new_value);
cbe5423b 208}
e7db48af 209
cbe5423b 210?>