Update copyright
[squirrelmail.git] / plugins / mail_fetch / options.php
CommitLineData
d622d38a 1<?php
4b4abf93 2
8d6a115b 3/**
4 * mail_fetch/options.php
5 *
8d6a115b 6 * Setup of the mailfetch plugin.
7 *
79ba18dc 8 * @copyright 1999-2013 The SquirrelMail Project Team
4b4abf93 9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
4f51df66 10 * @version $Id$
ea5f4b8e 11 * @package plugins
12 * @subpackage mail_fetch
8d6a115b 13 */
d622d38a 14
202bcbcc 15/**
16 * Include the SquirrelMail initialization file.
17 */
18require('../../include/init.php');
929da10d 19include_once(SM_PATH . 'plugins/mail_fetch/functions.php' );
202bcbcc 20include_once(SM_PATH . 'functions/imap_general.php');
929da10d 21include_once(SM_PATH . 'functions/forms.php');
d622d38a 22
d9c537c4 23// don't load this page if this plugin is not enabled
24//
25global $plugins;
26if (!in_array('mail_fetch', $plugins)) exit;
27
3c66c567 28/* globals */
3c66c567 29sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
91e0dccc 30
3c66c567 31if(!sqgetGlobalVar('mf_cypher', $mf_cypher, SQ_POST)) {
32 $mf_cypher = '';
33}
34if(! sqgetGlobalVar('mf_action', $mf_action, SQ_POST) ) {
a747d971 35 if (sqgetGlobalVar('mf_action_mod', $mf_action_mod, SQ_POST)) {
36 $mf_action = 'Modify';
37 }
38 elseif (sqgetGlobalVar('mf_action_del', $mf_action_del, SQ_POST)) {
39 $mf_action = 'Delete';
40 }
41 else {
42 $mf_action = 'config';
43 }
3c66c567 44}
86bb8549 45
162cd2c6 46sqgetGlobalVar('mf_sn', $mf_sn, SQ_POST);
3c66c567 47sqgetGlobalVar('mf_server', $mf_server, SQ_POST);
48sqgetGlobalVar('mf_port', $mf_port, SQ_POST);
49sqgetGlobalVar('mf_alias', $mf_alias, SQ_POST);
50sqgetGlobalVar('mf_user', $mf_user, SQ_POST);
51sqgetGlobalVar('mf_pass', $mf_pass, SQ_POST);
52sqgetGlobalVar('mf_subfolder', $mf_subfolder, SQ_POST);
53sqgetGlobalVar('mf_login', $mf_login, SQ_POST);
54sqgetGlobalVar('mf_fref', $mf_fref, SQ_POST);
55sqgetGlobalVar('mf_lmos', $mf_lmos, SQ_POST);
929da10d 56sqgetGlobalVar('mf_auth', $mf_auth, SQ_POST);
57sqgetGlobalVar('mf_type', $mf_type, SQ_POST);
3c66c567 58sqgetGlobalVar('submit_mailfetch', $submit_mailfetch, SQ_POST);
b571d899 59$mf_port = trim($mf_port);
60$mf_server = trim($mf_server);
d622d38a 61
a747d971 62
3c66c567 63/* end globals */
64
876fdb60 65displayPageHeader( $color );
d622d38a 66
60683821 67switch( $mf_action ) {
68 case 'add':
b571d899 69
70 $mf_action = 'config';
71
72 // restrict port number if necessary
73 //
74 $message = validate_mail_fetch_port_number($mf_port);
75 if (!empty($message)) break;
76
77 // restrict server address if necessary
78 //
79 $message = validate_mail_fetch_server_address($mf_server);
80 if (!empty($message)) break;
81
60683821 82 if ($mf_sn<1) $mf_sn=0;
83 if (!isset($mf_server)) return;
84 setPref($data_dir,$username,"mailfetch_server_$mf_sn", (isset($mf_server)?$mf_server:""));
85 setPref($data_dir,$username,"mailfetch_port_$mf_sn", (isset($mf_port)?$mf_port:110));
86 setPref($data_dir,$username,"mailfetch_alias_$mf_sn", (isset($mf_alias)?$mf_alias:""));
87 setPref($data_dir,$username,"mailfetch_user_$mf_sn",(isset($mf_user)?$mf_user:""));
f54ec17d 88 $pass = "";
89 if ( isset($mf_pass) ) {
90 if ( isset($mf_cypher) && $mf_cypher == 'on' ) {
91 setPref($data_dir,$username,"mailfetch_cypher", ($mf_cypher == 'on' ? 'on' : ''));
92 $pass = encrypt($mf_pass);
93 } else {
94 $pass = $mf_pass;
95 }
96 }
97 setPref($data_dir,$username,"mailfetch_pass_$mf_sn",$pass);
60683821 98 setPref($data_dir,$username,"mailfetch_lmos_$mf_sn",(isset($mf_lmos)?$mf_lmos:""));
99 setPref($data_dir,$username,"mailfetch_login_$mf_sn",(isset($mf_login)?$mf_login:""));
100 setPref($data_dir,$username,"mailfetch_fref_$mf_sn",(isset($mf_fref)?$mf_fref:""));
101 setPref($data_dir,$username,"mailfetch_subfolder_$mf_sn",(isset($mf_subfolder)?$mf_subfolder:""));
929da10d 102 setPref($data_dir,$username,"mailfetch_auth_$mf_sn",(isset($mf_auth)?$mf_auth:MAIL_FETCH_AUTH_USER));
103 setPref($data_dir,$username,"mailfetch_type_$mf_sn",(isset($mf_type)?$mf_type:MAIL_FETCH_USE_PLAIN));
60683821 104 $mf_sn++;
105 setPref($data_dir,$username,'mailfetch_server_number', $mf_sn);
60683821 106 break;
b571d899 107
108 // modify a server
109 //
60683821 110 case 'confirm_modify':
b571d899 111
112 // restrict port number if necessary
113 //
114 $message = validate_mail_fetch_port_number($mf_port);
115 if (!empty($message)) {
116 $mf_action = 'Modify';
117 break;
118 }
119
120 // restrict server address if necessary
121 //
122 $message = validate_mail_fetch_server_address($mf_server);
123 if (!empty($message)) {
124 $mf_action = 'Modify';
125 break;
126 }
127
60683821 128 if (!isset($mf_server)) return;
129 setPref($data_dir,$username,"mailfetch_server_$mf_sn", (isset($mf_server)?$mf_server:""));
130 setPref($data_dir,$username,"mailfetch_port_$mf_sn", (isset($mf_port)?$mf_port:110));
131 setPref($data_dir,$username,"mailfetch_alias_$mf_sn", (isset($mf_alias)?$mf_alias:""));
132 setPref($data_dir,$username,"mailfetch_user_$mf_sn",(isset($mf_user)?$mf_user:""));
f54ec17d 133 $pass = "";
134 if ( isset($mf_pass) ) {
135 if ( isset($mf_cypher) && $mf_cypher == 'on' ) {
136 setPref($data_dir,$username,"mailfetch_cypher", 'on');
137 $pass = encrypt($mf_pass);
138 } else {
139 setPref($data_dir,$username,"mailfetch_cypher", '');
140 $pass = $mf_pass;
141 }
142 }
143 setPref($data_dir,$username,"mailfetch_pass_$mf_sn",$pass);
60683821 144 setPref($data_dir,$username,"mailfetch_lmos_$mf_sn",(isset($mf_lmos)?$mf_lmos:""));
145 setPref($data_dir,$username,"mailfetch_login_$mf_sn",(isset($mf_login)?$mf_login:""));
146 setPref($data_dir,$username,"mailfetch_fref_$mf_sn",(isset($mf_fref)?$mf_fref:""));
147 setPref($data_dir,$username,"mailfetch_subfolder_$mf_sn",(isset($mf_subfolder)?$mf_subfolder:""));
929da10d 148 setPref($data_dir,$username,"mailfetch_auth_$mf_sn",(isset($mf_auth)?$mf_auth:MAIL_FETCH_AUTH_USER));
149 setPref($data_dir,$username,"mailfetch_type_$mf_sn",(isset($mf_type)?$mf_type:MAIL_FETCH_USE_PLAIN));
60683821 150 $mf_action = 'config';
151 break;
152 case 'confirm_delete':
153 //delete a server
154 $mailfetch_server_number = getPref($data_dir, $username, "mailfetch_server_number");
155 if ($mf_sn+1==$mailfetch_server_number) {
156 //is the last server, whe can only decrase $mailfetch_server_number
157 $mailfetch_server_number--;
158 setPref($data_dir,$username,"mailfetch_server_number", $mailfetch_server_number);
159 } else {
160 //if not the last, all the sequel server come up one step
161 //then whe decrase $mailfetch_server_number
162 $mailfetch_server_number--;
163 for ($i=$mf_sn;$i<$mailfetch_server_number;$i++) {
164 $tmp=$i+1;
165 setPref($data_dir,$username,'mailfetch_server_'.$i,
166 getPref($data_dir,$username, 'mailfetch_server_'.$tmp));
167 setPref($data_dir,$username,'mailfetch_port_'.$i,
168 getPref($data_dir,$username, 'mailfetch_port_'.$tmp));
169 setPref($data_dir,$username,'mailfetch_alias_'.$i,
170 getPref($data_dir,$username, 'mailfetch_alias_'.$tmp));
171 setPref($data_dir,$username,'mailfetch_user_'.$i,
172 getPref($data_dir,$username, 'mailfetch_user_'.$tmp));
173 setPref($data_dir,$username,'mailfetch_pass_'.$i,
174 getPref($data_dir,$username, 'mailfetch_pass_'.$tmp));
175 setPref($data_dir,$username,'mailfetch_lmos_'.$i,
176 getPref($data_dir,$username, 'mailfetch_lmos_'.$tmp));
177 setPref($data_dir,$username,'mailfetch_login_'.$i,
178 getPref($data_dir,$username, 'mailfetch_login_'.$tmp));
179 setPref($data_dir,$username,'mailfetch_fref_'.$i,
180 getPref($data_dir,$username, 'mailfetch_fref_'.$tmp));
181 setPref($data_dir,$username,'mailfetch_subfolder_'.$i,
182 getPref($data_dir,$username, 'mailfetch_subfolder_'.$tmp));
929da10d 183 setPref($data_dir,$username,'mailfetch_auth_'.$i,
184 getPref($data_dir,$username, 'mailfetch_auth_'.$tmp,MAIL_FETCH_AUTH_USER));
185 setPref($data_dir,$username,'mailfetch_type_'.$i,
186 getPref($data_dir,$username, 'mailfetch_type_'.$tmp,MAIL_FETCH_USE_PLAIN));
60683821 187 setPref($data_dir,$username,'mailfetch_uidl_'.$i,
188 getPref($data_dir,$username, 'mailfetch_uidl_'.$tmp));
189 }
190 setPref($data_dir,$username,"mailfetch_server_number", $mailfetch_server_number);
191 }
192 $mf_action = 'config';
193 break;
194}
4cf43843 195
60683821 196$mailfetch_server_number = getPref($data_dir, $username, 'mailfetch_server_number', 0);
197$mailfetch_cypher = getPref( $data_dir, $username, 'mailfetch_cypher' );
198if ($mailfetch_server_number<1) {
199 $mailfetch_server_number=0;
200}
201for ($i=0;$i<$mailfetch_server_number;$i++) {
202 $mailfetch_server_[$i] = getPref($data_dir, $username, "mailfetch_server_$i");
203 $mailfetch_port_[$i] = getPref($data_dir, $username, "mailfetch_port_$i");
204 $mailfetch_alias_[$i] = getPref($data_dir, $username, "mailfetch_alias_$i");
205 $mailfetch_user_[$i] = getPref($data_dir, $username, "mailfetch_user_$i");
206 $mailfetch_pass_[$i] = getPref($data_dir, $username, "mailfetch_pass_$i");
207 $mailfetch_lmos_[$i] = getPref($data_dir, $username, "mailfetch_lmos_$i");
208 $mailfetch_login_[$i] = getPref($data_dir, $username, "mailfetch_login_$i");
209 $mailfetch_fref_[$i] = getPref($data_dir, $username, "mailfetch_fref_$i");
210 $mailfetch_uidl_[$i] = getPref($data_dir, $username, "mailfetch_uidl_$i");
211 $mailfetch_subfolder_[$i] = getPref($data_dir, $username, "mailfetch_subfolder_$i");
929da10d 212 $mailfetch_auth_[$i] = getPref($data_dir, $username, "mailfetch_auth_$i",MAIL_FETCH_AUTH_USER);
213 $mailfetch_type_[$i] = getPref($data_dir, $username, "mailfetch_type_$i",MAIL_FETCH_USE_PLAIN);
60683821 214 if( $mailfetch_cypher == 'on' ) $mailfetch_pass_[$i] = decrypt( $mailfetch_pass_[$i] );
215}
ae8a7931 216
60683821 217echo '<br /><form method="post" action="'.$PHP_SELF.'">' .
218 html_tag( 'table',
219 html_tag( 'tr',
220 html_tag('td',
221 '<b>' . _("Remote POP server settings") . '</b>',
222 'center', $color[0] )
223 ),
224 'center', '', 'width="95%"' ) .
225 html_tag( 'table',
226 html_tag( 'tr',
227 html_tag( 'td',
228 _("You should be aware that the encryption used to store your password is not perfectly secure. However, if you are using pop, there is inherently no encryption anyway. Additionally, the encryption that we do to save it on the server can be undone by a hacker reading the source to this file.") ,
229 'left' )
230 ) .
231 html_tag( 'tr',
232 html_tag( 'td',
233 _("If you leave password empty, it will be asked when you fetch mail.") ,
234 'left' )
235 ) .
236 html_tag( 'tr',
237 html_tag( 'td',
238 '<input type="checkbox" name="mf_cypher" ' .
239 (($mailfetch_cypher=='on')?'checked="checked" />':' />') .
240 _("Encrypt passwords (informative only)") ,
241 'right' )
242 ) ,
243 'center', '', 'width="95%"' );
d622d38a 244
b571d899 245// display error or other messages if necessary
246//
247if (!empty($message)) {
248 echo html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="5" cellspacing="1"' ) .
249 html_tag( 'tr',
250 html_tag( 'td', '<b>' . $message . '</b>', 'center', $color[2] ));
251}
252
60683821 253switch( $mf_action ) {
254 case 'config':
255 echo html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="5" cellspacing="1"' ) .
256 html_tag( 'tr',
257 html_tag( 'td', '<b>' . _("Add Server") . '</b>', 'center', $color[9] )
258 ) .
259 html_tag( 'tr' ) .
260 html_tag( 'td', '', 'center', $color[0] ) .
4cf43843 261
60683821 262 "<input type=\"hidden\" name=\"mf_sn\" value=\"$mailfetch_server_number\" />" .
263 '<input type="hidden" name="mf_action" value="add" />' .
264 html_tag( 'table' ) .
265 html_tag( 'tr',
266 html_tag( 'th', _("Server:"), 'right' ) .
267 html_tag( 'td', '<input type="text" name="mf_server" value="" size="40" />', 'left' )
268 ) .
269 html_tag( 'tr',
270 html_tag( 'th', _("Port:"), 'right') .
271 html_tag( 'td', '<input type="text" name="mf_port" value="110" size="20" />', 'left')
272 ) .
273 html_tag( 'tr',
274 html_tag( 'th', _("Alias:"), 'right' ) .
275 html_tag( 'td', '<input type="text" name="mf_alias" value="" size="20" />', 'left' )
276 ) .
277 html_tag( 'tr',
278 html_tag( 'th', _("Username:"), 'right' ) .
279 html_tag( 'td', '<input type="text" name="mf_user" value="" size="20" />', 'left' )
280 ) .
281 html_tag( 'tr',
282 html_tag( 'th', _("Password:"), 'right' ) .
283 html_tag( 'td', '<input type="password" name="mf_pass" value="" size="20" />', 'left' )
284 ) .
929da10d 285 html_tag( 'tr',
286 html_tag( 'th', _("Authentication type:"), 'right' ) .
287 html_tag( 'td', addSelect('mf_auth',
288 array(MAIL_FETCH_AUTH_USER => _("USER"),
289 MAIL_FETCH_AUTH_APOP => _("APOP"),
290 MAIL_FETCH_AUTH_RFC1939 => _("APOP or USER")),
291 MAIL_FETCH_AUTH_USER,true), 'left' )
292 ) .
293 html_tag( 'tr',
294 html_tag( 'th', _("Connection type:"), 'right' ) .
295 html_tag( 'td', addSelect('mf_type',
296 array(MAIL_FETCH_USE_PLAIN => _("Plain text"),
297 MAIL_FETCH_USE_TLS => _("Use TLS"),
298 MAIL_FETCH_USE_STLS => _("Use StartTLS")),
299 MAIL_FETCH_USE_PLAIN,true), 'left' )
300 ) .
60683821 301 html_tag( 'tr' ) .
302 html_tag( 'th', _("Store in Folder:"), 'right' ) .
303 html_tag( 'td', '', 'left' );
2128bbc6 304 $imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0);
60683821 305 $boxes = sqimap_mailbox_list($imapConnection);
306 echo '<select name="mf_subfolder">';
4cf43843 307
60683821 308 $selected = 0;
309 if ( isset($mf_subfolder) )
310 $selected = array(strtolower($mf_subfolder));
311 echo sqimap_mailbox_option_list($imapConnection, $selected);
312 echo '</select></td></tr>' .
313 html_tag( 'tr',
314 html_tag( 'th', '&nbsp;', 'right' ) .
315 html_tag( 'td', '<input type="checkbox" name="mf_lmos" checked="checked" />' . _("Leave Mail on Server"), 'left' )
316 ) .
317 html_tag( 'tr',
318 html_tag( 'th', '&nbsp;', 'right' ) .
319 html_tag( 'td', '<input type="checkbox" name="mf_login" />' . _("Check mail at login"), 'left' )
320 ) .
321 html_tag( 'tr',
322 html_tag( 'th', '&nbsp;', 'right' ) .
323 html_tag( 'td', '<input type="checkbox" name="mf_fref" />' . _("Check mail at folder refresh"), 'left' )
324 ) .
325 html_tag( 'tr',
326 html_tag( 'td',
327 '<input type="submit" name="submit_mailfetch" value="' . _("Add Server") . '" />',
328 'center', '', 'colspan="2"' )
329 ) .
330 '</table></td></tr></table></form>';
4cf43843 331
60683821 332 // Modify Server
333 echo '<font size="-5"><br /></font>' .
334 html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="5" cellspacing="1"' ) .
335 html_tag( 'tr',
336 html_tag( 'td', '<b>' . _("Modify Server") . '</b>', 'center', $color[9] )
337 ) .
338 html_tag( 'tr' ) .
339 html_tag( 'td', '', 'center', $color[0] );
340 if ($mailfetch_server_number>0) {
341 echo "<form action=\"$PHP_SELF\" method=\"post\" target=\"_self\">";
342 echo '<b>' . _("Server Name:") . '</b> <select name="mf_sn">';
343 for ($i=0;$i<$mailfetch_server_number;$i++) {
344 echo "<option value=\"$i\">" .
3047e291 345 sm_encode_html_special_chars( (($mailfetch_alias_[$i]=='')?$mailfetch_server_[$i]:$mailfetch_alias_[$i])) . "</option>";
60683821 346 }
347 echo '</select>'.
348 '&nbsp;&nbsp;<input type="submit" name="mf_action_mod" value="' . _("Modify") . '" />'.
349 '&nbsp;&nbsp;<input type="submit" name="mf_action_del" value="' . _("Delete") . '" />'.
350 '</form>';
351 } else {
352 echo _("No servers known.");
353 }
354 echo '</td></tr></table>';
355 break;
356 case 'Delete': //erase confirmation about a server
357 echo html_tag( 'table',
358 html_tag( 'tr',
359 html_tag( 'td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0] )
360 ) ,
361 'center', '', 'width="95%" cellpadding="5" cellspacing="1"' ) .
362 '<br />' .
363 html_tag( 'table',
364 html_tag( 'tr',
365 html_tag( 'td', '<b>' . _("Confirm Deletion of a Server") . '</b>', 'center', $color[9] )
366 ) .
367 html_tag( 'tr',
368 html_tag( 'td',
369 "<input type=\"hidden\" name=\"mf_sn\" value=\"$mf_sn\" />" .
370 '<input type="hidden" name="mf_action" value="confirm_delete" />' .
3047e291 371 '<br />' . _("Selected Server:") . " <b>" . sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . "</b><br />" .
60683821 372 _("Confirm delete of selected server?") . '<br /><br />' .
373 '<input type="submit" name="submit_mailfetch" value="' . _("Confirm Delete") . '" />' .
374 '<br /></form>' ,
375 'center', $color[9] )
376 ) ,
377 'center', '', 'width="70%" cellpadding="5" cellspacing="1"' );
378 break; //modify a server
379 case 'Modify':
380 echo html_tag( 'table',
381 html_tag( 'tr',
382 html_tag( 'td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0] )
383 ) ,
384 'center', '', 'width="95%" cellpadding="5" cellspacing="1"' ) .
385 '<br />' .
386 html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="5" cellspacing="1"' ) .
387 html_tag( 'tr',
388 html_tag( 'td', '<b>' . _("Modify Server") . '</b>', 'center', $color[9] )
389 ) .
390 html_tag( 'tr' ) .
391 html_tag( 'td', '', 'center', $color[0] ) .
4cf43843 392
60683821 393 "<input type=\"hidden\" name=\"mf_sn\" value=\"$mf_sn\" />" .
394 '<input type="hidden" name="mf_action" value="confirm_modify" />' .
395 html_tag( 'table' ) .
396 html_tag( 'tr',
397 html_tag( 'th', _("Server:"), 'right' ) .
398 html_tag( 'td', '<input type="text" name="mf_server" value="' .
3047e291 399 sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . '" size="40" />', 'left' )
60683821 400 ) .
401 html_tag( 'tr',
402 html_tag( 'th', _("Port:"), 'right' ) .
403 html_tag( 'td', '<input type="text" name="mf_port" value="' .
3047e291 404 sm_encode_html_special_chars($mailfetch_port_[$mf_sn]) . '" size="40" />', 'left' )
60683821 405 ) .
406 html_tag( 'tr',
407 html_tag( 'th', _("Alias:"), 'right' ) .
408 html_tag( 'td', '<input type="text" name="mf_alias" value="' .
3047e291 409 sm_encode_html_special_chars($mailfetch_alias_[$mf_sn]) . '" size="40" />', 'left' )
60683821 410 ) .
411 html_tag( 'tr',
412 html_tag( 'th', _("Username:"), 'right' ) .
413 html_tag( 'td', '<input type="text" name="mf_user" value="' .
3047e291 414 sm_encode_html_special_chars($mailfetch_user_[$mf_sn]) . '" size="20" />', 'left' )
60683821 415 ) .
416 html_tag( 'tr',
417 html_tag( 'th', _("Password:"), 'right' ) .
418 html_tag( 'td', '<input type="password" name="mf_pass" value="' .
3047e291 419 sm_encode_html_special_chars($mailfetch_pass_[$mf_sn]) . '" size="20" />', 'left' )
60683821 420 ) .
929da10d 421 html_tag( 'tr',
422 html_tag( 'th', _("Authentication type:"), 'right' ) .
423 html_tag( 'td', addSelect('mf_auth',array(MAIL_FETCH_AUTH_USER => _("USER"),
424 MAIL_FETCH_AUTH_APOP => _("APOP"),
425 MAIL_FETCH_AUTH_RFC1939 => _("APOP or USER")),
426 $mailfetch_auth_[$mf_sn],true), 'left' )
427 ) .
428 html_tag( 'tr',
429 html_tag( 'th', _("Connection type:"), 'right' ) .
430 html_tag( 'td', addSelect('mf_type',array(MAIL_FETCH_USE_PLAIN => _("Plain text"),
431 MAIL_FETCH_USE_TLS => _("Use TLS"),
432 MAIL_FETCH_USE_STLS => _("Use StartTLS")),
433 $mailfetch_type_[$mf_sn],true), 'left' )
434 ) .
60683821 435 html_tag( 'tr' ) .
436 html_tag( 'th', _("Store in Folder:"), 'right' ) .
437 html_tag( 'td', '', 'left' );
dcc1cc82 438
2128bbc6 439 $imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0);
60683821 440 $boxes = sqimap_mailbox_list($imapConnection);
441 echo '<select name="mf_subfolder">';
442 $selected = 0;
443 if ( isset($mailfetch_subfolder_[$mf_sn]) ) {
444 $selected = array(strtolower($mailfetch_subfolder_[$mf_sn]));
445 }
446 echo sqimap_mailbox_option_list($imapConnection, $selected) .
447 '</select></td></tr>' .
448 html_tag( 'tr',
449 html_tag( 'th', '&nbsp;', 'right' ) .
450 html_tag( 'td',
451 '<input type="checkbox" name="mf_lmos" ' . (($mailfetch_lmos_[$mf_sn] == 'on')?'checked="checked"':'') .
452 ' />' . _("Leave Mail on Server") ,
453 'left' )
454 ) .
455 html_tag( 'tr',
456 html_tag( 'th', '&nbsp;', 'right' ) .
457 html_tag( 'td',
458 '<input type="checkbox" name="mf_login" ' . ( ($mailfetch_login_[$mf_sn] == 'on')?'checked="checked"':'') .
459 ' />' . _("Check mail at login"),
460 'left' )
461 ) .
462 html_tag( 'tr',
463 html_tag( 'th', '&nbsp;', 'right' ) .
464 html_tag( 'td',
465 '<input type="checkbox" name="mf_fref" ' . ( ($mailfetch_fref_[$mf_sn] == 'on')?'checked="checked"':'') .
466 ' />' . _("Check mail at folder refresh") ,
467 'left' )
468 ) .
469 html_tag( 'tr',
470 html_tag( 'td',
471 '<input type="submit" name="submit_mailfetch" value="' . _("Modify Server") . '" />',
472 'center', '', 'colspan="2"' )
473 ) .
474 '</table></form></td></tr></table>';
475 break;
476 default: //unsupported action
477 echo '</form>' .
478 html_tag( 'table',
479 html_tag( 'tr',
480 html_tag( 'td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0] )
481 ) ,
482 'center', '', 'width="95%"' ) .
483 '<br />' .
484 html_tag( 'table',
485 html_tag( 'tr',
486 html_tag( 'td', '<b>' . _("Undefined Function") . '</b>', 'center', $color[9] ) .
487 html_tag( 'td', '<b>' . _("The function you requested is unknown.") . '</b>', 'center', $color[0] )
488 ) ,
489 'center', '', 'width="70%"' );
490}
929da10d 491
8ab3c1bd 492$oTemplate->display('footer.tpl');