コード例 #1
0
ファイル: index.php プロジェクト: Esleelkartea/legedia-ESLE
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";
}
コード例 #2
0
    echo str_replace("\n", '<br />', str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", 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)) {
            unlink($dir);
        }
        file_put_contents($dir, utf8_decode($res));
        $date = substr(date('dmY'), 4, 4) . '-' . substr(date('dmY'), 2, 2) . '-' . substr(date('dmY'), 0, 2);
        $time = substr(date('His'), 0, 2) . ':' . substr(date('His'), 2, 2) . ':' . substr(date('His'), 4, 2);
        echo __('<strong>Resultado</strong> (fichero creado el %%fecha%% a las %%hora%%): %%dir%%', array('%%dir%%' => link_to($dir, $_SERVER["PHP_SELF"], array('id' => 'log2', 'class' => 'log')), '%%fecha%%' => format_date($date, "D", 'es'), '%%hora%%' => format_date($time, "t", 'es')), 'messages');
    } else {
        echo '<u id="log2" style="color: black; cursor: pointer" class="log">' . __('Resultado') . '</u>';
    }
    ?>
            </label>