Skip to content

Commit

Permalink
Add lock sign to inform users that the PDF is encrypted
Browse files Browse the repository at this point in the history
  • Loading branch information
tale-fau committed Jul 30, 2024
1 parent 4f8bec9 commit b713db3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
6 changes: 5 additions & 1 deletion lib/cryptography.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion templates/signature.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<button type="button" class="btn-close text-reset d-md-none" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body pt-0">
<p id="text_document_name" class="text-muted" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;" title=""><i class="bi bi-files"></i> <span></span></p>
<p id="text_document_name" class="text-muted" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;" title=""><?php if (isset($isPdfEncrypted) && $isPdfEncrypted): ?><i class="bi bi-lock-fill" title="<?php echo _("This PDF is stored encrypted on the server."); ?>"></i><?php endif;?><i class="bi bi-files"></i> <span></span></p>
<div class="form-check form-switch mb-2 small d-none">
<input class="form-check-input" type="checkbox" id="add-lock-checkbox" disabled="disabled">
<label style="cursor: pointer;" class="form-check-label" for="add-lock-checkbox"> <?php echo _("Keep the selection active"); ?></label>
Expand Down

0 comments on commit b713db3

Please sign in to comment.