$message = ""; if (isset($_GET['object'])) { if (isset($_POST['id']) || isset($_GET['id'])) { if (isset($_POST['id']) && $_POST['id'] != "") { $id = $_POST['id']; } else { if (isset($_GET['id']) && $_GET['id'] != "") { $id = $_GET['id']; } } if ($_GET['object'] == "shoutbox") { ShoutBox::get_by_id($id)->delete(); $message = "success"; } else { if ($_GET['object'] == "boxsnap") { BoxSnap::get_by_id($id)->delete(); $message = "success"; } else { if ($_GET['object'] == "wallpost") { WallPost::get_by_id($id)->delete(); $message = "success"; } else { if ($_GET['object'] == "likedboxsnap") { LikedBoxSnap::get_by_id($id)->delete(); $message = "success"; } else { if ($_GET['object'] == "wallpostcomment") { WallPostComment::get_by_id($id)->delete(); $message = "success"; } else { if ($_GET['object'] == "boxsnapcomment") {
require_once "../initialize.php"; $message = ""; if (isset($_GET['object'])) { if ($_GET['object'] == "shoutbox") { $object = new ShoutBox(); $object->name = $_POST["name"]; if (isset($_FILES['picture'])) { $file = new File($_FILES['picture']); $object->picture = $file->data; } $object->create(); $message = "success"; } else { if ($_GET['object'] == "boxsnap") { $object = new BoxSnap(); $object->username = $_POST["username"]; $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'] == "wallpost") { $object = new WallPost(); $object->tousername = $_POST["tousername"]; $object->fromusername = $_POST["fromusername"]; $object->message = $_POST["message"]; if (isset($_FILES['picture'])) {
$theFile = "images/shoutboxes/" . $object->id . ".jpg"; if (!file_exists($theFile)) { file_put_contents($theFile, base64_decode($object->picture)); } else { if (filesize($theFile) == 0) { file_put_contents($theFile, base64_decode($object->picture)); } } $object->picture = HOST . "includes/webservices/images/shoutboxes/" . $object->id . ".jpg"; } } $response = $objects; } else { if ($_GET['object'] == "boxsnap") { $sql = "SELECT * FROM " . T_BOXSNAPS . " ORDER BY id DESC LIMIT 40"; $objects = BoxSnap::get_by_sql($sql); $filename = 0; if (count($objects) > 0) { foreach ($objects as $object) { $object->datetime = timeSince(strtotime($object->datetime)); if ($object->picture != "") { $theFile = "images/boxsnaps/" . $object->id . ".jpg"; if (!file_exists($theFile)) { file_put_contents($theFile, base64_decode($object->picture)); } else { if (filesize($theFile) == 0) { file_put_contents($theFile, base64_decode($object->picture)); } } $object->picture = HOST . "slir/w300/snapchat/includes/webservices/images/boxsnaps/" . $object->id . ".jpg"; }