From 9731f3b6328307670aabf2550cce0ee00f06a561 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 13 May 2018 13:25:43 +0200 Subject: [PATCH] Improve posts datation --- classes/components/posts.php | 3 ++- db_struct.sql | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/components/posts.php b/classes/components/posts.php index 4104f00..417a0ac 100644 --- a/classes/components/posts.php +++ b/classes/components/posts.php @@ -425,6 +425,7 @@ class Posts { "ID_personne" => $post_user_id, "ID_amis" => $post_friend_id, "date_envoi" => mysql_date(), + "time_insert" => time(), "texte" => $post->has_content() ? $post->get_content() : "", "niveau_visibilite" => $post->get_visibility_level(), "type" => $post_kind_db, @@ -684,7 +685,7 @@ class Posts { $post->set_id($entry["ID"]); $post->set_userID($entry["ID_amis"] == 0 ? $entry["ID_personne"] : $entry["ID_amis"]); $post->set_user_page_id($entry["ID_personne"]); - $post->set_time_sent(strtotime($entry["date_envoi"])); + $post->set_time_sent($entry["time_insert"] == null ? strtotime($entry["date_envoi"]) : $entry["time_insert"]); $post->set_content($entry["texte"]); $post->set_visibility_level($entry["niveau_visibilite"]); $post->set_kind($this::POSTS_DB_TYPES[$entry["type"]]); diff --git a/db_struct.sql b/db_struct.sql index ae8daf6..6e0a7d7 100644 --- a/db_struct.sql +++ b/db_struct.sql @@ -421,6 +421,7 @@ CREATE TABLE `texte` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `ID_personne` int(11) NOT NULL, `date_envoi` datetime NOT NULL, + `time_insert` int(11) DEFAULT NULL, `texte` text NOT NULL, `ID_amis` int(11) NOT NULL DEFAULT '0', `niveau_visibilite` varchar(255) NOT NULL DEFAULT '1',