Exemplo n.º 1
0
        }
        if (Input::Get("name")) {
            $params[] = "name=" . urlencode($spintax->get(Input::Get("name")));
        }
        if (Input::Get("caption")) {
            $params[] = "caption=" . urlencode($spintax->get(Input::Get("caption")));
        }
        if (Input::Get("description")) {
            $params[] = "description=" . urlencode($spintax->get(Input::Get("description")));
        }
    } else {
        if (Input::Get("postType") == "image") {
            $params[] = "url=" . $spintax->get(Input::Get("image"));
        } else {
            if (Input::Get("postType") == "video") {
                $params[] = "file_url=" . $spintax->get(Input::Get("file_url"));
                if (Input::Get("message")) {
                    $params[] = "title=" . urlencode($spintax->get(Input::Get("message")));
                }
                if (Input::Get("description")) {
                    $params[] = "description=" . urlencode($spintax->get(Input::Get("description")));
                }
            }
        }
    }
    if ($result = $fb->Post(Input::get("groupID"), $params, Input::Get("postType"))) {
        echo json_encode($result, 128);
    }
} else {
    echo json_encode(array('error' => lang('EMPTY_REQUEST')), 128);
}
Exemplo n.º 2
0
     $params[] = "url=" . urlencode($spintax->get($postParam->image));
 }
 if ($postType == "video") {
     $params[] = "file_url=" . urlencode($spintax->get($postParam->video));
     if ($postParam->description != "") {
         $params[] = "description=" . urlencode($spintax->get($postParam->description));
     }
 }
 // Get app accessToken
 $accessToken = $fb->getAccessToken($scheduled->post_app, $scheduled->fb_account, $scheduled->userid);
 // Test access token
 if (!$fb->IsATValid($accessToken)) {
     logs::Save($scheduled->id, lang('INVALID_ACCESS_TOKEN'));
 } else {
     // Send post and get the result
     $result = (object) $fb->Post($groups[$scheduled->next_target], $params, $postType, $accessToken);
     // Save log
     if (isset($result->status)) {
         if (isset($result->id)) {
             logs::Save($scheduled->id, "<a href='https://www.facebook.com/" . $result->id . "' target='_blank'><span class='glyphicon glyphicon-ok'></span> " . lang('VIEW_POST') . " </a>");
         } else {
             if ($groups[$scheduled->next_target] == "me") {
                 logs::Save($scheduled->id, "Your timeline - " . $result->message);
             } else {
                 logs::Save($scheduled->id, $result->message . " <a href='https://www.facebook.com/groups/" . $groups[$scheduled->next_target] . "' target='_blank'><span class='glyphicon glyphicon-eye-open'></span> " . lang('VISIT_GROUP') . " </a>");
             }
         }
     } else {
         logs::Save($scheduled->id, lang('UNKNOWN_ERROR'));
     }
 }