Passed
Push — master ( b37a49...348454 )
by Joas
15:41 queued 15s
created
apps/federatedfilesharing/lib/AddressHandler.php 1 patch
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -38,120 +38,120 @@
 block discarded – undo
38 38
  */
39 39
 class AddressHandler {
40 40
 
41
-	/** @var IL10N */
42
-	private $l;
43
-
44
-	/** @var IURLGenerator */
45
-	private $urlGenerator;
46
-
47
-	/** @var ICloudIdManager */
48
-	private $cloudIdManager;
49
-
50
-	/**
51
-	 * AddressHandler constructor.
52
-	 *
53
-	 * @param IURLGenerator $urlGenerator
54
-	 * @param IL10N $il10n
55
-	 * @param ICloudIdManager $cloudIdManager
56
-	 */
57
-	public function __construct(
58
-		IURLGenerator $urlGenerator,
59
-		IL10N $il10n,
60
-		ICloudIdManager $cloudIdManager
61
-	) {
62
-		$this->l = $il10n;
63
-		$this->urlGenerator = $urlGenerator;
64
-		$this->cloudIdManager = $cloudIdManager;
65
-	}
66
-
67
-	/**
68
-	 * split user and remote from federated cloud id
69
-	 *
70
-	 * @param string $address federated share address
71
-	 * @return array [user, remoteURL]
72
-	 * @throws HintException
73
-	 */
74
-	public function splitUserRemote($address) {
75
-		try {
76
-			$cloudId = $this->cloudIdManager->resolveCloudId($address);
77
-			return [$cloudId->getUser(), $cloudId->getRemote()];
78
-		} catch (\InvalidArgumentException $e) {
79
-			$hint = $this->l->t('Invalid Federated Cloud ID');
80
-			throw new HintException('Invalid Federated Cloud ID', $hint, 0, $e);
81
-		}
82
-	}
83
-
84
-	/**
85
-	 * generate remote URL part of federated ID
86
-	 *
87
-	 * @return string url of the current server
88
-	 */
89
-	public function generateRemoteURL() {
90
-		return $this->urlGenerator->getAbsoluteURL('/');
91
-	}
92
-
93
-	/**
94
-	 * check if two federated cloud IDs refer to the same user
95
-	 *
96
-	 * @param string $user1
97
-	 * @param string $server1
98
-	 * @param string $user2
99
-	 * @param string $server2
100
-	 * @return bool true if both users and servers are the same
101
-	 */
102
-	public function compareAddresses($user1, $server1, $user2, $server2) {
103
-		$normalizedServer1 = strtolower($this->removeProtocolFromUrl($server1));
104
-		$normalizedServer2 = strtolower($this->removeProtocolFromUrl($server2));
105
-
106
-		if (rtrim($normalizedServer1, '/') === rtrim($normalizedServer2, '/')) {
107
-			// FIXME this should be a method in the user management instead
108
-			\OCP\Util::emitHook(
109
-				'\OCA\Files_Sharing\API\Server2Server',
110
-				'preLoginNameUsedAsUserName',
111
-				['uid' => &$user1]
112
-			);
113
-			\OCP\Util::emitHook(
114
-				'\OCA\Files_Sharing\API\Server2Server',
115
-				'preLoginNameUsedAsUserName',
116
-				['uid' => &$user2]
117
-			);
118
-
119
-			if ($user1 === $user2) {
120
-				return true;
121
-			}
122
-		}
123
-
124
-		return false;
125
-	}
126
-
127
-	/**
128
-	 * remove protocol from URL
129
-	 *
130
-	 * @param string $url
131
-	 * @return string
132
-	 */
133
-	public function removeProtocolFromUrl($url) {
134
-		if (strpos($url, 'https://') === 0) {
135
-			return substr($url, strlen('https://'));
136
-		} elseif (strpos($url, 'http://') === 0) {
137
-			return substr($url, strlen('http://'));
138
-		}
139
-
140
-		return $url;
141
-	}
142
-
143
-	/**
144
-	 * check if the url contain the protocol (http or https)
145
-	 *
146
-	 * @param string $url
147
-	 * @return bool
148
-	 */
149
-	public function urlContainProtocol($url) {
150
-		if (strpos($url, 'https://') === 0 ||
151
-			strpos($url, 'http://') === 0) {
152
-			return true;
153
-		}
154
-
155
-		return false;
156
-	}
41
+    /** @var IL10N */
42
+    private $l;
43
+
44
+    /** @var IURLGenerator */
45
+    private $urlGenerator;
46
+
47
+    /** @var ICloudIdManager */
48
+    private $cloudIdManager;
49
+
50
+    /**
51
+     * AddressHandler constructor.
52
+     *
53
+     * @param IURLGenerator $urlGenerator
54
+     * @param IL10N $il10n
55
+     * @param ICloudIdManager $cloudIdManager
56
+     */
57
+    public function __construct(
58
+        IURLGenerator $urlGenerator,
59
+        IL10N $il10n,
60
+        ICloudIdManager $cloudIdManager
61
+    ) {
62
+        $this->l = $il10n;
63
+        $this->urlGenerator = $urlGenerator;
64
+        $this->cloudIdManager = $cloudIdManager;
65
+    }
66
+
67
+    /**
68
+     * split user and remote from federated cloud id
69
+     *
70
+     * @param string $address federated share address
71
+     * @return array [user, remoteURL]
72
+     * @throws HintException
73
+     */
74
+    public function splitUserRemote($address) {
75
+        try {
76
+            $cloudId = $this->cloudIdManager->resolveCloudId($address);
77
+            return [$cloudId->getUser(), $cloudId->getRemote()];
78
+        } catch (\InvalidArgumentException $e) {
79
+            $hint = $this->l->t('Invalid Federated Cloud ID');
80
+            throw new HintException('Invalid Federated Cloud ID', $hint, 0, $e);
81
+        }
82
+    }
83
+
84
+    /**
85
+     * generate remote URL part of federated ID
86
+     *
87
+     * @return string url of the current server
88
+     */
89
+    public function generateRemoteURL() {
90
+        return $this->urlGenerator->getAbsoluteURL('/');
91
+    }
92
+
93
+    /**
94
+     * check if two federated cloud IDs refer to the same user
95
+     *
96
+     * @param string $user1
97
+     * @param string $server1
98
+     * @param string $user2
99
+     * @param string $server2
100
+     * @return bool true if both users and servers are the same
101
+     */
102
+    public function compareAddresses($user1, $server1, $user2, $server2) {
103
+        $normalizedServer1 = strtolower($this->removeProtocolFromUrl($server1));
104
+        $normalizedServer2 = strtolower($this->removeProtocolFromUrl($server2));
105
+
106
+        if (rtrim($normalizedServer1, '/') === rtrim($normalizedServer2, '/')) {
107
+            // FIXME this should be a method in the user management instead
108
+            \OCP\Util::emitHook(
109
+                '\OCA\Files_Sharing\API\Server2Server',
110
+                'preLoginNameUsedAsUserName',
111
+                ['uid' => &$user1]
112
+            );
113
+            \OCP\Util::emitHook(
114
+                '\OCA\Files_Sharing\API\Server2Server',
115
+                'preLoginNameUsedAsUserName',
116
+                ['uid' => &$user2]
117
+            );
118
+
119
+            if ($user1 === $user2) {
120
+                return true;
121
+            }
122
+        }
123
+
124
+        return false;
125
+    }
126
+
127
+    /**
128
+     * remove protocol from URL
129
+     *
130
+     * @param string $url
131
+     * @return string
132
+     */
133
+    public function removeProtocolFromUrl($url) {
134
+        if (strpos($url, 'https://') === 0) {
135
+            return substr($url, strlen('https://'));
136
+        } elseif (strpos($url, 'http://') === 0) {
137
+            return substr($url, strlen('http://'));
138
+        }
139
+
140
+        return $url;
141
+    }
142
+
143
+    /**
144
+     * check if the url contain the protocol (http or https)
145
+     *
146
+     * @param string $url
147
+     * @return bool
148
+     */
149
+    public function urlContainProtocol($url) {
150
+        if (strpos($url, 'https://') === 0 ||
151
+            strpos($url, 'http://') === 0) {
152
+            return true;
153
+        }
154
+
155
+        return false;
156
+    }
157 157
 }
