Ejemplo n.º 1
0
    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 {
        array_push($room_ids, $key);
    }
}
$data = array('rooms' => join(',', $room_ids), 'buddies' => join(',', array_unique(array_merge($friend_ids, $buddy_ids, $stranger_ids))), 'domain' => $_IMC['domain'], 'apikey' => $_IMC['apikey'], 'endpoint' => $space['uid'], 'nick' => to_unicode($nick));
$client = new HttpClient($_IMC['imsvr'], $_IMC['impost']);
$client->post('/presences/online', $data);
$pageContents = $client->getContent();
//TODO: handle errors!
$pageData = json_decode($pageContents);
if ($client->status != "200" || empty($pageData->ticket)) {
    $ticket = "";
} else {
    $ticket = $pageData->ticket;
}
if (empty($ticket)) {
    //登录失败
    echo '{status: "' . $client->status . '", "errorMsg":"' . $pageContents . '"}';
    exit;
}
Ejemplo n.º 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";
Ejemplo n.º 3
0
/**
 * UTF-8 aware alternative to strtoupper.
 *
 * Make a string uppercase.
 *
 * The concept of a characters "case" only exists is some alphabets such as
 * Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in
 * the Chinese alphabet, for example. See Unicode Standard Annex #21: Case Mappings.
 *
 * @author Andreas Gohr <*****@*****.**>
 * @see    http://www.php.net/strtoupper
 * @see    utf8_to_unicode
 * @see    utf8_from_unicode
 * @see    http://www.unicode.org/reports/tr21/tr21-5.html
 * @see    http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php
 *
 * @param string $string
 *
 * @return mixed either string in lowercase or FALSE is UTF-8 invalid
 */
