($Author$) * @version $Date$ */ /** * This function makes a javascript-powered link. Not sure why * Philippe decided to move it outside the main code, but hey. ;) * I bet for the i18n reasons. * * @param $jscode Javascript code to include in the link. * @param $title A little pop-up title to provide for the links. * @param $link The content of the link. * @return void, since this just draws the content. */ function SpellLink($jscode, $title, $link) { echo "$link" . ''; } /** * Declaring globals for users with E_ALL set. */ global $SQSPELL_APP, $attachment_dir, $SQSPELL_EREG, $color; $sqspell_text = $_POST['sqspell_text']; $sqspell_use_app = $_POST['sqspell_use_app']; /** * Now we explode the lines for three reasons: * 1) So we can ignore lines starting with ">" (reply's) * 2) So we can stop processing when we get to "--" on a single line, * which means that the signature is starting * 3) So we can add an extra space at the beginning of each line. This way * ispell/aspell don't treat these as command characters. */ $sqspell_raw_lines = explode("\n", $sqspell_text); for ($i=0; $i= 4.3.0, we can use proc_open and safe mode * and not mess w/ temp files. Otherwise we will do it the old * way, (minus the uneeded call to cat that messes up Wintel * boxen.) * Thanks Ray Ferguson for providing this patch. */ if( check_php_version ( 4, 3 ) ) { $descriptorspec = array( 0 => array('pipe', 'r'), // stdin is a pipe that the child will read from 1 => array('pipe', 'w'), // stdout is a pipe that the child will write to 2 => array('pipe', 'w'), // stderr is a pipe that the child will write to ); $spell_proc=proc_open($sqspell_command, $descriptorspec, $pipes); fwrite($pipes[0], $sqspell_new_text); fclose($pipes[0]); $sqspell_output = array(); for($i=1; $i<=2; $i++){ while(!feof($pipes[$i])) array_push($sqspell_output, rtrim(fgetss($pipes[$i],999),"\n")); fclose($pipes[$i]); } $sqspell_exitcode=proc_close($spell_proc); } else { do { $floc = "$attachment_dir/" . md5($sqspell_new_text . microtime()); } while (file_exists($floc)); $fp=fopen($floc, 'w'); fwrite($fp, $sqspell_new_text); fclose($fp); exec("$sqspell_command < $floc 2>&1", $sqspell_output, $sqspell_exitcode); unlink($floc); } /** * Check if the execution was successful. Bail out if it wasn't. */ if ($sqspell_exitcode){ $msg= "
" . sprintf(_("I tried to execute '%s', but it returned:"), $sqspell_command) . "
"
     . htmlspecialchars(join("\n", $sqspell_output)) . '
' . '
' . '
'; sqspell_makeWindow(null, _("SquirrelSpell is misconfigured."), null, $msg); exit; } /** * Load the user dictionary. */ $words=sqspell_getLang(sqspell_getWords(), $sqspell_use_app); /** * Define some variables to be used during the processing. */ $current_line=0; $missed_words=Array(); $misses = Array(); $locations = Array(); $errors=0; /** * Now we process the output of sqspell_command (ispell or aspell in * ispell compatibility mode, whichever). I'm going to be scarce on * comments here, since you can just look at the ispell/aspell output * and figure out what's going on. ;) The best way to describe this is * "Dark Magic". */ for ($i=0; $i\n" . "\n" . "\n" . "\n"; displayHtmlHeader(_("SquirrelSpell Results"),$extrajs); echo "\n"; ?>

"; echo $sptag . _("Line with an error:") . ''; ?>
'; ?> '; ?>
'; ?> '; ?>


' . ' '; ?>
'. '
'; sqspell_makeWindow(null, _("No errors found"), null, $msg); } /** * For Emacs weenies: * Local variables: * mode: php * End: * vim: syntax=php et ts=4 */ ?>