Fix two typos "squirrelmai" -> "squirrelmail". Sheesh.
[squirrelmail.git] / plugins / spamcop / setup.php
index b8e7058deadf4d8762214a8147424a8dd384b360..6c026dd303bd536bc76e232372ef4afe15e0d40a 100755 (executable)
@@ -1,17 +1,32 @@
 <?php
-
-
-/* Initialize the plugin */
+   /** 
+    **  setup.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
+    **/
+
+/** @ignore */
+require_once(SM_PATH . 'functions/global.php');
+
+
+/** Initialize the plugin */
 function squirrelmail_plugin_init_spamcop() {
    global $squirrelmail_plugin_hooks, $data_dir, $username,
       $spamcop_is_composing;
 
-   $squirrelmail_plugin_hooks['options_register']['spamcop'] =
+   $squirrelmail_plugin_hooks['optpage_register_block']['spamcop'] =
       'spamcop_options';
    $squirrelmail_plugin_hooks['loading_prefs']['spamcop'] =
       'spamcop_load';
    $squirrelmail_plugin_hooks['read_body_header_right']['spamcop'] =
       'spamcop_show_link';
+
+    sqgetGlobalVar('spamcop_is_composing' , $spamcop_is_composing);
       
    if (isset($spamcop_is_composing)) {
       $squirrelmail_plugin_hooks['compose_send']['spamcop'] =
@@ -44,39 +59,32 @@ function spamcop_load() {
 
 // Show the link on the read-a-message screen
 function spamcop_show_link() {
-   global $passed_id, $mailbox, $ent_num, $spamcop_enabled, $startMessage,
-      $spamcop_method;
-
-   // This was stolen from printer_friendly
-   // Do I really need/want it?
-   if (!trim($mailbox))
-      $mailbox = 'INBOX';
+   global $spamcop_enabled, $spamcop_method;
 
    if (! $spamcop_enabled)
       return;
 
+   /* GLOBALS */
+   sqgetGlobalVar('passed_id',    $passed_id,    SQ_GET);
+   sqgetGlobalVar('mailbox',      $mailbox,      SQ_GET);
+   sqgetGlobalVar('startMessage', $startMessage, SQ_GET);
+   /* END GLOBALS */
+
    echo "<br>\n";
    
    if ($spamcop_method == 'web_form') {
-?><script language=javascript>
-document.write('<a href="../plugins/spamcop/spamcop.php?passed_id=<?PHP
-echo urlencode($passed_id); ?>&js_web=1&mailbox=<?PHP
-echo urlencode($mailbox); ?>" target="_blank">');
+?><script language="javascript" type="text/javascript">
+document.write('<a href="../plugins/spamcop/spamcop.php?passed_id=<?PHP echo urlencode($passed_id); ?>&amp;js_web=1&amp;mailbox=<?PHP echo urlencode($mailbox); ?>" target="_blank">');
 document.write("<?PHP echo _("Report as Spam"); ?>");
 document.write("</a>");
 </script><noscript>
-<a href="../plugins/spamcop/spamcop_web.php?passed_id=<?PHP
-echo urlencode($passed_id); ?>&mailbox=<?PHP
-echo urlencode($mailbox); ?>&startMessage=<?PHP
-echo urlencode($startMessage); ?>"><?PHP
-echo _("Report as Spam"); ?></a>
+<a href="../plugins/spamcop/spamcop.php?passed_id=<?PHP echo urlencode($passed_id); ?>&amp;mailbox=<?PHP echo urlencode($mailbox); ?>&amp;startMessage=<?PHP echo urlencode($startMessage); ?>">
+<?PHP echo _("Report as Spam"); ?></a>
 </noscript><?PHP
    } else {
-?><a href="../plugins/spamcop/spamcop_web.php?passed_id=<?PHP
-echo urlencode($passed_id); ?>&mailbox=<?PHP
-echo urlencode($mailbox); ?>&startMessage=<?PHP
-echo urlencode($startMessage); ?>"><?PHP
-echo _("Report as Spam"); ?></a><?PHP
+?><a href="../plugins/spamcop/spamcop.php?passed_id=<?PHP echo urlencode($passed_id); ?>&amp;mailbox=<?PHP echo urlencode($mailbox); ?>&amp;startMessage=<?PHP echo urlencode($startMessage); ?>">
+<?PHP echo _("Report as Spam"); ?></a>
+<?PHP
    }
 }
 
@@ -84,9 +92,9 @@ echo _("Report as Spam"); ?></a><?PHP
 // Show the link to our own custom options page
 function spamcop_options()
 {
-   global $optionpages;
+   global $optpage_blocks;
    
-   $optionpages[] = array(
+   $optpage_blocks[] = array(
       'name' => _("SpamCop - Spam Reporting"),
       'url' => '../plugins/spamcop/options.php',
       'desc' => _("Help fight the battle against unsolicited email.  SpamCop reads the spam email and determines the correct addresses to send complaints to.  Quite fast, really smart, and easy to use."),