|
70 | 70 | $update = new Update($DB);
|
71 | 71 | $update->initSession();
|
72 | 72 |
|
73 |
| -if (isset($_POST['update_end'])) { |
| 73 | +if (($_SESSION['can_process_update'] ?? false) && isset($_POST['update_end'])) { |
74 | 74 | if (isset($_POST['send_stats'])) {
|
75 | 75 | Telemetry::enable();
|
76 | 76 | }
|
@@ -228,32 +228,30 @@ function showSecurityKeyCheckForm()
|
228 | 228 | echo "<h2>GLPI SETUP</h2>";
|
229 | 229 | echo "<br><h3>" . __('Upgrade') . "</h3>";
|
230 | 230 |
|
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)); |
256 | 248 | }
|
| 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>"; |
257 | 255 | } else {
|
258 | 256 | // Step 2
|
259 | 257 | if (test_connect()) {
|
|
0 commit comments