function invite() { global $userid; global $chatrooms_language; global $language; global $embed; global $embedcss; $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']; $time = getTimeStamp(); $buddyList = array(); $sql = "select GROUP_CONCAT(userid) bannedusers from cometchat_chatrooms_users where isbanned=1 and chatroomid='" . $id . "'"; $query = mysql_query($sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysql_error(); } $result = mysql_fetch_array($query); $bannedUsers = explode(',', $result['bannedusers']); $sql = getFriendsList($userid, $time); $query = mysql_query($sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysql_error(); } while ($chat = mysql_fetch_array($query)) { 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'; } $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) { $buddyList[] = array('id' => $chat['userid'], 'n' => $chat['username'], 's' => $chat['status'], 'a' => $avatar); } } } 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 = $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}"> \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\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 invite() { global $userid; global $chatrooms_language; global $language; global $embed; global $embedcss; $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']; $time = getTimeStamp(); $buddyList = array(); $sql = getFriendsList($userid, $time); $query = mysql_query($sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysql_error(); } while ($chat = mysql_fetch_array($query)) { 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'; } $avatar = getAvatar($chat['avatar']); if (!empty($chat['username'])) { if (function_exists('processName')) { $chat['username'] = processName($chat['username']); } $buddyList[] = array('id' => $chat['userid'], 'n' => $chat['username'], 's' => $chat['status'], 'a' => $avatar); } } if (function_exists('hooks_forcefriends') && is_array(hooks_forcefriends())) { $buddyList = array_merge(hooks_forcefriends(), $buddyList); } $number = 0; $s['available'] = ''; $s['away'] = ''; $s['busy'] = ''; $s['offline'] = ''; foreach ($buddyList as $buddy) { ++$number; if (strlen($buddy['n']) > 14) { $buddy['n'] = substr($buddy['n'], 0, 12) . '...'; } $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;">' . $buddy['n'] . '<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>'; if ($number % 2 == 0) { echo '<div style="clear:both"></div>'; $number = 0; } } echo <<<EOD <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>{$chatrooms_language[22]}</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <link type="text/css" rel="stylesheet" media="all" href="../../css.php?type=module&name=chatrooms" /> </head> <body> <form method="post" action="chatrooms.php?action=inviteusers&embed={$embed}"> <div class="container"> \t<div class="container_title {$embedcss}">{$chatrooms_language[21]}</div> \t<div class="container_body {$embedcss}"> \t\t{$s['available']}{$s['away']}{$s['offline']} \t\t<div style="clear:both"></div> \t</div> \t<div class="container_sub {$embedcss}"> \t\t<input type=submit value="{$chatrooms_language[20]}" class="invitebutton"> \t</div> </div>\t <input type="hidden" name="roomid" value="{$id}"> <input type="hidden" name="inviteid" value="{$inviteid}"> <input type="hidden" name="roomname" value="{$roomname}"></form> </body> </html> EOD; }
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; } } }
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "cometchat_init.php"; $response = array(); $messages = array(); $fetchid = $_REQUEST['userid']; $time = getTimeStamp(); $sql = getFriendsList($userid, $time); $query = mysqli_query($GLOBALS['dbh'], $sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysqli_error($GLOBALS['dbh']); } $isfriend = 0; while ($chat = mysqli_fetch_assoc($query)) { if ($chat['userid'] == $fetchid) { $isfriend = 1; break; } } $response = array('friend' => $isfriend); header('Content-type: application/json; charset=utf-8'); if (!empty($_GET['callback'])) { echo $_GET['callback'] . '(' . json_encode($response) . ')';
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; } } }
public function show_events() { $result = ""; if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; } else { $user_id = 0; } if (isset($_SESSION['last_login'])) { $last_login = $_SESSION['last_login']; } else { $last_login = 0; } $likes_byfriends = getLikesbyFriendsForUserPost($user_id, $last_login); $friendslist = getFriendsList($user_id); $friends = $this->getFriendsids($friendslist); $requested_list = show_events_foruser($friends); //for new post added by friends $result = '<ul class="ui-listview" data-role="listview">'; if ($likes_byfriends != null) { foreach ($likes_byfriends as $list) { $result .= '<li id="' . $list[0] . '_' . $list[5] . '_liked_user" style="border-style:none" class="ui-btn ui-li-has-arrow ui-li ui-li-has-thumb ui-btn-up-c" data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c">'; $result .= '<div class="ui-btn-inner ui-li">'; $result .= '<div class="ui-btn-text">'; $result .= '<a class="ui-link-inherit" href="#" id="' . $list[5] . '" onclick="show_post_detail(this) ">'; if ($list[3] != null) { $result .= '<img class="ui-li-thumb" src="' . $list[3] . '" style="width:3em; height:2em;">'; } else { $result .= '<img class="ui-li-thumb" src="images/profile_pic.jpg" style="width:3em; height:2em;"/>'; } if ($list[4] == 'female') { $result .= '<p class="ui-li-desc"><span style="font-weight:900; color:#333; font-size:1.2em">' . $list[1] . '</span> liked your post</p>'; } else { $result .= '<p class="ui-li-desc"><span style="font-weight:900; color:#333; font-size:1.2em">' . $list[1] . '</span> liked your post</p>'; } $tz = $_POST['timezone']; $tz = new DateTimeZone($tz); $date = new DateTime($list[2]); $date->setTimezone($tz); $result .= '<span class="event_changed" id="comment_date"> ' . $this->date_format($date->format('Y-m-d H:i:s'), $tz) . ' ago</span> '; $result .= '</a></div> </div> </li>'; } } if ($requested_list != null) { foreach ($requested_list as $value) { $result .= '<li id="' . $value[0] . '_friends_li_item" style="border-style:none" class="ui-btn ui-li-has-arrow ui-li ui-li-has-thumb ui-btn-up-c" data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c">'; $result .= '<div class="ui-btn-inner ui-li">'; $result .= '<div class="ui-btn-text">'; $result .= '<a class="ui-link-inherit" href="#" id="' . $value[5] . '" onclick="show_post_detail(this) " >'; if ($value[3] != null) { $result .= '<img class="ui-li-thumb" src="' . $value[3] . '" style="width:3em; height:2em;">'; } else { $result .= '<img class="ui-li-thumb" src="images/profile_pic.jpg" style="width:3em; height:2em;"/>'; } if ($value[4] == 'female') { $result .= '<p class="ui-li-desc"><span style="font-weight:900; color:#333; font-size:1.2em">' . $value[1] . '</span> updated her states</p>'; } else { $result .= '<p class="ui-li-desc"><span style="font-weight:900; color:#333; font-size:1.2em">' . $value[1] . '</span> updated his states</p>'; } $tz = $_POST['timezone']; $tz = new DateTimeZone($tz); $date = new DateTime($value[2]); $date->setTimezone($tz); $result .= '<span class="event_changed" id="comment_date"> ' . $this->date_format($date->format('Y-m-d H:i:s'), $tz) . ' ago</span> '; $result .= '</a></div> </div> </li>'; } } $result .= '</ul>'; $this->http_response($result, 200); }
function invite() { global $userid; global $broadcast_language; global $language; global $embed; global $embedcss; global $lightboxWindows; 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(); $sql = getFriendsList($userid, $time); $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') { 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[] = array('id' => $chat['userid'], 'n' => $chat['username'], 's' => $chat['status'], 'a' => $avatar); } } } 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;">' . $buddy['n'] . '<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 = $broadcast_language[18]; $invitehide = 'style="display:none;"'; } echo <<<EOD <!DOCTYPE html> <html> <head> <title>{$broadcast_language[13]}</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=broadcast" /> </head> <body> <form method="post" action="invite.php?action=inviteusers&embed={$embed}"> <div class="container"> \t<div class="container_title {$embedcss}">{$broadcast_language[11]}</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="{$broadcast_language[12]}" class="invitebutton"> \t</div> </div>\t <input type="hidden" name="roomid" value="{$id}"> </form> </body> </html> EOD; }
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; }