本文整理汇总了PHP中getGuestDetails函数的典型用法代码示例。如果您正苦于以下问题:PHP getGuestDetails函数的具体用法?PHP getGuestDetails怎么用?PHP getGuestDetails使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getGuestDetails函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadChatroomPro
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;
}
示例2: dirname
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 dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "plugins.php";
if ($p_ < 2) {
exit;
}
$id = $_GET['id'];
$sql = getUserDetails($id);
if ($guestsMode && $id >= 10000000) {
$sql = getGuestDetails($id);
}
$query = mysql_query($sql);
if (defined('DEV_MODE') && DEV_MODE == '1') {
echo mysql_error();
}
$user = mysql_fetch_array($query);
if (function_exists('processName')) {
$user['username'] = processName($user['username']);
}
$log = '';
$filename = 'Conversation with ' . $user['username'] . ' on ' . date('M jS Y');
$messages = array();
getChatboxData($id);
$log .= 'Conversation with ' . $user['username'] . ' on ' . date('M jS Y');
$log .= "\r\n-------------------------------------------------------\r\n\r\n";
示例3: mysqli_real_escape_string
}
$sql = "update cometchat_chatrooms set vidsession = '" . mysqli_real_escape_string($GLOBALS['dbh'], $newsessionid) . "' where id = '" . mysqli_real_escape_string($GLOBALS['dbh'], $grp) . "'";
$query = mysqli_query($GLOBALS['dbh'], $sql);
$grp = $newsessionid;
} else {
$grp = $chatroom['vidsession'];
}
if (empty($_REQUEST['join'])) {
sendChatroomMessage($grporg, $broadcast_language[9] . " <a href='javascript:void(0);' onclick=\"javascript:jqcc.ccbroadcast.join('" . $grporg . "');\">" . $broadcast_language[10] . "</a>", 0);
}
$avchat_token = $apiObj->generateToken($grp);
}
$name = "";
$sql = getUserDetails($userid);
if ($guestsMode && $userid >= 10000000) {
$sql = getGuestDetails($userid);
}
$result = mysqli_query($GLOBALS['dbh'], $sql);
if ($row = mysqli_fetch_assoc($result)) {
if (function_exists('processName')) {
$row['username'] = processName($row['username']);
}
$name = $row['username'];
}
$name = urlencode($name);
$baseUrl = BASE_URL;
$embed = '';
$embedcss = '';
$resize = 'window.resizeTo(';
$invitefunction = 'window.open';
if (!empty($_REQUEST['embed']) && $_REQUEST['embed'] == 'web') {
示例4: getStatus
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']);
}
}
}
示例5: getStatus
function getStatus()
{
global $response;
global $userid;
global $status;
global $startOffline;
global $processFurther;
global $chromeReorderFix;
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']);
}
$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']];
}
$chat['message'] = html_entity_decode($chat['message']);
$s = array('id' => $chat['userid'], 'n' => $chat['username'], 'l' => fetchLink($chat['link']), 'a' => getAvatar($chat['userid']), 's' => $chat['status'], 'm' => $chat['message']);
$response['userstatus'] = $s;
}
示例6: loadChatroomPro
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}" />
//.........这里部分代码省略.........
示例7: array
$response = array();
$messages = array();
$status['available'] = $language[30];
$status['busy'] = $language[31];
$status['offline'] = $language[32];
$status['invisible'] = $language[33];
$status['away'] = $language[34];
if (!empty($_REQUEST['userid'])) {
$fetchid = $_REQUEST['userid'];
} else {
$fetchid = $userid;
}
$time = getTimeStamp();
$sql = getUserDetails($fetchid);
if ($guestsMode && $fetchid >= 10000000) {
$sql = getGuestDetails($fetchid);
}
$query = mysql_query($sql);
if (defined('DEV_MODE') && DEV_MODE == '1') {
echo mysql_error();
}
$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';
}
if ($chat['message'] == null) {
$chat['message'] = $status[$chat['status']];
示例8: sendChatroomMessage
//.........这里部分代码省略.........
$message = 'CC^CONTROL_AUDIOCHAT_BUSY_CALL' . $grp;
break;
default:
$message = '';
break;
}
break;
case 'broadcast':
$grp = $controlparameters['params']['grp'];
switch ($controlparameters['method']) {
case 'endcall':
$message = 'CC^CONTROL_BROADCAST_END_CHATROOM_CALL' . $grp;
break;
default:
$message = '';
break;
}
break;
case 'chatroom':
$delid = $controlparameters['params']['id'];
switch ($controlparameters['method']) {
case 'deletemessage':
$message = 'CC^CONTROL_deletemessage_' . $delid;
break;
case 'kicked':
$message = 'CC^CONTROL_kicked_' . $delid;
break;
case 'banned':
$message = 'CC^CONTROL_banned_' . $delid;
break;
default:
$message = '';
break;
}
break;
default:
break;
}
}
}
if ($notsilent !== 0) {
$message = str_ireplace('CC^CONTROL_', '', $message);
$message = sanitize($message);
}
$styleStart = '';
$styleEnd = '';
if (!empty($_COOKIE[$cookiePrefix . 'chatroomcolor']) && preg_match('/^[a-f0-9]{6}$/i', $_COOKIE[$cookiePrefix . 'chatroomcolor']) && $notsilent == 1) {
$styleStart = '<span style="color:#' . mysqli_real_escape_string($GLOBALS['dbh'], $_COOKIE[$cookiePrefix . 'chatroomcolor']) . '">';
$styleEnd = '</span>';
}
if (USE_COMET == 1 && COMET_CHATROOMS == 1) {
$comet = new Comet(KEY_A, KEY_B);
if (empty($_SESSION['cometchat']['username'])) {
$name = '';
$sql = getUserDetails($userid);
if ($userid > 10000000) {
$sql = getGuestDetails($userid);
}
$result = mysqli_query($GLOBALS['dbh'], $sql);
if ($row = mysqli_fetch_assoc($result)) {
if (function_exists('processName')) {
$row['username'] = processName($row['username']);
}
$name = $row['username'];
}
$_SESSION['cometchat']['username'] = $name;
} else {
$name = $_SESSION['cometchat']['username'];
}
if (!empty($name)) {
$sql = "insert into cometchat_chatroommessages (userid,chatroomid,message,sent) values ('" . mysqli_real_escape_string($GLOBALS['dbh'], $userid) . "', '" . mysqli_real_escape_string($GLOBALS['dbh'], $to) . "','" . mysqli_real_escape_string($GLOBALS['dbh'], $styleStart) . mysqli_real_escape_string($GLOBALS['dbh'], $message) . mysqli_real_escape_string($GLOBALS['dbh'], $styleEnd) . "','" . getTimeStamp() . "')";
$query = mysqli_query($GLOBALS['dbh'], $sql);
$insertedid = mysqli_insert_id($GLOBALS['dbh']);
if (defined('DEV_MODE') && DEV_MODE == '1') {
echo mysqli_error($GLOBALS['dbh']);
}
$timestamp = getTimeStamp();
$info = $comet->publish(array('channel' => md5('chatroom_' . $to . KEY_A . KEY_B . KEY_C), 'message' => array("id" => $insertedid, "from" => $name, "fromid" => $userid, "message" => $styleStart . $message . $styleEnd, "sent" => getTimeStamp())));
if ($notsilent == 1) {
sendCCResponse(json_encode(array("id" => $insertedid, "m" => $styleStart . $message . $styleEnd)));
}
}
} else {
$sql = "insert into cometchat_chatroommessages (userid,chatroomid,message,sent) values ('" . mysqli_real_escape_string($GLOBALS['dbh'], $userid) . "', '" . mysqli_real_escape_string($GLOBALS['dbh'], $to) . "','" . mysqli_real_escape_string($GLOBALS['dbh'], $styleStart) . mysqli_real_escape_string($GLOBALS['dbh'], $message) . mysqli_real_escape_string($GLOBALS['dbh'], $styleEnd) . "','" . mysqli_real_escape_string($GLOBALS['dbh'], getTimeStamp()) . "')";
$query = mysqli_query($GLOBALS['dbh'], $sql);
$insertedid = mysqli_insert_id($GLOBALS['dbh']);
if (defined('DEV_MODE') && DEV_MODE == '1') {
echo mysqli_error($GLOBALS['dbh']);
}
if ($notsilent == 1) {
sendCCResponse(json_encode(array("id" => $insertedid, "m" => $styleStart . $message . $styleEnd)));
}
}
parsePusher($to, $insertedid, $message, '1');
$sql = "update cometchat_chatrooms set lastactivity = '" . mysqli_real_escape_string($GLOBALS['dbh'], getTimeStamp()) . "' where id = '" . mysqli_real_escape_string($GLOBALS['dbh'], $to) . "'";
$query = mysqli_query($GLOBALS['dbh'], $sql);
if ($notsilent == 0) {
return $insertedid;
}
}
示例9: getStatus
function getStatus()
{
global $response;
global $userid;
global $status;
global $startOffline;
global $processFurther;
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']);
}
$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']];
}
$channelprefix = '';
if (preg_match('/www\\./', $_SERVER['HTTP_HOST'])) {
$channelprefix = $_SERVER['HTTP_HOST'];
} else {
$channelprefix = 'www.' . $_SERVER['HTTP_HOST'];
}
$chat['message'] = html_entity_decode($chat['message']);
$ccmobileauth = 0;
if (!empty($_REQUEST['callbackfn']) && $_REQUEST['callbackfn'] == 'ccmobiletab') {
$ccmobileauth = md5($userid . 'cometchat');
}
$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);
$response['userstatus'] = $_SESSION['cometchat']['user'] = $s;
}
示例10: sendChatroomMessage
function sendChatroomMessage($to = 0, $message = '', $notsilent = 1)
{
global $userid;
global $cookiePrefix;
global $bannedUserIDs;
if ($to == 0 && empty($_POST['currentroom']) || $message == '' && $notsilent == 0 || isset($_POST['message']) && $_POST['message'] == '' || empty($userid) || in_array($userid, $bannedUserIDs)) {
return;
}
if (isset($_POST['message']) && !empty($_POST['currentroom'])) {
$to = $_POST['currentroom'];
$message = $_POST['message'];
}
if ($notsilent !== 0) {
$message = str_ireplace('CC^CONTROL_', '', $message);
$message = sanitize($message);
}
$styleStart = '';
$styleEnd = '';
if (!empty($_COOKIE[$cookiePrefix . 'chatroomcolor']) && preg_match('/^[a-f0-9]{6}$/i', $_COOKIE[$cookiePrefix . 'chatroomcolor']) && $notsilent == 1) {
$styleStart = '<span style="color:#' . $_COOKIE[$cookiePrefix . 'chatroomcolor'] . '">';
$styleEnd = '</span>';
}
if (USE_COMET == 1 && COMET_CHATROOMS == 1) {
$insertedid = getTimeStamp() . rand(100, 999);
if ($notsilent == 1) {
sendCCResponse(json_encode(array("id" => $insertedid, "m" => $styleStart . $message . $styleEnd)));
}
$comet = new Comet(KEY_A, KEY_B);
if (empty($_SESSION['cometchat']['username'])) {
$name = '';
$sql = getUserDetails($userid);
if ($userid > 10000000) {
$sql = getGuestDetails($userid);
}
$result = mysqli_query($GLOBALS['dbh'], $sql);
if ($row = mysqli_fetch_assoc($result)) {
if (function_exists('processName')) {
$row['username'] = processName($row['username']);
}
$name = $row['username'];
}
$_SESSION['cometchat']['username'] = $name;
} else {
$name = $_SESSION['cometchat']['username'];
}
if (!empty($name)) {
$info = $comet->publish(array('channel' => md5('chatroom_' . $to . KEY_A . KEY_B . KEY_C), 'message' => array("from" => $name, "fromid" => $userid, "message" => $styleStart . $message . $styleEnd, "sent" => $insertedid)));
if (defined('SAVE_LOGS') && SAVE_LOGS == 1) {
$sql = "insert into cometchat_chatroommessages (userid,chatroomid,message,sent) values ('" . mysqli_real_escape_string($GLOBALS['dbh'], $userid) . "', '" . mysqli_real_escape_string($GLOBALS['dbh'], $to) . "','" . $styleStart . mysqli_real_escape_string($GLOBALS['dbh'], $message) . $styleEnd . "','" . getTimeStamp() . "')";
$query = mysqli_query($GLOBALS['dbh'], $sql);
}
}
} else {
$sql = "insert into cometchat_chatroommessages (userid,chatroomid,message,sent) values ('" . mysqli_real_escape_string($GLOBALS['dbh'], $userid) . "', '" . mysqli_real_escape_string($GLOBALS['dbh'], $to) . "','" . $styleStart . mysqli_real_escape_string($GLOBALS['dbh'], $message) . $styleEnd . "','" . getTimeStamp() . "')";
$query = mysqli_query($GLOBALS['dbh'], $sql);
$insertedid = mysqli_insert_id($GLOBALS['dbh']);
if ($notsilent == 1) {
sendCCResponse(json_encode(array("id" => $insertedid, "m" => $styleStart . $message . $styleEnd)));
}
if (defined('DEV_MODE') && DEV_MODE == '1') {
echo mysqli_error($GLOBALS['dbh']);
}
}
parsePusher($to, $insertedid, $message, '1');
$sql = "update cometchat_chatrooms set lastactivity = '" . getTimeStamp() . "' where id = '" . mysqli_real_escape_string($GLOBALS['dbh'], $to) . "'";
$query = mysqli_query($GLOBALS['dbh'], $sql);
if ($notsilent != 0) {
return $insertedid;
}
}
示例11: getStatus
function getStatus()
{
global $response;
global $userid;
global $status;
global $startOffline;
global $processFurther;
global $channelprefix;
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']);
}
$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']];
}
$announcementpushchannel = '';
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');
}
$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);
$response['userstatus'] = $_SESSION['cometchat']['user'] = $s;
}
示例12: loadChatroomPro
//.........这里部分代码省略.........
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>';