当前位置: 首页>>代码示例>>PHP>>正文


PHP processName函数代码示例

本文整理汇总了PHP中processName函数的典型用法代码示例。如果您正苦于以下问题:PHP processName函数的具体用法?PHP processName怎么用?PHP processName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了processName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: data

function data()
{
    global $guestsMode;
    global $guestnamePrefix;
    $usertable = TABLE_PREFIX . DB_USERTABLE;
    $usertable_username = DB_USERTABLE_NAME;
    $usertable_userid = DB_USERTABLE_USERID;
    $guestpart = "";
    $criteria = "cometchat.id > '" . mysqli_real_escape_string($GLOBALS['dbh'], $_POST['timestamp']) . "' and ";
    $criteria2 = 'desc';
    if ($guestsMode) {
        $guestpart = "UNION (select cometchat.id id, cometchat.from, cometchat.to, cometchat.message, cometchat.sent, cometchat.read,CONCAT('{$guestnamePrefix}',f.name) fromu, CONCAT('{$guestnamePrefix}',t.name) tou from cometchat, cometchat_guests f, cometchat_guests t where {$criteria} f.id = cometchat.from and t.id = cometchat.to) UNION (select cometchat.id id, cometchat.from, cometchat.to, cometchat.message, cometchat.sent, cometchat.read, f." . $usertable_username . " fromu, CONCAT('{$guestnamePrefix}',t.name) tou from cometchat, " . $usertable . " f, cometchat_guests t where {$criteria} f." . $usertable_userid . " = cometchat.from and t.id = cometchat.to) UNION (select cometchat.id id, cometchat.from, cometchat.to, cometchat.message, cometchat.sent, cometchat.read, CONCAT('{$guestnamePrefix}',f.name) fromu, t." . $usertable_username . " tou from cometchat, cometchat_guests f, " . $usertable . " t where {$criteria} f.id = cometchat.from and t." . $usertable_userid . " = cometchat.to) ";
    }
    $response = array();
    $messages = array();
    if (empty($_POST['timestamp'])) {
        $criteria = '';
        $criteria2 = 'desc limit 20';
    }
    $sql = "(select cometchat.id id, cometchat.from, cometchat.to, cometchat.message, cometchat.sent, cometchat.read, f.{$usertable_username} fromu, t.{$usertable_username} tou from cometchat, {$usertable} f, {$usertable} t where {$criteria} f.{$usertable_userid} = cometchat.from and t.{$usertable_userid} = cometchat.to ) " . $guestpart . " order by id {$criteria2}";
    $query = mysqli_query($GLOBALS['dbh'], $sql);
    $timestamp = $_POST['timestamp'];
    while ($chat = mysqli_fetch_assoc($query)) {
        if (function_exists('processName')) {
            $chat['fromu'] = processName($chat['fromu']);
            $chat['tou'] = processName($chat['tou']);
        }
        $time = $chat['sent'] * 1000;
        if (strpos($chat['message'], 'CC^CONTROL_') === false) {
            array_unshift($messages, array('id' => $chat['id'], 'from' => $chat['from'], 'to' => $chat['to'], 'fromu' => $chat['fromu'], 'tou' => $chat['tou'], 'message' => $chat['message'], 'time' => $time));
        } elseif (strpos($chat['message'], 'sendSticker')) {
            $message = str_replace('CC^CONTROL_', '', $chat['message']);
            $message = json_decode($message);
            $category = $message->params->category;
            $key = $message->params->key;
            $image = '<img class="cometchat_stickerImage" type="image" src="' . BASE_URL . '/plugins/stickers/images/' . $category . '/' . $key . '.png">';
            array_unshift($messages, array('id' => $chat['id'], 'from' => $chat['from'], 'to' => $chat['to'], 'fromu' => $chat['fromu'], 'tou' => $chat['tou'], 'message' => $image, 'time' => $time));
        }
        if ($chat['id'] > $timestamp) {
            $timestamp = $chat['id'];
        }
    }
    $response['timestamp'] = $timestamp;
    $response['online'] = onlineusers();
    if (!empty($messages)) {
        $response['messages'] = $messages;
    }
    header('Content-type: application/json; charset=utf-8');
    echo json_encode($response);
    exit;
}
开发者ID:albertoneto,项目名称:localhost,代码行数:51,代码来源:monitor.m.php

