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
|
<?php require_once "../../resources/private/relative.php"; getRelativeDetails("resources"); ?>
/*<?php header("Content-Type: application/javascript");require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/setup.php"; ?>*/
setTimeout(() => {
switchPage("01-loader", "02-check")
document.title = '<?= $lang["setup"]["steps"][0] . " - " . $lang["setup"]["ititle"] ?> - ';
$.ajax({
url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/setup/check.php",
dataType: 'html',
cache: false,
contentType: false,
processData: false,
type: 'get',
success: function (data) {
setTimeout(() => {
if (data != "ok") {
document.getElementById('00-error-title').innerHTML = "Environnement incorrect"
document.getElementById('00-error-message').innerHTML = data
switchPage("02-check", "00-error")
document.title = '<?= $lang["setup"]["steps"][1] . " - " . $lang["setup"]["ititle"] ?> - ';
window.onbeforeunload = undefined;
} else {
switchPage("02-check", "03-welcome")
document.title = '<?= $lang["setup"]["steps"][2] . " - " . $lang["setup"]["ititle"] ?> - ';
}
}, 1000)
}
})
}, 1000)
function validateName() {
document.getElementById('04-name-tip').classList.remove('tip-orange')
document.getElementById('04-name-tip').classList.remove('tip-green')
document.getElementById('04-name-tip').classList.remove('tip-red')
document.getElementById('04-name-tip').innerHTML = "...";
setTimeout(() => {
name = document.getElementById('04-name-field').value
if (name.trim() == "") {
document.getElementById('04-name-tip').classList.add('tip-red')
document.getElementById('04-name-tip').innerHTML = "<?= $lang['setup']['sitename'][0] ?>";
return;
}
if (name.includes("<") || name.includes(">") || name.includes("#") || name.includes("@") || name.includes("}") || name.includes("{") || name.includes("|")) {
document.getElementById('04-name-tip').classList.add('tip-red')
document.getElementById('04-name-tip').innerHTML = "<?= $lang['setup']['sitename'][1] ?>";
return;
}
if (name.length > 75) {
document.getElementById('04-name-tip').classList.add('tip-red')
document.getElementById('04-name-tip').innerHTML = "<?= $lang['setup']['sitename'][2] ?>";
return;
}
if (name.length < 4) {
document.getElementById('04-name-tip').classList.add('tip-orange')
document.getElementById('04-name-tip').innerHTML = "<?= $lang['setup']['sitename'][3] ?>";
return;
}
if (name.length > 30) {
document.getElementById('04-name-tip').classList.add('tip-orange')
document.getElementById('04-name-tip').innerHTML = "<?= $lang['setup']['sitename'][4] ?>";
return;
}
document.getElementById('04-name-tip').classList.add('tip-green')
document.getElementById('04-name-tip').innerHTML = "<?= $lang['setup']['sitename'][5] ?>";
return;
}, 100)
}
function Name_ChangeIfOk() {
name = document.getElementById('04-name-field').value
if (name.trim() == "" || name.includes("<") || name.includes(">") || name.includes("#") || name.includes("@") || name.includes("}") || name.includes("{") || name.includes("|") || name.length > 75) {return;}
switchPage("04-name", "05-icon")
document.title = '<?= $lang["setup"]["steps"][3] . " - " . $lang["setup"]["ititle"] ?> - ';
}
function Icon_UploadFile() {
$("#05-icon-file").trigger('click');
Icon_Validate()
}
function Icon_Validate() {
if (document.getElementById('05-icon-file').value != "") {
document.getElementById('05-icon-img').src = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/config_file_replace.svg"
} else {
document.getElementById('05-icon-img').src = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/config_file_import.svg"
}
}
function Icon_Validate_Delayed() {
setTimeout(() => {
if (document.getElementById('05-icon-file').value != "") {
document.getElementById('05-icon-img').src = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/config_file_replace.svg"
} else {
document.getElementById('05-icon-img').src = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/config_file_import.svg"
}
}, 1000)
}
document.getElementById('04-name-field').value = ""
document.getElementById('05-icon-file').value = ""
setInterval(Icon_Validate, 100)
function upload() {
document.title = '<?= $lang["setup"]["steps"][4] . " - " . $lang["setup"]["ititle"] ?> - ';
switchPage("07-finish", "08-checking")
setTimeout(() => {
switchPage("08-checking", "09-uploading")
var formData = new FormData();
if (typeof $('#05-icon-file')[0].files[0] != "undefined") {
formData.append("file", $('#05-icon-file')[0].files[0]);
}
formData.append("upload_file", true);
formData.append("sitename", document.getElementById('04-name-field').value);
formData.append("language", lang);
$.ajax({
type: "POST",
dataType: 'html',
url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/setup/push.php",
success: function (data) {
if (data == "ok") {
setTimeout(() => {
switchPage("09-uploading", "10-summing")
setTimeout(() => {
switchPage("10-summing", "11-performance")
setTimeout(() => {
switchPage("11-performance", "12-done")
document.title = '<?= $lang["setup"]["steps"][5] . " - " . $lang["setup"]["ititle"] ?> - ';
window.onbeforeunload = undefined;
}, 3000)
}, 2000)
}, 3000)
} else {
document.getElementById('00-error-title').innerHTML = `<?= $lang["setup"]["errors"][0] ?>`
document.getElementById('00-error-message').innerHTML = data
document.title = `<?= $lang["setup"]["steps"][1] . " - " . $lang["setup"]["ititle"] ?> - `;
setTimeout(() => {
switchPage("09-check", "00-error")
$("#09-uploading").fadeOut(200);
$("#09-uploading")[0].style.display = "none";
}, 1000)
window.onbeforeunload = undefined;
}
},
error: function (error) {
document.title = '<?= $lang["setup"]["steps"][1] . " - " . $lang["setup"]["ititle"] ?> - ';
document.getElementById('00-error-title').innerHTML = `<?= $lang["setup"]["errors"][1] ?>`
document.getElementById('00-error-message').innerHTML = `<?= $lang["setup"]["errors"][2] ?>`
setTimeout(() => {
switchPage("09-check", "00-error")
$("#09-uploading").fadeOut(200);
$("#09-uploading")[0].style.display = "none";
}, 1000)
window.onbeforeunload = undefined;
},
data: formData,
cache: false,
contentType: false,
processData: false
});
}, 1000)
}
document.title = '<?= $lang["setup"]["steps"][6] . " - " . $lang["setup"]["ititle"] ?> - ';
function switchPage(from, to) {
$("#" + from).fadeOut(200);
setTimeout(() => {
$("#" + to).fadeIn(200);
}, 200)
}
function reloadPage() {
location.reload();
}
|