summaryrefslogtreecommitdiff
path: root/api/removeLibrary.php
blob: 901c3430633be324d66fa5903a26c1179be85043 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php

header("X-Frame-Options: SAMEORIGIN");
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
global $albums; global $_PROFILE; global $library;

if (!isset($_GET["i"]) || !isset($albums[$_GET["i"]])) return;

if (in_array($_GET["i"], $library)) {
    $library = array_filter($library, function ($i) {
        return $i !== $_GET["i"];
    });
}

file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/users/" . $_PROFILE["id"] . "-library.json", json_encode($library));