Thread View and Untrhead View added to strings.
[squirrelmail.git] / src / options_personal.php
... / ...
CommitLineData
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
14require_once('../functions/imap.php');
15require_once('../functions/array.php');
16
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);
21define('SMOPT_GRP_TZ', 3);
22
23/* Define the optpage load function for the personal options page. */
24function load_optpage_data_personal() {
25 global $data_dir, $username, $edit_identity, $edit_name,
26 $full_name, $reply_to, $email_address, $signature;
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 $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 ) {
125 $zone = trim($zone);
126 $TZ_ARRAY["$zone"] = "$zone";
127 }
128 }
129 fclose ($fd);
130
131 $optgrps[SMOPT_GRP_TZ] = _("Timezone Options");
132 $optvals[SMOPT_GRP_TZ] = array();
133
134 $optvals[SMOPT_GRP_TZ][] = array(
135 'name' => 'timezone',
136 'caption' => _("Your current timezone"),
137 'type' => SMOPT_TYPE_STRLIST,
138 'refresh' => SMOPT_REFRESH_NONE,
139 'posvals' => $TZ_ARRAY
140 );
141
142 /*** Load the Reply Citation Options into the array ***/
143 $optgrps[SMOPT_GRP_REPLY] = _("Reply Citation Options");
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
173 /*** Load the Signature Options into the array ***/
174 $optgrps[SMOPT_GRP_SIG] = _("Signature Options");
175 $optvals[SMOPT_GRP_SIG] = array();
176
177 $optvals[SMOPT_GRP_SIG][] = array(
178 'name' => 'use_signature',
179 'caption' => _("Use Signature"),
180 'type' => SMOPT_TYPE_BOOLEAN,
181 'refresh' => SMOPT_REFRESH_NONE
182 );
183
184 $optvals[SMOPT_GRP_SIG][] = array(
185 'name' => 'prefix_sig',
186 'caption' => _("Prefix Signature with '-- ' Line"),
187 'type' => SMOPT_TYPE_BOOLEAN,
188 'refresh' => SMOPT_REFRESH_NONE
189 );
190
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}
198
199/******************************************************************/
200/** Define any specialized save functions for this option page. ***/
201/******************************************************************/
202
203function save_option_signature($option) {
204 global $data_dir, $username;
205 setSig($data_dir, $username, 'g', $option->new_value);
206}
207
208?>