Allow mail_fetch plugin to use a different port
authorjangliss <jangliss@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 18 Nov 2002 03:21:24 +0000 (03:21 +0000)
committerjangliss <jangliss@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 18 Nov 2002 03:21:24 +0000 (03:21 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4167 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/mail_fetch/fetch.php
plugins/mail_fetch/options.php
plugins/mail_fetch/setup.php

index e1f220c..6fe08f3 100644 (file)
@@ -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;
         }
index af8ec27..4d1edb3 100644 (file)
@@ -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', '<input type=text name=mf_server value="" size=40>', 'left' )
                 ) .
+                html_tar( 'tr',
+                    html_tag( 'th', _("Port:"), 'right') .
+                    html_tag( 'td', '<input type=text name=mf_port value="" size=20', 'left')
+                ) .
                 html_tag( 'tr',
                     html_tag( 'th', _("Alias:"), 'right' ) .
                     html_tag( 'td', '<input type=text name=mf_alias value="" size=20>', 'left' )
@@ -302,6 +313,10 @@ require_once(SM_PATH . 'include/load_prefs.php');
                     html_tag( 'td', '<input type="text" name="mf_server" value="' . $mailfetch_server_[$mf_sn] . '" size="40">', 'left' )
                 ) .
                 html_tag( 'tr',
+                    html_tag( 'th', _("Port:"), 'right' ) .
+                    html_tag( 'td', '<input type="text" name="mf_port" value="' . $mailfetch_port_[$mf_sn] . '" size="40">', 'left' )
+                ) .
+                html_tag( 'tr',
                     html_tag( 'th', _("Alias:"), 'right' ) .
                     html_tag( 'td', '<input type="text" name="mf_alias" value="' . $mailfetch_alias_[$mf_sn] . '" size="40">', 'left' )
                 ) .
index 7842e5b..c5e67b0 100644 (file)
@@ -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");
                 $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];
 
                 $pop3 = new POP3($mailfetch_server, 60);
 
-                if (!$pop3->connect($mailfetch_server)) {
+                if (!$pop3->connect($mailfetch_server,$mailfetch_port)) {
                     $outMsg .= _("Warning, ") . $pop3->ERROR;
                     continue;
                 }