[geeklog-cvs] geeklog-1.3/plugins/spamx BlackList.Examine.class.php,1.8,1.9 MTBlackList.Examine.class.php,1.8,1.9

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Mon Apr 4 11:09:07 EDT 2005


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

Modified Files:
	BlackList.Examine.class.php MTBlackList.Examine.class.php 
Log Message:
html_entity_decode does not translate numeric entities (decimal and hex), so we have to handle them ourselves


Index: BlackList.Examine.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/BlackList.Examine.class.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** BlackList.Examine.class.php	29 Mar 2005 16:48:50 -0000	1.8
--- BlackList.Examine.class.php	4 Apr 2005 15:09:05 -0000	1.9
***************
*** 53,60 ****
          $nrows = DB_numRows ($result);
  
          $ans = 0;
          for ($i = 1; $i <= $nrows; $i++) {
              list ($val) = DB_fetchArray ($result);
!             if (preg_match ("#$val#i", html_entity_decode ($comment))) {
                  $ans = 1; // quit on first positive match
                  SPAMX_log ($LANG_SX00['foundspam'] . $val .
--- 53,66 ----
          $nrows = DB_numRows ($result);
  
+         // named entities
+         $comment = html_entity_decode ($comment);
+         // decimal notation
+         $comment = preg_replace ('/&#(\d+);/me', "chr(\\1)", $comment);
+         // hex notation
+         $comment = preg_replace ('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $comment);
          $ans = 0;
          for ($i = 1; $i <= $nrows; $i++) {
              list ($val) = DB_fetchArray ($result);
!             if (preg_match ("#$val#i", $comment)) {
                  $ans = 1; // quit on first positive match
                  SPAMX_log ($LANG_SX00['foundspam'] . $val .

Index: MTBlackList.Examine.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/MTBlackList.Examine.class.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MTBlackList.Examine.class.php	29 Mar 2005 16:48:51 -0000	1.8
--- MTBlackList.Examine.class.php	4 Apr 2005 15:09:05 -0000	1.9
***************
*** 56,63 ****
          $nrows = DB_numRows ($result);
  
          $ans = 0; // Found Flag
          for ($i = 1; $i <= $nrows; $i++) {
              list ($val) = DB_fetchArray ($result);
!             if (@preg_match ("#$val#i", html_entity_decode ($comment))) {
                  $ans = 1; // quit on first positive match
                  SPAMX_log ($LANG_SX00['fsc'] . $val . $LANG_SX00['fsc1'] .
--- 56,69 ----
          $nrows = DB_numRows ($result);
  
+         // named entities
+         $comment = html_entity_decode ($comment);
+         // decimal notation
+         $comment = preg_replace ('/&#(\d+);/me', "chr(\\1)", $comment);
+         // hex notation
+         $comment = preg_replace ('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $comment);
          $ans = 0; // Found Flag
          for ($i = 1; $i <= $nrows; $i++) {
              list ($val) = DB_fetchArray ($result);
!             if (@preg_match ("#$val#i", $comment)) {
                  $ans = 1; // quit on first positive match
                  SPAMX_log ($LANG_SX00['fsc'] . $val . $LANG_SX00['fsc1'] .




More information about the geeklog-cvs mailing list