@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | public function getApps($filter = null) { |
60 | 60 | $apps = (new OC_App())->listAllApps(); |
61 | 61 | $list = []; |
62 | - foreach($apps as $app) { |
|
62 | + foreach ($apps as $app) { |
|
63 | 63 | $list[] = $app['id']; |
64 | 64 | } |
65 | - if($filter){ |
|
66 | - switch($filter){ |
|
65 | + if ($filter) { |
|
66 | + switch ($filter) { |
|
67 | 67 | case 'enabled': |
68 | 68 | return new DataResponse(['apps' => \OC_App::getEnabledApps()]); |
69 | 69 | break; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function getAppInfo($app) { |
90 | 90 | $info = \OCP\App::getAppInfo($app); |
91 | - if(!is_null($info)) { |
|
91 | + if (!is_null($info)) { |
|
92 | 92 | return new DataResponse(OC_App::getAppInfo($app)); |
93 | 93 | } else { |
94 | 94 | throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND); |
@@ -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 |
@@ -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(); |
@@ -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 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $uid = $user->getUID(); |
80 | 80 | foreach (range(1, min([$number, 20])) as $i) { |
81 | - $code = $this->random->generate(self::$CODE_LENGTH, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); |
|
81 | + $code = $this->random->generate(self::$CODE_LENGTH, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS); |
|
82 | 82 | |
83 | 83 | $dbCode = new BackupCode(); |
84 | 84 | $dbCode->setUserId($uid); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $codes = $this->mapper->getBackupCodes($user); |
133 | 133 | $total = count($codes); |
134 | 134 | $used = 0; |
135 | - array_walk($codes, function (BackupCode $code) use (&$used) { |
|
135 | + array_walk($codes, function(BackupCode $code) use (&$used) { |
|
136 | 136 | if (1 === (int) $code->getUsed()) { |
137 | 137 | $used++; |
138 | 138 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $rows = $result->fetchAll(); |
48 | 48 | $result->closeCursor(); |
49 | 49 | |
50 | - return array_map(function ($row) { |
|
50 | + return array_map(function($row) { |
|
51 | 51 | return BackupCode::fromRow($row); |
52 | 52 | }, $rows); |
53 | 53 | } |