]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/steps/mail/spell.inc
Imported Upstream version 0.1~rc2
[roundcube.git] / program / steps / mail / spell.inc
index ea22a32a0ee29a34270753d523df8c88fc444837..d318c4a2ef0dcc0e03d01de71fb2fb7d5f9743ad 100644 (file)
@@ -5,7 +5,7 @@
  | program/steps/mail/spell.inc                                          |
  |                                                                       |
  | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2005, RoundCube Dev. - Switzerland                      |
+ | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
 
- $Id: spell.inc 265 2006-06-25 10:04:45Z thomasb $
+ $Id: spell.inc 850 2007-10-03 00:13:32Z ihug $
 
 */
 
 $REMOTE_REQUEST = TRUE;
 
-$google = "ssl://www.google.com";
+// default settings
+$host = "ssl://www.google.com";
 $port = 443;
-$lang = $_GET['lang'];
+$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($google, $port, $errno, $errstr, 30))
+if ($fp = fsockopen($host, $port, $errno, $errstr, 30))
   {
   $out = "POST $path HTTP/1.0\r\n";
-  $out .= "Host: $google\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";
@@ -49,4 +61,4 @@ if ($fp = fsockopen($google, $port, $errno, $errstr, 30))
 print $store;  
 exit;
 
-?>
\ No newline at end of file
+?>