示例2: unban

function unban()
{
    global $userid;
    global $chatrooms_language;
    global $language;
    global $embed;
    global $embedcss;
    global $guestsMode;
    global $basedata;
    global $chromeReorderFix;
    $status['available'] = $language[30];
    $status['busy'] = $language[31];
    $status['offline'] = $language[32];
    $status['invisible'] = $language[33];
    $status['away'] = $language[34];
    if (!empty($_REQUEST['callbackfn']) && $_REQUEST['callbackfn'] == 'mobileapp') {
        $id = mysqli_real_escape_string($GLOBALS['dbh'], $_REQUEST['roomid']);
    } else {
        $id = mysqli_real_escape_string($GLOBALS['dbh'], $_GET['roomid']);
        $inviteid = mysqli_real_escape_string($GLOBALS['dbh'], $_GET['inviteid']);
        $roomname = mysqli_real_escape_string($GLOBALS['dbh'], $_GET['roomname']);
        $popoutmode = mysqli_real_escape_string($GLOBALS['dbh'], $_GET['popoutmode']);
    }
    $cc_theme = '';
    if (!empty($_GET['cc_theme'])) {
        $cc_theme = '&cc_theme=' . $_GET['cc_theme'];
    }
    $time = getTimeStamp();
    $buddyList = array();
    $sql = "select DISTINCT " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " userid, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " username, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " link, " . DB_AVATARFIELD . " avatar, cometchat_status.lastactivity lastactivity, cometchat_status.isdevice isdevice, cometchat_status.status, cometchat_status.message from " . TABLE_PREFIX . DB_USERTABLE . " left join cometchat_status on " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " = cometchat_status.userid right join cometchat_chatrooms_users on " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " =cometchat_chatrooms_users.userid " . DB_AVATARTABLE . " where " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " <> '" . mysqli_real_escape_string($GLOBALS['dbh'], $userid) . "' and cometchat_chatrooms_users.chatroomid = '" . mysqli_real_escape_string($GLOBALS['dbh'], $id) . "' and cometchat_chatrooms_users.isbanned ='1' group by userid order by username asc";
    if ($guestsMode) {
        $sql = getChatroomBannedGuests($id, $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)) {
        $avatar = getAvatar($chat['avatar']);
        if (!empty($chat['username'])) {
            if (function_exists('processName')) {
                $chat['username'] = processName($chat['username']);
            }
            $buddyList[$chromeReorderFix . $chat['userid']] = array('id' => $chat['userid'], 'n' => $chat['username'], 'a' => $avatar);
        }
    }
    if (!empty($_REQUEST['callbackfn']) && $_REQUEST['callbackfn'] == 'mobileapp') {
        $response['unban'] = $buddyList;
        echo json_encode($response);
        exit;
    }
    $s['count'] = '';
    foreach ($buddyList as $buddy) {
        $s['count'] .= '<div class="invite_1" onclick="javascript:document.getElementById(\'check_' . $buddy['id'] . '\').checked = document.getElementById(\'check_' . $buddy['id'] . '\').checked?false:true;"><div class="invite_2"><img height=30 width=30 src="' . $buddy['a'] . '" /></div><div class="invite_3"><span class="invite_name">' . $buddy['n'] . '</span><br/></div><input type="checkbox" onclick="javascript:document.getElementById(\'check_' . $buddy['id'] . '\').checked = document.getElementById(\'check_' . $buddy['id'] . '\').checked?false:true;" name="unban[]" value="' . $buddy['id'] . '" id="check_' . $buddy['id'] . '" class="invite_4" /></div>';
    }
    if ($s['count'] == '') {
        $s['count'] = $chatrooms_language[44];
    }
    echo <<<EOD
<!DOCTYPE html>
<html>
\t<head>
\t\t<title>{$chatrooms_language[21]}</title>
\t\t<meta name="viewport" content="user-scalable=0,width=device-width, height=device-heigth minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0" />
\t\t<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
\t\t<link type="text/css" rel="stylesheet" media="all" href="../../css.php?type=module&name=chatrooms{$cc_theme}" />
\t\t<script src="../../js.php?type=core&name=jquery"></script>
\t\t<script>
\t\t\t\$ = jQuery = jqcc;
\t\t\t\$(function(){
\t\t\t\t\$('.invite_1').click(function() {
\t\t\t\t    var checked = \$( "input:checked" ).length;
\t\t\t\t    if(checked > 0){
\t\t\t\t    \t\$('.invitebutton').attr("disabled", false);
\t\t\t\t    }else{
\t\t\t\t    \t\$('.invitebutton').attr("disabled", true);
\t\t\t\t    }
\t\t\t\t});
\t\t\t});
\t\t</script>
\t</head>
\t<body>
\t\t<form method="post" action="chatrooms.php?action=unbanusers&embed={$embed}&basedata={$basedata}&popoutmode={&popoutmode}">
\t\t\t<div class="cometchat_wrapper">
\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{$s['count']}
\t\t\t\t\t<div style="clear:both"></div>
\t\t\t\t</div>
\t\t\t\t<div class="container_sub {$embedcss}">
\t\t\t\t\t<input type=submit value="Unban Users" class="invitebutton" disabled />
\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;
//.........这里部分代码省略.........
开发者ID:albertoneto,项目名称:localhost,代码行数:101,代码来源:chatrooms.php

示例3: unban

function unban()
{
    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 DISTINCT " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " userid, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " username, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_LASTACTIVITY . " lastactivity, " . DB_AVATARFIELD . " avatar, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " link,  cometchat_status.message, cometchat_status.status from " . TABLE_PREFIX . DB_USERTABLE . " left join cometchat_status on " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " = cometchat_status.userid right join cometchat_chatrooms_users on " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " =cometchat_chatrooms_users.userid " . DB_AVATARTABLE . " where " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " <> '" . mysql_real_escape_string($userid) . "' and cometchat_chatrooms_users.chatroomid = '" . mysql_real_escape_string($id) . "' and cometchat_chatrooms_users.isbanned ='1' order by username asc";
    $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);
    }
    $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="unban[]" value="' . $buddy['id'] . '" id="check_' . $buddy['id'] . '" class="invite_4" /></div>';
    }
    if ($s['available'] == '' && $s['busy'] == '' && $s['away'] == '' && $s['offline'] == '') {
        $s['available'] = $chatrooms_language[44];
    }
    echo <<<EOD
