$uname = $result[0]['username']; if ($user_id) { $sql = "SELECT * from user_like where liked_by=:user_id and liked_to=:user_id2"; $sth = $conn->prepare($sql); $sth->bindValue('user_id', $user_id); $sth->bindValue('user_id2', $user_id2); try { $sth->execute(); } catch (Exception $e) { } $likes = $sth->fetchAll(); $other_like_status = GeneralFunctions::getLikeStatus($user_id, $user_id2); $push_check = GeneralFunctions::PushCheck($user_id2); $new_match = $push_check[0]['new_matches']; //push notification code $user = GeneralFunctions::get_push_ids($user_id2); $apnid = $user[0]['apn_id']; $oid = $user[0]['id']; $reg_ids[] = $user[0]['reg_id']; $message = array(); $message['msg'] = $uname . ' and you have a match'; $message['type'] = 'match'; //match-push $message['uid'] = $user_id; $type = 'match'; if (count($likes)) { $sql = "UPDATE user_like set status=:status where liked_by=:user_id and liked_to=:user_id2"; $sth = $conn->prepare($sql); $sth->bindValue('user_id', $user_id); $sth->bindValue('user_id2', $user_id2); $sth->bindValue('status', $flag);
} } else { $video_name = ""; } $data = Messages::saveUserMessage($user_id, $other_id, $message, $image_name, $video_name, $message_type); if ($data) { $success = "1"; $msg = "Message Sent"; $messages = Messages::getRecUserMessagesAfter($user_id, $other_id, $message_id); $data = $messages ? $messages : []; //push check $push_check = GeneralFunctions::PushCheck($other_id); $push_notif = $push_check[0]['push_notification']; if ($push_notif) { //push notification code $user = GeneralFunctions::get_push_ids($other_id); $apnid = $user[0]['apn_id']; $oid = $user[0]['id']; $reg_ids[] = $user[0]['reg_id']; $message = array(); $message['msg'] = $uname . ' sent you a message'; $message['type'] = 'message'; //message-push $message['uid'] = $user_id; $type = 'message'; if (!empty($reg_ids)) { GCM::send_notification($reg_ids, $message); } if (!empty($apnid)) { try { $apns->newMessage($apnid);