4 +-----------------------------------------------------------------------+
5 | program/steps/mail/spell.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Submit request to Google's spell checking engine |
15 | Script from GoogieSpell by amix.dk |
17 +-----------------------------------------------------------------------+
18 | Author: Thomas Bruederli <roundcube@gmail.com> |
19 +-----------------------------------------------------------------------+
21 $Id: spell.inc 850 2007-10-03 00:13:32Z ihug $
25 $REMOTE_REQUEST = TRUE;
28 $host = "ssl://www.google.com";
30 $lang = get_input_value('lang', RCUBE_INPUT_GET);
31 $path = "/tbproxy/spell?lang=$lang";
33 // spell check uri is configured
34 if (!empty($CONFIG['spellcheck_uri']))
36 $a_uri = parse_url($CONFIG['spellcheck_uri']);
37 $ssl = ($a_uri['scheme']=='https' || $a_uri['scheme']=='ssl');
38 $port = $a_uri['port'] ? $a_uri['port'] : ($ssl ? 443 : 80);
39 $host = ($ssl ? 'ssl://' : '') . $a_uri['host'];
40 $path = $a_uri['path'] . ($a_uri['query'] ? '?'.$a_uri['query'] : '') . $lang;
43 $data = file_get_contents('php://input');
46 if ($fp = fsockopen($host, $port, $errno, $errstr, 30))
48 $out = "POST $path HTTP/1.0\r\n";
49 $out .= "Host: $host\r\n";
50 $out .= "Content-Length: " . strlen($data) . "\r\n";
51 $out .= "Content-type: application/x-www-form-urlencoded\r\n";
52 $out .= "Connection: Close\r\n\r\n";
57 $store .= fgets($fp, 128);