<!DOCTYPE html>
<html>
\t<head>
\t\t<title>{$chatrooms_language[21]}</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=unbanusers&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{$s['available']}{$s['busy']}{$s['away']}{$s['offline']}
\t\t\t\t\t<div style="clear:both"></div>
\t\t\t\t</div>
\t\t\t\t<div class="container_sub {$embedcss}">
\t\t\t\t\t<input type=submit value="Unban Users" 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;
}
开发者ID:quachvancam,项目名称:sugardating,代码行数:79,代码来源:chatrooms.php

示例4: sendChatroomMessage

         $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') {
     $embed = 'web';
     $resize = "parent.resizeCCPopup('broadcast',";
     $embedcss = 'embed';
     $invitefunction = 'parent.loadCCPopup';
 }
开发者ID:hughnguy,项目名称:php,代码行数:31,代码来源:index.php

示例5: searchlogs

function searchlogs()
{
    global $ts;
    global $usertable_userid;
    global $usertable_username;
    global $usertable;
    global $navigation;
    global $body;
    global $moderatorUserIDs;
    include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'chatrooms' . DIRECTORY_SEPARATOR . 'config.php';
    $username = $_REQUEST['susername'];
    if (empty($username)) {
        // Base 64 Encoded
        $username = 'Q293YXJkaWNlIGFza3MgdGhlIHF1ZXN0aW9uIC0gaXMgaXQgc2FmZT8NCkV4cGVkaWVuY3kgYXNrcyB0aGUgcXVlc3Rpb24gLSBpcyBpdCBwb2xpdGljPw0KVmFuaXR5IGFza3MgdGhlIHF1ZXN0aW9uIC0gaXMgaXQgcG9wdWxhcj8NCkJ1dCBjb25zY2llbmNlIGFza3MgdGhlIHF1ZXN0aW9uIC0gaXMgaXQgcmlnaHQ/DQpBbmQgdGhlcmUgY29tZXMgYSB0aW1lIHdoZW4gb25lIG11c3QgdGFrZSBhIHBvc2l0aW9uDQp0aGF0IGlzIG5laXRoZXIgc2FmZSwgbm9yIHBvbGl0aWMsIG5vciBwb3B1bGFyOw0KYnV0IG9uZSBtdXN0IHRha2UgaXQgYmVjYXVzZSBpdCBpcyByaWdodC4=';
    }
    $sql = "select {$usertable_userid} id, {$usertable_username} username from {$usertable} where {$usertable_username} LIKE '%" . mysqli_real_escape_string($GLOBALS['dbh'], sanitize_core($username)) . "%'";
    $query = mysqli_query($GLOBALS['dbh'], $sql);
    $userslist = '';
    while ($user = mysqli_fetch_assoc($query)) {
        if (function_exists('processName')) {
            $user['username'] = processName($user['username']);
        }
        $moderator = '<a style="font-size: 11px; margin-top: 2px; margin-left: 5px; float: right; font-weight: bold; color: #0F5D7E;" href="?module=chatrooms&amp;action=makemoderatorprocess&amp;susername=' . $username . '&amp;moderatorid=' . $user['id'] . '&amp;ts=' . $ts . '"><img style="width: 16px;" title="Make Moderator" src="images/add_moderator.png"></a>';
        if (in_array($user['id'], $moderatorUserIDs)) {
            $moderator = '<a style="font-size: 11px; margin-top: 2px; margin-left: 5px; float: right; font-weight: bold; color: #0F5D7E;" href="?module=chatrooms&amp;action=removemoderatorprocess&amp;susername=' . $username . '&amp;moderatorid=' . $user['id'] . '&amp;ts=' . $ts . '"><img style="width: 16px;" title="Remove Moderator" src="images/remove_moderator.png"></a>';
        }
        $userslist .= '<li class="ui-state-default cursor_default"><span style="font-size:11px;float:left;margin-top:2px;margin-left:5px;">' . $user['username'] . ' - ' . $user['id'] . '</span>' . $moderator . '<div style="clear:both"></div></li>';
    }
    $body = <<<EOD
\t{$navigation}

\t<div id="rightcontent" style="float:left;width:720px;border-left:1px dotted #ccc;padding-left:20px;">
\t\t<h2>Search results</h2>
\t\t<h3>Please find the user id next to each username. <a href="?module=chatrooms&amp;action=finduser&amp;ts={$ts}">Click here to search again</a></h3>

\t\t<div>
\t\t\t<ul id="modules_logs">
\t\t\t\t{$userslist}
\t\t\t</ul>
\t\t</div>

\t\t<div style="clear:both;padding:7.5px;"></div>
\t</div>

\t<div style="clear:both"></div>

EOD;
    template();
}
开发者ID:kostastzo,项目名称:Cometchat,代码行数:49,代码来源:chatrooms.m.php

