X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fspamcop%2Ffunctions.php;h=590785c247e1cf4a14f5e0d55798aba0f94e2aff;hp=2e10efc3c59b03f8b63a00b71259d7ff3ad22ce0;hb=24024eb7a3db834ca68720cd30fec275af758237;hpb=4b4abf93a9624311afef0c385023724ee46a2b60
diff --git a/plugins/spamcop/functions.php b/plugins/spamcop/functions.php
index 2e10efc..590785c 100644
--- a/plugins/spamcop/functions.php
+++ b/plugins/spamcop/functions.php
@@ -3,7 +3,7 @@
/**
* SpamCop plugin - functions
*
- * @copyright © 1999-2005 The SquirrelMail Project Team
+ * @copyright © 1999-2007 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package plugins
@@ -59,8 +59,8 @@ function spamcop_load_function() {
* @since 1.5.1
* @access private
*/
-function spamcop_show_link_function() {
- global $spamcop_enabled, $spamcop_method, $spamcop_quick_report,$javascript_on;
+function spamcop_show_link_function(&$links) {
+ global $spamcop_enabled, $spamcop_method, $spamcop_quick_report;
if (! $spamcop_enabled)
return;
@@ -79,8 +79,6 @@ function spamcop_show_link_function() {
$passed_ent_id = 0;
}
- echo "
\n";
-
/*
Catch situation when user uses quick_email and does not update
preferences. User gets web_form link. If prefs are set to
@@ -90,19 +88,24 @@ function spamcop_show_link_function() {
$spamcop_method = 'web_form';
}
- // Javascript is used only in web based reporting
- // don't insert javascript if javascript is disabled
- if ($spamcop_method == 'web_form' && $javascript_on) {
-?>
-
-
+// document.write('');
+//document.write("");
+//document.write("");
+//
+
+
+ $url = '../plugins/spamcop/spamcop.php?passed_id=' . urlencode($passed_id) .
+ '&mailbox=' . urlencode($mailbox) . '&startMessage=' . urlencode($startMessage) .
+ '&passed_ent_id=' . urlencode($passed_ent_id);
+ if ( $spamcop_method == 'web_form' && checkForJavascript() ) {
+ $url .= '&js_web=1';
}
+
+ $links[] = array ( 'URL' => $url,
+ 'Text' => _("Report as Spam")
+ );
}
/**
@@ -131,13 +134,12 @@ function spamcop_options_function() {
*/
function spamcop_while_sending_function() {
global $mailbox, $spamcop_delete, $spamcop_save, $spamcop_is_composing, $auto_expunge,
- $username, $key, $imapServerAddress, $imapPort;
+ $username, $imapServerAddress, $imapPort;
if (sqgetGlobalVar('spamcop_is_composing' , $spamcop_is_composing)) {
// delete spam message
if ($spamcop_delete) {
- $imapConnection = sqimap_login($username, $key, $imapServerAddress,
- $imapPort, 0);
+ $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
sqimap_mailbox_select($imapConnection, $mailbox);
sqimap_msgs_list_delete($imapConnection, $mailbox, array($spamcop_is_composing));
if ($auto_expunge)
@@ -178,9 +180,7 @@ function spamcop_enable_disable($option,$disable_action,$enable_action) {
*/
function spamcop_getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
$passed_ent_id='', $imapConnection) {
- global $attachment_dir, $username;
- $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
if (!$passed_ent_id) {
$body_a = sqimap_run_command($imapConnection,
'FETCH '.$passed_id.' RFC822',
@@ -196,22 +196,12 @@ function spamcop_getMessage_RFC822_Attachment($message, $composeMessage, $passed
array_shift($body_a);
$body = implode('', $body_a) . "\r\n";
- $localfilename = GenerateRandomString(32, 'FILE', 7);
- $full_localfilename = "$hashed_attachment_dir/$localfilename";
- $fp = fopen( $full_localfilename, 'w');
+ $filename = sq_get_attach_tempfile();
+ $fp = fopen($filename, 'wb');
fwrite ($fp, $body);
fclose($fp);
-
- /* dirty relative dir fix */
- if (substr($attachment_dir,0,3) == '../') {
- $attachment_dir = substr($attachment_dir,3);
- $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
- }
- $full_localfilename = "$hashed_attachment_dir/$localfilename";
-
$composeMessage->initAttachment('message/rfc822','email.txt',
- $full_localfilename);
+ $filename);
}
return $composeMessage;
}
-?>
\ No newline at end of file