Bonjour amis de Grafikart.fr
Voici ma fonction voir dans mon post controller
public function voir($id, $idC=null){
$this->loadModel('Comment');
if($this->request->is('post')){
$this->request->data = Sanitize::clean($this->request->data);
if($this->Comment->save($this->request->data)){
$this->Session->setFlash("Votre commentaire a bien été enregistré !", "notif");
$this->request->data'Comment']'contenu'] = "";
}else{
$this->Session->setFlash('Commentaire non envoyé !', "notif", array('type' => 'error'));
}
}elseif($this->request->is('put')){
$this->request->data = Sanitize::clean($this->request->data);
if($this->Comment->save(array(
'id' => $this->request->data'Comment']'id'],
'date_edition' => date('Y-m-d H:i:s'),
'auteur_edition' => $this->Auth->user('username'),
'contenu' => $this->request->data'Comment']'contenu']
))){
$this->Session->setFlash("Votre commentaire a bien été edité !", "notif");
$this->redirect('/posts/voir/'.$id.'');
}else{
$this->Session->setFlash('Commentaire non envoyé !', "notif", array('type' => 'error'));
}
}
if ($this->request->is('get')){
$this->Post->Comment->id = $idC;
$this->request->data = $this->Comment->read();
}
$this->layout = 'default';
$b = $this->Post->find('first', array('conditions' => array(
'Post.id' => $id),
'contain' => array(
'Comment' => array(
'User' => array(
'Avatar')),
'Category')
));
$this->set('article', $b);
}
Quand je veux editer un commentaire le commentaire apparait dans mon textarea avec plein de caractères spéciaux à la places des accents et des apostrophes, c'est à cause de ma méthode sanitise, pourtant mes articles s'affiche bien sans problèmes d'accents sur ma page, ce n'est que dans mon textarea pendant l'édition.
Vous savez comment je peux contourner ça ?
Merci à vous d'avance