X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fspamcop%2Fspamcop.php;h=be7bbcf9df89dc019d2f5dac76a01863b7966c3e;hp=27ac08068c7144c1481f2ab6ff221716ba3ee803;hb=c4faef335b2362c81b8ebf026d4066c12d70536c;hpb=91e0dccca7b2452d8b450791cae3aa4125e8889e diff --git a/plugins/spamcop/spamcop.php b/plugins/spamcop/spamcop.php index 27ac0806..be7bbcf9 100644 --- a/plugins/spamcop/spamcop.php +++ b/plugins/spamcop/spamcop.php @@ -1,73 +1,34 @@ parent; - } - if ($response == 'OK') { - 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'); - 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); - } - return $composeMessage; -} - +require('../../include/init.php'); +/* IMAP functions depend on date and mime */ +include_once(SM_PATH . 'functions/date.php'); +include_once(SM_PATH . 'functions/mime.php'); +/* IMAP functions */ +include_once(SM_PATH . 'functions/imap_general.php'); +include_once(SM_PATH . 'functions/imap_messages.php'); +/* plugin functions */ +include_once(SM_PATH . 'plugins/spamcop/functions.php'); + +include_once(SM_PATH . 'functions/compose.php'); /* GLOBALS */ -sqgetGlobalVar('username', $username, SQ_SESSION); -sqgetGlobalVar('key', $key, SQ_COOKIE); -sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); - sqgetGlobalVar('mailbox', $mailbox, SQ_GET); -sqgetGlobalVar('passed_id', $passed_id, SQ_GET); +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); sqgetGlobalVar('js_web', $js_web, SQ_GET); if (! sqgetGlobalVar('startMessage', $startMessage, SQ_GET) ) { @@ -97,8 +58,16 @@ if ($js_web) { displayPageHeader($color,$mailbox); } - $imap_stream = sqimap_login($username, $key, $imapServerAddress, - $imapPort, 0); +/** is spamcop plugin disabled */ +if (! is_plugin_enabled('spamcop')) { + error_box(_("Plugin is disabled.")); + // display footer (closes html tags) and stop script execution + $oTemplate->display('footer.tpl'); + exit(); +} + + global $imap_stream_options; // in case not defined in config + $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options); sqimap_mailbox_select($imap_stream, $mailbox); if ($spamcop_method == 'quick_email' || @@ -123,7 +92,7 @@ if ($js_web) { $message = sqimap_get_message($imap_stream, $passed_id, $mailbox); - $composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, + $composeMessage = spamcop_getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id, $imap_stream); $compose_messages[$session] = $composeMessage; @@ -149,11 +118,11 @@ echo "

"; '; - echo '\n"; + echo '\n"; } else { - ?>
- - + ?> + + "; } @@ -166,16 +135,17 @@ echo "

"; $report_email = 'submit.' . $spamcop_id . '@spam.spamcop.net'; else $report_email = 'quick.' . $spamcop_id . '@spam.spamcop.net'; - $form_action = SM_PATH . 'src/compose.php'; + $form_action = sqm_baseuri() . 'src/compose.php'; ?> - - - + + + + \n"; + echo '\n"; } else { $spam_message = mime_fetch_body ($imap_stream, $passed_id, $passed_ent_id, 50000); @@ -183,11 +153,8 @@ echo "

"; $Warning = "\n[truncated by SpamCop]\n"; $spam_message = substr($spam_message, 0, 50000 - strlen($Warning)) . $Warning; } - if ($spamcop_type=='member') { - $action_url="http://members.spamcop.net/sc"; - } else { - $action_url="http://www.spamcop.net/sc"; - } + $action_url="http://members.spamcop.net/sc"; + if (isset($js_web) && $js_web) { echo "\n"; @@ -197,8 +164,7 @@ echo "

"; } ?> - - + \n"; } @@ -207,4 +173,4 @@ echo "

"; - \ No newline at end of file +