}
function start_filters() {
- global $mailbox, $username, $key, $imapServerAddress, $imapPort, $imap,
+ global $mailbox, $imapServerAddress, $imapPort, $imap,
$imap_general, $filters, $imap_stream, $imapConnection,
- $UseSeparateImapConnection, $AllowSpamFilters;
+ $UseSeparateImapConnection, $AllowSpamFilters, $_SESSION, $_COOKIE;
+
+ $username = $_SESSION['username'];
+ $key = $_COOKIE['key'];
# if ($mailbox == 'INBOX') {
// Detect if we have already connected to IMAP or not.
if ($SpamFilters_SharedCache) {
filters_SaveCache();
} else {
- session_register('SpamFilters_DNScache');
+ sqsession_register($SpamFilters_DNScache, 'SpamFilters_DNScache');
}
}
displayPageHeader($color, 'None');
- if (isset($filter_submit)) {
- if (!isset($theid)) $theid = 0;
+ $username = $_SESSION['username'];
+ $key = $_COOKIE['key'];
+ $onetimepad = $_SESSION['onetimepad'];
+ $delimiter = $_SESSION['delimiter'];
+ if(isset($_GET['theid'])) {
+ $theid = $_GET['theid'];
+ }
+ if(isset($_POST['theid'])) {
+ $theid = $_POST['theid'];
+ }
+ if(isset($_GET['action'])) {
+ $action = $_GET['action'];
+ }
+
+ if (isset($_POST['filter_submit'])) {
+ if(isset($_GET['theid'])) {
+ $theid = $_GET['theid'];
+ } elseif (isset($_POST['theid'])) {
+ $theid = $_POST['theid'];
+ } else {
+ $theid = 0;
+ }
+ $filter_what = $_POST['filter_what'];
+ $filter_where = $_POST['filter_where'];
+ $filter_folder = $_POST['filter_folder'];
+
$filter_what = ereg_replace(",", " ", $filter_what);
$filter_what = str_replace("\\\\", "\\", $filter_what);
$filter_what = str_replace("\\\"", "\"", $filter_what);
filter_swap($theid, $theid - 1);
} elseif (isset($action) && $action == 'move_down') {
filter_swap($theid, $theid + 1);
- } elseif (isset($user_submit)) {
- echo "<br><center><b>"._("Saved Scan type")."</b></center>\n";
- setPref($data_dir, $username, 'filters_user_scan', $filters_user_scan_set);
+ } elseif (isset($_POST['user_submit'])) {
+ setPref($data_dir, $username, 'filters_user_scan', $_POST['filters_user_scan_set']);
+ echo '<br><center><b>'._("Saved Scan type")."</b></center>\n";
}
$filters = load_filters();
'center' ) . '<br>';
if (isset($action) && ($action == 'add' || $action == 'edit')) {
+ $username = $_SESSION['username'];
+ $key = $_COOKIE['key'];
+
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$boxes = sqimap_mailbox_list($imapConnection);
sqimap_logout($imapConnection);
function squirrelmail_plugin_init_filters() {
global $squirrelmail_plugin_hooks;
- global $mailbox, $imap_stream, $imapConnection;
+
+ if (isset($_GET['mailbox'])) {
+ $mailbox = $_GET['mailbox'];
+ }
+ elseif (isset($_POST['mailbox'])) {
+ $mailbox = $_POST['mailbox'];
+ }
+ else {
+ $mailbox = 'INBOX';
+ }
$squirrelmail_plugin_hooks['left_main_before']['filters'] = 'start_filters';
- if ($mailbox == 'INBOX') {
+ if (isset($mailbox) && $mailbox == 'INBOX') {
$squirrelmail_plugin_hooks['right_main_after_header']['filters'] = 'start_filters';
}
$squirrelmail_plugin_hooks['optpage_register_block']['filters'] = 'filters_optpage_register_block';
require_once(SM_PATH . 'plugins/filters/filters.php');
global $AllowSpamFilters;
+$username = $_SESSION['username'];
+$key = $_COOKIE['key'];
+$onetimepad = $_SESSION['onetimepad'];
+$delimiter = $_SESSION['delimiter'];
+
+if (isset($_GET['action'])) {
+ $action = $_GET['action'];
+}
+
displayPageHeader($color, 'None');
-if (isset($spam_submit)) {
+if (isset($_POST['spam_submit'])) {
$spam_filters = load_spam_filters();
- setPref($data_dir, $username, 'filters_spam_folder', $filters_spam_folder_set);
- setPref($data_dir, $username, 'filters_spam_scan', $filters_spam_scan_set);
+ setPref($data_dir, $username, 'filters_spam_folder', $_POST['filters_spam_folder_set']);
+ setPref($data_dir, $username, 'filters_spam_scan', $_POST['filters_spam_scan_set']);
foreach ($spam_filters as $Key => $Value) {
$input = $spam_filters[$Key]['prefname'] . '_set';
- if ( isset( $$input ) ) {
+ if ( isset( $_POST[$input] ) ) {
setPref( $data_dir, $username, $spam_filters[$Key]['prefname'],
- $$input);
+ $_POST[$input]);
} else {
removePref($data_dir, $username, $spam_filters[$Key]['prefname']);
}
$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') {
+ if ((isset($boxes[$i]['flags'][0]) && $boxes[$i]['flags'][0] != 'noselect') &&
+ (isset($boxes[$i]['flags'][1]) && $boxes[$i]['flags'][1] != 'noselect') &&
+ (isset($boxes[$i]['flags'][2]) && $boxes[$i]['flags'][2] != 'noselect')) {
$filters_spam_folder = $boxes[$i]['unformatted'];
}
}
}
-if (! isset($action) || $action != 'spam') {
+if (! isset($_GET['action']) || $_GET['action'] != 'spam') {
echo html_tag( 'p', '', 'center' ) .
'[<a href="spamoptions.php?action=spam">' . _("Edit") . '</a>]' .