Skip to content

Commit a492d57

Browse files
committed
Remove upload-button if uploads are disabled at PHP-level
1 parent f1a2e81 commit a492d57

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

modules/admin/src/Controller/Federation.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
use function array_pop;
2323
use function array_values;
2424
use function count;
25+
use function boolval;
2526
use function file_get_contents;
27+
use function ini_get;
2628
use function is_array;
2729
use function sprintf;
2830
use function str_replace;
@@ -243,7 +245,7 @@ private function getHostedIdP(): array
243245
);
244246
$entities[$index] = $entity;
245247
}
246-
} catch (\Exception $e) {
248+
} catch (Exception $e) {
247249
Logger::error('Federation: Error loading saml20-idp: ' . $e->getMessage());
248250
}
249251
}
@@ -300,7 +302,7 @@ private function getHostedIdP(): array
300302
);
301303
$entities[$index] = $entity;
302304
}
303-
} catch (\Exception $e) {
305+
} catch (Exception $e) {
304306
Logger::error('Federation: Error loading adfs-idp: ' . $e->getMessage());
305307
}
306308
}
@@ -477,6 +479,7 @@ public function metadataConverter(Request $request): Response
477479
'xmldata' => $xmldata,
478480
'output' => $output,
479481
'error' => $error,
482+
'upload' => boolval(ini_get('file_upload')),
480483
];
481484

482485
$this->menu->addOption('logout', $t->data['logouturl'], Translate::noop('Log out'));

modules/admin/templates/metadata_converter.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
</div>
1515
<br>
1616
<div class="center">
17+
{% if upload %}
1718
<div class="pure-button-group two-elements" role="group">
1819
<label class="pure-button">
1920
<span class="fa fa-folder-open"></span>{{ 'or select a file:'|trans }}
@@ -22,6 +23,7 @@
2223
<label id="show-file" class="pure-button hollow show-files" disabled>{{ 'No file selected.'|trans }}</label>
2324
</div>
2425
<br>
26+
{% endif %}
2527
<button class="pure-button pure-button-red pure-input-1-3">{{ 'Parse'|trans }}</button>
2628
</div>
2729
</form>

0 commit comments

Comments
 (0)