4 +-----------------------------------------------------------------------+
5 | program/steps/utils/spell.inc |
7 | This file is part of the Roundcube Webmail client |
8 | Copyright (C) 2005-2011, The Roundcube Dev Team |
9 | Licensed under the GNU GPL |
12 | Invoke the configured or default spell checking engine. |
14 +-----------------------------------------------------------------------+
15 | Author: Kris Steinhoff <steinhof@umich.edu> |
16 +-----------------------------------------------------------------------+
18 $Id: spell.inc 5181 2011-09-06 13:39:45Z alec $
23 $lang = get_input_value('lang', RCUBE_INPUT_GET);
24 $data = file_get_contents('php://input');
26 $learn_word = strpos($data, '<learnword>');
29 $left = strpos($data, '<text>');
30 $right = strrpos($data, '</text>');
31 $data = substr($data, $left+6, $right-($left+6));
32 $data = html_entity_decode($data, ENT_QUOTES, RCMAIL_CHARSET);
34 $spellchecker = new rcube_spellchecker($lang);
37 $spellchecker->add_word($data);
38 $result = '<?xml version="1.0" encoding="'.RCMAIL_CHARSET.'"?><learnwordresult></learnwordresult>';
41 $spellchecker->check($data);
42 $result = $spellchecker->get_xml();
45 // set response length
46 header("Content-Length: " . strlen($result));
48 // Don't use server's default Content-Type charset (#1486406)
49 header("Content-Type: text/xml; charset=" . RCMAIL_CHARSET);