forked from florisweb/projectcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiMap.php
More file actions
33 lines (24 loc) · 957 Bytes
/
miniMap.php
File metadata and controls
33 lines (24 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
$_projectId = (string)$_GET["projectId"];
if(!isset($_projectId)) die("No projectId supplied.");
$project = getProject($_projectId);
if (!$project) die("Couldn't find project.");
$miniMapName = getMiniMapName($project);
$url = "images/maps/" . $miniMapName . ".png";
if (!file_exists($url)) die();
echo file_get_contents($url, true);
function getProject($_projectId) {
$projects = json_decode(file_get_contents("uploads/data.txt"), true);
for ($i = 0; $i < sizeof($projects); $i++)
{
$project = $projects[$i];
if ($project["id"] != $_projectId) continue;
if (!$project["type"]["genMiniMap"]) continue;
return $project;
}
return false;
}
function getMiniMapName($_project) {
return "miniMapX" . $_project["coords"]["x"] . "Z" . $_project["coords"]["z"] . "R" . $_project["type"]["range"];
}
?>