From 65f994f763c50201d3309315ca608b020fb8db88 Mon Sep 17 00:00:00 2001 From: quenenni Date: Tue, 22 Aug 2017 18:02:46 +0200 Subject: [PATCH] =?UTF-8?q?petit=20oubli=20de=20m=C3=A0j=20de=20$err=20->?= =?UTF-8?q?=20$msg=20dans=20functions.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bureau/class/functions.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bureau/class/functions.php b/bureau/class/functions.php index a4ae63ee..a23451dd 100755 --- a/bureau/class/functions.php +++ b/bureau/class/functions.php @@ -1081,7 +1081,7 @@ function PercentToColor($p = 0) { /** * - * @global m_err $err + * @global m_messages $msg * @global m_mem $mem * @global int $cuid * @return boolean @@ -1096,7 +1096,7 @@ function panel_lock() { /** * - * @global m_err $err + * @global m_messages $msg * @global m_mem $mem * @global int $cuid * @return boolean @@ -1143,29 +1143,29 @@ function csrf_get($return=false) { * a token can be only checked once, it's disabled then * @param $token string the token to check in the DB + session * @return $result integer 0 for invalid token, 1 for good token, -1 for expired token (already used) - * if a token is invalid or expired, an $err is raised, that can be displayed + * if a token is invalid or expired, an $msg is raised, that can be displayed */ function csrf_check($token=null) { - global $db,$err; + global $db,$msg; if (is_null($token)) $token=$_POST["csrf"]; if (!isset($_SESSION["csrf"])) { - $err->raise("functions", _("The posted form token is incorrect. Maybe you need to allow cookies")); + $msg->raise('Error', "functions", _("The posted form token is incorrect. Maybe you need to allow cookies")); return 0; // no csrf cookie :/ } if (strlen($token)!=32 || strlen($_SESSION["csrf"])!=32) { unset($_SESSION["csrf"]); - $err->raise("functions", _("Your cookie or token is invalid")); + $msg->raise('Error', "functions", _("Your cookie or token is invalid")); return 0; // invalid csrf cookie } $db->query("SELECT used FROM csrf WHERE cookie=? AND token=?;",array($_SESSION["csrf"],$token)); if (!$db->next_record()) { - $err->raise("functions", _("Your token is invalid")); + $msg->raise('Error', "functions", _("Your token is invalid")); return 0; // invalid csrf cookie } if ($db->f("used")) { - $err->raise("functions", _("Your token is expired. Please refill the form.")); + $msg->raise('Error', "functions", _("Your token is expired. Please refill the form.")); return -1; // expired } $db->query("UPDATE csrf SET used=1 WHERE cookie=? AND token=?;",array($_SESSION["csrf"],$token));