<?php

require '../header.php';

$data = array();
$data["success"] = false;

if ( !isset($_REQUEST['albumid']) || !isset($_REQUEST['title']) || ($_REQUEST['title'] == "") ) {
    sendResponse($data);
}

$album = new Album($_REQUEST['albumid']);
if ( $album->getID() == 0 ) {
    sendResponse($data);
}

$album->setTitle($_REQUEST['title']);
$album->setDescription($_REQUEST['description']);
$album->save();
$data["success"] = true;
$data["album"] = $album;

sendResponse($data);

function sendResponse($data) {
    header('Content-Type: application/json');
    echo json_encode($data);
    exit();
}

exit();

// vim: set ts=4:sw=4
