[sam] sam module patch (added fields)

Devin Drown drown@banzai.org
Tue Oct 15 16:37:04 2002


This is a patch to add 3 new fields for the SAM module.

Adds the option to skip checking of RBL (By default, SpamAssassin will run 
RBL checks. If your ISP already does this for you, turn this on)

Adds whitelist_to and blacklist_to support (found in both the whitelist 
and blacklist manager sections).  These are helpful if you have multiple 
addresses all coming to a single email address.

-Devin


diff -ur sam.original/blacklist.php sam/blacklist.php
--- sam.original/blacklist.php	Tue Oct 15 10:07:03 2002
+++ sam/blacklist.php	Tue Oct 15 10:43:42 2002
@@ -30,12 +30,19 @@
         $sam->deleteListOption('blacklist_from');
     }
 
+    if (strlen(Horde::getFormData('blacklist_to')) > 0) {
+        $sam->setListOption('blacklist_to', Horde::getFormData('blacklist_to'));
+    } else {
+        $sam->deleteListOption('blacklist_to');
+    }
+
     /* Commit changes to database and notify user. */
     $sam->store(); 
     $notification->push(_("Updated Black List Filter"), 'horde.success');
 }
 
 $blacklist_from = $sam->getListOption('blacklist_from');
+$blacklist_to = $sam->getListOption('blacklist_to');
 
 $help = (boolean)$conf['user']['online_help'] && $browser->hasFeature('javascript');
 require SAM_TEMPLATES . '/common-header.inc';

diff -ur sam.original/spamassassin.php sam/spamassassin.php
--- sam.original/spamassassin.php	Tue Oct 15 10:07:04 2002
+++ sam/spamassassin.php	Tue Oct 15 10:56:05 2002
@@ -40,7 +40,8 @@
                     'spam_level_stars',
                     'report_header',
                     'use_terse_report',
-                    'defang_mime');
+                    'defang_mime',
+		    'skip_rbl_checks');
 
     foreach ($on_off as $option) {
         $sam->setOption($option, Horde::getFormData($option) ?
@@ -59,6 +60,7 @@
 $report_header = $sam->getOption('report_header') ? $sam->getOption('report_header') : 1;
 $use_terse_report = $sam->getOption('use_terse_report') ? $sam->getOption('use_terse_report') : 0;
 $defang_mime = $sam->getOption('defang_mime') ? $sam->getOption('defang_mime') : 1;
+$skip_rbl_checks  = $sam->getOption('skip_rbl_checks') ? $sam->getOption('skip_rbl_checks') : 0;
 
 $help = (boolean)$conf['user']['online_help'] && $browser->hasFeature('javascript');
 require SAM_TEMPLATES . '/common-header.inc';

diff -ur sam.original/templates/blacklist/body.inc sam/templates/blacklist/body.inc
--- sam.original/templates/blacklist/body.inc	Tue Oct 15 10:07:05 2002
+++ sam/templates/blacklist/body.inc	Tue Oct 15 10:44:49 2002
@@ -17,6 +17,19 @@
     </tr>
     <tr>
       <td align="center" valign="top">
+        <table border="0" align="center" cellpadding="1" cellspacing="2">
+         <tr>
+          <th class="light" align="right" valign="top" nowrap><?php echo _("Black List To: ") ?></th>
+          <td class="item" align="left" valign="middle" nowrap>
+            <textarea name="blacklist_to" rows="10" cols="70" wrap="physical"><?php echo $blacklist_to ?></textarea>
+          </td>
+          <?php /* if ($help): ?><td><?php echo Help::link('sam', 'blacklist_to') ?></td><?php endif; */?>
+         </tr>
+        </table>
+      </td>
+    </tr>
+    <tr>
+      <td align="center" valign="top">
         <input type="submit" class="button" value="<?php echo _("Save Changes") ?>" />&nbsp;
         <input type="reset" class="button" value="<?php echo _("Undo Changes") ?>" />
       </td>

diff -ur sam.original/templates/spamassassin/body.inc sam/templates/spamassassin/body.inc
--- sam.original/templates/spamassassin/body.inc	Tue Oct 15 10:07:05 2002
+++ sam/templates/spamassassin/body.inc	Tue Oct 15 10:52:11 2002
@@ -54,6 +54,13 @@
           </td>
           <?php if ($help): ?><td><?php echo Help::link('sam', 'defang_mime') ?></td><?php endif; ?>
          </tr>
+	 <tr>
+          <th class="light" align="right" valign="middle" nowrap><?php echo _("Skip RBL Checks: ") ?></th>
+          <td class="item" align="left" valign="middle">
+            <input type="checkbox" name="skip_rbl_checks" <? if ($skip_rbl_checks == 1) { print "checked"; } ?>>
+          </td>
+          <?php if ($help): ?><td><?php echo Help::link('sam', 'skip_rbl_checks') ?></td><?php endif; ?>
+         </tr>
         </table>
       </td>
     </tr>

diff -ur sam.original/templates/whitelist/body.inc sam/templates/whitelist/body.inc
--- sam.original/templates/whitelist/body.inc	Tue Oct 15 10:07:05 2002
+++ sam/templates/whitelist/body.inc	Tue Oct 15 10:28:46 2002
@@ -17,6 +17,20 @@
     </tr>
     <tr>
       <td align="center" valign="top">
+        <table border="0" align="center" cellpadding="1" cellspacing="2">
+
+         <tr>
+          <th class="light" align="right" valign="top" nowrap><?php echo _("White List To: ") ?></th>
+          <td class="item" align="left" valign="middle" nowrap>
+            <textarea name="whitelist_to" rows="10" cols="70" wrap="physical"><?php echo $whitelist_to ?></textarea>
+          </td>
+          <?php /* if ($help): ?><td><?php echo Help::link('sam', 'whitelist_to') ?></td><?php endif; */?>
+         </tr>
+        </table>
+      </td>
+    </tr>
+    <tr>
+      <td align="center" valign="top">
         <input type="submit" class="button" value="<?php echo _("Save Changes") ?>" />&nbsp;
         <input type="reset" class="button" value="<?php echo _("Undo Changes") ?>" />
       </td>

diff -ur sam.original/whitelist.php sam/whitelist.php
--- sam.original/whitelist.php	Tue Oct 15 10:07:05 2002
+++ sam/whitelist.php	Tue Oct 15 10:42:40 2002
@@ -29,6 +29,11 @@
     } else {
         $sam->deleteListOption('whitelist_from');
     }
+    if (strlen(Horde::getFormData('whitelist_to')) > 0) {
+        $sam->setListOption('whitelist_to', Horde::getFormData('whitelist_to'));
+    } else {
+        $sam->deleteListOption('whitelist_to');
+    }
 
     /* Commit changes to database and notify user. */
     $sam->store(); 
@@ -36,7 +41,7 @@
 }
 
 $whitelist_from = $sam->getListOption('whitelist_from');
-
+$whitelist_to = $sam->getListOption('whitelist_to');
 $help = (boolean)$conf['user']['online_help'] && $browser->hasFeature('javascript');
 require SAM_TEMPLATES . '/common-header.inc';
 require SAM_BASE . '/menu.php';