function invite() { global $userid; global $chatrooms_language; global $language; global $embed; global $embedcss; global $guestsMode; global $basedata; global $cookiePrefix; global $chromeReorderFix; global $hideOffline; global $plugins; $status['available'] = $language[30]; $status['busy'] = $language[31]; $status['offline'] = $language[32]; $status['invisible'] = $language[33]; $status['away'] = $language[34]; $id = $_GET['roomid']; $inviteid = $_GET['inviteid']; $roomname = $_GET['roomname']; $popoutmode = $_GET['popoutmode']; $time = getTimeStamp(); $sql = "select GROUP_CONCAT(userid) bannedusers from cometchat_chatrooms_users where ( isbanned=1 or ('" . mysqli_real_escape_string($GLOBALS['dbh'], $time) . "' - cometchat_chatrooms_users.lastactivity < " . ONLINE_TIMEOUT . ") ) and chatroomid='" . mysqli_real_escape_string($GLOBALS['dbh'], $id) . "' "; $query = mysqli_query($GLOBALS['dbh'], $sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysqli_error($GLOBALS['dbh']); } $result = mysqli_fetch_assoc($query); $bannedUsers = explode(',', $result['bannedusers']); $onlineCacheKey = 'all_online'; if ($userid > 10000000) { $onlineCacheKey .= 'guest'; } if (!is_array($buddyList = getCache($onlineCacheKey))) { $buddyList = array(); $sql = getFriendsList($userid, $time); if ($guestsMode) { $sql = getGuestsList($userid, $time, $sql); } $query = mysqli_query($GLOBALS['dbh'], $sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysqli_error($GLOBALS['dbh']); } while ($chat = mysqli_fetch_assoc($query)) { if ($time - processTime($chat['lastactivity']) < ONLINE_TIMEOUT && $chat['status'] != 'invisible' && $chat['status'] != 'offline' || $chat['isdevice'] == 1) { if ($chat['status'] != 'busy' && $chat['status'] != 'away') { $chat['status'] = 'available'; } } else { $chat['status'] = 'offline'; } $avatar = getAvatar($chat['avatar']); if (!empty($chat['username'])) { if (function_exists('processName')) { $chat['username'] = processName($chat['username']); } if (!in_array($chat['userid'], $bannedUsers) && $chat['userid'] != $userid && ($hideOffline == 0 || $hideOffline == 1 && $chat['status'] != 'offline')) { $buddyList[$chromeReorderFix . $chat['userid']] = array('id' => $chat['userid'], 'n' => $chat['username'], 'a' => $avatar, 's' => $chat['status']); } } } } if (DISPLAY_ALL_USERS == 0 && MEMCACHE != 0 && USE_CCAUTH == 0) { $tempBuddyList = array(); if (!is_array($friendIds = getCache('friend_ids_of_' . $userid))) { $friendIds = array(); $sql = getFriendsIds($userid); $query = mysqli_query($GLOBALS['dbh'], $sql); if (mysqli_num_rows($query) == 1) { $buddy = mysqli_fetch_assoc($query); $friendIds = explode(',', $buddy['friendid']); } else { while ($buddy = mysqli_fetch_assoc($query)) { $friendIds[] = $buddy['friendid']; } } setCache('friend_ids_of_' . $userid, $friendIds, 30); } foreach ($friendIds as $friendId) { $friendId = $chromeReorderFix . $friendId; if (!empty($buddyList[$friendId])) { $tempBuddyList[$friendId] = $buddyList[$friendId]; } } $buddyList = $tempBuddyList; } if (function_exists('hooks_forcefriends') && is_array(hooks_forcefriends())) { $buddyList = array_merge(hooks_forcefriends(), $buddyList); } $blockList = array(); if (in_array('block', $plugins)) { $blockedIds = getBlockedUserIDs(); foreach ($blockedIds as $bid) { array_push($blockList, $bid); if (isset($buddyList[$chromeReorderFix . $bid])) { unset($buddyList[$chromeReorderFix . $bid]); } } } $s['available'] = ''; $s['away'] = ''; $s['busy'] = ''; $s['offline'] = ''; foreach ($buddyList as $buddy) { if ($buddy['id'] != $userid) { $s[$buddy['s']] .= '<div class="invite_1"><div class="invite_2" onclick="javascript:document.getElementById(\'check_' . $buddy['id'] . '\').checked = document.getElementById(\'check_' . $buddy['id'] . '\').checked?false:true;"><img height=30 width=30 src="' . $buddy['a'] . '" /></div><div class="invite_3" onclick="javascript:document.getElementById(\'check_' . $buddy['id'] . '\').checked = document.getElementById(\'check_' . $buddy['id'] . '\').checked?false:true;"><span class="invite_name">' . $buddy['n'] . '</span><br/><span class="invite_5">' . $status[$buddy['s']] . '</span></div><input type="checkbox" name="invite[]" value="' . $buddy['id'] . '" id="check_' . $buddy['id'] . '" class="invite_4" /></div>'; } } $inviteContent = ''; $invitehide = ''; $inviteContent = $s['available'] . "" . $s['away'] . "" . $s['offline']; if (empty($inviteContent)) { $inviteContent = $chatrooms_language[45]; $invitehide = 'style="display:none;"'; } echo <<<EOD <!DOCTYPE html> <html> \t<head> \t\t<title>{$chatrooms_language[22]}</title> \t\t<meta http-equiv="content-type" content="text/html; charset=utf-8"/> \t\t<link type="text/css" rel="stylesheet" media="all" href="../../css.php?type=module&name=chatrooms" /> \t</head> \t<body> \t\t<form method="post" action="chatrooms.php?action=inviteusers&embed={$embed}&basedata={$basedata}"> \t\t\t<div class="container"> \t\t\t\t<div class="container_title {$embedcss}">{$chatrooms_language[21]}</div> \t\t\t\t<div class="container_body {$embedcss}"> \t\t\t\t\t{$inviteContent} \t\t\t\t\t<div style="clear:both"></div> \t\t\t\t</div> \t\t\t\t<div class="container_sub {$embedcss}" {$invitehide}> \t\t\t\t\t<input type=submit value="{$chatrooms_language[20]}" class="invitebutton" /> \t\t\t\t</div> \t\t\t</div> \t\t\t<input type="hidden" name="roomid" value="{$id}" /> \t\t\t<input type="hidden" name="inviteid" value="{$inviteid}" /> \t\t\t<input type="hidden" name="roomname" value="{$roomname}" /> \t\t</form> \t</body> </html> EOD; }
function publishCometMessages($broadcast, $id) { global $userid; global $plugins; global $blockpluginmode; if (in_array('block', $plugins)) { $blockedIds = getBlockedUserIDs(0, 1); for ($i = 0; $i < sizeof($broadcast); $i++) { if ($blockpluginmode == 1 && in_array($broadcast[$i]['to'], $blockedIds)) { if ($broadcast[$i]['dir'] == 1) { $broadcast[$i]['dir'] = 3; } else { $broadcast[$i]['dir'] = 2; } } else { if (in_array($broadcast[$i]['to'], $blockedIds)) { array_splice($broadcast, $i, 1); } } } } $sizeof_broadcast = sizeof($broadcast); for ($i = 0; $i < $sizeof_broadcast; $i++) { $insertedid = $id + $i; $key = ''; if (defined('KEY_A') && defined('KEY_B') && defined('KEY_C')) { $key = KEY_A . KEY_B . KEY_C; } $key_prefix = $broadcast[$i]['dir'] === 2 ? $userid : $broadcast[$i]['to']; $from = $broadcast[$i]['dir'] === 2 ? $broadcast[$i]['to'] : $userid; $self = $broadcast[$i]['dir'] === 2 ? 1 : 0; $channel = md5($key_prefix . $key); $comet = new Comet(KEY_A, KEY_B); if (method_exists($comet, 'processChannel')) { $channel = processChannel($channel); } if ($broadcast[$i]['dir'] != 3 && empty($broadcast[$i]['type'])) { $info = $comet->publish(array('channel' => $channel, 'message' => array("id" => $insertedid, "from" => $from, "message" => $broadcast[$i]['message'], "sent" => getTimeStamp(), "self" => $self, "direction" => $broadcast[$i]['dir']))); } else { $channel = md5($userid . $key); $self = 1; $from = $broadcast[$i]['to']; $info = $comet->publish(array('channel' => $channel, 'message' => array("id" => $insertedid, "from" => $from, "message" => $broadcast[$i]['message'], "sent" => getTimeStamp(), "self" => $self, "direction" => $broadcast[$i]['dir']))); } if ($broadcast[$i]['dir'] != 1 || $broadcast[$i]['dir'] != 3 && empty($broadcast[$i]['type'])) { $key_prefix = $userid; $from = $broadcast[$i]['to']; $channel = md5($key_prefix . $key); $self = 1; $info = $comet->publish(array('channel' => $channel, 'message' => array("id" => $insertedid, "from" => $from, "message" => $broadcast[$i]['message'], "sent" => getTimeStamp(), "self" => $self, "direction" => 0))); } if (function_exists('hooks_message')) { hooks_message($userid, $broadcast[$i]['to'], $broadcast[$i]['message'], $broadcast[$i]['dir']); } } }
function publishCometMessages($broadcast, $id) { global $userid; global $plugins; if (in_array('block', $plugins)) { $blockedIds = getBlockedUserIDs(); foreach ($broadcast as $tokey => $tovalue) { if (in_array($tovalue['to'], $blockedIds)) { array_splice($broadcast, $tokey, 1); } } } $sizeof_broadcast = sizeof($broadcast); for ($i = 0; $i < $sizeof_broadcast; $i++) { $insertedid = $id + $i; $key = ''; if (defined('KEY_A') && defined('KEY_B') && defined('KEY_C')) { $key = KEY_A . KEY_B . KEY_C; } $key_prefix = $broadcast[$i]['dir'] === 2 ? $userid : $broadcast[$i]['to']; $from = $broadcast[$i]['dir'] === 2 ? $broadcast[$i]['to'] : $userid; $self = $broadcast[$i]['dir'] === 2 ? 1 : 0; $channel = md5($key_prefix . $key); $comet = new Comet(KEY_A, KEY_B); $info = $comet->publish(array('channel' => $channel, 'message' => array("id" => $insertedid, "from" => $from, "message" => $broadcast[$i]['message'], "sent" => getTimeStamp(), "self" => $self))); if (function_exists('hooks_message')) { hooks_message($userid, $broadcast[$i]['to'], $broadcast[$i]['message']); } } }
function userSelection($silent = 0) { $baseUrl = BASE_URL; global $userid; global $broadcastmessage_language; global $language; global $embed; global $embedcss; global $guestsMode; global $basedata; global $sleekScroller; global $inviteContent; global $chromeReorderFix; global $hideOffline; global $plugins; $status['available'] = $language[30]; $status['busy'] = $language[31]; $status['offline'] = $language[32]; $status['invisible'] = $language[33]; $status['away'] = $language[34]; $time = getTimeStamp(); $onlineCacheKey = 'all_online'; if ($userid > 10000000) { $onlineCacheKey .= 'guest'; } if (!is_array($buddyList = getCache($onlineCacheKey))) { $buddyList = array(); $sql = getFriendsList($userid, $time); if ($guestsMode) { $sql = getGuestsList($userid, $time, $sql); } $query = mysqli_query($GLOBALS['dbh'], $sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysqli_error($GLOBALS['dbh']); } while ($chat = mysqli_fetch_assoc($query)) { if ($time - processTime($chat['lastactivity']) < ONLINE_TIMEOUT && $chat['status'] != 'invisible' && $chat['status'] != 'offline' || $chat['isdevice'] == 1) { if ($chat['status'] != 'busy' && $chat['status'] != 'away') { $chat['status'] = 'available'; } } else { $chat['status'] = 'offline'; } $avatar = getAvatar($chat['avatar']); if (!empty($chat['username'])) { if (function_exists('processName')) { $chat['username'] = processName($chat['username']); } if ($chat['userid'] != $userid && ($hideOffline == 0 || $hideOffline == 1 && $chat['status'] != 'offline')) { $buddyList[$chromeReorderFix . $chat['userid']] = array('id' => $chat['userid'], 'n' => $chat['username'], 'a' => $avatar, 's' => $chat['status']); } } } } if (DISPLAY_ALL_USERS == 0 && MEMCACHE != 0 && USE_CCAUTH == 0) { $tempBuddyList = array(); if (!is_array($friendIds = getCache('friend_ids_of_' . $userid))) { $friendIds = array(); $sql = getFriendsIds($userid); $query = mysqli_query($GLOBALS['dbh'], $sql); if (mysqli_num_rows($query) == 1) { $buddy = mysqli_fetch_assoc($query); $friendIds = explode(',', $buddy['friendid']); } else { while ($buddy = mysqli_fetch_assoc($query)) { $friendIds[] = $buddy['friendid']; } } setCache('friend_ids_of_' . $userid, $friendIds, 30); } foreach ($friendIds as $friendId) { $friendId = $chromeReorderFix . $friendId; if (isset($buddyList[$friendId])) { $tempBuddyList[$friendId] = $buddyList[$friendId]; } } $buddyList = $tempBuddyList; } if (function_exists('hooks_forcefriends') && is_array(hooks_forcefriends())) { $buddyList = array_merge(hooks_forcefriends(), $buddyList); } $blockList = array(); if (in_array('block', $plugins)) { $blockedIds = getBlockedUserIDs(); foreach ($blockedIds as $bid) { array_push($blockList, $bid); if (isset($buddyList[$chromeReorderFix . $bid])) { unset($buddyList[$chromeReorderFix . $bid]); } } } if (isset($buddyList[$chromeReorderFix . $userid])) { unset($buddyList[$chromeReorderFix . $userid]); } if (empty($silent)) { $buddyOrder = array(); $buddyGroup = array(); $buddyStatus = array(); $buddyName = array(); $buddyGuest = array(); foreach ($buddyList as $key => $row) { if (empty($row['g'])) { $row['g'] = ''; } $buddyGroup[$key] = strtolower($row['g']); $buddyStatus[$key] = strtolower($row['s']); $buddyName[$key] = strtolower($row['n']); if ($row['g'] == '') { $buddyOrder[$key] = 1; } else { $buddyOrder[$key] = 0; } $buddyGuest[$key] = 0; if ($row['id'] > 10000000) { $buddyGuest[$key] = 1; } } array_multisort($buddyOrder, SORT_ASC, $buddyGroup, SORT_STRING, $buddyStatus, SORT_STRING, $buddyGuest, SORT_ASC, $buddyName, SORT_STRING, $buddyList); $response['buddyList'] = $buddyList; $response['status'] = $status; } else { $s['available'] = ''; $s['away'] = ''; $s['busy'] = ''; $s['offline'] = ''; foreach ($buddyList as $buddy) { $s[$buddy['s']] .= '<div class="invite_1"><div class="invite_2" onclick="javascript:document.getElementById(\'check_' . $buddy['id'] . '\').checked = document.getElementById(\'check_' . $buddy['id'] . '\').checked?false:true;"><img height=30 width=30 src="' . $buddy['a'] . '" /></div><div class="invite_3" onclick="javascript:document.getElementById(\'check_' . $buddy['id'] . '\').checked = document.getElementById(\'check_' . $buddy['id'] . '\').checked?false:true;"><span class="invite_name">' . $buddy['n'] . '</span><br/><span class="invite_5">' . $status[$buddy['s']] . '</span></div><input type="checkbox" name="to[]" value="' . $buddy['id'] . '" id="check_' . $buddy['id'] . '" class="invite_4" /></div>'; } $inviteContent = ''; $invitehide = ''; $inviteContent = $s['available'] . "" . $s['away'] . "" . $s['offline']; if (empty($inviteContent)) { $inviteContent = '<div style= "padding-top:6px">' . $broadcastmessage_language[2] . '</div>'; $invitehide = 'style="display:none;"'; } } if (empty($silent)) { header('content-type: application/json; charset=utf-8'); echo $_GET['callback'] . '(' . json_encode($response) . ')'; } else { return $inviteContent; } }
function getBuddyList() { global $response; global $userid; global $db; global $status; global $hideOffline; global $plugins; global $guestsMode; global $cookiePrefix; global $chromeReorderFix; $time = getTimeStamp(); if (empty($_SESSION['cometchat']['cometchat_buddytime']) || $_REQUEST['initialize'] == 1 || $_REQUEST['f'] == 1 || !empty($_SESSION['cometchat']['cometchat_buddytime']) && ($time - $_SESSION['cometchat']['cometchat_buddytime'] >= REFRESH_BUDDYLIST || MEMCACHE != 0)) { if ($_REQUEST['initialize'] == 1 && !empty($_SESSION['cometchat']['cometchat_buddyblh']) && $time - $_SESSION['cometchat']['cometchat_buddytime'] < REFRESH_BUDDYLIST) { $response['buddylist'] = $_SESSION['cometchat']['cometchat_buddyresult']; $response['blh'] = $_SESSION['cometchat']['cometchat_buddyblh']; } else { $onlineCacheKey = 'all_online'; if ($userid > 10000000) { $onlineCacheKey .= 'guest'; } if (!is_array($buddyList = getCache($onlineCacheKey))) { $buddyList = array(); $sql = getFriendsList($userid, $time); if ($guestsMode) { $sql = getGuestsList($userid, $time, $sql); } $query = mysqli_query($GLOBALS['dbh'], $sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysqli_error($GLOBALS['dbh']); } while ($chat = mysqli_fetch_assoc($query)) { if (($time - processTime($chat['lastactivity']) < ONLINE_TIMEOUT || $chat['isdevice'] == 1) && $chat['status'] != 'invisible' && $chat['status'] != 'offline') { if ($chat['status'] != 'busy' && $chat['status'] != 'away') { $chat['status'] = 'available'; } } else { $chat['status'] = 'offline'; } if ($chat['message'] == null) { $chat['message'] = $status[$chat['status']]; } $link = fetchLink($chat['link']); $avatar = getAvatar($chat['avatar']); if (function_exists('processName')) { $chat['username'] = processName($chat['username']); } if (empty($chat['isdevice'])) { $chat['isdevice'] = "0"; } if (empty($chat['grp'])) { $chat['grp'] = ''; } if (!empty($chat['username']) && ($hideOffline == 0 || $hideOffline == 1 && $chat['status'] != 'offline')) { $buddyList[$chromeReorderFix . $chat['userid']] = array('id' => $chat['userid'], 'n' => $chat['username'], 'l' => $link, 'a' => $avatar, 'd' => $chat['isdevice'], 's' => $chat['status'], 'm' => $chat['message'], 'g' => $chat['grp']); } } setCache($onlineCacheKey, $buddyList, 30); } if (DISPLAY_ALL_USERS == 0 && MEMCACHE != 0 && USE_CCAUTH == 0) { $tempBuddyList = array(); if (!is_array($friendIds = getCache('friend_ids_of_' . $userid))) { $friendIds = array(); $sql = getFriendsIds($userid); $query = mysqli_query($GLOBALS['dbh'], $sql); if (mysqli_num_rows($query) == 1) { $buddy = mysqli_fetch_assoc($query); $friendIds = explode(',', $buddy['friendid']); } else { while ($buddy = mysqli_fetch_assoc($query)) { $friendIds[] = $buddy['friendid']; } } setCache('friend_ids_of_' . $userid, $friendIds, 30); } foreach ($friendIds as $friendId) { $friendId = $chromeReorderFix . $friendId; if (!empty($buddyList[$friendId])) { $tempBuddyList[$friendId] = $buddyList[$friendId]; } } $buddyList = $tempBuddyList; } $blockList = array(); if (in_array('block', $plugins)) { $blockedIds = getBlockedUserIDs(); foreach ($blockedIds as $bid) { array_push($blockList, $bid); if (!empty($buddyList[$chromeReorderFix . $bid])) { unset($buddyList[$chromeReorderFix . $bid]); } } } if (!empty($buddyList[$chromeReorderFix . $userid])) { unset($buddyList[$chromeReorderFix . $userid]); } if (function_exists('hooks_forcefriends') && is_array(hooks_forcefriends())) { $buddyList = array_merge(hooks_forcefriends(), $buddyList); } $buddyOrder = array(); $buddyGroup = array(); $buddyStatus = array(); $buddyName = array(); $buddyGuest = array(); foreach ($buddyList as $key => $row) { if (empty($row['g'])) { $row['g'] = ''; } $buddyGroup[$key] = strtolower($row['g']); $buddyStatus[$key] = strtolower($row['s']); $buddyName[$key] = strtolower($row['n']); if ($row['g'] == '') { $buddyOrder[$key] = 1; } else { $buddyOrder[$key] = 0; } $buddyGuest[$key] = 0; if ($row['id'] > 10000000) { $buddyGuest[$key] = 1; } } array_multisort($buddyOrder, SORT_ASC, $buddyGroup, SORT_STRING, $buddyStatus, SORT_STRING, $buddyGuest, SORT_ASC, $buddyName, SORT_STRING, $buddyList); $_SESSION['cometchat']['cometchat_buddytime'] = $time; $blh = md5(serialize($buddyList)); if (empty($_REQUEST['blh']) || !empty($_REQUEST['blh']) && $blh != $_REQUEST['blh']) { $response['buddylist'] = $buddyList; $response['blh'] = $blh; } $_SESSION['cometchat']['cometchat_buddyresult'] = $buddyList; $_SESSION['cometchat']['cometchat_buddyblh'] = $blh; } } }
function inviteusers() { global $chatrooms_language; global $close; global $embedcss; $post_roomid = mysqli_real_escape_string($GLOBALS['dbh'], $_POST['roomid']); $post_inviteid = mysqli_real_escape_string($GLOBALS['dbh'], $_POST['inviteid']); $post_roomname = mysqli_real_escape_string($GLOBALS['dbh'], $_POST['roomname']); if (!empty($_REQUEST['invite'])) { $blockedIds = getBlockedUserIDs(); foreach ($blockedIds as $bid) { if (in_array($bid, $_REQUEST['invite'])) { unset($_REQUEST['invite'][array_search($bid, $_REQUEST['invite'])]); } } foreach ($_REQUEST['invite'] as $user) { $chatroomroomname = base64_decode(rawurldecode($_POST['roomname'])); $response = sendMessage($user, "{$chatrooms_language[18]}{$chatroomroomname}. <a href=\"javascript:jqcc.cometchat.joinChatroom('{$post_roomid}','{$post_inviteid}','{$post_roomname}')\">{$chatrooms_language[19]}</a>", 1); addUsersToChatroom($post_roomid, $user); $processedMessage = $_SESSION['cometchat']['user']['n'] . ": " . "has invited you to join " . $_SESSION['cometchat']['chatroom']['n']; if ($response != '') { pushMobileNotification($user, $response['id'], $processedMessage); } } } echo <<<EOD <!DOCTYPE html> <html> \t<head> \t\t<title>{$chatrooms_language[18]}</title> \t\t<meta name="viewport" content="user-scalable=0,width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0" /> \t\t<meta http-equiv="content-type" content="text/html; charset=utf-8"/> \t\t<link type="text/css" rel="stylesheet" media="all" href="../../css.php?type=module&name=chatrooms" /> \t\t<script type="text/javascript"> \t\t\tfunction closePopup(name){ \t\t\t\tvar controlparameters = {'type':'modules', 'name':'chatrooms', 'method':'closeCCPopup', 'params':{'name':'invite'}}; \t\t\t\tcontrolparameters = JSON.stringify(controlparameters); \t\t\t\tif(typeof(parent) != 'undefined' && parent != null && parent != self){ \t\t\t\t\tparent.postMessage('CC^CONTROL_'+controlparameters,'*'); \t\t\t\t} else { \t\t\t\t\twindow.close(); \t\t\t\t} \t\t\t} \t\t</script> \t</head> \t<body onload="{$close}"> \t\t<div class="cometchat_wrapper"> \t\t\t<div class="container_title {$embedcss}">{$chatrooms_language[21]}</div> \t\t\t<div class="container_body {$embedcss}"> \t\t\t\t{$chatrooms_language[16]} \t\t\t\t<div style="clear:both"></div> \t\t\t</div> \t\t</div> \t</body> </html> EOD; }
/* CometChat Copyright (c) 2016 Inscripts License: https://www.cometchat.com/legal/license */ include_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "plugins.php"; include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "lang" . DIRECTORY_SEPARATOR . "en.php"; if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lang" . DIRECTORY_SEPARATOR . $lang . ".php")) { include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "lang" . DIRECTORY_SEPARATOR . $lang . ".php"; } if ($p_ < 1) { exit; } if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'block') { $blockedIds = getBlockedUserIDs(); $id = mysqli_real_escape_string($GLOBALS['dbh'], $_REQUEST['to']); if (!in_array($id, $blockedIds)) { $sql = "insert into cometchat_block (fromid, toid) values ('" . mysqli_real_escape_string($GLOBALS['dbh'], $userid) . "','" . mysqli_real_escape_string($GLOBALS['dbh'], $id) . "')"; $query = mysqli_query($GLOBALS['dbh'], $sql); removeCache('blocked_id_of_' . $userid); removeCache('blocked_id_of_' . $id); removeCache('blocked_id_of_receive_' . $userid); removeCache('blocked_id_of_receive_' . $id); $response = array(); $response['id'] = $id; $error = mysqli_error($GLOBALS['dbh']); if (!empty($error)) { $response['result'] = "0"; header('content-type: application/json; charset=utf-8'); $response['error'] = mysqli_error($GLOBALS['dbh']);