* -------------
* 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
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]))
+ 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);
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);
* End:
* vim: syntax=php et ts=4
*/
-?>
\ No newline at end of file
+?>