Please login to merge, or discard this patch.
apps/oauth2/lib/Migration/SetTokenExpiration.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,44 +36,44 @@
 block discarded – undo
36 36
 
37 37
 class SetTokenExpiration implements IRepairStep {
38 38
 
39
-	/** @var IDBConnection */
40
-	private $connection;
39
+    /** @var IDBConnection */
40
+    private $connection;
41 41
 
42
-	/** @var ITimeFactory */
43
-	private $time;
42
+    /** @var ITimeFactory */
43
+    private $time;
44 44
 
45
-	/** @var TokenProvider */
46
-	private $tokenProvider;
45
+    /** @var TokenProvider */
46
+    private $tokenProvider;
47 47
 
48
-	public function __construct(IDBConnection $connection,
49
-								ITimeFactory $timeFactory,
50
-								TokenProvider $tokenProvider) {
51
-		$this->connection = $connection;
52
-		$this->time = $timeFactory;
53
-		$this->tokenProvider = $tokenProvider;
54
-	}
48
+    public function __construct(IDBConnection $connection,
49
+                                ITimeFactory $timeFactory,
50
+                                TokenProvider $tokenProvider) {
51
+        $this->connection = $connection;
52
+        $this->time = $timeFactory;
53
+        $this->tokenProvider = $tokenProvider;
54
+    }
55 55
 
56
-	public function getName(): string {
57
-		return 'Update OAuth token expiration times';
58
-	}
56
+    public function getName(): string {
57
+        return 'Update OAuth token expiration times';
58
+    }
59 59
 
60
-	public function run(IOutput $output) {
61
-		$qb = $this->connection->getQueryBuilder();
62
-		$qb->select('*')
63
-			->from('oauth2_access_tokens');
60
+    public function run(IOutput $output) {
61
+        $qb = $this->connection->getQueryBuilder();
62
+        $qb->select('*')
63
+            ->from('oauth2_access_tokens');
64 64
 
65
-		$cursor = $qb->execute();
65
+        $cursor = $qb->execute();
66 66
 
67
-		while ($row = $cursor->fetch()) {
68
-			$token = AccessToken::fromRow($row);
69
-			try {
70
-				$appToken = $this->tokenProvider->getTokenById($token->getTokenId());
71
-				$appToken->setExpires($this->time->getTime() + 3600);
72
-				$this->tokenProvider->updateToken($appToken);
73
-			} catch (InvalidTokenException $e) {
74
-				//Skip this token
75
-			}
76
-		}
77
-		$cursor->closeCursor();
78
-	}
67
+        while ($row = $cursor->fetch()) {
68
+            $token = AccessToken::fromRow($row);
69
+            try {
70
+                $appToken = $this->tokenProvider->getTokenById($token->getTokenId());
71
+                $appToken->setExpires($this->time->getTime() + 3600);
72
+                $this->tokenProvider->updateToken($appToken);
73
+            } catch (InvalidTokenException $e) {
74
+                //Skip this token
75
+            }
76
+        }
77
+        $cursor->closeCursor();
78
+    }
79 79
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Controller/PreviewController.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -44,91 +44,91 @@
 block discarded – undo
44 44
 use OCP\IUserSession;
45 45
 
46 46
 class PreviewController extends Controller {
47
-	/** @var IRootFolder */
48
-	private $rootFolder;
49
-
50
-	/** @var ITrashManager */
51
-	private $trashManager;
52
-
53
-	/** @var IUserSession */
54
-	private $userSession;
55
-
56
-	/** @var IMimeTypeDetector */
57
-	private $mimeTypeDetector;
58
-
59
-	/** @var IPreview */
60
-	private $previewManager;
61
-
62
-	/** @var ITimeFactory */
63
-	private $time;
64
-
65
-	public function __construct(
66
-		string $appName,
67
-		IRequest $request,
68
-		IRootFolder $rootFolder,
69
-		ITrashManager $trashManager,
70
-		IUserSession $userSession,
71
-		IMimeTypeDetector $mimeTypeDetector,
72
-		IPreview $previewManager,
73
-		ITimeFactory $time
74
-	) {
75
-		parent::__construct($appName, $request);
76
-
77
-		$this->trashManager = $trashManager;
78
-		$this->rootFolder = $rootFolder;
79
-		$this->userSession = $userSession;
80
-		$this->mimeTypeDetector = $mimeTypeDetector;
81
-		$this->previewManager = $previewManager;
82
-		$this->time = $time;
83
-	}
84
-
85
-	/**
86
-	 * @NoAdminRequired
87
-	 * @NoCSRFRequired
88
-	 *
89
-	 * @return DataResponse|Http\FileDisplayResponse
90
-	 */
91
-	public function getPreview(
92
-		int $fileId = -1,
93
-		int $x = 128,
94
-		int $y = 128
95
-	) {
96
-		if ($fileId === -1 || $x === 0 || $y === 0) {
97
-			return new DataResponse([], Http::STATUS_BAD_REQUEST);
98
-		}
99
-
100
-		try {
101
-			$file = $this->trashManager->getTrashNodeById($this->userSession->getUser(), $fileId);
102
-			if ($file === null) {
103
-				return new DataResponse([], Http::STATUS_NOT_FOUND);
104
-			}
105
-			if ($file instanceof Folder) {
106
-				return new DataResponse([], Http::STATUS_BAD_REQUEST);
107
-			}
108
-
109
-			$pathParts = pathinfo($file->getName());
110
-			$extension = $pathParts['extension'] ?? '';
111
-			$fileName = $pathParts['filename'];
112
-			/*
47
+    /** @var IRootFolder */
48
+    private $rootFolder;
49
+
50
+    /** @var ITrashManager */
51
+    private $trashManager;
52
+
53
+    /** @var IUserSession */
54
+    private $userSession;
55
+
56
+    /** @var IMimeTypeDetector */
57
+    private $mimeTypeDetector;
58
+
59
+    /** @var IPreview */
60
+    private $previewManager;
61
+
62
+    /** @var ITimeFactory */
63
+    private $time;
64
+
65
+    public function __construct(
66
+        string $appName,
67
+        IRequest $request,
68
+        IRootFolder $rootFolder,
69
+        ITrashManager $trashManager,
70
+        IUserSession $userSession,
71
+        IMimeTypeDetector $mimeTypeDetector,
72
+        IPreview $previewManager,
73
+        ITimeFactory $time
74
+    ) {
75
+        parent::__construct($appName, $request);
76
+
77
+        $this->trashManager = $trashManager;
78
+        $this->rootFolder = $rootFolder;
79
+        $this->userSession = $userSession;
80
+        $this->mimeTypeDetector = $mimeTypeDetector;
81
+        $this->previewManager = $previewManager;
82
+        $this->time = $time;
83
+    }
84
+
85
+    /**
86
+     * @NoAdminRequired
87
+     * @NoCSRFRequired
88
+     *
89
+     * @return DataResponse|Http\FileDisplayResponse
90
+     */
91
+    public function getPreview(
92
+        int $fileId = -1,
93
+        int $x = 128,
94
+        int $y = 128
95
+    ) {
96
+        if ($fileId === -1 || $x === 0 || $y === 0) {
97
+            return new DataResponse([], Http::STATUS_BAD_REQUEST);
98
+        }
99
+
100
+        try {
101
+            $file = $this->trashManager->getTrashNodeById($this->userSession->getUser(), $fileId);
102
+            if ($file === null) {
103
+                return new DataResponse([], Http::STATUS_NOT_FOUND);
104
+            }
105
+            if ($file instanceof Folder) {
106
+                return new DataResponse([], Http::STATUS_BAD_REQUEST);
107
+            }
108
+
109
+            $pathParts = pathinfo($file->getName());
110
+            $extension = $pathParts['extension'] ?? '';
111
+            $fileName = $pathParts['filename'];
112
+            /*
113 113
 			 * Files in the root of the trashbin are timetamped.
114 114
 			 * So we have to strip that in order to properly detect the mimetype of the file.
115 115
 			 */
116
-			if (preg_match('/d\d+/', $extension)) {
117
-				$mimeType = $this->mimeTypeDetector->detectPath($fileName);
118
-			} else {
119
-				$mimeType = $this->mimeTypeDetector->detectPath($file->getName());
120
-			}
121
-
122
-			$f = $this->previewManager->getPreview($file, $x, $y, true, IPreview::MODE_FILL, $mimeType);
123
-			$response = new Http\FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]);
124
-
125
-			// Cache previews for 24H
126
-			$response->cacheFor(3600 * 24);
127
-			return $response;
128
-		} catch (NotFoundException $e) {
129
-			return new DataResponse([], Http::STATUS_NOT_FOUND);
130
-		} catch (\InvalidArgumentException $e) {
131
-			return new DataResponse([], Http::STATUS_BAD_REQUEST);
132
-		}
133
-	}
116
+            if (preg_match('/d\d+/', $extension)) {
117
+                $mimeType = $this->mimeTypeDetector->detectPath($fileName);
118
+            } else {
119
+                $mimeType = $this->mimeTypeDetector->detectPath($file->getName());
120
+            }
121
+
122
+            $f = $this->previewManager->getPreview($file, $x, $y, true, IPreview::MODE_FILL, $mimeType);
123
+            $response = new Http\FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]);
124
+
125
+            // Cache previews for 24H
126
+            $response->cacheFor(3600 * 24);
127
+            return $response;
128
+        } catch (NotFoundException $e) {
129
+            return new DataResponse([], Http::STATUS_NOT_FOUND);
130
+        } catch (\InvalidArgumentException $e) {
131
+            return new DataResponse([], Http::STATUS_BAD_REQUEST);
132
+        }
133
+    }
134 134
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Trash/LegacyTrashBackend.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -35,99 +35,99 @@
 block discarded – undo
