Esempio n. 1
0
// FBOPEN:SETUP - replace with your own user transmitted as you see fit.
// The normal FBJS system relies on cookies sent, but the open source
// makes no assumptions about the availability of cookies.
// Logged in users have a verified (hashed) cookie set, so
// it is useful to verify these cookies' hashes so as to prevent
// requests masquerading as an incorrect user.
$user = 1240077;
param_post(array('appid' => $PARAM_INT, 'query' => $PARAM_RAW, 'type' => $PARAM_INT, 'url' => $PARAM_STRING, 'fb_mockajax_context' => $PARAM_STRING, 'fb_mockajax_context_hash' => $PARAM_STRING));
$app_id = $post_appid;
if (!$app_id) {
    error_log('No app_id specified in fbjs_ajax_proxy');
    exit;
}
if (is_array($post_query)) {
    // PARAM_RAW needs noslashes
    $post_query = $post_query ? noslashes_recursive($post_query) : array();
} else {
    if ($post_query) {
        // PARAM_RAW needs noslashes
        $post_query = parse_querystring(noslashes($post_query));
    } else {
        $post_query = array();
    }
}
$FBJS_TYPES = array('RAW' => 0, 'JSON' => 1, 'FBML' => 2);
function render_fbjs_ajax_fbml_recursive($impl, &$array)
{
    foreach ($array as $key => $value) {
        if (substr($key, 0, 5) == 'fbml_') {
            $array[$key] = fbml_sample_parse($value, $impl);
        } else {
Esempio n. 2
0
    case 'iframe':
        $use_iframe = true;
        break;
    default:
        $use_iframe = $app_info['use_iframe'];
        break;
}
if ($use_iframe) {
    $fbml_from_callback = '<fb:iframe src="' . htmlize_filters($url) . '" smartsize="true" frameborder="0"/>';
} else {
    //
    // If we are interpreting a regular form, then we avoid the mangling that
    // happens when PHP constructs $_POST by interpreting the urlencoded form
    // directly from php://input.
    //
    $in_post_vars = noslashes_recursive($_POST);
    if (is_multipart_form()) {
        $post_tuples = null;
    } else {
        $in_post_tuples = php_input_raw_post_vars();
        $post_tuples = array();
        foreach ($in_post_tuples as $param_val) {
            $post_tuples[] = $param_val;
        }
    }
    list($others, $post_vars) = api_get_valid_fb_params($in_post_vars, $app_info['secret']);
    // If we took POST tuples that we want to pass along raw, then we
    // won't use the vars we got from $_POST
    if ($post_tuples !== null) {
        $post_vars = array();
    }