From b065ddd7ed6a888e3d34f138a766ffdfd55ecb4d Mon Sep 17 00:00:00 2001 From: alec Date: Tue, 18 May 2010 10:25:29 +0000 Subject: - Some files from /bin + spellchecking actions moved to the new 'utils' task git-svn-id: https://svn.roundcube.net/trunk@3627 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/steps/utils/spell_googie.inc | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 roundcubemail/program/steps/utils/spell_googie.inc (limited to 'roundcubemail/program/steps/utils/spell_googie.inc') diff --git a/roundcubemail/program/steps/utils/spell_googie.inc b/roundcubemail/program/steps/utils/spell_googie.inc new file mode 100644 index 000000000..ec60f48f0 --- /dev/null +++ b/roundcubemail/program/steps/utils/spell_googie.inc @@ -0,0 +1,73 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +$REMOTE_REQUEST = TRUE; + +// default settings +$host = "ssl://www.google.com"; +$port = 443; +$lang = get_input_value('lang', RCUBE_INPUT_GET); +$path = "/tbproxy/spell?lang=$lang"; + +// spell check uri is configured +if (!empty($CONFIG['spellcheck_uri'])) + { + $a_uri = parse_url($CONFIG['spellcheck_uri']); + $ssl = ($a_uri['scheme']=='https' || $a_uri['scheme']=='ssl'); + $port = $a_uri['port'] ? $a_uri['port'] : ($ssl ? 443 : 80); + $host = ($ssl ? 'ssl://' : '') . $a_uri['host']; + $path = $a_uri['path'] . ($a_uri['query'] ? '?'.$a_uri['query'] : '') . $lang; + } + +$data = file_get_contents('php://input'); +$store = ""; + +if ($fp = fsockopen($host, $port, $errno, $errstr, 30)) + { + $out = "POST $path HTTP/1.0\r\n"; + $out .= "Host: $host\r\n"; + $out .= "Content-Length: " . strlen($data) . "\r\n"; + $out .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $out .= "Connection: Close\r\n\r\n"; + $out .= $data; + fwrite($fp, $out); + + while (!feof($fp)) + $store .= fgets($fp, 128); + fclose($fp); + } + +// remove headers +$pos = strpos($store, ' -- cgit v1.2.3