Fix comment creation date

This commit is contained in:
Pierre 2018-05-13 13:19:19 +02:00
parent 0d0878daa9
commit 1ffa215d4d
2 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,7 @@ class Comments {
"ID_texte" => $comment->get_postID(), "ID_texte" => $comment->get_postID(),
"ID_personne" => $comment->get_userID(), "ID_personne" => $comment->get_userID(),
"date_envoi" => mysql_date(), "date_envoi" => mysql_date(),
"time_insert" => time(),
"commentaire" => $comment->has_content() ? $comment->get_content() : "", "commentaire" => $comment->has_content() ? $comment->get_content() : "",
"image_commentaire" => $comment->has_img_path() ? "file:".$comment->get_img_path() : "" "image_commentaire" => $comment->has_img_path() ? "file:".$comment->get_img_path() : ""
); );
@ -297,7 +298,7 @@ class Comments {
$comment->set_id($data["ID"]); $comment->set_id($data["ID"]);
$comment->set_userID($data["ID_personne"]); $comment->set_userID($data["ID_personne"]);
$comment->set_postID($data["ID_texte"]); $comment->set_postID($data["ID_texte"]);
$comment->set_time_sent(strtotime($data["date_envoi"])); $comment->set_time_sent($data["time_insert"] == null ? strtotime($data["date_envoi"]) : $data["time_insert"]);
$comment->set_content($data["commentaire"]); $comment->set_content($data["commentaire"]);
//Check for image //Check for image

View File

@ -66,6 +66,7 @@ CREATE TABLE `commentaires` (
`ID_personne` int(11) NOT NULL, `ID_personne` int(11) NOT NULL,
`ID_texte` int(11) NOT NULL, `ID_texte` int(11) NOT NULL,
`date_envoi` datetime NOT NULL, `date_envoi` datetime NOT NULL,
`time_insert` int(11) DEFAULT NULL,
`commentaire` varchar(255) NOT NULL, `commentaire` varchar(255) NOT NULL,
`image_commentaire` longtext NOT NULL, `image_commentaire` longtext NOT NULL,
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)