[imp] Re: IMP ISPELL problem with php4.1.2

Jacob Rush jacobr@mcluckieco.com
Thu, 28 Mar 2002 14:49:41 -0600


---------------------- multipart/mixed attachment
Ok I made this work somewhat.  Attached is a diff for the spelling 
problem.  Its not as elegant as I would like.  I had a problem getting 
strtok to reset where it is in a string and wound up using a bunch of 
explode()s.  Im still running 2.2.4 so this might not patch directly to 
newer versions.  Good luck.

-Jacob

---------------------- multipart/mixed attachment
--- spelling.old	Thu Mar 28 09:13:57 2002
+++ spelling.php3	Thu Mar 28 14:31:20 2002
@@ -44,8 +44,16 @@
 }
 
 function member ($string, $array) {
+  $nopStr = explode(".", $string);
+  $nopStr = explode(",", $nopStr[0]);
+  $nopStr = explode(":", $nopStr[0]);
+  $nopStr = explode(";", $nopStr[0]);
+  $nopStr = explode("'", $nopStr[0]);
+  $nopStr = explode("\"", $nopStr[0]);
+  $nopStr = explode("!", $nopStr[0]);
+  $nopStr = explode("?", $nopStr[0]);
   while (list($key, $val) = each($array)) {
-    if ($val == $string)
+    if ($val == $nopStr[0])
       return true;
   }
   return false;
@@ -102,10 +110,9 @@
 }
 
 $message = htmlspecialchars($message);
-
 if (isset($errors)) {
   $msg = '';
-  while (estrtok($tok, $delim, $message, " ,.:;'\"&%!?()[]{}/|\n\\")) {
+  while (estrtok($tok, $delim, $message, " ")) {
     if (member($tok, $errors))
       $msg .= "<font color=\"ff0000\">$tok</font>$delim";
     else

---------------------- multipart/mixed attachment--