@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $requirements = array()) { |
93 | 93 | $name = strtolower($method).$url; |
94 | 94 | $name = str_replace(array('/', '{', '}'), '_', $name); |
95 | - if(!isset(self::$actions[$name])) { |
|
95 | + if (!isset(self::$actions[$name])) { |
|
96 | 96 | $oldCollection = OC::$server->getRouter()->getCurrentCollection(); |
97 | 97 | OC::$server->getRouter()->useCollection('ocs'); |
98 | 98 | OC::$server->getRouter()->create($name, $url) |
@@ -115,17 +115,17 @@ discard block |
||
115 | 115 | $method = $request->getMethod(); |
116 | 116 | |
117 | 117 | // Prepare the request variables |
118 | - if($method === 'PUT') { |
|
118 | + if ($method === 'PUT') { |
|
119 | 119 | $parameters['_put'] = $request->getParams(); |
120 | - } else if($method === 'DELETE') { |
|
120 | + } else if ($method === 'DELETE') { |
|
121 | 121 | $parameters['_delete'] = $request->getParams(); |
122 | 122 | } |
123 | 123 | $name = $parameters['_route']; |
124 | 124 | // Foreach registered action |
125 | 125 | $responses = array(); |
126 | - foreach(self::$actions[$name] as $action) { |
|
126 | + foreach (self::$actions[$name] as $action) { |
|
127 | 127 | // Check authentication and availability |
128 | - if(!self::isAuthorised($action)) { |
|
128 | + if (!self::isAuthorised($action)) { |
|
129 | 129 | $responses[] = array( |
130 | 130 | 'app' => $action['app'], |
131 | 131 | 'response' => new OC_OCS_Result(null, API::RESPOND_UNAUTHORISED, 'Unauthorised'), |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | ); |
134 | 134 | continue; |
135 | 135 | } |
136 | - if(!is_callable($action['action'])) { |
|
136 | + if (!is_callable($action['action'])) { |
|
137 | 137 | $responses[] = array( |
138 | 138 | 'app' => $action['app'], |
139 | 139 | 'response' => new OC_OCS_Result(null, API::RESPOND_NOT_FOUND, 'Api method not found'), |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | 'failed' => array(), |
174 | 174 | ); |
175 | 175 | |
176 | - foreach($responses as $response) { |
|
177 | - if($response['shipped'] || ($response['app'] === 'core')) { |
|
178 | - if($response['response']->succeeded()) { |
|
176 | + foreach ($responses as $response) { |
|
177 | + if ($response['shipped'] || ($response['app'] === 'core')) { |
|
178 | + if ($response['response']->succeeded()) { |
|
179 | 179 | $shipped['succeeded'][$response['app']] = $response; |
180 | 180 | } else { |
181 | 181 | $shipped['failed'][$response['app']] = $response; |
182 | 182 | } |
183 | 183 | } else { |
184 | - if($response['response']->succeeded()) { |
|
184 | + if ($response['response']->succeeded()) { |
|
185 | 185 | $thirdparty['succeeded'][$response['app']] = $response; |
186 | 186 | } else { |
187 | 187 | $thirdparty['failed'][$response['app']] = $response; |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | // Remove any error responses if there is one shipped response that succeeded |
193 | - if(!empty($shipped['failed'])) { |
|
193 | + if (!empty($shipped['failed'])) { |
|
194 | 194 | // Which shipped response do we use if they all failed? |
195 | 195 | // They may have failed for different reasons (different status codes) |
196 | 196 | // Which response code should we return? |
197 | 197 | // Maybe any that are not \OCP\API::RESPOND_SERVER_ERROR |
198 | 198 | // Merge failed responses if more than one |
199 | 199 | $data = array(); |
200 | - foreach($shipped['failed'] as $failure) { |
|
200 | + foreach ($shipped['failed'] as $failure) { |
|
201 | 201 | $data = array_merge_recursive($data, $failure['response']->getData()); |
202 | 202 | } |
203 | 203 | $picked = reset($shipped['failed']); |
@@ -206,12 +206,12 @@ discard block |
||
206 | 206 | $headers = $picked['response']->getHeaders(); |
207 | 207 | $response = new OC_OCS_Result($data, $code, $meta['message'], $headers); |
208 | 208 | return $response; |
209 | - } elseif(!empty($shipped['succeeded'])) { |
|
209 | + } elseif (!empty($shipped['succeeded'])) { |
|
210 | 210 | $responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']); |
211 | - } elseif(!empty($thirdparty['failed'])) { |
|
211 | + } elseif (!empty($thirdparty['failed'])) { |
|
212 | 212 | // Merge failed responses if more than one |
213 | 213 | $data = array(); |
214 | - foreach($thirdparty['failed'] as $failure) { |
|
214 | + foreach ($thirdparty['failed'] as $failure) { |
|
215 | 215 | $data = array_merge_recursive($data, $failure['response']->getData()); |
216 | 216 | } |
217 | 217 | $picked = reset($thirdparty['failed']); |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $codes = []; |
229 | 229 | $header = []; |
230 | 230 | |
231 | - foreach($responses as $response) { |
|
232 | - if($response['shipped']) { |
|
231 | + foreach ($responses as $response) { |
|
232 | + if ($response['shipped']) { |
|
233 | 233 | $data = array_merge_recursive($response['response']->getData(), $data); |
234 | 234 | } else { |
235 | 235 | $data = array_merge_recursive($data, $response['response']->getData()); |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | // Use any non 100 status codes |
243 | 243 | $statusCode = 100; |
244 | 244 | $statusMessage = null; |
245 | - foreach($codes as $code) { |
|
246 | - if($code['code'] != 100) { |
|
245 | + foreach ($codes as $code) { |
|
246 | + if ($code['code'] != 100) { |
|
247 | 247 | $statusCode = $code['code']; |
248 | 248 | $statusMessage = $code['meta']['message']; |
249 | 249 | break; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | private static function isAuthorised($action) { |
262 | 262 | $level = $action['authlevel']; |
263 | - switch($level) { |
|
263 | + switch ($level) { |
|
264 | 264 | case API::GUEST_AUTH: |
265 | 265 | // Anyone can access |
266 | 266 | return true; |
@@ -270,16 +270,16 @@ discard block |
||
270 | 270 | case API::SUBADMIN_AUTH: |
271 | 271 | // Check for subadmin |
272 | 272 | $user = self::loginUser(); |
273 | - if(!$user) { |
|
273 | + if (!$user) { |
|
274 | 274 | return false; |
275 | 275 | } else { |
276 | 276 | $userObject = \OC::$server->getUserSession()->getUser(); |
277 | - if($userObject === null) { |
|
277 | + if ($userObject === null) { |
|
278 | 278 | return false; |
279 | 279 | } |
280 | 280 | $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); |
281 | 281 | $admin = OC_User::isAdminUser($user); |
282 | - if($isSubAdmin || $admin) { |
|
282 | + if ($isSubAdmin || $admin) { |
|
283 | 283 | return true; |
284 | 284 | } else { |
285 | 285 | return false; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | case API::ADMIN_AUTH: |
289 | 289 | // Check for admin |
290 | 290 | $user = self::loginUser(); |
291 | - if(!$user) { |
|
291 | + if (!$user) { |
|
292 | 292 | return false; |
293 | 293 | } else { |
294 | 294 | return OC_User::isAdminUser($user); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @return string|false (username, or false on failure) |
305 | 305 | */ |
306 | 306 | private static function loginUser() { |
307 | - if(self::$isLoggedIn === true) { |
|
307 | + if (self::$isLoggedIn === true) { |
|
308 | 308 | return \OC_User::getUser(); |
309 | 309 | } |
310 | 310 | |
@@ -358,13 +358,13 @@ discard block |
||
358 | 358 | * @param OC_OCS_Result $result |
359 | 359 | * @param string $format the format xml|json |
360 | 360 | */ |
361 | - public static function respond($result, $format='xml') { |
|
361 | + public static function respond($result, $format = 'xml') { |
|
362 | 362 | $request = \OC::$server->getRequest(); |
363 | 363 | |
364 | 364 | // Send 401 headers if unauthorised |
365 | - if($result->getStatusCode() === API::RESPOND_UNAUTHORISED) { |
|
365 | + if ($result->getStatusCode() === API::RESPOND_UNAUTHORISED) { |
|
366 | 366 | // If request comes from JS return dummy auth request |
367 | - if($request->getHeader('X-Requested-With') === 'XMLHttpRequest') { |
|
367 | + if ($request->getHeader('X-Requested-With') === 'XMLHttpRequest') { |
|
368 | 368 | header('WWW-Authenticate: DummyBasic realm="Authorisation Required"'); |
369 | 369 | } else { |
370 | 370 | header('WWW-Authenticate: Basic realm="Authorisation Required"'); |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | header('HTTP/1.0 401 Unauthorized'); |
373 | 373 | } |
374 | 374 | |
375 | - foreach($result->getHeaders() as $name => $value) { |
|
376 | - header($name . ': ' . $value); |
|
375 | + foreach ($result->getHeaders() as $name => $value) { |
|
376 | + header($name.': '.$value); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | $meta = $result->getMeta(); |
@@ -395,14 +395,14 @@ discard block |
||
395 | 395 | * @param XMLWriter $writer |
396 | 396 | */ |
397 | 397 | private static function toXML($array, $writer) { |
398 | - foreach($array as $k => $v) { |
|
398 | + foreach ($array as $k => $v) { |
|
399 | 399 | if ($k[0] === '@') { |
400 | 400 | $writer->writeAttribute(substr($k, 1), $v); |
401 | 401 | continue; |
402 | 402 | } else if (is_numeric($k)) { |
403 | 403 | $k = 'element'; |
404 | 404 | } |
405 | - if(is_array($v)) { |
|
405 | + if (is_array($v)) { |
|
406 | 406 | $writer->startElement($k); |
407 | 407 | self::toXML($v, $writer); |
408 | 408 | $writer->endElement(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | case 'database': |
95 | 95 | case 'mysql': |
96 | 96 | case 'sqlite': |
97 | - \OCP\Util::writeLog('core', 'Adding user backend ' . $backend . '.', \OCP\Util::DEBUG); |
|
97 | + \OCP\Util::writeLog('core', 'Adding user backend '.$backend.'.', \OCP\Util::DEBUG); |
|
98 | 98 | self::$_usedBackends[$backend] = new \OC\User\Database(); |
99 | 99 | \OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]); |
100 | 100 | break; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | \OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]); |
104 | 104 | break; |
105 | 105 | default: |
106 | - \OCP\Util::writeLog('core', 'Adding default user backend ' . $backend . '.', \OCP\Util::DEBUG); |
|
107 | - $className = 'OC_USER_' . strtoupper($backend); |
|
106 | + \OCP\Util::writeLog('core', 'Adding default user backend '.$backend.'.', \OCP\Util::DEBUG); |
|
107 | + $className = 'OC_USER_'.strtoupper($backend); |
|
108 | 108 | self::$_usedBackends[$backend] = new $className(); |
109 | 109 | \OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]); |
110 | 110 | break; |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | self::useBackend($backend); |
148 | 148 | self::$_setupedBackends[] = $i; |
149 | 149 | } else { |
150 | - \OCP\Util::writeLog('core', 'User backend ' . $class . ' already initialized.', \OCP\Util::DEBUG); |
|
150 | + \OCP\Util::writeLog('core', 'User backend '.$class.' already initialized.', \OCP\Util::DEBUG); |
|
151 | 151 | } |
152 | 152 | } else { |
153 | - \OCP\Util::writeLog('core', 'User backend ' . $class . ' not found.', \OCP\Util::ERROR); |
|
153 | + \OCP\Util::writeLog('core', 'User backend '.$class.' not found.', \OCP\Util::ERROR); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | if (self::getUser() !== $uid) { |
189 | 189 | self::setUserId($uid); |
190 | 190 | $setUidAsDisplayName = true; |
191 | - if($backend instanceof \OCP\UserInterface |
|
191 | + if ($backend instanceof \OCP\UserInterface |
|
192 | 192 | && $backend->implementsActions(OC_User_Backend::GET_DISPLAYNAME)) { |
193 | 193 | |
194 | 194 | $backendDisplayName = $backend->getDisplayName($uid); |
195 | - if(is_string($backendDisplayName) && trim($backendDisplayName) !== '') { |
|
195 | + if (is_string($backendDisplayName) && trim($backendDisplayName) !== '') { |
|
196 | 196 | $setUidAsDisplayName = false; |
197 | 197 | } |
198 | 198 | } |
199 | - if($setUidAsDisplayName) { |
|
199 | + if ($setUidAsDisplayName) { |
|
200 | 200 | self::setDisplayName($uid); |
201 | 201 | } |
202 | 202 | self::getUserSession()->setLoginName($uid); |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | if ($user) { |
491 | 491 | return $user->getHome(); |
492 | 492 | } else { |
493 | - return \OC::$server->getSystemConfig()->getValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $uid; |
|
493 | + return \OC::$server->getSystemConfig()->getValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$uid; |
|
494 | 494 | } |
495 | 495 | } |
496 | 496 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | private static function initLocalStorageRootFS() { |
78 | 78 | // mount local file backend as root |
79 | - $configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT . "/data"); |
|
79 | + $configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT."/data"); |
|
80 | 80 | //first set up the local "root" storage |
81 | 81 | \OC\Files\Filesystem::initMountManager(); |
82 | 82 | if (!self::$rootMounted) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | \OC\Files\Filesystem::initMountManager(); |
155 | 155 | |
156 | 156 | \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false); |
157 | - \OC\Files\Filesystem::addStorageWrapper('mount_options', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
157 | + \OC\Files\Filesystem::addStorageWrapper('mount_options', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
158 | 158 | if ($storage->instanceOfStorage('\OC\Files\Storage\Common')) { |
159 | 159 | /** @var \OC\Files\Storage\Common $storage */ |
160 | 160 | $storage->setMountOptions($mount->getOptions()); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | return $storage; |
163 | 163 | }); |
164 | 164 | |
165 | - \OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
165 | + \OC\Files\Filesystem::addStorageWrapper('enable_sharing', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
166 | 166 | if (!$mount->getOption('enable_sharing', true)) { |
167 | 167 | return new \OC\Files\Storage\Wrapper\PermissionsMask([ |
168 | 168 | 'storage' => $storage, |
@@ -173,21 +173,21 @@ discard block |
||
173 | 173 | }); |
174 | 174 | |
175 | 175 | // install storage availability wrapper, before most other wrappers |
176 | - \OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) { |
|
176 | + \OC\Files\Filesystem::addStorageWrapper('oc_availability', function($mountPoint, $storage) { |
|
177 | 177 | if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { |
178 | 178 | return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]); |
179 | 179 | } |
180 | 180 | return $storage; |
181 | 181 | }); |
182 | 182 | |
183 | - \OC\Files\Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
183 | + \OC\Files\Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
184 | 184 | if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { |
185 | 185 | return new \OC\Files\Storage\Wrapper\Encoding(['storage' => $storage]); |
186 | 186 | } |
187 | 187 | return $storage; |
188 | 188 | }); |
189 | 189 | |
190 | - \OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) { |
|
190 | + \OC\Files\Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage) { |
|
191 | 191 | // set up quota for home storages, even for other users |
192 | 192 | // which can happen when using sharing |
193 | 193 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | //if we aren't logged in, there is no use to set up the filesystem |
230 | 230 | if ($user != "") { |
231 | 231 | |
232 | - $userDir = '/' . $user . '/files'; |
|
232 | + $userDir = '/'.$user.'/files'; |
|
233 | 233 | |
234 | 234 | //jail the user into his "home" directory |
235 | 235 | \OC\Files\Filesystem::init($user, $userDir); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
309 | 309 | } |
310 | 310 | $userQuota = $user->getQuota(); |
311 | - if($userQuota === 'none') { |
|
311 | + if ($userQuota === 'none') { |
|
312 | 312 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
313 | 313 | } |
314 | 314 | return OC_Helper::computerFileSize($userQuota); |
@@ -323,15 +323,15 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public static function copySkeleton($userId, \OCP\Files\Folder $userDirectory) { |
325 | 325 | |
326 | - $skeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton'); |
|
326 | + $skeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT.'/core/skeleton'); |
|
327 | 327 | $instanceId = \OC::$server->getConfig()->getSystemValue('instanceid', ''); |
328 | 328 | |
329 | 329 | if ($instanceId === null) { |
330 | 330 | throw new \RuntimeException('no instance id!'); |
331 | 331 | } |
332 | - $appdata = 'appdata_' . $instanceId; |
|
332 | + $appdata = 'appdata_'.$instanceId; |
|
333 | 333 | if ($userId === $appdata) { |
334 | - throw new \RuntimeException('username is reserved name: ' . $appdata); |
|
334 | + throw new \RuntimeException('username is reserved name: '.$appdata); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | if (!empty($skeletonDirectory)) { |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | // Verify if folder exists |
360 | 360 | $dir = opendir($source); |
361 | - if($dir === false) { |
|
361 | + if ($dir === false) { |
|
362 | 362 | $logger->error(sprintf('Could not opendir "%s"', $source), ['app' => 'core']); |
363 | 363 | return; |
364 | 364 | } |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | // Copy the files |
367 | 367 | while (false !== ($file = readdir($dir))) { |
368 | 368 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
369 | - if (is_dir($source . '/' . $file)) { |
|
369 | + if (is_dir($source.'/'.$file)) { |
|
370 | 370 | $child = $target->newFolder($file); |
371 | - self::copyr($source . '/' . $file, $child); |
|
371 | + self::copyr($source.'/'.$file, $child); |
|
372 | 372 | } else { |
373 | 373 | $child = $target->newFile($file); |
374 | - $sourceStream = fopen($source . '/' . $file, 'r'); |
|
375 | - if($sourceStream === false) { |
|
376 | - $logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']); |
|
374 | + $sourceStream = fopen($source.'/'.$file, 'r'); |
|
375 | + if ($sourceStream === false) { |
|
376 | + $logger->error(sprintf('Could not fopen "%s"', $source.'/'.$file), ['app' => 'core']); |
|
377 | 377 | closedir($dir); |
378 | 378 | return; |
379 | 379 | } |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | return; |
449 | 449 | } |
450 | 450 | |
451 | - $timestamp = filemtime(OC::$SERVERROOT . '/version.php'); |
|
452 | - require OC::$SERVERROOT . '/version.php'; |
|
451 | + $timestamp = filemtime(OC::$SERVERROOT.'/version.php'); |
|
452 | + require OC::$SERVERROOT.'/version.php'; |
|
453 | 453 | /** @var $timestamp int */ |
454 | 454 | self::$versionCache['OC_Version_Timestamp'] = $timestamp; |
455 | 455 | /** @var $OC_Version string */ |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | |
497 | 497 | // core js files need separate handling |
498 | 498 | if ($application !== 'core' && $file !== null) { |
499 | - self::addTranslations ( $application ); |
|
499 | + self::addTranslations($application); |
|
500 | 500 | } |
501 | 501 | self::addExternalResource($application, $prepend, $path, "script"); |
502 | 502 | } |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | if ($type === "style") { |
574 | 574 | if (!in_array($path, self::$styles)) { |
575 | 575 | if ($prepend === true) { |
576 | - array_unshift ( self::$styles, $path ); |
|
576 | + array_unshift(self::$styles, $path); |
|
577 | 577 | } else { |
578 | 578 | self::$styles[] = $path; |
579 | 579 | } |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | } elseif ($type === "script") { |
582 | 582 | if (!in_array($path, self::$scripts)) { |
583 | 583 | if ($prepend === true) { |
584 | - array_unshift ( self::$scripts, $path ); |
|
584 | + array_unshift(self::$scripts, $path); |
|
585 | 585 | } else { |
586 | 586 | self::$scripts [] = $path; |
587 | 587 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @param array $attributes array of attributes for the element |
598 | 598 | * @param string $text the text content for the element |
599 | 599 | */ |
600 | - public static function addHeader($tag, $attributes, $text=null) { |
|
600 | + public static function addHeader($tag, $attributes, $text = null) { |
|
601 | 601 | self::$headers[] = array( |
602 | 602 | 'tag' => $tag, |
603 | 603 | 'attributes' => $attributes, |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | public static function checkServer(\OCP\IConfig $config) { |
638 | 638 | $l = \OC::$server->getL10N('lib'); |
639 | 639 | $errors = array(); |
640 | - $CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data'); |
|
640 | + $CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data'); |
|
641 | 641 | |
642 | 642 | if (!self::needUpgrade($config) && $config->getSystemValue('installed', false)) { |
643 | 643 | // this check needs to be done every time |
@@ -665,13 +665,13 @@ discard block |
||
665 | 665 | } |
666 | 666 | |
667 | 667 | // Check if config folder is writable. |
668 | - if(!OC_Helper::isReadOnlyConfigEnabled()) { |
|
668 | + if (!OC_Helper::isReadOnlyConfigEnabled()) { |
|
669 | 669 | if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { |
670 | 670 | $errors[] = array( |
671 | 671 | 'error' => $l->t('Cannot write into "config" directory'), |
672 | 672 | 'hint' => $l->t('This can usually be fixed by ' |
673 | 673 | . '%sgiving the webserver write access to the config directory%s.', |
674 | - array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>')) |
|
674 | + array('<a href="'.$urlGenerator->linkToDocs('admin-dir_permissions').'" target="_blank" rel="noreferrer">', '</a>')) |
|
675 | 675 | ); |
676 | 676 | } |
677 | 677 | } |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | 'hint' => $l->t('This can usually be fixed by ' |
688 | 688 | . '%sgiving the webserver write access to the apps directory%s' |
689 | 689 | . ' or disabling the appstore in the config file.', |
690 | - array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>')) |
|
690 | + array('<a href="'.$urlGenerator->linkToDocs('admin-dir_permissions').'" target="_blank" rel="noreferrer">', '</a>')) |
|
691 | 691 | ); |
692 | 692 | } |
693 | 693 | } |
@@ -709,9 +709,9 @@ discard block |
||
709 | 709 | //common hint for all file permissions error messages |
710 | 710 | $permissionsHint = $l->t('Permissions can usually be fixed by ' |
711 | 711 | . '%sgiving the webserver write access to the root directory%s.', |
712 | - array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>')); |
|
712 | + array('<a href="'.$urlGenerator->linkToDocs('admin-dir_permissions').'" target="_blank" rel="noreferrer">', '</a>')); |
|
713 | 713 | $errors[] = array( |
714 | - 'error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable', |
|
714 | + 'error' => 'Data directory ('.$CONFIG_DATADIRECTORY.') not writable', |
|
715 | 715 | 'hint' => $permissionsHint |
716 | 716 | ); |
717 | 717 | } else { |
@@ -809,15 +809,15 @@ discard block |
||
809 | 809 | } |
810 | 810 | } |
811 | 811 | |
812 | - foreach($missingDependencies as $missingDependency) { |
|
812 | + foreach ($missingDependencies as $missingDependency) { |
|
813 | 813 | $errors[] = array( |
814 | 814 | 'error' => $l->t('PHP module %s not installed.', array($missingDependency)), |
815 | 815 | 'hint' => $moduleHint |
816 | 816 | ); |
817 | 817 | $webServerRestart = true; |
818 | 818 | } |
819 | - foreach($invalidIniSettings as $setting) { |
|
820 | - if(is_bool($setting[1])) { |
|
819 | + foreach ($invalidIniSettings as $setting) { |
|
820 | + if (is_bool($setting[1])) { |
|
821 | 821 | $setting[1] = ($setting[1]) ? 'on' : 'off'; |
822 | 822 | } |
823 | 823 | $errors[] = [ |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | * TODO: Should probably be implemented in the above generic dependency |
836 | 836 | * check somehow in the long-term. |
837 | 837 | */ |
838 | - if($iniWrapper->getBool('mbstring.func_overload') !== null && |
|
838 | + if ($iniWrapper->getBool('mbstring.func_overload') !== null && |
|
839 | 839 | $iniWrapper->getBool('mbstring.func_overload') === true) { |
840 | 840 | $errors[] = array( |
841 | 841 | 'error' => $l->t('mbstring.func_overload is set to "%s" instead of the expected value "0"', [$iniWrapper->getString('mbstring.func_overload')]), |
@@ -843,16 +843,16 @@ discard block |
||
843 | 843 | ); |
844 | 844 | } |
845 | 845 | |
846 | - if(function_exists('xml_parser_create') && |
|
847 | - LIBXML_LOADED_VERSION < 20700 ) { |
|
846 | + if (function_exists('xml_parser_create') && |
|
847 | + LIBXML_LOADED_VERSION < 20700) { |
|
848 | 848 | $version = LIBXML_LOADED_VERSION; |
849 | - $major = floor($version/10000); |
|
849 | + $major = floor($version / 10000); |
|
850 | 850 | $version -= ($major * 10000); |
851 | - $minor = floor($version/100); |
|
851 | + $minor = floor($version / 100); |
|
852 | 852 | $version -= ($minor * 100); |
853 | 853 | $patch = $version; |
854 | 854 | $errors[] = array( |
855 | - 'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major . '.' . $minor . '.' . $patch]), |
|
855 | + 'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major.'.'.$minor.'.'.$patch]), |
|
856 | 856 | 'hint' => $l->t('To fix this issue update your libxml2 version and restart your web server.') |
857 | 857 | ); |
858 | 858 | } |
@@ -953,10 +953,10 @@ discard block |
||
953 | 953 | 'hint' => $l->t('Check the value of "datadirectory" in your configuration') |
954 | 954 | ]; |
955 | 955 | } |
956 | - if (!file_exists($dataDirectory . '/.ocdata')) { |
|
956 | + if (!file_exists($dataDirectory.'/.ocdata')) { |
|
957 | 957 | $errors[] = [ |
958 | 958 | 'error' => $l->t('Data directory (%s) is invalid', [$dataDirectory]), |
959 | - 'hint' => $l->t('Please check that the data directory contains a file' . |
|
959 | + 'hint' => $l->t('Please check that the data directory contains a file'. |
|
960 | 960 | ' ".ocdata" in its root.') |
961 | 961 | ]; |
962 | 962 | } |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | public static function checkLoggedIn() { |
973 | 973 | // Check if we are a user |
974 | 974 | if (!OC_User::isLoggedIn()) { |
975 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
975 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute( |
|
976 | 976 | 'core.login.showLoginForm', |
977 | 977 | [ |
978 | 978 | 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | } |
984 | 984 | // Redirect to index page if 2FA challenge was not solved yet |
985 | 985 | if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
986 | - header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); |
|
986 | + header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php')); |
|
987 | 987 | exit(); |
988 | 988 | } |
989 | 989 | } |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | public static function checkAdminUser() { |
997 | 997 | OC_Util::checkLoggedIn(); |
998 | 998 | if (!OC_User::isAdminUser(OC_User::getUser())) { |
999 | - header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); |
|
999 | + header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php')); |
|
1000 | 1000 | exit(); |
1001 | 1001 | } |
1002 | 1002 | } |
@@ -1010,12 +1010,12 @@ discard block |
||
1010 | 1010 | OC_Util::checkLoggedIn(); |
1011 | 1011 | $userObject = \OC::$server->getUserSession()->getUser(); |
1012 | 1012 | $isSubAdmin = false; |
1013 | - if($userObject !== null) { |
|
1013 | + if ($userObject !== null) { |
|
1014 | 1014 | $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); |
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | if (!$isSubAdmin) { |
1018 | - header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); |
|
1018 | + header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php')); |
|
1019 | 1019 | exit(); |
1020 | 1020 | } |
1021 | 1021 | return true; |
@@ -1050,10 +1050,10 @@ discard block |
||
1050 | 1050 | } |
1051 | 1051 | } |
1052 | 1052 | |
1053 | - if(\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') { |
|
1054 | - $location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/'); |
|
1053 | + if (\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') { |
|
1054 | + $location = $urlGenerator->getAbsoluteURL('/apps/'.$appId.'/'); |
|
1055 | 1055 | } else { |
1056 | - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/'); |
|
1056 | + $location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.$appId.'/'); |
|
1057 | 1057 | } |
1058 | 1058 | } |
1059 | 1059 | } |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | */ |
1068 | 1068 | public static function redirectToDefaultPage() { |
1069 | 1069 | $location = self::getDefaultPageUrl(); |
1070 | - header('Location: ' . $location); |
|
1070 | + header('Location: '.$location); |
|
1071 | 1071 | exit(); |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | $id = \OC::$server->getSystemConfig()->getValue('instanceid', null); |
1081 | 1081 | if (is_null($id)) { |
1082 | 1082 | // We need to guarantee at least one letter in instanceid so it can be used as the session_name |
1083 | - $id = 'oc' . \OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
1083 | + $id = 'oc'.\OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
1084 | 1084 | \OC::$server->getSystemConfig()->setValue('instanceid', $id); |
1085 | 1085 | } |
1086 | 1086 | return $id; |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | }, $value); |
1103 | 1103 | } else { |
1104 | 1104 | // Specify encoding for PHP<5.4 |
1105 | - $value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1105 | + $value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8'); |
|
1106 | 1106 | } |
1107 | 1107 | return $value; |
1108 | 1108 | } |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | $testContent = 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.'; |
1136 | 1136 | |
1137 | 1137 | // creating a test file |
1138 | - $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; |
|
1138 | + $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName; |
|
1139 | 1139 | |
1140 | 1140 | if (file_exists($testFile)) {// already running this test, possible recursive call |
1141 | 1141 | return false; |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | $fp = @fopen($testFile, 'w'); |
1145 | 1145 | if (!$fp) { |
1146 | 1146 | throw new OC\HintException('Can\'t create test file to check for working .htaccess file.', |
1147 | - 'Make sure it is possible for the webserver to write to ' . $testFile); |
|
1147 | + 'Make sure it is possible for the webserver to write to '.$testFile); |
|
1148 | 1148 | } |
1149 | 1149 | fwrite($fp, $testContent); |
1150 | 1150 | fclose($fp); |
@@ -1171,10 +1171,10 @@ discard block |
||
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | $fileName = '/htaccesstest.txt'; |
1174 | - $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; |
|
1174 | + $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName; |
|
1175 | 1175 | |
1176 | 1176 | // accessing the file via http |
1177 | - $url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName); |
|
1177 | + $url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT.'/data'.$fileName); |
|
1178 | 1178 | try { |
1179 | 1179 | $content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody(); |
1180 | 1180 | } catch (\Exception $e) { |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | $theme = \OC::$server->getSystemConfig()->getValue("theme", ''); |
1266 | 1266 | |
1267 | 1267 | if ($theme === '') { |
1268 | - if (is_dir(OC::$SERVERROOT . '/themes/default')) { |
|
1268 | + if (is_dir(OC::$SERVERROOT.'/themes/default')) { |
|
1269 | 1269 | $theme = 'default'; |
1270 | 1270 | } |
1271 | 1271 | } |
@@ -1336,13 +1336,13 @@ discard block |
||
1336 | 1336 | * @return bool|string |
1337 | 1337 | */ |
1338 | 1338 | public static function normalizeUnicode($value) { |
1339 | - if(Normalizer::isNormalized($value)) { |
|
1339 | + if (Normalizer::isNormalized($value)) { |
|
1340 | 1340 | return $value; |
1341 | 1341 | } |
1342 | 1342 | |
1343 | 1343 | $normalizedValue = Normalizer::normalize($value); |
1344 | 1344 | if ($normalizedValue === null || $normalizedValue === false) { |
1345 | - \OC::$server->getLogger()->warning('normalizing failed for "' . $value . '"', ['app' => 'core']); |
|
1345 | + \OC::$server->getLogger()->warning('normalizing failed for "'.$value.'"', ['app' => 'core']); |
|
1346 | 1346 | return $value; |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | $version = OC_Util::getVersionString(); |
1369 | 1369 | $build = OC_Util::getBuild(); |
1370 | 1370 | if (!empty($build) and OC_Util::getChannel() === 'daily') { |
1371 | - $version .= ' Build:' . $build; |
|
1371 | + $version .= ' Build:'.$build; |
|
1372 | 1372 | } |
1373 | 1373 | return $version; |
1374 | 1374 | } |
@@ -1415,19 +1415,19 @@ discard block |
||
1415 | 1415 | } else if ($config->getSystemValue('debug', false) && $versionDiff < 0) { |
1416 | 1416 | // downgrade with debug |
1417 | 1417 | $installedMajor = explode('.', $installedVersion); |
1418 | - $installedMajor = $installedMajor[0] . '.' . $installedMajor[1]; |
|
1418 | + $installedMajor = $installedMajor[0].'.'.$installedMajor[1]; |
|
1419 | 1419 | $currentMajor = explode('.', $currentVersion); |
1420 | - $currentMajor = $currentMajor[0] . '.' . $currentMajor[1]; |
|
1420 | + $currentMajor = $currentMajor[0].'.'.$currentMajor[1]; |
|
1421 | 1421 | if ($installedMajor === $currentMajor) { |
1422 | 1422 | // Same major, allow downgrade for developers |
1423 | 1423 | return true; |
1424 | 1424 | } else { |
1425 | 1425 | // downgrade attempt, throw exception |
1426 | - throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
1426 | + throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
1427 | 1427 | } |
1428 | 1428 | } else if ($versionDiff < 0) { |
1429 | 1429 | // downgrade attempt, throw exception |
1430 | - throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
1430 | + throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | // also check for upgrades for apps (independently from the user) |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | $apps = self::getEnabledApps(); |
112 | 112 | |
113 | 113 | // Add each apps' folder as allowed class path |
114 | - foreach($apps as $app) { |
|
114 | + foreach ($apps as $app) { |
|
115 | 115 | $path = self::getAppPath($app); |
116 | - if($path !== false) { |
|
116 | + if ($path !== false) { |
|
117 | 117 | self::registerAutoloading($app, $path); |
118 | 118 | } |
119 | 119 | } |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | public static function loadApp($app, $checkUpgrade = true) { |
141 | 141 | self::$loadedApps[] = $app; |
142 | 142 | $appPath = self::getAppPath($app); |
143 | - if($appPath === false) { |
|
143 | + if ($appPath === false) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // in case someone calls loadApp() directly |
148 | 148 | self::registerAutoloading($app, $appPath); |
149 | 149 | |
150 | - if (is_file($appPath . '/appinfo/app.php')) { |
|
151 | - \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); |
|
150 | + if (is_file($appPath.'/appinfo/app.php')) { |
|
151 | + \OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app); |
|
152 | 152 | if ($checkUpgrade and self::shouldUpgrade($app)) { |
153 | 153 | throw new \OC\NeedsUpdateException(); |
154 | 154 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | // enabled for groups |
161 | 161 | self::$enabledAppsCache = array(); |
162 | 162 | } |
163 | - \OC::$server->getEventLogger()->end('load_app_' . $app); |
|
163 | + \OC::$server->getEventLogger()->end('load_app_'.$app); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $info = self::getAppInfo($app); |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | * @param string $path |
188 | 188 | */ |
189 | 189 | public static function registerAutoloading($app, $path) { |
190 | - $key = $app . '-' . $path; |
|
191 | - if(isset(self::$alreadyRegistered[$key])) { |
|
190 | + $key = $app.'-'.$path; |
|
191 | + if (isset(self::$alreadyRegistered[$key])) { |
|
192 | 192 | return; |
193 | 193 | } |
194 | 194 | self::$alreadyRegistered[$key] = true; |
195 | 195 | // Register on PSR-4 composer autoloader |
196 | 196 | $appNamespace = \OC\AppFramework\App::buildAppNamespace($app); |
197 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); |
|
197 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true); |
|
198 | 198 | if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) { |
199 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true); |
|
199 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Register on legacy autoloader |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | private static function requireAppFile($app) { |
212 | 212 | try { |
213 | 213 | // encapsulated here to avoid variable scope conflicts |
214 | - require_once $app . '/appinfo/app.php'; |
|
214 | + require_once $app.'/appinfo/app.php'; |
|
215 | 215 | } catch (Error $ex) { |
216 | 216 | \OC::$server->getLogger()->logException($ex); |
217 | 217 | $blacklist = \OC::$server->getAppManager()->getAlwaysEnabledApps(); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public static function setAppTypes($app) { |
267 | 267 | $appData = self::getAppInfo($app); |
268 | - if(!is_array($appData)) { |
|
268 | + if (!is_array($appData)) { |
|
269 | 269 | return; |
270 | 270 | } |
271 | 271 | |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | } else { |
330 | 330 | $apps = $appManager->getEnabledAppsForUser($user); |
331 | 331 | } |
332 | - $apps = array_filter($apps, function ($app) { |
|
333 | - return $app !== 'files';//we add this manually |
|
332 | + $apps = array_filter($apps, function($app) { |
|
333 | + return $app !== 'files'; //we add this manually |
|
334 | 334 | }); |
335 | 335 | sort($apps); |
336 | 336 | array_unshift($apps, 'files'); |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | ); |
375 | 375 | $isDownloaded = $installer->isDownloaded($appId); |
376 | 376 | |
377 | - if(!$isDownloaded) { |
|
377 | + if (!$isDownloaded) { |
|
378 | 378 | $installer->downloadApp($appId); |
379 | 379 | } |
380 | 380 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | } |
413 | 413 | |
414 | 414 | $info = self::getAppInfo($appId); |
415 | - if(isset($info['settings']) && is_array($info['settings'])) { |
|
415 | + if (isset($info['settings']) && is_array($info['settings'])) { |
|
416 | 416 | $appPath = self::getAppPath($appId); |
417 | 417 | self::registerAutoloading($appId, $appPath); |
418 | 418 | \OC::$server->getSettingsManager()->setupSettings($info['settings']); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | //SubAdmins are also allowed to access user management |
502 | 502 | $userObject = \OC::$server->getUserSession()->getUser(); |
503 | 503 | $isSubAdmin = false; |
504 | - if($userObject !== null) { |
|
504 | + if ($userObject !== null) { |
|
505 | 505 | $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); |
506 | 506 | } |
507 | 507 | if ($isSubAdmin) { |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | */ |
587 | 587 | public static function findAppInDirectories($appId) { |
588 | 588 | $sanitizedAppId = self::cleanAppId($appId); |
589 | - if($sanitizedAppId !== $appId) { |
|
589 | + if ($sanitizedAppId !== $appId) { |
|
590 | 590 | return false; |
591 | 591 | } |
592 | 592 | static $app_dir = array(); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | |
598 | 598 | $possibleApps = array(); |
599 | 599 | foreach (OC::$APPSROOTS as $dir) { |
600 | - if (file_exists($dir['path'] . '/' . $appId)) { |
|
600 | + if (file_exists($dir['path'].'/'.$appId)) { |
|
601 | 601 | $possibleApps[] = $dir; |
602 | 602 | } |
603 | 603 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | } |
639 | 639 | |
640 | 640 | if (($dir = self::findAppInDirectories($appId)) != false) { |
641 | - return $dir['path'] . '/' . $appId; |
|
641 | + return $dir['path'].'/'.$appId; |
|
642 | 642 | } |
643 | 643 | return false; |
644 | 644 | } |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | */ |
653 | 653 | public static function getAppWebPath($appId) { |
654 | 654 | if (($dir = self::findAppInDirectories($appId)) != false) { |
655 | - return OC::$WEBROOT . $dir['url'] . '/' . $appId; |
|
655 | + return OC::$WEBROOT.$dir['url'].'/'.$appId; |
|
656 | 656 | } |
657 | 657 | return false; |
658 | 658 | } |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | * @return string |
666 | 666 | */ |
667 | 667 | public static function getAppVersion($appId, $useCache = true) { |
668 | - if($useCache && isset(self::$appVersion[$appId])) { |
|
668 | + if ($useCache && isset(self::$appVersion[$appId])) { |
|
669 | 669 | return self::$appVersion[$appId]; |
670 | 670 | } |
671 | 671 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @return string |
682 | 682 | */ |
683 | 683 | public static function getAppVersionByPath($path) { |
684 | - $infoFile = $path . '/appinfo/info.xml'; |
|
684 | + $infoFile = $path.'/appinfo/info.xml'; |
|
685 | 685 | $appData = self::getAppInfo($infoFile, true); |
686 | 686 | return isset($appData['version']) ? $appData['version'] : ''; |
687 | 687 | } |
@@ -704,10 +704,10 @@ discard block |
||
704 | 704 | return self::$appInfo[$appId]; |
705 | 705 | } |
706 | 706 | $appPath = self::getAppPath($appId); |
707 | - if($appPath === false) { |
|
707 | + if ($appPath === false) { |
|
708 | 708 | return null; |
709 | 709 | } |
710 | - $file = $appPath . '/appinfo/info.xml'; |
|
710 | + $file = $appPath.'/appinfo/info.xml'; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | $parser = new InfoParser(\OC::$server->getMemCacheFactory()->create('core.appinfo')); |
@@ -716,9 +716,9 @@ discard block |
||
716 | 716 | if (is_array($data)) { |
717 | 717 | $data = OC_App::parseAppInfo($data, $lang); |
718 | 718 | } |
719 | - if(isset($data['ocsid'])) { |
|
719 | + if (isset($data['ocsid'])) { |
|
720 | 720 | $storedId = \OC::$server->getConfig()->getAppValue($appId, 'ocsid'); |
721 | - if($storedId !== '' && $storedId !== $data['ocsid']) { |
|
721 | + if ($storedId !== '' && $storedId !== $data['ocsid']) { |
|
722 | 722 | $data['ocsid'] = $storedId; |
723 | 723 | } |
724 | 724 | } |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | * @param string $page |
799 | 799 | */ |
800 | 800 | public static function registerAdmin($app, $page) { |
801 | - self::$adminForms[] = $app . '/' . $page . '.php'; |
|
801 | + self::$adminForms[] = $app.'/'.$page.'.php'; |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | /** |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | * @param string $page |
808 | 808 | */ |
809 | 809 | public static function registerPersonal($app, $page) { |
810 | - self::$personalForms[] = $app . '/' . $page . '.php'; |
|
810 | + self::$personalForms[] = $app.'/'.$page.'.php'; |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | /** |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | |
837 | 837 | foreach (OC::$APPSROOTS as $apps_dir) { |
838 | 838 | if (!is_readable($apps_dir['path'])) { |
839 | - \OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], \OCP\Util::WARN); |
|
839 | + \OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], \OCP\Util::WARN); |
|
840 | 840 | continue; |
841 | 841 | } |
842 | 842 | $dh = opendir($apps_dir['path']); |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | if (is_resource($dh)) { |
845 | 845 | while (($file = readdir($dh)) !== false) { |
846 | 846 | |
847 | - if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) { |
|
847 | + if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) { |
|
848 | 848 | |
849 | 849 | $apps[] = $file; |
850 | 850 | } |
@@ -874,12 +874,12 @@ discard block |
||
874 | 874 | |
875 | 875 | $info = OC_App::getAppInfo($app, false, $langCode); |
876 | 876 | if (!is_array($info)) { |
877 | - \OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', \OCP\Util::ERROR); |
|
877 | + \OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', \OCP\Util::ERROR); |
|
878 | 878 | continue; |
879 | 879 | } |
880 | 880 | |
881 | 881 | if (!isset($info['name'])) { |
882 | - \OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', \OCP\Util::ERROR); |
|
882 | + \OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', \OCP\Util::ERROR); |
|
883 | 883 | continue; |
884 | 884 | } |
885 | 885 | |
@@ -906,13 +906,13 @@ discard block |
||
906 | 906 | } |
907 | 907 | |
908 | 908 | $appPath = self::getAppPath($app); |
909 | - if($appPath !== false) { |
|
910 | - $appIcon = $appPath . '/img/' . $app . '.svg'; |
|
909 | + if ($appPath !== false) { |
|
910 | + $appIcon = $appPath.'/img/'.$app.'.svg'; |
|
911 | 911 | if (file_exists($appIcon)) { |
912 | - $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, $app . '.svg'); |
|
912 | + $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, $app.'.svg'); |
|
913 | 913 | $info['previewAsIcon'] = true; |
914 | 914 | } else { |
915 | - $appIcon = $appPath . '/img/app.svg'; |
|
915 | + $appIcon = $appPath.'/img/app.svg'; |
|
916 | 916 | if (file_exists($appIcon)) { |
917 | 917 | $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, 'app.svg'); |
918 | 918 | $info['previewAsIcon'] = true; |
@@ -946,9 +946,9 @@ discard block |
||
946 | 946 | * @return string|false |
947 | 947 | */ |
948 | 948 | public static function getInternalAppIdByOcs($ocsID) { |
949 | - if(is_numeric($ocsID)) { |
|
949 | + if (is_numeric($ocsID)) { |
|
950 | 950 | $idArray = \OC::$server->getAppConfig()->getValues(false, 'ocsid'); |
951 | - if(array_search($ocsID, $idArray)) { |
|
951 | + if (array_search($ocsID, $idArray)) { |
|
952 | 952 | return array_search($ocsID, $idArray); |
953 | 953 | } |
954 | 954 | } |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | public static function getAppVersions() { |
1053 | 1053 | static $versions; |
1054 | 1054 | |
1055 | - if(!$versions) { |
|
1055 | + if (!$versions) { |
|
1056 | 1056 | $appConfig = \OC::$server->getAppConfig(); |
1057 | 1057 | $versions = $appConfig->getValues(false, 'installed_version'); |
1058 | 1058 | } |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | if ($app !== false) { |
1075 | 1075 | // check if the app is compatible with this version of ownCloud |
1076 | 1076 | $info = self::getAppInfo($app); |
1077 | - if(!is_array($info)) { |
|
1077 | + if (!is_array($info)) { |
|
1078 | 1078 | throw new \Exception( |
1079 | 1079 | $l->t('App "%s" cannot be installed because appinfo file cannot be read.', |
1080 | 1080 | [$info['name']] |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | $config->setAppValue($app, 'ocsid', $appData['id']); |
1100 | 1100 | } |
1101 | 1101 | |
1102 | - if(isset($info['settings']) && is_array($info['settings'])) { |
|
1102 | + if (isset($info['settings']) && is_array($info['settings'])) { |
|
1103 | 1103 | $appPath = self::getAppPath($app); |
1104 | 1104 | self::registerAutoloading($app, $appPath); |
1105 | 1105 | \OC::$server->getSettingsManager()->setupSettings($info['settings']); |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | \OC_Hook::emit('OC_App', 'post_enable', array('app' => $app)); |
1109 | 1109 | } else { |
1110 | - if(empty($appName) ) { |
|
1110 | + if (empty($appName)) { |
|
1111 | 1111 | throw new \Exception($l->t("No app name specified")); |
1112 | 1112 | } else { |
1113 | 1113 | throw new \Exception($l->t("App '%s' could not be installed!", $appName)); |
@@ -1125,24 +1125,24 @@ discard block |
||
1125 | 1125 | */ |
1126 | 1126 | public static function updateApp($appId) { |
1127 | 1127 | $appPath = self::getAppPath($appId); |
1128 | - if($appPath === false) { |
|
1128 | + if ($appPath === false) { |
|
1129 | 1129 | return false; |
1130 | 1130 | } |
1131 | 1131 | $appData = self::getAppInfo($appId); |
1132 | 1132 | self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']); |
1133 | - if (file_exists($appPath . '/appinfo/database.xml')) { |
|
1134 | - OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml'); |
|
1133 | + if (file_exists($appPath.'/appinfo/database.xml')) { |
|
1134 | + OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml'); |
|
1135 | 1135 | } |
1136 | 1136 | self::executeRepairSteps($appId, $appData['repair-steps']['post-migration']); |
1137 | 1137 | self::setupLiveMigrations($appId, $appData['repair-steps']['live-migration']); |
1138 | 1138 | unset(self::$appVersion[$appId]); |
1139 | 1139 | // run upgrade code |
1140 | - if (file_exists($appPath . '/appinfo/update.php')) { |
|
1140 | + if (file_exists($appPath.'/appinfo/update.php')) { |
|
1141 | 1141 | self::loadApp($appId, false); |
1142 | - include $appPath . '/appinfo/update.php'; |
|
1142 | + include $appPath.'/appinfo/update.php'; |
|
1143 | 1143 | } |
1144 | 1144 | self::setupBackgroundJobs($appData['background-jobs']); |
1145 | - if(isset($appData['settings']) && is_array($appData['settings'])) { |
|
1145 | + if (isset($appData['settings']) && is_array($appData['settings'])) { |
|
1146 | 1146 | $appPath = self::getAppPath($appId); |
1147 | 1147 | self::registerAutoloading($appId, $appPath); |
1148 | 1148 | \OC::$server->getSettingsManager()->setupSettings($appData['settings']); |
@@ -1151,14 +1151,14 @@ discard block |
||
1151 | 1151 | //set remote/public handlers |
1152 | 1152 | if (array_key_exists('ocsid', $appData)) { |
1153 | 1153 | \OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']); |
1154 | - } elseif(\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
1154 | + } elseif (\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
1155 | 1155 | \OC::$server->getConfig()->deleteAppValue($appId, 'ocsid'); |
1156 | 1156 | } |
1157 | 1157 | foreach ($appData['remote'] as $name => $path) { |
1158 | - \OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path); |
|
1158 | + \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path); |
|
1159 | 1159 | } |
1160 | 1160 | foreach ($appData['public'] as $name => $path) { |
1161 | - \OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path); |
|
1161 | + \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path); |
|
1162 | 1162 | } |
1163 | 1163 | |
1164 | 1164 | self::setAppTypes($appId); |
@@ -1228,17 +1228,17 @@ discard block |
||
1228 | 1228 | public static function getStorage($appId) { |
1229 | 1229 | if (OC_App::isEnabled($appId)) { //sanity check |
1230 | 1230 | if (OC_User::isLoggedIn()) { |
1231 | - $view = new \OC\Files\View('/' . OC_User::getUser()); |
|
1231 | + $view = new \OC\Files\View('/'.OC_User::getUser()); |
|
1232 | 1232 | if (!$view->file_exists($appId)) { |
1233 | 1233 | $view->mkdir($appId); |
1234 | 1234 | } |
1235 | - return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId); |
|
1235 | + return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId); |
|
1236 | 1236 | } else { |
1237 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', \OCP\Util::ERROR); |
|
1237 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', \OCP\Util::ERROR); |
|
1238 | 1238 | return false; |
1239 | 1239 | } |
1240 | 1240 | } else { |
1241 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', \OCP\Util::ERROR); |
|
1241 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', \OCP\Util::ERROR); |
|
1242 | 1242 | return false; |
1243 | 1243 | } |
1244 | 1244 | } |
@@ -1270,9 +1270,9 @@ discard block |
||
1270 | 1270 | |
1271 | 1271 | if ($attributeLang === $similarLang) { |
1272 | 1272 | $similarLangFallback = $option['@value']; |
1273 | - } else if (strpos($attributeLang, $similarLang . '_') === 0) { |
|
1273 | + } else if (strpos($attributeLang, $similarLang.'_') === 0) { |
|
1274 | 1274 | if ($similarLangFallback === false) { |
1275 | - $similarLangFallback = $option['@value']; |
|
1275 | + $similarLangFallback = $option['@value']; |
|
1276 | 1276 | } |
1277 | 1277 | } |
1278 | 1278 | } else { |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | $data['description'] = trim(self::findBestL10NOption($data['description'], $lang)); |
1308 | 1308 | } else if (isset($data['description']) && is_string($data['description'])) { |
1309 | 1309 | $data['description'] = trim($data['description']); |
1310 | - } else { |
|
1310 | + } else { |
|
1311 | 1311 | $data['description'] = ''; |
1312 | 1312 | } |
1313 | 1313 |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | * Class OC_JSON |
35 | 35 | * @deprecated Use a AppFramework JSONResponse instead |
36 | 36 | */ |
37 | -class OC_JSON{ |
|
37 | +class OC_JSON { |
|
38 | 38 | static protected $send_content_type_header = false; |
39 | 39 | /** |
40 | 40 | * set Content-Type header to jsonrequest |
41 | 41 | * @deprecated Use a AppFramework JSONResponse instead |
42 | 42 | */ |
43 | - public static function setContentTypeHeader($type='application/json') { |
|
43 | + public static function setContentTypeHeader($type = 'application/json') { |
|
44 | 44 | if (!self::$send_content_type_header) { |
45 | 45 | // We send json data |
46 | - header( 'Content-Type: '.$type . '; charset=utf-8'); |
|
46 | + header('Content-Type: '.$type.'; charset=utf-8'); |
|
47 | 47 | self::$send_content_type_header = true; |
48 | 48 | } |
49 | 49 | } |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * @deprecated Use the AppFramework instead. It will automatically check if the app is enabled. |
55 | 55 | */ |
56 | 56 | public static function checkAppEnabled($app) { |
57 | - if( !OC_App::isEnabled($app)) { |
|
57 | + if (!OC_App::isEnabled($app)) { |
|
58 | 58 | $l = \OC::$server->getL10N('lib'); |
59 | - self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ))); |
|
59 | + self::error(array('data' => array('message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled'))); |
|
60 | 60 | exit(); |
61 | 61 | } |
62 | 62 | } |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public static function checkLoggedIn() { |
69 | 69 | $twoFactorAuthManger = \OC::$server->getTwoFactorAuthManager(); |
70 | - if( !OC_User::isLoggedIn() |
|
70 | + if (!OC_User::isLoggedIn() |
|
71 | 71 | || $twoFactorAuthManger->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
72 | 72 | $l = \OC::$server->getL10N('lib'); |
73 | 73 | http_response_code(\OCP\AppFramework\Http::STATUS_UNAUTHORIZED); |
74 | - self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); |
|
74 | + self::error(array('data' => array('message' => $l->t('Authentication error'), 'error' => 'authentication_error'))); |
|
75 | 75 | exit(); |
76 | 76 | } |
77 | 77 | } |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | * @deprecated Use annotation based CSRF checks from the AppFramework instead |
82 | 82 | */ |
83 | 83 | public static function callCheck() { |
84 | - if(!\OC::$server->getRequest()->passesStrictCookieCheck()) { |
|
84 | + if (!\OC::$server->getRequest()->passesStrictCookieCheck()) { |
|
85 | 85 | header('Location: '.\OC::$WEBROOT); |
86 | 86 | exit(); |
87 | 87 | } |
88 | 88 | |
89 | - if( !(\OC::$server->getRequest()->passesCSRFCheck())) { |
|
89 | + if (!(\OC::$server->getRequest()->passesCSRFCheck())) { |
|
90 | 90 | $l = \OC::$server->getL10N('lib'); |
91 | - self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ))); |
|
91 | + self::error(array('data' => array('message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired'))); |
|
92 | 92 | exit(); |
93 | 93 | } |
94 | 94 | } |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | * @deprecated Use annotation based ACLs from the AppFramework instead |
99 | 99 | */ |
100 | 100 | public static function checkAdminUser() { |
101 | - if( !OC_User::isAdminUser(OC_User::getUser())) { |
|
101 | + if (!OC_User::isAdminUser(OC_User::getUser())) { |
|
102 | 102 | $l = \OC::$server->getL10N('lib'); |
103 | - self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); |
|
103 | + self::error(array('data' => array('message' => $l->t('Authentication error'), 'error' => 'authentication_error'))); |
|
104 | 104 | exit(); |
105 | 105 | } |
106 | 106 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public static function checkUserExists($user) { |
114 | 114 | if (!OCP\User::userExists($user)) { |
115 | 115 | $l = \OC::$server->getL10N('lib'); |
116 | - OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'), 'error' => 'unknown_user' ))); |
|
116 | + OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'), 'error' => 'unknown_user'))); |
|
117 | 117 | exit; |
118 | 118 | } |
119 | 119 | } |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | public static function checkSubAdminUser() { |
127 | 127 | $userObject = \OC::$server->getUserSession()->getUser(); |
128 | 128 | $isSubAdmin = false; |
129 | - if($userObject !== null) { |
|
129 | + if ($userObject !== null) { |
|
130 | 130 | $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); |
131 | 131 | } |
132 | 132 | |
133 | - if(!$isSubAdmin) { |
|
133 | + if (!$isSubAdmin) { |
|
134 | 134 | $l = \OC::$server->getL10N('lib'); |
135 | - self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); |
|
135 | + self::error(array('data' => array('message' => $l->t('Authentication error'), 'error' => 'authentication_error'))); |
|
136 | 136 | exit(); |
137 | 137 | } |
138 | 138 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | protected static function to_string(&$value) { |
162 | 162 | if ($value instanceof OC_L10N_String) { |
163 | - $value = (string)$value; |
|
163 | + $value = (string) $value; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * Encode and print $data in json format |
169 | 169 | * @deprecated Use a AppFramework JSONResponse instead |
170 | 170 | */ |
171 | - public static function encodedPrint($data, $setContentType=true) { |
|
172 | - if($setContentType) { |
|
171 | + public static function encodedPrint($data, $setContentType = true) { |
|
172 | + if ($setContentType) { |
|
173 | 173 | self::setContentTypeHeader(); |
174 | 174 | } |
175 | 175 | echo self::encode($data); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * SQL query via Doctrine prepare(), needs to be execute()'d! |
55 | 55 | */ |
56 | - static public function prepare( $query , $limit = null, $offset = null, $isManipulation = null) { |
|
56 | + static public function prepare($query, $limit = null, $offset = null, $isManipulation = null) { |
|
57 | 57 | $connection = \OC::$server->getDatabaseConnection(); |
58 | 58 | |
59 | 59 | if ($isManipulation === null) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | // return the result |
65 | 65 | try { |
66 | - $result =$connection->prepare($query, $limit, $offset); |
|
66 | + $result = $connection->prepare($query, $limit, $offset); |
|
67 | 67 | } catch (\Doctrine\DBAL\DBALException $e) { |
68 | 68 | throw new \OC\DatabaseException($e->getMessage(), $query); |
69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param string $sql |
80 | 80 | * @return bool |
81 | 81 | */ |
82 | - static public function isManipulation( $sql ) { |
|
82 | + static public function isManipulation($sql) { |
|
83 | 83 | $selectOccurrence = stripos($sql, 'SELECT'); |
84 | 84 | if ($selectOccurrence !== false && $selectOccurrence < 10) { |
85 | 85 | return false; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return OC_DB_StatementWrapper |
109 | 109 | * @throws \OC\DatabaseException |
110 | 110 | */ |
111 | - static public function executeAudited( $stmt, array $parameters = null) { |
|
111 | + static public function executeAudited($stmt, array $parameters = null) { |
|
112 | 112 | if (is_string($stmt)) { |
113 | 113 | // convert to an array with 'sql' |
114 | 114 | if (stripos($stmt, 'LIMIT') !== false) { //OFFSET requires LIMIT, so we only need to check for LIMIT |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | } |
122 | 122 | if (is_array($stmt)) { |
123 | 123 | // convert to prepared statement |
124 | - if ( ! array_key_exists('sql', $stmt) ) { |
|
124 | + if (!array_key_exists('sql', $stmt)) { |
|
125 | 125 | $message = 'statement array must at least contain key \'sql\''; |
126 | 126 | throw new \OC\DatabaseException($message); |
127 | 127 | } |
128 | - if ( ! array_key_exists('limit', $stmt) ) { |
|
128 | + if (!array_key_exists('limit', $stmt)) { |
|
129 | 129 | $stmt['limit'] = null; |
130 | 130 | } |
131 | - if ( ! array_key_exists('limit', $stmt) ) { |
|
131 | + if (!array_key_exists('limit', $stmt)) { |
|
132 | 132 | $stmt['offset'] = null; |
133 | 133 | } |
134 | 134 | $stmt = self::prepare($stmt['sql'], $stmt['limit'], $stmt['offset']); |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | self::raiseExceptionOnError($result, 'Could not execute statement'); |
140 | 140 | } else { |
141 | 141 | if (is_object($stmt)) { |
142 | - $message = 'Expected a prepared statement or array got ' . get_class($stmt); |
|
142 | + $message = 'Expected a prepared statement or array got '.get_class($stmt); |
|
143 | 143 | } else { |
144 | - $message = 'Expected a prepared statement or array got ' . gettype($stmt); |
|
144 | + $message = 'Expected a prepared statement or array got '.gettype($stmt); |
|
145 | 145 | } |
146 | 146 | throw new \OC\DatabaseException($message); |
147 | 147 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * |
169 | 169 | * TODO: write more documentation |
170 | 170 | */ |
171 | - public static function createDbFromStructure( $file ) { |
|
171 | + public static function createDbFromStructure($file) { |
|
172 | 172 | $schemaManager = self::getMDB2SchemaManager(); |
173 | 173 | $result = $schemaManager->createDbFromStructure($file); |
174 | 174 | return $result; |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | * @throws \OC\DatabaseException |
209 | 209 | */ |
210 | 210 | public static function raiseExceptionOnError($result, $message = null) { |
211 | - if($result === false) { |
|
211 | + if ($result === false) { |
|
212 | 212 | if ($message === null) { |
213 | 213 | $message = self::getErrorMessage(); |
214 | 214 | } else { |
215 | - $message .= ', Root cause:' . self::getErrorMessage(); |
|
215 | + $message .= ', Root cause:'.self::getErrorMessage(); |
|
216 | 216 | } |
217 | 217 | throw new \OC\DatabaseException($message, \OC::$server->getDatabaseConnection()->errorCode()); |
218 | 218 | } |
@@ -31,27 +31,27 @@ |
||
31 | 31 | * error code for functions not provided by the user backend |
32 | 32 | * @deprecated Use \OC_User_Backend::NOT_IMPLEMENTED instead |
33 | 33 | */ |
34 | -define('OC_USER_BACKEND_NOT_IMPLEMENTED', -501); |
|
34 | +define('OC_USER_BACKEND_NOT_IMPLEMENTED', -501); |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * actions that user backends can define |
38 | 38 | */ |
39 | 39 | /** @deprecated Use \OC_User_Backend::CREATE_USER instead */ |
40 | -define('OC_USER_BACKEND_CREATE_USER', 1 << 0); |
|
40 | +define('OC_USER_BACKEND_CREATE_USER', 1 << 0); |
|
41 | 41 | /** @deprecated Use \OC_User_Backend::SET_PASSWORD instead */ |
42 | -define('OC_USER_BACKEND_SET_PASSWORD', 1 << 4); |
|
42 | +define('OC_USER_BACKEND_SET_PASSWORD', 1 << 4); |
|
43 | 43 | /** @deprecated Use \OC_User_Backend::CHECK_PASSWORD instead */ |
44 | -define('OC_USER_BACKEND_CHECK_PASSWORD', 1 << 8); |
|
44 | +define('OC_USER_BACKEND_CHECK_PASSWORD', 1 << 8); |
|
45 | 45 | /** @deprecated Use \OC_User_Backend::GET_HOME instead */ |
46 | -define('OC_USER_BACKEND_GET_HOME', 1 << 12); |
|
46 | +define('OC_USER_BACKEND_GET_HOME', 1 << 12); |
|
47 | 47 | /** @deprecated Use \OC_User_Backend::GET_DISPLAYNAME instead */ |
48 | -define('OC_USER_BACKEND_GET_DISPLAYNAME', 1 << 16); |
|
48 | +define('OC_USER_BACKEND_GET_DISPLAYNAME', 1 << 16); |
|
49 | 49 | /** @deprecated Use \OC_User_Backend::SET_DISPLAYNAME instead */ |
50 | -define('OC_USER_BACKEND_SET_DISPLAYNAME', 1 << 20); |
|
50 | +define('OC_USER_BACKEND_SET_DISPLAYNAME', 1 << 20); |
|
51 | 51 | /** @deprecated Use \OC_User_Backend::PROVIDE_AVATAR instead */ |
52 | -define('OC_USER_BACKEND_PROVIDE_AVATAR', 1 << 24); |
|
52 | +define('OC_USER_BACKEND_PROVIDE_AVATAR', 1 << 24); |
|
53 | 53 | /** @deprecated Use \OC_User_Backend::COUNT_USERS instead */ |
54 | -define('OC_USER_BACKEND_COUNT_USERS', 1 << 28); |
|
54 | +define('OC_USER_BACKEND_COUNT_USERS', 1 << 28); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Abstract base class for user management. Provides methods for querying backend |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $this->defaultLogoClaim = ''; |
66 | 66 | $this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */ |
67 | 67 | |
68 | - $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php'; |
|
68 | + $themePath = OC::$SERVERROOT.'/themes/'.OC_Util::getTheme().'/defaults.php'; |
|
69 | 69 | if (file_exists($themePath)) { |
70 | 70 | // prevent defaults.php from printing output |
71 | 71 | ob_start(); |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | if ($this->themeExist('getShortFooter')) { |
240 | 240 | $footer = $this->theme->getShortFooter(); |
241 | 241 | } else { |
242 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
243 | - ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
244 | - ' – ' . $this->getSlogan(); |
|
242 | + $footer = '<a href="'.$this->getBaseUrl().'" target="_blank"'. |
|
243 | + ' rel="noreferrer">'.$this->getEntity().'</a>'. |
|
244 | + ' – '.$this->getSlogan(); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | return $footer; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | if ($this->themeExist('buildDocLinkToKey')) { |
269 | 269 | return $this->theme->buildDocLinkToKey($key); |
270 | 270 | } |
271 | - return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key; |
|
271 | + return $this->getDocBaseUrl().'/server/'.$this->defaultDocVersion.'/go.php?to='.$key; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public static function notFound() { |
37 | 37 | $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
38 | - $txt='Invalid query, please check the syntax. API specifications are here:' |
|
38 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
39 | 39 | .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n"; |
40 | 40 | OC_API::respond(new OC_OCS_Result(null, API::RESPOND_NOT_FOUND, $txt), $format); |
41 | 41 | } |