diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/user_ldap/ajax | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/user_ldap/ajax')
-rw-r--r-- | apps/user_ldap/ajax/clearMappings.php | 6 | ||||
-rw-r--r-- | apps/user_ldap/ajax/deleteConfiguration.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/ajax/getNewServerConfigPrefix.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/ajax/setConfiguration.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/ajax/testConfiguration.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/ajax/wizard.php | 14 |
6 files changed, 15 insertions, 15 deletions
diff --git a/apps/user_ldap/ajax/clearMappings.php b/apps/user_ldap/ajax/clearMappings.php index 5102822ce4e..b485d62dead 100644 --- a/apps/user_ldap/ajax/clearMappings.php +++ b/apps/user_ldap/ajax/clearMappings.php @@ -36,7 +36,7 @@ use OCA\User_LDAP\Mapping\GroupMapping; $subject = (string)$_POST['ldap_clear_mapping']; $mapping = null; try { - if($subject === 'user') { + if ($subject === 'user') { $mapping = new UserMapping(\OC::$server->getDatabaseConnection()); $result = $mapping->clearCb( function ($uid) { @@ -46,12 +46,12 @@ try { \OC::$server->getUserManager()->emit('\OC\User', 'postUnassignedUserId', [$uid]); } ); - } elseif($subject === 'group') { + } elseif ($subject === 'group') { $mapping = new GroupMapping(\OC::$server->getDatabaseConnection()); $result = $mapping->clear(); } - if($mapping === null || !$result) { + if ($mapping === null || !$result) { $l = \OC::$server->getL10N('user_ldap'); throw new \Exception($l->t('Failed to clear the mappings.')); } diff --git a/apps/user_ldap/ajax/deleteConfiguration.php b/apps/user_ldap/ajax/deleteConfiguration.php index 32b86f75fbd..f4f6eaf267d 100644 --- a/apps/user_ldap/ajax/deleteConfiguration.php +++ b/apps/user_ldap/ajax/deleteConfiguration.php @@ -33,7 +33,7 @@ $prefix = (string)$_POST['ldap_serverconfig_chooser']; $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig()); -if($helper->deleteServerConfiguration($prefix)) { +if ($helper->deleteServerConfiguration($prefix)) { \OC_JSON::success(); } else { $l = \OC::$server->getL10N('user_ldap'); diff --git a/apps/user_ldap/ajax/getNewServerConfigPrefix.php b/apps/user_ldap/ajax/getNewServerConfigPrefix.php index 6bf25729418..6118ac18566 100644 --- a/apps/user_ldap/ajax/getNewServerConfigPrefix.php +++ b/apps/user_ldap/ajax/getNewServerConfigPrefix.php @@ -39,7 +39,7 @@ $nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT); $resultData = ['configPrefix' => $nk]; $newConfig = new \OCA\User_LDAP\Configuration($nk, false); -if(isset($_POST['copyConfig'])) { +if (isset($_POST['copyConfig'])) { $originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']); $newConfig->setConfiguration($originalConfig->getConfiguration()); } else { diff --git a/apps/user_ldap/ajax/setConfiguration.php b/apps/user_ldap/ajax/setConfiguration.php index 2f6c318fa25..08d3680187b 100644 --- a/apps/user_ldap/ajax/setConfiguration.php +++ b/apps/user_ldap/ajax/setConfiguration.php @@ -37,8 +37,8 @@ $prefix = (string)$_POST['ldap_serverconfig_chooser']; // the Wizard-like tabs handle it on their own $chkboxes = ['ldap_configuration_active', 'ldap_override_main_server', 'ldap_turn_off_cert_check']; -foreach($chkboxes as $boxid) { - if(!isset($_POST[$boxid])) { +foreach ($chkboxes as $boxid) { + if (!isset($_POST[$boxid])) { $_POST[$boxid] = 0; } } diff --git a/apps/user_ldap/ajax/testConfiguration.php b/apps/user_ldap/ajax/testConfiguration.php index 3fe2337c86e..22cdea388c1 100644 --- a/apps/user_ldap/ajax/testConfiguration.php +++ b/apps/user_ldap/ajax/testConfiguration.php @@ -68,7 +68,7 @@ try { try { $ldapWrapper->read($connection->getConnectionResource(), '', 'objectClass=*', ['dn']); } catch (\Exception $e) { - if($e->getCode() === 1) { + if ($e->getCode() === 1) { \OC_JSON::error(['message' => $l->t('Invalid configuration: Anonymous binding is not allowed.')]); exit; } diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php index ccd7e5937c0..34c9729f6f3 100644 --- a/apps/user_ldap/ajax/wizard.php +++ b/apps/user_ldap/ajax/wizard.php @@ -36,13 +36,13 @@ $l = \OC::$server->getL10N('user_ldap'); -if(!isset($_POST['action'])) { +if (!isset($_POST['action'])) { \OC_JSON::error(['message' => $l->t('No action specified')]); } $action = (string)$_POST['action']; -if(!isset($_POST['ldap_serverconfig_chooser'])) { +if (!isset($_POST['ldap_serverconfig_chooser'])) { \OC_JSON::error(['message' => $l->t('No configuration specified')]); } $prefix = (string)$_POST['ldap_serverconfig_chooser']; @@ -76,7 +76,7 @@ $access = new \OCA\User_LDAP\Access( $wizard = new \OCA\User_LDAP\Wizard($configuration, $ldapWrapper, $access); -switch($action) { +switch ($action) { case 'guessPortAndTLS': case 'guessBaseDN': case 'detectEmailAttribute': @@ -95,7 +95,7 @@ switch($action) { case 'countInBaseDN': try { $result = $wizard->$action(); - if($result !== false) { + if ($result !== false) { \OC_JSON::success($result->getResultArray()); exit; } @@ -111,7 +111,7 @@ switch($action) { try { $loginName = $_POST['ldap_test_loginname']; $result = $wizard->$action($loginName); - if($result !== false) { + if ($result !== false) { \OC_JSON::success($result->getResultArray()); exit; } @@ -127,14 +127,14 @@ switch($action) { case 'save': $key = isset($_POST['cfgkey']) ? $_POST['cfgkey'] : false; $val = isset($_POST['cfgval']) ? $_POST['cfgval'] : null; - if($key === false || is_null($val)) { + if ($key === false || is_null($val)) { \OC_JSON::error(['message' => $l->t('No data specified')]); exit; } $cfg = [$key => $val]; $setParameters = []; $configuration->setConfiguration($cfg, $setParameters); - if(!in_array($key, $setParameters)) { + if (!in_array($key, $setParameters)) { \OC_JSON::error(['message' => $l->t($key. ' Could not set configuration %s', $setParameters[0])]); exit; |