Пример #1
0
<?php

include_once 'common.php';
if (empty($space)) {
    exit;
}
$name = nick($space);
require 'http_client.php';
$stranger_ids = ids_except($space['uid'], ids_array(gp("stranger_ids")));
//陌生人
$friend_ids = ids_array($space['friends']);
//好友
$buddy_ids = ids_array(gp("buddy_ids"));
//正在聊天的联系人
$new_messages = find_new_message();
//查找离线消息
for ($i = 0; $i < count($new_messages); $i++) {
    $msg_uid = $new_messages[$i]["from"];
    array_push($buddy_ids, $msg_uid);
    array_push($stranger_ids, $msg_uid);
}
//Login webim server.
$nick = to_utf8($name);
$setting = setting();
$block_list = is_array($setting->block_list) ? $setting->block_list : array();
$rooms = find_room();
$room_ids = array();
foreach ($rooms as $key => $value) {
    if (in_array($key, $block_list)) {
        $rooms[$key]['blocked'] = true;
    } else {
Пример #2
0
<?php

include_once 'common.php';
require 'http_client.php';
$ticket = gp('ticket');
$body = gp('body', '');
$style = gp('style', 'msg');
$to = gp('to');
$from = $space['uid'];
$time = microtime(true) * 1000;
if (empty($to) || empty($from)) {
    echo '{error:true}';
    exit;
}
$client = new HttpClient($_IMC['imsvr'], $_IMC['impost']);
$nick = to_unicode(to_utf8(nick($space)));
$client->post('/messages', array('domain' => $_IMC['domain'], 'apikey' => $_IMC['apikey'], 'ticket' => $ticket, 'nick' => $nick, 'to' => $to, 'body' => to_unicode($body), 'timestamp' => (string) $time, 'style' => $style));
//TODO: if forward message successfully.
$message = array('to' => $to, 'from' => $from, 'style' => $style, 'body' => from_utf8($body), 'timestamp' => $time);
inserttable('im_histories', $message);
echo "ok";
Пример #3
0
        ?>
' >
                              <div class="col-md-2 col-sm-2 hidden-xs">
                                <figure class="thumbnail">
                                  <figcaption class="text-center"><?php 
        echo img('images/usuarios/' . $comentario['autor'] . '.jpeg');
        ?>
</figcaption>
                                </figure>
                              </div>
                              <div class="col-md-10 col-sm-10">
                                <div class="panel panel-default arrow left">
                                  <div class="panel-body">
                                    <header class="text-left">
                                      <div class="comment-user"><i class="fa fa-user"><h4><?php 
        echo nick($comentario['autor']);
        ?>
</h4></i> </div>
                                     </header>
                                    <div class="comment-post">
                                      <p id="contenido<?php 
        echo $comentario['id'];
        ?>
">
                                        <?php 
        echo $comentario['contenido'];
        ?>
                                      </p>
                                    </div>
                                    <p class="text-right"><a id=<?php 
        echo $comentario['id'];
Пример #4
0
function find_history($ids)
{
    global $_SGLOBAL, $_IMC, $space;
    $uid = $space['uid'];
    $histories = array();
    $ids = ids_array($ids);
    if (empty($ids)) {
        return array();
    }
    for ($i = 0; $i < count($ids); $i++) {
        $id = $ids[$i];
        $list = array();
        if ((int) $id < $_IMC['room_id_pre']) {
            $query = $_SGLOBAL['db']->query("SELECT * FROM " . im_tname('histories') . " WHERE (`to`='{$id}' and `from`='{$uid}'  and fromdel=0) or (`to`='{$uid}' and `from`='{$id}'  and todel=0 and send=1) ORDER BY timestamp DESC LIMIT 30");
            while ($value = $_SGLOBAL['db']->fetch_array($query)) {
                array_unshift($list, array('to' => $value['to'], 'from' => $value['from'], 'style' => $value['style'], 'body' => to_utf8($value['body']), 'timestamp' => $value['timestamp'], 'type' => $value['type'], 'new' => 0));
            }
        } else {
            $query = $_SGLOBAL['db']->query("SELECT main.*, s.username, s.name FROM " . im_tname('histories') . " main\n             \tLEFT JOIN " . tname('space') . " s ON s.uid=main.from\n             \t WHERE `to`='{$id}' ORDER BY timestamp DESC LIMIT 30");
            while ($value = $_SGLOBAL['db']->fetch_array($query)) {
                $nick = nick($value);
                array_unshift($list, array('to' => $value['to'], 'nick' => to_utf8($nick), 'from' => $value['from'], 'style' => $value['style'], 'body' => to_utf8($value['body']), 'timestamp' => $value['timestamp']));
            }
        }
        $histories[$id] = $list;
    }
    return $histories;
}
Пример #5
0
<?php

include_once 'common.php';
require 'http_client.php';
$ticket = gp('ticket');
if (!empty($ticket)) {
    $data = array('ticket' => $ticket, 'domain' => $_IMC['domain'], 'apikey' => $_IMC['apikey'], 'to' => gp('to'), 'nick' => to_unicode(to_utf8(nick($space))), 'from' => $space['uid'], 'show' => gp('show'));
    //Logout webim server.
    $client = new HttpClient($_IMC['imsvr'], $_IMC['impost']);
    $client->post('/statuses', $data);
    $pageContents = $client->getContent();
    echo $pageContents;
}