From: thomppj Date: Thu, 15 Aug 2002 04:20:42 +0000 (+0000) Subject: Updated filters plugin to work with UID support. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=9feb43693d6ab0d94cb1c0b303f347568585b0ee Updated filters plugin to work with UID support. Made main header block look prettier in message view. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3306 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/plugins/filters/filters.php b/plugins/filters/filters.php index 8b017c96..0a022e1a 100644 --- a/plugins/filters/filters.php +++ b/plugins/filters/filters.php @@ -249,6 +249,7 @@ function start_filters() { $imap_general, $filters, $imap_stream, $imapConnection, $UseSeparateImapConnection, $AllowSpamFilters; +# We really want to do this for ALL mailbox. # if ($mailbox == 'INBOX') { // Detect if we have already connected to IMAP or not. // Also check if we are forced to use a separate IMAP connection @@ -290,47 +291,57 @@ function user_filters($imap_stream) { sqimap_mailbox_select($imap_stream, 'INBOX'); - // For every rule + /* For every rule */ for ($i=0; $i < count($filters); $i++) { // If it is the "combo" rule if ($filters[$i]['where'] == 'To or Cc') { - /* - * If it's "TO OR CC", we have to do two searches, one for TO - * and the other for CC. - */ - filter_search_and_delete($imap_stream, 'TO', - $filters[$i]['what'], $filters[$i]['folder'], $filters_user_scan); - filter_search_and_delete($imap_stream, 'CC', - $filters[$i]['what'], $filters[$i]['folder'], $filters_user_scan); + + /* If it's "TO OR CC", we have to do two */ + /* searches one for TO and the other for CC. */ + filter_search_and_delete($imap_stream, + 'TO', + $filters[$i]['what'], + $filters[$i]['folder'], + $filters_user_scan); + filter_search_and_delete($imap_stream, + 'CC', + $filters[$i]['what'], + $filters[$i]['folder'], + $filters_user_scan); } else { - /* - * If it's a normal TO, CC, SUBJECT, or FROM, then handle it - * normally. - */ - filter_search_and_delete($imap_stream, $filters[$i]['where'], - $filters[$i]['what'], $filters[$i]['folder'], $filters_user_scan); + + /* If it's a normal TO, CC, SUBJECT, */ + /* or FROM, then handle it normally. */ + filter_search_and_delete($imap_stream, + $filters[$i]['where'], + $filters[$i]['what'], + $filters[$i]['folder'], + $filters_user_scan); } } - // Clean out the mailbox whether or not auto_expunge is on - // That way it looks like it was redirected properly + + /* Clean out the mailbox whether or not auto_expunge is */ + /* on That way it looks like it was redirected properly */ sqimap_mailbox_expunge($imap_stream, 'INBOX'); } function filter_search_and_delete($imap, $where, $what, $where_to, $user_scan) { - global $languages, $squirrelmail_language, $allow_charset_search; + global $languages, $squirrelmail_language, $allow_charset_search, + $uid_support; if ($user_scan == 'new') { $category = 'UNSEEN'; } else { $category = 'ALL'; } - if ($allow_charset_search && isset($languages[$squirrelmail_language]['CHARSET']) && - $languages[$squirrelmail_language]['CHARSET']) { - $search_str = "SEARCH CHARSET " + if ($allow_charset_search + && isset($languages[$squirrelmail_language]['CHARSET']) + && $languages[$squirrelmail_language]['CHARSET']) { + $search_str = 'SEARCH CHARSET "' . strtoupper($languages[$squirrelmail_language]['CHARSET']) - . ' ' . $category . ' '; + . '" ' . $category . ' '; } else { - $search_str = 'SEARCH CHARSET US-ASCII ' . $category . ' '; + $search_str = 'SEARCH CHARSET "US-ASCII" ' . $category . ' '; } if ($where == "Header") { $what = explode(':', $what); @@ -338,21 +349,16 @@ function filter_search_and_delete($imap, $where, $what, $where_to, $user_scan) { $what = addslashes(trim($what[1])); } $search_str .= $where . ' {' . strlen($what) . "}\r\n" . $what . "\r\n"; - - fputs ($imap, "a001 $search_str"); - $read = filters_sqimap_read_data ($imap, 'a001', true, $response, $message); - - // This may have problems with EIMS due to it being goofy + $readin = sqimap_run_command($imap, $search_str, false, $result, $message, $uid_support); - for ($r=0; $r < count($read) && - substr($read[$r], 0, 8) != '* SEARCH'; $r++) {} - if ($response == 'OK') { - $ids = explode(' ', $read[$r]); + for ($r=0; $r < count($readin) && substr($readin[$r], 0, 8) != '* SEARCH'; ++$r) {} + if ($result == 'OK') { + $ids = explode(' ', $readin[$r]); if (sqimap_mailbox_exists($imap, $where_to)) { for ($j=2; $j < count($ids); $j++) { $id = trim($ids[$j]); sqimap_messages_copy ($imap, $id, $id, $where_to); - sqimap_messages_flag ($imap, $id, $id, 'Deleted'); + sqimap_messages_flag ($imap, $id, $id, 'Deleted', true); } } } diff --git a/plugins/listcommands/setup.php b/plugins/listcommands/setup.php index 07e9f704..9fbc1bf4 100644 --- a/plugins/listcommands/setup.php +++ b/plugins/listcommands/setup.php @@ -70,26 +70,23 @@ function plugin_listcommands_menu() { $url .= '&action=reply'; if ($compose_new_win == '1') { $output[] = "" . $fieldsdescr['reply'] . ''; - } - else { + } else { $output[] = '' . $fieldsdescr['reply'] . ''; } } - } elseif ($proto == 'href') { + } else if ($proto == 'href') { $output[] = '' . $fieldsdescr[$cmd] . ''; } } if (count($output) > 0) { - echo ''. "\n"; - echo ''; - echo html_tag( 'td', ''._("Mailing List").':  ', 'right', $color[0], 'valign="top" width="20%"') . "\n"; - echo html_tag( 'td', - '' . implode(' | ', $output) . '', 'left', $color[0], 'valign="top" width="80%"'); - echo "\n"; - echo '
'."\n"; + echo ''; + echo html_tag('TD', '' . _("Mailing List") . ':  ', + 'right', '', 'VALIGN="MIDDLE" WIDTH="20%"') . "\n"; + echo html_tag('TD', '' . implode(' | ', $output) . '', + 'left', $color[0], 'VALIGN="MIDDLE" WIDTH="80%"') . "\n"; + echo ""; } } diff --git a/src/read_body.php b/src/read_body.php index ef50b070..7dcc7ae3 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -364,18 +364,21 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, } } - $s = ''; +/* BOOKMARK */ + $s = '
'; foreach ($env as $key => $val) { if ($val) { - $s .= ''; - $s .= html_tag( 'td', ''.$key.':  ', 'right', $color[0], 'valign="top" width="20%"') . "\n"; - $s .= html_tag( 'td', $val, 'left', $color[0], 'valign="top" width="80%"'); - $s .= "\n"; + $s .= ''; + $s .= html_tag('TD', '' . $key . ':  ', 'RIGHT', '', 'VALIGN="MIDDLE" WIDTH="20%"') . "\n"; + $s .= html_tag('TD', $val, 'left', '', 'VALIGN="MIDDLE" WIDTH="80%"') . "\n"; + $s .= ''; } } - $s .= '
'; echo $s; + do_hook("read_body_header"); + formatToolbar($mailbox,$passed_id,$passed_ent_id,$message, $color); + echo ''; } function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response) { @@ -503,18 +506,21 @@ function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) { global $QUERY_STRING, $base_uri; $urlMailbox = urlencode($mailbox); - $s = ''. "\n". - '\n"; + $s .= '\n"; + $s .= '\n"; + $s .= "\n"; echo $s; do_hook("read_body_header_right"); - echo ''; - echo '
'; $url = $base_uri.'src/view_header.php?'.$QUERY_STRING; + +/* BOOKMARK */ + $s = "
' . _("Other") . ":  '; $s .= ''.("View Full Header").''; - /* Output the printer friendly link if we are in subtle mode. */ - $s .= ' | '. - printer_friendly_link($mailbox, $passed_id, $passed_ent_id, $color); + + /* Output the printer friendly link if we are in subtle mode. */ + $s .= ' | '; + $s .= printer_friendly_link($mailbox, $passed_id, $passed_ent_id, $color); + $s .= "
'."\n"; } @@ -621,8 +627,6 @@ displayPageHeader($color, $mailbox); do_hook('read_body_top'); formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response); formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee); -do_hook("read_body_header"); -formatToolbar($mailbox,$passed_id,$passed_ent_id,$message, $color); echo ''; echo '';
'.$messagebody.'