Commit 8974c1ea authored by Excody's avatar Excody

Fix DB.php

Hello! In this file i fixed bug with new and left chat participant.
parent f11c153c
...@@ -480,24 +480,19 @@ class DB ...@@ -480,24 +480,19 @@ class DB
} else { } else {
$forward_from = null; $forward_from = null;
} }
//Insert the new chat user if ($new_chat_participant) {
if (is_object($new_chat_participant)) { //Insert the new chat user
self::insertUser($new_chat_participant, $date, $chat); self::insertUser($new_chat_participant, $date, $chat);
$new_chat_participant = $new_chat_participant->getId(); $new_chat_participant = $new_chat_participant->getId();
} else { } elseif($left_chat_participant) {
$new_chat_participant = ''; //Insert the left chat user
}
//Insert the left chat user
if (is_object($left_chat_participant)) {
self::insertUser($left_chat_participant, $date, $chat); self::insertUser($left_chat_participant, $date, $chat);
$left_chat_participant = $left_chat_participant->getId(); $left_chat_participant = $left_chat_participant->getId();
} else {
$left_chat_participant = '';
} }
try { try {
//Messages Table //Messages Table
$sth = self::$pdo->prepare('INSERT IGNORE INTO `'.TB_MESSAGE.'` $sth = self::$pdo->prepare('INSERT IGNORE INTO `'.TB_MESSAGE.'`
...@@ -576,8 +571,8 @@ class DB ...@@ -576,8 +571,8 @@ class DB
$sth->bindParam(':caption', $caption, \PDO::PARAM_STR); $sth->bindParam(':caption', $caption, \PDO::PARAM_STR);
$sth->bindParam(':contact', $contact, \PDO::PARAM_STR); $sth->bindParam(':contact', $contact, \PDO::PARAM_STR);
$sth->bindParam(':location', $location, \PDO::PARAM_STR); $sth->bindParam(':location', $location, \PDO::PARAM_STR);
$sth->bindParam(':new_chat_participant', $new_chat_paticipant, \PDO::PARAM_INT); $sth->bindParam(':new_chat_participant', $new_chat_participant, \PDO::PARAM_INT);
$sth->bindParam(':left_chat_participant', $left_chat_paticipant, \PDO::PARAM_INT); $sth->bindParam(':left_chat_participant', $left_chat_participant, \PDO::PARAM_INT);
$sth->bindParam(':new_chat_title', $new_chat_title, \PDO::PARAM_STR); $sth->bindParam(':new_chat_title', $new_chat_title, \PDO::PARAM_STR);
//Array of Photosize //Array of Photosize
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment