@@ -38,71 +38,71 @@ |
||
38 | 38 | */ |
39 | 39 | class GroupManagement extends Action { |
40 | 40 | |
41 | - /** |
|
42 | - * log add user to group event |
|
43 | - * |
|
44 | - * @param IGroup $group |
|
45 | - * @param IUser $user |
|
46 | - */ |
|
47 | - public function addUser(IGroup $group, IUser $user) { |
|
48 | - $this->log('User "%s" added to group "%s"', |
|
49 | - [ |
|
50 | - 'group' => $group->getGID(), |
|
51 | - 'user' => $user->getUID() |
|
52 | - ], |
|
53 | - [ |
|
54 | - 'user', 'group' |
|
55 | - ] |
|
56 | - ); |
|
57 | - } |
|
41 | + /** |
|
42 | + * log add user to group event |
|
43 | + * |
|
44 | + * @param IGroup $group |
|
45 | + * @param IUser $user |
|
46 | + */ |
|
47 | + public function addUser(IGroup $group, IUser $user) { |
|
48 | + $this->log('User "%s" added to group "%s"', |
|
49 | + [ |
|
50 | + 'group' => $group->getGID(), |
|
51 | + 'user' => $user->getUID() |
|
52 | + ], |
|
53 | + [ |
|
54 | + 'user', 'group' |
|
55 | + ] |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * log remove user from group event |
|
61 | - * |
|
62 | - * @param IGroup $group |
|
63 | - * @param IUser $user |
|
64 | - */ |
|
65 | - public function removeUser(IGroup $group, IUser $user) { |
|
66 | - $this->log('User "%s" removed from group "%s"', |
|
67 | - [ |
|
68 | - 'group' => $group->getGID(), |
|
69 | - 'user' => $user->getUID() |
|
70 | - ], |
|
71 | - [ |
|
72 | - 'user', 'group' |
|
73 | - ] |
|
74 | - ); |
|
75 | - } |
|
59 | + /** |
|
60 | + * log remove user from group event |
|
61 | + * |
|
62 | + * @param IGroup $group |
|
63 | + * @param IUser $user |
|
64 | + */ |
|
65 | + public function removeUser(IGroup $group, IUser $user) { |
|
66 | + $this->log('User "%s" removed from group "%s"', |
|
67 | + [ |
|
68 | + 'group' => $group->getGID(), |
|
69 | + 'user' => $user->getUID() |
|
70 | + ], |
|
71 | + [ |
|
72 | + 'user', 'group' |
|
73 | + ] |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * log create group to group event |
|
79 | - * |
|
80 | - * @param IGroup $group |
|
81 | - */ |
|
82 | - public function createGroup(IGroup $group) { |
|
83 | - $this->log('Group created: "%s"', |
|
84 | - [ |
|
85 | - 'group' => $group->getGID() |
|
86 | - ], |
|
87 | - [ |
|
88 | - 'group' |
|
89 | - ] |
|
90 | - ); |
|
91 | - } |
|
77 | + /** |
|
78 | + * log create group to group event |
|
79 | + * |
|
80 | + * @param IGroup $group |
|
81 | + */ |
|
82 | + public function createGroup(IGroup $group) { |
|
83 | + $this->log('Group created: "%s"', |
|
84 | + [ |
|
85 | + 'group' => $group->getGID() |
|
86 | + ], |
|
87 | + [ |
|
88 | + 'group' |
|
89 | + ] |
|
90 | + ); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * log delete group to group event |
|
95 | - * |
|
96 | - * @param IGroup $group |
|
97 | - */ |
|
98 | - public function deleteGroup(IGroup $group) { |
|
99 | - $this->log('Group deleted: "%s"', |
|
100 | - [ |
|
101 | - 'group' => $group->getGID() |
|
102 | - ], |
|
103 | - [ |
|
104 | - 'group' |
|
105 | - ] |
|
106 | - ); |
|
107 | - } |
|
93 | + /** |
|
94 | + * log delete group to group event |
|
95 | + * |
|
96 | + * @param IGroup $group |
|
97 | + */ |
|
98 | + public function deleteGroup(IGroup $group) { |
|
99 | + $this->log('Group deleted: "%s"', |
|
100 | + [ |
|
101 | + 'group' => $group->getGID() |
|
102 | + ], |
|
103 | + [ |
|
104 | + 'group' |
|
105 | + ] |
|
106 | + ); |
|
107 | + } |
|
108 | 108 | } |
@@ -29,137 +29,137 @@ |
||
29 | 29 | * @package OCA\AdminAudit\Actions |
30 | 30 | */ |
31 | 31 | class Files extends Action { |
32 | - /** |
|
33 | - * Logs file read actions |
|
34 | - * |
|
35 | - * @param array $params |
|
36 | - */ |
|
37 | - public function read(array $params) { |
|
38 | - $this->log( |
|
39 | - 'File accessed: "%s"', |
|
40 | - $params, |
|
41 | - [ |
|
42 | - 'path', |
|
43 | - ] |
|
44 | - ); |
|
45 | - } |
|
32 | + /** |
|
33 | + * Logs file read actions |
|
34 | + * |
|
35 | + * @param array $params |
|
36 | + */ |
|
37 | + public function read(array $params) { |
|
38 | + $this->log( |
|
39 | + 'File accessed: "%s"', |
|
40 | + $params, |
|
41 | + [ |
|
42 | + 'path', |
|
43 | + ] |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Logs rename actions of files |
|
49 | - * |
|
50 | - * @param array $params |
|
51 | - */ |
|
52 | - public function rename(array $params) { |
|
53 | - $this->log( |
|
54 | - 'File renamed: "%s" to "%s"', |
|
55 | - $params, |
|
56 | - [ |
|
57 | - 'oldpath', |
|
58 | - 'newpath', |
|
59 | - ] |
|
60 | - ); |
|
61 | - } |
|
47 | + /** |
|
48 | + * Logs rename actions of files |
|
49 | + * |
|
50 | + * @param array $params |
|
51 | + */ |
|
52 | + public function rename(array $params) { |
|
53 | + $this->log( |
|
54 | + 'File renamed: "%s" to "%s"', |
|
55 | + $params, |
|
56 | + [ |
|
57 | + 'oldpath', |
|
58 | + 'newpath', |
|
59 | + ] |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Logs creation of files |
|
65 | - * |
|
66 | - * @param array $params |
|
67 | - */ |
|
68 | - public function create(array $params) { |
|
69 | - if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
70 | - return; |
|
71 | - } |
|
63 | + /** |
|
64 | + * Logs creation of files |
|
65 | + * |
|
66 | + * @param array $params |
|
67 | + */ |
|
68 | + public function create(array $params) { |
|
69 | + if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
70 | + return; |
|
71 | + } |
|
72 | 72 | |
73 | - $this->log( |
|
74 | - 'File created: "%s"', |
|
75 | - $params, |
|
76 | - [ |
|
77 | - 'path', |
|
78 | - ] |
|
79 | - ); |
|
80 | - } |
|
73 | + $this->log( |
|
74 | + 'File created: "%s"', |
|
75 | + $params, |
|
76 | + [ |
|
77 | + 'path', |
|
78 | + ] |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Logs copying of files |
|
84 | - * |
|
85 | - * @param array $params |
|
86 | - */ |
|
87 | - public function copy(array $params) { |
|
88 | - $this->log( |
|
89 | - 'File copied: "%s" to "%s"', |
|
90 | - $params, |
|
91 | - [ |
|
92 | - 'oldpath', |
|
93 | - 'newpath', |
|
94 | - ] |
|
95 | - ); |
|
96 | - } |
|
82 | + /** |
|
83 | + * Logs copying of files |
|
84 | + * |
|
85 | + * @param array $params |
|
86 | + */ |
|
87 | + public function copy(array $params) { |
|
88 | + $this->log( |
|
89 | + 'File copied: "%s" to "%s"', |
|
90 | + $params, |
|
91 | + [ |
|
92 | + 'oldpath', |
|
93 | + 'newpath', |
|
94 | + ] |
|
95 | + ); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * Logs writing of files |
|
100 | - * |
|
101 | - * @param array $params |
|
102 | - */ |
|
103 | - public function write(array $params) { |
|
104 | - if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
105 | - return; |
|
106 | - } |
|
98 | + /** |
|
99 | + * Logs writing of files |
|
100 | + * |
|
101 | + * @param array $params |
|
102 | + */ |
|
103 | + public function write(array $params) { |
|
104 | + if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
105 | + return; |
|
106 | + } |
|
107 | 107 | |
108 | - $this->log( |
|
109 | - 'File written to: "%s"', |
|
110 | - $params, |
|
111 | - [ |
|
112 | - 'path', |
|
113 | - ] |
|
114 | - ); |
|
115 | - } |
|
108 | + $this->log( |
|
109 | + 'File written to: "%s"', |
|
110 | + $params, |
|
111 | + [ |
|
112 | + 'path', |
|
113 | + ] |
|
114 | + ); |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Logs update of files |
|
119 | - * |
|
120 | - * @param array $params |
|
121 | - */ |
|
122 | - public function update(array $params) { |
|
123 | - $this->log( |
|
124 | - 'File updated: "%s"', |
|
125 | - $params, |
|
126 | - [ |
|
127 | - 'path', |
|
128 | - ] |
|
129 | - ); |
|
130 | - } |
|
117 | + /** |
|
118 | + * Logs update of files |
|
119 | + * |
|
120 | + * @param array $params |
|
121 | + */ |
|
122 | + public function update(array $params) { |
|
123 | + $this->log( |
|
124 | + 'File updated: "%s"', |
|
125 | + $params, |
|
126 | + [ |
|
127 | + 'path', |
|
128 | + ] |
|
129 | + ); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Logs deletions of files |
|
134 | - * |
|
135 | - * @param array $params |
|
136 | - */ |
|
137 | - public function delete(array $params) { |
|
138 | - $this->log( |
|
139 | - 'File deleted: "%s"', |
|
140 | - $params, |
|
141 | - [ |
|
142 | - 'path', |
|
143 | - ] |
|
144 | - ); |
|
145 | - } |
|
132 | + /** |
|
133 | + * Logs deletions of files |
|
134 | + * |
|
135 | + * @param array $params |
|
136 | + */ |
|
137 | + public function delete(array $params) { |
|
138 | + $this->log( |
|
139 | + 'File deleted: "%s"', |
|
140 | + $params, |
|
141 | + [ |
|
142 | + 'path', |
|
143 | + ] |
|
144 | + ); |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * Logs preview access to a file |
|
149 | - * |
|
150 | - * @param array $params |
|
151 | - */ |
|
152 | - public function preview(array $params) { |
|
153 | - $this->log( |
|
154 | - 'Preview accessed: "%s" (width: "%s", height: "%s" crop: "%s", mode: "%s")', |
|
155 | - $params, |
|
156 | - [ |
|
157 | - 'path', |
|
158 | - 'width', |
|
159 | - 'height', |
|
160 | - 'crop', |
|
161 | - 'mode' |
|
162 | - ] |
|
163 | - ); |
|
164 | - } |
|
147 | + /** |
|
148 | + * Logs preview access to a file |
|
149 | + * |
|
150 | + * @param array $params |
|
151 | + */ |
|
152 | + public function preview(array $params) { |
|
153 | + $this->log( |
|
154 | + 'Preview accessed: "%s" (width: "%s", height: "%s" crop: "%s", mode: "%s")', |
|
155 | + $params, |
|
156 | + [ |
|
157 | + 'path', |
|
158 | + 'width', |
|
159 | + 'height', |
|
160 | + 'crop', |
|
161 | + 'mode' |
|
162 | + ] |
|
163 | + ); |
|
164 | + } |
|
165 | 165 | } |
@@ -29,33 +29,33 @@ |
||
29 | 29 | * @package OCA\AdminAudit\Actions |
30 | 30 | */ |
31 | 31 | class Auth extends Action { |
32 | - public function loginAttempt(array $params) { |
|
33 | - $this->log( |
|
34 | - 'Login attempt: "%s"', |
|
35 | - $params, |
|
36 | - [ |
|
37 | - 'uid', |
|
38 | - ], |
|
39 | - true |
|
40 | - ); |
|
41 | - } |
|
32 | + public function loginAttempt(array $params) { |
|
33 | + $this->log( |
|
34 | + 'Login attempt: "%s"', |
|
35 | + $params, |
|
36 | + [ |
|
37 | + 'uid', |
|
38 | + ], |
|
39 | + true |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | - public function loginSuccessful(array $params) { |
|
44 | - $this->log( |
|
45 | - 'Login successful: "%s"', |
|
46 | - $params, |
|
47 | - [ |
|
48 | - 'uid', |
|
49 | - ], |
|
50 | - true |
|
51 | - ); |
|
52 | - } |
|
43 | + public function loginSuccessful(array $params) { |
|
44 | + $this->log( |
|
45 | + 'Login successful: "%s"', |
|
46 | + $params, |
|
47 | + [ |
|
48 | + 'uid', |
|
49 | + ], |
|
50 | + true |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | |
54 | - public function logout(array $params) { |
|
55 | - $this->log( |
|
56 | - 'Logout occurred', |
|
57 | - [], |
|
58 | - [] |
|
59 | - ); |
|
60 | - } |
|
54 | + public function logout(array $params) { |
|
55 | + $this->log( |
|
56 | + 'Logout occurred', |
|
57 | + [], |
|
58 | + [] |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | } |
@@ -29,25 +29,25 @@ |
||
29 | 29 | use OCP\IUserSession; |
30 | 30 | |
31 | 31 | class PersonalSection extends Section { |
32 | - /** @var IUserSession */ |
|
33 | - private $userSession; |
|
32 | + /** @var IUserSession */ |
|
33 | + private $userSession; |
|
34 | 34 | |
35 | - /** @var UserGlobalStoragesService */ |
|
36 | - private $userGlobalStoragesService; |
|
35 | + /** @var UserGlobalStoragesService */ |
|
36 | + private $userGlobalStoragesService; |
|
37 | 37 | |
38 | - /** @var BackendService */ |
|
39 | - private $backendService; |
|
38 | + /** @var BackendService */ |
|
39 | + private $backendService; |
|
40 | 40 | |
41 | - public function __construct( |
|
42 | - IURLGenerator $url, |
|
43 | - IL10N $l, |
|
44 | - IUserSession $userSession, |
|
45 | - UserGlobalStoragesService $userGlobalStoragesService, |
|
46 | - BackendService $backendService |
|
47 | - ) { |
|
48 | - parent::__construct($url, $l); |
|
49 | - $this->userSession = $userSession; |
|
50 | - $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
51 | - $this->backendService = $backendService; |
|
52 | - } |
|
41 | + public function __construct( |
|
42 | + IURLGenerator $url, |
|
43 | + IL10N $l, |
|
44 | + IUserSession $userSession, |
|
45 | + UserGlobalStoragesService $userGlobalStoragesService, |
|
46 | + BackendService $backendService |
|
47 | + ) { |
|
48 | + parent::__construct($url, $l); |
|
49 | + $this->userSession = $userSession; |
|
50 | + $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
51 | + $this->backendService = $backendService; |
|
52 | + } |
|
53 | 53 | } |
@@ -24,29 +24,29 @@ |
||
24 | 24 | use OCP\IRequest; |
25 | 25 | |
26 | 26 | class Capabilities implements IPublicCapability { |
27 | - /** @var IRequest */ |
|
28 | - private $request; |
|
27 | + /** @var IRequest */ |
|
28 | + private $request; |
|
29 | 29 | |
30 | - /** @var Throttler */ |
|
31 | - private $throttler; |
|
30 | + /** @var Throttler */ |
|
31 | + private $throttler; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Capabilities constructor. |
|
35 | - * |
|
36 | - * @param IRequest $request |
|
37 | - * @param Throttler $throttler |
|
38 | - */ |
|
39 | - public function __construct(IRequest $request, |
|
40 | - Throttler $throttler) { |
|
41 | - $this->request = $request; |
|
42 | - $this->throttler = $throttler; |
|
43 | - } |
|
33 | + /** |
|
34 | + * Capabilities constructor. |
|
35 | + * |
|
36 | + * @param IRequest $request |
|
37 | + * @param Throttler $throttler |
|
38 | + */ |
|
39 | + public function __construct(IRequest $request, |
|
40 | + Throttler $throttler) { |
|
41 | + $this->request = $request; |
|
42 | + $this->throttler = $throttler; |
|
43 | + } |
|
44 | 44 | |
45 | - public function getCapabilities() { |
|
46 | - return [ |
|
47 | - 'bruteforce' => [ |
|
48 | - 'delay' => $this->throttler->getDelay($this->request->getRemoteAddress()) |
|
49 | - ] |
|
50 | - ]; |
|
51 | - } |
|
45 | + public function getCapabilities() { |
|
46 | + return [ |
|
47 | + 'bruteforce' => [ |
|
48 | + 'delay' => $this->throttler->getDelay($this->request->getRemoteAddress()) |
|
49 | + ] |
|
50 | + ]; |
|
51 | + } |
|
52 | 52 | } |
@@ -29,68 +29,68 @@ |
||
29 | 29 | use OCP\Diagnostics\IQueryLogger; |
30 | 30 | |
31 | 31 | class QueryLogger implements IQueryLogger { |
32 | - /** |
|
33 | - * @var \OC\Diagnostics\Query |
|
34 | - */ |
|
35 | - protected $activeQuery; |
|
32 | + /** |
|
33 | + * @var \OC\Diagnostics\Query |
|
34 | + */ |
|
35 | + protected $activeQuery; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @var CappedMemoryCache |
|
39 | - */ |
|
40 | - protected $queries; |
|
37 | + /** |
|
38 | + * @var CappedMemoryCache |
|
39 | + */ |
|
40 | + protected $queries; |
|
41 | 41 | |
42 | - /** |
|
43 | - * QueryLogger constructor. |
|
44 | - */ |
|
45 | - public function __construct() { |
|
46 | - $this->queries = new CappedMemoryCache(1024); |
|
47 | - } |
|
42 | + /** |
|
43 | + * QueryLogger constructor. |
|
44 | + */ |
|
45 | + public function __construct() { |
|
46 | + $this->queries = new CappedMemoryCache(1024); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @var bool - Module needs to be activated by some app |
|
52 | - */ |
|
53 | - private $activated = false; |
|
50 | + /** |
|
51 | + * @var bool - Module needs to be activated by some app |
|
52 | + */ |
|
53 | + private $activated = false; |
|
54 | 54 | |
55 | - /** |
|
56 | - * @inheritdoc |
|
57 | - */ |
|
58 | - public function startQuery($sql, array $params = null, array $types = null) { |
|
59 | - if ($this->activated) { |
|
60 | - $this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack()); |
|
61 | - } |
|
62 | - } |
|
55 | + /** |
|
56 | + * @inheritdoc |
|
57 | + */ |
|
58 | + public function startQuery($sql, array $params = null, array $types = null) { |
|
59 | + if ($this->activated) { |
|
60 | + $this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack()); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - private function getStack() { |
|
65 | - $stack = debug_backtrace(); |
|
66 | - array_shift($stack); |
|
67 | - array_shift($stack); |
|
68 | - array_shift($stack); |
|
69 | - return $stack; |
|
70 | - } |
|
64 | + private function getStack() { |
|
65 | + $stack = debug_backtrace(); |
|
66 | + array_shift($stack); |
|
67 | + array_shift($stack); |
|
68 | + array_shift($stack); |
|
69 | + return $stack; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @inheritdoc |
|
74 | - */ |
|
75 | - public function stopQuery() { |
|
76 | - if ($this->activated && $this->activeQuery) { |
|
77 | - $this->activeQuery->end(microtime(true)); |
|
78 | - $this->queries[] = $this->activeQuery; |
|
79 | - $this->activeQuery = null; |
|
80 | - } |
|
81 | - } |
|
72 | + /** |
|
73 | + * @inheritdoc |
|
74 | + */ |
|
75 | + public function stopQuery() { |
|
76 | + if ($this->activated && $this->activeQuery) { |
|
77 | + $this->activeQuery->end(microtime(true)); |
|
78 | + $this->queries[] = $this->activeQuery; |
|
79 | + $this->activeQuery = null; |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * @inheritdoc |
|
85 | - */ |
|
86 | - public function getQueries() { |
|
87 | - return $this->queries->getData(); |
|
88 | - } |
|
83 | + /** |
|
84 | + * @inheritdoc |
|
85 | + */ |
|
86 | + public function getQueries() { |
|
87 | + return $this->queries->getData(); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @inheritdoc |
|
92 | - */ |
|
93 | - public function activate() { |
|
94 | - $this->activated = true; |
|
95 | - } |
|
90 | + /** |
|
91 | + * @inheritdoc |
|
92 | + */ |
|
93 | + public function activate() { |
|
94 | + $this->activated = true; |
|
95 | + } |
|
96 | 96 | } |
@@ -27,55 +27,55 @@ |
||
27 | 27 | use OCP\DB\QueryBuilder\IQueryFunction; |
28 | 28 | |
29 | 29 | class QuoteHelper { |
30 | - /** |
|
31 | - * @param array|string|ILiteral|IParameter|IQueryFunction $strings string, Literal or Parameter |
|
32 | - * @return array|string |
|
33 | - */ |
|
34 | - public function quoteColumnNames($strings) { |
|
35 | - if (!is_array($strings)) { |
|
36 | - return $this->quoteColumnName($strings); |
|
37 | - } |
|
30 | + /** |
|
31 | + * @param array|string|ILiteral|IParameter|IQueryFunction $strings string, Literal or Parameter |
|
32 | + * @return array|string |
|
33 | + */ |
|
34 | + public function quoteColumnNames($strings) { |
|
35 | + if (!is_array($strings)) { |
|
36 | + return $this->quoteColumnName($strings); |
|
37 | + } |
|
38 | 38 | |
39 | - $return = []; |
|
40 | - foreach ($strings as $string) { |
|
41 | - $return[] = $this->quoteColumnName($string); |
|
42 | - } |
|
39 | + $return = []; |
|
40 | + foreach ($strings as $string) { |
|
41 | + $return[] = $this->quoteColumnName($string); |
|
42 | + } |
|
43 | 43 | |
44 | - return $return; |
|
45 | - } |
|
44 | + return $return; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param string|ILiteral|IParameter|IQueryFunction $string string, Literal or Parameter |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - public function quoteColumnName($string) { |
|
52 | - if ($string instanceof IParameter || $string instanceof ILiteral || $string instanceof IQueryFunction) { |
|
53 | - return (string) $string; |
|
54 | - } |
|
47 | + /** |
|
48 | + * @param string|ILiteral|IParameter|IQueryFunction $string string, Literal or Parameter |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + public function quoteColumnName($string) { |
|
52 | + if ($string instanceof IParameter || $string instanceof ILiteral || $string instanceof IQueryFunction) { |
|
53 | + return (string) $string; |
|
54 | + } |
|
55 | 55 | |
56 | - if ($string === null || $string === 'null' || $string === '*') { |
|
57 | - return $string; |
|
58 | - } |
|
56 | + if ($string === null || $string === 'null' || $string === '*') { |
|
57 | + return $string; |
|
58 | + } |
|
59 | 59 | |
60 | - if (!is_string($string)) { |
|
61 | - throw new \InvalidArgumentException('Only strings, Literals and Parameters are allowed'); |
|
62 | - } |
|
60 | + if (!is_string($string)) { |
|
61 | + throw new \InvalidArgumentException('Only strings, Literals and Parameters are allowed'); |
|
62 | + } |
|
63 | 63 | |
64 | - $string = str_replace(' AS ', ' as ', $string); |
|
65 | - if (substr_count($string, ' as ')) { |
|
66 | - return implode(' as ', array_map([$this, 'quoteColumnName'], explode(' as ', $string, 2))); |
|
67 | - } |
|
64 | + $string = str_replace(' AS ', ' as ', $string); |
|
65 | + if (substr_count($string, ' as ')) { |
|
66 | + return implode(' as ', array_map([$this, 'quoteColumnName'], explode(' as ', $string, 2))); |
|
67 | + } |
|
68 | 68 | |
69 | - if (substr_count($string, '.')) { |
|
70 | - list($alias, $columnName) = explode('.', $string, 2); |
|
69 | + if (substr_count($string, '.')) { |
|
70 | + list($alias, $columnName) = explode('.', $string, 2); |
|
71 | 71 | |
72 | - if ($columnName === '*') { |
|
73 | - return '`' . $alias . '`.*'; |
|
74 | - } |
|
72 | + if ($columnName === '*') { |
|
73 | + return '`' . $alias . '`.*'; |
|
74 | + } |
|
75 | 75 | |
76 | - return '`' . $alias . '`.`' . $columnName . '`'; |
|
77 | - } |
|
76 | + return '`' . $alias . '`.`' . $columnName . '`'; |
|
77 | + } |
|
78 | 78 | |
79 | - return '`' . $string . '`'; |
|
80 | - } |
|
79 | + return '`' . $string . '`'; |
|
80 | + } |
|
81 | 81 | } |
@@ -29,39 +29,39 @@ |
||
29 | 29 | |
30 | 30 | class ConfigController extends OCSController { |
31 | 31 | |
32 | - /** @var IConfig */ |
|
33 | - private $config; |
|
32 | + /** @var IConfig */ |
|
33 | + private $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param string $appName |
|
37 | - * @param IRequest $request |
|
38 | - * @param IConfig $config |
|
39 | - */ |
|
40 | - public function __construct($appName, |
|
41 | - IRequest $request, |
|
42 | - IConfig $config) { |
|
43 | - parent::__construct($appName, $request); |
|
44 | - $this->config = $config; |
|
45 | - } |
|
35 | + /** |
|
36 | + * @param string $appName |
|
37 | + * @param IRequest $request |
|
38 | + * @param IConfig $config |
|
39 | + */ |
|
40 | + public function __construct($appName, |
|
41 | + IRequest $request, |
|
42 | + IConfig $config) { |
|
43 | + parent::__construct($appName, $request); |
|
44 | + $this->config = $config; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param string $appid |
|
49 | - * @param string $configkey |
|
50 | - * @param string $value |
|
51 | - * @return DataResponse |
|
52 | - */ |
|
53 | - public function setAppValue($appid, $configkey, $value) { |
|
54 | - $this->config->setAppValue($appid, $configkey, $value); |
|
55 | - return new DataResponse(); |
|
56 | - } |
|
47 | + /** |
|
48 | + * @param string $appid |
|
49 | + * @param string $configkey |
|
50 | + * @param string $value |
|
51 | + * @return DataResponse |
|
52 | + */ |
|
53 | + public function setAppValue($appid, $configkey, $value) { |
|
54 | + $this->config->setAppValue($appid, $configkey, $value); |
|
55 | + return new DataResponse(); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $appid |
|
60 | - * @param string $configkey |
|
61 | - * @return DataResponse |
|
62 | - */ |
|
63 | - public function deleteAppValue($appid, $configkey) { |
|
64 | - $this->config->deleteAppValue($appid, $configkey); |
|
65 | - return new DataResponse(); |
|
66 | - } |
|
58 | + /** |
|
59 | + * @param string $appid |
|
60 | + * @param string $configkey |
|
61 | + * @return DataResponse |
|
62 | + */ |
|
63 | + public function deleteAppValue($appid, $configkey) { |
|
64 | + $this->config->deleteAppValue($appid, $configkey); |
|
65 | + return new DataResponse(); |
|
66 | + } |
|
67 | 67 | } |
@@ -33,12 +33,12 @@ |
||
33 | 33 | */ |
34 | 34 | interface ICallbackResponse { |
35 | 35 | |
36 | - /** |
|
37 | - * Outputs the content that should be printed |
|
38 | - * |
|
39 | - * @param IOutput $output a small wrapper that handles output |
|
40 | - * @since 8.1.0 |
|
41 | - */ |
|
42 | - public function callback(IOutput $output); |
|
36 | + /** |
|
37 | + * Outputs the content that should be printed |
|
38 | + * |
|
39 | + * @param IOutput $output a small wrapper that handles output |
|
40 | + * @since 8.1.0 |
|
41 | + */ |
|
42 | + public function callback(IOutput $output); |
|
43 | 43 | |
44 | 44 | } |