6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Displays all options relating to personal information
14 /* Path for SquirrelMail required files. */
15 define('SM_PATH','../');
17 /* SquirrelMail required files. */
18 require_once(SM_PATH
. 'functions/imap.php');
19 require_once(SM_PATH
. 'functions/array.php');
21 /* Define the group constants for the personal options page. */
22 define('SMOPT_GRP_CONTACT', 0);
23 define('SMOPT_GRP_REPLY', 1);
24 define('SMOPT_GRP_SIG', 2);
25 define('SMOPT_GRP_TZ', 3);
27 /* Define the optpage load function for the personal options page. */
28 function load_optpage_data_personal() {
29 global $data_dir, $username, $edit_identity, $edit_name,
30 $full_name, $reply_to, $email_address, $signature;
32 /* Set the values of some global variables. */
33 $full_name = getPref($data_dir, $username, 'full_name');
34 $reply_to = getPref($data_dir, $username, 'reply_to');
35 $email_address = getPref($data_dir, $username, 'email_address');
36 $signature = getSig($data_dir, $username, 'g');
38 /* Build a simple array into which we will build options. */
42 /******************************************************/
43 /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
44 /******************************************************/
46 /*** Load the Contact Information Options into the array ***/
47 $optgrps[SMOPT_GRP_CONTACT
] = _("Name and Address Options");
48 $optvals[SMOPT_GRP_CONTACT
] = array();
50 /* Build a simple array into which we will build options. */
53 if (!isset($edit_identity)) {
54 $edit_identity = TRUE;
57 if ($edit_identity ||
$edit_name) {
58 $optvals[SMOPT_GRP_CONTACT
][] = array(
59 'name' => 'full_name',
60 'caption' => _("Full Name"),
61 'type' => SMOPT_TYPE_STRING
,
62 'refresh' => SMOPT_REFRESH_NONE
,
63 'size' => SMOPT_SIZE_HUGE
66 $optvals[SMOPT_GRP_CONTACT
][] = array(
67 'name' => 'full_name',
68 'caption' => _("Full Name"),
69 'type' => SMOPT_TYPE_COMMENT
,
70 'refresh' => SMOPT_REFRESH_NONE
,
71 'comment' => $full_name
76 $optvals[SMOPT_GRP_CONTACT
][] = array(
77 'name' => 'email_address',
78 'caption' => _("Email Address"),
79 'type' => SMOPT_TYPE_STRING
,
80 'refresh' => SMOPT_REFRESH_NONE
,
81 'size' => SMOPT_SIZE_HUGE
84 $optvals[SMOPT_GRP_CONTACT
][] = array(
85 'name' => 'email_address',
86 'caption' => _("Email Address"),
87 'type' => SMOPT_TYPE_COMMENT
,
88 'refresh' => SMOPT_REFRESH_NONE
,
89 'comment' => $email_address
93 $optvals[SMOPT_GRP_CONTACT
][] = array(
95 'caption' => _("Reply To"),
96 'type' => SMOPT_TYPE_STRING
,
97 'refresh' => SMOPT_REFRESH_NONE
,
98 'size' => SMOPT_SIZE_HUGE
101 $optvals[SMOPT_GRP_CONTACT
][] = array(
102 'name' => 'signature',
103 'caption' => _("Signature"),
104 'type' => SMOPT_TYPE_TEXTAREA
,
105 'refresh' => SMOPT_REFRESH_NONE
,
106 'size' => SMOPT_SIZE_MEDIUM
,
107 'save' => 'save_option_signature'
110 if ($edit_identity) {
111 $identities_link_value = '<A HREF="options_identities.php">'
112 . _("Edit Advanced Identities")
114 . _("(discards changes made on this form so far)");
115 $optvals[SMOPT_GRP_CONTACT
][] = array(
116 'name' => 'identities_link',
117 'caption' => _("Multiple Identities"),
118 'type' => SMOPT_TYPE_COMMENT
,
119 'refresh' => SMOPT_REFRESH_NONE
,
120 'comment' => $identities_link_value
124 if ( !ini_get("safe_mode") ) {
125 $TZ_ARRAY[SMPREF_NONE
] = _("Same as server");
126 $fd = fopen('../locale/timezones.cfg','r');
127 while (!feof ($fd)) {
128 $zone = fgets($fd, 1024);
131 $TZ_ARRAY["$zone"] = "$zone";
136 $optgrps[SMOPT_GRP_TZ
] = _("Timezone Options");
137 $optvals[SMOPT_GRP_TZ
] = array();
139 $optvals[SMOPT_GRP_TZ
][] = array(
140 'name' => 'timezone',
141 'caption' => _("Your current timezone"),
142 'type' => SMOPT_TYPE_STRLIST
,
143 'refresh' => SMOPT_REFRESH_NONE
,
144 'posvals' => $TZ_ARRAY
148 /*** Load the Reply Citation Options into the array ***/
149 $optgrps[SMOPT_GRP_REPLY
] = _("Reply Citation Options");
150 $optvals[SMOPT_GRP_REPLY
] = array();
152 $optvals[SMOPT_GRP_REPLY
][] = array(
153 'name' => 'reply_citation_style',
154 'caption' => _("Reply Citation Style"),
155 'type' => SMOPT_TYPE_STRLIST
,
156 'refresh' => SMOPT_REFRESH_NONE
,
157 'posvals' => array(SMPREF_NONE
=> _("No Citation"),
158 'author_said' => _("AUTHOR Said"),
159 'quote_who' => _("Quote Who XML"),
160 'user-defined' => _("User-Defined"))
163 $optvals[SMOPT_GRP_REPLY
][] = array(
164 'name' => 'reply_citation_start',
165 'caption' => _("User-Defined Citation Start"),
166 'type' => SMOPT_TYPE_STRING
,
167 'refresh' => SMOPT_REFRESH_NONE
,
168 'size' => SMOPT_SIZE_MEDIUM
171 $optvals[SMOPT_GRP_REPLY
][] = array(
172 'name' => 'reply_citation_end',
173 'caption' => _("User-Defined Citation End"),
174 'type' => SMOPT_TYPE_STRING
,
175 'refresh' => SMOPT_REFRESH_NONE
,
176 'size' => SMOPT_SIZE_MEDIUM
179 /*** Load the Signature Options into the array ***/
180 $optgrps[SMOPT_GRP_SIG
] = _("Signature Options");
181 $optvals[SMOPT_GRP_SIG
] = array();
183 $optvals[SMOPT_GRP_SIG
][] = array(
184 'name' => 'use_signature',
185 'caption' => _("Use Signature"),
186 'type' => SMOPT_TYPE_BOOLEAN
,
187 'refresh' => SMOPT_REFRESH_NONE
190 $optvals[SMOPT_GRP_SIG
][] = array(
191 'name' => 'prefix_sig',
192 'caption' => _("Prefix Signature with '-- ' Line"),
193 'type' => SMOPT_TYPE_BOOLEAN
,
194 'refresh' => SMOPT_REFRESH_NONE
197 /* Assemble all this together and return it as our result. */
205 /******************************************************************/
206 /** Define any specialized save functions for this option page. ***/
207 /******************************************************************/
209 function save_option_signature($option) {
210 global $data_dir, $username;
211 setSig($data_dir, $username, 'g', $option->new_value
);