Completed
Pull Request — master (#3838)
by Vars
12:18
created
apps/comments/lib/Controller/Notifications.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
 	public function view($id) {
94 94
 		try {
95 95
 			$comment = $this->commentsManager->get($id);
96
-			if($comment->getObjectType() !== 'files') {
96
+			if ($comment->getObjectType() !== 'files') {
97 97
 				return new NotFoundResponse();
98 98
 			}
99 99
 			$files = $this->folder->getById($comment->getObjectId());
100
-			if(count($files) === 0) {
100
+			if (count($files) === 0) {
101 101
 				$this->markProcessed($comment);
102 102
 				return new NotFoundResponse();
103 103
 			}
104 104
 
105 105
 			$url = $this->urlGenerator->linkToRouteAbsolute(
106 106
 				'files.viewcontroller.showFile',
107
-				[ 'fileid' => $comment->getObjectId() ]
107
+				['fileid' => $comment->getObjectId()]
108 108
 			);
109 109
 
110 110
 			$this->markProcessed($comment);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function markProcessed(IComment $comment) {
123 123
 		$user = $this->userSession->getUser();
124
-		if(is_null($user)) {
124
+		if (is_null($user)) {
125 125
 			return;
126 126
 		}
127 127
 		$notification = $this->notificationManager->createNotification();
Please login to merge, or discard this patch.
apps/comments/lib/AppInfo/Application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 
27 27
 class Application extends App {
28 28
 
29
-	public function __construct (array $urlParams = array()) {
29
+	public function __construct(array $urlParams = array()) {
30 30
 		parent::__construct('comments', $urlParams);
31 31
 		$container = $this->getContainer();
32 32
 
Please login to merge, or discard this patch.
apps/comments/lib/EventHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	 * @param CommentsEvent $event
52 52
 	 */
53 53
 	public function handle(CommentsEvent $event) {
54
-		if($event->getComment()->getObjectType() !== 'files') {
54
+		if ($event->getComment()->getObjectType() !== 'files') {
55 55
 			// this is a 'files'-specific Handler
56 56
 			return;
57 57
 		}
58 58
 
59 59
 		$eventType = $event->getEvent();
60
-		if( $eventType === CommentsEvent::EVENT_ADD
60
+		if ($eventType === CommentsEvent::EVENT_ADD
61 61
 		) {
62 62
 			$this->notificationHandler($event);
63 63
 			$this->activityHandler($event);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			CommentsEvent::EVENT_UPDATE,
70 70
 			CommentsEvent::EVENT_DELETE,
71 71
 		];
72
-		if(in_array($eventType, $applicableEvents)) {
72
+		if (in_array($eventType, $applicableEvents)) {
73 73
 			$this->notificationHandler($event);
74 74
 			return;
75 75
 		}
Please login to merge, or discard this patch.
apps/comments/appinfo/app.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 		$application = new \OCP\AppFramework\App('comments');
51 51
 		return $application->getContainer()->query(\OCA\Comments\Notification\Notifier::class);
52 52
 	},
53
-	function () {
53
+	function() {
54 54
 		$l = \OC::$server->getL10N('comments');
55 55
 		return ['id' => 'comments', 'name' => $l->t('Comments')];
56 56
 	}
57 57
 );
58 58
 
59 59
 $commentsManager = \OC::$server->getCommentsManager();
60
-$commentsManager->registerEventHandler(function () {
60
+$commentsManager->registerEventHandler(function() {
61 61
 	$application = new \OCP\AppFramework\App('comments');
62 62
 	/** @var \OCA\Comments\EventHandler $handler */
63 63
 	$handler = $application->getContainer()->query(\OCA\Comments\EventHandler::class);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 $commentsManager->registerDisplayNameResolver('user', function($id) {
67 67
 	$manager = \OC::$server->getUserManager();
68 68
 	$user = $manager->get($id);
69
-	if(is_null($user)) {
69
+	if (is_null($user)) {
70 70
 		$l = \OC::$server->getL10N('comments');
71 71
 		$displayName = $l->t('Unknown user');
72 72
 	} else {
Please login to merge, or discard this patch.
apps/files_trashbin/templates/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 					<label for="select_all_trash">
28 28
 						<span class="hidden-visually"><?php p($l->t('Select all'))?></span>
29 29
 					</label>
30
-					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a>
30
+					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a>
31 31
 					<span id="selectedActionsList" class='selectedActions'>
32 32
 						<a href="" class="undelete">
33 33
 							<span class="icon icon-history"></span>
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 				</div>
38 38
 			</th>
39 39
 			<th id="headerDate" class="hidden column-mtime">
40
-				<a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Deleted' )); ?></span><span class="sort-indicator"></span></a>
40
+				<a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t('Deleted')); ?></span><span class="sort-indicator"></span></a>
41 41
 				<span class="selectedActions">
42 42
 					<a href="" class="delete-selected">
43 43
 						<span><?php p($l->t('Delete'))?></span>
Please login to merge, or discard this patch.
apps/files_trashbin/ajax/undelete.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 
32 32
 $dir = '/';
33 33
 if (isset($_POST['dir'])) {
34
-	$dir = rtrim((string)$_POST['dir'], '/'). '/';
34
+	$dir = rtrim((string) $_POST['dir'], '/').'/';
35 35
 }
36 36
 $allFiles = false;
37
-if (isset($_POST['allfiles']) && (string)$_POST['allfiles'] === 'true') {
37
+if (isset($_POST['allfiles']) && (string) $_POST['allfiles'] === 'true') {
38 38
 	$allFiles = true;
39 39
 	$list = array();
40 40
 	$dirListing = true;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	foreach (OCA\Files_Trashbin\Helper::getTrashFiles($dir, \OCP\User::getUser()) as $file) {
45 45
 		$fileName = $file['name'];
46 46
 		if (!$dirListing) {
47
-			$fileName .= '.d' . $file['mtime'];
47
+			$fileName .= '.d'.$file['mtime'];
48 48
 		}
49 49
 		$list[] = $fileName;
50 50
 	}
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 
58 58
 $i = 0;
59 59
 foreach ($list as $file) {
60
-	$path = $dir . '/' . $file;
60
+	$path = $dir.'/'.$file;
61 61
 	if ($dir === '/') {
62 62
 		$file = ltrim($file, '/');
63 63
 		$delimiter = strrpos($file, '.d');
64 64
 		$filename = substr($file, 0, $delimiter);
65
-		$timestamp =  substr($file, $delimiter+2);
65
+		$timestamp = substr($file, $delimiter + 2);
66 66
 	} else {
67 67
 		$path_parts = pathinfo($file);
68 68
 		$filename = $path_parts['basename'];
69 69
 		$timestamp = null;
70 70
 	}
71 71
 
72
-	if ( !OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp) ) {
72
+	if (!OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp)) {
73 73
 		$error[] = $filename;
74
-		\OCP\Util::writeLog('trashbin', 'can\'t restore ' . $filename, \OCP\Util::ERROR);
74
+		\OCP\Util::writeLog('trashbin', 'can\'t restore '.$filename, \OCP\Util::ERROR);
75 75
 	} else {
76 76
 		$success[$i]['filename'] = $file;
77 77
 		$success[$i]['timestamp'] = $timestamp;
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 
81 81
 }
82 82
 
83
-if ( $error ) {
83
+if ($error) {
84 84
 	$filelist = '';
85
-	foreach ( $error as $e ) {
85
+	foreach ($error as $e) {
86 86
 		$filelist .= $e.', ';
87 87
 	}
88 88
 	$l = OC::$server->getL10N('files_trashbin');
Please login to merge, or discard this patch.
apps/files_trashbin/ajax/list.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
 \OC::$server->getSession()->close();
26 26
 
27 27
 // Load the files
28
-$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
29
-$sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name';
28
+$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : '';
29
+$sortAttribute = isset($_GET['sort']) ? (string) $_GET['sort'] : 'name';
30 30
 $sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false;
31 31
 $data = array();
32 32
 
Please login to merge, or discard this patch.
apps/files_trashbin/ajax/delete.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 $folder = isset($_POST['dir']) ? $_POST['dir'] : '/';
32 32
 
33 33
 // "empty trash" command
34
-if (isset($_POST['allfiles']) && (string)$_POST['allfiles'] === 'true'){
34
+if (isset($_POST['allfiles']) && (string) $_POST['allfiles'] === 'true') {
35 35
 	$deleteAll = true;
36 36
 	if ($folder === '/' || $folder === '') {
37 37
 		OCA\Files_Trashbin\Trashbin::deleteAll();
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 }
44 44
 else {
45 45
 	$deleteAll = false;
46
-	$files = (string)$_POST['files'];
46
+	$files = (string) $_POST['files'];
47 47
 	$list = json_decode($files);
48 48
 }
49 49
 
50
-$folder = rtrim($folder, '/') . '/';
50
+$folder = rtrim($folder, '/').'/';
51 51
 $error = array();
52 52
 $success = array();
53 53
 
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 		$file = ltrim($file, '/');
58 58
 		$delimiter = strrpos($file, '.d');
59 59
 		$filename = substr($file, 0, $delimiter);
60
-		$timestamp =  substr($file, $delimiter+2);
60
+		$timestamp = substr($file, $delimiter + 2);
61 61
 	} else {
62
-		$filename = $folder . '/' . $file;
62
+		$filename = $folder.'/'.$file;
63 63
 		$timestamp = null;
64 64
 	}
65 65
 
66 66
 	OCA\Files_Trashbin\Trashbin::delete($filename, \OCP\User::getUser(), $timestamp);
67 67
 	if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
68 68
 		$error[] = $filename;
69
-		\OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', \OCP\Util::ERROR);
69
+		\OCP\Util::writeLog('trashbin', 'can\'t delete '.$filename.' permanently.', \OCP\Util::ERROR);
70 70
 	}
71 71
 	// only list deleted files if not deleting everything
72 72
 	else if (!$deleteAll) {
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	}
77 77
 }
78 78
 
79
-if ( $error ) {
79
+if ($error) {
80 80
 	$filelist = '';
81
-	foreach ( $error as $e ) {
81
+	foreach ($error as $e) {
82 82
 		$filelist .= $e.', ';
83 83
 	}
84 84
 	$l = \OC::$server->getL10N('files_trashbin');
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Storage.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			if ($currentUser) {
88 88
 				$currentUserId = $currentUser->getUID();
89 89
 
90
-				$view = new View($currentUserId . '/files');
90
+				$view = new View($currentUserId.'/files');
91 91
 				$fileInfo = $view->getFileInfo($oldPath);
92 92
 				if ($fileInfo) {
93 93
 					$sourceStorage = $fileInfo->getStorage();
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 		} catch (\Exception $e) {
105 105
 			// do nothing, in this case we just disable the trashbin and continue
106 106
 			$logger = \OC::$server->getLogger();
107
-			$logger->debug('Trashbin storage could not check if a file was moved out of a shared folder: ' . $e->getMessage());
107
+			$logger->debug('Trashbin storage could not check if a file was moved out of a shared folder: '.$e->getMessage());
108 108
 		}
109 109
 
110
-		if($fileMovedOutOfSharedFolder) {
111
-			self::$moveOutOfSharedFolder['/' . $currentUserId . '/files' . $oldPath] = true;
110
+		if ($fileMovedOutOfSharedFolder) {
111
+			self::$moveOutOfSharedFolder['/'.$currentUserId.'/files'.$oldPath] = true;
112 112
 		} else {
113 113
 			self::$disableTrash = true;
114 114
 		}
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * @return bool true if the operation succeeded, false otherwise
148 148
 	 */
149 149
 	public function unlink($path) {
150
-		if (isset(self::$moveOutOfSharedFolder[$this->mountPoint . $path])) {
150
+		if (isset(self::$moveOutOfSharedFolder[$this->mountPoint.$path])) {
151 151
 			$result = $this->doDelete($path, 'unlink', true);
152
-			unset(self::$moveOutOfSharedFolder[$this->mountPoint . $path]);
152
+			unset(self::$moveOutOfSharedFolder[$this->mountPoint.$path]);
153 153
 		} else {
154 154
 			$result = $this->doDelete($path, 'unlink');
155 155
 		}
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 * @return bool true if the operation succeeded, false otherwise
166 166
 	 */
167 167
 	public function rmdir($path) {
168
-		if (isset(self::$moveOutOfSharedFolder[$this->mountPoint . $path])) {
168
+		if (isset(self::$moveOutOfSharedFolder[$this->mountPoint.$path])) {
169 169
 			$result = $this->doDelete($path, 'rmdir', true);
170
-			unset(self::$moveOutOfSharedFolder[$this->mountPoint . $path]);
170
+			unset(self::$moveOutOfSharedFolder[$this->mountPoint.$path]);
171 171
 		} else {
172 172
 			$result = $this->doDelete($path, 'rmdir');
173 173
 		}
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	 * @param $path
183 183
 	 * @return bool
184 184
 	 */
185
-	protected function shouldMoveToTrash($path){
186
-		$normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
185
+	protected function shouldMoveToTrash($path) {
186
+		$normalized = Filesystem::normalizePath($this->mountPoint.'/'.$path);
187 187
 		$parts = explode('/', $normalized);
188 188
 		if (count($parts) < 4) {
189 189
 			return false;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			return false;
221 221
 		}
222 222
 
223
-		$normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path, true, false, true);
223
+		$normalized = Filesystem::normalizePath($this->mountPoint.'/'.$path, true, false, true);
224 224
 		$result = true;
225 225
 		$view = Filesystem::getView();
226 226
 		if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 * Setup the storate wrapper callback
249 249
 	 */
250 250
 	public static function setupStorage() {
251
-		\OC\Files\Filesystem::addStorageWrapper('oc_trashbin', function ($mountPoint, $storage) {
251
+		\OC\Files\Filesystem::addStorageWrapper('oc_trashbin', function($mountPoint, $storage) {
252 252
 			return new \OCA\Files_Trashbin\Storage(
253 253
 				array('storage' => $storage, 'mountPoint' => $mountPoint),
254 254
 				\OC::$server->getUserManager()
Please login to merge, or discard this patch.