From fd4dfea7d7ff13af56986d4c714eb4380c43a026 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Mon, 9 Oct 2017 17:31:49 +0300 Subject: [PATCH] php: remove storage service --- web/documentserver-example/php/config.php | 1 - web/documentserver-example/php/functions.php | 63 -------------------- 2 files changed, 64 deletions(-) diff --git a/web/documentserver-example/php/config.php b/web/documentserver-example/php/config.php index ec051b5e..78fc9dc8 100644 --- a/web/documentserver-example/php/config.php +++ b/web/documentserver-example/php/config.php @@ -12,7 +12,6 @@ $GLOBALS['DOC_SERV_CONVERT'] = array(".docm", ".doc", ".dotx", ".dotm", ".dot", $GLOBALS['DOC_SERV_TIMEOUT'] = "120000"; -$GLOBALS['DOC_SERV_STORAGE_URL'] = "https://doc.onlyoffice.com/FileUploader.ashx"; $GLOBALS['DOC_SERV_CONVERTER_URL'] = "https://doc.onlyoffice.com/ConvertService.ashx"; $GLOBALS['DOC_SERV_API_URL'] = "https://doc.onlyoffice.com/web-apps/apps/api/documents/api.js"; diff --git a/web/documentserver-example/php/functions.php b/web/documentserver-example/php/functions.php index 1999bc0e..5520ccb0 100644 --- a/web/documentserver-example/php/functions.php +++ b/web/documentserver-example/php/functions.php @@ -31,57 +31,6 @@ require_once( dirname(__FILE__) . '/config.php' ); -function GetExternalFileUri($local_uri) { - $externalUri = ''; - - try - { - $documentRevisionId = GenerateRevisionId($local_uri); - - if (($fileContents = file_get_contents(str_replace(" ","%20", $local_uri))) === FALSE) { - throw new Exception("Bad Request"); - } else { - $contentType = mime_content_type($local_uri); - - $urlToService = generateUrlToStorage('', '', '', '', $documentRevisionId); - - $opts = array('http' => array( - 'method' => 'POST', - 'header' => "User-Agent: " . $_SERVER['HTTP_USER_AGENT'] . "\r\n" . - "Content-Type: " . $contentType . "\r\n" . - "Content-Length: " . strlen($fileContents) . "\r\n" . - "Accept: application/json\r\n", - 'content' => $fileContents, - 'timeout' => $GLOBALS['DOC_SERV_TIMEOUT'] - ) - ); - - if (substr($urlToService, 0, strlen("https")) === "https") { - $opts['ssl'] = array( 'verify_peer' => FALSE ); - } - - - $context = stream_context_create($opts); - - if (($response_data = file_get_contents($urlToService, FALSE, $context)) === FALSE) { - throw new Exception ("Could not get an answer"); - } else { - sendlog("GetExternalUri response_data:" . PHP_EOL . $response_data, "logs/common.log"); - GetResponseUri($response_data, $externalUri); - } - - sendlog("GetExternalFileUri. externalUri = " . $externalUri, "logs/common.log"); - return $externalUri . ""; - } - } - catch (Exception $e) - { - sendlog("GetExternalFileUri Exception: " . $e->getMessage(), "logs/common.log"); - } - return $local_uri; -} - - function DoUpload($fileUri) { $_fileName = GetCorrectName($fileUri); @@ -102,18 +51,6 @@ function DoUpload($fileUri) { } -function generateUrlToStorage($document_uri, $from_extension, $to_extension, $title, $document_revision_id) { - - return $GLOBALS['DOC_SERV_STORAGE_URL'] . "?" . http_build_query( - array( - "url" => $document_uri, - "outputtype" => trim($to_extension,'.'), - "filetype" => trim($from_extension, '.'), - "title" => $title, - "key" => $document_revision_id)); -} - - /** * Generate an error code table *