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