]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/js/tiny_mce/plugins/spellchecker/rpc.php
Imported Upstream version 0.5
[roundcube.git] / program / js / tiny_mce / plugins / spellchecker / rpc.php
diff --git a/program/js/tiny_mce/plugins/spellchecker/rpc.php b/program/js/tiny_mce/plugins/spellchecker/rpc.php
deleted file mode 100755 (executable)
index a0072ae..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php\r
-/**\r
- * $Id: rpc.php 822 2008-04-28 13:45:03Z spocke $\r
- *\r
- * @author Moxiecode\r
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.\r
- */\r
-\r
-require_once("./includes/general.php");\r
-\r
-// Set RPC response headers\r
-header('Content-Type: text/plain');\r
-header('Content-Encoding: UTF-8');\r
-header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");\r
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");\r
-header("Cache-Control: no-store, no-cache, must-revalidate");\r
-header("Cache-Control: post-check=0, pre-check=0", false);\r
-header("Pragma: no-cache");\r
-\r
-$raw = "";\r
-\r
-// Try param\r
-if (isset($_POST["json_data"]))\r
-       $raw = getRequestParam("json_data");\r
-\r
-// Try globals array\r
-if (!$raw && isset($_GLOBALS) && isset($_GLOBALS["HTTP_RAW_POST_DATA"]))\r
-       $raw = $_GLOBALS["HTTP_RAW_POST_DATA"];\r
-\r
-// Try globals variable\r
-if (!$raw && isset($HTTP_RAW_POST_DATA))\r
-       $raw = $HTTP_RAW_POST_DATA;\r
-\r
-// Try stream\r
-if (!$raw) {\r
-       if (!function_exists('file_get_contents')) {\r
-               $fp = fopen("php://input", "r");\r
-               if ($fp) {\r
-                       $raw = "";\r
-\r
-                       while (!feof($fp))\r
-                               $raw = fread($fp, 1024);\r
-\r
-                       fclose($fp);\r
-               }\r
-       } else\r
-               $raw = "" . file_get_contents("php://input");\r
-}\r
-\r
-// No input data\r
-if (!$raw)\r
-       die('{"result":null,"id":null,"error":{"errstr":"Could not get raw post data.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');\r
-\r
-// Passthrough request to remote server\r
-if (isset($config['general.remote_rpc_url'])) {\r
-       $url = parse_url($config['general.remote_rpc_url']);\r
-\r
-       // Setup request\r
-       $req = "POST " . $url["path"] . " HTTP/1.0\r\n";\r
-       $req .= "Connection: close\r\n";\r
-       $req .= "Host: " . $url['host'] . "\r\n";\r
-       $req .= "Content-Length: " . strlen($raw) . "\r\n";\r
-       $req .= "\r\n" . $raw;\r
-\r
-       if (!isset($url['port']) || !$url['port'])\r
-               $url['port'] = 80;\r
-\r
-       $errno = $errstr = "";\r
-\r
-       $socket = fsockopen($url['host'], intval($url['port']), $errno, $errstr, 30);\r
-       if ($socket) {\r
-               // Send request headers\r
-               fputs($socket, $req);\r
-\r
-               // Read response headers and data\r
-               $resp = "";\r
-               while (!feof($socket))\r
-                               $resp .= fgets($socket, 4096);\r
-\r
-               fclose($socket);\r
-\r
-               // Split response header/data\r
-               $resp = explode("\r\n\r\n", $resp);\r
-               echo $resp[1]; // Output body\r
-       }\r
-\r
-       die();\r
-}\r
-\r
-// Get JSON data\r
-$json = new Moxiecode_JSON();\r
-$input = $json->decode($raw);\r
-\r
-// Execute RPC\r
-if (isset($config['general.engine'])) {\r
-       $spellchecker = new $config['general.engine']($config);\r
-       $result = call_user_func_array(array($spellchecker, $input['method']), $input['params']);\r
-} else\r
-       die('{"result":null,"id":null,"error":{"errstr":"You must choose an spellchecker engine in the config.php file.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');\r
-\r
-// Request and response id should always be the same\r
-$output = array(\r
-       "id" => $input->id,\r
-       "result" => $result,\r
-       "error" => null\r
-);\r
-\r
-// Return JSON encoded string\r
-echo $json->encode($output);\r
-\r
-?>
\ No newline at end of file