diff --git a/www/include/options/accessLists/actionsACL/DB-Func.php b/www/include/options/accessLists/actionsACL/DB-Func.php index 10151912b7c..c2cb3a589d0 100644 --- a/www/include/options/accessLists/actionsACL/DB-Func.php +++ b/www/include/options/accessLists/actionsACL/DB-Func.php @@ -170,20 +170,24 @@ function multipleActionInDB($actions = array(), $nbrDup = array()) $query = "SELECT DISTINCT acl_group_id,acl_action_id FROM acl_group_actions_relations " . " WHERE acl_action_id = '" . $key . "'"; $dbResult = $pearDB->query($query); + $query = "INSERT INTO acl_group_actions_relations VALUES (:acl_action_id, :acl_group_id)"; + $statement = $pearDB->prepare($query); while ($cct = $dbResult->fetch()) { - $query = "INSERT INTO acl_group_actions_relations VALUES ('" . - $maxId["MAX(acl_action_id)"] . "', '" . $cct["acl_group_id"] . "')"; - $pearDB->query($query); + $statement->bindValue(':acl_action_id', (int) $maxId["MAX(acl_action_id)"], \PDO::PARAM_INT); + $statement->bindValue(':acl_group_id', (int) $cct["acl_group_id"], \PDO::PARAM_INT); + $statement->execute(); } # Duplicate Actions $query = "SELECT acl_action_rule_id,acl_action_name FROM acl_actions_rules " . "WHERE acl_action_rule_id = '" . $key . "'"; $dbResult = $pearDB->query($query); + $query = "INSERT INTO acl_actions_rules VALUES (NULL, :acl_action_id, :acl_action_name)"; + $statement = $pearDB->prepare($query); while ($acl = $dbResult->fetch()) { - $query = "INSERT INTO acl_actions_rules VALUES (NULL, '" . $maxId["MAX(acl_action_id)"] . - "', '" . $acl["acl_action_name"] . "')"; - $pearDB->query($query); + $statement->bindValue(':acl_action_id', (int) $maxId["MAX(acl_action_id)"], \PDO::PARAM_INT); + $statement->bindValue(':acl_action_name', $acl["acl_action_name"], \PDO::PARAM_STR); + $statement->execute(); } $dbResult->closeCursor(); @@ -298,8 +302,10 @@ function updateGroupActions($aclActionId, $ret = array()) } global $form, $pearDB; - $rq = "DELETE FROM acl_group_actions_relations WHERE acl_action_id = '" . $aclActionId . "'"; - $dbResult = $pearDB->query($rq); + $rq = "DELETE FROM acl_group_actions_relations WHERE acl_action_id = :acl_action_id"; + $statement = $pearDB->prepare($rq); + $statement->bindValue(':acl_action_id', (int) $aclActionId, \PDO::PARAM_INT); + $statement->execute(); if (isset($_POST["acl_groups"])) { foreach ($_POST["acl_groups"] as $id) { $rq = "INSERT INTO acl_group_actions_relations "; @@ -325,8 +331,10 @@ function updateRulesActions($aclActionId, $ret = array()) return; } - $rq = "DELETE FROM acl_actions_rules WHERE acl_action_rule_id = '" . $aclActionId . "'"; - $dbResult = $pearDB->query($rq); + $rq = "DELETE FROM acl_actions_rules WHERE acl_action_rule_id = :acl_action_rule_id"; + $statement = $pearDB->prepare($rq); + $statement->bindValue(':acl_action_rule_id', (int) $aclActionId, \PDO::PARAM_INT); + $statement->execute(); $actions = array(); $actions = listActions();