Ejemplo n.º 1
0
     }
     $um->getAvatarOf($user_id, false);
     break;
 case "uploadAvatar":
     if (!isset($_FILES["avatar"])) {
         echo "You gotta' choose a new image first!";
         return;
     }
     require_once "../framework/BinaryHandler.php";
     $bh = new BinaryHandler();
     $bh->uploadAvatar($_FILES['avatar']);
     break;
 case "getUserName":
     require_once "../framework2/CredentialStore.php";
     $cs = new CredentialStore();
     $un = $cs->getUserName();
     if ($un != "") {
         echo genJSON(200, $un, "");
     } else {
         echo genJSON(404, "User does not exist", "");
     }
     break;
 case "addPost":
     require_once "../framework/PostQuery.php";
     $pq = new PostQuery();
     $category = isset($_POST["cat"]) ? $_POST["cat"] : "";
     $title = isset($_POST["title"]) ? $_POST["title"] : "";
     $author = isset($_POST["author"]) ? $_POST["author"] : "";
     $details = isset($_POST["details"]) ? $_POST["details"] : "";
     $price = isset($_POST["price"]) ? $_POST["price"] : 0;
     $location = isset($_POST["location"]) ? $_POST["location"] : "";
Ejemplo n.º 2
0
     $bh = new BinaryHandler();
     echo $bh->getAvatar();
     break;
 case "uploadAvatar":
     if (!isset($_FILES["avatar"])) {
         echo "You gotta' choose a new image first!";
         return;
     }
     require_once "../framework/BinaryHandler.php";
     $bh = new BinaryHandler();
     $bh->uploadAvatar($_FILES['avatar']);
     break;
 case "getUserName":
     require_once "../framework/CredentialStore.php";
     $cs = new CredentialStore();
     echo $cs->getUserName();
     break;
 case "addPost":
     require_once "../framework/PostQuery.php";
     $pq = new PostQuery();
     $category = isset($_POST["cat"]) ? $_POST["cat"] : "";
     $title = isset($_POST["title"]) ? $_POST["title"] : "";
     $author = isset($_POST["author"]) ? $_POST["author"] : "";
     $details = isset($_POST["details"]) ? $_POST["details"] : "";
     $price = isset($_POST["price"]) ? $_POST["price"] : 0;
     $location = isset($_POST["location"]) ? $_POST["location"] : "";
     $tags = isset($_POST["tags"]) ? $_POST["tags"] : "";
     $isbn = isset($_POST["isbn"]) ? $_POST["isbn"] : 0;
     $school = $pq->cookieCheck("sPref");
     if ($pq->getSchoolName($school) == null) {
         ### Prevent from inserting into nonexisting db ###