function to_upper($string)
{
    static $UTF8_LOWER_TO_UPPER;
    $uni = to_unicode($string);
    if (!$uni) {
        return false;
    }
    if (!$UTF8_LOWER_TO_UPPER) {
        $UTF8_LOWER_TO_UPPER = array(0x61 => 0x41, 0x3c6 => 0x3a6, 0x163 => 0x162, 0xe5 => 0xc5, 0x62 => 0x42, 0x13a => 0x139, 0xe1 => 0xc1, 0x142 => 0x141, 0x3cd => 0x38e, 0x101 => 0x100, 0x491 => 0x490, 0x3b4 => 0x394, 0x15b => 0x15a, 0x64 => 0x44, 0x3b3 => 0x393, 0xf4 => 0xd4, 0x44a => 0x42a, 0x439 => 0x419, 0x113 => 0x112, 0x43c => 0x41c, 0x15f => 0x15e, 0x144 => 0x143, 0xee => 0xce, 0x45e => 0x40e, 0x44f => 0x42f, 0x3ba => 0x39a, 0x155 => 0x154, 0x69 => 0x49, 0x73 => 0x53, 0x1e1f => 0x1e1e, 0x135 => 0x134, 0x447 => 0x427, 0x3c0 => 0x3a0, 0x438 => 0x418, 0xf3 => 0xd3, 0x440 => 0x420, 0x454 => 0x404, 0x435 => 0x415, 0x449 => 0x429, 0x14b => 0x14a, 0x431 => 0x411, 0x459 => 0x409, 0x1e03 => 0x1e02, 0xf6 => 0xd6, 0xf9 => 0xd9, 0x6e => 0x4e, 0x451 => 0x401, 0x3c4 => 0x3a4, 0x443 => 0x423, 0x15d => 0x15c, 0x453 => 0x403, 0x3c8 => 0x3a8, 0x159 => 0x158, 0x67 => 0x47, 0xe4 => 0xc4, 0x3ac => 0x386, 0x3ae => 0x389, 0x167 => 0x166, 0x3be => 0x39e, 0x165 => 0x164, 0x117 => 0x116, 0x109 => 0x108, 0x76 => 0x56, 0xfe => 0xde, 0x157 => 0x156, 0xfa => 0xda, 0x1e61 => 0x1e60, 0x1e83 => 0x1e82, 0xe2 => 0xc2, 0x119 => 0x118, 0x146 => 0x145, 0x70 => 0x50, 0x151 => 0x150, 0x44e => 0x42e, 0x129 => 0x128, 0x3c7 => 0x3a7, 0x13e => 0x13d, 0x442 => 0x422, 0x7a => 0x5a, 0x448 => 0x428, 0x3c1 => 0x3a1, 0x1e81 => 0x1e80, 0x16d => 0x16c, 0xf5 => 0xd5, 0x75 => 0x55, 0x177 => 0x176, 0xfc => 0xdc, 0x1e57 => 0x1e56, 0x3c3 => 0x3a3, 0x43a => 0x41a, 0x6d => 0x4d, 0x16b => 0x16a, 0x171 => 0x170, 0x444 => 0x424, 0xec => 0xcc, 0x169 => 0x168, 0x3bf => 0x39f, 0x6b => 0x4b, 0xf2 => 0xd2, 0xe0 => 0xc0, 0x434 => 0x414, 0x3c9 => 0x3a9, 0x1e6b => 0x1e6a, 0xe3 => 0xc3, 0x44d => 0x42d, 0x436 => 0x416, 0x1a1 => 0x1a0, 0x10d => 0x10c, 0x11d => 0x11c, 0xf0 => 0xd0, 0x13c => 0x13b, 0x45f => 0x40f, 0x45a => 0x40a, 0xe8 => 0xc8, 0x3c5 => 0x3a5, 0x66 => 0x46, 0xfd => 0xdd, 0x63 => 0x43, 0x21b => 0x21a, 0xea => 0xca, 0x3b9 => 0x399, 0x17a => 0x179, 0xef => 0xcf, 0x1b0 => 0x1af, 0x65 => 0x45, 0x3bb => 0x39b, 0x3b8 => 0x398, 0x3bc => 0x39c, 0x45c => 0x40c, 0x43f => 0x41f, 0x44c => 0x42c, 0xfe => 0xde, 0xf0 => 0xd0, 0x1ef3 => 0x1ef2, 0x68 => 0x48, 0xeb => 0xcb, 0x111 => 0x110, 0x433 => 0x413, 0x12f => 0x12e, 0xe6 => 0xc6, 0x78 => 0x58, 0x161 => 0x160, 0x16f => 0x16e, 0x3b1 => 0x391, 0x457 => 0x407, 0x173 => 0x172, 0xff => 0x178, 0x6f => 0x4f, 0x43b => 0x41b, 0x3b5 => 0x395, 0x445 => 0x425, 0x121 => 0x120, 0x17e => 0x17d, 0x17c => 0x17b, 0x3b6 => 0x396, 0x3b2 => 0x392, 0x3ad => 0x388, 0x1e85 => 0x1e84, 0x175 => 0x174, 0x71 => 0x51, 0x437 => 0x417, 0x1e0b => 0x1e0a, 0x148 => 0x147, 0x105 => 0x104, 0x458 => 0x408, 0x14d => 0x14c, 0xed => 0xcd, 0x79 => 0x59, 0x10b => 0x10a, 0x3ce => 0x38f, 0x72 => 0x52, 0x430 => 0x410, 0x455 => 0x405, 0x452 => 0x402, 0x127 => 0x126, 0x137 => 0x136, 0x12b => 0x12a, 0x3af => 0x38a, 0x44b => 0x42b, 0x6c => 0x4c, 0x3b7 => 0x397, 0x125 => 0x124, 0x219 => 0x218, 0xfb => 0xdb, 0x11f => 0x11e, 0x43e => 0x41e, 0x1e41 => 0x1e40, 0x3bd => 0x39d, 0x107 => 0x106, 0x3cb => 0x3ab, 0x446 => 0x426, 0xfe => 0xde, 0xe7 => 0xc7, 0x3ca => 0x3aa, 0x441 => 0x421, 0x432 => 0x412, 0x10f => 0x10e, 0xf8 => 0xd8, 0x77 => 0x57, 0x11b => 0x11a, 0x74 => 0x54, 0x6a => 0x4a, 0x45b => 0x40b, 0x456 => 0x406, 0x103 => 0x102, 0x3bb => 0x39b, 0xf1 => 0xd1, 0x43d => 0x41d, 0x3cc => 0x38c, 0xe9 => 0xc9, 0xf0 => 0xd0, 0x457 => 0x407, 0x123 => 0x122);
    }
    $cnt = count($uni);
    for ($i = 0; $i < $cnt; $i++) {
        if (isset($UTF8_LOWER_TO_UPPER[$uni[$i]])) {
            $uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]];
        }
    }
    return from_unicode($uni);
}
Ejemplo n.º 4
0
                            <div class="webim-count">
                                0
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        </div>
<?php 
$template = ob_get_clean();
$template = preg_replace("/>\\s+?</i", "><", $template);
$template = preg_replace("/\r\n\\s*/i", "", $template);
$template = to_unicode(to_utf8($template));
$emot = array("dir" => urldecode($_GET['folder']) . "static/images/emot/" . $_IMC['emot'] . "/", "emots" => array(array("t" => "smile", "src" => "smile.png", "q" => array(":)")), array("t" => "smile_big", "src" => "smile-big.png", "q" => array(":d", ":-d", ":D", ":-D")), array("t" => "sad", "src" => "sad.png", "q" => array(":(", ":-(")), array("t" => "wink", "src" => "wink.png", "q" => array(";)", ";-)")), array("t" => "tongue", "src" => "tongue.png", "q" => array(":p", ":-p", ":P", ":-P")), array("t" => "shock", "src" => "shock.png", "q" => array("=-O", "=-o")), array("t" => "kiss", "src" => "kiss.png", "q" => array(":-*")), array("t" => "glasses_cool", "src" => "glasses-cool.png", "q" => array("8-)")), array("t" => "embarrassed", "src" => "embarrassed.png", "q" => array(":-[")), array("t" => "crying", "src" => "crying.png", "q" => array(":'(")), array("t" => "thinking", "src" => "thinking.png", "q" => array(":-/", ":-\\")), array("t" => "angel", "src" => "angel.png", "q" => array("O:-)", "o:-)")), array("t" => "shut_mouth", "src" => "shut-mouth.png", "q" => array(":-X", ":-x")), array("t" => "moneymouth", "src" => "moneymouth.png", "q" => array(":-\$")), array("t" => "foot_in_mouth", "src" => "foot-in-mouth.png", "q" => array(":-!")), array("t" => "shout", "src" => "shout.png", "q" => array(">:o", ">:O"))));
$emot = to_unicode($emot);
?>
(function($){
   $ && $.noConflict();
   <?php 
if (empty($_SGLOBAL['supe_uid'])) {
    echo "return;";
}
?>
   var folder = "<?php 
echo urldecode($_GET['folder']);
?>
";
   webim_css_link(folder + "static/css/theme_<?php 
echo $_IMC['theme'];
?>
Ejemplo n.º 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;
}