]> git.donarmstrong.com Git - roundcube.git/blob - program/steps/utils/spell.inc
b45ff39d051768b23c35d41ac18973be4ab666cd
[roundcube.git] / program / steps / utils / spell.inc
1 <?php
2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/utils/spell.inc                                         |
6  |                                                                       |
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                                            |
10  |                                                                       |
11  | PURPOSE:                                                              |
12  |   Invoke the configured or default spell checking engine.             |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Kris Steinhoff <steinhof@umich.edu>                           |
16  +-----------------------------------------------------------------------+
17
18  $Id: spell.inc 4815 2011-05-30 15:08:26Z alec $
19
20 */
21
22 // read input
23 $lang = get_input_value('lang', RCUBE_INPUT_GET);
24 $data = file_get_contents('php://input');
25
26 // Get data string
27 $left = strpos($data, '<text>');
28 $right = strrpos($data, '</text>');
29 $data = substr($data, $left+6, $right-($left+6));
30 $data = html_entity_decode($data, ENT_QUOTES, RCMAIL_CHARSET);
31
32 $spellchecker = new rcube_spellchecker($lang);
33 $spellchecker->check($data);
34 $result = $spellchecker->get_xml();
35
36 // set response length
37 header("Content-Length: " . strlen($result));
38
39 // Don't use server's default Content-Type charset (#1486406)
40 header("Content-Type: text/xml; charset=" . RCMAIL_CHARSET);
41 print $result;
42 exit;