<?php

chdir("../../database");
require_once "storeFrontend.php";
if (isset($_GET["productId"]) and isset($_GET["userId"])) {
    $productId = intval($_GET["productId"]);
    $userId = intval($_GET["userId"]);
    if (!favoriteExists($userId, $productId)) {
        setFavorite($userId, $productId);
    }
    echo json_encode(array("result" => "ok"));
} else {
    echo json_encode(array("result" => "missingParams"));
}
Ejemplo n.º 2
0
 session_start();
 $action = $_POST['action'];
 if (isset($_POST['recipeId'])) {
     $recipeId = $_POST['recipeId'];
 }
 if (isset($_POST['type'])) {
     $type = $_POST['type'];
 }
 $username = $_SESSION["username"];
 include 'connection.php';
 switch ($action) {
     case 'save':
         setFavorite(1, $username, $recipeId);
         break;
     case 'delete':
         setFavorite(0, $username, $recipeId);
         break;
     case 'byName':
         if ($type == "myFridge") {
             recipes($username);
         } else {
             if ($type == "quick") {
                 quickRecipes(15);
             } else {
                 searchRecipes($type);
             }
         }
         break;
     case 'byRating':
         if ($type == "myFridge") {
             recipes($username);
Ejemplo n.º 3
0
     deployErrorNotification();
     break;
 case 'sendNotifications':
     Utils::validateAPIKey();
     sendNotifications();
     break;
 case 'checkInactiveProjects':
     Utils::validateAPIKey();
     checkInactiveProjects();
     break;
 case 'checkRemovableProjects':
     Utils::validateAPIKey();
     checkRemovableProjects();
     break;
 case 'setFavorite':
     setFavorite();
     break;
 case 'getBonusHistory':
     getBonusHistory();
     break;
 case 'getMultipleBidList':
     getMultipleBidList();
     break;
 case 'getProjects':
     $userId = isset($_SESSION['userid']) ? $_SESSION['userid'] : 0;
     $currentUser = User::find($userId);
     getProjects(!$currentUser->isInternal());
     break;
 case 'getUserList':
     getUserList();
     break;