Esempio n. 1
0
     $message = "success";
 } else {
     if ($_GET['object'] == "wallpost") {
         $object = new WallPost();
         $object->tousername = $_POST["tousername"];
         $object->fromusername = $_POST["fromusername"];
         $object->message = $_POST["message"];
         if (isset($_FILES['picture'])) {
             $file = new File($_FILES['picture']);
             $object->picture = $file->data;
         }
         $object->create();
         $message = "success";
     } else {
         if ($_GET['object'] == "likedboxsnap") {
             $object = LikedBoxSnap::exists($_POST["boxsnapid"], $_POST["username"]);
             if (!$object) {
                 $object = new LikedBoxSnap();
                 $object->boxsnapid = $_POST["boxsnapid"];
                 $object->username = $_POST["username"];
                 $object->create();
             } else {
                 $object = LikedBoxSnap::get_by_id_username($_POST["boxsnapid"], $_POST["username"]);
                 if ($object) {
                     $object->delete();
                 }
             }
             $message = "success";
         } else {
             if ($_GET['object'] == "boxsnapcomment") {
                 $object = new BoxSnapComment();
Esempio n. 2
0
                 $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) {
                 $theFile = "images/boxsnaps/" . $object->id . ".jpg";
                 if (!file_exists($theFile)) {