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

Commit

Permalink
Fix: Sanitize and bind Media import (#11788)
Browse files Browse the repository at this point in the history
  • Loading branch information
emabassi-ext authored Sep 22, 2022
1 parent 8da2e2a commit c22ab19
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions www/class/centreonMedia.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,12 @@ public function addImage($parameters, $binary = null)
$imageId = $row['img_id'];

// Insert relation between directory and image
$query = 'INSERT INTO view_img_dir_relation '
. '(dir_dir_parent_id, img_img_id) '
. 'VALUES ('
. $directoryId . ', '
. $imageId . ' '
. ') ';
$statement = $this->db->prepare("INSERT INTO view_img_dir_relation (dir_dir_parent_id, img_img_id) " .
"VALUES (:dirId, :imgId) ");
$statement->bindValue(':dirId', (int) $directoryId, \PDO::PARAM_INT);
$statement->bindValue(':imgId', (int) $imageId, \PDO::PARAM_INT);
try {
$this->db->query($query);
$statement->execute();
} catch (\PDOException $e) {
throw new \Exception('Error while inserting relation between' . $imageName . ' and ' . $directoryName);
}
Expand Down

0 comments on commit c22ab19

Please sign in to comment.