summaryrefslogtreecommitdiff
path: root/icons.php
blob: 6babbdc7c9115c82e55141f307fcdab076c23649 (plain)
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
<?php

if (isset($_GET["_"])) {
    $name = $_GET["_"];

    if ($name === "." || $name === ".." || str_contains($name, "/")) {
        die();
    }

    if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/icons/new/" . $name)) {
        die();
    }
} else {
    die();
}

if (isset($_GET["color"])) {
    if (hexdec($_GET["color"]) > 0 && hexdec($_GET["color"]) < 16777215) {
        $color = trim($_GET["color"]);
    } else {
        $color = "000000";
    }
} else {
    $color = "000000";
}

header("Content-Type: image/svg+xml");

echo(str_replace(' width="48">', ' width="48" fill="#' . $color . '">', file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/icons/new/" . $name)));