Passed
Push — master ( 61d22f...88b2d8 )
by Roeland
08:51 queued 11s
created
apps/comments/composer/composer/autoload_static.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,40 +6,40 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitComments
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\Comments\\' => 13,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\Comments\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'OCA\\Comments\\Activity\\Filter' => __DIR__ . '/..' . '/../lib/Activity/Filter.php',
25
-        'OCA\\Comments\\Activity\\Listener' => __DIR__ . '/..' . '/../lib/Activity/Listener.php',
26
-        'OCA\\Comments\\Activity\\Provider' => __DIR__ . '/..' . '/../lib/Activity/Provider.php',
27
-        'OCA\\Comments\\Activity\\Setting' => __DIR__ . '/..' . '/../lib/Activity/Setting.php',
28
-        'OCA\\Comments\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
29
-        'OCA\\Comments\\Collaboration\\CommentersSorter' => __DIR__ . '/..' . '/../lib/Collaboration/CommentersSorter.php',
30
-        'OCA\\Comments\\Controller\\Notifications' => __DIR__ . '/..' . '/../lib/Controller/Notifications.php',
31
-        'OCA\\Comments\\EventHandler' => __DIR__ . '/..' . '/../lib/EventHandler.php',
32
-        'OCA\\Comments\\JSSettingsHelper' => __DIR__ . '/..' . '/../lib/JSSettingsHelper.php',
33
-        'OCA\\Comments\\Listener\\LoadAdditionalScripts' => __DIR__ . '/..' . '/../lib/Listener/LoadAdditionalScripts.php',
34
-        'OCA\\Comments\\Notification\\Listener' => __DIR__ . '/..' . '/../lib/Notification/Listener.php',
35
-        'OCA\\Comments\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
36
-        'OCA\\Comments\\Search\\Provider' => __DIR__ . '/..' . '/../lib/Search/Provider.php',
37
-        'OCA\\Comments\\Search\\Result' => __DIR__ . '/..' . '/../lib/Search/Result.php',
23
+    public static $classMap = array(
24
+        'OCA\\Comments\\Activity\\Filter' => __DIR__.'/..'.'/../lib/Activity/Filter.php',
25
+        'OCA\\Comments\\Activity\\Listener' => __DIR__.'/..'.'/../lib/Activity/Listener.php',
26
+        'OCA\\Comments\\Activity\\Provider' => __DIR__.'/..'.'/../lib/Activity/Provider.php',
27
+        'OCA\\Comments\\Activity\\Setting' => __DIR__.'/..'.'/../lib/Activity/Setting.php',
28
+        'OCA\\Comments\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
29
+        'OCA\\Comments\\Collaboration\\CommentersSorter' => __DIR__.'/..'.'/../lib/Collaboration/CommentersSorter.php',
30
+        'OCA\\Comments\\Controller\\Notifications' => __DIR__.'/..'.'/../lib/Controller/Notifications.php',
31
+        'OCA\\Comments\\EventHandler' => __DIR__.'/..'.'/../lib/EventHandler.php',
32
+        'OCA\\Comments\\JSSettingsHelper' => __DIR__.'/..'.'/../lib/JSSettingsHelper.php',
33
+        'OCA\\Comments\\Listener\\LoadAdditionalScripts' => __DIR__.'/..'.'/../lib/Listener/LoadAdditionalScripts.php',
34
+        'OCA\\Comments\\Notification\\Listener' => __DIR__.'/..'.'/../lib/Notification/Listener.php',
35
+        'OCA\\Comments\\Notification\\Notifier' => __DIR__.'/..'.'/../lib/Notification/Notifier.php',
36
+        'OCA\\Comments\\Search\\Provider' => __DIR__.'/..'.'/../lib/Search/Provider.php',
37
+        'OCA\\Comments\\Search\\Result' => __DIR__.'/..'.'/../lib/Search/Result.php',
38 38
     );
39 39
 
40 40
     public static function getInitializer(ClassLoader $loader)
