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