35 35
 use OCP\IUser;
36 36
 
37 37
 class LegacyTrashBackend implements ITrashBackend {
38
-	/** @var array */
39
-	private $deletedFiles = [];
38
+    /** @var array */
39
+    private $deletedFiles = [];
40 40
 
41
-	/** @var IRootFolder */
42
-	private $rootFolder;
41
+    /** @var IRootFolder */
42
+    private $rootFolder;
43 43
 
44
-	public function __construct(IRootFolder $rootFolder) {
45
-		$this->rootFolder = $rootFolder;
46
-	}
44
+    public function __construct(IRootFolder $rootFolder) {
45
+        $this->rootFolder = $rootFolder;
46
+    }
47 47
 
48
-	/**
49
-	 * @param array $items
50
-	 * @param IUser $user
51
-	 * @param ITrashItem $parent
52
-	 * @return ITrashItem[]
53
-	 */
54
-	private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array {
55
-		$parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : '';
56
-		$isRoot = $parent === null;
57
-		return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) {
58
-			$originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName();
59
-			if (!$originalLocation) {
60
-				$originalLocation = $file->getName();
61
-			}
62
-			return new TrashItem(
63
-				$this,
64
-				$originalLocation,
65
-				$file->getMTime(),
66
-				$parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''),
67
-				$file,
68
-				$user
69
-			);
70
-		}, $items);
71
-	}
48
+    /**
49
+     * @param array $items
50
+     * @param IUser $user
51
+     * @param ITrashItem $parent
52
+     * @return ITrashItem[]
53
+     */
54
+    private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array {
55
+        $parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : '';
56
+        $isRoot = $parent === null;
57
+        return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) {
58
+            $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName();
59
+            if (!$originalLocation) {
60
+                $originalLocation = $file->getName();
61
+            }
62
+            return new TrashItem(
63
+                $this,
64
+                $originalLocation,
65
+                $file->getMTime(),
66
+                $parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''),
67
+                $file,
68
+                $user
69
+            );
70
+        }, $items);
71
+    }
72 72
 
