forked from vijaydwivedics/rainloop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.php
50 lines (40 loc) · 1.61 KB
/
app.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
OCP\User::checkLoggedIn();
// code copied from nextcloud /lib/private/legacy/response.php
// fixes object-src: 'none' which blocks chrome from preview pdf
$policy = 'default-src \'self\'; '
. 'script-src \'self\' \'unsafe-eval\' \'nonce-'.\OC::$server->getContentSecurityPolicyNonceManager()->getNonce().'\'; '
. 'style-src \'self\' \'unsafe-inline\'; '
. 'frame-src *; '
. 'img-src * data: blob:; '
. 'font-src \'self\' data:; '
. 'media-src *; '
. 'connect-src *; '
. 'object-src \'self\'; '
. 'base-uri \'self\'; ';
header('Content-Security-Policy:' . $policy);
if (@file_exists(__DIR__.'/app/index.php'))
{
include_once OC_App::getAppPath('rainloop').'/lib/RainLoopHelper.php';
OC_RainLoop_Helper::regRainLoopDataFunction();
if (isset($_GET['OwnCloudAuth']))
{
$sEmail = '';
$sEncodedPassword = '';
$sUser = OCP\User::getUser();
if (OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false))
{
$sEmail = $sUser;
$sEncodedPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-autologin-password', '');
}
else
{
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
$sEncodedPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
}
$sDecodedPassword = OC_RainLoop_Helper::decodePassword($sEncodedPassword, md5($sEmail));
$_ENV['___rainloop_owncloud_email'] = $sEmail;
$_ENV['___rainloop_owncloud_password'] = $sDecodedPassword;
}
include __DIR__.'/app/index.php';
}