Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
MON-14501 - sanitize query in centreonXmlbgRequest class (#11559)
Browse files Browse the repository at this point in the history
* sanitize query in centreonXmlbgRequest class

* add closeCursor func to resolve conv
  • Loading branch information
emabassi-ext committed Aug 11, 2022
1 parent 5998080 commit 226fb89
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions www/class/centreonXMLBGRequest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,13 @@ public function __construct(

private function isUserAdmin()
{
$query = "SELECT contact_admin, contact_id FROM contact " .
"WHERE contact.contact_id = '" . CentreonDB::escape($this->user_id) . "' LIMIT 1";
$dbResult = $this->DB->query($query);
$admin = $dbResult->fetchRow();
$dbResult->closeCursor();
if ($admin["contact_admin"]) {
$statement = $this->DB->prepare("SELECT contact_admin, contact_id FROM contact " .
"WHERE contact.contact_id = :userId LIMIT 1");
$statement->bindValue(":userId", (int) $this->user_id, \PDO::PARAM_INT);
$statement->execute();
$admin = $statement->fetchRow();
$statement->closeCursor();
if ($admin !== false && $admin["contact_admin"]) {
$this->is_admin = 1;
} else {
$this->is_admin = 0;
Expand Down Expand Up @@ -330,7 +331,7 @@ public function setHostGroupsHistory($hg)

public function setServiceGroupsHistory($sg)
{
$_SESSION['monitoring_default_servicegroups'] = sg;
$_SESSION['monitoring_default_servicegroups'] = $sg;
}

public function setCriticality($criticality)
Expand Down

0 comments on commit 226fb89

Please sign in to comment.