$udte = true; // It's a single message that should be replaced with the existing one } else { $sql = $OP->dbh->prepare("INSERT INTO chat (`uid`, `fid`, `msg`, `posted`) VALUES (?, ?, ?, NOW())"); $sql->execute(array($who, $to, $msg)); } if (get("status", $to) == "off") { // if friend is offline $OP->notify("msg", $msg, 0, $to, $who); } $sql = $OP->dbh->prepare("SELECT `id` FROM `chat` WHERE `uid` = ? AND `fid` = ? ORDER BY `id` DESC LIMIT 1"); $sql->execute(array($who, $to)); while ($r = $sql->fetch()) { $cid = $r['id']; } $html = $OP->rendFilt(Render::chat($to, $cid)); ?> p="<?php echo $html; ?> "; <?php if ($udte == false) { ?> if($("#<?php echo $to; ?> .msgs .msg").length == 0){ $("#<?php echo $to; ?>
$(".msggt").show(); <?php } ?> open.chat.scrollToEnd(); } <?php } } } elseif (isset($_POST['all']) && $_POST['all'] == "true" && $to != "gadget") { $sql = $OP->dbh->prepare("SELECT fid FROM conn WHERE uid=:who AND fid=:fid AND uid IN (SELECT fid FROM conn WHERE uid=:fid)"); $sql->execute(array(":who" => $who, ":fid" => $to)); if ($sql->rowCount() == 0) { $OP->ser(); } $ht = $OP->rendFilt(Render::chat($to, true)); ?> $("#<?php echo $to; ?> .msgs").html("<?php echo $ht; ?> "); open.chat.scrollToEnd(); t=$(".users #<?php echo $to; ?> .user"); t.css({background:"white",color:"black"}); t.attr("title", "Unread Messages");
<?php if (loggedIn) { ?> <div class="chatgt"> <div class="msggt"> <div class="close">x</div> <div class="chattop"> <a id="cwinopen" href="chat/">Chat</a> </div> <?php require_once "inc/render.php"; ?> <?php echo Render::chat("gadget"); ?> </div> <div class="usersgt"> <div class="cusgt"> <div class="close">x</div> <img src="<?php echo get("avatar"); ?> "/> <div class="otd"> <a href="<?php echo Open::URL("profile"); ?> "><?php echo get("name", $who, false); ?>
<?php if ($sql->rowCount() != 0 && $friendID != "") { $pLink = get("plink", $friendID); $fName = get("name", $friendID, false); echo "Chat | <a href='{$pLink}'>{$fName}</a>"; } ?> </div> <div class="chatLoader"> <?php if ($friendID != "") { if ($sql->rowCount() == 0) { if ($friendID == $who) { echo "<h2>Uh... It's you</h2><p>Why do you want to chat with yourself ?</p>"; } else { echo "<h2>Not Friends</h2><p>You and {$friendID} are not friends.</p>"; } } else { require_once "{$docRoot}/inc/render.php"; echo Render::chat($friendID); } } else { echo "<h2>No User Selected</h2>To see messages, choose a person seen on the left table."; } ?> </div> </div> </div> </div> </body> </html>