示例6: dirname

<?php

include dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "modules.php";
$response = array();
$sql = "select DISTINCT " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " userid, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " username, " . DB_AVATARFIELD . " avatar , score, games from " . TABLE_PREFIX . DB_USERTABLE . " " . DB_AVATARTABLE . " join cometchat_games on " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " = cometchat_games.userid order by score desc";
$query = mysql_query($sql);
while ($game = mysql_fetch_array($query)) {
    if (function_exists('processName')) {
        $game['username'] = processName($game['username']);
    }
    $response[] = array('id' => $game['userid'], 'n' => $game['username'], 'a' => getAvatar($game['avatar']), 'gc' => $game['games'], 'tsc' => $game['score']);
}
echo json_encode($response);
开发者ID:quachvancam,项目名称:sugardating,代码行数:13,代码来源:search.php

示例7: distinct

        $embedcss = 'embed';
    }
    if (!empty($_GET['embed']) && $_GET['embed'] == 'desktop') {
        $embed = 'desktop';
        $embedcss = 'embed';
    }
    $usertable = TABLE_PREFIX . DB_USERTABLE;
    $usertable_username = DB_USERTABLE_NAME;
    $usertable_userid = DB_USERTABLE_USERID;
    $body = '';
    $number = 0;
    $sql = "select distinct(m.{$usertable_userid}) `id`, m.{$usertable_username} `name` from cometchat_block, {$usertable} m where m.{$usertable_userid} = toid and fromid = '" . mysql_real_escape_string($userid) . "'";
    $query = mysql_query($sql);
    while ($chat = mysql_fetch_array($query)) {
        if (function_exists('processName')) {
            $chat['name'] = processName($chat['name']);
        }
        ++$number;
        $body = <<<EOD
 {$body}
<div class="chat">
\t\t\t<div class="chatrequest"><b>{$number}</b></div> 
\t\t\t<div class="chatmessage">{$chat['name']}</div>
\t\t\t<div class="chattime"><a href="?action=unblock&id={$chat['id']}&basedata={$_REQUEST['basedata']}&embed={$embed}">{$block_language[4]}</a></div>
\t\t\t<div style="clear:both"></div>
</div> 

EOD;
    }
    if ($number == 0) {
        $body = <<<EOD
开发者ID:Nkelliny,项目名称:MobileDatingApp,代码行数:31,代码来源:index.php

示例8: getBuddyList

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;
        }
    }
}
开发者ID:Nkelliny,项目名称:MobileDatingApp,代码行数:94,代码来源:cometchat_receive.php

