This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
/
init_checkup.php
162 lines (105 loc) · 3.32 KB
/
init_checkup.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
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
<?php
//$goto_install = array();
/**
* function checkwritable()
* check folders and files
*/
if(!defined('INSTALLER')) {
header("location:../login.php");
die("PERMISSION DENIED!");
}
function checkwritable($path) {
global $goto_install;
global $lang;
global $icon;
echo '<div class="row">';
echo '<div class="col-md-4">'.$path.'</div>';
echo '<div class="col-md-8">';
if(!is_writable("$path")){
echo '<div class="alert alert-danger">'.$icon['exclamation_triangle'].' '.$lang['permission_false'].'</div>';
$goto_install[] = "false";
} else {
echo '<div class="alert alert-success">'.$icon['check'].' '. $lang['permission_true'].'</div>';
$goto_install[] = "true";
}
echo '</div>';
echo '</div>';
}
function checkexistingdir($path) {
global $goto_install;
if(!is_dir("$path")){
echo '<div class="row">';
echo '<div class="col-md-4">'.$path.'</div>';
echo '<div class="col-md-8">';
echo '<div class="alert alert-danger">' . $lang['missing_folder'] . '</div>';
$goto_install[] = "false";
echo '</div>';
echo '</div>';
}
}
/* collecting files and folders */
$check_this[] = FC_CONTENT_DIR . "/";
$check_this[] = "../$img_path";
$check_this[] = "../$files_path";
$check_this[] = "../$img_tmb_path";
$check_this[] = FC_CONTENT_DIR . "/avatars";
$check_this[] = FC_CONTENT_DIR . "/plugins";
$check_this[] = FC_CONTENT_DIR . "/SQLite";
$check_this[] = FC_CONTENT_DIR . "/galleries";
sort($check_this,SORT_NATURAL | SORT_FLAG_CASE);
$check_is_dir[] = "../modules/";
$check_is_dir[] = "../lib/";
$check_is_dir[] = "../styles/";
$check_is_dir[] = "../core/";
$check_is_dir[] = "../acp/";
/* minimum php version */
$needed_phpversion = "7.3";
$loaded_extensions = get_loaded_extensions();
echo '<fieldset>';
echo '<legend>'.$lang['files_and_folders'].'</legend>';
foreach($check_this as $filepath){
checkwritable("$filepath");
}
foreach($check_is_dir as $dir){
checkexistingdir("$dir");
}
echo '</fieldset>';
echo '<fieldset>';
echo '<legend>'.$lang['system_requirements'].'</legend>';
$version = phpversion();
echo '<div class="row">';
echo '<div class="col-md-4">PHP Version</div>';
echo '<div class="col-md-8">';
if($version < $needed_phpversion) {
echo '<div class="alert alert-danger">'.$icon['exclamation_triangle'].' ' . $lang['php_false'] . ' '.$needed_phpversion.'</div>';
$goto_install[] = "false";
} else {
echo '<div class="alert alert-success">'.$icon['check'].' ' . $lang['php_true'] . ' ('.$version.')</div>';
$goto_install[] = "true";
}
echo '</div>';
echo '</div>';
echo '<div class="row">';
echo '<div class="col-md-4">PDO/SQLite</div>';
echo '<div class="col-md-8">';
if (in_array("pdo_sqlite", get_loaded_extensions())) {
echo '<div class="alert alert-success">'.$icon['check'].' ' . $lang['pdo_true'] . '</div>';
$goto_install[] = "true";
} else {
echo '<div class="alert alert-danger">'.$icon['exclamation_triangle'].' '.$lang['pdo_false'].'</div>';
$goto_install[] = "false";
}
echo '</div>';
echo '</div>';
if(!in_array("false",$goto_install)) {
echo '<hr><form action="index.php" method="POST">';
echo '<div class="row">';
echo '<div class="col-md-4"></div>';
echo '<div class="col-md-8">';
echo '<input type="submit" class="btn btn-success" name="step2" value="'.$lang['next_step'].'">';
echo '</div>';
echo '</div>';
echo '</form>';
}
echo '</fieldset>';
?>