<?php
if (file_exists("includes/toolcheck.php")) {
	require("includes/toolcheck.php");
} else {
	require("../includes/toolcheck.php");
}
?>
<table width="980" height="20" border="0" align="center" valign="top" cellpadding="0" cellspacing="0" style="border-left: 1px solid #DDDDDD; border-right: 1px solid #DDDDDD; text-align: left;">
  <tr bgcolor="#FFFFFF">
    <td width="15" height="20">&nbsp;</td>
    <td height="20" colspan="4">
    <?php
	$i = 0;
	$xml = simplexml_load_file($_SESSION["cspsrv_protocol"]."://".$_SESSION["cspsrv_user"].":".$_SESSION["cspsrv_pass"]."@".$_SESSION["cspsrv_ip"].":".$_SESSION["cspsrv_port"]."/xmlHandler?command=ca-profiles");
	$caprofiles = "ca-profiles";
	?>
    <form name="imcspprofiles" action="tools.php" method="post">
    <fieldset>
	<legend>Importasao de perfil do csp</legend>
    <table width="100%" valign="top">
    <td width="70%" valign="top">
    <table width="100%" valign="top">
    <td width="40%" valign="top">
    <?php
    foreach($xml->$caprofiles->profile as $profile) {
		if ((string)$xml->$caprofiles->profile[$i]->attributes()->name <> "*") {
			print("CSP value:<br><input type=\"text\" name=\"cspvalue[]\" size=\"20\" tabindex=\"2\" value=\"".(string)$xml->$caprofiles->profile[$i]->attributes()->name."\" disabled=\"disabled\"><br><br>");
		}
		$i++;
	}
	$i = 0;
	?>
    </td>
    <td width="60%" valign="top">
    <?php
    foreach($xml->$caprofiles->profile as $profile) {
		if ((string)$xml->$caprofiles->profile[$i]->attributes()->name <> "*") {
			print("Profile name:<br><input type=\"text\" name=\"profilename[]\" size=\"20\" tabindex=\"1\" value=\"".(string)$xml->$caprofiles->profile[$i]->attributes()->name."\"><br><br>");
		}
		$i++;
	}
	?>
    </td>
    </table>
    <input type="submit" name="bimcspprof" value="Import" id="submit" tabindex="3">
    </td>
    <td width="30%" valign="top">Here you can import all your profiles from your CSP server directly into C.M.U.M.<br><br><strong>CSP value:</strong><br>The profile name in the csp config.<br><br><strong>Profile name:</strong><br>The name C.M.U.M. will use for the profile.</td>
    </table>
    </fieldset>
    </form>
    </td>
    <td width="15" height="20">&nbsp;</td>
  </tr>
</table>
