$Value) {
$input = $spam_filters[$Key]['prefname'] . '_set';
setPref($data_dir, $username, $spam_filters[$Key]['prefname'],
$$input);
}
} elseif (isset($action) && $action == 'delete') {
remove_filter($theid);
} elseif (isset($action) && $action == 'move_up') {
filter_swap($theid, $theid - 1);
} elseif (isset($action) && $action == 'move_down') {
filter_swap($theid, $theid + 1);
}
if ($AllowSpamFilters) {
$filters_spam_folder = getPref($data_dir, $username, 'filters_spam_folder');
$filters_spam_scan = getPref($data_dir, $username, 'filters_spam_scan');
}
$filters = load_filters();
echo '
' .
'
'.
"".
'' . _("Options") . ' - ' . _("Message Filtering") . ''.
' |
'.
'
[' . _("New") .
'] - [' . _("Done") . ']
' .
'';
for ($i=0; $i < count($filters); $i++) {
$clr = (($i % 2)?$color[0]:$color[9]);
$fdr = ($folder_prefix)?str_replace($folder_prefix, "", $filters[$i]["folder"]):$filters[$i]["folder"];
echo "".
"[" . _("Edit") . ']'.
' | '.
"[" . _("Delete") . ']'.
' | [';
if (isset($filters[$i + 1])) {
echo "" . _("Down") . '';
if ($i > 0) {
echo ' | ';
}
}
if ($i > 0) {
echo "" . _("Up") . '';
}
echo '] | - ';
printf( _("If %s contains %s then move to %s"), _($filters[$i]['where']), $filters[$i]['what'], $fdr );
echo ' |
';
}
echo '
'.
'';
if ($AllowSpamFilters) {
echo "".
'' . _("Spam Filtering") . ' |
'.
'
';
if (! isset($action) || $action != 'spam') {
echo '[' . _("Edit") . ']
';
printf( _("Spam is sent to %s"), ($filters_spam_folder?$filters_spam_folder:_("[not set yet]") ) );
echo '
';
printf( _("Spam scan is limited to %s"), (($filters_spam_scan == 'new')?_("New Messages Only"):_("All Messages") ) );
echo '
'.
"';
}
}
if (isset($action) && ($action == 'add' || $action == 'edit')) {
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$boxes = sqimap_mailbox_list($imapConnection);
sqimap_logout($imapConnection);
if ( !isset($theid) ) {
$theid = count($filters);
}
echo ''.
''.
'';
} else if (isset($action) && $action == 'spam' && $AllowSpamFilters) {
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$boxes = sqimap_mailbox_list($imapConnection);
sqimap_logout($imapConnection);
for ($i = 0; $i < count($boxes) && $filters_spam_folder == ''; $i++) {
if ($boxes[$i]['flags'][0] != 'noselect' &&
$boxes[$i]['flags'][1] != 'noselect' &&
$boxes[$i]['flags'][2] != 'noselect') {
$filters_spam_folder = $boxes[$i]['unformatted'];
}
}
echo '';
sqimap_logout($imapConnection);
}
?>