<?php
- /**
- ** mail_fetch/fetch.php
- **
- ** Copyright (c) 1999-2002 The SquirrelMail Project Team
- ** Licensed under the GNU GPL. For full terms see the file COPYING.
- **
- ** Fetch code.
- **
- ** $Id$
- **/
+/**
+ * mail_fetch/fetch.php
+ *
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * Fetch code.
+ *
+ * $Id$
+ */
- chdir('..');
- require_once('../src/validate.php');
- require_once('../functions/page_header.php');
- require_once('../functions/imap.php');
- require_once('../src/load_prefs.php');
- require_once('../plugins/mail_fetch/class.POP3.php');
- require_once('../functions/i18n.php');
- require_once( '../plugins/mail_fetch/functions.php' );
- require_once( '../functions/html.php' );
+define('SM_PATH','../../');
+require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/page_header.php');
+require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'include/load_prefs.php');
+require_once(SM_PATH . 'plugins/mail_fetch/class.POP3.php');
+require_once(SM_PATH . 'plugins/mail_fetch/functions.php' );
+require_once(SM_PATH . 'functions/html.php' );
+
+/* globals */
+sqgetGlobalVar('username', $username, SQ_SESSION);
+sqgetGlobalVar('key', $key, SQ_COOKIE);
+sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
+sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
+
+/* FIXME: This form, like the advanced identities form
+ * uses dynamic post variable names so we need
+ * to extract the whole $_POST array to make
+ * things work
+ */
+
+extract($_POST);
+/* end globals */
function Mail_Fetch_Status($msg) {
echo html_tag( 'table',
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");
'<option value="all" selected>..' . _("All") . "...\n";
for ($i=0;$i<$mailfetch_server_number;$i++) {
echo "<option value=\"$i\">" .
- (($mailfetch_alias_[$i]=='')?$mailfetch_server_[$i]:$mailfetch_alias_[$i]) .
+ htmlspecialchars((($mailfetch_alias_[$i]=='')?$mailfetch_server_[$i]:$mailfetch_alias_[$i])) .
'</option>' . "\n";
}
echo '</select>' .
if ($mailfetch_pass_[$i]=='') {
echo html_tag( 'tr',
html_tag( 'td', _("Password for") . ' <b>' .
- (($mailfetch_alias_[$i]=='')?$mailfetch_server_[$i]:$mailfetch_alias_[$i]) .
+ htmlspecialchars((($mailfetch_alias_[$i]=='')?$mailfetch_server_[$i]:$mailfetch_alias_[$i])) .
'</b>: ',
'right' ) .
html_tag( 'td', '<input type="password" name="pass_' . $i , '">', 'left' )
echo html_tag( 'tr',
html_tag( 'td', ' ' ) .
html_tag( 'td', '<input type=submit name=submit_mailfetch value="' . _("Fetch Mail"). '">', 'left' )
- );
-
+ ) .
'</table></form>';
exit();
}
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";
html_tag( 'table',
html_tag( 'tr',
html_tag( 'td', '<b>' . _("Fetching from ") .
- (($mailfetch_alias_[$i_loop] == '')?$mailfetch_server:$mailfetch_alias_[$i_loop]) .
+ htmlspecialchars((($mailfetch_alias_[$i_loop] == '')?$mailfetch_server:$mailfetch_alias_[$i_loop])) .
'</b>',
'center' ) ,
'', $color[9] ) ,
flush();
- if (!$pop3->connect($mailfetch_server)) {
+ if (!$pop3->connect($mailfetch_server,$mailfetch_port)) {
Mail_Fetch_Status(_("Oops, ") . $pop3->ERROR );
continue;
}