示例9: data

function data()
{
    if (USE_COMET == 1 && SAVE_LOGS == 0) {
        echo 0;
    } else {
        global $guestsMode;
        global $guestnamePrefix;
        if (!empty($guestnamePrefix)) {
            $guestnamePrefix .= '-';
        }
        $usertable = TABLE_PREFIX . DB_USERTABLE;
        $usertable_username = DB_USERTABLE_NAME;
        $usertable_userid = DB_USERTABLE_USERID;
        $guestpart = "";
        $criteria = "cometchat.id > '" . mysqli_real_escape_string($GLOBALS['dbh'], $_POST['timestamp']) . "' and ";
        $criteria2 = 'desc';
        if ($guestsMode) {
            $guestpart = "UNION (select cometchat.id id, cometchat.from, cometchat.to, cometchat.message, cometchat.sent, cometchat.read,CONCAT('{$guestnamePrefix}',f.name) fromu, CONCAT('{$guestnamePrefix}',t.name) tou from cometchat, cometchat_guests f, cometchat_guests t where {$criteria} f.id = cometchat.from and t.id = cometchat.to) UNION (select cometchat.id id, cometchat.from, cometchat.to, cometchat.message, cometchat.sent, cometchat.read, f." . $usertable_username . " fromu, CONCAT('{$guestnamePrefix}',t.name) tou from cometchat, " . $usertable . " f, cometchat_guests t where {$criteria} f." . $usertable_userid . " = cometchat.from and t.id = cometchat.to) UNION (select cometchat.id id, cometchat.from, cometchat.to, cometchat.message, cometchat.sent, cometchat.read, CONCAT('{$guestnamePrefix}',f.name) fromu, t." . $usertable_username . " tou from cometchat, cometchat_guests f, " . $usertable . " t where {$criteria} f.id = cometchat.from and t." . $usertable_userid . " = cometchat.to) ";
        }
        $response = array();
        $messages = array();
        if (empty($_POST['timestamp'])) {
            $criteria = '';
            $criteria2 = 'desc limit 20';
        }
        $sql = "(select cometchat.id id, cometchat.from, cometchat.to, cometchat.message, cometchat.sent, cometchat.read, f.{$usertable_username} fromu, t.{$usertable_username} tou from cometchat, {$usertable} f, {$usertable} t where {$criteria} f.{$usertable_userid} = cometchat.from and t.{$usertable_userid} = cometchat.to ) " . $guestpart . " order by id {$criteria2}";
        $query = mysqli_query($GLOBALS['dbh'], $sql);
        $timestamp = $_POST['timestamp'];
        while ($chat = mysqli_fetch_assoc($query)) {
            if (function_exists('processName')) {
                $chat['fromu'] = processName($chat['fromu']);
                $chat['tou'] = processName($chat['tou']);
            }
            $time = $chat['sent'] * 1000;
            if (strpos($chat['message'], 'CC^CONTROL_') === false) {
                array_unshift($messages, array('id' => $chat['id'], 'from' => $chat['from'], 'to' => $chat['to'], 'fromu' => $chat['fromu'], 'tou' => $chat['tou'], 'message' => $chat['message'], 'time' => $time));
            }
            if ($chat['id'] > $timestamp) {
                $timestamp = $chat['id'];
            }
        }
        $response['timestamp'] = $timestamp;
        $response['online'] = onlineusers();
        if (!empty($messages)) {
            $response['messages'] = $messages;
        }
        header('Content-type: application/json; charset=utf-8');
        echo json_encode($response);
    }
    exit;
}
开发者ID:hughnguy,项目名称:php,代码行数:51,代码来源:monitor.m.php

