<?php
include '../autoload.php';

error_log ( "JasperParser...");

$jrxmlFolder = $_POST['folder'] ?? '';
if($jrxmlFolder != '')
{
	$jrxmlFolder  = $GLOBALS["JASPER_TEMPLATES_FOLDER"].'/'.$jrxmlFolder;
}

$jarFile = $GLOBALS["JASPER_APP_FOLDER"] . "/eoJasperParser.jar";

$output = shell_exec($GLOBALS["JAVA_EXE"].' -jar "'.$jarFile.'" "'.$jrxmlFolder.'" 2>&1');

$output = mb_convert_encoding($output, 'UTF-8', 'auto');

// error_log ( " output : " .$output );

header('Content-Type: text/html; charset=UTF-8');
echo $output;
