Просмотр исходного кода

Unset session error message just before exit (#3524)

Jaap Marcus 2 лет назад
Родитель
Сommit
ba7c2c5961
2 измененных файлов с 10 добавлено и 1 удалено
  1. 10 0
      web/inc/main.php
  2. 0 1
      web/templates/includes/js.php

+ 10 - 0
web/inc/main.php

@@ -557,3 +557,13 @@ function backendtpl_with_webdomains() {
 function validate_password($password) {
 function validate_password($password) {
 	return preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(.){8,}$/', $password);
 	return preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(.){8,}$/', $password);
 }
 }
+
+function unset_alerts() {
+	if (!empty($_SESSION["error_msg"])) {
+		unset($_SESSION["error_msg"]);
+	}
+	if (!empty($_SESSION["ok_msg"])) {
+		unset($_SESSION["ok_msg"]);
+	}
+}
+register_shutdown_function("unset_alerts");

+ 0 - 1
web/templates/includes/js.php

@@ -16,7 +16,6 @@
 	})
 	})
 </script>
 </script>
 
 
-<?php if (!empty($_SESSION['error_msg'])) unset($_SESSION['error_msg']); ?>
 
 
 <?php
 <?php
 $customScriptDirectory = new DirectoryIterator($_SERVER["HESTIA"] . "/web/js/custom_scripts");
 $customScriptDirectory = new DirectoryIterator($_SERVER["HESTIA"] . "/web/js/custom_scripts");