squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

personal.php
Go to the documentation of this file.
1 <?php
2 
15 require_once(SM_PATH . 'functions/imap.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 define('SMOPT_GRP_TZ', 3);
22 
38  $full_name, $reply_to, $email_address, $signature, $tzChangeAllowed,
39  $color;
40 
41  /* Set the values of some global variables. */
42  $full_name = getPref($data_dir, $username, 'full_name');
43  $reply_to = getPref($data_dir, $username, 'reply_to');
44  $email_address = getPref($data_dir, $username, 'email_address');
45  $signature = getSig($data_dir, $username, 'g');
46 
47  /* Build a simple array into which we will build options. */
48  $optgrps = array();
49  $optvals = array();
50 
51  /******************************************************/
52  /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
53  /******************************************************/
54 
55  /*** Load the Contact Information Options into the array ***/
56  $optgrps[SMOPT_GRP_CONTACT] = _("Name and Address Options");
57  $optvals[SMOPT_GRP_CONTACT] = array();
58 
59  /* Build a simple array into which we will build options. */
60  $optvals = array();
61 
62  if (!isset($edit_identity)) {
63  $edit_identity = TRUE;
64  }
65 
66  if ($edit_identity || $edit_name) {
67  $optvals[SMOPT_GRP_CONTACT][] = array(
68  'name' => 'full_name',
69  'caption' => _("Full Name"),
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' => 'full_name',
77  'caption' => _("Full Name"),
78  'type' => SMOPT_TYPE_COMMENT,
79  'refresh' => SMOPT_REFRESH_NONE,
80  'comment' => $full_name
81  );
82  }
83 
84  if ($edit_identity) {
85  $optvals[SMOPT_GRP_CONTACT][] = array(
86  'name' => 'email_address',
87  'caption' => _("E-mail Address"),
88  'type' => SMOPT_TYPE_STRING,
89  'refresh' => SMOPT_REFRESH_NONE,
90  'size' => SMOPT_SIZE_HUGE
91  );
92  } else {
93  $optvals[SMOPT_GRP_CONTACT][] = array(
94  'name' => 'email_address',
95  'caption' => _("E-mail Address"),
96  'type' => SMOPT_TYPE_COMMENT,
97  'refresh' => SMOPT_REFRESH_NONE,
98  'comment' => $email_address
99  );
100  }
101 
102  $optvals[SMOPT_GRP_CONTACT][] = array(
103  'name' => 'reply_to',
104  'caption' => _("Reply To"),
105  'type' => SMOPT_TYPE_STRING,
106  'refresh' => SMOPT_REFRESH_NONE,
107  'size' => SMOPT_SIZE_HUGE
108  );
109 
110  $optvals[SMOPT_GRP_CONTACT][] = array(
111  'name' => 'signature',
112  'caption' => _("Signature"),
113  'type' => SMOPT_TYPE_TEXTAREA,
114  'refresh' => SMOPT_REFRESH_NONE,
115  'size' => SMOPT_SIZE_MEDIUM,
116  'save' => 'save_option_signature'
117  );
118 
119  if ($edit_identity) {
120  $identities_link_value = '<a href="options_identities.php">'
121  . _("Edit Advanced Identities")
122  . '</a> '
123  . _("(discards changes made on this form so far)");
124  $optvals[SMOPT_GRP_CONTACT][] = array(
125  'name' => 'identities_link',
126  'caption' => _("Multiple Identities"),
127  'type' => SMOPT_TYPE_COMMENT,
128  'refresh' => SMOPT_REFRESH_NONE,
129  'comment' => $identities_link_value
130  );
131  }
132 
133  if ( $tzChangeAllowed || function_exists('date_default_timezone_set')) {
134  $TZ_ARRAY[SMPREF_NONE] = _("Same as server");
135  $tzfile = SM_PATH . 'locale/timezones.cfg';
136  if ((!is_readable($tzfile)) or (!$fd = fopen($tzfile,'r'))) {
137  $message = _("Error opening timezone config, contact administrator.");
138  }
139 
140  // TODO: make error user friendly
141  if (isset($message)) {
143  exit;
144  }
145  while (!feof ($fd)) {
146  $zone = fgets($fd, 1024);
147  if( $zone ) {
148  $zone = trim($zone);
149  $TZ_ARRAY[$zone] = $zone;
150  }
151  }
152  fclose ($fd);
153 
154  $optgrps[SMOPT_GRP_TZ] = _("Timezone Options");
155  $optvals[SMOPT_GRP_TZ] = array();
156 
157  $optvals[SMOPT_GRP_TZ][] = array(
158  'name' => 'timezone',
159  'caption' => _("Your current timezone"),
160  'type' => SMOPT_TYPE_STRLIST,
161  'refresh' => SMOPT_REFRESH_NONE,
162  'posvals' => $TZ_ARRAY
163  );
164  }
165 
166  /*** Load the Reply Citation Options into the array ***/
167  $optgrps[SMOPT_GRP_REPLY] = _("Reply Citation Options");
168  $optvals[SMOPT_GRP_REPLY] = array();
169 
170  $optvals[SMOPT_GRP_REPLY][] = array(
171  'name' => 'reply_citation_style',
172  'caption' => _("Reply Citation Style"),
173  'type' => SMOPT_TYPE_STRLIST,
174  'refresh' => SMOPT_REFRESH_NONE,
175  'posvals' => array(SMPREF_NONE => _("No Citation"),
176  'author_said' => _("AUTHOR Wrote"),
177  'date_time_author' => _("On DATE, AUTHOR Wrote"),
178  'quote_who' => _("Quote Who XML"),
179  'user-defined' => _("User-Defined"))
180  );
181 
182  $optvals[SMOPT_GRP_REPLY][] = array(
183  'name' => 'reply_citation_start',
184  'caption' => _("User-Defined Citation Start"),
185  'type' => SMOPT_TYPE_STRING,
186  'refresh' => SMOPT_REFRESH_NONE,
187  'size' => SMOPT_SIZE_MEDIUM
188  );
189 
190  $optvals[SMOPT_GRP_REPLY][] = array(
191  'name' => 'reply_citation_end',
192  'caption' => _("User-Defined Citation End"),
193  'type' => SMOPT_TYPE_STRING,
194  'refresh' => SMOPT_REFRESH_NONE,
195  'size' => SMOPT_SIZE_MEDIUM
196  );
197 
198  /*** Load the Signature Options into the array ***/
199  $optgrps[SMOPT_GRP_SIG] = _("Signature Options");
200  $optvals[SMOPT_GRP_SIG] = array();
201 
202  $optvals[SMOPT_GRP_SIG][] = array(
203  'name' => 'use_signature',
204  'caption' => _("Use Signature"),
205  'type' => SMOPT_TYPE_BOOLEAN,
206  'refresh' => SMOPT_REFRESH_NONE
207  );
208 
209  $optvals[SMOPT_GRP_SIG][] = array(
210  'name' => 'prefix_sig',
211  'caption' => _("Prefix Signature with '-- ' Line"),
212  'type' => SMOPT_TYPE_BOOLEAN,
213  'refresh' => SMOPT_REFRESH_NONE
214  );
215 
216  /* Assemble all this together and return it as our result. */
217  $result = array(
218  'grps' => $optgrps,
219  'vals' => $optvals
220  );
221  return ($result);
222 }
223 
224 /******************************************************************/
226 /******************************************************************/
227 
231 function save_option_signature($option) {
232  global $data_dir, $username;
233  setSig($data_dir, $username, 'g', $option->new_value);
234 }
235 
plain_error_message
plain_error_message($message, $color)
Definition: display_messages.php:40
getPref
getPref($data_dir, $username, $string, $default='')
Definition: db_prefs.php:316
SMOPT_SIZE_HUGE
const SMOPT_SIZE_HUGE
Definition: options.php:53
$edit_identity
$edit_identity
Definition: config_default.php:588
getSig
getSig($data_dir, $username, $number)
Definition: db_prefs.php:407
$data_dir
$data_dir
Definition: config_default.php:499
$tzChangeAllowed
$tzChangeAllowed
Definition: validate.php:71
SMOPT_TYPE_COMMENT
const SMOPT_TYPE_COMMENT
Definition: options.php:27
SMOPT_GRP_CONTACT
const SMOPT_GRP_CONTACT
Definition: personal.php:18
$username
global $username
Definition: validate.php:55
SMOPT_TYPE_TEXTAREA
const SMOPT_TYPE_TEXTAREA
Definition: options.php:22
$message
$message
Definition: download.php:54
SMPREF_NONE
const SMPREF_NONE
Definition: constants.php:29
SMOPT_TYPE_STRING
const SMOPT_TYPE_STRING
Definition: options.php:20
SMOPT_SIZE_MEDIUM
const SMOPT_SIZE_MEDIUM
Definition: options.php:51
$edit_name
$edit_name
Definition: config_default.php:589
exit
exit
Definition: help.php:128
SM_PATH
const SM_PATH
Definition: decrypt_headers.php:16
_
_($str)
Definition: gettext.php:160
SMOPT_REFRESH_NONE
const SMOPT_REFRESH_NONE
Definition: options.php:44
SMOPT_GRP_SIG
const SMOPT_GRP_SIG
Definition: personal.php:20
SMOPT_GRP_REPLY
const SMOPT_GRP_REPLY
Definition: personal.php:19
save_option_signature
save_option_signature($option)
Definition: personal.php:231
SMOPT_TYPE_STRLIST
const SMOPT_TYPE_STRLIST
Definition: options.php:21
SMOPT_GRP_TZ
const SMOPT_GRP_TZ
Definition: personal.php:21
$color
$color
Definition: load_prefs.php:28
load_optpage_data_personal
load_optpage_data_personal()
Definition: personal.php:36
SMOPT_TYPE_BOOLEAN
const SMOPT_TYPE_BOOLEAN
Definition: options.php:25
setSig
setSig($data_dir, $username, $number, $string)
Definition: db_prefs.php:393