[geeklog-cvs] geeklog-1.3/plugins/spamx Import.Admin.class.php,1.4,1.5

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Fri Sep 24 06:21:18 EDT 2004


Update of /var/cvs/geeklog-1.3/plugins/spamx
In directory www:/tmp/cvs-serv11888/spamx

Modified Files:
	Import.Admin.class.php 
Log Message:
Added code to import a user's personal blacklist (from the SpamX plugin 1.0), provided by Tom Willet.


Index: Import.Admin.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/Import.Admin.class.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Import.Admin.class.php	22 Sep 2004 08:19:19 -0000	1.4
--- Import.Admin.class.php	24 Sep 2004 10:21:15 -0000	1.5
***************
*** 137,141 ****
              if (file_exists ($fromfile)) {
                  $blacklist = file ($fromfile);
!                 $count = _do_import ($blacklist);
  
                  if ($count > 0) {
--- 137,141 ----
              if (file_exists ($fromfile)) {
                  $blacklist = file ($fromfile);
!                 $count = $this->_do_import ($blacklist);
  
                  if ($count > 0) {
***************
*** 155,158 ****
--- 155,174 ----
          }
  
+         // Import Personal Blacklist for existing users.
+         $fromfile = $_CONF['path_html'] . 'spamx/blacklist.php';
+         if (file_exists ($fromfile)) {
+             require_once ($fromfile);
+             $count = $this->_do_importp ($SPAMX_BLACKLIST);
+              $display .= $LANG_SX00['initial_Pimport'];
+             if ($count > 0) {
+                 $display .= sprintf ($LANG_SX00['import_success'], $count);
+                 SPAMX_log ($LANG_SX00['uPlist'] . $LANG_SX00['uMTlist2']
+                            . $count . $LANG_SX00['uMTlist3'] . '0'
+                            . $LANG_SX00['entries']);
+             } else {
+                 $display .= $LANG_SX00['import_failure'];
+             }
+         }
+ 
          return $display;
      }
***************
*** 183,186 ****
--- 199,226 ----
          return $count;
      }
+ 
+     /**
+     * Import personal blacklist
+     *
+     * @param    array   $lines  The blacklist
+     * @return   int             number of lines imported
+     *
+     */
+     function _do_importp ($lines)
+     {
+         global $_TABLES;
+ 
+         $count = 0;
+         foreach ($lines as $entry) {
+             if (!empty ($entry)) {
+                 DB_query ('INSERT INTO ' . $_TABLES['spamx']
+                           . ' VALUES ("Personal","' . $entry . '")');
+                $count++;
+             }
+         }
+ 
+         return $count;
+     }
+ 
  }
  




More information about the geeklog-cvs mailing list