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

Fix: Sanitize and bind Media import #11788

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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