@@ -34,59 +34,59 @@ |
||
34 | 34 | |
35 | 35 | class TestConfig extends Command { |
36 | 36 | |
37 | - protected function configure() { |
|
38 | - $this |
|
39 | - ->setName('ldap:test-config') |
|
40 | - ->setDescription('tests an LDAP configuration') |
|
41 | - ->addArgument( |
|
42 | - 'configID', |
|
43 | - InputArgument::REQUIRED, |
|
44 | - 'the configuration ID' |
|
45 | - ) |
|
46 | - ; |
|
47 | - } |
|
37 | + protected function configure() { |
|
38 | + $this |
|
39 | + ->setName('ldap:test-config') |
|
40 | + ->setDescription('tests an LDAP configuration') |
|
41 | + ->addArgument( |
|
42 | + 'configID', |
|
43 | + InputArgument::REQUIRED, |
|
44 | + 'the configuration ID' |
|
45 | + ) |
|
46 | + ; |
|
47 | + } |
|
48 | 48 | |
49 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
50 | - $helper = new Helper(\OC::$server->getConfig()); |
|
51 | - $availableConfigs = $helper->getServerConfigurationPrefixes(); |
|
52 | - $configID = $input->getArgument('configID'); |
|
53 | - if(!in_array($configID, $availableConfigs)) { |
|
54 | - $output->writeln("Invalid configID"); |
|
55 | - return; |
|
56 | - } |
|
49 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
50 | + $helper = new Helper(\OC::$server->getConfig()); |
|
51 | + $availableConfigs = $helper->getServerConfigurationPrefixes(); |
|
52 | + $configID = $input->getArgument('configID'); |
|
53 | + if(!in_array($configID, $availableConfigs)) { |
|
54 | + $output->writeln("Invalid configID"); |
|
55 | + return; |
|
56 | + } |
|
57 | 57 | |
58 | - $result = $this->testConfig($configID); |
|
59 | - if($result === 0) { |
|
60 | - $output->writeln('The configuration is valid and the connection could be established!'); |
|
61 | - } else if($result === 1) { |
|
62 | - $output->writeln('The configuration is invalid. Please have a look at the logs for further details.'); |
|
63 | - } else if($result === 2) { |
|
64 | - $output->writeln('The configuration is valid, but the Bind failed. Please check the server settings and credentials.'); |
|
65 | - } else { |
|
66 | - $output->writeln('Your LDAP server was kidnapped by aliens.'); |
|
67 | - } |
|
68 | - } |
|
58 | + $result = $this->testConfig($configID); |
|
59 | + if($result === 0) { |
|
60 | + $output->writeln('The configuration is valid and the connection could be established!'); |
|
61 | + } else if($result === 1) { |
|
62 | + $output->writeln('The configuration is invalid. Please have a look at the logs for further details.'); |
|
63 | + } else if($result === 2) { |
|
64 | + $output->writeln('The configuration is valid, but the Bind failed. Please check the server settings and credentials.'); |
|
65 | + } else { |
|
66 | + $output->writeln('Your LDAP server was kidnapped by aliens.'); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * tests the specified connection |
|
72 | - * @param string $configID |
|
73 | - * @return int |
|
74 | - */ |
|
75 | - protected function testConfig($configID) { |
|
76 | - $lw = new \OCA\User_LDAP\LDAP(); |
|
77 | - $connection = new Connection($lw, $configID); |
|
70 | + /** |
|
71 | + * tests the specified connection |
|
72 | + * @param string $configID |
|
73 | + * @return int |
|
74 | + */ |
|
75 | + protected function testConfig($configID) { |
|
76 | + $lw = new \OCA\User_LDAP\LDAP(); |
|
77 | + $connection = new Connection($lw, $configID); |
|
78 | 78 | |
79 | - //ensure validation is run before we attempt the bind |
|
80 | - $connection->getConfiguration(); |
|
79 | + //ensure validation is run before we attempt the bind |
|
80 | + $connection->getConfiguration(); |
|
81 | 81 | |
82 | - if(!$connection->setConfiguration(array( |
|
83 | - 'ldap_configuration_active' => 1, |
|
84 | - ))) { |
|
85 | - return 1; |
|
86 | - } |
|
87 | - if($connection->bind()) { |
|
88 | - return 0; |
|
89 | - } |
|
90 | - return 2; |
|
91 | - } |
|
82 | + if(!$connection->setConfiguration(array( |
|
83 | + 'ldap_configuration_active' => 1, |
|
84 | + ))) { |
|
85 | + return 1; |
|
86 | + } |
|
87 | + if($connection->bind()) { |
|
88 | + return 0; |
|
89 | + } |
|
90 | + return 2; |
|
91 | + } |
|
92 | 92 | } |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | $helper = new Helper(\OC::$server->getConfig()); |
51 | 51 | $availableConfigs = $helper->getServerConfigurationPrefixes(); |
52 | 52 | $configID = $input->getArgument('configID'); |
53 | - if(!in_array($configID, $availableConfigs)) { |
|
53 | + if (!in_array($configID, $availableConfigs)) { |
|
54 | 54 | $output->writeln("Invalid configID"); |
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | 58 | $result = $this->testConfig($configID); |
59 | - if($result === 0) { |
|
59 | + if ($result === 0) { |
|
60 | 60 | $output->writeln('The configuration is valid and the connection could be established!'); |
61 | - } else if($result === 1) { |
|
61 | + } else if ($result === 1) { |
|
62 | 62 | $output->writeln('The configuration is invalid. Please have a look at the logs for further details.'); |
63 | - } else if($result === 2) { |
|
63 | + } else if ($result === 2) { |
|
64 | 64 | $output->writeln('The configuration is valid, but the Bind failed. Please check the server settings and credentials.'); |
65 | 65 | } else { |
66 | 66 | $output->writeln('Your LDAP server was kidnapped by aliens.'); |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | //ensure validation is run before we attempt the bind |
80 | 80 | $connection->getConfiguration(); |
81 | 81 | |
82 | - if(!$connection->setConfiguration(array( |
|
82 | + if (!$connection->setConfiguration(array( |
|
83 | 83 | 'ldap_configuration_active' => 1, |
84 | 84 | ))) { |
85 | 85 | return 1; |
86 | 86 | } |
87 | - if($connection->bind()) { |
|
87 | + if ($connection->bind()) { |
|
88 | 88 | return 0; |
89 | 89 | } |
90 | 90 | return 2; |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $helper = new Helper(\OC::$server->getConfig()); |
61 | 61 | $availableConfigs = $helper->getServerConfigurationPrefixes(); |
62 | 62 | $configID = $input->getArgument('configID'); |
63 | - if(!in_array($configID, $availableConfigs)) { |
|
63 | + if (!in_array($configID, $availableConfigs)) { |
|
64 | 64 | $output->writeln("Invalid configID"); |
65 | 65 | return; |
66 | 66 | } |
@@ -37,56 +37,56 @@ |
||
37 | 37 | |
38 | 38 | class SetConfig extends Command { |
39 | 39 | |
40 | - protected function configure() { |
|
41 | - $this |
|
42 | - ->setName('ldap:set-config') |
|
43 | - ->setDescription('modifies an LDAP configuration') |
|
44 | - ->addArgument( |
|
45 | - 'configID', |
|
46 | - InputArgument::REQUIRED, |
|
47 | - 'the configuration ID' |
|
48 | - ) |
|
49 | - ->addArgument( |
|
50 | - 'configKey', |
|
51 | - InputArgument::REQUIRED, |
|
52 | - 'the configuration key' |
|
53 | - ) |
|
54 | - ->addArgument( |
|
55 | - 'configValue', |
|
56 | - InputArgument::REQUIRED, |
|
57 | - 'the new configuration value' |
|
58 | - ) |
|
59 | - ; |
|
60 | - } |
|
40 | + protected function configure() { |
|
41 | + $this |
|
42 | + ->setName('ldap:set-config') |
|
43 | + ->setDescription('modifies an LDAP configuration') |
|
44 | + ->addArgument( |
|
45 | + 'configID', |
|
46 | + InputArgument::REQUIRED, |
|
47 | + 'the configuration ID' |
|
48 | + ) |
|
49 | + ->addArgument( |
|
50 | + 'configKey', |
|
51 | + InputArgument::REQUIRED, |
|
52 | + 'the configuration key' |
|
53 | + ) |
|
54 | + ->addArgument( |
|
55 | + 'configValue', |
|
56 | + InputArgument::REQUIRED, |
|
57 | + 'the new configuration value' |
|
58 | + ) |
|
59 | + ; |
|
60 | + } |
|
61 | 61 | |
62 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
63 | - $helper = new Helper(\OC::$server->getConfig()); |
|
64 | - $availableConfigs = $helper->getServerConfigurationPrefixes(); |
|
65 | - $configID = $input->getArgument('configID'); |
|
66 | - if(!in_array($configID, $availableConfigs)) { |
|
67 | - $output->writeln("Invalid configID"); |
|
68 | - return; |
|
69 | - } |
|
62 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
63 | + $helper = new Helper(\OC::$server->getConfig()); |
|
64 | + $availableConfigs = $helper->getServerConfigurationPrefixes(); |
|
65 | + $configID = $input->getArgument('configID'); |
|
66 | + if(!in_array($configID, $availableConfigs)) { |
|
67 | + $output->writeln("Invalid configID"); |
|
68 | + return; |
|
69 | + } |
|
70 | 70 | |
71 | - $this->setValue( |
|
72 | - $configID, |
|
73 | - $input->getArgument('configKey'), |
|
74 | - $input->getArgument('configValue') |
|
75 | - ); |
|
76 | - } |
|
71 | + $this->setValue( |
|
72 | + $configID, |
|
73 | + $input->getArgument('configKey'), |
|
74 | + $input->getArgument('configValue') |
|
75 | + ); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * save the configuration value as provided |
|
80 | - * @param string $configID |
|
81 | - * @param string $configKey |
|
82 | - * @param string $configValue |
|
83 | - */ |
|
84 | - protected function setValue($configID, $key, $value) { |
|
85 | - $configHolder = new Configuration($configID); |
|
86 | - $configHolder->$key = $value; |
|
87 | - $configHolder->saveConfiguration(); |
|
78 | + /** |
|
79 | + * save the configuration value as provided |
|
80 | + * @param string $configID |
|
81 | + * @param string $configKey |
|
82 | + * @param string $configValue |
|
83 | + */ |
|
84 | + protected function setValue($configID, $key, $value) { |
|
85 | + $configHolder = new Configuration($configID); |
|
86 | + $configHolder->$key = $value; |
|
87 | + $configHolder->saveConfiguration(); |
|
88 | 88 | |
89 | - $connectionFactory = new ConnectionFactory(new LDAP()); |
|
90 | - $connectionFactory->get($configID)->clearCache(); |
|
91 | - } |
|
89 | + $connectionFactory = new ConnectionFactory(new LDAP()); |
|
90 | + $connectionFactory->get($configID)->clearCache(); |
|
91 | + } |
|
92 | 92 | } |
@@ -33,39 +33,39 @@ |
||
33 | 33 | use Symfony\Component\Console\Output\OutputInterface; |
34 | 34 | |
35 | 35 | class CreateEmptyConfig extends Command { |
36 | - /** @var \OCA\User_LDAP\Helper */ |
|
37 | - protected $helper; |
|
36 | + /** @var \OCA\User_LDAP\Helper */ |
|
37 | + protected $helper; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param Helper $helper |
|
41 | - */ |
|
42 | - public function __construct(Helper $helper) { |
|
43 | - $this->helper = $helper; |
|
44 | - parent::__construct(); |
|
45 | - } |
|
39 | + /** |
|
40 | + * @param Helper $helper |
|
41 | + */ |
|
42 | + public function __construct(Helper $helper) { |
|
43 | + $this->helper = $helper; |
|
44 | + parent::__construct(); |
|
45 | + } |
|
46 | 46 | |
47 | - protected function configure() { |
|
48 | - $this |
|
49 | - ->setName('ldap:create-empty-config') |
|
50 | - ->setDescription('creates an empty LDAP configuration') |
|
51 | - ->addOption( |
|
52 | - 'only-print-prefix', |
|
53 | - 'p', |
|
54 | - InputOption::VALUE_NONE, |
|
55 | - 'outputs only the prefix' |
|
56 | - ) |
|
57 | - ; |
|
58 | - } |
|
47 | + protected function configure() { |
|
48 | + $this |
|
49 | + ->setName('ldap:create-empty-config') |
|
50 | + ->setDescription('creates an empty LDAP configuration') |
|
51 | + ->addOption( |
|
52 | + 'only-print-prefix', |
|
53 | + 'p', |
|
54 | + InputOption::VALUE_NONE, |
|
55 | + 'outputs only the prefix' |
|
56 | + ) |
|
57 | + ; |
|
58 | + } |
|
59 | 59 | |
60 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
61 | - $configPrefix = $this->helper->getNextServerConfigurationPrefix(); |
|
62 | - $configHolder = new Configuration($configPrefix); |
|
63 | - $configHolder->saveConfiguration(); |
|
60 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
61 | + $configPrefix = $this->helper->getNextServerConfigurationPrefix(); |
|
62 | + $configHolder = new Configuration($configPrefix); |
|
63 | + $configHolder->saveConfiguration(); |
|
64 | 64 | |
65 | - $prose = ''; |
|
66 | - if(!$input->getOption('only-print-prefix')) { |
|
67 | - $prose = 'Created new configuration with configID '; |
|
68 | - } |
|
69 | - $output->writeln($prose . "{$configPrefix}"); |
|
70 | - } |
|
65 | + $prose = ''; |
|
66 | + if(!$input->getOption('only-print-prefix')) { |
|
67 | + $prose = 'Created new configuration with configID '; |
|
68 | + } |
|
69 | + $output->writeln($prose . "{$configPrefix}"); |
|
70 | + } |
|
71 | 71 | } |
@@ -63,9 +63,9 @@ |
||
63 | 63 | $configHolder->saveConfiguration(); |
64 | 64 | |
65 | 65 | $prose = ''; |
66 | - if(!$input->getOption('only-print-prefix')) { |
|
66 | + if (!$input->getOption('only-print-prefix')) { |
|
67 | 67 | $prose = 'Created new configuration with configID '; |
68 | 68 | } |
69 | - $output->writeln($prose . "{$configPrefix}"); |
|
69 | + $output->writeln($prose."{$configPrefix}"); |
|
70 | 70 | } |
71 | 71 | } |
@@ -35,77 +35,77 @@ |
||
35 | 35 | use OCA\User_LDAP\Configuration; |
36 | 36 | |
37 | 37 | class ShowConfig extends Command { |
38 | - /** @var \OCA\User_LDAP\Helper */ |
|
39 | - protected $helper; |
|
38 | + /** @var \OCA\User_LDAP\Helper */ |
|
39 | + protected $helper; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param Helper $helper |
|
43 | - */ |
|
44 | - public function __construct(Helper $helper) { |
|
45 | - $this->helper = $helper; |
|
46 | - parent::__construct(); |
|
47 | - } |
|
41 | + /** |
|
42 | + * @param Helper $helper |
|
43 | + */ |
|
44 | + public function __construct(Helper $helper) { |
|
45 | + $this->helper = $helper; |
|
46 | + parent::__construct(); |
|
47 | + } |
|
48 | 48 | |
49 | - protected function configure() { |
|
50 | - $this |
|
51 | - ->setName('ldap:show-config') |
|
52 | - ->setDescription('shows the LDAP configuration') |
|
53 | - ->addArgument( |
|
54 | - 'configID', |
|
55 | - InputArgument::OPTIONAL, |
|
56 | - 'will show the configuration of the specified id' |
|
57 | - ) |
|
58 | - ->addOption( |
|
59 | - 'show-password', |
|
60 | - null, |
|
61 | - InputOption::VALUE_NONE, |
|
62 | - 'show ldap bind password' |
|
63 | - ) |
|
64 | - ; |
|
65 | - } |
|
49 | + protected function configure() { |
|
50 | + $this |
|
51 | + ->setName('ldap:show-config') |
|
52 | + ->setDescription('shows the LDAP configuration') |
|
53 | + ->addArgument( |
|
54 | + 'configID', |
|
55 | + InputArgument::OPTIONAL, |
|
56 | + 'will show the configuration of the specified id' |
|
57 | + ) |
|
58 | + ->addOption( |
|
59 | + 'show-password', |
|
60 | + null, |
|
61 | + InputOption::VALUE_NONE, |
|
62 | + 'show ldap bind password' |
|
63 | + ) |
|
64 | + ; |
|
65 | + } |
|
66 | 66 | |
67 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
68 | - $availableConfigs = $this->helper->getServerConfigurationPrefixes(); |
|
69 | - $configID = $input->getArgument('configID'); |
|
70 | - if(!is_null($configID)) { |
|
71 | - $configIDs[] = $configID; |
|
72 | - if(!in_array($configIDs[0], $availableConfigs)) { |
|
73 | - $output->writeln("Invalid configID"); |
|
74 | - return; |
|
75 | - } |
|
76 | - } else { |
|
77 | - $configIDs = $availableConfigs; |
|
78 | - } |
|
67 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
68 | + $availableConfigs = $this->helper->getServerConfigurationPrefixes(); |
|
69 | + $configID = $input->getArgument('configID'); |
|
70 | + if(!is_null($configID)) { |
|
71 | + $configIDs[] = $configID; |
|
72 | + if(!in_array($configIDs[0], $availableConfigs)) { |
|
73 | + $output->writeln("Invalid configID"); |
|
74 | + return; |
|
75 | + } |
|
76 | + } else { |
|
77 | + $configIDs = $availableConfigs; |
|
78 | + } |
|
79 | 79 | |
80 | - $this->renderConfigs($configIDs, $output, $input->getOption('show-password')); |
|
81 | - } |
|
80 | + $this->renderConfigs($configIDs, $output, $input->getOption('show-password')); |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * prints the LDAP configuration(s) |
|
85 | - * @param string[] configID(s) |
|
86 | - * @param OutputInterface $output |
|
87 | - * @param bool $withPassword Set to TRUE to show plaintext passwords in output |
|
88 | - */ |
|
89 | - protected function renderConfigs($configIDs, $output, $withPassword) { |
|
90 | - foreach($configIDs as $id) { |
|
91 | - $configHolder = new Configuration($id); |
|
92 | - $configuration = $configHolder->getConfiguration(); |
|
93 | - ksort($configuration); |
|
83 | + /** |
|
84 | + * prints the LDAP configuration(s) |
|
85 | + * @param string[] configID(s) |
|
86 | + * @param OutputInterface $output |
|
87 | + * @param bool $withPassword Set to TRUE to show plaintext passwords in output |
|
88 | + */ |
|
89 | + protected function renderConfigs($configIDs, $output, $withPassword) { |
|
90 | + foreach($configIDs as $id) { |
|
91 | + $configHolder = new Configuration($id); |
|
92 | + $configuration = $configHolder->getConfiguration(); |
|
93 | + ksort($configuration); |
|
94 | 94 | |
95 | - $table = new Table($output); |
|
96 | - $table->setHeaders(array('Configuration', $id)); |
|
97 | - $rows = array(); |
|
98 | - foreach($configuration as $key => $value) { |
|
99 | - if($key === 'ldapAgentPassword' && !$withPassword) { |
|
100 | - $value = '***'; |
|
101 | - } |
|
102 | - if(is_array($value)) { |
|
103 | - $value = implode(';', $value); |
|
104 | - } |
|
105 | - $rows[] = array($key, $value); |
|
106 | - } |
|
107 | - $table->setRows($rows); |
|
108 | - $table->render($output); |
|
109 | - } |
|
110 | - } |
|
95 | + $table = new Table($output); |
|
96 | + $table->setHeaders(array('Configuration', $id)); |
|
97 | + $rows = array(); |
|
98 | + foreach($configuration as $key => $value) { |
|
99 | + if($key === 'ldapAgentPassword' && !$withPassword) { |
|
100 | + $value = '***'; |
|
101 | + } |
|
102 | + if(is_array($value)) { |
|
103 | + $value = implode(';', $value); |
|
104 | + } |
|
105 | + $rows[] = array($key, $value); |
|
106 | + } |
|
107 | + $table->setRows($rows); |
|
108 | + $table->render($output); |
|
109 | + } |
|
110 | + } |
|
111 | 111 | } |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | protected function execute(InputInterface $input, OutputInterface $output) { |
68 | 68 | $availableConfigs = $this->helper->getServerConfigurationPrefixes(); |
69 | 69 | $configID = $input->getArgument('configID'); |
70 | - if(!is_null($configID)) { |
|
70 | + if (!is_null($configID)) { |
|
71 | 71 | $configIDs[] = $configID; |
72 | - if(!in_array($configIDs[0], $availableConfigs)) { |
|
72 | + if (!in_array($configIDs[0], $availableConfigs)) { |
|
73 | 73 | $output->writeln("Invalid configID"); |
74 | 74 | return; |
75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param bool $withPassword Set to TRUE to show plaintext passwords in output |
88 | 88 | */ |
89 | 89 | protected function renderConfigs($configIDs, $output, $withPassword) { |
90 | - foreach($configIDs as $id) { |
|
90 | + foreach ($configIDs as $id) { |
|
91 | 91 | $configHolder = new Configuration($id); |
92 | 92 | $configuration = $configHolder->getConfiguration(); |
93 | 93 | ksort($configuration); |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | $table = new Table($output); |
96 | 96 | $table->setHeaders(array('Configuration', $id)); |
97 | 97 | $rows = array(); |
98 | - foreach($configuration as $key => $value) { |
|
99 | - if($key === 'ldapAgentPassword' && !$withPassword) { |
|
98 | + foreach ($configuration as $key => $value) { |
|
99 | + if ($key === 'ldapAgentPassword' && !$withPassword) { |
|
100 | 100 | $value = '***'; |
101 | 101 | } |
102 | - if(is_array($value)) { |
|
102 | + if (is_array($value)) { |
|
103 | 103 | $value = implode(';', $value); |
104 | 104 | } |
105 | 105 | $rows[] = array($key, $value); |
@@ -26,13 +26,13 @@ |
||
26 | 26 | namespace OCA\User_LDAP; |
27 | 27 | |
28 | 28 | abstract class LDAPUtility { |
29 | - protected $ldap; |
|
29 | + protected $ldap; |
|
30 | 30 | |
31 | - /** |
|
32 | - * constructor, make sure the subclasses call this one! |
|
33 | - * @param ILDAPWrapper $ldapWrapper an instance of an ILDAPWrapper |
|
34 | - */ |
|
35 | - public function __construct(ILDAPWrapper $ldapWrapper) { |
|
36 | - $this->ldap = $ldapWrapper; |
|
37 | - } |
|
31 | + /** |
|
32 | + * constructor, make sure the subclasses call this one! |
|
33 | + * @param ILDAPWrapper $ldapWrapper an instance of an ILDAPWrapper |
|
34 | + */ |
|
35 | + public function __construct(ILDAPWrapper $ldapWrapper) { |
|
36 | + $this->ldap = $ldapWrapper; |
|
37 | + } |
|
38 | 38 | } |
@@ -28,55 +28,55 @@ |
||
28 | 28 | use OCP\Settings\IIconSection; |
29 | 29 | |
30 | 30 | class Section implements IIconSection { |
31 | - /** @var IL10N */ |
|
32 | - private $l; |
|
33 | - /** @var IURLGenerator */ |
|
34 | - private $url; |
|
31 | + /** @var IL10N */ |
|
32 | + private $l; |
|
33 | + /** @var IURLGenerator */ |
|
34 | + private $url; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param IURLGenerator $url |
|
38 | - * @param IL10N $l |
|
39 | - */ |
|
40 | - public function __construct(IURLGenerator $url, IL10N $l) { |
|
41 | - $this->url = $url; |
|
42 | - $this->l = $l; |
|
43 | - } |
|
36 | + /** |
|
37 | + * @param IURLGenerator $url |
|
38 | + * @param IL10N $l |
|
39 | + */ |
|
40 | + public function __construct(IURLGenerator $url, IL10N $l) { |
|
41 | + $this->url = $url; |
|
42 | + $this->l = $l; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * returns the ID of the section. It is supposed to be a lower case string, |
|
47 | - * e.g. 'ldap' |
|
48 | - * |
|
49 | - * @returns string |
|
50 | - */ |
|
51 | - public function getID() { |
|
52 | - return 'ldap'; |
|
53 | - } |
|
45 | + /** |
|
46 | + * returns the ID of the section. It is supposed to be a lower case string, |
|
47 | + * e.g. 'ldap' |
|
48 | + * |
|
49 | + * @returns string |
|
50 | + */ |
|
51 | + public function getID() { |
|
52 | + return 'ldap'; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
57 | - * integration'. Use the L10N service to translate it. |
|
58 | - * |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - public function getName() { |
|
62 | - return $this->l->t('LDAP / AD integration'); |
|
63 | - } |
|
55 | + /** |
|
56 | + * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
57 | + * integration'. Use the L10N service to translate it. |
|
58 | + * |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + public function getName() { |
|
62 | + return $this->l->t('LDAP / AD integration'); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return int whether the form should be rather on the top or bottom of |
|
67 | - * the settings navigation. The sections are arranged in ascending order of |
|
68 | - * the priority values. It is required to return a value between 0 and 99. |
|
69 | - * |
|
70 | - * E.g.: 70 |
|
71 | - */ |
|
72 | - public function getPriority() { |
|
73 | - return 25; |
|
74 | - } |
|
65 | + /** |
|
66 | + * @return int whether the form should be rather on the top or bottom of |
|
67 | + * the settings navigation. The sections are arranged in ascending order of |
|
68 | + * the priority values. It is required to return a value between 0 and 99. |
|
69 | + * |
|
70 | + * E.g.: 70 |
|
71 | + */ |
|
72 | + public function getPriority() { |
|
73 | + return 25; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * {@inheritdoc} |
|
78 | - */ |
|
79 | - public function getIcon() { |
|
80 | - return $this->url->imagePath('user_ldap', 'app-dark.svg'); |
|
81 | - } |
|
76 | + /** |
|
77 | + * {@inheritdoc} |
|
78 | + */ |
|
79 | + public function getIcon() { |
|
80 | + return $this->url->imagePath('user_ldap', 'app-dark.svg'); |
|
81 | + } |
|
82 | 82 | } |
@@ -28,32 +28,32 @@ |
||
28 | 28 | use OCA\User_LDAP\Mapping\UserMapping; |
29 | 29 | |
30 | 30 | class LDAPProviderFactory implements ILDAPProviderFactory { |
31 | - /** |
|
32 | - * Server container |
|
33 | - * |
|
34 | - * @var IServerContainer |
|
35 | - */ |
|
36 | - private $serverContainer; |
|
31 | + /** |
|
32 | + * Server container |
|
33 | + * |
|
34 | + * @var IServerContainer |
|
35 | + */ |
|
36 | + private $serverContainer; |
|
37 | 37 | |
38 | - /** |
|
39 | - * Constructor for the LDAP provider factory |
|
40 | - * |
|
41 | - * @param IServerContainer $serverContainer server container |
|
42 | - */ |
|
43 | - public function __construct(IServerContainer $serverContainer) { |
|
44 | - $this->serverContainer = $serverContainer; |
|
45 | - } |
|
38 | + /** |
|
39 | + * Constructor for the LDAP provider factory |
|
40 | + * |
|
41 | + * @param IServerContainer $serverContainer server container |
|
42 | + */ |
|
43 | + public function __construct(IServerContainer $serverContainer) { |
|
44 | + $this->serverContainer = $serverContainer; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * creates and returns an instance of the ILDAPProvider |
|
49 | - * |
|
50 | - * @return OCP\LDAP\ILDAPProvider |
|
51 | - */ |
|
52 | - public function getLDAPProvider() { |
|
53 | - $dbConnection = $this->serverContainer->getDatabaseConnection(); |
|
54 | - $userMapping = new UserMapping($dbConnection); |
|
55 | - return new LDAPProvider($this->serverContainer, new Helper($this->serverContainer->getConfig()), |
|
56 | - new DeletedUsersIndex($this->serverContainer->getConfig(), |
|
57 | - $dbConnection, $userMapping)); |
|
58 | - } |
|
47 | + /** |
|
48 | + * creates and returns an instance of the ILDAPProvider |
|
49 | + * |
|
50 | + * @return OCP\LDAP\ILDAPProvider |
|
51 | + */ |
|
52 | + public function getLDAPProvider() { |
|
53 | + $dbConnection = $this->serverContainer->getDatabaseConnection(); |
|
54 | + $userMapping = new UserMapping($dbConnection); |
|
55 | + return new LDAPProvider($this->serverContainer, new Helper($this->serverContainer->getConfig()), |
|
56 | + new DeletedUsersIndex($this->serverContainer->getConfig(), |
|
57 | + $dbConnection, $userMapping)); |
|
58 | + } |
|
59 | 59 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $application->registerRoutes($this, [ |
42 | 42 | 'ocs' => [ |
43 | 43 | ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'], |
44 | - ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
44 | + ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
45 | 45 | ['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'], |
46 | 46 | ['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'], |
47 | 47 | ] |
@@ -23,36 +23,36 @@ |
||
23 | 23 | |
24 | 24 | /** @var $this \OCP\Route\IRouter */ |
25 | 25 | $this->create('user_ldap_ajax_clearMappings', 'ajax/clearMappings.php') |
26 | - ->actionInclude('user_ldap/ajax/clearMappings.php'); |
|
26 | + ->actionInclude('user_ldap/ajax/clearMappings.php'); |
|
27 | 27 | $this->create('user_ldap_ajax_deleteConfiguration', 'ajax/deleteConfiguration.php') |
28 | - ->actionInclude('user_ldap/ajax/deleteConfiguration.php'); |
|
28 | + ->actionInclude('user_ldap/ajax/deleteConfiguration.php'); |
|
29 | 29 | $this->create('user_ldap_ajax_getConfiguration', 'ajax/getConfiguration.php') |
30 | - ->actionInclude('user_ldap/ajax/getConfiguration.php'); |
|
30 | + ->actionInclude('user_ldap/ajax/getConfiguration.php'); |
|
31 | 31 | $this->create('user_ldap_ajax_getNewServerConfigPrefix', 'ajax/getNewServerConfigPrefix.php') |
32 | - ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php'); |
|
32 | + ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php'); |
|
33 | 33 | $this->create('user_ldap_ajax_setConfiguration', 'ajax/setConfiguration.php') |
34 | - ->actionInclude('user_ldap/ajax/setConfiguration.php'); |
|
34 | + ->actionInclude('user_ldap/ajax/setConfiguration.php'); |
|
35 | 35 | $this->create('user_ldap_ajax_testConfiguration', 'ajax/testConfiguration.php') |
36 | - ->actionInclude('user_ldap/ajax/testConfiguration.php'); |
|
36 | + ->actionInclude('user_ldap/ajax/testConfiguration.php'); |
|
37 | 37 | $this->create('user_ldap_ajax_wizard', 'ajax/wizard.php') |
38 | - ->actionInclude('user_ldap/ajax/wizard.php'); |
|
38 | + ->actionInclude('user_ldap/ajax/wizard.php'); |
|
39 | 39 | |
40 | 40 | $application = new \OCP\AppFramework\App('user_ldap'); |
41 | 41 | $application->registerRoutes($this, [ |
42 | - 'ocs' => [ |
|
43 | - ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'], |
|
44 | - ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
45 | - ['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'], |
|
46 | - ['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'], |
|
47 | - ] |
|
42 | + 'ocs' => [ |
|
43 | + ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'], |
|
44 | + ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
45 | + ['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'], |
|
46 | + ['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'], |
|
47 | + ] |
|
48 | 48 | ]); |
49 | 49 | |
50 | 50 | $application = new OCA\User_LDAP\AppInfo\Application(); |
51 | 51 | $application->registerRoutes($this, [ |
52 | - 'routes' => [ |
|
53 | - ['name' => 'renewPassword#tryRenewPassword', 'url' => '/renewpassword', 'verb' => 'POST'], |
|
54 | - ['name' => 'renewPassword#showRenewPasswordForm', 'url' => '/renewpassword/{user}', 'verb' => 'GET'], |
|
55 | - ['name' => 'renewPassword#cancel', 'url' => '/renewpassword/cancel', 'verb' => 'GET'], |
|
56 | - ['name' => 'renewPassword#showLoginFormInvalidPassword', 'url' => '/renewpassword/invalidlogin/{user}', 'verb' => 'GET'], |
|
57 | - ] |
|
52 | + 'routes' => [ |
|
53 | + ['name' => 'renewPassword#tryRenewPassword', 'url' => '/renewpassword', 'verb' => 'POST'], |
|
54 | + ['name' => 'renewPassword#showRenewPasswordForm', 'url' => '/renewpassword/{user}', 'verb' => 'GET'], |
|
55 | + ['name' => 'renewPassword#cancel', 'url' => '/renewpassword/cancel', 'verb' => 'GET'], |
|
56 | + ['name' => 'renewPassword#showLoginFormInvalidPassword', 'url' => '/renewpassword/invalidlogin/{user}', 'verb' => 'GET'], |
|
57 | + ] |
|
58 | 58 | ]); |
@@ -41,44 +41,44 @@ |
||
41 | 41 | $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL); |
42 | 42 | |
43 | 43 | switch ($parameter->getType()) { |
44 | - case DefinitionParameter::VALUE_PASSWORD: ?> |
|
45 | - <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
|
46 | - <input type="password" |
|
44 | + case DefinitionParameter::VALUE_PASSWORD: ?> |
|
45 | + <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
|
46 | + <input type="password" |
|
47 | 47 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
48 | - data-parameter="<?php p($parameter->getName()); ?>" |
|
48 | + data-parameter="<?php p($parameter->getName()); ?>" |
|
49 | 49 | value="<?php p($value); ?>" |
50 | 50 | placeholder="<?php p($placeholder); ?>" |
51 | 51 | /> |
52 | 52 | <?php |
53 | - break; |
|
54 | - case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
55 | - <?php $checkboxId = uniqid("checkbox_"); ?> |
|
53 | + break; |
|
54 | + case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
55 | + <?php $checkboxId = uniqid("checkbox_"); ?> |
|
56 | 56 | <div> |
57 | 57 | <label> |
58 | 58 | <input type="checkbox" |
59 | 59 | id="<?php p($checkboxId); ?>" |
60 | 60 | <?php if (!empty($classes)): ?> class="checkbox <?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
61 | - data-parameter="<?php p($parameter->getName()); ?>" |
|
61 | + data-parameter="<?php p($parameter->getName()); ?>" |
|
62 | 62 | <?php if ($value === true): ?> checked="checked"<?php endif; ?> |
63 | - /> |
|
63 | + /> |
|
64 | 64 | <?php p($placeholder); ?> |
65 | 65 | </label> |
66 | 66 | </div> |
67 | 67 | <?php |
68 | - break; |
|
69 | - case DefinitionParameter::VALUE_HIDDEN: ?> |
|
70 | - <input type="hidden" |
|
68 | + break; |
|
69 | + case DefinitionParameter::VALUE_HIDDEN: ?> |
|
70 | + <input type="hidden" |
|
71 | 71 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
72 | - data-parameter="<?php p($parameter->getName()); ?>" |
|
72 | + data-parameter="<?php p($parameter->getName()); ?>" |
|
73 | 73 | value="<?php p($value); ?>" |
74 | 74 | /> |
75 | 75 | <?php |
76 | - break; |
|
77 | - default: ?> |
|
78 | - <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
|
79 | - <input type="text" |
|
76 | + break; |
|
77 | + default: ?> |
|
78 | + <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
|
79 | + <input type="text" |
|
80 | 80 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
81 | - data-parameter="<?php p($parameter->getName()); ?>" |
|
81 | + data-parameter="<?php p($parameter->getName()); ?>" |
|
82 | 82 | value="<?php p($value); ?>" |
83 | 83 | placeholder="<?php p($placeholder); ?>" |
84 | 84 | /> |
@@ -1,51 +1,51 @@ discard block |
||
1 | 1 | <?php |
2 | - use \OCA\Files_External\Lib\Backend\Backend; |
|
3 | - use \OCA\Files_External\Lib\Auth\AuthMechanism; |
|
4 | - use \OCA\Files_External\Lib\DefinitionParameter; |
|
5 | - use \OCA\Files_External\Service\BackendService; |
|
2 | + use \OCA\Files_External\Lib\Backend\Backend; |
|
3 | + use \OCA\Files_External\Lib\Auth\AuthMechanism; |
|
4 | + use \OCA\Files_External\Lib\DefinitionParameter; |
|
5 | + use \OCA\Files_External\Service\BackendService; |
|
6 | 6 | |
7 | - $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting']; |
|
7 | + $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting']; |
|
8 | 8 | |
9 | - $l->t("Enable encryption"); |
|
10 | - $l->t("Enable previews"); |
|
11 | - $l->t("Enable sharing"); |
|
12 | - $l->t("Check for changes"); |
|
13 | - $l->t("Never"); |
|
14 | - $l->t("Once every direct access"); |
|
15 | - $l->t('Read only'); |
|
9 | + $l->t("Enable encryption"); |
|
10 | + $l->t("Enable previews"); |
|
11 | + $l->t("Enable sharing"); |
|
12 | + $l->t("Check for changes"); |
|
13 | + $l->t("Never"); |
|
14 | + $l->t("Once every direct access"); |
|
15 | + $l->t('Read only'); |
|
16 | 16 | |
17 | - script('files_external', [ |
|
18 | - 'settings', |
|
19 | - 'templates' |
|
20 | - ]); |
|
21 | - style('files_external', 'settings'); |
|
17 | + script('files_external', [ |
|
18 | + 'settings', |
|
19 | + 'templates' |
|
20 | + ]); |
|
21 | + style('files_external', 'settings'); |
|
22 | 22 | |
23 | - // load custom JS |
|
24 | - foreach ($_['backends'] as $backend) { |
|
25 | - /** @var Backend $backend */ |
|
26 | - $scripts = $backend->getCustomJs(); |
|
27 | - foreach ($scripts as $script) { |
|
28 | - script('files_external', $script); |
|
29 | - } |
|
30 | - } |
|
31 | - foreach ($_['authMechanisms'] as $authMechanism) { |
|
32 | - /** @var AuthMechanism $authMechanism */ |
|
33 | - $scripts = $authMechanism->getCustomJs(); |
|
34 | - foreach ($scripts as $script) { |
|
35 | - script('files_external', $script); |
|
36 | - } |
|
37 | - } |
|
23 | + // load custom JS |
|
24 | + foreach ($_['backends'] as $backend) { |
|
25 | + /** @var Backend $backend */ |
|
26 | + $scripts = $backend->getCustomJs(); |
|
27 | + foreach ($scripts as $script) { |
|
28 | + script('files_external', $script); |
|
29 | + } |
|
30 | + } |
|
31 | + foreach ($_['authMechanisms'] as $authMechanism) { |
|
32 | + /** @var AuthMechanism $authMechanism */ |
|
33 | + $scripts = $authMechanism->getCustomJs(); |
|
34 | + foreach ($scripts as $script) { |
|
35 | + script('files_external', $script); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | - function writeParameterInput($parameter, $options, $classes = []) { |
|
40 | - $value = ''; |
|
41 | - if (isset($options[$parameter->getName()])) { |
|
42 | - $value = $options[$parameter->getName()]; |
|
43 | - } |
|
44 | - $placeholder = $parameter->getText(); |
|
45 | - $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL); |
|
39 | + function writeParameterInput($parameter, $options, $classes = []) { |
|
40 | + $value = ''; |
|
41 | + if (isset($options[$parameter->getName()])) { |
|
42 | + $value = $options[$parameter->getName()]; |
|
43 | + } |
|
44 | + $placeholder = $parameter->getText(); |
|
45 | + $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL); |
|
46 | 46 | |
47 | - switch ($parameter->getType()) { |
|
48 | - case DefinitionParameter::VALUE_PASSWORD: ?> |
|
47 | + switch ($parameter->getType()) { |
|
48 | + case DefinitionParameter::VALUE_PASSWORD: ?> |
|
49 | 49 | <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
50 | 50 | <input type="password" |
51 | 51 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | placeholder="<?php p($placeholder); ?>" |
55 | 55 | /> |
56 | 56 | <?php |
57 | - break; |
|
58 | - case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
57 | + break; |
|
58 | + case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
59 | 59 | <?php $checkboxId = uniqid("checkbox_"); ?> |
60 | 60 | <div> |
61 | 61 | <label> |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | </label> |
70 | 70 | </div> |
71 | 71 | <?php |
72 | - break; |
|
73 | - case DefinitionParameter::VALUE_HIDDEN: ?> |
|
72 | + break; |
|
73 | + case DefinitionParameter::VALUE_HIDDEN: ?> |
|
74 | 74 | <input type="hidden" |
75 | 75 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
76 | 76 | data-parameter="<?php p($parameter->getName()); ?>" |
77 | 77 | value="<?php p($value); ?>" |
78 | 78 | /> |
79 | 79 | <?php |
80 | - break; |
|
81 | - default: ?> |
|
80 | + break; |
|
81 | + default: ?> |
|
82 | 82 | <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
83 | 83 | <input type="text" |
84 | 84 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | placeholder="<?php p($placeholder); ?>" |
88 | 88 | /> |
89 | 89 | <?php |
90 | - } |
|
91 | - } |
|
90 | + } |
|
91 | + } |
|
92 | 92 | ?> |
93 | 93 | |
94 | 94 | <div id="emptycontent" class="hidden"> |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | <?php p($l->t('Add storage')); ?> |
134 | 134 | </option> |
135 | 135 | <?php |
136 | - $sortedBackends = array_filter($_['backends'], function($backend) use ($_) { |
|
137 | - return $backend->isVisibleFor($_['visibilityType']); |
|
138 | - }); |
|
139 | - uasort($sortedBackends, function($a, $b) { |
|
140 | - return strcasecmp($a->getText(), $b->getText()); |
|
141 | - }); |
|
142 | - ?> |
|
136 | + $sortedBackends = array_filter($_['backends'], function($backend) use ($_) { |
|
137 | + return $backend->isVisibleFor($_['visibilityType']); |
|
138 | + }); |
|
139 | + uasort($sortedBackends, function($a, $b) { |
|
140 | + return strcasecmp($a->getText(), $b->getText()); |
|
141 | + }); |
|
142 | + ?> |
|
143 | 143 | <?php foreach ($sortedBackends as $backend): ?> |
144 | 144 | <?php if ($backend->getDeprecateTo()) continue; // ignore deprecated backends ?> |
145 | 145 | <option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option> |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | |
172 | 172 | <p id="userMountingBackends"<?php if (!$_['allowUserMounting']): ?> class="hidden"<?php endif; ?>> |
173 | 173 | <?php |
174 | - $userBackends = array_filter($_['backends'], function($backend) { |
|
175 | - return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL); |
|
176 | - }); |
|
177 | - ?> |
|
174 | + $userBackends = array_filter($_['backends'], function($backend) { |
|
175 | + return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL); |
|
176 | + }); |
|
177 | + ?> |
|
178 | 178 | <?php $i = 0; foreach ($userBackends as $backend): ?> |
179 | 179 | <?php if ($deprecateTo = $backend->getDeprecateTo()): ?> |
180 | 180 | <input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" /> |
@@ -96,9 +96,9 @@ |
||
96 | 96 | <h2><?php p($l->t('No external storage configured or you don\'t have the permission to configure them')); ?></h2> |
97 | 97 | </div> |
98 | 98 | |
99 | -<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>"> |
|
99 | +<form data-can-create="<?php echo $canCreateMounts ? 'true' : 'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled'] ? 'true' : 'false'; ?>"> |
|
100 | 100 | <h2 class="inlineblock" data-anchor-name="external-storage"><?php p($l->t('External storages')); ?></h2> |
101 | - <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-external-storage')); ?>"></a> |
|
101 | + <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation')); ?>" href="<?php p(link_to_docs('admin-external-storage')); ?>"></a> |
|
102 | 102 | <p class="settings-hint"><?php p($l->t('External storage enables you to mount external storage services and devices as secondary Nextcloud storage devices. You may also allow users to mount their own external storage services.')); ?></p> |
103 | 103 | <?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> |
104 | 104 | <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> |
@@ -100,7 +100,10 @@ discard block |
||
100 | 100 | <h2 class="inlineblock" data-anchor-name="external-storage"><?php p($l->t('External storages')); ?></h2> |
101 | 101 | <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-external-storage')); ?>"></a> |
102 | 102 | <p class="settings-hint"><?php p($l->t('External storage enables you to mount external storage services and devices as secondary Nextcloud storage devices. You may also allow users to mount their own external storage services.')); ?></p> |
103 | - <?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> |
|
103 | + <?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) { |
|
104 | + print_unescaped(''.$_['dependencies'].''); |
|
105 | +} |
|
106 | +?> |
|
104 | 107 | <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> |
105 | 108 | <thead> |
106 | 109 | <tr> |
@@ -109,7 +112,10 @@ discard block |
||
109 | 112 | <th><?php p($l->t('External storage')); ?></th> |
110 | 113 | <th><?php p($l->t('Authentication')); ?></th> |
111 | 114 | <th><?php p($l->t('Configuration')); ?></th> |
112 | - <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) print_unescaped('<th>'.$l->t('Available for').'</th>'); ?> |
|
115 | + <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) { |
|
116 | + print_unescaped('<th>'.$l->t('Available for').'</th>'); |
|
117 | +} |
|
118 | +?> |
|
113 | 119 | <th> </th> |
114 | 120 | <th> </th> |
115 | 121 | <th> </th> |
@@ -142,7 +148,10 @@ discard block |
||
142 | 148 | }); |
143 | 149 | ?> |
144 | 150 | <?php foreach ($sortedBackends as $backend): ?> |
145 | - <?php if ($backend->getDeprecateTo()) continue; // ignore deprecated backends ?> |
|
151 | + <?php if ($backend->getDeprecateTo()) { |
|
152 | + continue; |
|
153 | +} |
|
154 | +// ignore deprecated backends ?> |
|
146 | 155 | <option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option> |
147 | 156 | <?php endforeach; ?> |
148 | 157 | </select> |
@@ -167,7 +176,10 @@ discard block |
||
167 | 176 | |
168 | 177 | <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?> |
169 | 178 | <input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox" |
170 | - value="1" <?php if ($_['allowUserMounting']) print_unescaped(' checked="checked"'); ?> /> |
|
179 | + value="1" <?php if ($_['allowUserMounting']) { |
|
180 | + print_unescaped(' checked="checked"'); |
|
181 | +} |
|
182 | +?> /> |
|
171 | 183 | <label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span> |
172 | 184 | |
173 | 185 | <p id="userMountingBackends"<?php if (!$_['allowUserMounting']): ?> class="hidden"<?php endif; ?>> |
@@ -179,8 +191,14 @@ discard block |
||
179 | 191 | <?php $i = 0; foreach ($userBackends as $backend): ?> |
180 | 192 | <?php if ($deprecateTo = $backend->getDeprecateTo()): ?> |
181 | 193 | <input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" /> |
182 | - <?php else: ?> |
|
183 | - <input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) print_unescaped(' checked="checked"'); ?> /> |
|
194 | + <?php else { |
|
195 | + : ?> |
|
196 | + <input type="checkbox" id="allowUserMountingBackends<?php p($i); |
|
197 | +} |
|
198 | +?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) { |
|
199 | + print_unescaped(' checked="checked"'); |
|
200 | +} |
|
201 | +?> /> |
|
184 | 202 | <label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend->getText()); ?></label> <br /> |
185 | 203 | <?php endif; ?> |
186 | 204 | <?php $i++; ?> |