From 773250be24599d93a40851d17991bab7d0861d53 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 18 Jul 2016 13:34:18 +0200 Subject: [PATCH] Cleanup coding style --- .../lib/Controllers/ShareController.php | 58 +++++++++---------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/apps/files_sharing/lib/Controllers/ShareController.php b/apps/files_sharing/lib/Controllers/ShareController.php index fd4ff3f32c0..7a955f6f960 100644 --- a/apps/files_sharing/lib/Controllers/ShareController.php +++ b/apps/files_sharing/lib/Controllers/ShareController.php @@ -31,11 +31,9 @@ namespace OCA\Files_Sharing\Controllers; -use OC; use OC_Files; use OC_Util; use OCA\FederatedFileSharing\FederatedShareProvider; -use OCP; use OCP\Template; use OCP\Share; use OCP\AppFramework\Controller; @@ -71,9 +69,9 @@ class ShareController extends Controller { protected $userManager; /** @var ILogger */ protected $logger; - /** @var OCP\Activity\IManager */ + /** @var \OCP\Activity\IManager */ protected $activityManager; - /** @var OCP\Share\IManager */ + /** @var \OCP\Share\IManager */ protected $shareManager; /** @var ISession */ protected $session; @@ -93,7 +91,7 @@ class ShareController extends Controller { * @param IURLGenerator $urlGenerator * @param IUserManager $userManager * @param ILogger $logger - * @param OCP\Activity\IManager $activityManager + * @param \OCP\Activity\IManager $activityManager * @param \OCP\Share\IManager $shareManager * @param ISession $session * @param IPreview $previewManager @@ -153,7 +151,7 @@ class ShareController extends Controller { * Authenticates against password-protected shares * @param string $token * @param string $password - * @return RedirectResponse|TemplateResponse + * @return RedirectResponse|TemplateResponse|NotFoundResponse */ public function authenticate($token, $password = '') { @@ -209,8 +207,8 @@ class ShareController extends Controller { * otherwise token * @param int $errorCode * @param string $errorMessage - * @throws OC\HintException - * @throws OC\ServerNotAvailableException + * @throws \OC\HintException + * @throws \OC\ServerNotAvailableException */ protected function emitAccessShareHook($share, $errorCode = 200, $errorMessage = '') { $itemType = $itemSource = $uidOwner = ''; @@ -256,7 +254,7 @@ class ShareController extends Controller { * * @param string $token * @param string $path - * @return TemplateResponse|RedirectResponse + * @return TemplateResponse|RedirectResponse|NotFoundResponse * @throws NotFoundException * @throws \Exception */ @@ -343,7 +341,7 @@ class ShareController extends Controller { $folder->assign('hideFileList', $hideFileList); $folder->assign('publicUploadEnabled', 'no'); $folder->assign('uploadMaxFilesize', $maxUploadFilesize); - $folder->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); + $folder->assign('uploadMaxHumanFilesize', \OCP\Util::humanFileSize($maxUploadFilesize)); $folder->assign('freeSpace', $freeSpace); $folder->assign('uploadLimit', $uploadLimit); // PHP upload limit $folder->assign('usedSpacePercent', 0); @@ -360,31 +358,31 @@ class ShareController extends Controller { $shareTmpl['previewMaxY'] = $this->config->getSystemValue('preview_max_y', 1024); // Load files we need - OCP\Util::addScript('files', 'file-upload'); - OCP\Util::addStyle('files_sharing', 'public'); - OCP\Util::addStyle('files_sharing', 'mobile'); - OCP\Util::addScript('files_sharing', 'public'); - OCP\Util::addScript('files', 'fileactions'); - OCP\Util::addScript('files', 'fileactionsmenu'); - OCP\Util::addScript('files', 'jquery.fileupload'); - OCP\Util::addScript('files_sharing', 'files_drop'); + \OCP\Util::addScript('files', 'file-upload'); + \OCP\Util::addStyle('files_sharing', 'public'); + \OCP\Util::addStyle('files_sharing', 'mobile'); + \OCP\Util::addScript('files_sharing', 'public'); + \OCP\Util::addScript('files', 'fileactions'); + \OCP\Util::addScript('files', 'fileactionsmenu'); + \OCP\Util::addScript('files', 'jquery.fileupload'); + \OCP\Util::addScript('files_sharing', 'files_drop'); if (isset($shareTmpl['folder'])) { // JS required for folders - OCP\Util::addStyle('files', 'files'); - OCP\Util::addStyle('files', 'upload'); - OCP\Util::addScript('files', 'filesummary'); - OCP\Util::addScript('files', 'breadcrumb'); - OCP\Util::addScript('files', 'fileinfomodel'); - OCP\Util::addScript('files', 'newfilemenu'); - OCP\Util::addScript('files', 'files'); - OCP\Util::addScript('files', 'filelist'); - OCP\Util::addscript('files', 'keyboardshortcuts'); + \OCP\Util::addStyle('files', 'files'); + \OCP\Util::addStyle('files', 'upload'); + \OCP\Util::addScript('files', 'filesummary'); + \OCP\Util::addScript('files', 'breadcrumb'); + \OCP\Util::addScript('files', 'fileinfomodel'); + \OCP\Util::addScript('files', 'newfilemenu'); + \OCP\Util::addScript('files', 'files'); + \OCP\Util::addScript('files', 'filelist'); + \OCP\Util::addScript('files', 'keyboardshortcuts'); } $this->eventDispatcher->dispatch('OCA\Files_Sharing::loadAdditionalScripts'); - $csp = new OCP\AppFramework\Http\ContentSecurityPolicy(); + $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); $response = new TemplateResponse($this->appName, 'public', $shareTmpl, 'base'); $response->setContentSecurityPolicy($csp); @@ -402,7 +400,7 @@ class ShareController extends Controller { * @param string $files * @param string $path * @param string $downloadStartSecret - * @return void|OCP\AppFramework\Http\Response + * @return void|\OCP\AppFramework\Http\Response * @throws NotFoundException */ public function downloadShare($token, $files = null, $path = '', $downloadStartSecret = '') { @@ -411,7 +409,7 @@ class ShareController extends Controller { $share = $this->shareManager->getShareByToken($token); if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { - return new OCP\AppFramework\Http\DataResponse('Share is read-only'); + return new \OCP\AppFramework\Http\DataResponse('Share is read-only'); } // Share is password protected - check whether the user is permitted to access the share -- 2.39.5