示例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;
    }
}
开发者ID:networksoft,项目名称:goldenquick.pekcellgold.com,代码行数:70,代码来源:cometchat_shared.php

示例11: array

\t<body>
\t<div class="container">
\t<div class="container_title {$embedcss}" >{$block_language[3]}</div>

\t<div class="container_body {$embedcss}">

\t{$body}

\t</div>
\t</div>
\t</div>
\t</body>
\t</html>
EOD;
    } else {
        $response = array();
        while ($chat = mysqli_fetch_assoc($query)) {
            if (function_exists('processName')) {
                $blockedName = processName($chat['name']);
            } else {
                $blockedName = $chat['name'];
            }
            $blockedID = $chat['id'];
            $response[$blockedID] = array('id' => $blockedID, 'name' => $blockedName);
        }
        if (empty($response)) {
            $response = json_decode('{}');
        }
        echo json_encode($response);
    }
}
开发者ID:kostastzo,项目名称:Cometchat,代码行数:31,代码来源:index.php

示例12: getBuddyList

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];
                    }
                }
//.........这里部分代码省略.........
开发者ID:albertoneto,项目名称:localhost,代码行数:101,代码来源:cometchat_receive.php

示例13: viewuserconversation

function viewuserconversation()
{
    checktoken();
    global $db;
    global $body;
    global $trayicon;
    global $navigation;
    global $usertable_userid;
    global $usertable_username;
    global $usertable;
    $userid = $_GET['data'];
    $userid2 = $_GET['data2'];
    $sql = "select {$usertable_username} username from {$usertable} where {$usertable_userid} = '" . mysql_real_escape_string($userid) . "'";
    $query = mysql_query($sql);
    $usern = mysql_fetch_array($query);
    $sql = "select {$usertable_username} username from {$usertable} where {$usertable_userid} = '" . mysql_real_escape_string($userid2) . "'";
    $query = mysql_query($sql);
    $usern2 = mysql_fetch_array($query);
    $sql = "(select m.*  from cometchat m where  (m.from = '" . mysql_real_escape_string($userid) . "' and m.to = '" . mysql_real_escape_string($userid2) . "') or (m.to = '" . mysql_real_escape_string($userid) . "' and m.from = '" . mysql_real_escape_string($userid2) . "'))\n\torder by id desc";
    $query = mysql_query($sql);
    $userslist = '';
    while ($chat = mysql_fetch_array($query)) {
        $time = date('g:iA M dS', $chat['sent']);
        if ($userid == $chat['from']) {
            $dir = '>';
        } else {
            $dir = '<';
        }
        $userslist .= '<li class="ui-state-default"><span style="font-size:11px;float:left;margin-top:2px;margin-left:0px;width:10px;margin-right:10px;color:#fff;background-color:#333;padding:0px;-moz-border-radius:5px;-webkit-border-radius:5px;"><b>' . $dir . '</b></span><span style="font-size:11px;float:left;margin-top:2px;margin-left:5px;width:560px;">&nbsp; ' . $chat['message'] . '</span><span style="font-size:11px;float:right;width:100px;overflow:hidden;margin-top:2px;margin-left:10px;">' . $time . '</span><div style="clear:both"></div></li>';
    }
    if (function_exists('processName')) {
        $usern['username'] = processName($usern['username']);
        $usern2['username'] = processName($usern2['username']);
    }
    $body = <<<EOD
\t{$navigation}
\t<form action="?module=logs&action=newlogprocess" method="post" enctype="multipart/form-data">
\t<div id="rightcontent" style="float:left;width:720px;border-left:1px dotted #ccc;padding-left:20px;">
\t\t<h2>Log between {$usern['username']} and {$usern2['username']}</h2>
\t\t<h3>To see other conversations of {$usern['username']}, <a href="?module=logs&action=viewuser&data={$userid}">click here</a></h3>

\t\t<div>
\t\t\t<ul id="modules_logslong">
\t\t\t\t{$userslist}
\t\t\t</ul>
\t\t</div>
\t</div>

\t<div style="clear:both"></div>

EOD;
    template();
}
开发者ID:rezarahimi4861,项目名称:icmf,代码行数:53,代码来源:logs.m.php

