Example #1
0
                     $object->picture = HOST . "slir/w100/snapchat/includes/webservices/images/extendedprofiles/2" . $object->id . ".jpg";
                 } else {
                     $object->picture = "http://i.imgur.com/tmqV1Vo.png";
                 }
                 $response = $object;
             } else {
                 $response = "Username does not exists.";
             }
         }
     } else {
         $response = "No username specified.";
     }
 } else {
     if ($_GET['object'] == "boxsnapcomment") {
         $sql = "SELECT * FROM " . T_BOXSNAPCOMMENTS . " WHERE boxsnapid = " . $_GET['boxsnapid'] . " ORDER BY id DESC";
         $objects = BoxSnapComment::get_by_sql($sql);
         if (count($objects) > 0) {
             foreach ($objects as $object) {
                 // EXTENDED PROFILE PICTURE
                 $extendedprofile = ExtendedProfile::get_by_username($object->username);
                 $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";