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