41 41
     {
42
-        return \Closure::bind(function () use ($loader) {
42
+        return \Closure::bind(function() use ($loader) {
43 43
             $loader->prefixLengthsPsr4 = ComposerStaticInitComments::$prefixLengthsPsr4;
44 44
             $loader->prefixDirsPsr4 = ComposerStaticInitComments::$prefixDirsPsr4;
45 45
             $loader->classMap = ComposerStaticInitComments::$classMap;
Please login to merge, or discard this patch.
apps/comments/composer/composer/autoload_classmap.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\Comments\\Activity\\Filter' => $baseDir . '/../lib/Activity/Filter.php',
10
-    'OCA\\Comments\\Activity\\Listener' => $baseDir . '/../lib/Activity/Listener.php',
11
-    'OCA\\Comments\\Activity\\Provider' => $baseDir . '/../lib/Activity/Provider.php',
12
-    'OCA\\Comments\\Activity\\Setting' => $baseDir . '/../lib/Activity/Setting.php',
13
-    'OCA\\Comments\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
14
-    'OCA\\Comments\\Collaboration\\CommentersSorter' => $baseDir . '/../lib/Collaboration/CommentersSorter.php',
15
-    'OCA\\Comments\\Controller\\Notifications' => $baseDir . '/../lib/Controller/Notifications.php',
16
-    'OCA\\Comments\\EventHandler' => $baseDir . '/../lib/EventHandler.php',
17
-    'OCA\\Comments\\JSSettingsHelper' => $baseDir . '/../lib/JSSettingsHelper.php',
18
-    'OCA\\Comments\\Listener\\LoadAdditionalScripts' => $baseDir . '/../lib/Listener/LoadAdditionalScripts.php',
19
-    'OCA\\Comments\\Notification\\Listener' => $baseDir . '/../lib/Notification/Listener.php',
20
-    'OCA\\Comments\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
21
-    'OCA\\Comments\\Search\\Provider' => $baseDir . '/../lib/Search/Provider.php',
22
-    'OCA\\Comments\\Search\\Result' => $baseDir . '/../lib/Search/Result.php',
9
+    'OCA\\Comments\\Activity\\Filter' => $baseDir.'/../lib/Activity/Filter.php',
10
+    'OCA\\Comments\\Activity\\Listener' => $baseDir.'/../lib/Activity/Listener.php',
11
+    'OCA\\Comments\\Activity\\Provider' => $baseDir.'/../lib/Activity/Provider.php',
12
+    'OCA\\Comments\\Activity\\Setting' => $baseDir.'/../lib/Activity/Setting.php',
13
+    'OCA\\Comments\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
14
+    'OCA\\Comments\\Collaboration\\CommentersSorter' => $baseDir.'/../lib/Collaboration/CommentersSorter.php',
15
+    'OCA\\Comments\\Controller\\Notifications' => $baseDir.'/../lib/Controller/Notifications.php',
16
+    'OCA\\Comments\\EventHandler' => $baseDir.'/../lib/EventHandler.php',
17
+    'OCA\\Comments\\JSSettingsHelper' => $baseDir.'/../lib/JSSettingsHelper.php',
18
+    'OCA\\Comments\\Listener\\LoadAdditionalScripts' => $baseDir.'/../lib/Listener/LoadAdditionalScripts.php',
19
+    'OCA\\Comments\\Notification\\Listener' => $baseDir.'/../lib/Notification/Listener.php',
20
+    'OCA\\Comments\\Notification\\Notifier' => $baseDir.'/../lib/Notification/Notifier.php',
21
+    'OCA\\Comments\\Search\\Provider' => $baseDir.'/../lib/Search/Provider.php',
22
+    'OCA\\Comments\\Search\\Result' => $baseDir.'/../lib/Search/Result.php',
23 23
 );
Please login to merge, or discard this patch.
apps/comments/lib/Listener/LoadAdditionalScripts.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@
 block discarded – undo
30 30
 use OCP\Util;
31 31
 
32 32
 class LoadAdditionalScripts implements IEventListener {
33
-	public function handle(Event $event): void {
34
-		if (!($event instanceof LoadAdditionalScriptsEvent)) {
35
-			return;
36
-		}
33
+    public function handle(Event $event): void {
34
+        if (!($event instanceof LoadAdditionalScriptsEvent)) {
35
+            return;
36
+        }
37 37
 
38
-		Util::addScript('comments', 'comments');
39
-	}
38
+        Util::addScript('comments', 'comments');
39
+    }
40 40
 
41 41
 }
Please login to merge, or discard this patch.
apps/comments/lib/AppInfo/Application.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -38,49 +38,49 @@
 block discarded – undo
38 38
 
39 39
 class Application extends App {
40 40
 
41
-	public function __construct (array $urlParams = array()) {
42
-		parent::__construct('comments', $urlParams);
43
-		$container = $this->getContainer();
41
+    public function __construct (array $urlParams = array()) {
42
+        parent::__construct('comments', $urlParams);
43
+        $container = $this->getContainer();
44 44
 
45
-		$container->registerAlias('NotificationsController', Notifications::class);
45
+        $container->registerAlias('NotificationsController', Notifications::class);
46 46
 
47
-		$jsSettingsHelper = new JSSettingsHelper($container->getServer());
48
-		Util::connectHook('\OCP\Config', 'js', $jsSettingsHelper, 'extend');
49
-	}
47
+        $jsSettingsHelper = new JSSettingsHelper($container->getServer());
48
+        Util::connectHook('\OCP\Config', 'js', $jsSettingsHelper, 'extend');
49
+    }
50 50
 
51
-	public function register() {
52
-		$server = $this->getContainer()->getServer();
51
+    public function register() {
52
+        $server = $this->getContainer()->getServer();
53 53
 
54
-		/** @var IEventDispatcher $newDispatcher */
55
-		$dispatcher = $server->query(IEventDispatcher::class);
56
-		$this->registerSidebarScripts($dispatcher);
57
-		$this->registerDavEntity($dispatcher);
58
-		$this->registerNotifier();
59
-		$this->registerCommentsEventHandler();
54
+        /** @var IEventDispatcher $newDispatcher */
55
+        $dispatcher = $server->query(IEventDispatcher::class);
56
+        $this->registerSidebarScripts($dispatcher);
57
+        $this->registerDavEntity($dispatcher);
58
+        $this->registerNotifier();
59
+        $this->registerCommentsEventHandler();
60 60
 
61
-		$server->getSearch()->registerProvider(Provider::class, ['apps' => ['files']]);
62
-	}
61
+        $server->getSearch()->registerProvider(Provider::class, ['apps' => ['files']]);
62
+    }
63 63
 
64
-	protected function registerSidebarScripts(IEventDispatcher $dispatcher) {
65
-		$dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScripts::class);
66
-	}
64
+    protected function registerSidebarScripts(IEventDispatcher $dispatcher) {
65
+        $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScripts::class);
66
+    }
67 67
 
68
-	protected function registerDavEntity(IEventDispatcher $dispatcher) {
69
-		$dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
70
-			$event->addEntityCollection('files', function($name) {
71
-				$nodes = \OC::$server->getUserFolder()->getById((int)$name);
72
-				return !empty($nodes);
73
-			});
74
-		});
75
-	}
68
+    protected function registerDavEntity(IEventDispatcher $dispatcher) {
69
+        $dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
70
+            $event->addEntityCollection('files', function($name) {
71
+                $nodes = \OC::$server->getUserFolder()->getById((int)$name);
72
+                return !empty($nodes);
73
+            });
74
+        });
75
+    }
76 76
 
77
-	protected function registerNotifier() {
78
-		$this->getContainer()->getServer()->getNotificationManager()->registerNotifierService(Notifier::class);
79
-	}
77
+    protected function registerNotifier() {
78
+        $this->getContainer()->getServer()->getNotificationManager()->registerNotifierService(Notifier::class);
79
+    }
80 80
 
