Ejemplo n.º 1
0
<?php

require_once '../../../php/EPCharacterCreator.php';
require_once '../../../php/EPFileUtility.php';
session_start();
$filename = $_POST["saveName"];
$file_util = new EPFileUtility($_SESSION['cc']->character);
$filename = $file_util->sanitizeFilename($filename);
// append .json extension if it is missing
if ('.json' !== substr($filename, -5, 5)) {
    $filename .= '.json';
}
header('Content-Type: application/json');
header('Content-Disposition: attachment; filename="' . $filename . '"');
echo json_encode($_SESSION['cc']->getSavePack());
Ejemplo n.º 2
0
<?php

require_once '../../../php/EPCharacterCreator.php';
require_once '../../../php/EPFileUtility.php';
session_start();
$file_util = new EPFileUtility($_SESSION['cc']->character);
$save_name = $file_util->buildExportFilename('EPCharacterSave', 'json');
?>
	<table id="table_save" align="center">
		<tr align="center">
			<td>
				<h1><b><u> Save character </u></b></h1>
			</td>
		</tr>
		
		<tr align="center">
			<td>
				Enter a file name
				<br><br>
				<form action="other/save.php" id="saveForm" method="POST" enctype="multipart/form-data">
					<input style="line-height: 1em;" id="saveName" name="saveName" type="text" value="<?php 
echo $save_name;
?>
">
				</form>
				<br><br>
			</td>
		</tr>
		
		
		
            $pdf->Text($apt_x, $apt_y, formatIt($bm->name));
            //bm name
            $pdf->SetFont('Lato-Lig', '', $fontsizetxt);
            $bmdescs = formatItForRect($bm->description, $rectlength);
            $paddle = 0;
            foreach ($bmdescs as $line) {
                $pdf->Text($apt_x + 46, $apt_y + $paddle, formatIt($line));
                //Bm desc
                $paddle += $paddleIncrement;
            }
            $apt_y += $y_space + $paddle;
            $pdf->SetFont('Lato-Lig', '', $fontsize);
        }
    }
    //===================
    $file_util = new EPFileUtility($_SESSION['cc']->character);
    $filename = $file_util->buildExportFilename('EPCharacter', 'pdf');
    $pdf->Output($filename, 'D');
} else {
    header("Status: 500 Internal Server Error", true, 500);
    echo "Bad news, something went wrong, we can not print your character, verify your character and try again.";
    die;
}
//HELPERS ===============================================================
function formatIt($string)
{
    $res = $string;
    if ($res == null) {
        $res = " ";
    }
    $res = strtoupper($res);