function loadChatroomPro() { global $chatrooms_language; global $language; global $embed; global $embedcss; global $userid; global $moderatorUserIDs; global $lightboxWindows; $close = 'setTimeout("window.close()",2000);'; if (!empty($_GET['embed']) && $_GET['embed'] == 'web') { $embed = 'web'; $embedcss = 'embed'; $close = 'parent.closeCCPopup("loadChatroomPro");'; } $id = $_GET['roomid']; $uid = $_GET['inviteid']; $roomname = $_GET['roomname']; $owner = $_GET['owner']; $apiAccess = $_GET['apiAccess']; $options = ""; $caller = "window.opener."; if ($apiAccess) { $options = " <input type=button class='invitebutton' onclick=javascript:window.opener.parent.jqcc.cometchat.chatWith({$uid});{$close} value='" . $chatrooms_language[43] . "' />"; if ($lightboxWindows) { $options = " <input type=button class='invitebutton' onclick=javascript:parent.jqcc.cometchat.chatWith({$uid});{$close} value='" . $chatrooms_language[43] . "' />"; $caller = "\$('#cometchat_trayicon_chatrooms_iframe,.cometchat_embed_chatrooms',parent.document)[0].contentWindow."; } } if ($owner == 1 || in_array($userid, $moderatorUserIDs)) { $sql = "select createdby from cometchat_chatrooms where id = '" . mysql_real_escape_string($id) . "' limit 1"; $query = mysql_query($sql); $room = mysql_fetch_array($query); if (!in_array($uid, $moderatorUserIDs) && $uid != $room['createdby']) { $options = "<input type=button value='" . $chatrooms_language[40] . "' onClick=javascript:" . $caller . "kickUser({$uid},0);{$close} class='invitebutton' />\n\t\t\t<input type=button value='" . $chatrooms_language[41] . "' onClick=javascript:" . $caller . "banUser({$uid},0);{$close} class='invitebutton' />" . $options; } } if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysql_error(); } $sql = getUserDetails($uid); if ($uid > 10000000) { $sql = getGuestDetails($uid); } $res = mysql_query($sql); $result = mysql_fetch_array($res); $link = fetchLink($result['link']); $avatar = getAvatar($result['avatar']); if ($link != '' && $uid < 10000000) { $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 http-equiv="content-type" content="text/html; charset=utf-8"/> \t\t<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> \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"> \t\t\t<div class="container"> \t\t\t\t<div class="container_title {$embedcss}">{$result['username']}</div>\t \t\t\t\t<div class="chatroom_avatar"><img src="{$avatar}" height="50px" width="50px" /></div> \t\t\t\t<div class="control_buttons">{$options}</div>\t \t\t\t</div> \t\t</form> \t</body> </html> EOD; }
function getStatus() { global $response; global $userid; global $status; global $startOffline; global $processFurther; global $channelprefix; global $language; global $cookiePrefix; global $announcementpushchannel; global $bannedUserIDs; if ($userid > 10000000) { $sql = getGuestDetails($userid); } else { $sql = getUserDetails($userid); } $query = mysqli_query($GLOBALS['dbh'], $sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysqli_error($GLOBALS['dbh']); } if (mysqli_num_rows($query) > 0) { $chat = mysqli_fetch_assoc($query); if (!empty($_REQUEST['callbackfn'])) { $_SESSION['cometchat']['startoffline'] = 1; } if ($startOffline == 1 && empty($_SESSION['cometchat']['startoffline'])) { $_SESSION['cometchat']['startoffline'] = 1; $chat['status'] = 'offline'; setStatus('offline'); $_SESSION['cometchat']['cometchat_sessionvars']['buddylist'] = 0; $processFurther = 0; } else { if (empty($chat['status'])) { $chat['status'] = 'available'; } else { if ($chat['status'] == 'away') { $chat['status'] = 'available'; setStatus('available'); } if ($chat['status'] == 'offline') { $processFurther = 0; $_SESSION['cometchat']['cometchat_sessionvars']['buddylist'] = 0; } } } if (empty($chat['message'])) { $chat['message'] = $status[$chat['status']]; } if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "announcements" . DIRECTORY_SEPARATOR . "config.php")) { include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "announcements" . DIRECTORY_SEPARATOR . "config.php"; } $chat['message'] = html_entity_decode($chat['message']); $ccmobileauth = 0; if (!empty($_REQUEST['callbackfn']) && $_REQUEST['callbackfn'] == 'ccmobiletab') { $ccmobileauth = md5($_SESSION['basedata'] . 'cometchat'); } 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); } $s = array('id' => $chat['userid'], 'n' => $chat['username'], 'l' => fetchLink($chat['link']), 'a' => getAvatar($chat['avatar']), 's' => $chat['status'], 'm' => $chat['message'], 'push_channel' => 'C_' . md5($channelprefix . "USER_" . $userid . BASE_URL), 'ccmobileauth' => $ccmobileauth, 'push_an_channel' => $announcementpushchannel, 'webrtc_prefix' => $channelprefix, 'ch' => $chat['ch'], 'ls' => $chat['lastseen'], 'lstn' => $chat['lastseensetting']); if (in_array($chat['userid'], $bannedUserIDs)) { $s['b'] = 1; } $response['userstatus'] = $_SESSION['cometchat']['user'] = $s; } else { if (USE_CCAUTH != 1) { $response['loggedout'] = '1'; $response['logout_message'] = $language[30]; setcookie($cookiePrefix . 'guest', '', time() - 3600, '/'); setcookie($cookiePrefix . 'state', '', time() - 3600, '/'); unset($_SESSION['cometchat']); } } }
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 getLink($userid) { return fetchLink($userid); }
function loadChatroomPro() { global $chatrooms_language; global $language; global $embed; global $embedcss; global $userid; global $moderatorUserIDs; global $lightboxWindows; $close = 'setTimeout("window.close()",2000);'; if (!empty($_GET['embed']) && $_GET['embed'] == 'web') { $embed = 'web'; $embedcss = 'embed'; $close = 'parent.closeCCPopup("loadChatroomPro");'; } $id = $_GET['roomid']; $cc_theme = ''; if (!empty($_GET['cc_theme'])) { $cc_theme = '&cc_theme=' . $_GET['cc_theme']; } $uid = $_GET['inviteid']; $owner = $_GET['owner']; $apiAccess = $_GET['apiAccess']; $options = ""; $status_area = ""; $caller = "window.opener."; $popoutmode = $_GET['popoutmode']; if ($apiAccess) { if ($lightboxWindows) { $caller = "\$('#cometchat_trayicon_chatrooms_iframe,.cometchat_embed_chatrooms',parent.document)[0].contentWindow."; $options = " <input type=button class='invitebutton chat' uid=" . $uid . " value='" . $chatrooms_language[43] . "' />"; if ($popoutmode && $popoutmode != 'null') { $options = " <input type=button class='invitebutton chat' uid=" . $uid . " value='" . $chatrooms_language[43] . "' />"; } } else { $options = " <input type=button class='invitebutton chat' uid=" . $uid . " value='" . $chatrooms_language[43] . "' />"; if ($popoutmode && $popoutmode != 'null') { $options = " <input type=button class='invitebutton chat' 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 value='" . $chatrooms_language[40] . "' uid = " . $uid . " class='invitebutton kickBan'/>\n\t\t\t<input type=button 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) { $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 http-equiv="content-type" content="text/html; charset=utf-8"/> \t\t<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></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).val(); \t\t if(method == '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':'loadChatroomPro', 'method':'closeCCPopup', 'params':{}}; 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 controlparameters = {"type":"modules", "name":"cometchat", "method":"chatWith", "params":{"uid":uid,"chatroommode":"0"}}; \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':'loadChatroomPro', 'method':'closeCCPopup', 'params':{}}; 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="container"> \t\t\t\t<div class="container_title {$embedcss}">{$result['username']}</div> \t\t\t\t<div class="container_body {$embedcss}" style='height:50px;'> \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\tif(typeof(parent) != 'undefined'){ \t\t\t\t\tvar controlparameters = {'type':'module', 'name':'chatrooms', 'method':'resizeCCPopup', 'params':{"id":"loadChatroomPro", "height":sum+140, "width":80}}; \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 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; } } }
<?php //$response = file_get_contents("http://news.zing.vn/Dong-mon-duoc-moi-sang-La-Liga-Thai-Sung-van-let-det-post557687.html"); $response = fetchLink("http://news.zing.vn/Dong-mon-duoc-moi-sang-La-Liga-Thai-Sung-van-let-det-post557687.html"); //$response = get_content("http://news.zing.vn/Dong-mon-duoc-moi-sang-La-Liga-Thai-Sung-van-let-det-post557687.html"); echo htmlspecialchars($response); function fetchLink($link, $referer = '', &$header = array()) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $link); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_ENCODING, ''); if ($referer) { curl_setopt($ch, CURLOPT_REFERER, $referer); } curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20120403211507 Firefox/32.0"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 3); curl_setopt($ch, CURLOPT_MAXREDIRS, 3); $result = curl_exec($ch); $header = curl_getinfo($ch); curl_close($ch); if (200 == (int) $header['http_code'] and trim($result) != "") { return $result; } else { $result = file_get_contents($link); if (trim($result) != "") { $head['http_code'] = 200; } else { $head['http_code'] = 404; }
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; }
$query = mysqli_query($GLOBALS['dbh'], $sql); if (defined('DEV_MODE') && DEV_MODE == '1') { echo mysqli_error($GLOBALS['dbh']); } $chat = mysqli_fetch_assoc($query); if (($time - processTime($chat['lastactivity']) < ONLINE_TIMEOUT || $chat['isdevice'] == 1) && $chat['status'] != 'invisible' && $chat['status'] != 'offline') { if ($chat['status'] != 'busy' && $chat['status'] != 'away') { $chat['status'] = 'available'; } } else { $chat['status'] = 'offline'; } if ($chat['message'] == null) { $chat['message'] = $status[$chat['status']]; } $link = fetchLink($chat['link']); $avatar = getAvatar($chat['avatar']); if (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 (function_exists('processName')) { $chat['username'] = processName($chat['username']); } $response = array('id' => $chat['userid'], 'n' => $chat['username'], 'l' => $link, 'd' => $chat['isdevice'], 'a' => $avatar, 's' => $chat['status'], 'm' => $chat['message'], 'ch' => $chat['ch'], 'ls' => $chat['lastseen'], 'lstn' => $chat['lastseensetting']); header('Content-type: application/json; charset=utf-8'); if (!empty($_GET['callback'])) { echo $_GET['callback'] . '(' . json_encode($response) . ')'; } else {
//Filter user action and redirect to scrap function if (isset($_GET["search"])) { $type = $_GET["search"]; $pageTitle = base64_decode($_GET["title"]); fetchSearch($type, $pageTitle); } else { if (isset($_GET["item"])) { $item = base64_decode($_GET["item"]); $title = base64_decode($_GET["title"]); fetchMovie($item, $title); } else { if (isset($_GET["host"])) { $host = base64_decode($_GET["host"]); $link = base64_decode($_GET["link"]); $title = base64_decode($_GET["title"]); fetchLink($title, $host, $link); } else { fetchCategoryItems(""); } } } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ /** * Get category movies and pages. */ function fetchCategoryItems($title) { $template = new Anime44MoviesTemplate(); $template->setLetter($letter); //If page equal "x" goto page number list, in other case process actual category page