<?php
- /**
- ** spamcop.php -- SpamCop plugin
- **
- ** Copyright (c) 1999-2003 The SquirrelMail development team
- ** Licensed under the GNU GPL. For full terms see the file COPYING.
- **
- ** $Id$
- * @package plugins
- * @subpackage spamcop
- **/
+/**
+ * spamcop.php -- SpamCop plugin -- main page
+ *
+ * @copyright (c) 1999-2004 The SquirrelMail development team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package plugins
+ * @subpackage spamcop
+ */
/** @ignore */
define('SM_PATH','../../');
require_once(SM_PATH . 'include/validate.php');
require_once(SM_PATH . 'functions/imap.php');
+/**
+ * Stores message in attachment directory, when email based reports are used
+ * @access private
+ */
function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
$passed_ent_id='', $imapConnection) {
- global $attachments, $attachment_dir, $username, $data_dir, $uid_support;
-
+ global $attachments, $attachment_dir, $username, $data_dir;
+
$hashed_attachment_dir = getHashedDir($username, $attachment_dir);
if (!$passed_ent_id) {
$body_a = sqimap_run_command($imapConnection,
'FETCH '.$passed_id.' RFC822',
TRUE, $response, $readmessage,
- $uid_support);
+ TRUE);
} else {
$body_a = sqimap_run_command($imapConnection,
'FETCH '.$passed_id.' BODY['.$passed_ent_id.']',
- TRUE, $response, $readmessage, $uid_support);
+ TRUE, $response, $readmessage,TRUE);
$message = $message->parent;
}
if ($response == 'OK') {
sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
+sqgetGlobalVar('js_web', $js_web, SQ_GET);
if (! sqgetGlobalVar('startMessage', $startMessage, SQ_GET) ) {
$startMessage = 1;
}
if (! sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET) ) {
- $passed_ent_id = '';
+ $passed_ent_id = 0;
+}
+if (! sqgetGlobalVar('js_web', $js_web, SQ_GET) ) {
+ $js_web = 0;
}
sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION);
}
/* END GLOBALS */
-
- displayPageHeader($color, $mailbox);
+// js_web variable is 1 only when link opens web based report page in new window
+// and in new window menu line or extra javascript code is not needed.
+if ($js_web) {
+ displayHTMLHeader(_("SpamCop reporting"));
+ echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\">\n";
+} else {
+ displayPageHeader($color,$mailbox);
+}
$imap_stream = sqimap_login($username, $key, $imapServerAddress,
$imapPort, 0);
$message = sqimap_get_message($imap_stream, $passed_id, $mailbox);
$composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
- $passed_ent_id='', $imap_stream);
+ $passed_ent_id, $imap_stream);
$compose_messages[$session] = $composeMessage;
sqsession_register($compose_messages, 'compose_messages');
<tr>
<td align="left" valign="top">
<?PHP if (isset($js_web) && $js_web) {
- ?><form method="post" action="javascript:return false">
- <input type="button" value="Close Window"
- onClick="window.close(); return true;">
- <?PHP
+ echo '<form method="post" action="javascript:return false">';
+ echo '<input type="button" value="' . _("Close Window") . "\" onClick=\"window.close(); return true;\" />\n";
} else {
?><form method="post" action="../../src/right_main.php">
- <input type="hidden" name="mailbox" value="<?PHP echo htmlspecialchars($mailbox) ?>">
- <input type="hidden" name="startMessage" value="<?PHP echo htmlspecialchars($startMessage) ?>">
- <input type="submit" value="Cancel / Done">
- <?PHP
+ <input type="hidden" name="mailbox" value="<?PHP echo htmlspecialchars($mailbox) ?>" />
+ <input type="hidden" name="startMessage" value="<?PHP echo htmlspecialchars($startMessage) ?>" />
+<?PHP
+ echo '<input type="submit" value="' . _("Cancel / Done") . "\" />";
}
?></form>
</td>
$report_email = 'quick.' . $spamcop_id . '@spam.spamcop.net';
$form_action = SM_PATH . 'src/compose.php';
?> <form method="post" action="<?PHP echo $form_action?>">
- <input type="hidden" name="mailbox" value="<?PHP echo htmlspecialchars($mailbox) ?>">
- <input type="hidden" name="spamcop_is_composing" value="<?PHP echo htmlspecialchars($passed_id) ?>">
- <input type="hidden" name="send_to" value="<?PHP echo $report_email?>">
- <input type="hidden" name="subject" value="reply anyway">
- <input type="hidden" name="identity" value="0">
- <input type="hidden" name="session" value="<?PHP echo $session?>">
- <input type="submit" name="send" value="Send Spam Report">
-<?PHP } else {
- $spam_message = mime_fetch_body ($imap_stream, $passed_id, 0, 50000);
+ <input type="hidden" name="mailbox" value="<?PHP echo htmlspecialchars($mailbox) ?>" />
+ <input type="hidden" name="spamcop_is_composing" value="<?PHP echo htmlspecialchars($passed_id) ?>" />
+ <input type="hidden" name="send_to" value="<?PHP echo htmlspecialchars($report_email)?>" />
+ <input type="hidden" name="subject" value="reply anyway" />
+ <input type="hidden" name="identity" value="0" />
+ <input type="hidden" name="session" value="<?PHP echo $session?>" />
+<?php
+ echo '<input type="submit" name="send" value="' . _("Send Spam Report") . "\" />\n";
+} else {
+ $spam_message = mime_fetch_body ($imap_stream, $passed_id, $passed_ent_id, 50000);
if (strlen($spam_message) == 50000) {
$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";
+ }
if (isset($js_web) && $js_web) {
-?> <form method="post" action="http://www.spamcop.net/sc" name="submitspam"
- enctype="multipart/form-data"><?PHP
+ echo "<form method=\"post\" action=\"$action_url\" name=\"submitspam\"".
+ " enctype=\"multipart/form-data\">\n";
} else {
-?> <form method="post" action="http://www.spamcop.net/sc" name="submitspam"
- enctype="multipart/form-data" target="_blank"><?PHP
+ echo "<form method=\"post\" action=\"$action_url\" name=\"submitspam\"".
+ " enctype=\"multipart/form-data\" target=\"_blank\">\n";
} ?>
- <input type="hidden" name="action" value="submit">
- <input type="hidden" name="oldverbose" value="1">
- <input type="hidden" name="code" value="<?PHP echo $spamcop_id ?>">
- <input type="hidden" name="spam" value="<?PHP echo htmlspecialchars($spam_message); ?>">
- <input type="submit" name="x1" value="Send Spam Report">
-<?PHP }
+ <input type="hidden" name="action" value="submit" />
+ <input type="hidden" name="oldverbose" value="1" />
+ <input type="hidden" name="code" value="<?PHP echo htmlspecialchars($spamcop_id) ?>" />
+ <input type="hidden" name="spam" value="<?PHP echo htmlspecialchars($spam_message); ?>" />
+ <?php
+ echo '<input type="submit" name="x1" value="' . _("Send Spam Report") . "\" />\n";
+ }
?> </form>
</td>
</tr>
</table>
-<?php noframes_bottom(); ?>
+</body>
+</html>