This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
forked from projectsend/projectsend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.php
92 lines (82 loc) · 2.86 KB
/
error.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
use ProjectSend\Classes\Session;
define('IS_ERROR_PAGE', true);
$allowed_levels = array(9, 8, 7, 0);
require_once 'bootstrap.php';
$error_type = (!empty($_GET['e'])) ? $_GET['e'] : '401';
switch ($error_type) {
default:
case '401':
http_response_code(401);
$page_title = __('Access denied', 'cftp_admin');
$error_message = __("Your account type doesn't allow you to view this page. Please contact a system administrator if you need to access this function.", 'cftp_admin');
break;
case 'csrf':
http_response_code(403);
$page_title = __('Token mismatch', 'cftp_admin');
$error_message = __("The security token could not be validated.", 'cftp_admin');
break;
case '404':
http_response_code(404);
$page_title = __('Error 404', 'cftp_admin');
$error_message = __("Resource not found.", 'cftp_admin');
break;
case '403':
http_response_code(403);
$page_title = __('Error 403', 'cftp_admin');
$error_message = __("Forbidden.", 'cftp_admin');
break;
case 'database':
http_response_code(403);
$page_title = __('Database error', 'cftp_admin');
$error_message = (Session::has('database_connection_error')) ? Session::get('database_connection_error') : __("Can not connect to database", 'cftp_admin');
Session::remove('database_connection_error');
break;
case 'requirements':
http_response_code(403);
$page_title = __('Requirements error', 'cftp_admin');
$error_message = '';
$errors = get_server_requirements_errors();
foreach ($errors as $error) {
$error_message .= $error . '<br>';
}
break;
}
?>
<!doctype html>
<html lang="<?php echo SITE_LANG; ?>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo html_output($page_title . ' » ' . get_option('this_install_title')); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php meta_favicon(); ?>
<?php
render_assets('js', 'head');
render_assets('css', 'head');
render_custom_assets('head');
?>
</head>
<body class="backend error_page">
<div class="container">
<div class="row">
<div class="col-12">
<h2 class="mt-4 mb-4"><?php echo $page_title; ?></h2>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="white-box">
<div class="white-box-interior">
<?php echo $error_message; ?>
</div>
</div>
</div>
</div>
</div>
<?php render_custom_assets('body_bottom'); ?>
</body>
</html>
<?php
exit;