示例14: viewuserchatroomconversation

function viewuserchatroomconversation()
{
    global $ts;
    global $body;
    global $navigation;
    global $usertable_userid;
    global $usertable_username;
    global $usertable;
    global $guestsMode;
    global $guestnamePrefix;
    if (!empty($guestnamePrefix)) {
        $guestnamePrefix .= '-';
    }
    if ($guestsMode) {
        $usertable = "(select " . $usertable_userid . ", " . $usertable_username . "  from " . $usertable . " union select id " . $usertable_userid . ",concat('" . $guestnamePrefix . "',name) " . $usertable_username . " from cometchat_guests)";
    }
    $chatroomid = $_GET['data'];
    $sql = "select name chatroomname from cometchat_chatrooms where id = '" . mysqli_real_escape_string($GLOBALS['dbh'], $chatroomid) . "'";
    $query = mysqli_query($GLOBALS['dbh'], $sql);
    $chatroomn = mysqli_fetch_assoc($query);
    $sql = "select cometchat_chatroommessages.*, f." . $usertable_username . " username  from cometchat_chatroommessages join " . $usertable . " f on cometchat_chatroommessages.userid = f." . $usertable_userid . " where chatroomid = '" . mysqli_real_escape_string($GLOBALS['dbh'], $chatroomid) . "' order by id desc LIMIT 200";
    $query = mysqli_query($GLOBALS['dbh'], $sql);
    $chatroomlog = '';
    while ($chat = mysqli_fetch_assoc($query)) {
        if (function_exists('processName')) {
            $chatroomn['chatroomname'] = processName($chatroomn['chatroomname']);
        }
        $time = $chat['sent'];
        $chatroomlog .= '<li class="ui-state-default"><span style="font-size: 11px; float: left; margin-top: 2px; margin-left: 0px; width: 8em; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; padding: 0px; text-align: center;">' . $chat["username"] . '</span><span style="font-size:11px;float:left;margin-top:2px;margin-left:5px;width:495px;">&nbsp; ' . $chat['message'] . '</span><span style="font-size:11px;float:right;width:100px;overflow:hidden;margin-top:2px;margin-left:10px;"><span class="chat_time" timestamp="' . $time . '"></span></span><div style="clear:both"></div></li>';
    }
    $body = <<<EOD
\t{$navigation}
        <link href="../css.php?admin=1" media="all" rel="stylesheet" type="text/css" />
\t<form action="?module=logs&action=newlogprocess&ts={$ts}" method="post" enctype="multipart/form-data">
\t<div id="rightcontent" style="float:left;width:720px;border-left:1px dotted #ccc;padding-left:20px;">
\t\t<h2>Log of  in {$chatroomn['chatroomname']} chatroom</h2>
\t\t<h3>To see other conversations of  in other chatrooms, <a href="?module=logs&action=chatroomlog&ts={$ts}">click here</a></h3>

\t\t<div>
\t\t\t<ul id="modules_logslong">
\t\t\t\t{$chatroomlog}
\t\t\t</ul>
\t\t</div>
\t</div>

\t<div style="clear:both"></div>

EOD;
    template();
}
开发者ID:rodino25,项目名称:tsv2,代码行数:50,代码来源:logs.m.php

示例15: logs

