diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-07-31 08:18:54 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-07-31 08:36:23 +0200 |
commit | e22d13bee1d88432ef8cdefd8d4916af10f67b49 (patch) | |
tree | 548f9c04a821adb67194d2088544f9ebeb42215b /program/include | |
parent | 3185f3a52404baacaef29e4ace534c97e5ddc931 (diff) |
Don't send complete error page to the spellchecker on error (when pspell extension isn't found)
Conflicts:
program/include/rcube_spellchecker.php
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcube_spellchecker.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/program/include/rcube_spellchecker.php b/program/include/rcube_spellchecker.php index a6f391346..7b3a04ebd 100644 --- a/program/include/rcube_spellchecker.php +++ b/program/include/rcube_spellchecker.php @@ -60,13 +60,6 @@ class rcube_spellchecker $this->engine = $this->rc->config->get('spellcheck_engine', 'googie'); $this->lang = $lang ? $lang : 'en'; - if ($this->engine == 'pspell' && !extension_loaded('pspell')) { - raise_error(array( - 'code' => 500, 'type' => 'php', - 'file' => __FILE__, 'line' => __LINE__, - 'message' => "Pspell extension not available"), true, true); - } - $this->options = array( 'ignore_syms' => $this->rc->config->get('spellcheck_ignore_syms'), 'ignore_nums' => $this->rc->config->get('spellcheck_ignore_nums'), @@ -238,8 +231,8 @@ class rcube_spellchecker else if (!pspell_check($this->plink, $word)) { $suggestions = pspell_suggest($this->plink, $word); - if (sizeof($suggestions) > self::MAX_SUGGESTIONS) - $suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS); + if (sizeof($suggestions) > self::MAX_SUGGESTIONS) + $suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS); $matches[] = array($word, $pos, $len, null, $suggestions); } @@ -324,6 +317,16 @@ class rcube_spellchecker private function _pspell_init() { if (!$this->plink) { + if (!extension_loaded('pspell')) { + $this->error = "Pspell extension not available"; + raise_error(array( + 'code' => 500, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => $this->error), true, false); + + return; + } + $this->plink = pspell_new($this->lang, null, null, RCMAIL_CHARSET, PSPELL_FAST); } |