diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php index 419bef1ede..d97811bb79 100644 --- a/apps/files_encryption/appinfo/app.php +++ b/apps/files_encryption/appinfo/app.php @@ -33,13 +33,18 @@ if (!OC_Config::getValue('maintenance', false)) { } $view = new OC_FilesystemView('/'); - $session = new \OCA\Encryption\Session($view); + + $sessionReady = false; + if(extension_loaded("openssl")) { + $session = new \OCA\Encryption\Session($view); + $sessionReady = true; + } $user = \OCP\USER::getUser(); // check if user has a private key - if ( - !$view->file_exists('/' . $user . '/files_encryption/' . $user . '.private.key') - && OCA\Encryption\Crypt::mode() === 'server' + if ($sessionReady === false + || (!$view->file_exists('/' . $user . '/files_encryption/' . $user . '.private.key') + && OCA\Encryption\Crypt::mode() === 'server') ) { // Force the user to log-in again if the encryption key isn't unlocked diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 7698b95cfd..e39e068cc5 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -38,11 +38,15 @@ class Hooks { * @note This method should never be called for users using client side encryption */ public static function login($params) { - - // Manually initialise Filesystem{} singleton with correct - // fake root path, in order to avoid fatal webdav errors - // NOTE: disabled because this give errors on webdav! - //\OC\Files\Filesystem::init( $params['uid'], '/' . 'files' . '/' ); + $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.'); + \OC_App::disable('files_encryption'); + \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR); + \OCP\Template::printErrorPage($error_msg, $hint); + } $view = new \OC_FilesystemView('/');