Skip to content

Commit dc91653

Browse files
authored
Merge commit from fork
1 parent ccf7500 commit dc91653

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

inc/config.php

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
);
246246

247247
if ($outdated !== true) {
248+
$_SESSION['can_process_update'] = true;
248249
echo "<form method='post' action='" . $CFG_GLPI["root_doc"] . "/install/update.php'>";
249250
if (!VersionParser::isStableRelease(GLPI_VERSION)) {
250251
echo Config::agreeUnstableMessage(VersionParser::isDevVersion(GLPI_VERSION));

install/install.php

+1
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ function update1($dbname)
506506
footer_html();
507507
} else {
508508
$from_install = true;
509+
$_SESSION['can_process_update'] = true;
509510
include_once(GLPI_ROOT . "/install/update.php");
510511
}
511512
}

install/update.php

+24-26
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
$update = new Update($DB);
7171
$update->initSession();
7272

73-
if (isset($_POST['update_end'])) {
73+
if (($_SESSION['can_process_update'] ?? false) && isset($_POST['update_end'])) {
7474
if (isset($_POST['send_stats'])) {
7575
Telemetry::enable();
7676
}
@@ -228,32 +228,30 @@ function showSecurityKeyCheckForm()
228228
echo "<h2>GLPI SETUP</h2>";
229229
echo "<br><h3>" . __('Upgrade') . "</h3>";
230230

231-
// step 1 avec bouton de confirmation
232-
233-
if (empty($_POST["continuer"]) && empty($_POST["from_update"])) {
234-
if (empty($from_install) && !isset($_POST["from_update"])) {
235-
echo "<div class='center'>";
236-
echo "<h3><span class='migred'>" . __('Impossible to accomplish an update by this way!') . "</span>";
237-
echo "<p>";
238-
echo "<a class='btn btn-primary' href='../index.php'>
239-
" . __('Go back to GLPI') . "
240-
</a></p>";
241-
echo "</div>";
242-
} else {
243-
echo "<div class='center'>";
244-
echo "<h3 class='my-4'><span class='migred p-2'>" . sprintf(__('Caution! You will update the GLPI database named: %s'), $DB->dbdefault) . "</h3>";
245-
246-
echo "<form action='update.php' method='post'>";
247-
if (!VersionParser::isStableRelease(GLPI_VERSION)) {
248-
echo Config::agreeUnstableMessage(VersionParser::isDevVersion(GLPI_VERSION));
249-
}
250-
echo "<button type='submit' class='btn btn-primary' name='continuer' value='1'>
251-
" . __('Continue') . "
252-
<i class='fas fa-chevron-right ms-1'></i>
253-
</button>";
254-
Html::closeForm();
255-
echo "</div>";
231+
if (($_SESSION['can_process_update'] ?? false) === false) {
232+
// Unexpected direct access to the form
233+
echo "<div class='center'>";
234+
echo "<h3><span class='migred'>" . __('Impossible to accomplish an update by this way!') . "</span>";
235+
echo "<p>";
236+
echo "<a class='btn btn-primary' href='../index.php'>
237+
" . __('Go back to GLPI') . "
238+
</a></p>";
239+
echo "</div>";
240+
} elseif (empty($_POST["continuer"]) && empty($_POST["from_update"])) {
241+
// step 1 avec bouton de confirmation
242+
echo "<div class='center'>";
243+
echo "<h3 class='my-4'><span class='migred p-2'>" . sprintf(__('Caution! You will update the GLPI database named: %s'), $DB->dbdefault) . "</h3>";
244+
245+
echo "<form action='update.php' method='post'>";
246+
if (!VersionParser::isStableRelease(GLPI_VERSION)) {
247+
echo Config::agreeUnstableMessage(VersionParser::isDevVersion(GLPI_VERSION));
256248
}
249+
echo "<button type='submit' class='btn btn-primary' name='continuer' value='1'>
250+
" . __('Continue') . "
251+
<i class='fas fa-chevron-right ms-1'></i>
252+
</button>";
253+
Html::closeForm();
254+
echo "</div>";
257255
} else {
258256
// Step 2
259257
if (test_connect()) {

0 commit comments

Comments
 (0)