73
-	public function listTrashRoot(IUser $user): array {
74
-		$entries = Helper::getTrashFiles('/', $user->getUID());
75
-		return $this->mapTrashItems($entries, $user);
76
-	}
73
+    public function listTrashRoot(IUser $user): array {
74
+        $entries = Helper::getTrashFiles('/', $user->getUID());
75
+        return $this->mapTrashItems($entries, $user);
76
+    }
77 77
 
78
-	public function listTrashFolder(ITrashItem $folder): array {
79
-		$user = $folder->getUser();
80
-		$entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID());
81
-		return $this->mapTrashItems($entries, $user ,$folder);
82
-	}
78
+    public function listTrashFolder(ITrashItem $folder): array {
79
+        $user = $folder->getUser();
80
+        $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID());
81
+        return $this->mapTrashItems($entries, $user ,$folder);
82
+    }
83 83
 
84
-	public function restoreItem(ITrashItem $item) {
85
-		Trashbin::restore($item->getTrashPath(), $item->getName(), $item->isRootItem() ? $item->getDeletedTime() : null);
86
-	}
84
+    public function restoreItem(ITrashItem $item) {
85
+        Trashbin::restore($item->getTrashPath(), $item->getName(), $item->isRootItem() ? $item->getDeletedTime() : null);
86
+    }
87 87
 
