-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
92 lines (86 loc) · 2.4 KB
/
index.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
if (version_compare(PHP_VERSION, '8.1') === -1) {
exit('You need at least PHP 8.1 to install this application.');
}
// if not installed yet, redirect to public dir
if (
!file_exists(__DIR__ . '/.env') ||
!preg_match('/INSTALLED=(true|1)/', file_get_contents(__DIR__ . '/.env'))
) {
// create .htaccess files
$rootHtaccess = __DIR__ . '/.htaccess';
$rootHtaccessStub = __DIR__ . '/htaccess.example';
$publicHtaccess = __DIR__ . '/public/.htaccess';
$publicHtaccessStub = __DIR__ . '/public/htaccess.example';
$shouldReload = false;
try {
if (!file_exists($rootHtaccess)) {
$contents = file_get_contents($rootHtaccessStub);
file_put_contents($rootHtaccess, $contents);
$shouldReload = true;
}
if (!file_exists($publicHtaccess)) {
$contents = file_get_contents($publicHtaccessStub);
file_put_contents($publicHtaccess, $contents);
$shouldReload = true;
}
} catch (Exception $e) {
//
}
}
?>
<html lang="en">
<head>
<title>.htaccess error</title>
<style>
html {
width: 100%;
height: 100%;
}
body {
background: rgb(250, 250, 250);
color: rgba(0, 0, 0, 0.87);
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
}
.logo {
text-align: center;
margin-bottom: 25px;
}
img {
max-width: 200px;
}
.panel {
background: rgb(255, 255, 255);
border: 1px solid rgba(0, 0, 0, 0.12);
padding: 40px 80px;
border-radius: 4px;
width: max-content;
text-align: center;
max-width: 700px;
}
h1 {
margin: 0 0 6px;
}
p {
font-size: 20px;
}
</style>
</head>
<body>
<?php if (!$shouldReload): ?>
<div class="panel">
<h1>Could not find .htaccess file</h1>
<p>See this article <a href="https://support.vebto.com/hc/articles/21/27/172/site-not-loading">https://support.vebto.com/hc/articles/21/27/172/site-not-loading</a> for possible solutions.</p>
</div>
<?php else: ?>
<script>
window.location.reload();
</script>
<?php endif; ?>
</body>
</html>