From b713db3b9201c47a3898b568e914fe2db1b8ed5c Mon Sep 17 00:00:00 2001 From: tale-fau Date: Tue, 30 Jul 2024 18:26:12 +0200 Subject: [PATCH] Add lock sign to inform users that the PDF is encrypted --- app.php | 2 +- lib/cryptography.class.php | 6 +++++- templates/signature.html.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app.php b/app.php index 004320b..3f6066b 100644 --- a/app.php +++ b/app.php @@ -108,7 +108,7 @@ function($f3) { if(!is_dir($f3->get('PDF_STORAGE_PATH').$f3->get('hash'))) { $f3->error(404); } - + $f3->set('isPdfEncrypted', CryptographyClass::isPathEncrypted($f3->get('PDF_STORAGE_PATH').$f3->get('hash'))); $f3->set('activeTab', 'sign'); echo View::instance()->render('signature.html.php'); } diff --git a/lib/cryptography.class.php b/lib/cryptography.class.php index 7c9a02a..3fb8720 100644 --- a/lib/cryptography.class.php +++ b/lib/cryptography.class.php @@ -61,7 +61,11 @@ public function decrypt() { } public function isEncrypted() { - return file_exists($this->pathHash."/filename.txt.gpg"); + return self::isPathEncrypted($this->pathHash); + } + + public static function isPathEncrypted($pathHash) { + return file_exists($pathHash."/filename.txt.gpg"); } public static function hardUnlink($element) { diff --git a/templates/signature.html.php b/templates/signature.html.php index 4a7982e..224e8cc 100644 --- a/templates/signature.html.php +++ b/templates/signature.html.php @@ -58,7 +58,7 @@
-

+

">