-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.php
More file actions
669 lines (612 loc) · 31.7 KB
/
install.php
File metadata and controls
669 lines (612 loc) · 31.7 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
<?php
// Simple Installer (tiny, minimal)
if (!file_exists('config.php')) {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$site_title = trim($_POST['site_title'] ?? 'My FlatFile Blog');
$admin_username = trim($_POST['admin_username'] ?? 'admin');
$admin_email = trim($_POST['admin_email'] ?? 'admin@example.com');
$admin_password = trim($_POST['admin_password'] ?? '');
$timezone = trim($_POST['timezone'] ?? 'UTC');
$scheme = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) ? 'https://' : 'http://';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$dir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
$base_url = trim($_POST['base_url'] ?? ($scheme . $host . ($dir ? $dir : '')), '/') . '/';
if ($admin_password === '') {
$admin_password = bin2hex(random_bytes(8));
}
foreach (['content', 'content/posts', 'uploads', 'uploads/featured', 'logs'] as $d) {
if (!is_dir($d)) {
@mkdir($d, 0755, true);
}
}
$cfg = "<?php\n" .
"define('SITE_TITLE', '" . addslashes($site_title) . "');\n" .
"define('BASE_URL', '" . addslashes($base_url) . "');\n" .
"define('ADMIN_USERNAME', '" . addslashes($admin_username) . "');\n" .
"define('ADMIN_EMAIL', '" . addslashes($admin_email) . "');\n" .
"define('TIMEZONE', '" . addslashes($timezone) . "');\n" .
"define('ADMIN_PASSWORD_HASH', '" . password_hash($admin_password, PASSWORD_DEFAULT) . "');\n" .
"define('CSRF_TOKEN_NAME', 'csrf_token');\n" .
"define('SESSION_TIMEOUT', 3600);\n" .
"define('CONTENT_DIR', __DIR__ . '/content/');\n" .
"define('POSTS_DIR', __DIR__ . '/content/posts/');\n" .
"define('UPLOADS_DIR', __DIR__ . '/uploads/');\n" .
"define('LOGS_DIR', __DIR__ . '/logs/');\n" .
"define('DEBUG_MODE', false);\n" .
"if (defined('TIMEZONE')) { date_default_timezone_set(TIMEZONE); }\n" .
"?>";
file_put_contents('config.php', $cfg);
$settings = ['site_title' => $site_title, 'site_description' => 'A simple, fast, and secure flat-file blog system.', 'admin_email' => $admin_email, 'timezone' => $timezone, 'posts_per_page' => 10];
file_put_contents('content/settings.json', json_encode($settings, JSON_PRETTY_PRINT));
if (!file_exists('content/index.json')) {
file_put_contents('content/index.json', json_encode([], JSON_PRETTY_PRINT));
}
header('Location: admin/');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Install FlatFile Blog</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container py-5">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card shadow">
<div class="card-header bg-dark text-white text-center">
<h1 class="h4 mb-0">FlatFile Blog — Quick Install</h1>
</div>
<div class="card-body">
<form method="POST">
<div class="row">
<div class="col-md-6 mb-3"><label class="form-label">Site Title</label><input
class="form-control" name="site_title" value="My FlatFile Blog" required></div>
<div class="col-md-6 mb-3"><label class="form-label">Admin Username</label><input
class="form-control" name="admin_username" placeholder="admin" required></div>
</div>
<div class="row">
<div class="col-md-6 mb-3"><label class="form-label">Admin Email</label><input
type="email" class="form-control" name="admin_email"
placeholder="admin@example.com" required></div>
<div class="col-md-6 mb-3"><label class="form-label">Timezone</label><select
class="form-select" name="timezone" required>
<option value="UTC">UTC</option>
<option value="America/New_York">Eastern Time (ET)</option>
<option value="America/Chicago">Central Time (CT)</option>
<option value="America/Denver">Mountain Time (MT)</option>
<option value="America/Los_Angeles">Pacific Time (PT)</option>
<option value="Europe/London">London (GMT)</option>
<option value="Europe/Paris">Paris (CET)</option>
<option value="Asia/Tokyo">Tokyo (JST)</option>
<option value="Asia/Shanghai">Shanghai (CST)</option>
<option value="Asia/Kolkata">Mumbai (IST)</option>
<option value="Australia/Sydney">Sydney (AEST)</option>
</select></div>
</div>
<div class="row">
<div class="col-md-6 mb-3"><label class="form-label">Admin Password</label><input
type="password" class="form-control" name="admin_password"
placeholder="leave blank to auto-generate"></div>
<div class="col-md-6 mb-3"><label class="form-label">Base URL</label><input
class="form-control" name="base_url"
value="<?php echo (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) ? 'https://' : 'http://') . ($_SERVER['HTTP_HOST'] ?? 'localhost') . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\'); ?>">
</div>
</div>
<div class="d-grid"><button class="btn btn-dark btn-lg" type="submit">Install</button></div>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
exit;
}
/**
* FlatFile Blog Installation Script
*
* This script sets up the entire blog system automatically.
* Run this once to install the blog system.
*/
// Check if already installed
$already_installed = file_exists('config.php') && file_exists('content/index.json');
// Set error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Installation status
$installation_steps = [];
$errors = [];
$success = true;
// Function to add installation step
function addStep($step, $status = 'success')
{
global $installation_steps;
$installation_steps[] = ['step' => $step, 'status' => $status];
}
// Function to add error
function addError($error)
{
global $errors, $success;
$errors[] = $error;
$success = false;
}
// Handle reinstall action
if (isset($_POST['action']) && $_POST['action'] === 'reinstall') {
// Delete existing files
$files_to_delete = [
'config.php',
'content/index.json',
'content/settings.json'
];
$directories_to_delete = [
'content/posts',
'uploads/featured',
'logs'
];
foreach ($files_to_delete as $file) {
if (file_exists($file)) {
unlink($file);
}
}
foreach ($directories_to_delete as $dir) {
if (is_dir($dir)) {
$files = glob($dir . '/*');
foreach ($files as $file) {
if (is_file($file)) {
unlink($file);
}
}
rmdir($dir);
}
}
// Remove empty directories
if (is_dir('content') && count(scandir('content')) == 2) {
rmdir('content');
}
if (is_dir('uploads') && count(scandir('uploads')) == 2) {
rmdir('uploads');
}
if (is_dir('logs') && count(scandir('logs')) == 2) {
rmdir('logs');
}
addStep("Removed existing installation files");
$already_installed = false;
}
// Check if form was submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !isset($_POST['action'])) {
$site_title = trim($_POST['site_title'] ?? '');
$site_description = trim($_POST['site_description'] ?? '');
$admin_username = trim($_POST['admin_username'] ?? '');
$admin_email = trim($_POST['admin_email'] ?? '');
$admin_password = trim($_POST['admin_password'] ?? '');
$timezone = trim($_POST['timezone'] ?? '');
$base_url = trim($_POST['base_url'] ?? '');
// Validate inputs
if (empty($site_title)) {
addError('Site title is required');
}
if (empty($admin_username)) {
addError('Admin username is required');
}
if (empty($admin_email) || !filter_var($admin_email, FILTER_VALIDATE_EMAIL)) {
addError('Valid admin email is required');
}
if (empty($admin_password) || strlen($admin_password) < 6) {
addError('Admin password must be at least 6 characters');
}
if (empty($timezone)) {
addError('Timezone is required');
}
if (empty($base_url)) {
addError('Base URL is required');
}
if ($success) {
// Step 1: Create directories
$directories = [
'content',
'content/posts',
'content/backups',
'uploads',
'uploads/featured',
'assets',
'assets/css',
'assets/js',
'libs',
'logs',
'admin',
'admin/tools'
];
foreach ($directories as $dir) {
if (!file_exists($dir)) {
if (mkdir($dir, 0755, true)) {
addStep("Created directory: $dir");
} else {
addError("Failed to create directory: $dir");
}
} else {
addStep("Directory already exists: $dir");
}
}
// Step 2: Create config.php
$config_content = "<?php
/**
* FlatFile Blog Configuration
* Generated by install.php
*/
// Site Configuration
define('SITE_TITLE', '" . addslashes($site_title) . "');
define('BASE_URL', '" . rtrim($base_url, '/') . "/');
define('ADMIN_USERNAME', '" . addslashes($admin_username) . "');
define('ADMIN_EMAIL', '" . addslashes($admin_email) . "');
define('TIMEZONE', '" . addslashes($timezone) . "');
// Security
define('ADMIN_PASSWORD_HASH', '" . password_hash($admin_password, PASSWORD_DEFAULT) . "');
define('CSRF_TOKEN_NAME', 'csrf_token');
define('SESSION_TIMEOUT', 3600); // 1 hour
// Directories
define('CONTENT_DIR', __DIR__ . '/content/');
define('POSTS_DIR', __DIR__ . '/content/posts/');
define('UPLOADS_DIR', __DIR__ . '/uploads/');
define('LOGS_DIR', __DIR__ . '/logs/');
// Create logs directory if it doesn't exist
if (!file_exists(LOGS_DIR)) {
mkdir(LOGS_DIR, 0755, true);
}
// Security Settings
define('MAX_UPLOAD_SIZE', 5 * 1024 * 1024); // 5MB
define('ALLOWED_IMAGE_TYPES', ['image/jpeg', 'image/png', 'image/gif', 'image/webp']);
define('THUMBNAIL_SIZE', 300);
define('MEDIUM_SIZE', 800);
// Performance
define('CACHE_ENABLED', true);
define('CACHE_DURATION', 3600); // 1 hour
// Development
define('DEBUG_MODE', false);
define('LOG_LEVEL', 'INFO');
// Production Settings
define('ENVIRONMENT', 'production');
define('MAINTENANCE_MODE', false);
// Error handling for production
if (!DEBUG_MODE) {
error_reporting(0);
ini_set('display_errors', 0);
ini_set('log_errors', 1);
ini_set('error_log', LOGS_DIR . 'error.log');
} else {
error_reporting(E_ALL);
ini_set('display_errors', 1);
}
// Set timezone
if (defined('TIMEZONE')) {
date_default_timezone_set(TIMEZONE);
}
// Security headers
if (!headers_sent()) {
header('X-Content-Type-Options: nosniff');
header('X-Frame-Options: DENY');
header('X-XSS-Protection: 1; mode=block');
header('Referrer-Policy: strict-origin-when-cross-origin');
}
// Note: Direct access protection is handled by .htaccess file
?>";
if (file_put_contents('config.php', $config_content)) {
addStep("Created config.php");
} else {
addError("Failed to create config.php");
}
// Step 3: Skip sample post creation
addStep("Skipped sample post creation");
// Step 4: Create settings file
$settings = [
'site_title' => $site_title,
'site_description' => $site_description,
'admin_email' => $admin_email,
'timezone' => $timezone,
'posts_per_page' => 10,
'enable_comments' => false,
'enable_rss' => true,
'enable_sitemap' => true,
'theme' => 'default',
'language' => 'en'
];
if (file_put_contents('content/settings.json', json_encode($settings, JSON_PRETTY_PRINT))) {
addStep("Created settings file");
} else {
addError("Failed to create settings file");
}
// Step 5: Create empty index.json
$index_data = [];
if (file_put_contents('content/index.json', json_encode($index_data, JSON_PRETTY_PRINT))) {
addStep("Created empty content index");
} else {
addError("Failed to create content index");
}
// Step 6: Skip .htaccess creation (keeping existing file)
addStep("Skipped .htaccess creation (keeping existing file)");
// Step 7: Create robots.txt
$robots_content = "User-agent: *
Disallow: /admin/
Disallow: /content/
Disallow: /logs/
Disallow: /libs/
Disallow: /uploads/
Allow: /uploads/featured/
Sitemap: " . rtrim($base_url, '/') . "/sitemap";
if (file_put_contents('robots.txt', $robots_content)) {
addStep("Created robots.txt");
} else {
addError("Failed to create robots.txt");
}
// Step 8: Set permissions (if possible)
if (function_exists('chmod')) {
$files_to_chmod = [
'content' => 0755,
'uploads' => 0755,
'logs' => 0755,
'config.php' => 0644,
'.htaccess' => 0644
];
foreach ($files_to_chmod as $file => $permission) {
if (file_exists($file)) {
if (chmod($file, $permission)) {
addStep("Set permissions for $file");
} else {
addStep("Could not set permissions for $file (this is normal on some servers)", 'warning');
}
}
}
}
// Installation complete
if ($success) {
addStep("Installation completed successfully!");
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Install - FlatFile Blog</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row d-flex justify-content-center align-items-center vh-100">
<div class="col-md-8">
<div class="card shadow">
<div class="card-body">
<?php if ($already_installed && $_SERVER['REQUEST_METHOD'] !== 'POST'): ?>
<!-- Already Installed Warning -->
<div class="card border-0 p-5">
<h2 class="text-danger mb-4">
FlatFile Blog Already Installed!
</h2>
<div class="text-danger">
<p class="mb-3">
If you want to start fresh, you can delete the existing installation and reinstall.
<strong>This will delete all your blog posts, settings, and uploaded files!</strong>
Make sure to backup your data before doing this.
</p>
</div>
<form method="POST" class="d-inline">
<input type="hidden" name="action" value="reinstall">
<button type="submit" class="btn btn-danger"
onclick="return confirm('Are you sure you want to delete the existing installation? This action cannot be undone!')">
<i class="bi bi-trash me-2"></i>
Delete & Reinstall
</button>
</form>
</div>
<?php elseif ($_SERVER['REQUEST_METHOD'] === 'POST'): ?>
<!-- Installation Results -->
<div class="card border-0 mb-4">
<!-- <div class="card-header bg-<?php echo $success ? 'success' : 'danger'; ?> text-white">
<h5 class="mb-0">
<i class="bi bi-<?php echo $success ? 'check-circle' : 'exclamation-triangle'; ?> me-2"></i>
Installation <?php echo $success ? 'Successful' : 'Failed'; ?>
</h5>
</div> -->
<div class="card-body">
<?php if (!empty($errors)): ?>
<div class="text-danger">
<h6 class="mb-3">Errors:</h6>
<ul class="mb-0">
<?php foreach ($errors as $error): ?>
<li><?php echo htmlspecialchars($error); ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<h6 class="mb-3">Installation Steps:</h6>
<div class="list-group">
<?php foreach ($installation_steps as $step): ?>
<div class="list-group-item d-flex align-items-center">
<i
class="bi bi-<?php echo $step['status'] === 'success' ? 'check-circle-fill text-success' : ($step['status'] === 'warning' ? 'exclamation-triangle-fill text-warning' : 'x-circle-fill text-danger'); ?> me-3"></i>
<span><?php echo htmlspecialchars($step['step']); ?></span>
</div>
<?php endforeach; ?>
</div>
<?php if ($success): ?>
<div class="mt-4">
<div class="text-success">
<p class="mb-2">
Your FlatFile blog has been successfully installed.
<br><br>
<a href="admin/" class="btn btn-dark">
Complete Setup
</a>
</p>
</div>
</div>
<div class="mt-4">
<div class="alert alert-warning text-dark">
<h6 class="mb-0">
Please delete this <code>install.php</code> file for security reasons.
</h6>
</div>
</div>
<?php else: ?>
<div class="mt-4">
<div class="text-danger">
<h6><i class="bi bi-exclamation-triangle me-2"></i>Installation Failed</h6>
<p>Please fix the errors above and try again.</p>
<a href="install.php" class="btn btn-danger">
<i class="bi bi-arrow-clockwise me-2"></i>Try Again
</a>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php else: ?>
<!-- Installation Form -->
<form method="POST" class="needs-validation" novalidate>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="site_title" class="form-label">
<i class="bi bi-globe me-2"></i>Site Title
</label>
<input type="text" class="form-control" id="site_title" name="site_title"
value="My FlatFile Blog" required>
<div class="form-text">The name of your blog</div>
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="admin_username" class="form-label">
<i class="bi bi-person me-2"></i>Admin Username
</label>
<input type="text" class="form-control" id="admin_username"
name="admin_username" placeholder="admin" required>
<div class="form-text">Your admin username</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="admin_email" class="form-label">
<i class="bi bi-envelope me-2"></i>Admin Email
</label>
<input type="email" class="form-control" id="admin_email" name="admin_email"
placeholder="admin@example.com" required>
<div class="form-text">Your email address</div>
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="timezone" class="form-label">
<i class="bi bi-clock me-2"></i>Timezone
</label>
<select class="form-select" id="timezone" name="timezone" required>
<option value="">Select Timezone</option>
<option value="UTC">UTC</option>
<option value="America/New_York">Eastern Time (ET)</option>
<option value="America/Chicago">Central Time (CT)</option>
<option value="America/Denver">Mountain Time (MT)</option>
<option value="America/Los_Angeles">Pacific Time (PT)</option>
<option value="Europe/London">London (GMT)</option>
<option value="Europe/Paris">Paris (CET)</option>
<option value="Asia/Tokyo">Tokyo (JST)</option>
<option value="Asia/Shanghai">Shanghai (CST)</option>
<option value="Asia/Kolkata">Mumbai (IST)</option>
<option value="Australia/Sydney">Sydney (AEST)</option>
</select>
<div class="form-text">Your timezone</div>
</div>
</div>
</div>
<div class="mb-3">
<label for="site_description" class="form-label">
<i class="bi bi-text-paragraph me-2"></i>Site Description
</label>
<textarea class="form-control" id="site_description" name="site_description" rows="3"
placeholder="A brief description of your blog">A simple, fast, and secure flat-file blog system built with PHP and Bootstrap.</textarea>
<div class="form-text">Brief description of your blog</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="admin_password" class="form-label">
<i class="bi bi-lock me-2"></i>Admin Password
</label>
<input type="password" class="form-control" id="admin_password"
name="admin_password" placeholder="Enter a secure password" minlength="6"
required>
<div class="form-text">Minimum 6 characters</div>
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="base_url" class="form-label">
<i class="bi bi-link-45deg me-2"></i>Base URL
</label>
<input type="url" class="form-control" id="base_url" name="base_url" value="<?php
$is_https = (
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)
|| (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
);
$scheme = $is_https ? 'https://' : 'http://';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$script_dir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
echo $scheme . $host . ($script_dir ? $script_dir : '');
?>" required>
<div class="form-text">Your blog's URL</div>
</div>
</div>
</div>
<div class="text-info">
<h6><i class="bi bi-info-circle me-2"></i>What will be installed:</h6>
<ul class="mb-0">
<li>Blog system files and directories</li>
<li>Configuration files</li>
<li>Sample blog post</li>
<li>Admin panel setup</li>
<li>Security configurations</li>
</ul>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary btn-lg">
<i class="bi bi-download me-2"></i>Install FlatFile Blog
</button>
</div>
</form>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Form validation
(function () {
'use strict';
window.addEventListener('load', function () {
var forms = document.getElementsByClassName('needs-validation');
var validation = Array.prototype.filter.call(forms, function (form) {
form.addEventListener('submit', function (event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
</script>
</body>
</html>