Skip to content

Commit

Permalink
closes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
PF4Public committed May 16, 2016
1 parent 32741b2 commit 8097467
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions config.inc.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ $rcmail_config ['fetchmail_limit'] = 10;
// allow remote folder setting
$rcmail_config ['fetchmail_folder'] = false;

// mda for fetchmail
$rcmail_config ['fetchmail_mda'] = '';

?>
5 changes: 3 additions & 2 deletions fetchmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,21 @@ function save() {
} else {
$fetchall = 1;
}
$mda = $rcmail->config->get ( 'fetchmail_mda' );
if ($newentry or $id == '') {
$sql = "SELECT * FROM fetchmail WHERE mailbox='" . $mailbox . "'";
$result = $rcmail->db->query ( $sql );
$limit = $rcmail->config->get ( 'fetchmail_limit' );
$num_rows = $rcmail->db->num_rows ( $result );
if ($num_rows < $limit) {
$sql = "INSERT INTO fetchmail (mailbox, active, src_server, src_user, src_password, src_folder, poll_time, fetchall, keep, protocol, usessl, src_auth) VALUES ('$mailbox', '$enabled', '$server', '$user', '$pass', '$folder', '$pollinterval', '$fetchall', '$keep', '$protocol', '$usessl', 'password' )";
$sql = "INSERT INTO fetchmail (mailbox, active, src_server, src_user, src_password, src_folder, poll_time, fetchall, keep, protocol, usessl, src_auth, mda) VALUES ('$mailbox', '$enabled', '$server', '$user', '$pass', '$folder', '$pollinterval', '$fetchall', '$keep', '$protocol', '$usessl', 'password', '$mda' )";
$insert = $rcmail->db->query ( $sql );
$rcmail->output->command ( 'display_message', $this->gettext ( 'successfullysaved' ), 'confirmation' );
} else {
$rcmail->output->command ( 'display_message', 'Error: ' . $this->gettext ( 'fetchmaillimitreached' ), 'error' );
}
} else {
$sql = "UPDATE fetchmail SET mailbox = '$mailbox', active = '$enabled', keep = '$keep', protocol = '$protocol', src_server = '$server', src_user = '$user', src_password = '$pass', src_folder = '$folder', poll_time = '$pollinterval', fetchall = '$fetchall', usessl = '$usessl', src_auth = 'password' WHERE id = '$id'";
$sql = "UPDATE fetchmail SET mailbox = '$mailbox', active = '$enabled', keep = '$keep', protocol = '$protocol', src_server = '$server', src_user = '$user', src_password = '$pass', src_folder = '$folder', poll_time = '$pollinterval', fetchall = '$fetchall', usessl = '$usessl', src_auth = 'password', mda = '$mda' WHERE id = '$id'";
$update = $rcmail->db->query ( $sql );
$rcmail->output->command ( 'display_message', $this->gettext ( 'successfullysaved' ), 'confirmation' );
}
Expand Down

0 comments on commit 8097467

Please sign in to comment.