-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
220 lines (197 loc) · 7.51 KB
/
Copy pathindex.php
File metadata and controls
220 lines (197 loc) · 7.51 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
/**
* Flowaxy CMS Installer
* Окремий інсталятор, який може бути повністю видалений після установки.
*
* Взаємодіє з ядром через ENGINE_DIR, не вимагає завантаження всього рушія.
*/
declare(strict_types=1);
// Визначаємо корінь проєкту та директорію движка, якщо ще не визначені
if (!defined('ROOT_DIR')) {
define('ROOT_DIR', dirname(__DIR__));
}
if (!defined('ENGINE_DIR')) {
define('ENGINE_DIR', ROOT_DIR . '/engine');
}
// Проста перевірка: якщо папка install не існує — система вже встановлена
// НО: дозволяємо доступ до action=finish_install, оскільки це фінальний крок, який видалить інсталятор
$action = $_GET['action'] ?? $_POST['action'] ?? '';
$installDir = ROOT_DIR . '/install';
$installedFlagFile = ROOT_DIR . '/storage/config/installed.flag';
// Якщо папка install не існує або є файл-маркер встановлення - система встановлена
if ((!is_dir($installDir) || file_exists($installedFlagFile)) && $action !== 'finish_install') {
http_response_code(403);
?>
<!DOCTYPE html>
<html lang="uk">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flowaxy CMS вже встановлена</title>
<link rel="icon" type="image/png" href="/install/assets/images/brand/favicon.png">
<link rel="stylesheet" href="/install/assets/styles/installer.css?v=2">
<style>
.already-installed-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.already-installed-box {
background: #ffffff;
border-radius: 14px;
max-width: 600px;
width: 100%;
box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
overflow: hidden;
}
.already-installed-header {
background: #020617;
padding: 20px 24px;
color: #ffffff;
display: flex;
align-items: center;
gap: 12px;
border-bottom: 1px solid rgba(15, 23, 42, 0.8);
}
.already-installed-header .logo-container {
margin: 0;
display: flex;
align-items: center;
}
.already-installed-header .logo-container img {
height: 32px;
width: auto;
}
.already-installed-content {
padding: 40px;
text-align: center;
}
.already-installed-icon {
width: 64px;
height: 64px;
margin: 0 auto 24px;
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
}
.already-installed-title {
font-size: 24px;
font-weight: 700;
color: #1a202c;
margin-bottom: 16px;
letter-spacing: -0.01em;
}
.already-installed-message {
font-size: 14px;
color: #4a5568;
line-height: 1.6;
margin-bottom: 24px;
}
.already-installed-message code {
background: #f7fafc;
border: 1px solid #e2e8f0;
padding: 2px 8px;
border-radius: 4px;
font-family: 'Courier New', monospace;
font-size: 13px;
color: #2d3748;
}
.already-installed-warning {
background: #fffaf0;
border: 1px solid #feebc8;
border-left: 4px solid #ed8936;
padding: 16px 20px;
border-radius: 8px;
margin-bottom: 24px;
text-align: left;
}
.already-installed-warning-title {
font-size: 14px;
font-weight: 600;
color: #c05621;
margin-bottom: 8px;
display: flex;
align-items: center;
gap: 8px;
}
.already-installed-warning-text {
font-size: 13px;
color: #744210;
line-height: 1.5;
}
.already-installed-actions {
display: flex;
gap: 12px;
justify-content: center;
flex-wrap: wrap;
}
.already-installed-actions .btn {
min-width: 140px;
}
@media (max-width: 640px) {
.already-installed-content {
padding: 30px 20px;
}
.already-installed-title {
font-size: 20px;
}
.already-installed-actions {
flex-direction: column;
}
.already-installed-actions .btn {
width: 100%;
}
}
</style>
</head>
<body>
<div class="already-installed-container">
<div class="already-installed-box">
<div class="already-installed-header">
<div class="logo-container">
<img src="/install/assets/images/brand/logo-white.png" alt="Flowaxy CMS">
</div>
</div>
<div class="already-installed-content">
<div class="already-installed-icon">⚠️</div>
<h1 class="already-installed-title">Flowaxy CMS вже встановлена</h1>
<p class="already-installed-message">
Система виявлена, що Flowaxy CMS вже встановлена на цьому сервері.
</p>
<div class="already-installed-warning">
<div class="already-installed-warning-title">
<span>⚠️</span>
<span>Для повторної інсталяції:</span>
</div>
<div class="already-installed-warning-text">
Видаліть файл <code>storage/config/installed.flag</code> та всі відповідні таблиці з бази даних перед початком нової інсталяції.
</div>
</div>
<div class="already-installed-actions">
<a href="/" class="btn btn-primary">Перейти на сайт</a>
<a href="/admin" class="btn btn-secondary">Панель адміністратора</a>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
exit;
}
// Підключаємо контролер інсталятора з ядра install
$installerHandler = __DIR__ . '/core/InstallerController.php';
if (!is_file($installerHandler)) {
http_response_code(500);
echo '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Installer error</title></head><body>';
echo '<h1>Installer handler not found</h1>';
echo '<p>Очікувався файл <code>install/core/InstallerController.php</code>, але він відсутній.</p>';
echo '</body></html>';
exit;
}
require_once $installerHandler;