require_once DIR_APP . 'projects.php'; $user_id = $_SESSION['uid']; readNotifications($user_id); $responce['result'] = 'OK'; echo json_encode($responce); break; case 'route-this-project': require_once DIR_APP . 'users.php'; require_once DIR_APP . 'projects.php'; $id = AddProjectRouter($_POST['project_id'], $_SESSION['uid'], $_POST['sent_to']); if (!empty($id)) { $responce['result'] = 'OK'; $responce['id'] = $id; $responce['user_id'] = $_POST['sent_to']; $responce['user'] = getUserNameById($_POST['sent_to']); addSuggestion($_POST['project_id'], $_POST['sent_to'], $_SESSION['uid']); $project_title = getProjectTitle($_POST['project_id']); $author = getUserNameById($_SESSION['uid']); $url = SITE_URL . '/home.php?pid=' . $_POST['project_id']; $text = $author . ' suggested project ' . $project_title; addNotification($_POST['sent_to'], $text, $_SESSION['uid'], $url); } else { $responce['result'] = 'FALSE'; } echo json_encode($responce); break; case 'unroute-this-user': require_once DIR_APP . 'users.php'; require_once DIR_APP . 'projects.php'; $user = getUserNameById($_POST['user_id']); if (RemoveRouterId($_POST['router_id'])) {
} return $result; } if (isset($_GET["suggestion"])) { $suggestion = $_GET["suggestion"]; $motivation = ""; $verification = ""; if (isset($_GET["motivation"])) { $motivation = $_GET["motivation"]; } if (isset($verification)) { $verification = $_GET["verification"]; } else { header("Content-Type: application/json;charset=utf-8"); die(json_encode(array("error" => "Missing validation"))); } header("Content-Type: application/json;charset=utf-8"); echo json_encode(array("result" => addSuggestion($suggestion, $verification, $motivation))); } if (isset($_GET["list"])) { header("Content-Type: application/json;charset=utf-8"); echo json_encode(getSuggestions()); } if (isset($_GET["vote"])) { header("Content-Type: application/json;charset=utf-8"); echo json_encode(vote(filter_var($_GET["id"], FILTER_SANITIZE_NUMBER_INT))); } if (isset($_GET["votes"])) { header("Content-Type: application/json;charset=utf-8"); echo json_encode(getVotes()); }