Ejemplo n.º 1
0
function xmt_twt_raw_imp($acc, $req, $typ = 'twt')
{
    global $xmt_acc;
    if ($typ == 'dmg') {
        $req = str_replace('direct-messages', 'statuses', $req);
        $req = str_replace('direct_message', 'status', $req);
        $req = str_replace('sender', 'user', $req);
    }
    if ($req == '') {
        return;
    }
    $arr_twt = json_decode($req, true);
    if (!$arr_twt) {
        xmt_log($req);
        return;
    } elseif ($arr_twt['errors']) {
        xmt_log($arr_twt['errors'][0]['message'] . ' (Code: ' . $arr_twt['errors'][0]['code'] . ')');
        return;
    }
    foreach ($arr_twt as $res) {
        $twt_typ = $typ;
        if ($res['retweeted']) {
            $twt_typ = 'rtw';
        }
        $rpl = (string) $res['in_reply_to_screen_name'];
        if ($rpl != '') {
            if ($rpl == $xmt_acc[$acc]['cfg']['twt_usr_nme']) {
                $twt_typ = 'rty';
            } else {
                $twt_typ = 'rfy';
            }
        }
        xmt_twt_ins($acc, array('id' => (string) $res['id_str'], 'twt' => (string) $res['text'], 'ath' => (string) $res['user']['screen_name'], 'src' => (string) $res['source'], 'dtp' => date('Y-m-d H:i:s', xmt_get_time((string) $res['created_at'])), 'typ' => $twt_typ));
        xmt_ath_ins(array('uid' => (string) $res['user']['screen_name'], 'nme' => (string) $res['user']['name'], 'img_url' => (string) $res['user']['profile_image_url']));
    }
    unset($arr_twt);
}
Ejemplo n.º 2
0
function xmt_parse_time($dt, $date_format, $gmt_cst_add = 0)
{
    $timestamp = '';
    if ($date_format != '') {
        if ($date_format == 'span') {
            $timestamp .= xmt_time_span(xmt_get_time($dt, $gmt_cst_add));
        } else {
            $timestamp .= date($date_format, xmt_get_time($dt, $gmt_cst_add));
        }
    }
    return $timestamp;
}