X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fsquirrelspell%2Fmodules%2Fcheck_me.mod;h=bc5aea8852c5026c517dc731ebc43f97ffca5ed4;hb=9eb3fcb302b8e0363760bee586f1c43e7050b365;hp=72fc8d4104382242c810b54cded611f153ed6536;hpb=6ed7bbcbd1ff4f3853925e342e5baec0b90e4a56;p=squirrelmail.git diff --git a/plugins/squirrelspell/modules/check_me.mod b/plugins/squirrelspell/modules/check_me.mod index 72fc8d41..bc5aea88 100644 --- a/plugins/squirrelspell/modules/check_me.mod +++ b/plugins/squirrelspell/modules/check_me.mod @@ -4,17 +4,17 @@ * ------------- * Squirrelspell module. * - * Copyright (c) 1999-2004 The SquirrelMail development team + * Copyright (c) 1999-2005 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This module is the main workhorse of SquirrelSpell. It submits * the message to the spell-checker, parses the output, and loads * the interface window. * - * $Id$ - * - * @author Konstantin Riabitsev ($Author$) - * @version $Date$ + * @author Konstantin Riabitsev + * @version $Id$ + * @package plugins + * @subpackage squirrelspell */ /** @@ -66,7 +66,7 @@ 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 + * way, (minus the uneeded call to cat that messes up Wintel * boxen.) * Thanks Ray Ferguson for providing this patch. */ @@ -92,22 +92,37 @@ if( check_php_version ( 4, 3 ) ) { 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); + $spell_proc = @proc_open($sqspell_command, $descriptorspec, $pipes); + if ( ! is_resource ( $spell_proc ) ) { + error_box ( _("Could not run the spellchecker command (%s).", + htmlspecialchars($sqspell_command) ) , $color ); + } + if ( ! @fwrite($pipes[0], $sqspell_new_text) ) { + error_box ( _("Error while writing to pipe.", + htmlspecialchars($floc) ) , $color ); + } 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]); + 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); + $fp = @fopen($floc, 'w'); + if ( ! is_resource ($fp) ) { + error_box ( _("Could not open temporary file '%s'.", + htmlspecialchars($floc) ) , $color ); + } + if ( ! @fwrite($fp, $sqspell_new_text) ) { + error_box ( _("Error while writing to temporary file '%s'.", + htmlspecialchars($floc) ) , $color ); + } fclose($fp); exec("$sqspell_command < $floc 2>&1", $sqspell_output, $sqspell_exitcode); unlink($floc); @@ -120,7 +135,7 @@ if ($sqspell_exitcode){ $msg= "
" . sprintf(_("I tried to execute '%s', but it returned:"), $sqspell_command) . "
"
-     . join("\n", htmlspecialchars($sqspell_output)) . "
" + . htmlspecialchars(join("\n", $sqspell_output)) . '' . '
' . '
'; @@ -176,7 +191,7 @@ for ($i=0; $i\n" . "\n" . "\n" . "\n"; - + displayHtmlHeader(_("SquirrelSpell Results"),$extrajs); @@ -306,7 +321,7 @@ if ($errors){
- @@ -316,7 +331,7 @@ if ($errors){ echo $sptag . _("Line with an error:") . ''; ?>
- @@ -327,7 +342,7 @@ if ($errors){ ?>
- @@ -336,7 +351,7 @@ if ($errors){ ?> -
- +
@@ -435,4 +450,4 @@ if ($errors){ * End: * vim: syntax=php et ts=4 */ -?> \ No newline at end of file +?>