The Facebook App Free Gifts is quite the viral application.
I’m not sure if this was intentional or not, but pretty much the entire application is available for perusal / download via pastie, a tool commonly used by developers to share code snippets.
Some of the app code mirrored below:
// includes
require_once('/fbExchange/code/fbApps/coreLib/globalConfig.php'); // hard code to live config file, NOT beta!
require_once('facebook.php'); // from coreLib
require_once('/fbExchange/code/fbApps/freegifts/lib/lib.php'); // needs total rewrite
//Some facebook stuff
$facebook = new Facebook($api_key, $secret);
$facebook->require_frame();
$appUrl = "http://apps.facebook.com/freegifts";
$callbackUrl = "http://freegifts.fbexchange.com";
...
//Determine the page
if (isset($_GET['to']) && isset($_GET['from']))
$page = "giftToGift";
else if (isset($_GET['from']))
$page = "sentGifts";
else if (isset($_GET['to']))
$page = "receivedGifts";
else if ($_GET['action'] == "single")
$page = "singleGift";
else if ($_GET['action'] == "valentines")
$page = "valentines";
else if ($_GET['action'] == "track")
$page = "track";
else if ($_GET['action'] == "stats")
$page = "stats";
else if ($_GET['action'] == "settings")
$page = "settings";
else
$page = "default";
Update: Zach from Free Gifts sent me a note explaining the situation. I’ve removed my mirror. This kind of thing can happen to the best of us. It’s also just a small portion of the app, not the entire thing.
I stumbled across the code via this Google search.
A little word to the wise: don’t pastie your entire application’s code… unless you intend for it to be open source, that is. 