コード例 #1
0
ファイル: action_deleteAlbum.php プロジェクト: Areadrill/ltw
<?require_once('session_check.php');
if(!isset($_GET["id"])){
  http_response_code(400);
  exit();
}

require_once("album.php");
$owners = getAlbumAllowedEditors($_GET["id"]);

if(!isset($_SESSION["id"]) || !in_array($_SESSION["id"], $owners, TRUE)){
  http_response_code(403);
  exit();
}

if(!existsAlbum($_GET["id"])){
  http_response_code(404);
  exit();
}
$album = getAlbum($_GET["id"]);

$deleted = deleteAlbum($_GET["id"]);
var_dump($deleted);
if(!$deleted){
  http_response_code(500);
  exit;
}
http_response_code(200);

header("Location: ../event.php?id=".$album["eid"]);
?>
コード例 #2
0
<?
require_once('session_check.php');
require_once("album.php");
if(existsAlbum($_POST["albumId"])){
  addAlbumPhoto($_POST["albumId"],$_FILES["albumImage"]);
  $eventID = getAlbum($_POST["albumId"])["eid"];
  http_response_code(200);
  if(1){//!isset($_POST["return_json"]) && $_POST["return_json"]){
    echo json_encode(getAlbumImages(getAlbum($_POST["albumId"])));

  }
  else
    header("Location: ../manageAlbums.php?eid=".$eventID);
}
else{
  http_response_code(400);
  header("Location: ../index.php");
}
コード例 #3
0
<?require_once('session_check.php');
if(!isset($_POST["aid"]) || !isset($_POST["iid"])){
  http_response_code(400);
  exit();
}

require_once("album.php");
$owners = getAlbumAllowedEditors($_POST["aid"]);
$album = getAlbum($_POST["aid"]);
if(!isset($_SESSION["id"]) || !in_array($_SESSION["id"], $owners, TRUE) ){
  http_response_code(403);
  exit();
}

if(!existsAlbum($_POST["aid"])|| !imageInAlbum($_POST["iid"], $_POST["aid"])){
  http_response_code(404);
  exit();
}

require("connect.php");
$stmt2 = $db->prepare("DELETE FROM ImageAlbum WHERE iid=? and aid=?");
$res2 = $stmt2->execute(array($_POST["iid"], $_POST["aid"]));
$stmt = $db->prepare('DELETE FROM Image WHERE iid=?');
$res = $stmt->execute(array($_POST["iid"]));

if(!$res || !$res2){
  http_response_code(500);
  var_dump($_POST["iid"]);
  exit;
}
http_response_code(200);
コード例 #4
0
ファイル: view_album.php プロジェクト: Areadrill/ltw
<?
session_start();
require_once("database/album.php");
if(!isset($_GET['id'])){
  http_response_code(400);
  ?><p> No album was specified </p><?
  exit;
}

if(!existsAlbum($_GET['id'])){
  http_response_code(404);
  ?><p> The album does not exist in the server </p><?
  exit;
}
$album = getAlbum($_GET['id']);
$eventId = intval(getAlbum($_GET['id'])['eid']);
$albumImages = getAlbumImages($album);
?>

<!DOCTYPE html>
<html>
  <head>
    <?require_once('includes.php');?>
    <script type="text/javascript" src="scripts/view_album.js"></script>
    <link rel="stylesheet" type="text/css" href="stylesheets/album.css" >

  </head>
  <body>
    <?require_once('templates/header.php');?>
    <section id="album">
    <h1> <?echo $album['nome'];?></h1>
コード例 #5
0
ファイル: action_renameAlbum.php プロジェクト: Areadrill/ltw
if(strlen($_POST['newName']) == 0 || strlen($_POST['newName']) > 50){
  http_response_code(400);
  exit();
}

if(!isset($_SESSION["id"])){
  http_response_code(401);
  exit;
}

if(!in_array($_SESSION["id"], getAlbumAllowedEditors($_POST["aid"]))){
  http_response_code(403);
  exit;
}

if(!existsAlbum($_POST["aid"])){
  http_response_code(404);
  exit();
}

$res = renameAlbum($_POST["aid"], $_POST["newName"]);

if(!$res)
{
  http_response_code(500);
  exit;
}

$album = getAlbum($_POST["aid"]);

echo json_encode($album["nome"]);