$object->name = $extendedprofile->name; 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"; } $object->likes = count(LikedBoxSnap::get_all_by_boxsnapid($object->id)); $object->comments = count(BoxSnapComment::get_all_by_boxsnapid($object->id)); if (isset($_GET['username'])) { if (LikedBoxSnap::exists($object->id, $_GET['username'])) { $object->liked = true; } } } } $response = $objects; } else { if ($_GET['object'] == "wallpost") { $sql = "SELECT * FROM " . T_WALLPOSTS . " WHERE " . C_WALLPOST_TOUSERNAME . "='" . $_GET['tousername'] . "' ORDER BY id DESC LIMIT 20"; $objects = WallPost::get_by_sql($sql); $filename = 0; if (count($objects) > 0) { foreach ($objects as $object) {