1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

Storage path of the pdf in config and disabled in the interface if not defined

This commit is contained in:
Vincent LAURENT 2022-04-01 17:34:35 +02:00
parent 35c31d3d8b
commit b57bad56e2
4 changed files with 18 additions and 2 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ package-lock.json
package.json
node_modules
tests/downloads/
config/config.ini

10
app.php
View File

@ -10,7 +10,12 @@ $f3->set('XFRAME', null); // Allow use in an iframe
$f3->set('ROOT', __DIR__);
$f3->set('UI', $f3->get('ROOT')."/templates/");
$f3->set('UPLOADS', sys_get_temp_dir()."/");
$f3->set('STORAGE', sys_get_temp_dir()."/pdf/");
$f3->config(__DIR__.'/config/config.ini');
if($f3->get('STORAGE') && !preg_match('|/$|', $f3->get('STORAGE'))) {
$f3->set('STORAGE', $f3->get('STORAGE').'/');
}
function convertPHPSizeToBytes($sSize)
{
@ -50,6 +55,9 @@ $f3->route('GET /signature',
$f3->set('maxSize', min(array(convertPHPSizeToBytes(ini_get('post_max_size')), convertPHPSizeToBytes(ini_get('upload_max_filesize')))));
$f3->set('maxPage', ini_get('max_file_uploads') - 1);
if(!$f3->get('STORAGE')) {
$f3->set('noSharingMode', true);
}
echo View::instance()->render('signature.html.php');
}
);

View File

@ -0,0 +1,5 @@
[globals]
# Path to which stored pdf to activate the mode of sharing a signature to several.
# To deactivate this mode, simply do not configure it or leave it empty
STORAGE=/path/to/folder

View File

@ -78,6 +78,7 @@
</div>
<div id="form_block" class="position-absolute bottom-0 pb-2 ps-0 pe-4 w-100 d-none d-sm-none d-md-block">
<?php if(!isset($hash)): ?>
<?php if(!isset($noSharingMode)): ?>
<form id="form_sharing" action="/share" method="post" enctype="multipart/form-data">
<input id="input_pdf_share" name="pdf" type="file" class="d-none" />
<input id="input_svg_share" name="svg[]" type="file" class="d-none" />
@ -85,12 +86,13 @@
<button class="btn btn-outline-dark w-100" type="submit" id="save_share"><i class="bi bi-share"></i> Partager pour signer <i class="bi bi-people-fill"></i> à plusieurs </button>
</div>
</form>
<?php endif; ?>
<form id="form_pdf" action="/sign" method="post" enctype="multipart/form-data">
<input id="input_pdf" name="pdf" type="file" class="d-none" />
<input id="input_svg" name="svg[]" type="file" class="d-none" />
<button class="btn btn-primary w-100 mt-2" disabled="disabled" type="submit" id="save"><i class="bi bi-download"></i> Télécharger le PDF signé</button>
</form>
<?php else: ?>
<?php elseif(!isset($noSharingMode)): ?>
<p id="nblayers_text" class="small d-none mb-2 opacity-50">Vous êtes <span class="badge rounded-pill bg-dark text-white"><span class="nblayers">0</span> <i class="bi bi-people-fill"></i></span> à avoir signé ce PDF</p>
<div class="btn-group w-100 mb-1">
<a id="btn_download" class="btn btn-outline-dark w-100" href="/signature/<?php echo $hash ?>/pdf"><i class="bi bi-download"></i> Télécharger le PDF</a>