Esempio n. 1
0
function post_status($content, $type = 'did', $escape = true)
{
    if (!user()) {
        return;
    }
    if ($escape) {
        $content = iescape($content, true);
    }
    $uid = user('id');
    if ($type == 'did') {
        $c = md5($content);
        if ($c == data_read("user/{$uid}/lastdid")) {
            return;
        }
        data_save("user/{$uid}/lastdid", $c);
    }
    $data = array('user' => $uid, 'date' => time(), 'type' => $type, 'content' => $content);
    $data = json_encode($data);
    sync_begin();
    $id = last_post_id() + 1;
    data_save('status/id', $id);
    sync_end();
    data_save("status/post_{$id}", $data);
}
Esempio n. 2
0
            $data['status'] = $_POST['status'];
        }
    }
    if (isset($_POST['tag'])) {
        $data['tag'] = array();
        foreach (preg_split('/\\s+/', $_POST['tag']) as $t) {
            if (!$t) {
                continue;
            }
            $t = strtolower($t);
            $data['tag'][] = $t;
            data_save('ticket/tag/' . base64_encode($t), '');
        }
    }
    data_save($dataF, json_encode($data));
    sync_end();
    header('location: ticket?id=' . $ticketID);
    die;
}
if (isset($_GET['list'])) {
    $list = data_list('ticket', 't_');
    $list = array_reverse($list);
    $max = $_GET['list'] * 1;
    if (!$max) {
        $max = 0x7ffffffffffff;
    }
    $c = 0;
    $ret = array();
    foreach ($list as $k => &$v) {
        $v *= 1;
        if ($v >= $max) {