function getBuddyList() { global $response; global $userid; global $db; global $status; global $hideOffline; global $plugins; global $guestsMode; global $cookiePrefix; global $chromeReorderFix; $time = getTimeStamp(); $buddyList = array(); 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 ($onlineUsers = getCache($cookiePrefix . $onlineCacheKey, 30)) { $buddyList = unserialize($onlineUsers); } else { $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['isdevice'] == 1) { $chat['status'] = 'available'; } } else { $chat['status'] = 'offline'; } if ($chat['message'] == null) { $chat['message'] = $status[$chat['status']]; } $link = fetchLink($chat['link']); $avatar = getAvatar($chat['userid']); if (function_exists('processName')) { $chat['username'] = processName($chat['username']); } 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($cookiePrefix . $onlineCacheKey, serialize($buddyList), 30); } if (DISPLAY_ALL_USERS == 0 && MEMCACHE != 0) { $tempBuddyList = array(); $friendIds = array(); if ($onlineFrnds = getCache($cookiePrefix . 'friend_ids_of_' . $userid, 30)) { $friendIds = unserialize($onlineFrnds); } else { $sql = getFriendsIds($userid); $res = mysqli_query($GLOBALS['dbh'], $sql); $result = mysqli_fetch_assoc($res); if (!empty($result['myfrndids'])) { $friendIds = explode(',', $result['myfrndids']); } setCache($cookiePrefix . 'friend_ids_of_' . $userid, serialize($friendIds), 30); } foreach ($friendIds as $friendId) { $friendId = $chromeReorderFix . $friendId; if (isset($buddyList[$friendId])) { $tempBuddyList[$friendId] = $buddyList[$friendId]; } } $buddyList = $tempBuddyList; } $blockList = array(); if (in_array('block', $plugins)) { $blockId = array(); if ($blockedUsers = getCache($cookiePrefix . 'blocked_id_of_' . $userid, 30)) { $blockId = unserialize($blockedUsers); } else { $sql = "select group_concat(blockedid) blockedids from (select fromid as blockedid from cometchat_block where toid = '" . mysqli_real_escape_string($GLOBALS['dbh'], $userid) . "' UNION select toid as blockedid from cometchat_block where fromid = '" . mysqli_real_escape_string($GLOBALS['dbh'], $userid) . "') as blocked"; $query = mysqli_query($GLOBALS['dbh'], $sql); $blockIds = mysqli_fetch_assoc($query); if (!empty($blockIds['blockedids'])) { $blockId = explode(',', $blockIds['blockedids']); } setCache($cookiePrefix . 'blocked_id_of_' . $userid, serialize($blockId), 3600); } foreach ($blockId 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 (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 invite() { global $userid; global $avchat_language; global $language; global $embed; global $embedcss; global $lightboxWindows; global $guestsMode; global $cookiePrefix; global $chromeReorderFix; if ($lightboxWindows == '1') { $embed = 'web'; $embedcss = 'embed'; } $status['available'] = $language[30]; $status['busy'] = $language[31]; $status['offline'] = $language[32]; $status['invisible'] = $language[33]; $status['away'] = $language[34]; $id = $_GET['roomid']; if (empty($id)) { exit; } $time = getTimeStamp(); $buddyList = array(); $onlineCacheKey = 'all_online'; if ($userid > 10000000) { $onlineCacheKey .= 'guest'; } if ($onlineUsers = getCache($cookiePrefix . $onlineCacheKey, 30)) { $buddyList = unserialize($onlineUsers); } else { $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) { $buddyList[$chromeReorderFix . $chat['userid']] = array('id' => $chat['userid'], 'n' => $chat['username'], 'a' => $avatar, 's' => $chat['status']); } } } } if (DISPLAY_ALL_USERS == 0 && MEMCACHE != 0) { $tempBuddyList = array(); if ($onlineFrnds = getCache($cookiePrefix . 'friend_ids_of_' . $userid, 30)) { $friendIds = unserialize($onlineFrnds); } else { $sql = getFriendsIds($userid); $res = mysqli_query($GLOBALS['dbh'], $sql); $result = mysqli_fetch_assoc($res); if (!empty($result['friends'])) { $friendIds = explode(',', $result['friends']); } setCache($cookiePrefix . 'friend_ids_of_' . $userid, serialize($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); } $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="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 = $avchat_language[25]; $invitehide = 'style="display:none;"'; } echo <<<EOD <!DOCTYPE html> <html> <head> <title>{$avchat_language[18]}</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <link type="text/css" rel="stylesheet" media="all" href="../../css.php?type=plugin&name=avchat" /> </head> <body> <form method="post" action="invite.php?action=inviteusers&embed={$embed}"> <div class="container"> \t<div class="container_title {$embedcss}">{$avchat_language[16]}</div> \t<div class="container_body {$embedcss}"> \t\t{$inviteContent} \t\t<div style="clear:both"></div> \t</div> \t<div class="container_sub" {$invitehide}> \t\t<input type=submit value="{$avchat_language[17]}" class="invitebutton"> \t</div> </div>\t <input type="hidden" name="roomid" value="{$id}"> </form> </body> </html> EOD; }
function getBuddyList() { global $response; global $userid; global $db; global $status; global $hideOffline; global $plugins; global $guestsMode; $time = getTimeStamp(); $buddyList = array(); if (empty($_SESSION['cometchat']['cometchat_buddytime']) || $_REQUEST['initialize'] == 1 || $_REQUEST['f'] == 1 || !empty($_SESSION['cometchat']['cometchat_buddytime']) && $time - $_SESSION['cometchat']['cometchat_buddytime'] >= REFRESH_BUDDYLIST) { 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 { $blockList = array(); if (in_array('block', $plugins)) { $sql = "(select toid as id from cometchat_block where fromid = '" . mysql_real_escape_string($userid) . "') union (select fromid as id from cometchat_block where toid = '" . mysql_real_escape_string($userid) . "') "; $query = mysql_query($sql); while ($user = mysql_fetch_array($query)) { array_push($blockList, $user['id']); } } $sql = getFriendsList($userid, $time); if ($guestsMode) { $sql = getGuestsList($userid, $time, $sql); } $query = mysql_query($sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysql_error(); } while ($chat = mysql_fetch_array($query)) { if (!in_array($chat['userid'], $blockList)) { if ($time - processTime($chat['lastactivity']) < ONLINE_TIMEOUT && $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 = getLink($chat['link']); $avatar = getAvatar($chat['avatar']); if (function_exists('processName')) { $chat['username'] = processName($chat['username']); } if (empty($chat['grp'])) { $chat['grp'] = ''; } if (!empty($chat['username']) && ($hideOffline == 0 || $hideOffline == 1 && $chat['status'] != 'offline')) { $buddyList[] = array('id' => $chat['userid'], 'n' => $chat['username'], 's' => $chat['status'], 'm' => $chat['message'], 'g' => $chat['grp'], 'a' => $avatar, 'l' => $link); } } } 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 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 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; global $blockpluginmode; global $bannedUserIDs; $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 && !defined('TAPATALK')) { $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)) || $_REQUEST['f'] == 1 || defined('TAPATALK')) { $buddyList = array(); $sql = getFriendsList($userid, $time); if ($guestsMode) { $sql = getGuestsList($userid, $time, $sql); } if (!empty($_REQUEST['activeChatboxIds'])) { $activeChatboxIds = "'" . str_replace(",", "','", $_REQUEST['activeChatboxIds']) . "'"; $sql = getActivechatboxdetails($activeChatboxIds) . " UNION " . $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 (in_array($chat['userid'], $bannedUserIDs)) { continue; } 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['ch'])) { if (defined('KEY_A') && defined('KEY_B') && defined('KEY_C')) { $key = KEY_A . KEY_B . KEY_C; } $chat['ch'] = md5($chat['userid'] . $key); } if (defined('TAPATALK')) { global $integration; $chat['message'] = $integration->hooks_processMessageBuddylist($chat['message']); } if (!empty($chat['username']) && ($hideOffline == 0 || $hideOffline == 1 && $chat['status'] != 'offline') || in_array($chat['userid'], explode(",", $_REQUEST['activeChatboxIds']))) { $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'], 'ls' => $chat['lastseen'], 'lstn' => $chat['lastseensetting'], 'ch' => $chat['ch']); } } 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) || $_REQUEST['f'] == 1)) { $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)) { if ($blockpluginmode == 1) { $blockedIds = getBlockedUserIDs(1); } else { $blockedIds = getBlockedUserIDs(); } foreach ($blockedIds as $bid) { array_push($blockList, $bid); if (!empty($buddyList[$chromeReorderFix . $bid])) { if ($blockpluginmode == 1) { if (defined('TAPATALK') && (!empty($_REQUEST['callbackfn']) && $_REQUEST['callbackfn'] == 'mobileapp')) { $buddyList[$chromeReorderFix . $bid]['s'] = 'banned'; } else { $buddyList[$chromeReorderFix . $bid]['s'] = 'blocked'; } } else { unset($buddyList[$chromeReorderFix . $bid]); } } } } if (!empty($buddyList[$chromeReorderFix . $userid])) { if (empty($_SESSION['cometchat']['user']) || !empty($_SESSION['cometchat']['user']) && $_SESSION['cometchat']['user']['s'] != $buddyList[$chromeReorderFix . $userid]['s']) { array_merge($_SESSION['cometchat']['user'], $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; } } if (!defined('TAPATALK')) { 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'] || $_REQUEST['f'] == 1) { $response['buddylist'] = $buddyList; $response['blh'] = $blh; } $_SESSION['cometchat']['cometchat_buddyresult'] = $buddyList; $_SESSION['cometchat']['cometchat_buddyblh'] = $blh; } } }
function loadChatroomPro() { global $chatrooms_language; global $language; global $embed; global $embedcss; global $userid; global $moderatorUserIDs; global $lightboxWindows; global $showchatbutton; global $chromeReorderFix; $close = 'setTimeout("window.close()",2000);'; $callbackfn = ''; if (!empty($_REQUEST['callbackfn'])) { $callbackfn = $_REQUEST['callbackfn']; } if (!empty($_GET['embed']) && $_GET['embed'] == 'web') { $embed = 'web'; $embedcss = 'embed'; $close = 'parent.closeCCPopup("loadChatroomPro");'; } $callerWindow = ''; if (!empty($_REQUEST['caller'])) { $callerWindow = $_REQUEST['caller']; } $id = mysqli_real_escape_string($GLOBALS['dbh'], $_GET['roomid']); $cc_theme = ''; if (!empty($_GET['cc_theme'])) { $cc_theme = '&cc_theme=' . $_GET['cc_theme']; } $uid = mysqli_real_escape_string($GLOBALS['dbh'], $_GET['inviteid']); $owner = $_GET['owner']; $apiAccess = 0; if (!empty($_GET['apiAccess']) && $_GET['apiAccess'] != 'undefined') { $apiAccess = $_GET['apiAccess']; } $options = ""; $status_area = ""; $popoutmode = $_GET['popoutmode']; $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)) || $force == 1) { $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); } if ($apiAccess && ($showchatbutton == '0' || $showchatbutton == '1' && array_key_exists($chromeReorderFix . $uid, $buddyList))) { $options = "<input type=button class='invitebutton chat' caller='" . $callerWindow . "' uid=" . $uid . " value='" . $chatrooms_language[43] . "' />"; } if ($owner == 1 || in_array($userid, $moderatorUserIDs)) { $sql = "select createdby from cometchat_chatrooms where id = '" . mysqli_real_escape_string($GLOBALS['dbh'], $id) . "' limit 1"; $query = mysqli_query($GLOBALS['dbh'], $sql); $room = mysqli_fetch_assoc($query); if (!in_array($uid, $moderatorUserIDs) && $uid != $room['createdby']) { $options = "<input type=button id='cc_kick' value='" . $chatrooms_language[40] . "' uid = " . $uid . " class='invitebutton kickBan'/>\n\t\t\t<input type=button id='cc_ban' value='" . $chatrooms_language[41] . "' uid = " . $uid . " class='invitebutton kickBan' />" . $options; } } if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysqli_error($GLOBALS['dbh']); } $sql = getUserDetails($uid); if ($uid > 10000000) { $sql = getGuestDetails($uid); } $res = mysqli_query($GLOBALS['dbh'], $sql); $result = mysqli_fetch_assoc($res); $link = fetchLink($result['link']); $avatar = getAvatar($result['avatar']); $status = $result['status']; $statusMessage = $result['message']; $isDevice = $result['isdevice']; $icon = ''; if ($statusMessage == null && $status == 'available') { $statusMessage = $language[30]; } else { if ($statusMessage == null && $status == 'away') { $statusMessage = $language[34]; } else { if ($statusMessage == null && $status == 'busy') { $statusMessage = $language[31]; } else { if ($statusMessage == null && $status == 'offline') { $statusMessage = $language[32]; } else { if ($statusMessage == null && $status == 'invisible') { $statusMessage = $language[33]; } } } } } $usercontentstatus = $status; if ($isDevice == 1) { $usercontentstatus = 'mobile cometchat_mobile_' . $status; $icon = '<div class="cometchat_dot"></div>'; } $status_area = '<span class="cometchat_userscontentdot cometchat_userscontentdot_synergy cometchat_' . $usercontentstatus . ' cometchat_' . $usercontentstatus . '_synergy">' . $icon . '</span><span class="status_messagearea">' . $statusMessage . '</span>'; if ($link != '' && $uid < 10000000 && $callbackfn != 'desktop') { $options .= " <input type=button class='invitebutton' onClick=javascript:window.open('" . $link . "');" . $close . " value='" . $chatrooms_language[42] . "' />"; } echo <<<EOD <!DOCTYPE html> <html> \t<head> \t\t<title>{$result['username']}</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<script src="../../js.php?type=core&name=jquery"></script> \t\t<script> \t\t \$ = jQuery = jqcc; \t\t</script> \t\t<link type="text/css" rel="stylesheet" media="all" href="../../css.php?type=module&name=chatrooms{$cc_theme}" /> \t\t<script> \t\t\$('.kickBan').live('click',function(){ \t\t var uid = \$(this).attr('uid'); \t\t var method = \$(this).attr('id'); \t\t if(method == 'cc_kick'){ \t\t \taction = 'kickChatroomUser'; \t\t } else { \t\t \taction = 'banChatroomUser'; \t\t } \t var controlparameters = {"type":"modules", "name":"cometchat", "method":action, "params":{"uid":uid, "allowed":"1", "chatroommode":"1"}}; \t controlparameters = JSON.stringify(controlparameters); \t if(typeof(parent) != 'undefined' && parent != null && parent != self){ \t \tparent.postMessage('CC^CONTROL_'+controlparameters,'*'); \t var controlparameters = {'type':'plugins', 'name':'chatrooms', 'method':'closeCCPopup', 'params':{'name':'loadChatroomPro'}}; controlparameters = JSON.stringify(controlparameters); parent.postMessage('CC^CONTROL_'+controlparameters,'*'); \t } else { \t \twindow.opener.postMessage('CC^CONTROL_'+controlparameters,'*'); \t \twindow.close(); \t\t\t} \t\t}); \t\t\$('.chat').live('click',function(){ \t\t\tvar uid = \$(this).attr('uid'); \t\t\tvar caller = \$(this).attr('caller'); \t\t\tvar callbackfn="<?php echo {$callbackfn}; ?>"; \t\t\tvar controlparameters = {"type":"modules", "name":"cometchat", "method":"chatWith", "params":{"uid":uid, "chatroommode":"0", "caller":caller}}; \t\t\tif(callbackfn){ \t\t\t\tcontrolparameters = {"type":"modules", "name":"cometchat", "method":"chatWith", "params":{"uid":uid, "chatroommode":"0"}}; \t\t\t} \t controlparameters = JSON.stringify(controlparameters); \t if(typeof(parent) != 'undefined' && parent != null && parent != self){ \t parent.postMessage('CC^CONTROL_'+controlparameters,'*'); \t var controlparameters = {'type':'plugins', 'name':'chatrooms', 'method':'closeCCPopup', 'params':{'name':'loadChatroomPro'}}; controlparameters = JSON.stringify(controlparameters); parent.postMessage('CC^CONTROL_'+controlparameters,'*'); \t } else { \t window.opener.postMessage('CC^CONTROL_'+controlparameters,'*'); \t window.close(); \t } \t\t}); \t\t</script> \t</head> \t<body> \t\t<form method="post"> \t\t\t<div class="cometchat_wrapper"> \t\t\t\t<div class="container_title {$embedcss}">{$result['username']}</div> \t\t\t\t<div class="container_body {$embedcss}" style='height:auto'> \t\t\t\t\t<div class="chatroom_avatar"><img src="{$avatar}" height="50px" width="50px" /></div> \t\t\t\t\t<div class="status_container"> \t\t\t\t\t\t<div class="status_area">{$status_area}</div> \t\t\t\t\t\t<div class="control_buttons">{$options}</div> \t\t\t\t\t</div> \t\t\t\t\t<div style='clear:both'></div> \t\t\t\t</div> \t\t\t</div> \t\t</form> \t\t<script type='text/javascript'> \t\t\tif(typeof \$ != 'undefined') \t\t\t\$(document).ready(function(){ \t\t\t\tsum = 0; \t\t\t\t\$('.control_buttons input').each(function(i,o){ \t\t\t\t\tsum += \$(o).outerWidth(false); \t\t\t\t}); \t\t\t\tsetTimeout(function(){ \t\t\t\t\twindow.resizeTo(sum+140, (\$('form').outerHeight(false)+window.outerHeight-window.innerHeight+10)); \t\t\t\t\t//140 = container.padding(10*2) + avatar(50) + buttons.margin-left(20) + buttons.margin-right(20) + 30 (container margin(2%)+ inter-button spacing(taking worst case scenario)) \t\t\t\t\t//10 = container.margin(5*2) \t\t\t\t},500); \t\t\t\tvar mobileDevice = navigator.userAgent.match(/ipad|ipod|iphone|android|windows ce|Windows Phone|blackberry|palm|symbian/i); \t\t\t\tif(typeof(parent) != 'undefined' && !mobileDevice){ \t\t\t\t\tvar controlparameters = {'type':'module', 'name':'chatrooms', 'method':'resizeCCPopup', 'params':{"id":"loadChatroomPro", "height":sum+178, "width":96}}; \tcontrolparameters = JSON.stringify(controlparameters); \tif(typeof(window.opener) == null){ \t\twindow.opener.postMessage('CC^CONTROL_'+controlparameters,'*'); \t}else{ \t\tparent.postMessage('CC^CONTROL_'+controlparameters,'*'); \t} \t\t\t\t} \t\t\t\t//Height 80 = container_body.height(50) + embed.padding(10*2) + container.margin(5*2) \t\t\t}); \t\t</script> \t</body> </html> EOD; }
function invite() { global $userid; global $audiochat_language; global $language; global $embed; global $embedcss; global $lightboxWindows; global $guestsMode; global $cookiePrefix; global $chromeReorderFix; global $hideOffline; global $target; global $basedata, $onsubmit; if ($lightboxWindows == '1') { $embed = 'web'; $embedcss = 'embed'; } $status['available'] = $language[30]; $status['busy'] = $language[31]; $status['offline'] = $language[32]; $status['invisible'] = $language[33]; $status['away'] = $language[34]; $id = $_GET['roomid']; if (empty($id)) { exit; } $time = getTimeStamp(); $buddyList = array(); $onlineCacheKey = 'all_online'; if ($userid > 10000000) { $onlineCacheKey .= 'guest'; } if ($onlineUsers = getCache($cookiePrefix . $onlineCacheKey, 30)) { $buddyList = unserialize($onlineUsers); } else { $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) { $tempBuddyList = array(); if ($onlineFrnds = getCache($cookiePrefix . 'friend_ids_of_' . $userid, 30)) { $friendIds = unserialize($onlineFrnds); } else { $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($cookiePrefix . 'friend_ids_of_' . $userid, serialize($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); } $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 = $audiochat_language[25]; $invitehide = 'style="display:none;"'; } echo <<<EOD <!DOCTYPE html> <html> <head> <title>{$audiochat_language[18]}</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <link type="text/css" rel="stylesheet" media="all" href="../../css.php?type=plugin&name=audiochat" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> \tfunction inviteUsers(){ \t\tvar invite=[]; \t\t\$(document).find(".invite_4:checked").each(function(){ \t\t\tinvite.push(\$(this).val()); \t\t}); \t\tvar roomid = \$(document).find("input[name=roomid]").val(); \t\tvar basedata = {$basedata}; \t\t\$.ajax({ \t\t\turl: 'invite.php?action=inviteusers&embed={$embed}', \t\t\tdata:{invite:invite,roomid:roomid,basedata:basedata}, \t\t\ttype:"POST", \t\t\tasync: false, \t\t\tsuccess:function(data){ \t\t\t\t\$(document).find("body").html('<div class="container_title {$embedcss}">{$audiochat_language[16]}</div><div class="container_body {$embedcss}">{$audiochat_language[12]}</span><div style="clear:both"></div></div>'); \t\t\t\tsetTimeout(function(){parentSandboxBridge.closeCCPopup()},2000); \t\t\t} \t\t}); \treturn false; \t} </script> </head> <body> <form method="post" action="invite.php?action=inviteusers&embed={$embed}" {$onsubmit}> <div class="container"> \t<div class="container_title {$embedcss}">{$audiochat_language[16]}</div> \t<div class="container_body {$embedcss}"> \t\t{$inviteContent} \t\t<div style="clear:both"></div> \t</div> \t<div class="container_sub" {$invitehide}> \t\t<input type="submit" value="{$audiochat_language[17]}" class="invitebutton"> \t</div> </div> <input type="hidden" name="roomid" value="{$id}"> </form> </body> </html> EOD; }