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:
parent
a5a286b1c8
commit
7c0c5ffbfe
6
app.php
6
app.php
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue