@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getGroups($search = '', $limit = null, $offset = null) { |
74 | 74 | if ($limit !== null) { |
75 | - $limit = (int)$limit; |
|
75 | + $limit = (int) $limit; |
|
76 | 76 | } |
77 | 77 | if ($offset !== null) { |
78 | - $offset = (int)$offset; |
|
78 | + $offset = (int) $offset; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $groups = $this->groupManager->search($search, $limit, $offset); |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | $user = $this->userSession->getUser(); |
101 | 101 | |
102 | 102 | // Check the group exists |
103 | - if(!$this->groupManager->groupExists($groupId)) { |
|
103 | + if (!$this->groupManager->groupExists($groupId)) { |
|
104 | 104 | throw new OCSException('The requested group could not be found', \OCP\API::RESPOND_NOT_FOUND); |
105 | 105 | } |
106 | 106 | |
107 | 107 | $isSubadminOfGroup = false; |
108 | 108 | $group = $this->groupManager->get($groupId); |
109 | 109 | if ($group !== null) { |
110 | - $isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminofGroup($user, $group); |
|
110 | + $isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminofGroup($user, $group); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // Check subadmin has access to this group |
114 | - if($this->groupManager->isAdmin($user->getUID()) |
|
114 | + if ($this->groupManager->isAdmin($user->getUID()) |
|
115 | 115 | || $isSubadminOfGroup) { |
116 | 116 | $users = $this->groupManager->get($groupId)->getUsers(); |
117 | - $users = array_map(function($user) { |
|
117 | + $users = array_map(function($user) { |
|
118 | 118 | /** @var IUser $user */ |
119 | 119 | return $user->getUID(); |
120 | 120 | }, $users); |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function addGroup($groupid) { |
138 | 138 | // Validate name |
139 | - if(empty($groupid)){ |
|
139 | + if (empty($groupid)) { |
|
140 | 140 | \OCP\Util::writeLog('provisioning_api', 'Group name not supplied', \OCP\Util::ERROR); |
141 | 141 | throw new OCSException('Invalid group name', 101); |
142 | 142 | } |
143 | 143 | // Check if it exists |
144 | - if($this->groupManager->groupExists($groupid)){ |
|
144 | + if ($this->groupManager->groupExists($groupid)) { |
|
145 | 145 | throw new OCSException('', 102); |
146 | 146 | } |
147 | 147 | $this->groupManager->createGroup($groupid); |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function deleteGroup($groupId) { |
159 | 159 | // Check it exists |
160 | - if(!$this->groupManager->groupExists($groupId)){ |
|
160 | + if (!$this->groupManager->groupExists($groupId)) { |
|
161 | 161 | throw new OCSException('', 101); |
162 | - } else if($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()){ |
|
162 | + } else if ($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()) { |
|
163 | 163 | // Cannot delete admin group |
164 | 164 | throw new OCSException('', 102); |
165 | 165 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | public function getSubAdminsOfGroup($groupId) { |
176 | 176 | // Check group exists |
177 | 177 | $targetGroup = $this->groupManager->get($groupId); |
178 | - if($targetGroup === null) { |
|
178 | + if ($targetGroup === null) { |
|
179 | 179 | throw new OCSException('Group does not exist', 101); |
180 | 180 | } |
181 | 181 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $currentChannel = $_['currentChannel']; |
15 | 15 | ?> |
16 | 16 | <form id="oca_updatenotification_section" class="followupsection"> |
17 | - <?php if($isNewVersionAvailable === true) { ?> |
|
17 | + <?php if ($isNewVersionAvailable === true) { ?> |
|
18 | 18 | <strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong> |
19 | 19 | <?php if ($_['updaterEnabled']) { ?> |
20 | 20 | <input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>"> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | <label for="release-channel"><?php p($l->t('Update channel:')) ?></label> |
32 | 32 | <select id="release-channel"> |
33 | 33 | <option value="<?php p($currentChannel); ?>"><?php p($currentChannel); ?></option> |
34 | - <?php foreach ($channels as $channel => $channelTitle){ ?> |
|
34 | + <?php foreach ($channels as $channel => $channelTitle) { ?> |
|
35 | 35 | <option value="<?php p($channelTitle) ?>"> |
36 | 36 | <?php p($channelTitle) ?> |
37 | 37 | </option> |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $notification->setParsedSubject($l->t('Update to %1$s is available.', [$parameters['version']])); |
92 | 92 | |
93 | 93 | if ($this->isAdmin()) { |
94 | - $notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index') . '#updater'); |
|
94 | + $notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index').'#updater'); |
|
95 | 95 | } |
96 | 96 | } else { |
97 | 97 | $appInfo = $this->getAppInfo($notification->getObjectType()); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ]); |
112 | 112 | |
113 | 113 | if ($this->isAdmin()) { |
114 | - $notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps') . '#app-' . $notification->getObjectType()); |
|
114 | + $notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps').'#app-'.$notification->getObjectType()); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 |
@@ -99,7 +99,7 @@ |
||
99 | 99 | $currentChannel = \OCP\Util::getChannel(); |
100 | 100 | |
101 | 101 | // Remove the currently used channel from the channels list |
102 | - if(($key = array_search($currentChannel, $channels)) !== false) { |
|
102 | + if (($key = array_search($currentChannel, $channels)) !== false) { |
|
103 | 103 | unset($channels[$key]); |
104 | 104 | } |
105 | 105 | $updateState = $this->updateChecker->getUpdateState(); |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | $data = $this->updater->check(); |
44 | 44 | $result = []; |
45 | 45 | |
46 | - if(isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) { |
|
46 | + if (isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) { |
|
47 | 47 | $result['updateAvailable'] = true; |
48 | 48 | $result['updateVersion'] = $data['versionstring']; |
49 | 49 | $result['updaterEnabled'] = $data['autoupdater'] === '1'; |
50 | - if(substr($data['web'], 0, 8) === 'https://') { |
|
50 | + if (substr($data['web'], 0, 8) === 'https://') { |
|
51 | 51 | $result['updateLink'] = $data['web']; |
52 | 52 | } |
53 | - if(substr($data['url'], 0, 8) === 'https://') { |
|
53 | + if (substr($data['url'], 0, 8) === 'https://') { |
|
54 | 54 | $result['downloadLink'] = $data['url']; |
55 | 55 | } |
56 | 56 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array $data |
65 | 65 | */ |
66 | 66 | public function getJavaScript(array $data) { |
67 | - $data['array']['oc_updateState'] = json_encode([ |
|
67 | + $data['array']['oc_updateState'] = json_encode([ |
|
68 | 68 | 'updateAvailable' => true, |
69 | 69 | 'updateVersion' => $this->getUpdateState()['updateVersion'], |
70 | 70 | 'updateLink' => isset($this->getUpdateState()['updateLink']) ? $this->getUpdateState()['updateLink'] : '', |
@@ -30,7 +30,7 @@ |
||
30 | 30 | use OCP\AppFramework\IAppContainer; |
31 | 31 | |
32 | 32 | class Application extends App { |
33 | - public function __construct (array $urlParams = array()) { |
|
33 | + public function __construct(array $urlParams = array()) { |
|
34 | 34 | parent::__construct('updatenotification', $urlParams); |
35 | 35 | $container = $this->getContainer(); |
36 | 36 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | */ |
70 | 70 | protected function run($argument) { |
71 | 71 | // Delete old tokens after 2 days |
72 | - if($this->timeFactory->getTime() - $this->config->getAppValue('core', 'updater.secret.created', $this->timeFactory->getTime()) >= 172800) { |
|
72 | + if ($this->timeFactory->getTime() - $this->config->getAppValue('core', 'updater.secret.created', $this->timeFactory->getTime()) >= 172800) { |
|
73 | 73 | $this->config->deleteSystemValue('updater.secret'); |
74 | 74 | } |
75 | 75 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | */ |
24 | 24 | |
25 | -if(\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) { |
|
25 | +if (\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) { |
|
26 | 26 | $updater = new \OC\Updater\VersionCheck( |
27 | 27 | \OC::$server->getHTTPClientService(), |
28 | 28 | \OC::$server->getConfig() |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | ); |
33 | 33 | |
34 | 34 | $userObject = \OC::$server->getUserSession()->getUser(); |
35 | - if($userObject !== null) { |
|
36 | - if(\OC::$server->getGroupManager()->isAdmin($userObject->getUID()) && |
|
35 | + if ($userObject !== null) { |
|
36 | + if (\OC::$server->getGroupManager()->isAdmin($userObject->getUID()) && |
|
37 | 37 | !\OC::$server->getAppManager()->isEnabledForUser('notifications')) { |
38 | - if($updateChecker->getUpdateState() !== []) { |
|
38 | + if ($updateChecker->getUpdateState() !== []) { |
|
39 | 39 | \OCP\Util::addScript('updatenotification', 'notification'); |
40 | 40 | OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'getJavaScript'); |
41 | 41 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function invertTextColor($color) { |
60 | 60 | $l = $this->calculateLuminance($color); |
61 | - if($l>0.5) { |
|
61 | + if ($l > 0.5) { |
|
62 | 62 | return true; |
63 | 63 | } else { |
64 | 64 | return false; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function elementColor($color) { |
75 | 75 | $l = $this->calculateLuminance($color); |
76 | - if($l>0.8) { |
|
76 | + if ($l > 0.8) { |
|
77 | 77 | return '#555555'; |
78 | 78 | } else { |
79 | 79 | return $color; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function calculateLuminance($color) { |
88 | 88 | $hex = preg_replace("/[^0-9A-Fa-f]/", '', $color); |
89 | 89 | if (strlen($hex) === 3) { |
90 | - $hex = $hex{0} . $hex{0} . $hex{1} . $hex{1} . $hex{2} . $hex{2}; |
|
90 | + $hex = $hex{0}.$hex{0}.$hex{1}.$hex{1}.$hex{2}.$hex{2}; |
|
91 | 91 | } |
92 | 92 | if (strlen($hex) !== 6) { |
93 | 93 | return 0; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $r = hexdec(substr($hex, 0, 2)); |
96 | 96 | $g = hexdec(substr($hex, 2, 2)); |
97 | 97 | $b = hexdec(substr($hex, 4, 2)); |
98 | - return (0.299 * $r + 0.587 * $g + 0.114 * $b)/255; |
|
98 | + return (0.299 * $r + 0.587 * $g + 0.114 * $b) / 255; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @return string base64 encoded radio button svg |
104 | 104 | */ |
105 | 105 | public function generateRadioButton($color) { |
106 | - $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">' . |
|
106 | + $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">'. |
|
107 | 107 | '<path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 1a6 6 0 0 1 6 6 6 6 0 0 1-6 6 6 6 0 0 1-6-6 6 6 0 0 1 6-6zm0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" fill="'.$color.'"/></svg>'; |
108 | 108 | return base64_encode($radioButtonIcon); |
109 | 109 | } |
@@ -117,20 +117,20 @@ discard block |
||
117 | 117 | $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
118 | 118 | try { |
119 | 119 | $appPath = $this->appManager->getAppPath($app); |
120 | - $icon = $appPath . '/img/' . $app . '.svg'; |
|
120 | + $icon = $appPath.'/img/'.$app.'.svg'; |
|
121 | 121 | if (file_exists($icon)) { |
122 | 122 | return $icon; |
123 | 123 | } |
124 | - $icon = $appPath . '/img/app.svg'; |
|
124 | + $icon = $appPath.'/img/app.svg'; |
|
125 | 125 | if (file_exists($icon)) { |
126 | 126 | return $icon; |
127 | 127 | } |
128 | 128 | } catch (AppPathNotFoundException $e) {} |
129 | 129 | |
130 | - if($this->config->getAppValue('theming', 'logoMime', '') !== '' && $this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
131 | - return $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/themedinstancelogo'; |
|
130 | + if ($this->config->getAppValue('theming', 'logoMime', '') !== '' && $this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
131 | + return $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/themedinstancelogo'; |
|
132 | 132 | } |
133 | - return \OC::$SERVERROOT . '/core/img/logo.svg'; |
|
133 | + return \OC::$SERVERROOT.'/core/img/logo.svg'; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
143 | 143 | $image = str_replace(array('\0', '\\', '..'), '', $image); |
144 | 144 | if ($app === "core") { |
145 | - $icon = \OC::$SERVERROOT . '/core/img/' . $image; |
|
145 | + $icon = \OC::$SERVERROOT.'/core/img/'.$image; |
|
146 | 146 | if (file_exists($icon)) { |
147 | 147 | return $icon; |
148 | 148 | } |
@@ -154,23 +154,23 @@ discard block |
||
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | |
157 | - $icon = $appPath . '/img/' . $image; |
|
157 | + $icon = $appPath.'/img/'.$image; |
|
158 | 158 | if (file_exists($icon)) { |
159 | 159 | return $icon; |
160 | 160 | } |
161 | - $icon = $appPath . '/img/' . $image . '.svg'; |
|
161 | + $icon = $appPath.'/img/'.$image.'.svg'; |
|
162 | 162 | if (file_exists($icon)) { |
163 | 163 | return $icon; |
164 | 164 | } |
165 | - $icon = $appPath . '/img/' . $image . '.png'; |
|
165 | + $icon = $appPath.'/img/'.$image.'.png'; |
|
166 | 166 | if (file_exists($icon)) { |
167 | 167 | return $icon; |
168 | 168 | } |
169 | - $icon = $appPath . '/img/' . $image . '.gif'; |
|
169 | + $icon = $appPath.'/img/'.$image.'.gif'; |
|
170 | 170 | if (file_exists($icon)) { |
171 | 171 | return $icon; |
172 | 172 | } |
173 | - $icon = $appPath . '/img/' . $image . '.jpg'; |
|
173 | + $icon = $appPath.'/img/'.$image.'.jpg'; |
|
174 | 174 | if (file_exists($icon)) { |
175 | 175 | return $icon; |
176 | 176 | } |