4 * spamcop.php -- SpamCop plugin -- main page
6 * @copyright © 1999-2006 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 * Include the SquirrelMail initialization file.
16 require('../../include/init.php');
18 include_once(SM_PATH
. 'functions/imap_general.php');
19 include_once(SM_PATH
. 'functions/imap_messages.php');
20 /* plugin functions */
21 include_once(SM_PATH
. 'plugins/spamcop/functions.php');
25 sqgetGlobalVar('username', $username, SQ_SESSION
);
27 sqgetGlobalVar('mailbox', $mailbox, SQ_GET
);
28 sqgetGlobalVar('passed_id', $passed_id, SQ_GET
);
29 sqgetGlobalVar('js_web', $js_web, SQ_GET
);
31 if (! sqgetGlobalVar('startMessage', $startMessage, SQ_GET
) ) {
34 if (! sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET
) ) {
37 if (! sqgetGlobalVar('js_web', $js_web, SQ_GET
) ) {
41 sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION
);
43 if(! sqgetGlobalVar('composesession', $composesession, SQ_SESSION
) ) {
45 sqsession_register($composesession, 'composesession');
49 // js_web variable is 1 only when link opens web based report page in new window
50 // and in new window menu line or extra javascript code is not needed.
52 displayHTMLHeader(_("SpamCop reporting"));
53 echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\">\n";
55 displayPageHeader($color,$mailbox);
58 /** is spamcop plugin disabled */
59 if (! is_plugin_enabled('spamcop')) {
60 error_box(_("Plugin is disabled."),$color);
61 echo "\n</body></html>\n";
65 $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
66 sqimap_mailbox_select($imap_stream, $mailbox);
68 if ($spamcop_method == 'quick_email' ||
69 $spamcop_method == 'thorough_email') {
70 // Use email-based reporting -- save as an attachment
71 $session = "$composesession"+
1;
72 $composesession = $session;
73 sqsession_register($composesession,'composesession');
74 if (!isset($compose_messages)) {
75 $compose_messages = array();
77 if (!isset($compose_messages[$session]) ||
($compose_messages[$session] == NULL)) {
78 $composeMessage = new Message();
79 $rfc822_header = new Rfc822Header();
80 $composeMessage->rfc822_header
= $rfc822_header;
81 $composeMessage->reply_rfc822_header
= '';
82 $compose_messages[$session] = $composeMessage;
83 sqsession_register($compose_messages,'compose_messages');
85 $composeMessage=$compose_messages[$session];
89 $message = sqimap_get_message($imap_stream, $passed_id, $mailbox);
90 $composeMessage = spamcop_getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
91 $passed_ent_id, $imap_stream);
93 $compose_messages[$session] = $composeMessage;
94 sqsession_register($compose_messages, 'compose_messages');
96 $fn = getPref($data_dir, $username, 'full_name');
97 $em = getPref($data_dir, $username, 'email_address');
99 $HowItLooks = $fn . ' ';
101 $HowItLooks .= '<' . $em . '>';
106 echo _("Sending this spam report will give you back a reply with URLs that you can click on to properly report this spam message to the proper authorities. This is a free service. By pressing the \"Send Spam Report\" button, you agree to follow SpamCop's rules/terms of service/etc.");
111 <table align
="center" width
="75%" border
="0" cellpadding
="0" cellspacing
="0">
113 <td align
="left" valign
="top">
114 <?php
if (isset($js_web) && $js_web) {
115 echo '<form method="post" action="javascript:return false">';
116 echo '<input type="button" value="' . _("Close Window") . "\" onclick=\"window.close(); return true;\" />\n";
118 ?
><form method
="post" action
="../../src/right_main.php">
119 <input type
="hidden" name
="mailbox" value
="<?php echo htmlspecialchars($mailbox) ?>" />
120 <input type
="hidden" name
="startMessage" value
="<?php echo htmlspecialchars($startMessage) ?>" />
122 echo '<input type="submit" value="' . _("Cancel / Done") . "\" />";
126 <td align
="right" valign
="top">
127 <?php
if ($spamcop_method == 'thorough_email' ||
128 $spamcop_method == 'quick_email') {
129 if ($spamcop_method == 'thorough_email')
130 $report_email = 'submit.' . $spamcop_id . '@spam.spamcop.net';
132 $report_email = 'quick.' . $spamcop_id . '@spam.spamcop.net';
133 $form_action = SM_PATH
. 'src/compose.php';
134 ?
> <form method
="post" action
="<?php echo $form_action?>">
135 <input type
="hidden" name
="mailbox" value
="<?php echo htmlspecialchars($mailbox) ?>" />
136 <input type
="hidden" name
="spamcop_is_composing" value
="<?php echo htmlspecialchars($passed_id) ?>" />
137 <input type
="hidden" name
="send_to" value
="<?php echo htmlspecialchars($report_email)?>" />
138 <input type
="hidden" name
="subject" value
="reply anyway" />
139 <input type
="hidden" name
="identity" value
="0" />
140 <input type
="hidden" name
="session" value
="<?php echo $session?>" />
142 echo '<input type="submit" name="send" value="' . _("Send Spam Report") . "\" />\n";
144 $spam_message = mime_fetch_body ($imap_stream, $passed_id, $passed_ent_id, 50000);
146 if (strlen($spam_message) == 50000) {
147 $Warning = "\n[truncated by SpamCop]\n";
148 $spam_message = substr($spam_message, 0, 50000 - strlen($Warning)) . $Warning;
150 if ($spamcop_type=='member') {
151 $action_url="http://members.spamcop.net/sc";
153 $action_url="http://www.spamcop.net/sc";
155 if (isset($js_web) && $js_web) {
156 echo "<form method=\"post\" action=\"$action_url\" name=\"submitspam\"".
157 " enctype=\"multipart/form-data\">\n";
159 echo "<form method=\"post\" action=\"$action_url\" name=\"submitspam\"".
160 " enctype=\"multipart/form-data\" target=\"_blank\">\n";
162 <input type
="hidden" name
="action" value
="submit" />
163 <input type
="hidden" name
="oldverbose" value
="1" />
164 <input type
="hidden" name
="code" value
="<?php echo htmlspecialchars($spamcop_id) ?>" />
165 <input type
="hidden" name
="spam" value
="<?php echo htmlspecialchars($spam_message); ?>" />
167 echo '<input type="submit" name="x1" value="' . _("Send Spam Report") . "\" />\n";