function signDocument() { global $src_file, $target_file, $user_cert_file_path; // replace signature value with the signature made by card $src = file_get_contents($target_file); $src = preg_replace('/<ds:SignatureValue>[^<]*<\\/ds:SignatureValue>/i', '<ds:SignatureValue>' . $_POST['sinatuta'] . '</ds:SignatureValue>', $src); file_put_contents($target_file, $src); // send to service require_once 'xmlResponseProba.class.php'; $xml = file_get_contents($target_file); $encodedXml = xmlResponse::encodeXML($xml); $aa = xmlResponse::probarXML($encodedXml); echo xmlResponse::decodeXML($aa['res']); echo "END"; }
echo '</script><br />'; return true; } } ?> <fieldset> <label style="float:none; text-align:center; font-size: 12px" class="form1"><?php echo __('El fichero de %%tipo%% (creado el %%fecha%% a las %%hora%%) ha sido <strong>enviado</strong>: %%dir%%', array('%%tipo%%' => strtolower($notificacion->tipo), '%%dir%%' => link_to($dir, $_SERVER["PHP_SELF"], array('id' => 'log1', 'class' => 'log')), '%%fecha%%' => format_date($date, "D", 'es'), '%%hora%%' => format_date($time, "t", 'es')), 'messages'); ?> </label> <div id="div_log1" style="clear:both; height: 300px; overflow: auto; border: 1px solid silver; padding: 5px; margin: 5px;"><?php echo str_replace("\n", '<br />', str_replace("\t", " ", htmlentities(file_get_contents($dir)))); ?> </div> </fieldset><?php $encodedXml = xmlResponse::encodeXML($xml); $rEncodedXml = xmlResponse::probarXML($encodedXml); $res = ''; ?> <fieldset> <label style="float:none; text-align:center; font-size: 12px" class="form1"><?php if ($rEncodedXml['result'] != 'ok') { echo '<strong>' . $rEncodedXml['result'] . '</strong><br /><br />'; echo '<u>' . __('Mensaje') . '</u>:<br />' . $rEncodedXml['message'] . '<br /><br />'; } else { $res .= xmlResponse::decodeXML($rEncodedXml['res']); } if (strpos($res, '<est_err>00</est_err>') !== false) { $dir = sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . $id_fichero . '-' . $id_notificacion . '-result.xml'; if (is_file($dir)) {