<?php

require "../header.php";

$filter = "";
if ( isset($_REQUEST["filter"]) ) $filter = $_REQUEST["filter"];
if ( $filter === "" ) {
   $filter = null;
} else {
   $filter = "%" . str_replace("%", "", $filter) . "%";
}

$data = array();
$data["error"] = false;
$data["message"] = "";
$data["images"] = MTGImage::getList($filter);
$data["validated"] = $_SESSION["validated"];

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