81
-	protected function registerCommentsEventHandler() {
82
-		$this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function () {
83
-			return $this->getContainer()->query(EventHandler::class);
84
-		});
85
-	}
81
+    protected function registerCommentsEventHandler() {
82
+        $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function () {
83
+            return $this->getContainer()->query(EventHandler::class);
84
+        });
85
+    }
86 86
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 class Application extends App {
40 40
 
41
-	public function __construct (array $urlParams = array()) {
41
+	public function __construct(array $urlParams = array()) {
42 42
 		parent::__construct('comments', $urlParams);
43 43
 		$container = $this->getContainer();
44 44
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	protected function registerDavEntity(IEventDispatcher $dispatcher) {
69 69
 		$dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
70 70
 			$event->addEntityCollection('files', function($name) {
71
-				$nodes = \OC::$server->getUserFolder()->getById((int)$name);
71
+				$nodes = \OC::$server->getUserFolder()->getById((int) $name);
72 72
 				return !empty($nodes);
73 73
 			});
74 74
 		});
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	}
80 80
 
81 81
 	protected function registerCommentsEventHandler() {
82
-		$this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function () {
82
+		$this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function() {
83 83
 			return $this->getContainer()->query(EventHandler::class);
84 84
 		});
85 85
 	}
Please login to merge, or discard this patch.
apps/files/composer/composer/autoload_static.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,56 +6,56 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitFiles
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\Files\\' => 10,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\Files\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'OCA\\Files\\Activity\\FavoriteProvider' => __DIR__ . '/..' . '/../lib/Activity/FavoriteProvider.php',
25
-        'OCA\\Files\\Activity\\Filter\\Favorites' => __DIR__ . '/..' . '/../lib/Activity/Filter/Favorites.php',
26
-        'OCA\\Files\\Activity\\Filter\\FileChanges' => __DIR__ . '/..' . '/../lib/Activity/Filter/FileChanges.php',
27
-        'OCA\\Files\\Activity\\Helper' => __DIR__ . '/..' . '/../lib/Activity/Helper.php',
28
-        'OCA\\Files\\Activity\\Provider' => __DIR__ . '/..' . '/../lib/Activity/Provider.php',
29
-        'OCA\\Files\\Activity\\Settings\\FavoriteAction' => __DIR__ . '/..' . '/../lib/Activity/Settings/FavoriteAction.php',
30
-        'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileChanged.php',
31
-        'OCA\\Files\\Activity\\Settings\\FileCreated' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileCreated.php',
32
-        'OCA\\Files\\Activity\\Settings\\FileDeleted' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileDeleted.php',
33
-        'OCA\\Files\\Activity\\Settings\\FileFavorite' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileFavorite.php',
34
-        'OCA\\Files\\Activity\\Settings\\FileRestored' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileRestored.php',
35
-        'OCA\\Files\\App' => __DIR__ . '/..' . '/../lib/App.php',
36
-        'OCA\\Files\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
37
-        'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupFileLocks.php',
38
-        'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => __DIR__ . '/..' . '/../lib/BackgroundJob/DeleteOrphanedItems.php',
39
-        'OCA\\Files\\BackgroundJob\\ScanFiles' => __DIR__ . '/..' . '/../lib/BackgroundJob/ScanFiles.php',
40
-        'OCA\\Files\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
41
-        'OCA\\Files\\Collaboration\\Resources\\Listener' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/Listener.php',
42
-        'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/ResourceProvider.php',
43
-        'OCA\\Files\\Command\\DeleteOrphanedFiles' => __DIR__ . '/..' . '/../lib/Command/DeleteOrphanedFiles.php',
44
-        'OCA\\Files\\Command\\Scan' => __DIR__ . '/..' . '/../lib/Command/Scan.php',
45
-        'OCA\\Files\\Command\\ScanAppData' => __DIR__ . '/..' . '/../lib/Command/ScanAppData.php',
46
-        'OCA\\Files\\Command\\TransferOwnership' => __DIR__ . '/..' . '/../lib/Command/TransferOwnership.php',
47
-        'OCA\\Files\\Controller\\AjaxController' => __DIR__ . '/..' . '/../lib/Controller/AjaxController.php',
48
-        'OCA\\Files\\Controller\\ApiController' => __DIR__ . '/..' . '/../lib/Controller/ApiController.php',
49
-        'OCA\\Files\\Controller\\ViewController' => __DIR__ . '/..' . '/../lib/Controller/ViewController.php',
50
-        'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => __DIR__ . '/..' . '/../lib/Event/LoadAdditionalScriptsEvent.php',
51
-        'OCA\\Files\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
52
-        'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => __DIR__ . '/..' . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
53
-        'OCA\\Files\\Service\\TagService' => __DIR__ . '/..' . '/../lib/Service/TagService.php',
23
+    public static $classMap = array(
24
+        'OCA\\Files\\Activity\\FavoriteProvider' => __DIR__.'/..'.'/../lib/Activity/FavoriteProvider.php',
25
+        'OCA\\Files\\Activity\\Filter\\Favorites' => __DIR__.'/..'.'/../lib/Activity/Filter/Favorites.php',
26
+        'OCA\\Files\\Activity\\Filter\\FileChanges' => __DIR__.'/..'.'/../lib/Activity/Filter/FileChanges.php',
27
+        'OCA\\Files\\Activity\\Helper' => __DIR__.'/..'.'/../lib/Activity/Helper.php',
28
+        'OCA\\Files\\Activity\\Provider' => __DIR__.'/..'.'/../lib/Activity/Provider.php',
29
+        'OCA\\Files\\Activity\\Settings\\FavoriteAction' => __DIR__.'/..'.'/../lib/Activity/Settings/FavoriteAction.php',
30
+        'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__.'/..'.'/../lib/Activity/Settings/FileChanged.php',
31
+        'OCA\\Files\\Activity\\Settings\\FileCreated' => __DIR__.'/..'.'/../lib/Activity/Settings/FileCreated.php',
32
+        'OCA\\Files\\Activity\\Settings\\FileDeleted' => __DIR__.'/..'.'/../lib/Activity/Settings/FileDeleted.php',
33
+        'OCA\\Files\\Activity\\Settings\\FileFavorite' => __DIR__.'/..'.'/../lib/Activity/Settings/FileFavorite.php',
34
+        'OCA\\Files\\Activity\\Settings\\FileRestored' => __DIR__.'/..'.'/../lib/Activity/Settings/FileRestored.php',
35
+        'OCA\\Files\\App' => __DIR__.'/..'.'/../lib/App.php',
36
+        'OCA\\Files\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
37
+        'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupFileLocks.php',
38
+        'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => __DIR__.'/..'.'/../lib/BackgroundJob/DeleteOrphanedItems.php',
39
+        'OCA\\Files\\BackgroundJob\\ScanFiles' => __DIR__.'/..'.'/../lib/BackgroundJob/ScanFiles.php',
40
+        'OCA\\Files\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php',
41
+        'OCA\\Files\\Collaboration\\Resources\\Listener' => __DIR__.'/..'.'/../lib/Collaboration/Resources/Listener.php',
42
+        'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => __DIR__.'/..'.'/../lib/Collaboration/Resources/ResourceProvider.php',
43
+        'OCA\\Files\\Command\\DeleteOrphanedFiles' => __DIR__.'/..'.'/../lib/Command/DeleteOrphanedFiles.php',
44
+        'OCA\\Files\\Command\\Scan' => __DIR__.'/..'.'/../lib/Command/Scan.php',
45
+        'OCA\\Files\\Command\\ScanAppData' => __DIR__.'/..'.'/../lib/Command/ScanAppData.php',
46
+        'OCA\\Files\\Command\\TransferOwnership' => __DIR__.'/..'.'/../lib/Command/TransferOwnership.php',
47
+        'OCA\\Files\\Controller\\AjaxController' => __DIR__.'/..'.'/../lib/Controller/AjaxController.php',
48
+        'OCA\\Files\\Controller\\ApiController' => __DIR__.'/..'.'/../lib/Controller/ApiController.php',
49
+        'OCA\\Files\\Controller\\ViewController' => __DIR__.'/..'.'/../lib/Controller/ViewController.php',
50
+        'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => __DIR__.'/..'.'/../lib/Event/LoadAdditionalScriptsEvent.php',
51
+        'OCA\\Files\\Helper' => __DIR__.'/..'.'/../lib/Helper.php',
52
+        'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => __DIR__.'/..'.'/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
53
+        'OCA\\Files\\Service\\TagService' => __DIR__.'/..'.'/../lib/Service/TagService.php',
54 54
     );
55 55
 
56 56
     public static function getInitializer(ClassLoader $loader)
57 57
     {
58
-        return \Closure::bind(function () use ($loader) {
58
+        return \Closure::bind(function() use ($loader) {
59 59
             $loader->prefixLengthsPsr4 = ComposerStaticInitFiles::$prefixLengthsPsr4;
60 60
             $loader->prefixDirsPsr4 = ComposerStaticInitFiles::$prefixDirsPsr4;
61 61
             $loader->classMap = ComposerStaticInitFiles::$classMap;
Please login to merge, or discard this patch.
apps/files/composer/composer/autoload_classmap.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -6,34 +6,34 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\Files\\Activity\\FavoriteProvider' => $baseDir . '/../lib/Activity/FavoriteProvider.php',
10
-    'OCA\\Files\\Activity\\Filter\\Favorites' => $baseDir . '/../lib/Activity/Filter/Favorites.php',
11
-    'OCA\\Files\\Activity\\Filter\\FileChanges' => $baseDir . '/../lib/Activity/Filter/FileChanges.php',
12
-    'OCA\\Files\\Activity\\Helper' => $baseDir . '/../lib/Activity/Helper.php',
13
-    'OCA\\Files\\Activity\\Provider' => $baseDir . '/../lib/Activity/Provider.php',
14
-    'OCA\\Files\\Activity\\Settings\\FavoriteAction' => $baseDir . '/../lib/Activity/Settings/FavoriteAction.php',
15
-    'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir . '/../lib/Activity/Settings/FileChanged.php',
16
-    'OCA\\Files\\Activity\\Settings\\FileCreated' => $baseDir . '/../lib/Activity/Settings/FileCreated.php',
17
-    'OCA\\Files\\Activity\\Settings\\FileDeleted' => $baseDir . '/../lib/Activity/Settings/FileDeleted.php',
18
-    'OCA\\Files\\Activity\\Settings\\FileFavorite' => $baseDir . '/../lib/Activity/Settings/FileFavorite.php',
19
-    'OCA\\Files\\Activity\\Settings\\FileRestored' => $baseDir . '/../lib/Activity/Settings/FileRestored.php',
20
-    'OCA\\Files\\App' => $baseDir . '/../lib/App.php',
21
-    'OCA\\Files\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
22
-    'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir . '/../lib/BackgroundJob/CleanupFileLocks.php',
23
-    'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => $baseDir . '/../lib/BackgroundJob/DeleteOrphanedItems.php',
24
-    'OCA\\Files\\BackgroundJob\\ScanFiles' => $baseDir . '/../lib/BackgroundJob/ScanFiles.php',
25
-    'OCA\\Files\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
26
-    'OCA\\Files\\Collaboration\\Resources\\Listener' => $baseDir . '/../lib/Collaboration/Resources/Listener.php',
27
-    'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => $baseDir . '/../lib/Collaboration/Resources/ResourceProvider.php',
28
-    'OCA\\Files\\Command\\DeleteOrphanedFiles' => $baseDir . '/../lib/Command/DeleteOrphanedFiles.php',
29
-    'OCA\\Files\\Command\\Scan' => $baseDir . '/../lib/Command/Scan.php',
30
-    'OCA\\Files\\Command\\ScanAppData' => $baseDir . '/../lib/Command/ScanAppData.php',
31
-    'OCA\\Files\\Command\\TransferOwnership' => $baseDir . '/../lib/Command/TransferOwnership.php',
32
-    'OCA\\Files\\Controller\\AjaxController' => $baseDir . '/../lib/Controller/AjaxController.php',
33
-    'OCA\\Files\\Controller\\ApiController' => $baseDir . '/../lib/Controller/ApiController.php',
34
-    'OCA\\Files\\Controller\\ViewController' => $baseDir . '/../lib/Controller/ViewController.php',
35
-    'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => $baseDir . '/../lib/Event/LoadAdditionalScriptsEvent.php',
36
-    'OCA\\Files\\Helper' => $baseDir . '/../lib/Helper.php',
37
-    'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => $baseDir . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
38
-    'OCA\\Files\\Service\\TagService' => $baseDir . '/../lib/Service/TagService.php',
9
+    'OCA\\Files\\Activity\\FavoriteProvider' => $baseDir.'/../lib/Activity/FavoriteProvider.php',
10
+    'OCA\\Files\\Activity\\Filter\\Favorites' => $baseDir.'/../lib/Activity/Filter/Favorites.php',
11
+    'OCA\\Files\\Activity\\Filter\\FileChanges' => $baseDir.'/../lib/Activity/Filter/FileChanges.php',
12
+    'OCA\\Files\\Activity\\Helper' => $baseDir.'/../lib/Activity/Helper.php',
13
+    'OCA\\Files\\Activity\\Provider' => $baseDir.'/../lib/Activity/Provider.php',
14
+    'OCA\\Files\\Activity\\Settings\\FavoriteAction' => $baseDir.'/../lib/Activity/Settings/FavoriteAction.php',
15
+    'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir.'/../lib/Activity/Settings/FileChanged.php',
16
+    'OCA\\Files\\Activity\\Settings\\FileCreated' => $baseDir.'/../lib/Activity/Settings/FileCreated.php',
17
+    'OCA\\Files\\Activity\\Settings\\FileDeleted' => $baseDir.'/../lib/Activity/Settings/FileDeleted.php',
18
+    'OCA\\Files\\Activity\\Settings\\FileFavorite' => $baseDir.'/../lib/Activity/Settings/FileFavorite.php',
19
+    'OCA\\Files\\Activity\\Settings\\FileRestored' => $baseDir.'/../lib/Activity/Settings/FileRestored.php',
20
+    'OCA\\Files\\App' => $baseDir.'/../lib/App.php',
21
+    'OCA\\Files\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
22
+    'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir.'/../lib/BackgroundJob/CleanupFileLocks.php',
23
+    'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => $baseDir.'/../lib/BackgroundJob/DeleteOrphanedItems.php',
24
+    'OCA\\Files\\BackgroundJob\\ScanFiles' => $baseDir.'/../lib/BackgroundJob/ScanFiles.php',
25
+    'OCA\\Files\\Capabilities' => $baseDir.'/../lib/Capabilities.php',
26
+    'OCA\\Files\\Collaboration\\Resources\\Listener' => $baseDir.'/../lib/Collaboration/Resources/Listener.php',
27
+    'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => $baseDir.'/../lib/Collaboration/Resources/ResourceProvider.php',
28
+    'OCA\\Files\\Command\\DeleteOrphanedFiles' => $baseDir.'/../lib/Command/DeleteOrphanedFiles.php',
29
+    'OCA\\Files\\Command\\Scan' => $baseDir.'/../lib/Command/Scan.php',
30
+    'OCA\\Files\\Command\\ScanAppData' => $baseDir.'/../lib/Command/ScanAppData.php',
31
+    'OCA\\Files\\Command\\TransferOwnership' => $baseDir.'/../lib/Command/TransferOwnership.php',
32
+    'OCA\\Files\\Controller\\AjaxController' => $baseDir.'/../lib/Controller/AjaxController.php',
33
+    'OCA\\Files\\Controller\\ApiController' => $baseDir.'/../lib/Controller/ApiController.php',
34
+    'OCA\\Files\\Controller\\ViewController' => $baseDir.'/../lib/Controller/ViewController.php',
35
+    'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => $baseDir.'/../lib/Event/LoadAdditionalScriptsEvent.php',
36
+    'OCA\\Files\\Helper' => $baseDir.'/../lib/Helper.php',
37
+    'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => $baseDir.'/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
38
+    'OCA\\Files\\Service\\TagService' => $baseDir.'/../lib/Service/TagService.php',
39 39
 );
Please login to merge, or discard this patch.
apps/files/lib/Controller/ViewController.php 1 patch
Indentation   +281 added lines, -281 removed lines patch added patch discarded remove patch
@@ -52,285 +52,285 @@
 block discarded – undo
52 52
  * @package OCA\Files\Controller
53 53
  */
54 54
 class ViewController extends Controller {
55
-	/** @var string */
56
-	protected $appName;
57
-	/** @var IRequest */
58
-	protected $request;
59
-	/** @var IURLGenerator */
60
-	protected $urlGenerator;
61
-	/** @var IL10N */
62
-	protected $l10n;
63
-	/** @var IConfig */
64
-	protected $config;
65
-	/** @var IEventDispatcher */
66
-	protected $eventDispatcher;
67
-	/** @var IUserSession */
68
-	protected $userSession;
69
-	/** @var IAppManager */
70
-	protected $appManager;
71
-	/** @var IRootFolder */
72
-	protected $rootFolder;
73
-	/** @var Helper */
74
-	protected $activityHelper;
75
-
76
-	public function __construct(string $appName,
77
-		IRequest $request,
78
-		IURLGenerator $urlGenerator,
79
-		IL10N $l10n,
80
-		IConfig $config,
81
-		IEventDispatcher $eventDispatcher,
82
-		IUserSession $userSession,
83
-		IAppManager $appManager,
84
-		IRootFolder $rootFolder,
85
-		Helper $activityHelper
86
-	) {
87
-		parent::__construct($appName, $request);
88
-		$this->appName         = $appName;
89
-		$this->request         = $request;
90
-		$this->urlGenerator    = $urlGenerator;
91
-		$this->l10n            = $l10n;
92
-		$this->config          = $config;
93
-		$this->eventDispatcher = $eventDispatcher;
94
-		$this->userSession     = $userSession;
95
-		$this->appManager      = $appManager;
96
-		$this->rootFolder      = $rootFolder;
97
-		$this->activityHelper  = $activityHelper;
98
-	}
99
-
100
-	/**
101
-	 * @param string $appName
102
-	 * @param string $scriptName
103
-	 * @return string
104
-	 */
105
-	protected function renderScript($appName, $scriptName) {
106
-		$content    = '';
107
-		$appPath    = \OC_App::getAppPath($appName);
108
-		$scriptPath = $appPath . '/' . $scriptName;
109
-		if (file_exists($scriptPath)) {
110
-			// TODO: sanitize path / script name ?
111
-			ob_start();
112
-			include $scriptPath;
113
-			$content = ob_get_contents();
114
-			@ob_end_clean();
115
-		}
116
-
117
-		return $content;
118
-	}
119
-
120
-	/**
121
-	 * FIXME: Replace with non static code
122
-	 *
123
-	 * @return array
124
-	 * @throws \OCP\Files\NotFoundException
125
-	 */
126
-	protected function getStorageInfo() {
127
-		$dirInfo = \OC\Files\Filesystem::getFileInfo('/', false);
128
-
129
-		return \OC_Helper::getStorageInfo('/', $dirInfo);
130
-	}
131
-
132
-	/**
133
-	 * @NoCSRFRequired
134
-	 * @NoAdminRequired
135
-	 *
136
-	 * @param string $fileid
137
-	 * @return TemplateResponse|RedirectResponse
138
-	 * @throws NotFoundException
139
-	 */
140
-	public function showFile(string $fileid = null): Response {
141
-		// This is the entry point from the `/f/{fileid}` URL which is hardcoded in the server.
142
-		try {
143
-			return $this->redirectToFile($fileid);
144
-		} catch (NotFoundException $e) {
145
-			return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
146
-		}
147
-	}
148
-
149
-	/**
150
-	 * @NoCSRFRequired
151
-	 * @NoAdminRequired
152
-	 *
153
-	 * @param string $dir
154
-	 * @param string $view
155
-	 * @param string $fileid
156
-	 * @param bool $fileNotFound
157
-	 * @return TemplateResponse|RedirectResponse
158
-	 * @throws NotFoundException
159
-	 */
160
-	public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) {
161
-		if ($fileid !== null) {
162
-			try {
163
-				return $this->redirectToFile($fileid);
164
-			} catch (NotFoundException $e) {
165
-				return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
166
-			}
167
-		}
168
-
169
-		$nav = new \OCP\Template('files', 'appnavigation', '');
170
-
171
-		// Load the files we need
172
-		\OCP\Util::addStyle('files', 'merged');
173
-		\OCP\Util::addScript('files', 'merged-index');
174
-
175
-		// mostly for the home storage's free space
176
-		// FIXME: Make non static
177
-		$storageInfo = $this->getStorageInfo();
178
-
179
-		$user = $this->userSession->getUser()->getUID();
180
-
181
-		// Get all the user favorites to create a submenu
182
-		try {
183
-			$favElements = $this->activityHelper->getFavoriteFilePaths($this->userSession->getUser()->getUID());
184
-		} catch (\RuntimeException $e) {
185
-			$favElements['folders'] = [];
186
-		}
187
-
188
-		$collapseClasses = '';
189
-		if (count($favElements['folders']) > 0) {
190
-			$collapseClasses = 'collapsible';
191
-		}
192
-
193
-		$favoritesSublistArray = Array();
194
-
195
-		$navBarPositionPosition = 6;
196
-		$currentCount           = 0;
197
-		foreach ($favElements['folders'] as $dir) {
198
-
199
-			$link         = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $dir, 'view' => 'files']);
200
-			$sortingValue = ++$currentCount;
201
-			$element      = [
202
-				'id'                 => str_replace('/', '-', $dir),
203
-				'view'               => 'files',
204
-				'href'               => $link,
205
-				'dir'                => $dir,
206
-				'order'              => $navBarPositionPosition,
207
-				'folderPosition'     => $sortingValue,
208
-				'name'               => basename($dir),
209
-				'icon'               => 'files',
210
-				'quickaccesselement' => 'true'
211
-			];
212
-
213
-			array_push($favoritesSublistArray, $element);
214
-			$navBarPositionPosition++;
215
-		}
216
-
217
-		$navItems = \OCA\Files\App::getNavigationManager()->getAll();
218
-
219
-		// add the favorites entry in menu
220
-		$navItems['favorites']['sublist'] = $favoritesSublistArray;
221
-		$navItems['favorites']['classes'] = $collapseClasses;
222
-
223
-		// parse every menu and add the expandedState user value
224
-		foreach ($navItems as $key => $item) {
225
-			if (isset($item['expandedState'])) {
226
-				$navItems[$key]['defaultExpandedState'] = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', $item['expandedState'], '0') === '1';
227
-			}
228
-		}
229
-
230
-		$nav->assign('navigationItems', $navItems);
231
-
232
-		$nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used']));
233
-		if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
234
-			$totalSpace = $this->l10n->t('Unlimited');
235
-		} else {
236
-			$totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
237
-		}
238
-		$nav->assign('total_space', $totalSpace);
239
-		$nav->assign('quota', $storageInfo['quota']);
240
-		$nav->assign('usage_relative', $storageInfo['relative']);
241
-
242
-		$contentItems = [];
243
-
244
-		// render the container content for every navigation item
245
-		foreach ($navItems as $item) {
246
-			$content = '';
247
-			if (isset($item['script'])) {
248
-				$content = $this->renderScript($item['appname'], $item['script']);
249
-			}
250
-			// parse submenus
251
-			if (isset($item['sublist'])) {
252
-				foreach ($item['sublist'] as $subitem) {
253
-					$subcontent = '';
254
-					if (isset($subitem['script'])) {
255
-						$subcontent = $this->renderScript($subitem['appname'], $subitem['script']);
256
-					}
257
-					$contentItems[$subitem['id']] = [
258
-						'id'      => $subitem['id'],
259
-						'content' => $subcontent
260
-					];
261
-				}
262
-			}
263
-			$contentItems[$item['id']] = [
264
-				'id'      => $item['id'],
265
-				'content' => $content
266
-			];
267
-		}
268
-
269
-		$event = new LoadAdditionalScriptsEvent();
270
-		$this->eventDispatcher->dispatch(LoadAdditionalScriptsEvent::class, $event);
271
-
272
-		$params                                = [];
273
-		$params['usedSpacePercent']            = (int) $storageInfo['relative'];
274
-		$params['owner']                       = $storageInfo['owner'];
275
-		$params['ownerDisplayName']            = $storageInfo['ownerDisplayName'];
276
-		$params['isPublic']                    = false;
277
-		$params['allowShareWithLink']          = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
278
-		$params['defaultFileSorting']          = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
279
-		$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
280
-		$params['showgridview']				   = $this->config->getUserValue($user, 'files', 'show_grid', false);
281
-		$params['isIE']						   = \OCP\Util::isIE();
282
-		$showHidden                            = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
283
-		$params['showHiddenFiles']             = $showHidden ? 1 : 0;
284
-		$params['fileNotFound']                = $fileNotFound ? 1 : 0;
285
-		$params['appNavigation']               = $nav;
286
-		$params['appContents']                 = $contentItems;
287
-		$params['hiddenFields']                = $event->getHiddenFields();
288
-
289
-		$response = new TemplateResponse(
290
-			$this->appName,
291
-			'index',
292
-			$params
293
-		);
294
-		$policy = new ContentSecurityPolicy();
295
-		$policy->addAllowedFrameDomain('\'self\'');
296
-		$response->setContentSecurityPolicy($policy);
297
-
298
-		return $response;
299
-	}
300
-
301
-	/**
302
-	 * Redirects to the file list and highlight the given file id
303
-	 *
304
-	 * @param string $fileId file id to show
305
-	 * @return RedirectResponse redirect response or not found response
306
-	 * @throws \OCP\Files\NotFoundException
307
-	 */
308
-	private function redirectToFile($fileId) {
309
-		$uid        = $this->userSession->getUser()->getUID();
310
-		$baseFolder = $this->rootFolder->getUserFolder($uid);
311
-		$files      = $baseFolder->getById($fileId);
312
-		$params     = [];
313
-
314
-		if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
315
-			$baseFolder     = $this->rootFolder->get($uid . '/files_trashbin/files/');
316
-			$files          = $baseFolder->getById($fileId);
317
-			$params['view'] = 'trashbin';
318
-		}
319
-
320
-		if (!empty($files)) {
321
-			$file = current($files);
322
-			if ($file instanceof Folder) {
323
-				// set the full path to enter the folder
324
-				$params['dir'] = $baseFolder->getRelativePath($file->getPath());
325
-			} else {
326
-				// set parent path as dir
327
-				$params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath());
328
-				// and scroll to the entry
329
-				$params['scrollto'] = $file->getName();
330
-			}
331
-
332
-			return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));
333
-		}
334
-		throw new \OCP\Files\NotFoundException();
335
-	}
55
+    /** @var string */
56
+    protected $appName;
57
+    /** @var IRequest */
58
+    protected $request;
59
+    /** @var IURLGenerator */
60
+    protected $urlGenerator;
61
+    /** @var IL10N */
62
+    protected $l10n;
63
+    /** @var IConfig */
64
+    protected $config;
65
+    /** @var IEventDispatcher */
66
+    protected $eventDispatcher;
67
+    /** @var IUserSession */
68
+    protected $userSession;
69
+    /** @var IAppManager */
70
+    protected $appManager;
71
+    /** @var IRootFolder */
72
+    protected $rootFolder;
73
+    /** @var Helper */
74
+    protected $activityHelper;
75
+
76
+    public function __construct(string $appName,
77
+        IRequest $request,
78
+        IURLGenerator $urlGenerator,
79
+        IL10N $l10n,
80
+        IConfig $config,
81
+        IEventDispatcher $eventDispatcher,
82
+        IUserSession $userSession,
83
+        IAppManager $appManager,
84
+        IRootFolder $rootFolder,
85
+        Helper $activityHelper
86
+    ) {
87
+        parent::__construct($appName, $request);
88
+        $this->appName         = $appName;
89
+        $this->request         = $request;
90
+        $this->urlGenerator    = $urlGenerator;
91
+        $this->l10n            = $l10n;
92
+        $this->config          = $config;
93
+        $this->eventDispatcher = $eventDispatcher;
94
+        $this->userSession     = $userSession;
95
+        $this->appManager      = $appManager;
96
+        $this->rootFolder      = $rootFolder;
97
+        $this->activityHelper  = $activityHelper;
98
+    }
99
+
100
+    /**
101
+     * @param string $appName
102
+     * @param string $scriptName
103
+     * @return string
104
+     */
105
+    protected function renderScript($appName, $scriptName) {
106
+        $content    = '';
107
+        $appPath    = \OC_App::getAppPath($appName);
108
+        $scriptPath = $appPath . '/' . $scriptName;
109
+        if (file_exists($scriptPath)) {
110
+            // TODO: sanitize path / script name ?
111
+            ob_start();
112
+            include $scriptPath;
113
+            $content = ob_get_contents();
114
+            @ob_end_clean();
115
+        }
116
+
117
+        return $content;
118
+    }
119
+
120
+    /**
121
+     * FIXME: Replace with non static code
122
+     *
123
+     * @return array
124
+     * @throws \OCP\Files\NotFoundException
125
+     */
126
+    protected function getStorageInfo() {
127
+        $dirInfo = \OC\Files\Filesystem::getFileInfo('/', false);
128
+
129
+        return \OC_Helper::getStorageInfo('/', $dirInfo);
130
+    }
131
+
132
+    /**
133
+     * @NoCSRFRequired
134
+     * @NoAdminRequired
135
+     *
136
+     * @param string $fileid
137
+     * @return TemplateResponse|RedirectResponse
138
+     * @throws NotFoundException
139
+     */
140
+    public function showFile(string $fileid = null): Response {
141
+        // This is the entry point from the `/f/{fileid}` URL which is hardcoded in the server.
142
+        try {
143
+            return $this->redirectToFile($fileid);
144
+        } catch (NotFoundException $e) {
145
+            return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
146
+        }
147
+    }
148
+
149
+    /**
150
+     * @NoCSRFRequired
151
+     * @NoAdminRequired
152
+     *
153
+     * @param string $dir
154
+     * @param string $view
155
+     * @param string $fileid
156
+     * @param bool $fileNotFound
157
+     * @return TemplateResponse|RedirectResponse
158
+     * @throws NotFoundException
159
+     */
160
+    public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) {
161
+        if ($fileid !== null) {
162
+            try {
163
+                return $this->redirectToFile($fileid);
164
+            } catch (NotFoundException $e) {
165
+                return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
166
+            }
167
+        }
168
+
169
+        $nav = new \OCP\Template('files', 'appnavigation', '');
170
+
171
+        // Load the files we need
172
+        \OCP\Util::addStyle('files', 'merged');
173
+        \OCP\Util::addScript('files', 'merged-index');
174
+
175
+        // mostly for the home storage's free space
176
+        // FIXME: Make non static
177
+        $storageInfo = $this->getStorageInfo();
178
+
179
+        $user = $this->userSession->getUser()->getUID();
180
+
181
+        // Get all the user favorites to create a submenu
182
+        try {
183
+            $favElements = $this->activityHelper->getFavoriteFilePaths($this->userSession->getUser()->getUID());
184
+        } catch (\RuntimeException $e) {
185
+            $favElements['folders'] = [];
186
+        }
187
+
188
+        $collapseClasses = '';
189
+        if (count($favElements['folders']) > 0) {
190
+            $collapseClasses = 'collapsible';
191
+        }
192
+
193
+        $favoritesSublistArray = Array();
194
+
195
+        $navBarPositionPosition = 6;
196
+        $currentCount           = 0;
197
+        foreach ($favElements['folders'] as $dir) {
198
+
199
+            $link         = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $dir, 'view' => 'files']);
200
+            $sortingValue = ++$currentCount;
201
+            $element      = [
202
+                'id'                 => str_replace('/', '-', $dir),
203
+                'view'               => 'files',
204
+                'href'               => $link,
205
+                'dir'                => $dir,
206
+                'order'              => $navBarPositionPosition,
207
+                'folderPosition'     => $sortingValue,
208
+                'name'               => basename($dir),
209
+                'icon'               => 'files',
210
+                'quickaccesselement' => 'true'
211
+            ];
212
+
213
+            array_push($favoritesSublistArray, $element);
214
+            $navBarPositionPosition++;
215
+        }
216
+
217
+        $navItems = \OCA\Files\App::getNavigationManager()->getAll();
218
+
219
+        // add the favorites entry in menu
220
+        $navItems['favorites']['sublist'] = $favoritesSublistArray;
221
+        $navItems['favorites']['classes'] = $collapseClasses;
222
+
223
+        // parse every menu and add the expandedState user value
224
+        foreach ($navItems as $key => $item) {
225
+            if (isset($item['expandedState'])) {
226
+                $navItems[$key]['defaultExpandedState'] = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', $item['expandedState'], '0') === '1';
227
+            }
228
+        }
229
+
230
+        $nav->assign('navigationItems', $navItems);
231
+
232
+        $nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used']));
233
+        if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
234
+            $totalSpace = $this->l10n->t('Unlimited');
235
+        } else {
236
+            $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
237
+        }
238
+        $nav->assign('total_space', $totalSpace);
239
+        $nav->assign('quota', $storageInfo['quota']);
240
+        $nav->assign('usage_relative', $storageInfo['relative']);
241
+
242
+        $contentItems = [];
243
+
244
+        // render the container content for every navigation item
245
+        foreach ($navItems as $item) {
246
+            $content = '';
247
+            if (isset($item['script'])) {
248
+                $content = $this->renderScript($item['appname'], $item['script']);
249
+            }
250
+            // parse submenus
251
+            if (isset($item['sublist'])) {
252
+                foreach ($item['sublist'] as $subitem) {
253
+                    $subcontent = '';
254
+                    if (isset($subitem['script'])) {
255
+                        $subcontent = $this->renderScript($subitem['appname'], $subitem['script']);
256
+                    }
257
+                    $contentItems[$subitem['id']] = [
258
+                        'id'      => $subitem['id'],
259
+                        'content' => $subcontent
260
+                    ];
261
+                }
262
+            }
263
+            $contentItems[$item['id']] = [
264
+                'id'      => $item['id'],
265
+                'content' => $content
266
+            ];
267
+        }
268
+
269
+        $event = new LoadAdditionalScriptsEvent();
270
+        $this->eventDispatcher->dispatch(LoadAdditionalScriptsEvent::class, $event);
271
+
272
+        $params                                = [];
273
+        $params['usedSpacePercent']            = (int) $storageInfo['relative'];
274
+        $params['owner']                       = $storageInfo['owner'];
275
+        $params['ownerDisplayName']            = $storageInfo['ownerDisplayName'];
276
+        $params['isPublic']                    = false;
277
+        $params['allowShareWithLink']          = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
278
+        $params['defaultFileSorting']          = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
279
+        $params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
280
+        $params['showgridview']				   = $this->config->getUserValue($user, 'files', 'show_grid', false);
281
+        $params['isIE']						   = \OCP\Util::isIE();
282
+        $showHidden                            = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
283
+        $params['showHiddenFiles']             = $showHidden ? 1 : 0;
284
+        $params['fileNotFound']                = $fileNotFound ? 1 : 0;
285
+        $params['appNavigation']               = $nav;
286
+        $params['appContents']                 = $contentItems;
287
+        $params['hiddenFields']                = $event->getHiddenFields();
288
+
289
+        $response = new TemplateResponse(
290
+            $this->appName,
291
+            'index',
292
+            $params
293
+        );
294
+        $policy = new ContentSecurityPolicy();
295
+        $policy->addAllowedFrameDomain('\'self\'');
296
+        $response->setContentSecurityPolicy($policy);
297
+
298
+        return $response;
299
+    }
300
+
301
+    /**
302
+     * Redirects to the file list and highlight the given file id
303
+     *
304
+     * @param string $fileId file id to show
305
+     * @return RedirectResponse redirect response or not found response
306
+     * @throws \OCP\Files\NotFoundException
307
+     */
308
+    private function redirectToFile($fileId) {
309
+        $uid        = $this->userSession->getUser()->getUID();
310
+        $baseFolder = $this->rootFolder->getUserFolder($uid);
311
+        $files      = $baseFolder->getById($fileId);
312
+        $params     = [];
313
+
314
+        if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
315
+            $baseFolder     = $this->rootFolder->get($uid . '/files_trashbin/files/');
316
+            $files          = $baseFolder->getById($fileId);
317
+            $params['view'] = 'trashbin';
318
+        }
319
+
320
+        if (!empty($files)) {
321
+            $file = current($files);
322
+            if ($file instanceof Folder) {
323
+                // set the full path to enter the folder
324
+                $params['dir'] = $baseFolder->getRelativePath($file->getPath());
325
+            } else {
326
+                // set parent path as dir
327
+                $params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath());
328
+                // and scroll to the entry
329
+                $params['scrollto'] = $file->getName();
330
+            }
331
+
332
+            return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));
333
+        }
334
+        throw new \OCP\Files\NotFoundException();
335
+    }
336 336
 }
