From e42b0dd20795b5132ca6d2a05d5c2f9d21357574 Mon Sep 17 00:00:00 2001 From: jangliss Date: Mon, 18 Nov 2002 03:21:24 +0000 Subject: [PATCH] Allow mail_fetch plugin to use a different port git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4167 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/mail_fetch/fetch.php | 4 +++- plugins/mail_fetch/options.php | 15 +++++++++++++++ plugins/mail_fetch/setup.php | 5 ++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/plugins/mail_fetch/fetch.php b/plugins/mail_fetch/fetch.php index e1f220c3..6fe08f30 100644 --- a/plugins/mail_fetch/fetch.php +++ b/plugins/mail_fetch/fetch.php @@ -53,6 +53,7 @@ require_once(SM_PATH . 'functions/html.php' ); if ($mailfetch_server_number<1) $mailfetch_server_number=0; for ($i=0;$i<$mailfetch_server_number;$i++) { $mailfetch_server_[$i] = getPref($data_dir, $username, "mailfetch_server_$i"); + $mailfetch_port_[$i] = getPref($data_dir, $username, "mailfetch_port_$i"); $mailfetch_alias_[$i] = getPref($data_dir, $username, "mailfetch_alias_$i"); $mailfetch_user_[$i] = getPref($data_dir, $username, "mailfetch_user_$i"); $mailfetch_pass_[$i] = getPref($data_dir, $username, "mailfetch_pass_$i"); @@ -123,6 +124,7 @@ require_once(SM_PATH . 'functions/html.php' ); for ($i_loop=$i_start;$i_loop<$i_stop;$i_loop++) { $mailfetch_server=$mailfetch_server_[$i_loop]; + $mailfetch_port=$mailfetch_port_[$i_loop]; $mailfetch_user=$mailfetch_user_[$i_loop]; if ($mailfetch_pass_[$i_loop]=="") { $tmp="pass_$i_loop"; @@ -150,7 +152,7 @@ require_once(SM_PATH . 'functions/html.php' ); flush(); - if (!$pop3->connect($mailfetch_server)) { + if (!$pop3->connect($mailfetch_server,$mailfetch_port)) { Mail_Fetch_Status(_("Oops, ") . $pop3->ERROR ); continue; } diff --git a/plugins/mail_fetch/options.php b/plugins/mail_fetch/options.php index af8ec273..4d1edb35 100644 --- a/plugins/mail_fetch/options.php +++ b/plugins/mail_fetch/options.php @@ -32,6 +32,9 @@ require_once(SM_PATH . 'include/load_prefs.php'); if(isset($_POST['mf_server'])) { $mf_server = $_POST['mf_server']; } + if(isset($_POST['mf_port'])) { + $mf_port = $_POST['mf_port']; + } if(isset($_POST['mf_alias'])) { $mf_alias = $_POST['mf_alias']; } @@ -72,6 +75,7 @@ require_once(SM_PATH . 'include/load_prefs.php'); if ($mf_sn<1) $mf_sn=0; if (!isset($mf_server)) return; setPref($data_dir,$username,"mailfetch_server_$mf_sn", (isset($mf_server)?$mf_server:"")); + setPref($data_dir,$username,"mailfetch_port_$mf_sn"), (isset($mf_port)?$mf_port:'110'); setPref($data_dir,$username,"mailfetch_alias_$mf_sn", (isset($mf_alias)?$mf_alias:"")); setPref($data_dir,$username,"mailfetch_user_$mf_sn",(isset($mf_user)?$mf_user:"")); setPref($data_dir,$username,"mailfetch_pass_$mf_sn",(isset($mf_pass)?encrypt( $mf_pass ) :"")); @@ -88,6 +92,7 @@ require_once(SM_PATH . 'include/load_prefs.php'); //modify a server if (!isset($mf_server)) return; setPref($data_dir,$username,"mailfetch_server_$mf_sn", (isset($mf_server)?$mf_server:"")); + setPref($data_dir,$username,"mailfetch_port_$mf_sn"), (isset($mf_port)?$mf_port:'110'); setPref($data_dir,$username,"mailfetch_alias_$mf_sn", (isset($mf_alias)?$mf_alias:"")); setPref($data_dir,$username,"mailfetch_user_$mf_sn",(isset($mf_user)?$mf_user:"")); setPref($data_dir,$username,"mailfetch_pass_$mf_sn",(isset($mf_pass)?encrypt( $mf_pass ) :"")); @@ -112,6 +117,7 @@ require_once(SM_PATH . 'include/load_prefs.php'); for ($i=$mf_sn;$i<$mailfetch_server_number;$i++) { $tmp=$i+1; setPref($data_dir,$username,"mailfetch_server_$i", getPref($data_dir, $username, "mailfetch_server_$tmp")); + setPref($data_dir,$username,"mailfetch_port_$i"), getPref($data_dir,$username, "mailfetch_port_$tmp")); setPref($data_dir,$username,"mailfetch_alias_$i", getPref($data_dir, $username, "mailfetch_alias_$tmp")); setPref($data_dir,$username,"mailfetch_user_$i", getPref($data_dir, $username, "mailfetch_user_$tmp")); setPref($data_dir,$username,"mailfetch_pass_$i",(isset($mf_pass)?encrypt( $mf_pass ) :"")); @@ -134,6 +140,7 @@ require_once(SM_PATH . 'include/load_prefs.php'); } for ($i=0;$i<$mailfetch_server_number;$i++) { $mailfetch_server_[$i] = getPref($data_dir, $username, "mailfetch_server_$i"); + $mailfetch_port_[$i] = getPref($data_dir, $username, "mailfetch_port_$i"); $mailfetch_alias_[$i] = getPref($data_dir, $username, "mailfetch_alias_$i"); $mailfetch_user_[$i] = getPref($data_dir, $username, "mailfetch_user_$i"); $mailfetch_pass_[$i] = getPref($data_dir, $username, "mailfetch_pass_$i"); @@ -190,6 +197,10 @@ require_once(SM_PATH . 'include/load_prefs.php'); html_tag( 'th', _("Server:"), 'right' ) . html_tag( 'td', '', 'left' ) ) . + html_tar( 'tr', + html_tag( 'th', _("Port:"), 'right') . + html_tag( 'td', '', 'left' ) @@ -301,6 +312,10 @@ require_once(SM_PATH . 'include/load_prefs.php'); html_tag( 'th', _("Server:"), 'right' ) . html_tag( 'td', '', 'left' ) ) . + html_tag( 'tr', + html_tag( 'th', _("Port:"), 'right' ) . + html_tag( 'td', '', 'left' ) + ) . html_tag( 'tr', html_tag( 'th', _("Alias:"), 'right' ) . html_tag( 'td', '', 'left' ) diff --git a/plugins/mail_fetch/setup.php b/plugins/mail_fetch/setup.php index 7842e5b4..c5e67b05 100644 --- a/plugins/mail_fetch/setup.php +++ b/plugins/mail_fetch/setup.php @@ -50,6 +50,7 @@ if ($mailfetch_server_number<1) $mailfetch_server_number=0; for ($i=0;$i<$mailfetch_server_number;$i++) { $mailfetch_server_[$i] = getPref($data_dir, $username, "mailfetch_server_$i"); + $mailfetch_port_[$i] = getPref($data_dir, $username, "mailfetch_port_$i"); $mailfetch_alias_[$i] = getPref($data_dir, $username, "mailfetch_alias_$i"); $mailfetch_user_[$i] = getPref($data_dir, $username, "mailfetch_user_$i"); $mailfetch_pass_[$i] = getPref($data_dir, $username, "mailfetch_pass_$i"); @@ -97,6 +98,7 @@ ( ( $mailfetch_login_[$i_loop] == 'on' && $mailfetch_newlog == 'on' ) || $mailfetch_fref_[$i_loop] == 'on' ) ) { $mailfetch_server_[$i_loop] = getPref($data_dir, $username, "mailfetch_server_$i_loop"); + $mailfetch_port_[$i_loop] = getPref($data_dir, $username , "mailfetch_port_$i_loop"); $mailfetch_alias_[$i_loop] = getPref($data_dir, $username, "mailfetch_alias_$i_loop"); $mailfetch_user_[$i_loop] = getPref($data_dir, $username, "mailfetch_user_$i_loop"); $mailfetch_lmos_[$i_loop] = getPref($data_dir, $username, "mailfetch_lmos_$i_loop"); @@ -104,6 +106,7 @@ $mailfetch_subfolder_[$i_loop] = getPref($data_dir, $username, "mailfetch_subfolder_$i_loop"); $mailfetch_server=$mailfetch_server_[$i_loop]; + $mailfetch_port=$mailfetch_port_[$i_loop]; $mailfetch_user=$mailfetch_user_[$i_loop]; $mailfetch_alias=$mailfetch_alias_[$i_loop]; $mailfetch_pass=$mailfetch_pass_[$i_loop]; @@ -118,7 +121,7 @@ $pop3 = new POP3($mailfetch_server, 60); - if (!$pop3->connect($mailfetch_server)) { + if (!$pop3->connect($mailfetch_server,$mailfetch_port)) { $outMsg .= _("Warning, ") . $pop3->ERROR; continue; } -- 2.25.1