function logs()
{
    global $db;
    $usertable = TABLE_PREFIX . DB_USERTABLE;
    $usertable_username = DB_USERTABLE_NAME;
    $usertable_userid = DB_USERTABLE_USERID;
    global $body;
    global $userid;
    global $chathistory_language;
    if (!empty($_GET['id'])) {
        logsview();
    }
    $sql = "select m1.*, f.{$usertable_username} fromu, t.{$usertable_username} tou from cometchat m1, {$usertable} f, {$usertable} t  \n\twhere  f.{$usertable_userid} = m1.from and t.{$usertable_userid} = m1.to and ((m1.from = '" . mysql_real_escape_string($userid) . "') or (m1.to = '" . mysql_real_escape_string($userid) . "')) and (m1.sent) > ALL\n\t(select (m2.sent)+1800 from cometchat m2\n\twhere ((m2.to = m1.to and m2.from = m1.from) or (m2.to = m1.from and m2.from = m1.to))\n\tand m2.sent <= m1.sent and m2.id < m1.id) order by id desc";
    if (!empty($_GET['history'])) {
        $history = $_GET['history'];
        $sql = "select m1.*, f.{$usertable_username} fromu, t.{$usertable_username} tou from cometchat m1, {$usertable} f, {$usertable} t  \n\twhere  f.{$usertable_userid} = m1.from and t.{$usertable_userid} = m1.to and ((m1.from = '" . mysql_real_escape_string($userid) . "' and m1.to = '" . mysql_real_escape_string($history) . "') or (m1.to = '" . mysql_real_escape_string($userid) . "' and m1.from = '" . mysql_real_escape_string($history) . "')) and (m1.sent) > ALL\n\t(select (m2.sent)+1800 from cometchat m2\n\twhere ((m2.to = m1.to and m2.from = m1.from) or (m2.to = m1.from and m2.from = m1.to))\n\tand m2.sent <= m1.sent and m2.id < m1.id) order by id desc";
    }
    $query = mysql_query($sql);
    $chatdata = '<table>';
    $previd = 1000000;
    while ($chat = mysql_fetch_array($query)) {
        if (function_exists('processName')) {
            $chat['fromu'] = processName($chat['fromu']);
            $chat['tou'] = processName($chat['tou']);
        }
        $requester = $chat['fromu'];
        if ($chat['from'] == '1') {
            $requester = $chat['tou'];
            $chat['fromu'] = $chathistory_language[1];
        }
        $time = date('g:iA M dS', $chat['sent'] + $_SESSION['cometchat']['timedifference']);
        $chat['message'] = strip_tags($chat['message']);
        $encode = base64_encode($chat['id'] . "," . $previd);
        $chatdata = <<<EOD
 {$chatdata}
<div class="chat" id="{$encode}">
\t\t\t<div class="chatrequest"><b>{$chat['fromu']}</b></div> 
\t\t\t<div class="chatmessage chatmessage_short">{$chat['message']}</div>
\t\t\t<div class="chattime">{$time}</div>
\t\t\t<div style="clear:both"></div>
</div> 

EOD;
        $previd = $chat['id'];
    }
    $chatdata .= '</table>';
    $history = '';
    if (!empty($_GET['history'])) {
        $history = '+"&history=' . $_GET['history'] . '"';
    }
    if (!empty($_GET['embed']) && $_GET['embed'] == 'web') {
        $history .= '+"&embed=web"';
    }
    if (!empty($_GET['embed']) && $_GET['embed'] == 'desktop') {
        $history .= '+"&embed=desktop"';
    }
    $baseData = $_REQUEST['basedata'];
    $body = <<<EOD
\t<script>
\t\tjQuery(document).ready(function () {
\t\t\t\$('.chat').mouseover(function() {
\t\t\t\t\$(this).addClass('chatbg');
\t\t\t});

\t\t\t\$('.chat').mouseout(function() {
\t\t\t\t\$(this).removeClass('chatbg');
\t\t\t});

\t\t\t\$('.chat').click(function() {
\t\t\t\tvar id = \$(this).attr('id');
\t\t\t\tlocation.href = "?action=logs&basedata={$baseData}&id="+id{$history};
\t\t\t});
\t\t});
\t</script>\t
\t{$chatdata}
EOD;
    template();
}
开发者ID:rezarahimi4861,项目名称:icmf,代码行数:78,代码来源:index.php


注:本文中的processName函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。