diff --git a/controllers/discussions.php b/controllers/discussions.php index bba8d38..d1be75c 100755 --- a/controllers/discussions.php +++ b/controllers/discussions.php @@ -82,8 +82,8 @@ foreach ($sendeds as $sended) { $messages[] = array( - 'date' => $sended['at'], - 'text' => $sended['content'], + 'date' => htmlspecialchars($sended['at']), + 'text' => htmlspecialchars($sended['content']), 'type' => 'sended', ); } @@ -91,8 +91,8 @@ foreach ($receiveds as $received) { $messages[] = array( - 'date' => $received['at'], - 'text' => $received['content'], + 'date' => htmlspecialchars($received['at']), + 'text' => htmlspecialchars($received['content']), 'type' => 'received', ); } @@ -100,8 +100,8 @@ foreach ($scheduleds as $scheduled) { $messages[] = array( - 'date' => $scheduled['at'], - 'text' => $scheduled['content'], + 'date' => htmlspecialchars($scheduled['at']), + 'text' => htmlspecialchars($scheduled['content']), 'type' => 'inprogress', ); } @@ -111,6 +111,9 @@ return strtotime($a["date"]) - strtotime($b["date"]); }); + //On récupère uniquement les 25 derniers messages sur l'ensemble + $messages = array_slice($messages, -25); + echo json_encode(['transactionId' => $transactionId, 'messages' => $messages]); return true; } diff --git a/templates/discussions/show.php b/templates/discussions/show.php index 67ce0d0..519bf12 100755 --- a/templates/discussions/show.php +++ b/templates/discussions/show.php @@ -71,8 +71,8 @@ var texte = '' + '
'; break; @@ -80,8 +80,8 @@ var texte = '' + ' '; break; @@ -90,8 +90,8 @@ ' '; break;