mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-24 09:09:22 +00:00
Backport Security Patches for Samples
This commit is contained in:
@@ -85,6 +85,8 @@ if (isset($_POST['submit'])) {
|
||||
$helper->log('The Sample Number Value must be numeric');
|
||||
} elseif (!is_numeric($_POST['decimals']) || str_contains((string) $_POST['decimals'], '.') || (int) $_POST['decimals'] < 0) {
|
||||
$helper->log('The Decimal Places value must be positive integer');
|
||||
} elseif (!in_array($_POST['currency'], array_keys($currencies), true)) {
|
||||
$helper->log('Unrecognized currency symbol');
|
||||
} else {
|
||||
try {
|
||||
$wizard = new Wizard\Currency($_POST['currency'], (int) $_POST['decimals'], isset($_POST['thousands']), (bool) $_POST['position'], (bool) $_POST['spacing']);
|
||||
@@ -93,13 +95,14 @@ if (isset($_POST['submit'])) {
|
||||
$helper->log('<hr /><b>Code:</b><br />');
|
||||
$helper->log('use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard;');
|
||||
$helper->log(
|
||||
"\$mask = Wizard\\Currency('{$_POST['currency']}', {$_POST['decimals']}, Wizard\\Number::"
|
||||
"\$wizard = new Wizard\\Currency('{$_POST['currency']}', {$_POST['decimals']}, Wizard\\Number::"
|
||||
. (isset($_POST['thousands']) ? 'WITH_THOUSANDS_SEPARATOR' : 'WITHOUT_THOUSANDS_SEPARATOR')
|
||||
. ', Wizard\Currency::' . (((bool) $_POST['position']) ? 'LEADING_SYMBOL' : 'TRAILING_SYMBOL')
|
||||
. ', Wizard\Currency::' . (((bool) $_POST['spacing']) ? 'SYMBOL_WITH_SPACING' : 'SYMBOL_WITHOUT_SPACING')
|
||||
. ');<br />'
|
||||
. ');'
|
||||
);
|
||||
$helper->log('echo (string) $mask;');
|
||||
$helper->log('$mask = $wizard->format();');
|
||||
$helper->log('<br />echo (string) $mask;');
|
||||
$helper->log('<hr /><b>Mask:</b><br />');
|
||||
$helper->log($mask . '<br />');
|
||||
$helper->log('<br /><b>Example:</b><br />');
|
||||
|
||||
Reference in New Issue
Block a user