Exemple #1
0
    $dfrn_id = $orig_id = $r[0]['issued-id'] ? $r[0]['issued-id'] : $r[0]['dfrn-id'];
    if ($r[0]['duplex'] && $r[0]['issued-id']) {
        $orig_id = $r[0]['issued-id'];
        $dfrn_id = '1:' . $orig_id;
    }
    if ($r[0]['duplex'] && $r[0]['dfrn-id']) {
        $orig_id = $r[0]['dfrn-id'];
        $dfrn_id = '0:' . $orig_id;
    }
    $sec = random_string();
    q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)\n\t\t\tVALUES( %d, %s, '%s', '%s', %d )", intval(api_user()), intval($cid), dbesc($dfrn_id), dbesc($sec), intval(time() + 45));
    logger($r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
    $dest = $url ? '&destination_url=' . $url : '';
    goaway($r[0]['poll'] . '?dfrn_id=' . $dfrn_id . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest . $quiet);
}
api_register_func('api/friendica/remoteauth', 'api_friendica_remoteauth', true);
function api_share_as_retweet(&$item)
{
    $body = trim($item["body"]);
    // Skip if it isn't a pure repeated messages
    // Does it start with a share?
    if (strpos($body, "[share") > 0) {
        return false;
    }
    // Does it end with a share?
    if (strlen($body) > strrpos($body, "[/share]") + 8) {
        return false;
    }
    $attributes = preg_replace("/\\[share(.*?)\\]\\s?(.*?)\\s?\\[\\/share\\]\\s?/ism", "\$1", $body);
    // Skip if there is no shared message in there
    if ($body == $attributes) {
Exemple #2
0
}
function api_oauth_access_token(&$a, $type)
{
    try {
        $oauth = new FKOAuth1();
        $req = OAuthRequest::from_request();
        $r = $oauth->fetch_access_token($req);
    } catch (Exception $e) {
        echo "error=" . OAuthUtil::urlencode_rfc3986($e->getMessage());
        killme();
    }
    echo $r;
    killme();
}
api_register_func('api/oauth/request_token', 'api_oauth_request_token', false);
api_register_func('api/oauth/access_token', 'api_oauth_access_token', false);
/*
Not implemented by now:
statuses/retweets_of_me
friendships/create
friendships/destroy
friendships/exists
friendships/show
account/update_location
account/update_profile_background_image
account/update_profile_image
blocks/create
blocks/destroy

Not implemented in status.net:
statuses/retweeted_to_me
Exemple #3
0
        return false;
    }
    if (!$_REQUEST['photo_id']) {
        return false;
    }
    $scale = array_key_exists('scale', $_REQUEST) ? intval($_REQUEST['scale']) : 0;
    $r = q("select * from photo where uid = %d and `resource-id` = '%s' and scale = %d limit 1", intval(local_user()), dbesc($_REQUEST['photo_id']), intval($scale));
    if ($r) {
        header("Content-type: application/json");
        $r[0]['data'] = base64_encode($r[0]['data']);
        echo json_encode($r[0]);
    }
    killme();
}
api_register_func('api/friendica/photos/list', 'api_fr_photos_list', true);
api_register_func('api/friendica/photo', 'api_fr_photo_detail', true);
function api_share_as_retweet($a, $uid, &$item)
{
    $body = trim($item["body"]);
    // Skip if it isn't a pure repeated messages
    // Does it start with a share?
    if (strpos($body, "[share") > 0) {
        return false;
    }
    // Does it end with a share?
    if (strlen($body) > strrpos($body, "[/share]") + 8) {
        return false;
    }
    $attributes = preg_replace("/\\[share(.*?)\\]\\s?(.*?)\\s?\\[\\/share\\]\\s?/ism", "\$1", $body);
    // Skip if there is no shared message in there
    if ($body == $attributes) {