fix utf8 for local metadata (pfsense use iso8859-1)

This commit is contained in:
Thomas NOËL 2014-10-29 13:06:55 +01:00
parent 5db56e351e
commit a663852e74
1 changed files with 17 additions and 7 deletions

View File

@ -162,7 +162,7 @@ if ($_POST) {
$federation['codename'] = $pconfig['codename'];
$federation['descr'] = $pconfig['descr'];
$federation['url'] = $pconfig['url'];
$federation['metadata'] = base64_encode(trim($pconfig['metadata']));
$federation['metadata'] = base64_encode(utf8_encode(trim($pconfig['metadata'])));
$federation['certref'] = $pconfig['certref'];
if ($_POST['enable'])
@ -259,13 +259,18 @@ include("head.inc");
<td width="22%" valign="top" class="vncellreq"><?=gettext("Metadata URL");?></td>
<td width="78%" class="vtable">
<input name="url" type="text" class="formfld url" id="url" size="65" value="<?=htmlspecialchars($pconfig['url']);?>" placeholder="https://..." />
<br/><?=gettext("or");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Metadata file content");?></td>
<td width="22%" valign="top" class="vncellreq"></td>
<td width="78%" class="vtable"><?=gettext("or");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Local metadata (xml)");?></td>
<td width="78%" class="vtable">
<textarea name="metadata" class="formpre" cols="75" rows="20"><?=htmlspecialchars($pconfig['metadata']);?></textarea>
<textarea name="metadata" class="formpre" cols="65" rows="5" placeholder="<EntitiesDescriptor> ... </EntitiesDescriptor>"><?=htmlspecialchars(utf8_decode($pconfig['metadata']));?></textarea><br />
If metadata are defined here, it disables the download URL above.
</td>
</tr>
<tr>
@ -314,7 +319,7 @@ include("head.inc");
<td width="10%" class="listhdrr"><?=gettext("Active");?></td>
<td width="15%" class="listhdrr"><?=gettext("Codename");?></td>
<td width="20%" class="listhdrr"><?=gettext("Description");?></td>
<td width="50%" class="listhdrr"><?=gettext("URL");?></td>
<td width="50%" class="listhdrr"><?=gettext("URL or local metadata");?></td>
</tr>
<?php
$i = 0;
@ -322,7 +327,7 @@ include("head.inc");
$name = htmlspecialchars($federation['codename']);
$descr = htmlspecialchars($federation['descr']);
$url = htmlspecialchars($federation['url']);
$metadata = htmlspecialchars(utf8_decode(base64_decode($federation['metadata'])));
?>
<tr>
<td class="listlr"><?php
@ -330,7 +335,12 @@ include("head.inc");
?></td>
<td class="listr"><?=$name;?></td>
<td class="listr"><em><?=$descr;?></em></td>
<td class="listr"><?=$url;?>&nbsp;</td>
<td class="listr"><?php
if ($metadata)
echo '<em>local metadata:</em> ' . substr($metadata,0,40) . ' ...';
else
echo $url;
?>&nbsp;</td>
<td valign="middle" nowrap class="list">
<a href="services_captiveportal_saml_federation.php?act=edit&amp;id=<?=$i;?>">
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit");?>" alt="<?=gettext("edit");?>" width="17" height="17" border="0" />