1
0
Fork 0
mirror of https://github.com/24eme/signaturepdf synced 2024-05-21 23:26:38 +02:00

Add method to check if GPG is installed and a way to handle it's absence

This commit is contained in:
Tanguy Le Faucheur 2023-11-23 11:19:38 +01:00
parent a5a286b1c8
commit 7c0c5ffbfe
2 changed files with 17 additions and 1 deletions

View file

@ -83,7 +83,11 @@ $f3->route('GET /signature',
}
if (!$f3->exists('PDF_STORAGE_ENCRYPTION')) {
$f3->set('PDF_STORAGE_ENCRYPTION', '');
if (CryptographyClass::isGpgInstalled() == true) {
$f3->set('PDF_STORAGE_ENCRYPTION', 'true');
} else {
$f3->set('PDF_STORAGE_ENCRYPTION', '');
}
}
$f3->set('activeTab', 'sign');

View file

@ -74,5 +74,17 @@ class CryptographyClass
return implode('', $pieces);
}
public static function isGpgInstalled() {
$output = null;
$returnCode = null;
exec('gpg --version', $output, $returnCode);
if ($returnCode == 0) {
return true;
}
return false;
}
}
?>