", " ", $THEARTICLE); // 2. strip duplicated spaces $THEARTICLE = ereg_replace("[ \,\.\n\t\r]+", " ", $THEARTICLE); // 3. strip whitespace from the start and the end of a string $THEARTICLE = trim($THEARTICLE); // 4. count words $SpaceCount = explode(" ",$THEARTICLE); return sizeof($SpaceCount);; } function CheckForLinks($THETEXT){ return ""; } /* ** check string for vulgar words ** vulgar words and patterns stored in AIV_VULGAR table. */ function IsArticleVulgar($THEARTICLE) { global $DB, $DBID; $SQL = "select * from AIV_VULGAR where VW_STATUS='E'"; $result = mysql_query($SQL, $DBID); $BadWordList = ""; if ($result) { for ($i=0;$i", " ", $THEARTICLE); $THEARTICLE = ereg_replace(""", " ", $THEARTICLE); $THEARTICLE = ereg_replace("&", " ", $THEARTICLE); $THEARTICLE = ereg_replace("<", " ", $THEARTICLE); $THEARTICLE = ereg_replace(">", " ", $THEARTICLE); // 2. strip duplicated spaces $THEARTICLE = ereg_replace(" +", " ", $THEARTICLE); $tf = tempnam("/tmp", "AIVSPL"); $currerrlvl = error_reporting( 0 ); $tmpfile = fopen($tf, "a+"); if( $tmpfile ){ fwrite($tmpfile, $THEARTICLE); fclose($tmpfile); } error_reporting( $currerrlvl ); $resString = ""; // // now time we don't spell check!!!! // // // // unlink($tf); return $resString; // // // // // // $cmd = "/usr/bin/spell < $tf | /bin/sort -f | /usr/bin/uniq"; $datastrim = popen($cmd, "r"); // if the string correct $datastrin shud be empty while( !feof($datastrim) ){ // collect all misspelled words $badspell = trim(fgets($datastrim, 1024)); if( $badspell != "" ){ if( $resString != "" ){ $resString .= ", "; } $resString .= """ . _hs($badspell) . """; } } pclose($datastrim); unlink($tf); return $resString; } ?>