server/apps/files_encryption/appinfo/app.php

71 lines
2.2 KiB
PHP
Raw Normal View History

2011-10-21 15:02:11 +00:00
<?php
OC::$CLASSPATH['OCA\Encryption\Crypt'] = 'files_encryption/lib/crypt.php';
OC::$CLASSPATH['OCA\Encryption\Hooks'] = 'files_encryption/hooks/hooks.php';
OC::$CLASSPATH['OCA\Encryption\Util'] = 'files_encryption/lib/util.php';
OC::$CLASSPATH['OCA\Encryption\Keymanager'] = 'files_encryption/lib/keymanager.php';
OC::$CLASSPATH['OCA\Encryption\Stream'] = 'files_encryption/lib/stream.php';
OC::$CLASSPATH['OCA\Encryption\Proxy'] = 'files_encryption/lib/proxy.php';
OC::$CLASSPATH['OCA\Encryption\Session'] = 'files_encryption/lib/session.php';
2013-03-09 00:04:33 +00:00
OC::$CLASSPATH['OCA\Encryption\Capabilities'] = 'files_encryption/lib/capabilities.php';
OC::$CLASSPATH['OCA\Encryption\Helper'] = 'files_encryption/lib/helper.php';
2011-10-21 15:02:11 +00:00
if (!OC_Config::getValue('maintenance', false)) {
OC_FileProxy::register(new OCA\Encryption\Proxy());
2011-10-21 15:02:11 +00:00
// User related hooks
OCA\Encryption\Helper::registerUserHooks();
2011-10-21 15:02:11 +00:00
// Sharing related hooks
OCA\Encryption\Helper::registerShareHooks();
// Filesystem related hooks
OCA\Encryption\Helper::registerFilesystemHooks();
2013-04-27 18:18:05 +00:00
// App manager related hooks
OCA\Encryption\Helper::registerAppHooks();
stream_wrapper_register('crypt', 'OCA\Encryption\Stream');
// check if we are logged in
if (OCP\User::isLoggedIn()) {
// ensure filesystem is loaded
if (!\OC\Files\Filesystem::$loaded) {
\OC_Util::setupFS();
}
$view = new OC_FilesystemView('/');
$sessionReady = OCA\Encryption\Helper::checkRequirements();
if($sessionReady) {
$session = new \OCA\Encryption\Session($view);
}
2013-05-15 12:32:50 +00:00
$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')
) {
2013-05-15 12:32:50 +00:00
// 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
// enabled)
OCP\User::logout();
2013-05-15 12:32:50 +00:00
header("Location: " . OC::$WEBROOT . '/');
2013-05-15 12:32:50 +00:00
exit();
}
2013-05-15 12:32:50 +00:00
}
} else {
// logout user if we are in maintenance to force re-login
OCP\User::logout();
2013-05-15 12:32:50 +00:00
}
2013-02-09 17:01:38 +00:00
// Register settings scripts
2013-05-27 15:26:58 +00:00
OCP\App::registerAdmin('files_encryption', 'settings-admin');
OCP\App::registerPersonal('files_encryption', 'settings-personal');