sex/news.php

47 lines
1.5 KiB
PHP

<!-- Copyright 2008 Neil Edelman, distributed under the terms of the
GNU General Public License, see copying.txt -->
<div style = "text-align: right;">
<a href = "index.php">back</a>
</div>
<h1>Advertise</h1>
<p>
This advertises your position on your newsfeed. You may need to change the
<a href = "http://www.facebook.com/editapps.php">settings</a> for Sex so that
it has permission to write to your wall. You can always delete to story or
change the size.
</p>
<div style = "text-align: center;">
<?php
require_once 'fb/facebook.php';
require 'sex.php';
global $sex;
$apikey = 'd35c4d090afad9b89dc6f50edab81b95';
$secret = '1252a1a9dadb492f70a278eebd31ef73';
$fb = new Facebook($apikey, $secret);
$user = $fb->require_login();
$bundle = 48640476760;
if(isset($_POST['sex']) && $_POST['sex'] == 'foo') {
if(($pos = SexExtract($fb->api_client->profile_getFBML($user))) == null) {
echo 'That\'s fucked up. Try choosing your position again.';
break;
}
echo 'Publishing '.$pos.' . . . ';
$replace = '{"pos":"'.$sex[$pos][0].'","images":[{'.
'"src":"http://www.cs.mcgill.ca/~nedelm/sex/stuff/'.$pos.'.jpg",'.
'"href":"http://apps.facebook.com/sexfuck/"}]}';
try {
$fb->api_client->feed_publishUserAction($bundle, $replace, null, null, 2);
} catch(Exception $e) {
echo 'OhNo! '.$e->getMessage().'.';
}
} else {
echo '<form action = "news.php" method = "post">'.
'<input type = "hidden" value = "foo" name = "sex">'.
'<input type = "submit" value = "Do It" class = "inputsubmit">';
}
?>
</div>