summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorVicDeo <dubiniuk@owncloud.com>2013-07-04 06:53:17 -0700
committerVicDeo <dubiniuk@owncloud.com>2013-07-04 06:53:17 -0700
commitf67fc78531a0180d3c60edb849b29ac744bacbaa (patch)
treeff25a1be8acdbbde1a227afdd2e16c9e0efd0c2e /apps/files_encryption
parent63c83ff50bc8329d4fea4c09d724d7d944ddcb1d (diff)
parentf30dd1557eda78f81a7a9e40bea8ae5bee61d36d (diff)
downloadnextcloud-server-f67fc78531a0180d3c60edb849b29ac744bacbaa.tar.gz
nextcloud-server-f67fc78531a0180d3c60edb849b29ac744bacbaa.zip
Merge pull request #3899 from owncloud/encryption_check_php_version
check php version, the encryption app needs php >= 5.3.3
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/appinfo/app.php5
-rw-r--r--apps/files_encryption/files/error.php1
-rw-r--r--apps/files_encryption/hooks/hooks.php8
-rwxr-xr-xapps/files_encryption/lib/helper.php20
4 files changed, 24 insertions, 10 deletions
diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php
index ca3f2554e5e..90a9984e27f 100644
--- a/apps/files_encryption/appinfo/app.php
+++ b/apps/files_encryption/appinfo/app.php
@@ -37,10 +37,9 @@ if (!OC_Config::getValue('maintenance', false)) {
$view = new OC_FilesystemView('/');
- $sessionReady = false;
- if(extension_loaded("openssl")) {
+ $sessionReady = OCA\Encryption\Helper::checkRequirements();
+ if($sessionReady) {
$session = new \OCA\Encryption\Session($view);
- $sessionReady = true;
}
$user = \OCP\USER::getUser();
diff --git a/apps/files_encryption/files/error.php b/apps/files_encryption/files/error.php
index da65d8dcf35..f93c67d920a 100644
--- a/apps/files_encryption/files/error.php
+++ b/apps/files_encryption/files/error.php
@@ -21,4 +21,3 @@ if (!isset($_)) { //also provide standalone error page
exit;
}
-?>
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 09153918940..197982010f9 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -39,10 +39,10 @@ class Hooks {
*/
public static function login($params) {
$l = new \OC_L10N('files_encryption');
- //check if openssl is available
- if(!extension_loaded("openssl") ) {
- $error_msg = $l->t("PHP module OpenSSL is not installed.");
- $hint = $l->t('Please ask your server administrator to install the module. For now the encryption app was disabled.');
+ //check if all requirements are met
+ if(!Helper::checkRequirements() ) {
+ $error_msg = $l->t("Missing requirements.");
+ $hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that the OpenSSL PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
\OC_App::disable('files_encryption');
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
\OCP\Template::printErrorPage($error_msg, $hint);
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index 0d30dd8e7b5..31cf48a0393 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -132,7 +132,7 @@ class Helper {
$view->file_put_contents('/public-keys/' . $recoveryKeyId . '.public.key', $keypair['publicKey']);
- // Encrypt private key empthy passphrase
+ // Encrypt private key empty passphrase
$encryptedPrivateKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($keypair['privateKey'], $recoveryPassword);
// Save private key
@@ -217,4 +217,20 @@ class Helper {
header('Location: ' . $location . '?p=' . $post);
exit();
}
-} \ No newline at end of file
+
+
+ /**
+ * check requirements for encryption app.
+ * @return bool true if requirements are met
+ */
+ public static function checkRequirements() {
+ $result = true;
+
+ //openssl extension needs to be loaded
+ $result &= extension_loaded("openssl");
+ // we need php >= 5.3.3
+ $result &= version_compare(phpversion(), '5.3.3', '>=');
+
+ return (bool) $result;
+ }
+}