88
-	public function removeItem(ITrashItem $item) {
89
-		$user = $item->getUser();
90
-		if ($item->isRootItem()) {
91
-			$path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime()));
92
-			Trashbin::delete($path, $user->getUID(), $item->getDeletedTime());
93
-		} else {
94
-			Trashbin::delete($item->getTrashPath(), $user->getUID(), null);
95
-		}
96
-	}
88
+    public function removeItem(ITrashItem $item) {
89
+        $user = $item->getUser();
90
+        if ($item->isRootItem()) {
91
+            $path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime()));
92
+            Trashbin::delete($path, $user->getUID(), $item->getDeletedTime());
93
+        } else {
94
+            Trashbin::delete($item->getTrashPath(), $user->getUID(), null);
95
+        }
96
+    }
97 97
 
98
-	public function moveToTrash(IStorage $storage, string $internalPath): bool {
99
-		if (!$storage instanceof Storage) {
100
-			return false;
101
-		}
102
-		$normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true);
103
-		$view = Filesystem::getView();
104
-		if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) {
105
-			$this->deletedFiles[$normalized] = $normalized;
106
-			if ($filesPath = $view->getRelativePath($normalized)) {
107
-				$filesPath = trim($filesPath, '/');
108
-				$result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath);
109
-			} else {
110
-				$result = false;
111
-			}
112
-			unset($this->deletedFiles[$normalized]);
113
-		} else {
114
-			$result = false;
115
-		}
98
+    public function moveToTrash(IStorage $storage, string $internalPath): bool {
99
+        if (!$storage instanceof Storage) {
100
+            return false;
101
+        }
102
+        $normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true);
103
+        $view = Filesystem::getView();
104
+        if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) {
105
+            $this->deletedFiles[$normalized] = $normalized;
106
+            if ($filesPath = $view->getRelativePath($normalized)) {
107
+                $filesPath = trim($filesPath, '/');
108
+                $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath);
109
+            } else {
110
+                $result = false;
111
+            }
112
+            unset($this->deletedFiles[$normalized]);
113
+        } else {
114
+            $result = false;
115
+        }
116 116
 
117
-		return $result;
118
-	}
117
+        return $result;
118
+    }
119 119
 
120
-	public function getTrashNodeById(IUser $user, int $fileId) {
121
-		try {
122
-			$userFolder = $this->rootFolder->getUserFolder($user->getUID());
123
-			$trash = $userFolder->getParent()->get('files_trashbin/files');
124
-			$trashFiles = $trash->getById($fileId);
125
-			if (!$trashFiles) {
126
-				return null;
127
-			}
128
-			return $trashFiles ? array_pop($trashFiles) : null;
129
-		} catch (NotFoundException $e) {
130
-			return null;
131
-		}
132
-	}
120
+    public function getTrashNodeById(IUser $user, int $fileId) {
121
+        try {
122
+            $userFolder = $this->rootFolder->getUserFolder($user->getUID());
123
+            $trash = $userFolder->getParent()->get('files_trashbin/files');
124
+            $trashFiles = $trash->getById($fileId);
125
+            if (!$trashFiles) {
126
+                return null;
127
+            }
128
+            return $trashFiles ? array_pop($trashFiles) : null;
129
+        } catch (NotFoundException $e) {
130
+            return null;
131
+        }
132
+    }
133 133
 }
Please login to merge, or discard this patch.
core/templates/twofactorselectchallenge.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 			<?php } else { ?>
21 21
 				<strong><?php p($l->t('Two-factor authentication is enforced but has not been configured on your account. Please continue to setup two-factor authentication.')) ?></strong>
22 22
 				<a class="button primary two-factor-primary" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.setupProviders',
23
-					[
24
-						'redirect_url' => $_['redirect_url'],
25
-					]
26
-				)) ?>">
23
+                    [
24
+                        'redirect_url' => $_['redirect_url'],
25
+                    ]
26
+                )) ?>">
27 27
 					<?php p($l->t('Set up two-factor authentication')) ?>
28 28
 				</a>
29 29
 			<?php } ?>
@@ -37,18 +37,18 @@  discard block
 block discarded – undo
37 37
 		<li>
38 38
 			<a class="two-factor-provider"
39 39
 			   href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge',
40
-								[
41
-									'challengeProviderId' => $provider->getId(),
42
-									'redirect_url' => $_['redirect_url'],
43
-								]
44
-							)) ?>">
40
+                                [
41
+                                    'challengeProviderId' => $provider->getId(),
42
+                                    'redirect_url' => $_['redirect_url'],
43
+                                ]
44
+                            )) ?>">
45 45
 				<?php
46
-				if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) {
47
-					$icon = $provider->getLightIcon();
48
-				} else {
49
-					$icon = image_path('core', 'actions/password-white.svg');
50
-				}
51
-				?>
46
+                if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) {
47
+                    $icon = $provider->getLightIcon();
48
+                } else {
49
+                    $icon = image_path('core', 'actions/password-white.svg');
50
+                }
51
+                ?>
52 52
 				<img src="<?php p($icon) ?>" alt="" />
53 53
 				<div>
54 54
 					<h3><?php p($provider->getDisplayName()) ?></h3>
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 	<?php if (!is_null($_['backupProvider'])): ?>
63 63
 	<p>
64 64
 		<a class="<?php if ($noProviders): ?>button primary two-factor-primary<?php else: ?>two-factor-secondary<?php endif ?>" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge',
65
-			[
66
-				'challengeProviderId' => $_['backupProvider']->getId(),
67
-				'redirect_url' => $_['redirect_url'],
68
-			]
69
-		)) ?>">
65
+            [
66
+                'challengeProviderId' => $_['backupProvider']->getId(),
67
+                'redirect_url' => $_['redirect_url'],
68
+            ]
69
+        )) ?>">
70 70
 			<?php p($l->t('Use backup code')) ?>
71 71
 		</a>
72 72
 	</p>
Please login to merge, or discard this patch.
core/Migrations/Version14000Date20180626223656.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -28,42 +28,42 @@
 block discarded – undo
28 28
 use OCP\Migration\SimpleMigrationStep;
29 29
 
30 30
 class Version14000Date20180626223656 extends SimpleMigrationStep {
31
-	public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) {
32
-		/** @var ISchemaWrapper $schema */
33
-		$schema = $schemaClosure();
34
-		if (!$schema->hasTable('whats_new')) {
35
-			$table = $schema->createTable('whats_new');
36
-			$table->addColumn('id', 'integer', [
37
-				'autoincrement' => true,
38
-				'notnull' => true,
39
-				'length' => 4,
40
-				'unsigned' => true,
41
-			]);
42
-			$table->addColumn('version', 'string', [
43
-				'notnull' => true,
44
-				'length' => 64,
45
-				'default' => '11',
46
-			]);
47
-			$table->addColumn('etag', 'string', [
48
-				'notnull' => true,
49
-				'length' => 64,
50
-				'default' => '',
51
-			]);
52
-			$table->addColumn('last_check', 'integer', [
53
-				'notnull' => true,
54
-				'length' => 4,
55
-				'unsigned' => true,
56
-				'default' => 0,
57
-			]);
58
-			$table->addColumn('data', 'text', [
59
-				'notnull' => true,
60
-				'default' => '',
61
-			]);
62
-			$table->setPrimaryKey(['id']);
63
-			$table->addUniqueIndex(['version'], 'version');
64
-			$table->addIndex(['version', 'etag'], 'version_etag_idx');
65
-		}
31
+    public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) {
32
+        /** @var ISchemaWrapper $schema */
33
+        $schema = $schemaClosure();
34
+        if (!$schema->hasTable('whats_new')) {
35
+            $table = $schema->createTable('whats_new');
36
+            $table->addColumn('id', 'integer', [
37
+                'autoincrement' => true,
38
+                'notnull' => true,
39
+                'length' => 4,
40
+                'unsigned' => true,
41
+            ]);
42
+            $table->addColumn('version', 'string', [
43
+                'notnull' => true,
44
+                'length' => 64,
45
+                'default' => '11',
46
+            ]);
47
+            $table->addColumn('etag', 'string', [
48
+                'notnull' => true,
49
+                'length' => 64,
50
+                'default' => '',
51
+            ]);
52
+            $table->addColumn('last_check', 'integer', [
53
+                'notnull' => true,
54
+                'length' => 4,
55
+                'unsigned' => true,
56
+                'default' => 0,
57
+            ]);
58
+            $table->addColumn('data', 'text', [
59
+                'notnull' => true,
60
+                'default' => '',
61
+            ]);
62
+            $table->setPrimaryKey(['id']);
63
+            $table->addUniqueIndex(['version'], 'version');
64
+            $table->addIndex(['version', 'etag'], 'version_etag_idx');
65
+        }
66 66
 
67
-		return $schema;
68
-	}
67
+        return $schema;
68
+    }
69 69
 }
Please login to merge, or discard this patch.
core/Migrations/Version19000Date20200211083441.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -10,36 +10,36 @@
 block discarded – undo
10 10
 use OCP\Migration\SimpleMigrationStep;
11 11
 
