mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
Php code bump
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
bfc6fc8e50
commit
37a4d2bbbc
3 changed files with 15 additions and 5 deletions
|
|
@ -30,6 +30,7 @@ use OCP\AppFramework\Http\DataDisplayResponse;
|
|||
use OCP\AppFramework\Http\NotFoundResponse;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\IRequest;
|
||||
|
||||
class SvgController extends Controller {
|
||||
|
|
@ -40,13 +41,18 @@ class SvgController extends Controller {
|
|||
/** @var ITimeFactory */
|
||||
protected $timeFactory;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
public function __construct(string $appName,
|
||||
IRequest $request,
|
||||
ITimeFactory $timeFactory) {
|
||||
ITimeFactory $timeFactory,
|
||||
IAppManager $appManager) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->serverRoot = \OC::$SERVERROOT;
|
||||
$this->timeFactory = $timeFactory;
|
||||
$this->appManager = $appManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,7 +64,7 @@ class SvgController extends Controller {
|
|||
* @param string $folder
|
||||
* @param string $fileName
|
||||
* @param string $color
|
||||
* @return DataDisplayResponse|NotFoundException
|
||||
* @return DataDisplayResponse|NotFoundResponse
|
||||
*/
|
||||
public function getSvgFromCore(string $folder, string $fileName, string $color = 'ffffff') {
|
||||
$path = $this->serverRoot . "/core/img/$folder/$fileName.svg";
|
||||
|
|
@ -74,7 +80,7 @@ class SvgController extends Controller {
|
|||
* @param string $app
|
||||
* @param string $fileName
|
||||
* @param string $color
|
||||
* @return DataDisplayResponse|NotFoundException
|
||||
* @return DataDisplayResponse|NotFoundResponse
|
||||
*/
|
||||
public function getSvgFromApp(string $app, string $fileName, string $color = 'ffffff') {
|
||||
|
||||
|
|
@ -83,7 +89,9 @@ class SvgController extends Controller {
|
|||
return $this->getSvg($path, $color, $fileName);
|
||||
}
|
||||
|
||||
$appPath = \OC_App::getAppWebPath($app);
|
||||
$appRootPath = $this->appManager->getAppPath($app);
|
||||
$appPath = substr($appRootPath, strlen($this->serverRoot));
|
||||
|
||||
if (!$appPath) {
|
||||
return new NotFoundResponse();
|
||||
}
|
||||
|
|
@ -97,7 +105,7 @@ class SvgController extends Controller {
|
|||
*
|
||||
* @param string $path
|
||||
* @param string $color
|
||||
* @return DataDisplayResponse|NotFoundException
|
||||
* @return DataDisplayResponse|NotFoundResponse
|
||||
*/
|
||||
private function getSvg(string $path, string $color, string $fileName) {
|
||||
if (!file_exists($path)) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
declare (strict_types = 1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
declare (strict_types = 1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue