From 1ffa215d4dbcb45aa744476984451e67e4e13014 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 13 May 2018 13:19:19 +0200 Subject: [PATCH] Fix comment creation date --- classes/components/comments.php | 3 ++- db_struct.sql | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/components/comments.php b/classes/components/comments.php index 0fc178f..685665f 100644 --- a/classes/components/comments.php +++ b/classes/components/comments.php @@ -25,6 +25,7 @@ class Comments { "ID_texte" => $comment->get_postID(), "ID_personne" => $comment->get_userID(), "date_envoi" => mysql_date(), + "time_insert" => time(), "commentaire" => $comment->has_content() ? $comment->get_content() : "", "image_commentaire" => $comment->has_img_path() ? "file:".$comment->get_img_path() : "" ); @@ -297,7 +298,7 @@ class Comments { $comment->set_id($data["ID"]); $comment->set_userID($data["ID_personne"]); $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"]); //Check for image diff --git a/db_struct.sql b/db_struct.sql index 9ef27cf..ae8daf6 100644 --- a/db_struct.sql +++ b/db_struct.sql @@ -66,6 +66,7 @@ CREATE TABLE `commentaires` ( `ID_personne` int(11) NOT NULL, `ID_texte` int(11) NOT NULL, `date_envoi` datetime NOT NULL, + `time_insert` int(11) DEFAULT NULL, `commentaire` varchar(255) NOT NULL, `image_commentaire` longtext NOT NULL, PRIMARY KEY (`ID`)