Skip to content
Snippets Groups Projects
Commit 6c841e30 authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

Merge pull request #210 from thijskh/metaconvert-fileupload

Support file uploads in metadata converter.
parents ddedd9e7 29635688
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,9 @@
"metaconv_title": {
"en": "Metadata parser"
},
"metaconv_selectfile": {
"en": "or select a file:"
},
"metaconv_parse": {
"en": "Parse"
},
......
......@@ -7,12 +7,16 @@ $this->includeAtTemplateBase('includes/header.php');
<h2><?php echo $this->t('metaconv_title'); ?></h2>
<form action="?" method="post">
<form action="?" method="post" enctype="multipart/form-data">
<p><?php echo($this->t('{admin:metaconv_xmlmetadata}')); ?></p>
<p>
<textarea rows="20" cols="120" name="xmldata"><?php echo htmlspecialchars($this->data['xmldata']); ?></textarea>
</p>
<p>
<?php echo $this->t('metaconv_selectfile'); ?>
<input type="file" name="xmlfile" /></p>
<p>
<input type="submit" value="<?php echo $this->t('metaconv_parse'); ?>" />
</p>
......
......@@ -7,9 +7,13 @@ SimpleSAML\Utils\Auth::requireAdmin();
$config = SimpleSAML_Configuration::getInstance();
if(array_key_exists('xmldata', $_POST)) {
if ( !empty($_FILES['xmlfile']['tmp_name']) ) {
$xmldata = file_get_contents($_FILES['xmlfile']['tmp_name']);
} elseif ( array_key_exists('xmldata', $_POST) ) {
$xmldata = $_POST['xmldata'];
}
if ( !empty($xmldata) ) {
\SimpleSAML\Utils\XML::checkSAMLMessage($xmldata, 'saml-meta');
$entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsString($xmldata);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment