OC::$CLASSPATH['OCA\Encryption\Capabilities'] = 'files_encryption/lib/capabilities.php';
OC::$CLASSPATH['OCA\Encryption\Helper'] = 'files_encryption/lib/helper.php';
-if(!OC_Config::getValue('maintenance', false)) {
+if (!OC_Config::getValue('maintenance', false)) {
OC_FileProxy::register(new OCA\Encryption\Proxy());
// User related hooks
stream_wrapper_register('crypt', 'OCA\Encryption\Stream');
-// check if we are logged in
-if (OCP\User::isLoggedIn()) {
+ // check if we are logged in
+ if (OCP\User::isLoggedIn()) {
- // ensure filesystem is loaded
- if(!\OC\Files\Filesystem::$loaded) {
- \OC_Util::setupFS();
- }
+ // ensure filesystem is loaded
+ if (!\OC\Files\Filesystem::$loaded) {
+ \OC_Util::setupFS();
+ }
- $view = new OC_FilesystemView('/');
+ $view = new OC_FilesystemView('/');
+
+ $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'
- ) {
+ $user = \OCP\USER::getUser();
+ // check if user has a private key
+ 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
// (happens when a user is logged in before the encryption app is
* @note This method should never be called for users using client side encryption\r
*/\r
public static function login($params) {\r
-\r
- // Manually initialise Filesystem{} singleton with correct \r
- // fake root path, in order to avoid fatal webdav errors\r
- // NOTE: disabled because this give errors on webdav!\r
- //\OC\Files\Filesystem::init( $params['uid'], '/' . 'files' . '/' );\r
+ $l = new \OC_L10N('files_encryption');\r
+ //check if openssl is available\r
+ if(!extension_loaded("openssl") ) {\r
+ $error_msg = $l->t("PHP module OpenSSL is not installed.");\r
+ $hint = $l->t('Please ask your server administrator to install the module. For now the encryption app was disabled.');\r
+ \OC_App::disable('files_encryption');\r
+ \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);\r
+ \OCP\Template::printErrorPage($error_msg, $hint);\r
+ }\r
\r
$view = new \OC_FilesystemView('/');\r
\r