Blame view
sources/apps/files_encryption/files/error.php
1.97 KB
|
03e52840d
|
1 |
<?php |
|
31b7f2792
|
2 |
|
|
03e52840d
|
3 4 |
if (!isset($_)) { //also provide standalone error page
require_once __DIR__ . '/../../../lib/base.php';
|
|
6d9380f96
|
5 |
require_once __DIR__ . '/../lib/crypt.php'; |
|
03e52840d
|
6 7 |
$l = OC_L10N::get('files_encryption');
|
|
31b7f2792
|
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
if (isset($_GET['errorCode'])) {
$errorCode = $_GET['errorCode'];
switch ($errorCode) {
case \OCA\Encryption\Crypt::ENCRYPTION_NOT_INITIALIZED_ERROR:
$errorMsg = $l->t('Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app.');
break;
case \OCA\Encryption\Crypt::ENCRYPTION_PRIVATE_KEY_NOT_VALID_ERROR:
$theme = new OC_Defaults();
$errorMsg = $l->t('Your private key is not valid! Likely your password was changed outside of %s (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files.', array($theme->getName()));
break;
case \OCA\Encryption\Crypt::ENCRYPTION_NO_SHARE_KEY_FOUND:
$errorMsg = $l->t('Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.');
break;
default:
|
|
6d9380f96
|
22 |
$errorMsg = $l->t("Unknown error. Please check your system settings or contact your administrator");
|
|
31b7f2792
|
23 24 25 26 |
break;
}
} else {
$errorCode = \OCA\Encryption\Crypt::ENCRYPTION_UNKNOWN_ERROR;
|
|
6d9380f96
|
27 |
$errorMsg = $l->t("Unknown error. Please check your system settings or contact your administrator");
|
|
31b7f2792
|
28 |
} |
|
03e52840d
|
29 |
|
|
31b7f2792
|
30 31 |
if (isset($_GET['p']) && $_GET['p'] === '1') {
header('HTTP/1.0 403 ' . $errorMsg);
|
|
03e52840d
|
32 |
} |
|
31b7f2792
|
33 34 |
// check if ajax request
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
|
03e52840d
|
35 36 |
\OCP\JSON::error(array('data' => array('message' => $errorMsg)));
} else {
|
|
31b7f2792
|
37 |
header('HTTP/1.0 403 ' . $errorMsg);
|
|
03e52840d
|
38 |
$tmpl = new OC_Template('files_encryption', 'invalid_private_key', 'guest');
|
|
31b7f2792
|
39 40 |
$tmpl->assign('message', $errorMsg);
$tmpl->assign('errorCode', $errorCode);
|
|
03e52840d
|
41 42 43 44 45 |
$tmpl->printPage(); } exit; } |
|
31b7f2792
|
46 |