2011-10-21 15:02:11 +00:00
|
|
|
<?php
|
|
|
|
|
2012-10-17 15:35:19 +00:00
|
|
|
OC::$CLASSPATH['OCA\Encryption\Crypt'] = 'apps/files_encryption/lib/crypt.php';
|
|
|
|
OC::$CLASSPATH['OCA\Encryption\Hooks'] = 'apps/files_encryption/hooks/hooks.php';
|
|
|
|
OC::$CLASSPATH['OCA\Encryption\Util'] = 'apps/files_encryption/lib/util.php';
|
|
|
|
OC::$CLASSPATH['OCA\Encryption\Keymanager'] = 'apps/files_encryption/lib/keymanager.php';
|
|
|
|
OC::$CLASSPATH['OCA\Encryption\Stream'] = 'apps/files_encryption/lib/stream.php';
|
|
|
|
OC::$CLASSPATH['OCA\Encryption\Proxy'] = 'apps/files_encryption/lib/proxy.php';
|
2012-12-11 15:10:56 +00:00
|
|
|
OC::$CLASSPATH['OCA\Encryption\Session'] = 'apps/files_encryption/lib/session.php';
|
2011-10-21 15:02:11 +00:00
|
|
|
|
2012-10-17 15:35:19 +00:00
|
|
|
OC_FileProxy::register(new OCA\Encryption\Proxy());
|
2011-10-21 15:02:11 +00:00
|
|
|
|
2012-10-17 15:35:19 +00:00
|
|
|
OCP\Util::connectHook('OC_User','post_login','OCA\Encryption\Hooks','login');
|
|
|
|
OCP\Util::connectHook('OC_Webdav_Properties', 'update', 'OCA\Encryption\Hooks', 'updateKeyfile');
|
2012-12-11 13:22:46 +00:00
|
|
|
OCP\Util::connectHook('OC_User','post_setPassword','OCA\Encryption\Hooks','setPassphrase');
|
2011-10-21 15:02:11 +00:00
|
|
|
|
2012-10-17 15:35:19 +00:00
|
|
|
stream_wrapper_register( 'crypt', 'OCA\Encryption\Stream');
|
2012-02-22 14:18:22 +00:00
|
|
|
|
2012-12-11 15:10:56 +00:00
|
|
|
$session = new OCA\Encryption\Session();
|
|
|
|
|
|
|
|
if (
|
|
|
|
! $session->getPrivateKey( \OCP\USER::getUser() )
|
|
|
|
&& OCP\User::isLoggedIn()
|
|
|
|
&& OCA\Encryption\Crypt::mode() == 'server'
|
|
|
|
) {
|
2012-07-25 17:28:56 +00:00
|
|
|
|
|
|
|
// Force the user to re-log in if the encryption key isn't unlocked (happens when a user is logged in before the encryption app is enabled)
|
2012-05-01 17:04:20 +00:00
|
|
|
OCP\User::logout();
|
2012-07-25 17:28:56 +00:00
|
|
|
|
2012-02-22 14:18:22 +00:00
|
|
|
header("Location: ".OC::$WEBROOT.'/');
|
2012-07-25 17:28:56 +00:00
|
|
|
|
2012-02-22 14:18:22 +00:00
|
|
|
exit();
|
2012-07-25 17:28:56 +00:00
|
|
|
|
2012-02-22 14:18:22 +00:00
|
|
|
}
|
2012-02-22 21:20:46 +00:00
|
|
|
|
2012-08-02 08:39:30 +00:00
|
|
|
OCP\App::registerAdmin('files_encryption', 'settings');
|
2012-12-11 15:15:30 +00:00
|
|
|
OCP\App::registerPersonal('files_encryption','settings-personal');
|
|
|
|
|
|
|
|
file_put_contents( '/home/samtuke/tmp.txt', $_SESSION['privateKey'] );
|