@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class FileDeleted implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'file_deleted'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'file_deleted'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A new file or folder has been <strong>deleted</strong>'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A new file or folder has been <strong>deleted</strong>'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 3; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 3; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class FileChanged implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'file_changed'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'file_changed'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A file or folder has been <strong>changed</strong> or <strong>renamed</strong>'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A file or folder has been <strong>changed</strong> or <strong>renamed</strong>'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 1; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 1; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class FileRestored implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'file_restored'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'file_restored'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A new file or folder has been <strong>restored</strong>'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A new file or folder has been <strong>restored</strong>'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 4; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 4; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class FileCreated implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'file_created'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'file_created'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A new file or folder has been <strong>created</strong>'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A new file or folder has been <strong>created</strong>'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 0; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 0; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class FavoriteAction implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'favorite'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'favorite'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A file has been added to or removed from your <strong>favorites</strong>'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A file has been added to or removed from your <strong>favorites</strong>'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 5; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 5; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class FileFavorite implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'file_favorite'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'file_favorite'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 2; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 2; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return false; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return false; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return false; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return false; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -38,99 +38,99 @@ |
||
38 | 38 | */ |
39 | 39 | class TagService { |
40 | 40 | |
41 | - /** @var IUserSession */ |
|
42 | - private $userSession; |
|
43 | - /** @var IManager */ |
|
44 | - private $activityManager; |
|
45 | - /** @var ITags */ |
|
46 | - private $tagger; |
|
47 | - /** @var Folder */ |
|
48 | - private $homeFolder; |
|
41 | + /** @var IUserSession */ |
|
42 | + private $userSession; |
|
43 | + /** @var IManager */ |
|
44 | + private $activityManager; |
|
45 | + /** @var ITags */ |
|
46 | + private $tagger; |
|
47 | + /** @var Folder */ |
|
48 | + private $homeFolder; |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param IUserSession $userSession |
|
52 | - * @param IManager $activityManager |
|
53 | - * @param ITags $tagger |
|
54 | - * @param Folder $homeFolder |
|
55 | - */ |
|
56 | - public function __construct( |
|
57 | - IUserSession $userSession, |
|
58 | - IManager $activityManager, |
|
59 | - ITags $tagger, |
|
60 | - Folder $homeFolder |
|
61 | - ) { |
|
62 | - $this->userSession = $userSession; |
|
63 | - $this->activityManager = $activityManager; |
|
64 | - $this->tagger = $tagger; |
|
65 | - $this->homeFolder = $homeFolder; |
|
66 | - } |
|
50 | + /** |
|
51 | + * @param IUserSession $userSession |
|
52 | + * @param IManager $activityManager |
|
53 | + * @param ITags $tagger |
|
54 | + * @param Folder $homeFolder |
|
55 | + */ |
|
56 | + public function __construct( |
|
57 | + IUserSession $userSession, |
|
58 | + IManager $activityManager, |
|
59 | + ITags $tagger, |
|
60 | + Folder $homeFolder |
|
61 | + ) { |
|
62 | + $this->userSession = $userSession; |
|
63 | + $this->activityManager = $activityManager; |
|
64 | + $this->tagger = $tagger; |
|
65 | + $this->homeFolder = $homeFolder; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Updates the tags of the specified file path. |
|
70 | - * The passed tags are absolute, which means they will |
|
71 | - * replace the actual tag selection. |
|
72 | - * |
|
73 | - * @param string $path path |
|
74 | - * @param array $tags array of tags |
|
75 | - * @return array list of tags |
|
76 | - * @throws \OCP\Files\NotFoundException if the file does not exist |
|
77 | - */ |
|
78 | - public function updateFileTags($path, $tags) { |
|
79 | - $fileId = $this->homeFolder->get($path)->getId(); |
|
68 | + /** |
|
69 | + * Updates the tags of the specified file path. |
|
70 | + * The passed tags are absolute, which means they will |
|
71 | + * replace the actual tag selection. |
|
72 | + * |
|
73 | + * @param string $path path |
|
74 | + * @param array $tags array of tags |
|
75 | + * @return array list of tags |
|
76 | + * @throws \OCP\Files\NotFoundException if the file does not exist |
|
77 | + */ |
|
78 | + public function updateFileTags($path, $tags) { |
|
79 | + $fileId = $this->homeFolder->get($path)->getId(); |
|
80 | 80 | |
81 | - $currentTags = $this->tagger->getTagsForObjects(array($fileId)); |
|
81 | + $currentTags = $this->tagger->getTagsForObjects(array($fileId)); |
|
82 | 82 | |
83 | - if (!empty($currentTags)) { |
|
84 | - $currentTags = current($currentTags); |
|
85 | - } |
|
83 | + if (!empty($currentTags)) { |
|
84 | + $currentTags = current($currentTags); |
|
85 | + } |
|
86 | 86 | |
87 | - $newTags = array_diff($tags, $currentTags); |
|
88 | - foreach ($newTags as $tag) { |
|
89 | - if ($tag === Tags::TAG_FAVORITE) { |
|
90 | - $this->addActivity(true, $fileId, $path); |
|
91 | - } |
|
92 | - $this->tagger->tagAs($fileId, $tag); |
|
93 | - } |
|
94 | - $deletedTags = array_diff($currentTags, $tags); |
|
95 | - foreach ($deletedTags as $tag) { |
|
96 | - if ($tag === Tags::TAG_FAVORITE) { |
|
97 | - $this->addActivity(false, $fileId, $path); |
|
98 | - } |
|
99 | - $this->tagger->unTag($fileId, $tag); |
|
100 | - } |
|
87 | + $newTags = array_diff($tags, $currentTags); |
|
88 | + foreach ($newTags as $tag) { |
|
89 | + if ($tag === Tags::TAG_FAVORITE) { |
|
90 | + $this->addActivity(true, $fileId, $path); |
|
91 | + } |
|
92 | + $this->tagger->tagAs($fileId, $tag); |
|
93 | + } |
|
94 | + $deletedTags = array_diff($currentTags, $tags); |
|
95 | + foreach ($deletedTags as $tag) { |
|
96 | + if ($tag === Tags::TAG_FAVORITE) { |
|
97 | + $this->addActivity(false, $fileId, $path); |
|
98 | + } |
|
99 | + $this->tagger->unTag($fileId, $tag); |
|
100 | + } |
|
101 | 101 | |
102 | - // TODO: re-read from tagger to make sure the |
|
103 | - // list is up to date, in case of concurrent changes ? |
|
104 | - return $tags; |
|
105 | - } |
|
102 | + // TODO: re-read from tagger to make sure the |
|
103 | + // list is up to date, in case of concurrent changes ? |
|
104 | + return $tags; |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * @param bool $addToFavorite |
|
109 | - * @param int $fileId |
|
110 | - * @param string $path |
|
111 | - */ |
|
112 | - protected function addActivity($addToFavorite, $fileId, $path) { |
|
113 | - $user = $this->userSession->getUser(); |
|
114 | - if (!$user instanceof IUser) { |
|
115 | - return; |
|
116 | - } |
|
107 | + /** |
|
108 | + * @param bool $addToFavorite |
|
109 | + * @param int $fileId |
|
110 | + * @param string $path |
|
111 | + */ |
|
112 | + protected function addActivity($addToFavorite, $fileId, $path) { |
|
113 | + $user = $this->userSession->getUser(); |
|
114 | + if (!$user instanceof IUser) { |
|
115 | + return; |
|
116 | + } |
|
117 | 117 | |
118 | - $event = $this->activityManager->generateEvent(); |
|
119 | - try { |
|
120 | - $event->setApp('files') |
|
121 | - ->setObject('files', $fileId, $path) |
|
122 | - ->setType('favorite') |
|
123 | - ->setAuthor($user->getUID()) |
|
124 | - ->setAffectedUser($user->getUID()) |
|
125 | - ->setTimestamp(time()) |
|
126 | - ->setSubject( |
|
127 | - $addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED, |
|
128 | - ['id' => $fileId, 'path' => $path] |
|
129 | - ); |
|
130 | - $this->activityManager->publish($event); |
|
131 | - } catch (\InvalidArgumentException $e) { |
|
132 | - } catch (\BadMethodCallException $e) { |
|
133 | - } |
|
134 | - } |
|
118 | + $event = $this->activityManager->generateEvent(); |
|
119 | + try { |
|
120 | + $event->setApp('files') |
|
121 | + ->setObject('files', $fileId, $path) |
|
122 | + ->setType('favorite') |
|
123 | + ->setAuthor($user->getUID()) |
|
124 | + ->setAffectedUser($user->getUID()) |
|
125 | + ->setTimestamp(time()) |
|
126 | + ->setSubject( |
|
127 | + $addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED, |
|
128 | + ['id' => $fileId, 'path' => $path] |
|
129 | + ); |
|
130 | + $this->activityManager->publish($event); |
|
131 | + } catch (\InvalidArgumentException $e) { |
|
132 | + } catch (\BadMethodCallException $e) { |
|
133 | + } |
|
134 | + } |
|
135 | 135 | } |
136 | 136 |
@@ -29,23 +29,23 @@ |
||
29 | 29 | use OCP\Util; |
30 | 30 | |
31 | 31 | class SettingsController extends Controller { |
32 | - public function __construct($appName, IRequest $request) { |
|
33 | - parent::__construct($appName, $request); |
|
34 | - } |
|
32 | + public function __construct($appName, IRequest $request) { |
|
33 | + parent::__construct($appName, $request); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param string $maxUploadSize |
|
38 | - * @return JSONResponse |
|
39 | - */ |
|
40 | - public function setMaxUploadSize($maxUploadSize) { |
|
41 | - $setMaxSize = \OC_Files::setUploadLimit(Util::computerFileSize($maxUploadSize)); |
|
36 | + /** |
|
37 | + * @param string $maxUploadSize |
|
38 | + * @return JSONResponse |
|
39 | + */ |
|
40 | + public function setMaxUploadSize($maxUploadSize) { |
|
41 | + $setMaxSize = \OC_Files::setUploadLimit(Util::computerFileSize($maxUploadSize)); |
|
42 | 42 | |
43 | - if ($setMaxSize === false) { |
|
44 | - return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
|
45 | - } else { |
|
46 | - return new JSONResponse([ |
|
47 | - 'maxUploadSize' => Util::humanFileSize($setMaxSize) |
|
48 | - ]); |
|
49 | - } |
|
50 | - } |
|
43 | + if ($setMaxSize === false) { |
|
44 | + return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
|
45 | + } else { |
|
46 | + return new JSONResponse([ |
|
47 | + 'maxUploadSize' => Util::humanFileSize($setMaxSize) |
|
48 | + ]); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | protected function renderScript($appName, $scriptName) { |
110 | 110 | $content = ''; |
111 | 111 | $appPath = \OC_App::getAppPath($appName); |
112 | - $scriptPath = $appPath . '/' . $scriptName; |
|
112 | + $scriptPath = $appPath.'/'.$scriptName; |
|
113 | 113 | if (file_exists($scriptPath)) { |
114 | 114 | // TODO: sanitize path / script name ? |
115 | 115 | ob_start(); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts'); |
227 | 227 | |
228 | 228 | $params = []; |
229 | - $params['usedSpacePercent'] = (int)$storageInfo['relative']; |
|
229 | + $params['usedSpacePercent'] = (int) $storageInfo['relative']; |
|
230 | 230 | $params['owner'] = $storageInfo['owner']; |
231 | 231 | $params['ownerDisplayName'] = $storageInfo['ownerDisplayName']; |
232 | 232 | $params['isPublic'] = false; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $params = []; |
267 | 267 | |
268 | 268 | if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) { |
269 | - $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/'); |
|
269 | + $baseFolder = $this->rootFolder->get($uid.'/files_trashbin/files/'); |
|
270 | 270 | $files = $baseFolder->getById($fileId); |
271 | 271 | $params['view'] = 'trashbin'; |
272 | 272 | } |
@@ -49,207 +49,207 @@ |
||
49 | 49 | * @package OCA\Files\Controller |
50 | 50 | */ |
51 | 51 | class ViewController extends Controller { |
52 | - /** @var string */ |
|
53 | - protected $appName; |
|
54 | - /** @var IRequest */ |
|
55 | - protected $request; |
|
56 | - /** @var IURLGenerator */ |
|
57 | - protected $urlGenerator; |
|
58 | - /** @var IL10N */ |
|
59 | - protected $l10n; |
|
60 | - /** @var IConfig */ |
|
61 | - protected $config; |
|
62 | - /** @var EventDispatcherInterface */ |
|
63 | - protected $eventDispatcher; |
|
64 | - /** @var IUserSession */ |
|
65 | - protected $userSession; |
|
66 | - /** @var IAppManager */ |
|
67 | - protected $appManager; |
|
68 | - /** @var IRootFolder */ |
|
69 | - protected $rootFolder; |
|
70 | - |
|
71 | - /** |
|
72 | - * @param string $appName |
|
73 | - * @param IRequest $request |
|
74 | - * @param IURLGenerator $urlGenerator |
|
75 | - * @param IL10N $l10n |
|
76 | - * @param IConfig $config |
|
77 | - * @param EventDispatcherInterface $eventDispatcherInterface |
|
78 | - * @param IUserSession $userSession |
|
79 | - * @param IAppManager $appManager |
|
80 | - * @param IRootFolder $rootFolder |
|
81 | - */ |
|
82 | - public function __construct($appName, |
|
83 | - IRequest $request, |
|
84 | - IURLGenerator $urlGenerator, |
|
85 | - IL10N $l10n, |
|
86 | - IConfig $config, |
|
87 | - EventDispatcherInterface $eventDispatcherInterface, |
|
88 | - IUserSession $userSession, |
|
89 | - IAppManager $appManager, |
|
90 | - IRootFolder $rootFolder |
|
91 | - ) { |
|
92 | - parent::__construct($appName, $request); |
|
93 | - $this->appName = $appName; |
|
94 | - $this->request = $request; |
|
95 | - $this->urlGenerator = $urlGenerator; |
|
96 | - $this->l10n = $l10n; |
|
97 | - $this->config = $config; |
|
98 | - $this->eventDispatcher = $eventDispatcherInterface; |
|
99 | - $this->userSession = $userSession; |
|
100 | - $this->appManager = $appManager; |
|
101 | - $this->rootFolder = $rootFolder; |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * @param string $appName |
|
106 | - * @param string $scriptName |
|
107 | - * @return string |
|
108 | - */ |
|
109 | - protected function renderScript($appName, $scriptName) { |
|
110 | - $content = ''; |
|
111 | - $appPath = \OC_App::getAppPath($appName); |
|
112 | - $scriptPath = $appPath . '/' . $scriptName; |
|
113 | - if (file_exists($scriptPath)) { |
|
114 | - // TODO: sanitize path / script name ? |
|
115 | - ob_start(); |
|
116 | - include $scriptPath; |
|
117 | - $content = ob_get_contents(); |
|
118 | - @ob_end_clean(); |
|
119 | - } |
|
120 | - return $content; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * FIXME: Replace with non static code |
|
125 | - * |
|
126 | - * @return array |
|
127 | - * @throws \OCP\Files\NotFoundException |
|
128 | - */ |
|
129 | - protected function getStorageInfo() { |
|
130 | - $dirInfo = \OC\Files\Filesystem::getFileInfo('/', false); |
|
131 | - return \OC_Helper::getStorageInfo('/', $dirInfo); |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * @NoCSRFRequired |
|
136 | - * @NoAdminRequired |
|
137 | - * |
|
138 | - * @param string $dir |
|
139 | - * @param string $view |
|
140 | - * @param string $fileid |
|
141 | - * @return TemplateResponse|RedirectResponse |
|
142 | - */ |
|
143 | - public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) { |
|
144 | - if ($fileid !== null) { |
|
145 | - try { |
|
146 | - return $this->showFile($fileid); |
|
147 | - } catch (NotFoundException $e) { |
|
148 | - return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true])); |
|
149 | - } |
|
150 | - } |
|
151 | - |
|
152 | - $nav = new \OCP\Template('files', 'appnavigation', ''); |
|
153 | - |
|
154 | - // Load the files we need |
|
155 | - \OCP\Util::addStyle('files', 'merged'); |
|
156 | - \OCP\Util::addScript('files', 'merged-index'); |
|
157 | - |
|
158 | - // mostly for the home storage's free space |
|
159 | - // FIXME: Make non static |
|
160 | - $storageInfo = $this->getStorageInfo(); |
|
161 | - |
|
162 | - \OCA\Files\App::getNavigationManager()->add( |
|
163 | - [ |
|
164 | - 'id' => 'favorites', |
|
165 | - 'appname' => 'files', |
|
166 | - 'script' => 'simplelist.php', |
|
167 | - 'order' => 5, |
|
168 | - 'name' => $this->l10n->t('Favorites') |
|
169 | - ] |
|
170 | - ); |
|
171 | - |
|
172 | - $navItems = \OCA\Files\App::getNavigationManager()->getAll(); |
|
173 | - usort($navItems, function($item1, $item2) { |
|
174 | - return $item1['order'] - $item2['order']; |
|
175 | - }); |
|
176 | - $nav->assign('navigationItems', $navItems); |
|
177 | - |
|
178 | - $contentItems = []; |
|
179 | - |
|
180 | - // render the container content for every navigation item |
|
181 | - foreach ($navItems as $item) { |
|
182 | - $content = ''; |
|
183 | - if (isset($item['script'])) { |
|
184 | - $content = $this->renderScript($item['appname'], $item['script']); |
|
185 | - } |
|
186 | - $contentItem = []; |
|
187 | - $contentItem['id'] = $item['id']; |
|
188 | - $contentItem['content'] = $content; |
|
189 | - $contentItems[] = $contentItem; |
|
190 | - } |
|
191 | - |
|
192 | - $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts'); |
|
193 | - |
|
194 | - $params = []; |
|
195 | - $params['usedSpacePercent'] = (int)$storageInfo['relative']; |
|
196 | - $params['owner'] = $storageInfo['owner']; |
|
197 | - $params['ownerDisplayName'] = $storageInfo['ownerDisplayName']; |
|
198 | - $params['isPublic'] = false; |
|
199 | - $params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'); |
|
200 | - $user = $this->userSession->getUser()->getUID(); |
|
201 | - $params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name'); |
|
202 | - $params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc'); |
|
203 | - $showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false); |
|
204 | - $params['showHiddenFiles'] = $showHidden ? 1 : 0; |
|
205 | - $params['fileNotFound'] = $fileNotFound ? 1 : 0; |
|
206 | - $params['appNavigation'] = $nav; |
|
207 | - $params['appContents'] = $contentItems; |
|
208 | - |
|
209 | - $response = new TemplateResponse( |
|
210 | - $this->appName, |
|
211 | - 'index', |
|
212 | - $params |
|
213 | - ); |
|
214 | - $policy = new ContentSecurityPolicy(); |
|
215 | - $policy->addAllowedFrameDomain('\'self\''); |
|
216 | - $response->setContentSecurityPolicy($policy); |
|
217 | - |
|
218 | - return $response; |
|
219 | - } |
|
220 | - |
|
221 | - /** |
|
222 | - * Redirects to the file list and highlight the given file id |
|
223 | - * |
|
224 | - * @param string $fileId file id to show |
|
225 | - * @return RedirectResponse redirect response or not found response |
|
226 | - * @throws \OCP\Files\NotFoundException |
|
227 | - */ |
|
228 | - private function showFile($fileId) { |
|
229 | - $uid = $this->userSession->getUser()->getUID(); |
|
230 | - $baseFolder = $this->rootFolder->getUserFolder($uid); |
|
231 | - $files = $baseFolder->getById($fileId); |
|
232 | - $params = []; |
|
233 | - |
|
234 | - if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) { |
|
235 | - $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/'); |
|
236 | - $files = $baseFolder->getById($fileId); |
|
237 | - $params['view'] = 'trashbin'; |
|
238 | - } |
|
239 | - |
|
240 | - if (!empty($files)) { |
|
241 | - $file = current($files); |
|
242 | - if ($file instanceof Folder) { |
|
243 | - // set the full path to enter the folder |
|
244 | - $params['dir'] = $baseFolder->getRelativePath($file->getPath()); |
|
245 | - } else { |
|
246 | - // set parent path as dir |
|
247 | - $params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath()); |
|
248 | - // and scroll to the entry |
|
249 | - $params['scrollto'] = $file->getName(); |
|
250 | - } |
|
251 | - return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params)); |
|
252 | - } |
|
253 | - throw new \OCP\Files\NotFoundException(); |
|
254 | - } |
|
52 | + /** @var string */ |
|
53 | + protected $appName; |
|
54 | + /** @var IRequest */ |
|
55 | + protected $request; |
|
56 | + /** @var IURLGenerator */ |
|
57 | + protected $urlGenerator; |
|
58 | + /** @var IL10N */ |
|
59 | + protected $l10n; |
|
60 | + /** @var IConfig */ |
|
61 | + protected $config; |
|
62 | + /** @var EventDispatcherInterface */ |
|
63 | + protected $eventDispatcher; |
|
64 | + /** @var IUserSession */ |
|
65 | + protected $userSession; |
|
66 | + /** @var IAppManager */ |
|
67 | + protected $appManager; |
|
68 | + /** @var IRootFolder */ |
|
69 | + protected $rootFolder; |
|
70 | + |
|
71 | + /** |
|
72 | + * @param string $appName |
|
73 | + * @param IRequest $request |
|
74 | + * @param IURLGenerator $urlGenerator |
|
75 | + * @param IL10N $l10n |
|
76 | + * @param IConfig $config |
|
77 | + * @param EventDispatcherInterface $eventDispatcherInterface |
|
78 | + * @param IUserSession $userSession |
|
79 | + * @param IAppManager $appManager |
|
80 | + * @param IRootFolder $rootFolder |
|
81 | + */ |
|
82 | + public function __construct($appName, |
|
83 | + IRequest $request, |
|
84 | + IURLGenerator $urlGenerator, |
|
85 | + IL10N $l10n, |
|
86 | + IConfig $config, |
|
87 | + EventDispatcherInterface $eventDispatcherInterface, |
|
88 | + IUserSession $userSession, |
|
89 | + IAppManager $appManager, |
|
90 | + IRootFolder $rootFolder |
|
91 | + ) { |
|
92 | + parent::__construct($appName, $request); |
|
93 | + $this->appName = $appName; |
|
94 | + $this->request = $request; |
|
95 | + $this->urlGenerator = $urlGenerator; |
|
96 | + $this->l10n = $l10n; |
|
97 | + $this->config = $config; |
|
98 | + $this->eventDispatcher = $eventDispatcherInterface; |
|
99 | + $this->userSession = $userSession; |
|
100 | + $this->appManager = $appManager; |
|
101 | + $this->rootFolder = $rootFolder; |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * @param string $appName |
|
106 | + * @param string $scriptName |
|
107 | + * @return string |
|
108 | + */ |
|
109 | + protected function renderScript($appName, $scriptName) { |
|
110 | + $content = ''; |
|
111 | + $appPath = \OC_App::getAppPath($appName); |
|
112 | + $scriptPath = $appPath . '/' . $scriptName; |
|
113 | + if (file_exists($scriptPath)) { |
|
114 | + // TODO: sanitize path / script name ? |
|
115 | + ob_start(); |
|
116 | + include $scriptPath; |
|
117 | + $content = ob_get_contents(); |
|
118 | + @ob_end_clean(); |
|
119 | + } |
|
120 | + return $content; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * FIXME: Replace with non static code |
|
125 | + * |
|
126 | + * @return array |
|
127 | + * @throws \OCP\Files\NotFoundException |
|
128 | + */ |
|
129 | + protected function getStorageInfo() { |
|
130 | + $dirInfo = \OC\Files\Filesystem::getFileInfo('/', false); |
|
131 | + return \OC_Helper::getStorageInfo('/', $dirInfo); |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * @NoCSRFRequired |
|
136 | + * @NoAdminRequired |
|
137 | + * |
|
138 | + * @param string $dir |
|
139 | + * @param string $view |
|
140 | + * @param string $fileid |
|
141 | + * @return TemplateResponse|RedirectResponse |
|
142 | + */ |
|
143 | + public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) { |
|
144 | + if ($fileid !== null) { |
|
145 | + try { |
|
146 | + return $this->showFile($fileid); |
|
147 | + } catch (NotFoundException $e) { |
|
148 | + return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true])); |
|
149 | + } |
|
150 | + } |
|
151 | + |
|
152 | + $nav = new \OCP\Template('files', 'appnavigation', ''); |
|
153 | + |
|
154 | + // Load the files we need |
|
155 | + \OCP\Util::addStyle('files', 'merged'); |
|
156 | + \OCP\Util::addScript('files', 'merged-index'); |
|
157 | + |
|
158 | + // mostly for the home storage's free space |
|
159 | + // FIXME: Make non static |
|
160 | + $storageInfo = $this->getStorageInfo(); |
|
161 | + |
|
162 | + \OCA\Files\App::getNavigationManager()->add( |
|
163 | + [ |
|
164 | + 'id' => 'favorites', |
|
165 | + 'appname' => 'files', |
|
166 | + 'script' => 'simplelist.php', |
|
167 | + 'order' => 5, |
|
168 | + 'name' => $this->l10n->t('Favorites') |
|
169 | + ] |
|
170 | + ); |
|
171 | + |
|
172 | + $navItems = \OCA\Files\App::getNavigationManager()->getAll(); |
|
173 | + usort($navItems, function($item1, $item2) { |
|
174 | + return $item1['order'] - $item2['order']; |
|
175 | + }); |
|
176 | + $nav->assign('navigationItems', $navItems); |
|
177 | + |
|
178 | + $contentItems = []; |
|
179 | + |
|
180 | + // render the container content for every navigation item |
|
181 | + foreach ($navItems as $item) { |
|
182 | + $content = ''; |
|
183 | + if (isset($item['script'])) { |
|
184 | + $content = $this->renderScript($item['appname'], $item['script']); |
|
185 | + } |
|
186 | + $contentItem = []; |
|
187 | + $contentItem['id'] = $item['id']; |
|
188 | + $contentItem['content'] = $content; |
|
189 | + $contentItems[] = $contentItem; |
|
190 | + } |
|
191 | + |
|
192 | + $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts'); |
|
193 | + |
|
194 | + $params = []; |
|
195 | + $params['usedSpacePercent'] = (int)$storageInfo['relative']; |
|
196 | + $params['owner'] = $storageInfo['owner']; |
|
197 | + $params['ownerDisplayName'] = $storageInfo['ownerDisplayName']; |
|
198 | + $params['isPublic'] = false; |
|
199 | + $params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'); |
|
200 | + $user = $this->userSession->getUser()->getUID(); |
|
201 | + $params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name'); |
|
202 | + $params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc'); |
|
203 | + $showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false); |
|
204 | + $params['showHiddenFiles'] = $showHidden ? 1 : 0; |
|
205 | + $params['fileNotFound'] = $fileNotFound ? 1 : 0; |
|
206 | + $params['appNavigation'] = $nav; |
|
207 | + $params['appContents'] = $contentItems; |
|
208 | + |
|
209 | + $response = new TemplateResponse( |
|
210 | + $this->appName, |
|
211 | + 'index', |
|
212 | + $params |
|
213 | + ); |
|
214 | + $policy = new ContentSecurityPolicy(); |
|
215 | + $policy->addAllowedFrameDomain('\'self\''); |
|
216 | + $response->setContentSecurityPolicy($policy); |
|
217 | + |
|
218 | + return $response; |
|
219 | + } |
|
220 | + |
|
221 | + /** |
|
222 | + * Redirects to the file list and highlight the given file id |
|
223 | + * |
|
224 | + * @param string $fileId file id to show |
|
225 | + * @return RedirectResponse redirect response or not found response |
|
226 | + * @throws \OCP\Files\NotFoundException |
|
227 | + */ |
|
228 | + private function showFile($fileId) { |
|
229 | + $uid = $this->userSession->getUser()->getUID(); |
|
230 | + $baseFolder = $this->rootFolder->getUserFolder($uid); |
|
231 | + $files = $baseFolder->getById($fileId); |
|
232 | + $params = []; |
|
233 | + |
|
234 | + if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) { |
|
235 | + $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/'); |
|
236 | + $files = $baseFolder->getById($fileId); |
|
237 | + $params['view'] = 'trashbin'; |
|
238 | + } |
|
239 | + |
|
240 | + if (!empty($files)) { |
|
241 | + $file = current($files); |
|
242 | + if ($file instanceof Folder) { |
|
243 | + // set the full path to enter the folder |
|
244 | + $params['dir'] = $baseFolder->getRelativePath($file->getPath()); |
|
245 | + } else { |
|
246 | + // set parent path as dir |
|
247 | + $params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath()); |
|
248 | + // and scroll to the entry |
|
249 | + $params['scrollto'] = $file->getName(); |
|
250 | + } |
|
251 | + return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params)); |
|
252 | + } |
|
253 | + throw new \OCP\Files\NotFoundException(); |
|
254 | + } |
|
255 | 255 | } |