diff --git a/Dockerfile b/Dockerfile index 9250b43..6644508 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ ENV UPLOAD_MAX_FILESIZE=24M ENV POST_MAX_SIZE=24M ENV MAX_FILE_UPLOADS=201 ENV PDF_STORAGE_PATH= +ENV DISABLE_ORGANIZATION=false RUN apt update && \ apt install -y gettext-base librsvg2-bin pdftk imagemagick potrace && \ diff --git a/README.md b/README.md index 932d3c4..a4eb5d9 100644 --- a/README.md +++ b/README.md @@ -96,10 +96,11 @@ Les variables suivantes permettent de configurer le déployement : |`POST_MAX_SIZE`|Taille maximum du fichier PDF à signer|48M|24M| |`MAX_FILE_UPLOADS`|Nombre de pages maximum du PDF, ici 200 pages + le PDF d'origine|401|201| |`PDF_STORAGE_PATH`|chemin vers lequel les fichiers pdf uploadés pourront être stockés|/data|| +|`DISABLE_ORGANIZATION`|Desactiver la route Organiser|true|false| ```bash docker run -d --name=signaturepdf -p 8080:80 -e SERVERNAME=pdf.example.org -e UPLOAD_MAX_FILESIZE=48M -e POST_MAX_SIZE=48M -e MAX_FILE_UPLOADS=401 -e PDF_STORAGE_PATH=/data signaturepdf -```` +``` ### Alpine @@ -237,6 +238,11 @@ Par exemple pour apache : chown www-data /path/to/folder/to/store/pdf ``` +### Desactivation du mode Organiser + +Pour desactiver le mode Organiser, ajouter `DISABLE_ORGANIZATION=true` dans le fichier +`config/config.ini`. + ## Mise à jour La dernière version stable est sur la branche `master`, pour la mise à jour il suffit de récupérer les dernières modifications : diff --git a/app.php b/app.php index 18cc252..2e9f7f9 100644 --- a/app.php +++ b/app.php @@ -16,6 +16,11 @@ if($f3->get('PDF_STORAGE_PATH') && !preg_match('|/$|', $f3->get('PDF_STORAGE_PAT $f3->set('PDF_STORAGE_PATH', $f3->get('PDF_STORAGE_PATH').'/'); } +$f3->set('disableOrganization', false); +if($f3->get('DISABLE_ORGANIZATION')) { + $f3->set('disableOrganization', $f3->get('DISABLE_ORGANIZATION')); +} + $f3->route('GET /', function($f3) { $f3->reroute('/signature'); @@ -294,6 +299,7 @@ $f3->route('GET /cron', function($f3) { } }); +if (!$f3->get('disableOrganization')) { $f3->route('GET /organization', function($f3) { $f3->set('maxSize', min(array(convertPHPSizeToBytes(ini_get('post_max_size')), convertPHPSizeToBytes(ini_get('upload_max_filesize'))))); @@ -319,7 +325,7 @@ $f3->route('POST /organize', $filenames[] = str_replace('.pdf', '', $fileBaseName); return basename($tmpfile).uniqid().".pdf"; - }); + }); if(!count($files)) { $f3->error(403); @@ -341,6 +347,7 @@ $f3->route('POST /organize', array_map('unlink', glob($tmpfile."*")); } ); +} function convertPHPSizeToBytes($sSize) { diff --git a/config/config.ini.example b/config/config.ini.example index f427cfb..0058a92 100644 --- a/config/config.ini.example +++ b/config/config.ini.example @@ -2,4 +2,5 @@ # 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 -PDF_STORAGE_PATH=/path/to/folder \ No newline at end of file +PDF_STORAGE_PATH=/path/to/folder +DISABLE_ORGANIZATION=false diff --git a/config/config.ini.tpl b/config/config.ini.tpl index a4e92e8..158ca36 100644 --- a/config/config.ini.tpl +++ b/config/config.ini.tpl @@ -3,3 +3,4 @@ # 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 PDF_STORAGE_PATH=${PDF_STORAGE_PATH} +DISABLE_ORGANIZATION=${DISABLE_ORGANIZATION} diff --git a/templates/signature.html.php b/templates/signature.html.php index a92ba8b..0107509 100644 --- a/templates/signature.html.php +++ b/templates/signature.html.php @@ -17,6 +17,7 @@
+ +

Signer un PDF

Signer, parapher, tamponner, compléter un document