Please login to merge, or discard this patch.
apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -32,25 +32,25 @@
 block discarded – undo
32 32
 
33 33
 class LegacyLoadAdditionalScriptsAdapter implements IEventListener {
34 34
 
35
-	/** @var SymfonyAdapter */
36
-	private $dispatcher;
37
-
38
-	public function __construct(SymfonyAdapter $dispatcher) {
39
-		$this->dispatcher = $dispatcher;
40
-	}
41
-
42
-	public function handle(Event $event): void {
43
-		if (!($event instanceof LoadAdditionalScriptsEvent)) {
44
-			return;
45
-		}
46
-
47
-		$legacyEvent = new GenericEvent(null, ['hiddenFields' => []]);
48
-		$this->dispatcher->dispatch('OCA\Files::loadAdditionalScripts', $legacyEvent);
49
-
50
-		$hiddenFields = $legacyEvent->getArgument('hiddenFields');
51
-		foreach ($hiddenFields as $name => $value) {
52
-			$event->addHiddenField($name, $value);
53
-		}
54
-	}
35
+    /** @var SymfonyAdapter */
36
+    private $dispatcher;
37
+
38
+    public function __construct(SymfonyAdapter $dispatcher) {
39
+        $this->dispatcher = $dispatcher;
40
+    }
41
+
42
+    public function handle(Event $event): void {
43
+        if (!($event instanceof LoadAdditionalScriptsEvent)) {
44
+            return;
45
+        }
46
+
47
+        $legacyEvent = new GenericEvent(null, ['hiddenFields' => []]);
48
+        $this->dispatcher->dispatch('OCA\Files::loadAdditionalScripts', $legacyEvent);
49
+
50
+        $hiddenFields = $legacyEvent->getArgument('hiddenFields');
51
+        foreach ($hiddenFields as $name => $value) {
52
+            $event->addHiddenField($name, $value);
53
+        }
54
+    }
55 55
 
56 56
 }