12 12
 class Version19000Date20200211083441 extends SimpleMigrationStep {
13
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
14
-		/** @var ISchemaWrapper $schema */
15
-		$schema = $schemaClosure();
13
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
14
+        /** @var ISchemaWrapper $schema */
15
+        $schema = $schemaClosure();
16 16
 
17
-		if (!$schema->hasTable('webauthn')) {
18
-			$table = $schema->createTable('webauthn');
19
-			$table->addColumn('id', 'integer', [
20
-				'autoincrement' => true,
21
-				'notnull' => true,
22
-				'length' => 64,
23
-			]);
24
-			$table->addColumn('uid', 'string', [
25
-				'notnull' => true,
26
-				'length' => 64,
27
-			]);
28
-			$table->addColumn('name', 'string', [
29
-				'notnull' => true,
30
-				'length' => 64,
31
-			]);
32
-			$table->addColumn('public_key_credential_id', 'string', [
33
-				'notnull' => true,
34
-				'length' => 255
35
-			]);
36
-			$table->addColumn('data', 'text', [
37
-				'notnull' => true,
38
-			]);
39
-			$table->setPrimaryKey(['id']);
40
-			$table->addIndex(['uid'], 'webauthn_uid');
41
-			$table->addIndex(['public_key_credential_id'], 'webauthn_publicKeyCredentialId');
42
-		}
43
-		return $schema;
44
-	}
17
+        if (!$schema->hasTable('webauthn')) {
18
+            $table = $schema->createTable('webauthn');
19
+            $table->addColumn('id', 'integer', [
20
+                'autoincrement' => true,
21
+                'notnull' => true,
22
+                'length' => 64,
23
+            ]);
24
+            $table->addColumn('uid', 'string', [
25
+                'notnull' => true,
26
+                'length' => 64,
27
+            ]);
28
+            $table->addColumn('name', 'string', [
29
+                'notnull' => true,
30
+                'length' => 64,
31
+            ]);
32
+            $table->addColumn('public_key_credential_id', 'string', [
33
+                'notnull' => true,
34
+                'length' => 255
35
+            ]);
36
+            $table->addColumn('data', 'text', [
37
+                'notnull' => true,
38
+            ]);
39
+            $table->setPrimaryKey(['id']);
40
+            $table->addIndex(['uid'], 'webauthn_uid');
41
+            $table->addIndex(['public_key_credential_id'], 'webauthn_publicKeyCredentialId');
42
+        }
43
+        return $schema;
44
+    }
45 45
 }
Please login to merge, or discard this patch.
core/Migrations/Version14000Date20180522074438.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -33,31 +33,31 @@
 block discarded – undo
33 33
 use OCP\Migration\SimpleMigrationStep;
34 34
 
35 35
 class Version14000Date20180522074438 extends SimpleMigrationStep {
36
-	public function changeSchema(IOutput $output, Closure $schemaClosure,
37
-								 array $options): ISchemaWrapper {
38
-		$schema = $schemaClosure();
36
+    public function changeSchema(IOutput $output, Closure $schemaClosure,
37
+                                    array $options): ISchemaWrapper {
38
+        $schema = $schemaClosure();
39 39
 
40
-		if (!$schema->hasTable('twofactor_providers')) {
41
-			$table = $schema->createTable('twofactor_providers');
42
-			$table->addColumn('provider_id', 'string',
43
-				[
44
-					'notnull' => true,
45
-					'length' => 32,
46
-				]);
47
-			$table->addColumn('uid', 'string',
48
-				[
49
-					'notnull' => true,
50
-					'length' => 64,
51
-				]);
52
-			$table->addColumn('enabled', 'smallint',
53
-				[
54
-					'notnull' => true,
55
-					'length' => 1,
56
-				]);
57
-			$table->setPrimaryKey(['provider_id', 'uid']);
58
-			$table->addIndex(['uid'], 'twofactor_providers_uid');
59
-		}
40
+        if (!$schema->hasTable('twofactor_providers')) {
41
+            $table = $schema->createTable('twofactor_providers');
42
+            $table->addColumn('provider_id', 'string',
43
+                [
44
+                    'notnull' => true,
45
+                    'length' => 32,
46
+                ]);
47
+            $table->addColumn('uid', 'string',
48
+                [
49
+                    'notnull' => true,
50
+                    'length' => 64,
51
+                ]);
52
+            $table->addColumn('enabled', 'smallint',
53
+                [
54
+                    'notnull' => true,
55
+                    'length' => 1,
56
+                ]);
57
+            $table->setPrimaryKey(['provider_id', 'uid']);
58
+            $table->addIndex(['uid'], 'twofactor_providers_uid');
59
+        }
60 60
 
61
-		return $schema;
62
-	}
61
+        return $schema;
62
+    }
63 63
 }
Please login to merge, or discard this patch.
lib/public/FullTextSearch/Model/ISearchOption.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -36,130 +36,130 @@
 block discarded – undo
