Permalink
Browse files

clean getRealFSReference usages

  • Loading branch information...
1 parent 4009ea1 commit cfd28f26c7148fa984c393c6323e64d808652ab2 @cdujeu cdujeu committed Sep 12, 2016
@@ -98,8 +98,6 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
}
$target = rtrim(base64_decode($httpVars["parent_url"]), '/') ."/plugins/editor.pixlr";
- $tmp = MetaStreamWrapper::getRealFSReference($selectedNodeUrl);
- //$tmp = TextEncoder::fromUTF8($tmp);
$this->logInfo('Preview', 'Sending content of '.$selectedNodeUrl.' to Pixlr server.', array("files" => $selectedNodeUrl));
Controller::applyHook("node.read", array($selectedNode));
@@ -108,8 +106,8 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
$saveTarget = $target."/fake_save_pixlr_".md5($httpVars["secure_token"]).".php";
}
- $type = pathinfo($tmp, PATHINFO_EXTENSION);
- $data = file_get_contents($tmp);
+ $type = pathinfo($selectedNodeUrl, PATHINFO_EXTENSION);
+ $data = file_get_contents($selectedNodeUrl);
$rawData = 'data:image/' . $type . ';base64,' . base64_encode($data);
$params = [
@@ -175,7 +175,6 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
}
$target = base64_decode($httpVars["parent_url"]);
- $tmp = MetaStreamWrapper::getRealFSReference($nodeUrl);
$node = new AJXP_Node($nodeUrl);
Controller::applyHook("node.read", array($node));
@@ -203,6 +202,8 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
$service = "exportwriter";
}
+ $contentHandle = fopen($nodeUrl, 'r');
+
$postResponse = $this->client->post("https://".$service.".zoho.com/remotedoc.im", [
'headers' => [
'User-Agent' => $request->getHeader('User-Agent')
@@ -217,7 +218,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
'format' => $extension,
'mode' => $repoWriteable && is_writeable($nodeUrl) ? 'normaledit' : 'view',
'saveurl' => $saveUrl."?signature=".$b64Sig."&XDEBUG_SESSION_START=phpstorm",
- 'content' => fopen($tmp, 'r')
+ 'content' => fopen($nodeUrl, 'r')
]
]);
@@ -236,6 +237,8 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
throw new FileNotFoundException("Could not open file");
}
+ fclose($contentHandle);
+
$response = $response
->withStatus(302)
->withHeader("Location", $result["URL"]);
@@ -135,7 +135,7 @@ public function extractExif(\Psr\Http\Message\ServerRequestInterface $requestInt
$ctx = $requestInterface->getAttribute("ctx");
$userSelection = UserSelection::fromContext($ctx, $httpVars);
$selectedNode = $userSelection->getUniqueNode();
- $realFile = MetaStreamWrapper::getRealFSReference($selectedNode->getUrl());
+ $realFile = $selectedNode->getRealFile();
ApplicationState::safeIniSet('exif.encode_unicode', 'UTF-8');
$exifData = @exif_read_data($realFile, 0, TRUE);

0 comments on commit cfd28f2

Please sign in to comment.