Please login to merge, or discard this patch.
apps/files/lib/AppInfo/Application.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -41,56 +41,56 @@
 block discarded – undo
41 41
 use OCA\Files\Capabilities;
42 42
 
43 43
 class Application extends App {
44
-	public function __construct(array $urlParams=array()) {
45
-		parent::__construct('files', $urlParams);
46
-		$container = $this->getContainer();
47
-		$server = $container->getServer();
44
+    public function __construct(array $urlParams=array()) {
45
+        parent::__construct('files', $urlParams);
46
+        $container = $this->getContainer();
47
+        $server = $container->getServer();
48 48
 
49
-		/**
50
-		 * Controllers
51
-		 */
52
-		$container->registerService('APIController', function (IContainer $c) use ($server) {
53
-			return new ApiController(
54
-				$c->query('AppName'),
55
-				$c->query('Request'),
56
-				$server->getUserSession(),
57
-				$c->query('TagService'),
58
-				$server->getPreviewManager(),
59
-				$server->getShareManager(),
60
-				$server->getConfig(),
61
-				$server->getUserFolder()
62
-			);
63
-		});
49
+        /**
50
+         * Controllers
51
+         */
52
+        $container->registerService('APIController', function (IContainer $c) use ($server) {
53
+            return new ApiController(
54
+                $c->query('AppName'),
55
+                $c->query('Request'),
56
+                $server->getUserSession(),
57
+                $c->query('TagService'),
58
+                $server->getPreviewManager(),
59
+                $server->getShareManager(),
60
+                $server->getConfig(),
61
+                $server->getUserFolder()
62
+            );
63
+        });
64 64
 
65
-		/**
66
-		 * Services
67
-		 */
68
-		$container->registerService('TagService', function(IContainer $c) use ($server) {
69
-			$homeFolder = $c->query('ServerContainer')->getUserFolder();
70
-			return new TagService(
71
-				$c->query('ServerContainer')->getUserSession(),
72
-				$c->query('ServerContainer')->getActivityManager(),
73
-				$c->query('ServerContainer')->getTagManager()->load('files'),
74
-				$homeFolder,
75
-				$server->getEventDispatcher()
76
-			);
77
-		});
65
+        /**
66
+         * Services
67
+         */
68
+        $container->registerService('TagService', function(IContainer $c) use ($server) {
69
+            $homeFolder = $c->query('ServerContainer')->getUserFolder();
70
+            return new TagService(
71
+                $c->query('ServerContainer')->getUserSession(),
72
+                $c->query('ServerContainer')->getActivityManager(),
73
+                $c->query('ServerContainer')->getTagManager()->load('files'),
74
+                $homeFolder,
75
+                $server->getEventDispatcher()
76
+            );
77
+        });
78 78
 
79
-		/*
79
+        /*
80 80
 		 * Register capabilities
81 81
 		 */
82
-		$container->registerCapability(Capabilities::class);
82
+        $container->registerCapability(Capabilities::class);
83 83
 
84
-		/**
85
-		 * Register Collaboration ResourceProvider
86
-		 */
87
-		/** @var IManager $resourceManager */
88
-		$resourceManager = $container->query(IManager::class);
89
-		$resourceManager->registerResourceProvider(ResourceProvider::class);
90
-		Listener::register($server->getEventDispatcher());
84
+        /**
85
+         * Register Collaboration ResourceProvider
86
+         */
87
+        /** @var IManager $resourceManager */
88
+        $resourceManager = $container->query(IManager::class);
89
+        $resourceManager->registerResourceProvider(ResourceProvider::class);
90
+        Listener::register($server->getEventDispatcher());
91 91
 
92
-		/** @var IEventDispatcher $dispatcher */
93
-		$dispatcher = $container->query(IEventDispatcher::class);
94
-		$dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class);
95
-	}
92
+        /** @var IEventDispatcher $dispatcher */
93
+        $dispatcher = $container->query(IEventDispatcher::class);
94
+        $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class);
95
+    }
96 96
 }
Please login to merge, or discard this patch.