-
Notifications
You must be signed in to change notification settings - Fork 0
/
recomendar.php
54 lines (45 loc) · 1.64 KB
/
recomendar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
* recomendar.php
*/
include_once 'constants.php';
include_once LIB_PATH.'moods.php';
include_once LIB_PATH.'display.php';
$invite_href = "recomendar.php"; // Rename this as needed
$fb = get_fb();
$user = $fb->require_login();
echo render_header("recomendar");
if(isset($_POST["ids"])) {
echo "<center>Gracias por invitar a ".sizeof($_POST["ids"])." de tus amigos a <b><a href=\"".URL_APP."\"><fb:application-name /></a></b>.<br><br>\n</center>";
}
else { // Retrieve array of friends who've already added the app.
$fql = 'SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$user.') AND is_app_user = 1';
$_friends = $fb->api_client->fql_query($fql);
// Extract the user ID's returned in the FQL request into a new array.
$friends = array();
if (is_array($_friends) && count($_friends)) {
foreach ($_friends as $friend) {
$friends[] = $friend['uid'];
}
}
// Convert the array of friends into a comma-delimeted string.
$friends = implode(',', $friends);
// Prepare the invitation text that all invited users will receive.
$content =
"<a href=\"".URL_APP."\"><fb:application-name /></a> ".DESCRIPCION."\n".
"<fb:req-choice url=\"".$fb->get_add_url()."\" label=\"Incluir ".NAME_APP." en tu perfil\"/>";
?>
<fb:request-form
action="<? echo $invite_href; ?>"
method="post"
type="<?=NAME_APP?>"
content="<? echo htmlentities($content); ?>"
image="<?=URL_LOGO?>">
<fb:multi-friend-selector
actiontext="Estos son los amigos que aún no utilizan <?=NAME_APP?>. Invítalos! Es gratis! :P"
bypass="cancel"
exclude_ids="<? echo $friends; ?>" />
</fb:request-form>
<?
}
?>