@@ -77,24 +77,24 @@ discard block |
||
77 | 77 | protected function userManagementHooks(ILogger $logger) { |
78 | 78 | $userActions = new UserManagement($logger); |
79 | 79 | |
80 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
81 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
82 | - Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
80 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
81 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
82 | + Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
83 | 83 | |
84 | 84 | /** @var IUserSession|Session $userSession */ |
85 | 85 | $userSession = $this->getContainer()->getServer()->getUserSession(); |
86 | 86 | $userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); |
87 | 87 | } |
88 | 88 | |
89 | - protected function groupHooks(ILogger $logger) { |
|
89 | + protected function groupHooks(ILogger $logger) { |
|
90 | 90 | $groupActions = new GroupManagement($logger); |
91 | 91 | |
92 | 92 | /** @var IGroupManager|Manager $groupManager */ |
93 | 93 | $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
94 | - $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
95 | - $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
96 | - $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
97 | - $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
94 | + $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
95 | + $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
96 | + $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
97 | + $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | protected function sharingHooks(ILogger $logger) { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | protected function versionsHooks(ILogger $logger) { |
208 | 208 | $versionsActions = new Versions($logger); |
209 | 209 | Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
210 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
210 | + Util::connectHook('\OCP\Versions', 'delete', $versionsActions, 'delete'); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | protected function trashbinHooks(ILogger $logger) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param array $params |
36 | 36 | */ |
37 | 37 | public function shared(array $params) { |
38 | - if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
38 | + if ($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
39 | 39 | $this->log( |
40 | 40 | 'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)', |
41 | 41 | $params, |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'id', |
48 | 48 | ] |
49 | 49 | ); |
50 | - } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
50 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
51 | 51 | $this->log( |
52 | 52 | 'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)', |
53 | 53 | $params, |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'id', |
61 | 61 | ] |
62 | 62 | ); |
63 | - } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
63 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
64 | 64 | $this->log( |
65 | 65 | 'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)', |
66 | 66 | $params, |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param array $params |
83 | 83 | */ |
84 | 84 | public function unshare(array $params) { |
85 | - if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
85 | + if ($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
86 | 86 | $this->log( |
87 | 87 | 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', |
88 | 88 | $params, |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 'id', |
94 | 94 | ] |
95 | 95 | ); |
96 | - } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
96 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
97 | 97 | $this->log( |
98 | 98 | 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', |
99 | 99 | $params, |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'id', |
106 | 106 | ] |
107 | 107 | ); |
108 | - } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
108 | + } elseif ($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
109 | 109 | $this->log( |
110 | 110 | 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', |
111 | 111 | $params, |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | array $params, |
48 | 48 | array $elements, |
49 | 49 | $obfuscateParameters = false) { |
50 | - foreach($elements as $element) { |
|
51 | - if(!isset($params[$element])) { |
|
50 | + foreach ($elements as $element) { |
|
51 | + if (!isset($params[$element])) { |
|
52 | 52 | if ($obfuscateParameters) { |
53 | 53 | $this->logger->critical( |
54 | 54 | '$params["'.$element.'"] was missing.', |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $replaceArray = []; |
71 | - foreach($elements as $element) { |
|
72 | - if($params[$element] instanceof \DateTime) { |
|
71 | + foreach ($elements as $element) { |
|
72 | + if ($params[$element] instanceof \DateTime) { |
|
73 | 73 | $params[$element] = $params[$element]->format('Y-m-d H:i:s'); |
74 | 74 | } |
75 | 75 | $replaceArray[] = $params[$element]; |
@@ -66,7 +66,7 @@ |
||
66 | 66 | * @param IUser $user |
67 | 67 | */ |
68 | 68 | public function setPassword(IUser $user) { |
69 | - if($user->getBackendClassName() === 'Database') { |
|
69 | + if ($user->getBackendClassName() === 'Database') { |
|
70 | 70 | $this->log( |
71 | 71 | 'Password of user "%s" has been changed', |
72 | 72 | [ |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | use Symfony\Component\Console\Input\InputOption; |
40 | 40 | use Symfony\Component\Console\Output\OutputInterface; |
41 | 41 | |
42 | -class CheckCode extends Command implements CompletionAwareInterface { |
|
42 | +class CheckCode extends Command implements CompletionAwareInterface { |
|
43 | 43 | |
44 | 44 | /** @var InfoParser */ |
45 | 45 | private $infoParser; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'c', |
70 | 70 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
71 | 71 | 'enable the specified checker(s)', |
72 | - [ 'private', 'deprecation', 'strong-comparison' ] |
|
72 | + ['private', 'deprecation', 'strong-comparison'] |
|
73 | 73 | ) |
74 | 74 | ->addOption( |
75 | 75 | '--skip-checkers', |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $codeChecker = new CodeChecker($checkList, !$input->getOption('skip-validate-info')); |
101 | 101 | |
102 | 102 | $codeChecker->listen('CodeChecker', 'analyseFileBegin', function($params) use ($output) { |
103 | - if(OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
103 | + if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
104 | 104 | $output->writeln("<info>Analysing {$params}</info>"); |
105 | 105 | } |
106 | 106 | }); |
@@ -108,29 +108,29 @@ discard block |
||
108 | 108 | $count = count($errors); |
109 | 109 | |
110 | 110 | // show filename if the verbosity is low, but there are errors in a file |
111 | - if($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) { |
|
111 | + if ($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) { |
|
112 | 112 | $output->writeln("<info>Analysing {$filename}</info>"); |
113 | 113 | } |
114 | 114 | |
115 | 115 | // show error count if there are errors present or the verbosity is high |
116 | - if($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
116 | + if ($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
117 | 117 | $output->writeln(" {$count} errors"); |
118 | 118 | } |
119 | 119 | usort($errors, function($a, $b) { |
120 | - return $a['line'] >$b['line']; |
|
120 | + return $a['line'] > $b['line']; |
|
121 | 121 | }); |
122 | 122 | |
123 | - foreach($errors as $p) { |
|
123 | + foreach ($errors as $p) { |
|
124 | 124 | $line = sprintf("%' 4d", $p['line']); |
125 | 125 | $output->writeln(" <error>line $line: {$p['disallowedToken']} - {$p['reason']}</error>"); |
126 | 126 | } |
127 | 127 | }); |
128 | 128 | $errors = []; |
129 | - if(!$input->getOption('skip-checkers')) { |
|
129 | + if (!$input->getOption('skip-checkers')) { |
|
130 | 130 | $errors = $codeChecker->analyse($appId); |
131 | 131 | } |
132 | 132 | |
133 | - if(!$input->getOption('skip-validate-info')) { |
|
133 | + if (!$input->getOption('skip-validate-info')) { |
|
134 | 134 | $infoChecker = new InfoChecker($this->infoParser); |
135 | 135 | |
136 | 136 | $infoChecker->listen('InfoChecker', 'mandatoryFieldMissing', function($key) use ($output) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | }); |
139 | 139 | |
140 | 140 | $infoChecker->listen('InfoChecker', 'deprecatedFieldFound', function($key, $value) use ($output) { |
141 | - if($value === [] || is_null($value) || $value === '') { |
|
141 | + if ($value === [] || is_null($value) || $value === '') { |
|
142 | 142 | $output->writeln("<info>Deprecated field available: $key</info>"); |
143 | 143 | } else { |
144 | 144 | $output->writeln("<info>Deprecated field available: $key => $value</info>"); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $output->writeln("<error>Migrate the app version to appinfo/info.xml (add <version>$version</version> to appinfo/info.xml and remove appinfo/version)</error>"); |
162 | 162 | }); |
163 | 163 | |
164 | - if(OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
164 | + if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
165 | 165 | $infoChecker->listen('InfoChecker', 'mandatoryFieldFound', function($key, $value) use ($output) { |
166 | 166 | $output->writeln("<info>Mandatory field available: $key => $value</info>"); |
167 | 167 | }); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | throw new \RuntimeException("No app with given id <$appId> known."); |
223 | 223 | } |
224 | 224 | |
225 | - $updatePhp = $appPath . '/appinfo/update.php'; |
|
225 | + $updatePhp = $appPath.'/appinfo/update.php'; |
|
226 | 226 | if (file_exists($updatePhp)) { |
227 | 227 | $output->writeln("<info>Deprecated file found: $updatePhp - please use repair steps</info>"); |
228 | 228 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <fieldset id="ldapWizard1"> |
2 | 2 | <p> |
3 | 3 | <select id="ldap_serverconfig_chooser" name="ldap_serverconfig_chooser"> |
4 | - <?php if(count($_['serverConfigurationPrefixes']) === 0 ) { |
|
4 | + <?php if (count($_['serverConfigurationPrefixes']) === 0) { |
|
5 | 5 | ?> |
6 | - <option value="" selected><?php p($l->t('1. Server'));?></option>'); |
|
6 | + <option value="" selected><?php p($l->t('1. Server')); ?></option>'); |
|
7 | 7 | <?php |
8 | 8 | } else { |
9 | 9 | $i = 1; |
10 | 10 | $sel = ' selected'; |
11 | - foreach($_['serverConfigurationPrefixes'] as $prefix) { |
|
11 | + foreach ($_['serverConfigurationPrefixes'] as $prefix) { |
|
12 | 12 | ?> |
13 | - <option value="<?php p($prefix); ?>"<?php p($sel); $sel = ''; ?>><?php p($l->t('%s. Server:', array($i++)));?> <?php p(' '.$_['serverConfigurationHosts'][$prefix]); ?></option> |
|
13 | + <option value="<?php p($prefix); ?>"<?php p($sel); $sel = ''; ?>><?php p($l->t('%s. Server:', array($i++))); ?> <?php p(' '.$_['serverConfigurationHosts'][$prefix]); ?></option> |
|
14 | 14 | <?php |
15 | 15 | } |
16 | 16 | } |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | </select> |
19 | 19 | <button type="button" id="ldap_action_add_configuration" |
20 | 20 | name="ldap_action_add_configuration" class="icon-add icon-default-style" |
21 | - title="<?php p($l->t('Add a new configuration'));?>"> </button> |
|
21 | + title="<?php p($l->t('Add a new configuration')); ?>"> </button> |
|
22 | 22 | <button type="button" id="ldap_action_copy_configuration" |
23 | 23 | name="ldap_action_copy_configuration" |
24 | 24 | class="ldapIconCopy icon-default-style" |
25 | - title="<?php p($l->t('Copy current configuration into new directory binding'));?>"> </button> |
|
25 | + title="<?php p($l->t('Copy current configuration into new directory binding')); ?>"> </button> |
|
26 | 26 | <button type="button" id="ldap_action_delete_configuration" |
27 | 27 | name="ldap_action_delete_configuration" class="icon-delete icon-default-style" |
28 | - title="<?php p($l->t('Delete the current configuration'));?>"> </button> |
|
28 | + title="<?php p($l->t('Delete the current configuration')); ?>"> </button> |
|
29 | 29 | </p> |
30 | 30 | |
31 | 31 | <div class="hostPortCombinator"> |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | <div class="table"> |
35 | 35 | <input type="text" class="host" id="ldap_host" |
36 | 36 | name="ldap_host" |
37 | - placeholder="<?php p($l->t('Host'));?>" |
|
38 | - title="<?php p($l->t('You can omit the protocol, unless you require SSL. If so, start with ldaps://'));?>" |
|
37 | + placeholder="<?php p($l->t('Host')); ?>" |
|
38 | + title="<?php p($l->t('You can omit the protocol, unless you require SSL. If so, start with ldaps://')); ?>" |
|
39 | 39 | /> |
40 | 40 | <span class="hostPortCombinatorSpan"> |
41 | 41 | <input type="number" id="ldap_port" name="ldap_port" |
42 | - placeholder="<?php p($l->t('Port'));?>" /> |
|
42 | + placeholder="<?php p($l->t('Port')); ?>" /> |
|
43 | 43 | <button class="ldapDetectPort" name="ldapDetectPort" type="button"> |
44 | - <?php p($l->t('Detect Port'));?> |
|
44 | + <?php p($l->t('Detect Port')); ?> |
|
45 | 45 | </button> |
46 | 46 | </span> |
47 | 47 | </div> |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | <div class="tablerow"> |
52 | 52 | <input type="text" id="ldap_dn" name="ldap_dn" |
53 | 53 | class="tablecell" |
54 | - placeholder="<?php p($l->t('User DN'));?>" autocomplete="off" |
|
55 | - title="<?php p($l->t('The DN of the client user with which the bind shall be done, e.g. uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password empty.'));?>" |
|
54 | + placeholder="<?php p($l->t('User DN')); ?>" autocomplete="off" |
|
55 | + title="<?php p($l->t('The DN of the client user with which the bind shall be done, e.g. uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password empty.')); ?>" |
|
56 | 56 | /> |
57 | 57 | </div> |
58 | 58 | |
59 | 59 | <div class="tablerow"> |
60 | 60 | <input type="password" id="ldap_agent_password" |
61 | 61 | class="tablecell" name="ldap_agent_password" |
62 | - placeholder="<?php p($l->t('Password'));?>" autocomplete="off" |
|
63 | - title="<?php p($l->t('For anonymous access, leave DN and Password empty.'));?>" |
|
62 | + placeholder="<?php p($l->t('Password')); ?>" autocomplete="off" |
|
63 | + title="<?php p($l->t('For anonymous access, leave DN and Password empty.')); ?>" |
|
64 | 64 | /> |
65 | 65 | <button class="ldapSaveAgentCredentials" name="ldapSaveAgentCredentials" type="button"> |
66 | - <?php p($l->t('Save Credentials'));?> |
|
66 | + <?php p($l->t('Save Credentials')); ?> |
|
67 | 67 | </button> |
68 | 68 | </div> |
69 | 69 | <div class="tablerow"> </div> |
@@ -71,24 +71,24 @@ discard block |
||
71 | 71 | <div class="tablerow"> |
72 | 72 | <textarea id="ldap_base" name="ldap_base" |
73 | 73 | class="tablecell" |
74 | - placeholder="<?php p($l->t('One Base DN per line'));?>" |
|
75 | - title="<?php p($l->t('You can specify Base DN for users and groups in the Advanced tab'));?>"> |
|
74 | + placeholder="<?php p($l->t('One Base DN per line')); ?>" |
|
75 | + title="<?php p($l->t('You can specify Base DN for users and groups in the Advanced tab')); ?>"> |
|
76 | 76 | </textarea> |
77 | 77 | <button class="ldapDetectBase" name="ldapDetectBase" type="button"> |
78 | - <?php p($l->t('Detect Base DN'));?> |
|
78 | + <?php p($l->t('Detect Base DN')); ?> |
|
79 | 79 | </button> |
80 | 80 | <button class="ldapTestBase" name="ldapTestBase" type="button"> |
81 | - <?php p($l->t('Test Base DN'));?> |
|
81 | + <?php p($l->t('Test Base DN')); ?> |
|
82 | 82 | </button> |
83 | 83 | </div> |
84 | 84 | |
85 | 85 | <div class="tablerow left"> |
86 | 86 | <input type="checkbox" id="ldap_experienced_admin" value="1" |
87 | 87 | name="ldap_experienced_admin" class="tablecell" |
88 | - title="<?php p($l->t('Avoids automatic LDAP requests. Better for bigger setups, but requires some LDAP knowledge.'));?>" |
|
88 | + title="<?php p($l->t('Avoids automatic LDAP requests. Better for bigger setups, but requires some LDAP knowledge.')); ?>" |
|
89 | 89 | /> |
90 | 90 | <label for="ldap_experienced_admin" class="tablecell"> |
91 | - <?php p($l->t('Manually enter LDAP filters (recommended for large directories)'));?> |
|
91 | + <?php p($l->t('Manually enter LDAP filters (recommended for large directories)')); ?> |
|
92 | 92 | </label> |
93 | 93 | </div> |
94 | 94 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function __construct($configPrefix, $autoRead = true) { |
109 | 109 | $this->configPrefix = $configPrefix; |
110 | - if($autoRead) { |
|
110 | + if ($autoRead) { |
|
111 | 111 | $this->readConfiguration(); |
112 | 112 | } |
113 | 113 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return mixed|null |
118 | 118 | */ |
119 | 119 | public function __get($name) { |
120 | - if(isset($this->config[$name])) { |
|
120 | + if (isset($this->config[$name])) { |
|
121 | 121 | return $this->config[$name]; |
122 | 122 | } |
123 | 123 | return null; |
@@ -148,22 +148,22 @@ discard block |
||
148 | 148 | * @return false|null |
149 | 149 | */ |
150 | 150 | public function setConfiguration($config, &$applied = null) { |
151 | - if(!is_array($config)) { |
|
151 | + if (!is_array($config)) { |
|
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | |
155 | 155 | $cta = $this->getConfigTranslationArray(); |
156 | - foreach($config as $inputKey => $val) { |
|
157 | - if(strpos($inputKey, '_') !== false && array_key_exists($inputKey, $cta)) { |
|
156 | + foreach ($config as $inputKey => $val) { |
|
157 | + if (strpos($inputKey, '_') !== false && array_key_exists($inputKey, $cta)) { |
|
158 | 158 | $key = $cta[$inputKey]; |
159 | - } elseif(array_key_exists($inputKey, $this->config)) { |
|
159 | + } elseif (array_key_exists($inputKey, $this->config)) { |
|
160 | 160 | $key = $inputKey; |
161 | 161 | } else { |
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | |
165 | 165 | $setMethod = 'setValue'; |
166 | - switch($key) { |
|
166 | + switch ($key) { |
|
167 | 167 | case 'ldapAgentPassword': |
168 | 168 | $setMethod = 'setRawValue'; |
169 | 169 | break; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | break; |
188 | 188 | } |
189 | 189 | $this->$setMethod($key, $val); |
190 | - if(is_array($applied)) { |
|
190 | + if (is_array($applied)) { |
|
191 | 191 | $applied[] = $inputKey; |
192 | 192 | // storing key as index avoids duplication, and as value for simplicity |
193 | 193 | } |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | public function readConfiguration() { |
200 | - if(!$this->configRead && !is_null($this->configPrefix)) { |
|
200 | + if (!$this->configRead && !is_null($this->configPrefix)) { |
|
201 | 201 | $cta = array_flip($this->getConfigTranslationArray()); |
202 | - foreach($this->config as $key => $val) { |
|
203 | - if(!isset($cta[$key])) { |
|
202 | + foreach ($this->config as $key => $val) { |
|
203 | + if (!isset($cta[$key])) { |
|
204 | 204 | //some are determined |
205 | 205 | continue; |
206 | 206 | } |
207 | 207 | $dbKey = $cta[$key]; |
208 | - switch($key) { |
|
208 | + switch ($key) { |
|
209 | 209 | case 'ldapBase': |
210 | 210 | case 'ldapBaseUsers': |
211 | 211 | case 'ldapBaseGroups': |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function saveConfiguration() { |
250 | 250 | $cta = array_flip($this->getConfigTranslationArray()); |
251 | - foreach($this->unsavedChanges as $key) { |
|
251 | + foreach ($this->unsavedChanges as $key) { |
|
252 | 252 | $value = $this->config[$key]; |
253 | 253 | switch ($key) { |
254 | 254 | case 'ldapAgentPassword': |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | case 'ldapGroupFilterObjectclass': |
265 | 265 | case 'ldapGroupFilterGroups': |
266 | 266 | case 'ldapLoginFilterAttributes': |
267 | - if(is_array($value)) { |
|
267 | + if (is_array($value)) { |
|
268 | 268 | $value = implode("\n", $value); |
269 | 269 | } |
270 | 270 | break; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | case 'ldapUuidGroupAttribute': |
276 | 276 | continue 2; |
277 | 277 | } |
278 | - if(is_null($value)) { |
|
278 | + if (is_null($value)) { |
|
279 | 279 | $value = ''; |
280 | 280 | } |
281 | 281 | $this->saveValue($cta[$key], $value); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | protected function getMultiLine($varName) { |
291 | 291 | $value = $this->getValue($varName); |
292 | - if(empty($value)) { |
|
292 | + if (empty($value)) { |
|
293 | 293 | $value = ''; |
294 | 294 | } else { |
295 | 295 | $value = preg_split('/\r\n|\r|\n/', $value); |
@@ -305,21 +305,21 @@ discard block |
||
305 | 305 | * @param array|string $value to set |
306 | 306 | */ |
307 | 307 | protected function setMultiLine($varName, $value) { |
308 | - if(empty($value)) { |
|
308 | + if (empty($value)) { |
|
309 | 309 | $value = ''; |
310 | 310 | } else if (!is_array($value)) { |
311 | 311 | $value = preg_split('/\r\n|\r|\n|;/', $value); |
312 | - if($value === false) { |
|
312 | + if ($value === false) { |
|
313 | 313 | $value = ''; |
314 | 314 | } |
315 | 315 | } |
316 | 316 | |
317 | - if(!is_array($value)) { |
|
317 | + if (!is_array($value)) { |
|
318 | 318 | $finalValue = trim($value); |
319 | 319 | } else { |
320 | 320 | $finalValue = []; |
321 | - foreach($value as $key => $val) { |
|
322 | - if(is_string($val)) { |
|
321 | + foreach ($value as $key => $val) { |
|
322 | + if (is_string($val)) { |
|
323 | 323 | $val = trim($val); |
324 | 324 | if ($val !== '') { |
325 | 325 | //accidental line breaks are not wanted and can cause |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | */ |
367 | 367 | protected function getValue($varName) { |
368 | 368 | static $defaults; |
369 | - if(is_null($defaults)) { |
|
369 | + if (is_null($defaults)) { |
|
370 | 370 | $defaults = $this->getDefaults(); |
371 | 371 | } |
372 | 372 | return \OCP\Config::getAppValue('user_ldap', |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @param mixed $value to set |
382 | 382 | */ |
383 | 383 | protected function setValue($varName, $value) { |
384 | - if(is_string($value)) { |
|
384 | + if (is_string($value)) { |
|
385 | 385 | $value = trim($value); |
386 | 386 | } |
387 | 387 | $this->config[$varName] = $value; |
@@ -7,49 +7,49 @@ discard block |
||
7 | 7 | <form id="ocDefaultEncryptionModule" class="section"> |
8 | 8 | <h2 data-anchor-name="basic-encryption-module"><?php p($l->t('Basic encryption module')); ?></h2> |
9 | 9 | |
10 | - <?php if ($_["initialized"] === \OCA\Encryption\Session::NOT_INITIALIZED ): ?> |
|
10 | + <?php if ($_["initialized"] === \OCA\Encryption\Session::NOT_INITIALIZED): ?> |
|
11 | 11 | |
12 | 12 | <?php p($l->t("Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.")); ?> |
13 | 13 | |
14 | - <?php elseif ( $_["initialized"] === \OCA\Encryption\Session::INIT_EXECUTED ): ?> |
|
14 | + <?php elseif ($_["initialized"] === \OCA\Encryption\Session::INIT_EXECUTED): ?> |
|
15 | 15 | <p> |
16 | 16 | <a name="changePKPasswd" /> |
17 | 17 | <label for="changePrivateKeyPasswd"> |
18 | - <em><?php p( $l->t( "Your private key password no longer matches your log-in password." ) ); ?></em> |
|
18 | + <em><?php p($l->t("Your private key password no longer matches your log-in password.")); ?></em> |
|
19 | 19 | </label> |
20 | 20 | <br /> |
21 | - <?php p( $l->t( "Set your old private key password to your current log-in password:" ) ); ?> |
|
22 | - <?php if ( $_["recoveryEnabledForUser"] ): |
|
23 | - p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) ); |
|
21 | + <?php p($l->t("Set your old private key password to your current log-in password:")); ?> |
|
22 | + <?php if ($_["recoveryEnabledForUser"]): |
|
23 | + p($l->t(" If you don't remember your old password you can ask your administrator to recover your files.")); |
|
24 | 24 | endif; ?> |
25 | 25 | <br /> |
26 | 26 | <input |
27 | 27 | type="password" |
28 | 28 | name="changePrivateKeyPassword" |
29 | 29 | id="oldPrivateKeyPassword" /> |
30 | - <label for="oldPrivateKeyPassword"><?php p($l->t( "Old log-in password" )); ?></label> |
|
30 | + <label for="oldPrivateKeyPassword"><?php p($l->t("Old log-in password")); ?></label> |
|
31 | 31 | <br /> |
32 | 32 | <input |
33 | 33 | type="password" |
34 | 34 | name="changePrivateKeyPassword" |
35 | 35 | id="newPrivateKeyPassword" /> |
36 | - <label for="newRecoveryPassword"><?php p($l->t( "Current log-in password" )); ?></label> |
|
36 | + <label for="newRecoveryPassword"><?php p($l->t("Current log-in password")); ?></label> |
|
37 | 37 | <br /> |
38 | 38 | <button |
39 | 39 | type="button" |
40 | 40 | name="submitChangePrivateKeyPassword" |
41 | - disabled><?php p($l->t( "Update Private Key Password" )); ?> |
|
41 | + disabled><?php p($l->t("Update Private Key Password")); ?> |
|
42 | 42 | </button> |
43 | 43 | <span class="msg"></span> |
44 | 44 | </p> |
45 | 45 | |
46 | - <?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL ): ?> |
|
46 | + <?php elseif ($_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL): ?> |
|
47 | 47 | <br /> |
48 | 48 | <p id="userEnableRecovery"> |
49 | - <label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label> |
|
49 | + <label for="userEnableRecovery"><?php p($l->t("Enable password recovery:")); ?></label> |
|
50 | 50 | <span class="msg"></span> |
51 | 51 | <br /> |
52 | - <em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em> |
|
52 | + <em><?php p($l->t("Enabling this option will allow you to reobtain access to your encrypted files in case of password loss")); ?></em> |
|
53 | 53 | <br /> |
54 | 54 | <input |
55 | 55 | type="radio" |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | id="userEnableRecoveryCheckbox" |
58 | 58 | name="userEnableRecovery" |
59 | 59 | value="1" |
60 | - <?php echo ( $_["recoveryEnabledForUser"] ? 'checked="checked"' : '' ); ?> /> |
|
61 | - <label for="userEnableRecoveryCheckbox"><?php p( $l->t( "Enabled" ) ); ?></label> |
|
60 | + <?php echo ($_["recoveryEnabledForUser"] ? 'checked="checked"' : ''); ?> /> |
|
61 | + <label for="userEnableRecoveryCheckbox"><?php p($l->t("Enabled")); ?></label> |
|
62 | 62 | <br /> |
63 | 63 | |
64 | 64 | <input |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | id="userDisableRecoveryCheckbox" |
68 | 68 | name="userEnableRecovery" |
69 | 69 | value="0" |
70 | - <?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> /> |
|
71 | - <label for="userDisableRecoveryCheckbox"><?php p( $l->t( "Disabled" ) ); ?></label> |
|
70 | + <?php echo ($_["recoveryEnabledForUser"] === false ? 'checked="checked"' : ''); ?> /> |
|
71 | + <label for="userDisableRecoveryCheckbox"><?php p($l->t("Disabled")); ?></label> |
|
72 | 72 | </p> |
73 | 73 | <?php endif; ?> |
74 | 74 | </form> |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return array(); |
91 | 91 | } |
92 | 92 | |
93 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
93 | + $path = $this->getPathToCertificates().'uploads/'; |
|
94 | 94 | if (!$this->view->is_dir($path)) { |
95 | 95 | return array(); |
96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | while (false !== ($file = readdir($handle))) { |
103 | 103 | if ($file != '.' && $file != '..') { |
104 | 104 | try { |
105 | - $result[] = new Certificate($this->view->file_get_contents($path . $file), $file); |
|
105 | + $result[] = new Certificate($this->view->file_get_contents($path.$file), $file); |
|
106 | 106 | } catch (\Exception $e) { |
107 | 107 | } |
108 | 108 | } |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | $this->view->mkdir($path); |
123 | 123 | } |
124 | 124 | |
125 | - $defaultCertificates = file_get_contents(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
125 | + $defaultCertificates = file_get_contents(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
126 | 126 | if (strlen($defaultCertificates) < 1024) { // sanity check to verify that we have some content for our bundle |
127 | 127 | // log as exception so we have a stacktrace |
128 | 128 | $this->logger->logException(new \Exception('Shipped ca-bundle is empty, refusing to create certificate bundle')); |
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
132 | - $certPath = $path . 'rootcerts.crt'; |
|
133 | - $tmpPath = $certPath . '.tmp' . $this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
132 | + $certPath = $path.'rootcerts.crt'; |
|
133 | + $tmpPath = $certPath.'.tmp'.$this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
134 | 134 | $fhCerts = $this->view->fopen($tmpPath, 'w'); |
135 | 135 | |
136 | 136 | // Write user certificates |
137 | 137 | foreach ($certs as $cert) { |
138 | - $file = $path . '/uploads/' . $cert->getName(); |
|
138 | + $file = $path.'/uploads/'.$cert->getName(); |
|
139 | 139 | $data = $this->view->file_get_contents($file); |
140 | 140 | if (strpos($data, 'BEGIN CERTIFICATE')) { |
141 | 141 | fwrite($fhCerts, $data); |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | throw new \Exception('Filename is not valid'); |
172 | 172 | } |
173 | 173 | |
174 | - $dir = $this->getPathToCertificates() . 'uploads/'; |
|
174 | + $dir = $this->getPathToCertificates().'uploads/'; |
|
175 | 175 | if (!$this->view->file_exists($dir)) { |
176 | 176 | $this->view->mkdir($dir); |
177 | 177 | } |
178 | 178 | |
179 | 179 | try { |
180 | - $file = $dir . $name; |
|
180 | + $file = $dir.$name; |
|
181 | 181 | $certificateObject = new Certificate($certificate, $name); |
182 | 182 | $this->view->file_put_contents($file, $certificate); |
183 | 183 | $this->createCertificateBundle(); |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | if (!Filesystem::isValidPath($name)) { |
199 | 199 | return false; |
200 | 200 | } |
201 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
202 | - if ($this->view->file_exists($path . $name)) { |
|
203 | - $this->view->unlink($path . $name); |
|
201 | + $path = $this->getPathToCertificates().'uploads/'; |
|
202 | + if ($this->view->file_exists($path.$name)) { |
|
203 | + $this->view->unlink($path.$name); |
|
204 | 204 | $this->createCertificateBundle(); |
205 | 205 | } |
206 | 206 | return true; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if ($uid === '') { |
217 | 217 | $uid = $this->uid; |
218 | 218 | } |
219 | - return $this->getPathToCertificates($uid) . 'rootcerts.crt'; |
|
219 | + return $this->getPathToCertificates($uid).'rootcerts.crt'; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | if ($uid === '') { |
249 | 249 | $uid = $this->uid; |
250 | 250 | } |
251 | - $path = is_null($uid) ? '/files_external/' : '/' . $uid . '/files_external/'; |
|
251 | + $path = is_null($uid) ? '/files_external/' : '/'.$uid.'/files_external/'; |
|
252 | 252 | |
253 | 253 | return $path; |
254 | 254 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $sourceMTimes[] = $this->view->filemtime($this->getCertificateBundle(null)); |
275 | 275 | } |
276 | 276 | |
277 | - $sourceMTime = array_reduce($sourceMTimes, function ($max, $mtime) { |
|
277 | + $sourceMTime = array_reduce($sourceMTimes, function($max, $mtime) { |
|
278 | 278 | return max($max, $mtime); |
279 | 279 | }, 0); |
280 | 280 | return $sourceMTime > $this->view->filemtime($targetBundle); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @return int |
287 | 287 | */ |
288 | 288 | protected function getFilemtimeOfCaBundle() { |
289 | - return filemtime(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
289 | + return filemtime(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | } |