Skip to content

Commit

Permalink
Issue CollaboraOnline#43: Enhance docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
donquixote authored and AaronGilMartinez committed Nov 25, 2024
1 parent f5e534d commit eb19f53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function permissionDenied(): Response {
* @return \Symfony\Component\HttpFoundation\Response
* The response with file contents.
*/
public function wopiCheckFileInfo(string $id, Request $request) {
function wopiCheckFileInfo(string $id, Request $request) {
$token = $request->query->get('access_token');

$jwt_payload = CoolUtils::verifyTokenForId($token, $id);
Expand Down Expand Up @@ -119,7 +119,7 @@ public function wopiCheckFileInfo(string $id, Request $request) {
* @return \Symfony\Component\HttpFoundation\Response
* The response with file contents.
*/
public function wopiGetFile(string $id, Request $request) {
function wopiGetFile(string $id, Request $request) {
$token = $request->query->get('access_token');

$jwt_payload = CoolUtils::verifyTokenForId($token, $id);
Expand All @@ -144,7 +144,7 @@ public function wopiGetFile(string $id, Request $request) {
}

/**
* Handles the wopi "save" request for a media entity.
* Handles the wopi "save" request for a media entity..
*
* @param string $id
* Media id from url.
Expand All @@ -154,7 +154,7 @@ public function wopiGetFile(string $id, Request $request) {
* @return \Symfony\Component\HttpFoundation\Response
* The response.
*/
public function wopiPutFile(string $id, Request $request) {
function wopiPutFile(string $id, Request $request) {
$token = $request->query->get('access_token');
$timestamp = $request->headers->get('x-cool-wopi-timestamp');
$modified_by_user = $request->headers->get('x-cool-wopi-ismodifiedbyuser') == 'true';
Expand Down
4 changes: 2 additions & 2 deletions src/Cool/CoolRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function getDiscovery($server) {

$stream_context = stream_context_create([
'ssl' => [
'verify_peer' => !$disable_checks,
'verify_peer_name' => !$disable_checks,
'verify_peer' => !$disable_checks,
'verify_peer_name' => !$disable_checks,
],
]);
$res = file_get_contents($discovery_url, FALSE, $stream_context);
Expand Down
10 changes: 4 additions & 6 deletions src/Cool/CoolUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static function setMediaSource(Media $media, File $source) {
* @return string
* The key value.
*/
public static function getKey() {
static function getKey() {
$default_config = \Drupal::config('collabora_online.settings');
$key_id = $default_config->get('cool')['key_id'];

Expand Down Expand Up @@ -110,8 +110,7 @@ public static function verifyTokenForId(
if ($payload && ($payload->fid == $id) && ($payload->exp >= gettimeofday(TRUE))) {
return $payload;
}
}
catch (\Exception $e) {
} catch (\Exception $e) {
\Drupal::logger('cool')->error($e->getMessage());
}
return NULL;
Expand Down Expand Up @@ -218,11 +217,10 @@ public static function getDocumentType(File $file) {
* @return \Drupal\Core\Url
* Editor url to visit as full-page, or to embed in an iframe.
*/
public static function getEditorUrl(Media $media, $can_write = FALSE) {
public static function getEditorUrl(Media $media, $can_write = false) {
if ($can_write) {
return Url::fromRoute('collabora-online.edit', ['media' => $media->id()]);
}
else {
} else {
return Url::fromRoute('collabora-online.view', ['media' => $media->id()]);
}
}
Expand Down

0 comments on commit eb19f53

Please sign in to comment.