Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
clean getRealFSReference usages
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Sep 12, 2016
1 parent 4009ea1 commit cfd28f2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 2 additions & 4 deletions core/src/plugins/editor.pixlr/PixlrEditor.php
Expand Up @@ -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));

Expand All @@ -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 = [
Expand Down
7 changes: 5 additions & 2 deletions core/src/plugins/editor.zoho/ZohoEditor.php
Expand Up @@ -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));
Expand Down Expand Up @@ -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')
Expand All @@ -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')
]
]);

Expand All @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/meta.exif/ExifMetaManager.php
Expand Up @@ -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);
Expand Down

0 comments on commit cfd28f2

Please sign in to comment.