Example #1
0
<?php

include_once 'common.php';
$data = gp('data');
if (!empty($data)) {
    $_SGLOBAL['db']->query("UPDATE " . im_tname('setting') . " SET web='{$data}' WHERE uid={$space['uid']}");
}
echo "{success:true}";
Example #2
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;
}
Example #3
0
$body = gp('body', '');
$style = gp('style', '');
$to = gp('to');
$send = gp('offline') == "1" ? false : true;
$type = gp('type');
$from = $space['uid'];
$time = microtime(true) * 1000;
#$time = time();
if (empty($to) || empty($from)) {
    echo '{success:false}';
    exit;
}
#if($type=='multicast'){
#   $to = $to + $_IMC['room_id_pre'];
#}
$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, 'type' => $type, 'to' => $to, 'body' => to_unicode($body), 'timestamp' => $time, 'style' => $style));
$pageContents = $client->getContent();
//TODO:send => true if forward message successfully.
//
$body = from_utf8($body);
$columns = "`uid`,`send`,`to`,`from`,`style`,`body`,`timestamp`,`type`";
$values_from = "'{$from}','1','{$to}','{$from}','{$style}','{$body}','{$time}','{$type}'";
$values_to = "'{$to}','{$send}','{$to}','{$from}','{$style}','{$body}','{$time}','{$type}'";
$_SGLOBAL['db']->query("INSERT INTO " . im_tname('histories') . " ({$columns}) VALUES ({$values_to})");
$output = array();
$output["success"] = $send;
$output["msg"] = $pageContents;
#$output['timestamp'] = time();
echo json_encode($output);
Example #4
0
include_once 'common.php';
if ($ucappopen['UCHOME']) {
    $menu = array(array("title" => 'doing', "icon" => $uchomeurl . "/image/app/doing.gif", "link" => $uchomeurl . "/space.php?do=doing"), array("title" => 'album', "icon" => $uchomeurl . "/image/app/album.gif", "link" => $uchomeurl . "/space.php?do=album"), array("title" => 'blog', "icon" => $uchomeurl . "/image/app/blog.gif", "link" => $uchomeurl . "/space.php?do=blog"), array("title" => 'thread', "icon" => $uchomeurl . "/image/app/mtag.gif", "link" => $uchomeurl . "/space.php?do=thread"), array("title" => 'share', "icon" => $uchomeurl . "/image/app/share.gif", "link" => $uchomeurl . "/space.php?do=share"));
}
if ($_SCONFIG['my_status']) {
    if (is_array($_SGLOBAL['userapp'])) {
        foreach ($_SGLOBAL['userapp'] as $value) {
            $menu[] = array("title" => $value['appname'], "icon" => "http://appicon.manyou.com/icons/" . $value['appid'], "link" => "userapp.php?id=" . $value['appid']);
        }
    }
}
if (!empty($_SGLOBAL['supe_uid'])) {
    $setting = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query("SELECT * FROM " . im_tname('setting') . " WHERE uid='{$_SGLOBAL['supe_uid']}'"));
    if (empty($setting)) {
        $setting = array('uid' => $space['uid'], 'web' => "");
        $_SGLOBAL['db']->query("INSERT INTO " . im_tname('setting') . " (uid,web) VALUES ({$_SGLOBAL['supe_uid']},'')");
    }
    $setting = $setting["web"];
}
$setting = empty($setting) ? "{}" : $setting;
?>

//custom
(function(webim){
	var path = "";
	path = document.location.href.split("/webim");
	path = path.length > 1 ? (path[0] + "/") : "";
        var menu = webim.JSON.decode('<?php 
echo json_encode($menu);
?>
');
Example #5
0
function setting()
{
    global $_SGLOBAL, $_IMC, $space;
    if (!empty($_SGLOBAL['supe_uid'])) {
        $setting = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query("SELECT * FROM " . im_tname('setting') . " WHERE uid='{$_SGLOBAL['supe_uid']}'"));
        if (empty($setting)) {
            $setting = array('uid' => $space['uid'], 'web' => "");
            $_SGLOBAL['db']->query("INSERT INTO " . im_tname('setting') . " (uid,web) VALUES ({$_SGLOBAL['supe_uid']},'')");
        }
        $setting = $setting["web"];
    }
    return json_decode(empty($setting) ? "{}" : $setting);
}