Adding error reporting routines, by popular demand. :)
[squirrelmail.git] / plugins / squirrelspell / modules / check_me.mod
index 65428a509dd9249e31a181e40d2dc47a4eb52c6b..370241f1621628dd66fc9c772496bae6dfb1415e 100644 (file)
@@ -101,12 +101,27 @@ fclose($fp);
 /**
  * Execute ispell/aspell and catch the output.
  */
-exec("cat $floc | $sqspell_command", $sqspell_output);
+exec("cat $floc | $sqspell_command 2>&1", $sqspell_output, $sqspell_exitcode);
 /**
  * Remove the temp file.
  */
 unlink($floc);
 
+/**
+ * Check if the execution was successful. Bail out if it wasn't.
+ */
+if ($sqspell_exitcode){
+  $msg= "<div align='center'>"
+     . sprintf(_("I tried to execute '%s', but it returned:"),
+               $sqspell_command) . "<pre>"
+     . nl2br(join("\n", $sqspell_output)) . "</pre>"
+     . "<form onsubmit=\"return false\">"
+     . "<input type=\"submit\" value=\"  " . _("Close")
+     . "  \" onclick=\"self.close()\"></form></div>";
+  sqspell_makeWindow(null, _("SquirrelSpell is misconfigured."), null, $msg);
+  exit;
+}
+
 /**
  * Load the user dictionary.
  */