36 36
 interface ISearchOption {
37 37
 
38 38
 
39
-	/**
40
-	 * @since 16.0.0
41
-	 */
42
-	public const CHECKBOX = 'checkbox';
43
-
44
-	/**
45
-	 * @since 16.0.0
46
-	 */
47
-	public const INPUT = 'input';
48
-
49
-	/**
50
-	 * @since 16.0.0
51
-	 */
52
-	public const INPUT_SMALL = 'small';
53
-
54
-
55
-	/**
56
-	 * Set the name/key of the option.
57
-	 * The string should only contains alphanumerical chars and underscore.
58
-	 * The key can be retrieve when using ISearchRequest::getOption
59
-	 *
60
-	 * @see ISearchRequest::getOption
61
-	 *
62
-	 * @since 16.0.0
63
-	 *
64
-	 * @param string $name
65
-	 *
66
-	 * @return ISearchOption
67
-	 */
68
-	public function setName(string $name): ISearchOption;
69
-
70
-	/**
71
-	 * Get the name/key of the option.
72
-	 *
73
-	 * @since 16.0.0
74
-	 *
75
-	 * @return string
76
-	 */
77
-	public function getName(): string;
78
-
79
-
80
-	/**
81
-	 * Set the title/display name of the option.
82
-	 *
83
-	 * @since 16.0.0
84
-	 *
85
-	 * @param string $title
86
-	 *
87
-	 * @return ISearchOption
88
-	 */
89
-	public function setTitle(string $title): ISearchOption;
90
-
91
-	/**
92
-	 * Get the title of the option.
93
-	 *
94
-	 * @since 16.0.0
95
-	 *
96
-	 * @return string
97
-	 */
98
-	public function getTitle(): string;
99
-
100
-
101
-	/**
102
-	 * Set the type of the option.
103
-	 * $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT
104
-	 *
105
-	 * @since 16.0.0
106
-	 *
107
-	 * @param string $type
108
-	 *
109
-	 * @return ISearchOption
110
-	 */
111
-	public function setType(string $type): ISearchOption;
112
-
113
-	/**
114
-	 * Get the type of the option.
115
-	 *
116
-	 * @since 16.0.0
117
-	 *
118
-	 * @return string
119
-	 */
120
-	public function getType(): string;
121
-
122
-
123
-	/**
124
-	 * In case of Type is INPUT, set the size of the input field.
125
-	 * Value can be ISearchOption::INPUT_SMALL or not defined.
126
-	 *
127
-	 * @since 16.0.0
128
-	 *
129
-	 * @param string $size
130
-	 *
131
-	 * @return ISearchOption
132
-	 */
133
-	public function setSize(string $size): ISearchOption;
134
-
135
-	/**
136
-	 * Get the size of the INPUT.
137
-	 *
138
-	 * @since 16.0.0
139
-	 *
140
-	 * @return string
141
-	 */
142
-	public function getSize(): string;
143
-
144
-
145
-	/**
146
-	 * In case of Type is , set the placeholder to be displayed in the input
147
-	 * field.
148
-	 *
149
-	 * @since 16.0.0
150
-	 *
151
-	 * @param string $placeholder
152
-	 *
153
-	 * @return ISearchOption
154
-	 */
155
-	public function setPlaceholder(string $placeholder): ISearchOption;
156
-
157
-	/**
158
-	 * Get the placeholder.
159
-	 *
160
-	 * @since 16.0.0
161
-	 *
162
-	 * @return string
163
-	 */
164
-	public function getPlaceholder(): string;
39
+    /**
40
+     * @since 16.0.0
41
+     */
42
+    public const CHECKBOX = 'checkbox';
43
+
44
+    /**
45
+     * @since 16.0.0
46
+     */
47
+    public const INPUT = 'input';
48
+
49
+    /**
50
+     * @since 16.0.0
51
+     */
52
+    public const INPUT_SMALL = 'small';
53
+
54
+
55
+    /**
56
+     * Set the name/key of the option.
57
+     * The string should only contains alphanumerical chars and underscore.
58
+     * The key can be retrieve when using ISearchRequest::getOption
59
+     *
60
+     * @see ISearchRequest::getOption
61
+     *
62
+     * @since 16.0.0
63
+     *
64
+     * @param string $name
65
+     *
66
+     * @return ISearchOption
67
+     */
68
+    public function setName(string $name): ISearchOption;
69
+
70
+    /**
71
+     * Get the name/key of the option.
72
+     *
73
+     * @since 16.0.0
74
+     *
75
+     * @return string
76
+     */
77
+    public function getName(): string;
78
+
79
+
80
+    /**
81
+     * Set the title/display name of the option.
82
+     *
83
+     * @since 16.0.0
84
+     *
85
+     * @param string $title
86
+     *
87
+     * @return ISearchOption
88
+     */
89
+    public function setTitle(string $title): ISearchOption;
90
+
91
+    /**
92
+     * Get the title of the option.
93
+     *
94
+     * @since 16.0.0
95
+     *
96
+     * @return string
97
+     */
98
+    public function getTitle(): string;
99
+
100
+
101
+    /**
102
+     * Set the type of the option.
103
+     * $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT
104
+     *
105
+     * @since 16.0.0
106
+     *
107
+     * @param string $type
108
+     *
109
+     * @return ISearchOption
110
+     */
111
+    public function setType(string $type): ISearchOption;
112
+
113
+    /**
114
+     * Get the type of the option.
115
+     *
116
+     * @since 16.0.0
117
+     *
118
+     * @return string
119
+     */
120
+    public function getType(): string;
121
+
122
+
123
+    /**
124
+     * In case of Type is INPUT, set the size of the input field.
125
+     * Value can be ISearchOption::INPUT_SMALL or not defined.
126
+     *
127
+     * @since 16.0.0
128
+     *
129
+     * @param string $size
130
+     *
131
+     * @return ISearchOption
132
+     */
133
+    public function setSize(string $size): ISearchOption;
134
+
135
+    /**
136
+     * Get the size of the INPUT.
137
+     *
138
+     * @since 16.0.0
139
+     *
140
+     * @return string
141
+     */
142
+    public function getSize(): string;
143
+
144
+
145
+    /**
146
+     * In case of Type is , set the placeholder to be displayed in the input
147
+     * field.
148
+     *
149
+     * @since 16.0.0
150
+     *
151
+     * @param string $placeholder
152
+     *
153
+     * @return ISearchOption
154
+     */
155
+    public function setPlaceholder(string $placeholder): ISearchOption;
156
+
157
+    /**
158
+     * Get the placeholder.
159
+     *
160
+     * @since 16.0.0
161
+     *
162
+     * @return string
163
+     */
164
+    public function getPlaceholder(): string;
165 165
 }
Please login to merge, or discard this patch.