PluginProbe
User Access Manager / 2.3.2
User Access Manager v2.3.2
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
← All changes | src/Controller/Backend/SettingsController.php +17 -31 2.3.162.3.2 View file →
@@ -169,54 +169,40 @@
169 169 }
170 170
171 171 private function isXSendFileAvailable(): bool
172 172 {
173 - // On nginx, X-Accel-Redirect is always available — no HTTP test needed.
174 - if ($this->wordpress->isNginx()) {
175 - return true;
176 - }
177 -
178 - $content = $this->php->fileGetContents($this->wordpress->getSiteUrl() . '?testXSendFile');
173 + $content = @file_get_contents($this->wordpress->getSiteUrl() . '?testXSendFile');
179 174 $this->fileHandler->removeXSendFileTestFile();
180 175
181 176 return ($content === 'success');
182 177 }
183 178
184 - private function configureXSendFileOption(Form $form): void
179 + private function disableXSendFileOption(Form $form): void
185 180 {
186 181 $formElements = $form->getElements();
187 182
188 - if (isset($formElements['download_type']) === false) {
189 - return;
190 - }
183 + if (isset($formElements['download_type']) === true) {
184 + /** @var ValueSetFormElement $downloadType */
185 + $downloadType = $formElements['download_type'];
186 + $possibleValues = $downloadType->getPossibleValues();
191 187
192 - /** @var ValueSetFormElement $downloadType */
193 - $downloadType = $formElements['download_type'];
194 - $possibleValues = $downloadType->getPossibleValues();
195 -
196 - if (isset($possibleValues['xsendfile']) === false) {
197 - return;
188 + if (isset($possibleValues['xsendfile']) === true) {
189 + $possibleValues['xsendfile']->markDisabled();
190 + }
198 191 }
199 -
200 - if ($this->wordpress->isNginx() === true) {
201 - // X-Accel-Redirect is always available on nginx — just relabel the option.
202 - $possibleValues['xsendfile']->setLabel(TXT_UAM_DOWNLOAD_TYPE_XACCELREDIRECT);
203 - } elseif ($this->isXSendFileAvailable() === false) {
204 - $possibleValues['xsendfile']->markDisabled();
205 - }
206 192 }
207 193
208 194 private function addLockFileTypes(array $configParameters, array &$parameters): void
209 195 {
210 - if (isset($configParameters['lock_file_types']) === true) {
196 + if (isset($configParameters['lock_file_types']) === true
197 + && $this->wordpress->isNginx() === false
198 + ) {
211 199 $parameters['lock_file_types'] = [
212 200 'selected' => 'locked_file_types',
213 201 'not_selected' => 'not_locked_file_types'
214 202 ];
215 203
216 - if ($this->wordpress->isNginx() === false
217 - && $this->wordpress->gotModRewrite() === false
218 - ) {
204 + if ($this->wordpress->gotModRewrite() === false) {
219 205 $parameters[] = 'file_pass_type';
220 206 }
221 207 }
222 208 }
@@ -250,9 +236,11 @@
250 236 $this->addLockFileTypes($configParameters, $parameters);
251 237
252 238 $form = $this->formHelper->getSettingsForm($parameters);
253 239
254 - $this->configureXSendFileOption($form);
240 + if ($this->isXSendFileAvailable() === false) {
241 + $this->disableXSendFileOption($form);
242 + }
255 243
256 244 return $form;
257 245 }
258 246
@@ -314,10 +302,9 @@
314 302 if (isset($configParameters['redirect'])) {
315 303 $values = [
316 304 $this->formFactory->createMultipleFormElementValue('false', TXT_UAM_NO),
317 305 $this->formFactory->createMultipleFormElementValue('blog', TXT_UAM_REDIRECT_TO_BLOG),
318 - $this->formFactory->createMultipleFormElementValue('login', TXT_UAM_REDIRECT_TO_LOGIN),
319 - $this->formFactory->createMultipleFormElementValue('origin', TXT_UAM_REDIRECT_TO_ORIGIN)
306 + $this->formFactory->createMultipleFormElementValue('login', TXT_UAM_REDIRECT_TO_LOGIN)
320 307 ];
321 308
322 309 $this->addCustomPageRedirectFormElement($configParameters, $values);
323 310
@@ -346,9 +333,8 @@
346 333 $parameters = [
347 334 'lock_recursive',
348 335 'protect_feed',
349 336 $redirect,
350 - 'append_redirect_to_parameter',
351 337 'blog_admin_hint',
352 338 'blog_admin_hint_text',
353 339 'show_assigned_groups',
354 340 'hide_edit_link_on_no_access',