} if (isset($_GET['action'])) { $action = $_GET['action']; if (isset($_POST['username']) && isset($_POST['auth_token']) || isset($_GET['username']) && isset($_GET['auth_token'])) { if (isset($_POST['username']) && isset($_POST['auth_token'])) { $username = $_POST['username']; $auth_token = $_POST['auth_token']; } if (isset($_GET['username']) && isset($_GET['auth_token'])) { $username = $_GET['username']; $auth_token = $_GET['auth_token']; } $snapchat = new Snapchat(); $snapchat->username = $username; $snapchat->auth_token = $auth_token; if (ExtendedProfile::get_by_username($snapchat->username) == false) { $object = new ExtendedProfile(); $object->username = $snapchat->username; $object->create(); } if ($action == "getupdates") { $result = $snapchat->getUpdates2(); formatSnaps($result, $snapchat); $response->status = OKAY; $response->message = $result; } if ($action == "getcaptcha") { $result = $snapchat->getCaptcha(); $response->status = OKAY; $response->message = $result; }
// EXTENDED PROFILE PICTURE $toextendedprofile = ExtendedProfile::get_by_username($object->tousername); if ($extendedprofile && $extendedprofile->picture) { $theFile = "images/extendedprofiles/" . $extendedprofile->id . ".jpg"; if (!file_exists($theFile)) { file_put_contents($theFile, base64_decode($extendedprofile->picture)); } else { if (filesize($theFile) == 0) { file_put_contents($theFile, base64_decode($extendedprofile->picture)); } } $object->profilepicture = HOST . "slir/w100/snapchat/includes/webservices/images/extendedprofiles/" . $extendedprofile->id . ".jpg"; } else { $object->profilepicture = "http://i.imgur.com/tmqV1Vo.png"; } $fromextendedprofile = ExtendedProfile::get_by_username($object->fromusername); if ($fromextendedprofile && $fromextendedprofile) { $theFile = "images/extendedprofiles/" . $fromextendedprofile->id . ".jpg"; if (!file_exists($theFile)) { file_put_contents($theFile, base64_decode($fromextendedprofile->picture)); } else { if (filesize($theFile) == 0) { file_put_contents($theFile, base64_decode($fromextendedprofile->picture)); } } $object->fromprofilepicture = HOST . "includes/webservices/images/extendedprofiles/" . $fromextendedprofile->id . ".jpg"; } } } $response = $objects; } else {