Ejemplo n.º 1
0
 public static function isUserInChat($chatId, $userId)
 {
     $db = Mdb::GetConnection();
     $collection = $db->selectCollection(Mdb::$dbname, 'chat');
     $result = $collection->findOne(['_id' => intval($chatId), 'members' => ['$all' => [intval($userId)]]], ['_id' => true]);
     return empty($result) ? false : true;
 }
Ejemplo n.º 2
0
 public static function setLanguage($lng)
 {
     $db = Mdb::GetConnection();
     $collection = $db->selectCollection(Mdb::$dbname, 'user');
     $result = $collection->update(['_id' => self::getUserId()], ['$set' => ['lng' => $lng]]);
 }