Created
March 28, 2012 12:33
-
-
Save awojnowski/2225816 to your computer and use it in GitHub Desktop.
Facebook Bootstrap Automater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function retrieve_graph($input) { | |
$json = file_get_contents('http://graph.facebook.com/' . $input); | |
$json = json_decode($json); | |
if (isset($json->error) || !$json) return null; | |
return $json; | |
} | |
function strip_utf($string) { | |
for ($i = 0; $i < strlen ($string); $i++) if (ord($string[$i]) > 127) $string[$i] = " "; | |
return $string; | |
} | |
$graph_array; | |
$bootstrap_array; | |
$boostrap_url; | |
if (isset($_POST['bootstrap'])) { | |
$bootstrap = $_POST['bootstrap']; | |
$bootstrap = str_replace('for (;;);','',$bootstrap); | |
$bootstrap = stripslashes($bootstrap); | |
$bootstrap_array = json_decode($bootstrap); | |
} else if (isset($_GET['id'])) { | |
$uid = $_GET['id']; | |
if (is_numeric($uid)) { | |
$graph_array = retrieve_graph($uid); | |
} | |
if (!is_numeric($uid) && !$graph_array) { | |
$graph_array = retrieve_graph($uid); | |
} | |
if ($graph_array) { | |
// go ahead and create the url now that we know about the user | |
$bootstrap_url = 'https://www.facebook.com/ajax/typeahead/search/bootstrap.php?__a=1&viewer=' . $graph_array->id . '&__user=' . $graph_array->id; | |
} | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Fazebooq</title> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
}); | |
</script> | |
<style type="text/css"> | |
body { | |
margin:0; | |
padding:0; | |
font-family:Helvetica, Arial; | |
} | |
div#container { | |
margin-left:auto; | |
margin-right:auto; | |
margin-top:50px; | |
margin-bottom:50px; | |
width:800px; | |
} | |
a.entry { | |
display:block; | |
margin:5px; | |
padding:10px; | |
height:50px; | |
background-color:#EEE; | |
color:#000; | |
text-decoration:none; | |
overflow:hidden; | |
} | |
a.entry:hover { | |
background-color:#FFF; | |
} | |
div.number { | |
height:50px; | |
line-height:50px; | |
color:#AAA; | |
float:right; | |
} | |
img.image { | |
float:left; | |
} | |
div.content { | |
float:left; | |
margin-left:10px; | |
} | |
span.desc { | |
font-style:italic; | |
font-size:12px; | |
color:#666; | |
} | |
div#version { | |
position:fixed; | |
right:5px; | |
bottom:5px; | |
font-size:12px; | |
color:#999; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="version">alpha 0.3.3</div> | |
<div id="container"> | |
<?php if ($bootstrap_url) { ?> | |
This page retrieves the profiles and pages of the people that you view most often on Facebook. Also showing up are some profiles that | |
you viewed recently. <strong>NOTE: This will not work if this user is not you.</strong><br /><br /> | |
Visit the page below, and copy the text that appears. Then, copy it to the field below and click "Submit".<br /><br /> | |
<strong>Ctrl + A</strong> - Select All<br /> | |
<strong>Ctrl + C</strong> - Copy<br /> | |
<strong>Ctrl + V</strong> - Paste<br /><br /> | |
Your bootstrap URL: <a href="<?= $bootstrap_url; ?>" target="_blank"><?= $bootstrap_url; ?></a><br /><br /> | |
<form method="post"> | |
<textarea name="bootstrap" style="height:100px; width:800px;"></textarea><br /> | |
<input type="submit" value="Submit" /> | |
</form><br /><br /> | |
<?php } else if ($bootstrap_array) { | |
$entries = $bootstrap_array->payload->entries; | |
$entries_count = count($entries); | |
$i = 0; | |
echo 'You creeper! Here are the profiles/pages that you either view often or recently (total of <strong>' . $entries_count . '</strong>):'; | |
foreach($entries as $user) { | |
$i ++; | |
?> | |
<a class="entry" href="https://facebook.com<?= $user->path; ?>" target="_new"> | |
<div class="number"><?= $i; ?></div> | |
<img src="<?= $user->photo; ?>" class="image" width="50" height="50" /> | |
<div class="content"> | |
<?= $user->text; ?><?php if ($user->uid == $_GET['id']) echo '<strong> (that\'s you)</strong>'; ?><br /> | |
<span class="desc"> | |
<?php if (is_string($user->tokens) > 0) { ?><strong>Alias(es):</strong> <?= $user->tokens; ?><?php } ?> | |
<?php if (is_string($user->category)) { ?><strong>Category:</strong> <?= strip_utf($user->category); ?><?php } ?> | |
<strong>View Index:</strong> <?= $user->index; ?> | |
</span><br /> | |
<span style="color:#6973FF; font-size:12px;">https://facebook.com<?= $user->path; ?></span> | |
</div> | |
</a> | |
<?php | |
} | |
} else { ?> | |
This page retrieves the profiles and pages of the people that you view most often on Facebook. Also showing up are some profiles that | |
you viewed recently. You must be logged in to http://www.facebook.com.<br /><br /> | |
If you know your username or ID on Facebook, enter it here:<br /><br /> | |
<form method="get"> | |
<input type="text" name="id" style="font-size:16px; height:20px; padding:5px; width:250px;" /><br/> | |
<input type="submit" value="Submit" /> | |
</form><br /><br /> | |
<?php } ?> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment